From 0bcde8ce1987ba759af391fdc6e99168af51a64d Mon Sep 17 00:00:00 2001 From: Maikel Koek Date: Tue, 27 Mar 2018 10:23:59 +0200 Subject: [PATCH 001/464] Don't throw shipping method exception when creating quote with only virtual products via API --- .../Magento/Checkout/Model/ShippingInformationManagement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php index 381ee2b9015c9..da5620a6ca899 100644 --- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php +++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php @@ -177,7 +177,7 @@ public function saveAddressInformation( $shippingAddress = $quote->getShippingAddress(); - if (!$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod())) { + if (!$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod()) && !$quote->getIsVirtual()) { throw new NoSuchEntityException( __('Carrier with such method not found: %1, %2', $carrierCode, $methodCode) ); From 9afb7bd8b07ea5b2a1357643261846d015a07928 Mon Sep 17 00:00:00 2001 From: Maikel Koek Date: Tue, 27 Mar 2018 11:15:02 +0200 Subject: [PATCH 002/464] Swap condition to check if quote is virtual first --- .../Magento/Checkout/Model/ShippingInformationManagement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php index da5620a6ca899..f4d5c5e7c8287 100644 --- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php +++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php @@ -177,7 +177,7 @@ public function saveAddressInformation( $shippingAddress = $quote->getShippingAddress(); - if (!$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod()) && !$quote->getIsVirtual()) { + if (!$quote->getIsVirtual() && !$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod())) { throw new NoSuchEntityException( __('Carrier with such method not found: %1, %2', $carrierCode, $methodCode) ); From f902d8230a26c3c6dffcfb9af1112d9bfcd4b0af Mon Sep 17 00:00:00 2001 From: Maikel Koek Date: Tue, 27 Mar 2018 11:54:47 +0200 Subject: [PATCH 003/464] Integration test to save address information on virtual quote without exceptions --- .../ShippingInformationManagementTest.php | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php new file mode 100644 index 0000000000000..17cad94ec6f69 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php @@ -0,0 +1,138 @@ +cartManagement = $objectManager->create(CartManagementInterface::class); + $this->cartItemRepository = $objectManager->create(CartItemRepositoryInterface::class); + $this->cartItem = $objectManager->create(CartItemInterface::class); + $this->shippingInformationManagement = $objectManager->create(ShippingInformationManagementInterface::class); + $this->shippingInformation = $objectManager->create(ShippingInformationInterface::class); + $this->customerRepository = $objectManager->create(CustomerRepositoryInterface::class); + $this->apiAddressFactory = $objectManager->create(AddressInterfaceFactory::class); + $this->shipmentEstimation = $objectManager->create(ShipmentEstimationInterface::class); + $this->paymentInformationManagement = $objectManager->create(PaymentInformationManagementInterface::class); + $this->payment = $objectManager->create(PaymentInterface::class); + $this->invoiceOrder = $objectManager->create(InvoiceOrderInterface::class); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Catalog/_files/product_virtual_in_stock.php + */ + public function testQuoteApiWithOnlyVirtualProducts() + { + $customer = $this->customerRepository->getById(1); + + // Create empty quote + $quoteId = $this->cartManagement->createEmptyCartForCustomer($customer->getId()); + + $cartItem = $this->cartItem + ->setSku('virtual-product') + ->setQty(1) + ->setQuoteId($quoteId); + + // Add item to cart + $this->cartItemRepository->save($cartItem); + + $billingAddress = $shippingAddress = null; + foreach ($customer->getAddresses() as $address) { + $billingAddress = $address; + $shippingAddress = $address; + break; + } + + /** @var \Magento\Quote\Model\Quote\Address $apiBillingAddress */ + $apiBillingAddress = $this->apiAddressFactory->create(); + $apiBillingAddress->setRegion($billingAddress->getRegion()) + ->setRegionId($billingAddress->getRegionId()) + ->setCountryId($billingAddress->getCountryId()) + ->setStreet($billingAddress->getStreet()) + ->setPostcode($billingAddress->getPostcode()) + ->setCity($billingAddress->getCity()) + ->setFirstname($billingAddress->getFirstname()) + ->setLastname($billingAddress->getLastname()) + ->setEmail($customer->getEmail()) + ->setTelephone($billingAddress->getTelephone()); + + /** @var \Magento\Quote\Model\Quote\Address $apiShippingAddress */ + $apiShippingAddress = $this->apiAddressFactory->create(); + $apiShippingAddress->setRegion($shippingAddress->getRegion()) + ->setRegionId($shippingAddress->getRegionId()) + ->setCountryId($shippingAddress->getCountryId()) + ->setStreet($shippingAddress->getStreet()) + ->setPostcode($shippingAddress->getPostcode()) + ->setCity($shippingAddress->getCity()) + ->setFirstname($shippingAddress->getFirstname()) + ->setLastname($shippingAddress->getLastname()) + ->setEmail($customer->getEmail()) + ->setTelephone($shippingAddress->getTelephone()); + + // Estimate shipping + $this->shipmentEstimation->estimateByExtendedAddress($quoteId, $apiShippingAddress); + + $addressInformation = $this->shippingInformation + ->setBillingAddress($apiBillingAddress) + ->setShippingAddress($apiShippingAddress) + ->setShippingCarrierCode('flatrate') + ->setShippingMethodCode('flatrate'); + + // Set address information on quote + $this->shippingInformationManagement->saveAddressInformation($quoteId, $addressInformation); + } +} From a89e84acfdc44fcbf8b6b76d000cd15243c3aa7b Mon Sep 17 00:00:00 2001 From: Maikel Koek Date: Tue, 27 Mar 2018 12:24:40 +0200 Subject: [PATCH 004/464] Import Bootstrap class to use in setUp method --- .../Checkout/Model/ShippingInformationManagementTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php index 17cad94ec6f69..f962ffe1a83a1 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php @@ -6,6 +6,7 @@ namespace Magento\Checkout\Model; +use Magento\TestFramework\Helper\Bootstrap; use Magento\Checkout\Api\Data\ShippingInformationInterface; use Magento\Checkout\Api\PaymentInformationManagementInterface; use Magento\Checkout\Api\ShippingInformationManagementInterface; @@ -55,7 +56,7 @@ class ShippingInformationManagementTest extends \PHPUnit\Framework\TestCase public function setUp() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager = Bootstrap::getObjectManager(); $this->cartManagement = $objectManager->create(CartManagementInterface::class); $this->cartItemRepository = $objectManager->create(CartItemRepositoryInterface::class); From 1279654f39f81cd6ea36d01702ed8d204b4b8af6 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Sun, 23 Sep 2018 15:28:51 +0300 Subject: [PATCH 005/464] to revert --- .../view/frontend/layout/sales_email_item_price.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/frontend/layout/sales_email_item_price.xml b/app/code/Magento/Tax/view/frontend/layout/sales_email_item_price.xml index 0fe801a71b937..5dc1e5c72313d 100644 --- a/app/code/Magento/Tax/view/frontend/layout/sales_email_item_price.xml +++ b/app/code/Magento/Tax/view/frontend/layout/sales_email_item_price.xml @@ -5,7 +5,8 @@ * See COPYING.txt for license details. */ --> - + @@ -16,3 +17,10 @@ + + + + + + + From 3f43dfe3f790cd6a9e69cf1a2b48f72667ce4a54 Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Mon, 22 Oct 2018 12:15:34 -0400 Subject: [PATCH 006/464] Add a module manager to the Magento Framework API --- app/etc/di.xml | 1 + .../Magento/Framework/Module/Manager.php | 14 +++-------- .../Module/ModuleManagerInterface.php | 24 +++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 lib/internal/Magento/Framework/Module/ModuleManagerInterface.php diff --git a/app/etc/di.xml b/app/etc/di.xml index db979f9b76382..da8c7e8d29798 100755 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -64,6 +64,7 @@ + diff --git a/lib/internal/Magento/Framework/Module/Manager.php b/lib/internal/Magento/Framework/Module/Manager.php index a9a3d2294a90f..debdf3ab2b692 100644 --- a/lib/internal/Magento/Framework/Module/Manager.php +++ b/lib/internal/Magento/Framework/Module/Manager.php @@ -10,14 +10,9 @@ namespace Magento\Framework\Module; /** - * Module status manager. - * - * Usage: - * ```php - * $manager->isEnabled('Vendor_Module'); - * ``` + * @inheritdoc */ -class Manager +class Manager implements ModuleManagerInterface { /** * @var Output\ConfigInterface @@ -52,10 +47,7 @@ public function __construct( } /** - * Whether a module is enabled in the configuration or not - * - * @param string $moduleName Fully-qualified module name - * @return boolean + * @inheritdoc */ public function isEnabled($moduleName) { diff --git a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php new file mode 100644 index 0000000000000..ea1f17870ce9a --- /dev/null +++ b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php @@ -0,0 +1,24 @@ +isEnabled('Vendor_Module'); + * ``` + * + * @api + */ +interface ModuleManagerInterface +{ + /** + * Retrieve whether or not a module is enabled by configuration + * + * @param string $moduleName Fully-qualified module name, e.g. Magento_Config + * @return boolean Whether or not the module is enabled in the configuration + */ + public function isEnabled($moduleName); +} From c88cf519102d21eaa55d2f3a86013deeecb3b7aa Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Tue, 23 Oct 2018 07:57:28 -0400 Subject: [PATCH 007/464] Strictly define the types for ModuleManagerInterface::isEnabled --- lib/internal/Magento/Framework/Module/Manager.php | 4 +++- .../Magento/Framework/Module/ModuleManagerInterface.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Manager.php b/lib/internal/Magento/Framework/Module/Manager.php index debdf3ab2b692..659ada3c20ac8 100644 --- a/lib/internal/Magento/Framework/Module/Manager.php +++ b/lib/internal/Magento/Framework/Module/Manager.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + /** * Module statuses manager */ @@ -49,7 +51,7 @@ public function __construct( /** * @inheritdoc */ - public function isEnabled($moduleName) + public function isEnabled(string $moduleName): bool { return $this->moduleList->has($moduleName); } diff --git a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php index ea1f17870ce9a..04c3fbbbd318b 100644 --- a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php +++ b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php @@ -20,5 +20,5 @@ interface ModuleManagerInterface * @param string $moduleName Fully-qualified module name, e.g. Magento_Config * @return boolean Whether or not the module is enabled in the configuration */ - public function isEnabled($moduleName); + public function isEnabled(string $moduleName): bool; } From f1a1ba66b1892886eb2a27826aad3b83f9cd3edd Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Tue, 29 Jan 2019 15:31:52 +0200 Subject: [PATCH 008/464] ENGCOM-3260: Unit and static tests fix. --- .../Magento/Framework/Module/ModuleManagerInterface.php | 4 ++++ .../Magento/Framework/Module/Test/Unit/ManagerTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php index 04c3fbbbd318b..464291a019c21 100644 --- a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php +++ b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php @@ -1,4 +1,8 @@ _moduleList->expects($this->once())->method('has')->with('Disabled_Module')->willReturn(false); $this->_outputConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue(true)); $this->assertFalse($this->_model->isOutputEnabled('Disabled_Module')); } From 6409dbecac36b69629d3665dc529d43427af72f6 Mon Sep 17 00:00:00 2001 From: "v.sikailo" Date: Thu, 31 Jan 2019 12:24:52 +0200 Subject: [PATCH 009/464] partial fixes in Newsletter module - PHPDocs - strict_type --- app/code/Magento/Newsletter/Block/Adminhtml/Problem.php | 4 ++-- .../Controller/Adminhtml/Subscriber/MassDelete.php | 3 ++- app/code/Magento/Newsletter/Controller/Manage/Save.php | 9 +++++---- .../Magento/Newsletter/Controller/Subscriber/Confirm.php | 6 ++++-- app/code/Magento/Newsletter/Model/Subscriber.php | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php index 61a17d7ad5e51..6534f39451275 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php @@ -83,7 +83,7 @@ protected function _prepareLayout() /** * Get the html element for unsubscribe button * - * @return $string + * @return string */ public function getUnsubscribeButtonHtml() { @@ -93,7 +93,7 @@ public function getUnsubscribeButtonHtml() /** * Get the html element for delete button * - * @return $string + * @return string */ public function getDeleteButtonHtml() { diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php index 7f02e4ea13445..0afc98a5cc12e 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php @@ -18,10 +18,11 @@ class MassDelete extends Subscriber * @var SubscriberFactory */ private $subscriberFactory; - + /** * @param Context $context * @param FileFactory $fileFactory + * @param SubscriberFactory|null $subscriberFactory */ public function __construct( Context $context, diff --git a/app/code/Magento/Newsletter/Controller/Manage/Save.php b/app/code/Magento/Newsletter/Controller/Manage/Save.php index 698c2d19aae68..400922f149f8e 100644 --- a/app/code/Magento/Newsletter/Controller/Manage/Save.php +++ b/app/code/Magento/Newsletter/Controller/Manage/Save.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Newsletter\Controller\Manage; @@ -65,9 +66,9 @@ public function __construct( /** * Save newsletter subscription preference action * - * @return void|null + * @return \Magento\Framework\App\ResponseInterface */ - public function execute() + public function execute(): \Magento\Framework\App\ResponseInterface { if (!$this->formKeyValidator->validate($this->getRequest())) { return $this->_redirect('customer/account/'); @@ -110,7 +111,7 @@ public function execute() $this->messageManager->addError(__('Something went wrong while saving your subscription.')); } } - $this->_redirect('customer/account/'); + return $this->_redirect('customer/account/'); } /** @@ -119,7 +120,7 @@ public function execute() * @param Customer $customer * @return void */ - private function setIgnoreValidationFlag($customer) + private function setIgnoreValidationFlag(Customer $customer): void { $customer->setData('ignore_validation_flag', true); } diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php b/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php index 4e338c2d1df34..8d1114b66acf0 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php @@ -4,15 +4,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Newsletter\Controller\Subscriber; class Confirm extends \Magento\Newsletter\Controller\Subscriber { /** * Subscription confirm action - * @return void + * @return \Magento\Framework\Controller\Result\Redirect */ - public function execute() + public function execute(): \Magento\Framework\Controller\Result\Redirect { $id = (int)$this->getRequest()->getParam('id'); $code = (string)$this->getRequest()->getParam('code'); diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index e7e5d5f202811..eb87f303b84d2 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -686,7 +686,7 @@ public function confirm($code) * Mark receiving subscriber of queue newsletter * * @param \Magento\Newsletter\Model\Queue $queue - * @return boolean + * @return Subscriber */ public function received(\Magento\Newsletter\Model\Queue $queue) { From ed43407dde622f7b6047b99c65fa5bd71db6d986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= Date: Mon, 11 Feb 2019 13:00:29 +0100 Subject: [PATCH 010/464] Fix checking if image is in media directory --- app/code/Magento/Catalog/Model/Category/FileInfo.php | 2 +- .../Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php index 9715bb2b1616e..d4d4389630528 100644 --- a/app/code/Magento/Catalog/Model/Category/FileInfo.php +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -76,7 +76,7 @@ private function getMediaDirectory() private function getBaseDirectory() { if (!isset($this->baseDirectory)) { - $this->baseDirectory = $this->filesystem->getDirectoryRead(DirectoryList::ROOT); + $this->baseDirectory = $this->filesystem->getDirectoryRead(DirectoryList::PUB); } return $this->baseDirectory; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php index 8ca823127e66c..967e7d5889a17 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -57,7 +57,7 @@ protected function setUp() $this->filesystem->expects($this->any()) ->method('getDirectoryRead') - ->with(DirectoryList::ROOT) + ->with(DirectoryList::PUB) ->willReturn($this->baseDirectory); $this->mime = $this->getMockBuilder(Mime::class) From c764ca310cdfa890caf6fc144da2a3aa5861cbee Mon Sep 17 00:00:00 2001 From: Graham Wharton Date: Sun, 10 Mar 2019 13:59:49 +0000 Subject: [PATCH 011/464] Transactional emails are now database aware with regard to email logo image. --- .../Magento/Email/Model/AbstractTemplate.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index a6ecdaf24ebbb..7f9bda7ab0cdd 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -14,6 +14,7 @@ use Magento\Store\Model\Information as StoreInformation; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\Store; +use Magento\MediaStorage\Helper\File\Storage\Database; /** * Template model class @@ -163,6 +164,11 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn */ private $urlModel; + /** + * @var Database + */ + private $fileStorageDatabase; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\View\DesignInterface $design @@ -177,6 +183,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn * @param \Magento\Framework\Filter\FilterManager $filterManager * @param \Magento\Framework\UrlInterface $urlModel * @param array $data + * @param Database $fileStorageDatabase * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -193,7 +200,8 @@ public function __construct( \Magento\Email\Model\TemplateFactory $templateFactory, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\UrlInterface $urlModel, - array $data = [] + array $data = [], + Database $fileStorageDatabase = null ) { $this->design = $design; $this->area = isset($data['area']) ? $data['area'] : null; @@ -207,6 +215,7 @@ public function __construct( $this->templateFactory = $templateFactory; $this->filterManager = $filterManager; $this->urlModel = $urlModel; + $this->fileStorageDatabase = $fileStorageDatabase ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Database::class); parent::__construct($context, $registry, null, null, $data); } @@ -394,6 +403,11 @@ protected function getLogoUrl($store) if ($fileName) { $uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR; $mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); + if ($this->fileStorageDatabase->checkDbUsage() && + !$mediaDirectory->isFile($uploadDir . '/' . $fileName) + ) { + $this->fileStorageDatabase->saveFileToFilesystem($uploadDir . '/' . $fileName); + } if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) { return $this->storeManager->getStore()->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_MEDIA From 057c13d66dc67c8291662ec5be77b87d26db781f Mon Sep 17 00:00:00 2001 From: Graham Wharton Date: Sun, 10 Mar 2019 18:38:22 +0000 Subject: [PATCH 012/464] Resolved test failures --- .../Magento/Email/Model/AbstractTemplate.php | 3 ++- .../Test/Unit/Model/BackendTemplateTest.php | 20 +++++++++++++++++-- app/code/Magento/Email/composer.json | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 7f9bda7ab0cdd..db4a5f1d8c58b 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -215,7 +215,8 @@ public function __construct( $this->templateFactory = $templateFactory; $this->filterManager = $filterManager; $this->urlModel = $urlModel; - $this->fileStorageDatabase = $fileStorageDatabase ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Database::class); + $this->fileStorageDatabase = $fileStorageDatabase ?: + \Magento\Framework\App\ObjectManager::getInstance()->get(Database::class); parent::__construct($context, $registry, null, null, $data); } diff --git a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php index 31a04b0b2bbd0..bfe5005ee7351 100644 --- a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php @@ -46,6 +46,11 @@ class BackendTemplateTest extends \PHPUnit\Framework\TestCase */ private $serializerMock; + /** + * @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject + */ + private $databaseHelperMock; + protected function setUp() { $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -56,6 +61,7 @@ protected function setUp() $this->structureMock = $this->createMock(\Magento\Config\Model\Config\Structure::class); $this->structureMock->expects($this->any())->method('getFieldPathsByAttribute')->willReturn(['path' => 'test']); + $this->databaseHelperMock = $this->createMock(\Magento\MediaStorage\Helper\File\Storage\Database::class); $this->resourceModelMock = $this->createMock(\Magento\Email\Model\ResourceModel\Template::class); $this->resourceModelMock->expects($this->any()) ->method('getSystemConfigByPathsAndTemplateId') @@ -64,8 +70,18 @@ protected function setUp() $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); $objectManagerMock->expects($this->any()) ->method('get') - ->with(\Magento\Email\Model\ResourceModel\Template::class) - ->will($this->returnValue($this->resourceModelMock)); + ->willReturnCallback( + function ($value) { + switch($value) { + case \Magento\MediaStorage\Helper\File\Storage\Database::class: + return ($this->databaseHelperMock); + case \Magento\Email\Model\ResourceModel\Template::class: + return ($this->resourceModelMock); + default: + return(NULL); + } + } + ); \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 1011b16f8537d..e887adef1fbc9 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -12,6 +12,7 @@ "magento/module-config": "*", "magento/module-store": "*", "magento/module-theme": "*", + "magento/module-media-storage": "*", "magento/module-variable": "*" }, "suggest": { From 17ed8d47f722dea48ea6ddb80c16a08228205702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= Date: Mon, 18 Mar 2019 23:08:40 +0100 Subject: [PATCH 013/464] Revert change from Root to Pub, trim pub directory if filePath not begins with it --- .../Magento/Catalog/Model/Category/FileInfo.php | 14 ++++++++++---- .../Test/Unit/Model/Category/FileInfoTest.php | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php index d4d4389630528..ba4d3e9609412 100644 --- a/app/code/Magento/Catalog/Model/Category/FileInfo.php +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -76,7 +76,7 @@ private function getMediaDirectory() private function getBaseDirectory() { if (!isset($this->baseDirectory)) { - $this->baseDirectory = $this->filesystem->getDirectoryRead(DirectoryList::PUB); + $this->baseDirectory = $this->filesystem->getDirectoryRead(DirectoryList::ROOT); } return $this->baseDirectory; @@ -135,7 +135,7 @@ private function getFilePath($fileName) { $filePath = ltrim($fileName, '/'); - $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath(); + $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath); $isFileNameBeginsWithMediaDirectoryPath = $this->isBeginsWithMediaDirectoryPath($fileName); // if the file is not using a relative path, it resides in the catalog/category media directory @@ -160,7 +160,7 @@ public function isBeginsWithMediaDirectoryPath($fileName) { $filePath = ltrim($fileName, '/'); - $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath(); + $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath); $isFileNameBeginsWithMediaDirectoryPath = strpos($filePath, $mediaDirectoryRelativeSubpath) === 0; return $isFileNameBeginsWithMediaDirectoryPath; @@ -169,14 +169,20 @@ public function isBeginsWithMediaDirectoryPath($fileName) /** * Get media directory subpath relative to base directory path * + * @param string $filePath * @return string */ - private function getMediaDirectoryPathRelativeToBaseDirectoryPath() + private function getMediaDirectoryPathRelativeToBaseDirectoryPath(string $filePath = '') { $baseDirectoryPath = $this->getBaseDirectory()->getAbsolutePath(); $mediaDirectoryPath = $this->getMediaDirectory()->getAbsolutePath(); $mediaDirectoryRelativeSubpath = substr($mediaDirectoryPath, strlen($baseDirectoryPath)); + $pubDirectory = 'pub/'; + + if (strpos($mediaDirectoryRelativeSubpath, $pubDirectory) === 0 && strpos($filePath, $pubDirectory) !== 0) { + $mediaDirectoryRelativeSubpath = substr($mediaDirectoryRelativeSubpath, strlen($pubDirectory)); + } return $mediaDirectoryRelativeSubpath; } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php index 967e7d5889a17..8ca823127e66c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -57,7 +57,7 @@ protected function setUp() $this->filesystem->expects($this->any()) ->method('getDirectoryRead') - ->with(DirectoryList::PUB) + ->with(DirectoryList::ROOT) ->willReturn($this->baseDirectory); $this->mime = $this->getMockBuilder(Mime::class) From 112476a20ce1e2685fc62f315372870cb0da3743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= Date: Tue, 26 Mar 2019 20:19:35 +0100 Subject: [PATCH 014/464] Change hardcoded pub path to constant --- app/code/Magento/Catalog/Model/Category/FileInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php index ba4d3e9609412..94189a67d6e74 100644 --- a/app/code/Magento/Catalog/Model/Category/FileInfo.php +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -178,7 +178,7 @@ private function getMediaDirectoryPathRelativeToBaseDirectoryPath(string $filePa $mediaDirectoryPath = $this->getMediaDirectory()->getAbsolutePath(); $mediaDirectoryRelativeSubpath = substr($mediaDirectoryPath, strlen($baseDirectoryPath)); - $pubDirectory = 'pub/'; + $pubDirectory = DirectoryList::PUB . DIRECTORY_SEPARATOR; if (strpos($mediaDirectoryRelativeSubpath, $pubDirectory) === 0 && strpos($filePath, $pubDirectory) !== 0) { $mediaDirectoryRelativeSubpath = substr($mediaDirectoryRelativeSubpath, strlen($pubDirectory)); From 0ce024617fd4b7d1cf777987a3857db82314ce4d Mon Sep 17 00:00:00 2001 From: Lusine Papyan Date: Mon, 8 Apr 2019 16:46:50 +0400 Subject: [PATCH 015/464] MAGETWO-94004: Magento Admin can not configure properly bundle/grouped/configurable product with shared catalog enabled and if they were added by sku to an order - Added automated test script --- .../Catalog/Test/Mftf/Data/ProductData.xml | 3 ++ .../ActionGroup/AdminOrderActionGroup.xml | 44 +++++++++++++++++++ .../AdminOrderFormConfigureProductSection.xml | 4 +- .../AdminOrderFormItemsOrderedSection.xml | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index ba4a623e35def..f858634a63320 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -206,6 +206,9 @@ EavStockItem CustomAttributeProductAttribute + + pr + api-simple-product simple diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index 0e09f3933c1aa..13a9d7531b66c 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -131,6 +131,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml index 83d417f6f8555..aa430bced2659 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml @@ -12,5 +12,7 @@ + + - \ No newline at end of file + diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml index beb566b20806c..a5035df2f37be 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml @@ -16,5 +16,6 @@ + From cfc7f6c7c3d7640bff7d0a59abf047cdd6889959 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova Date: Wed, 20 Mar 2019 19:10:34 +0300 Subject: [PATCH 016/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Set empty billing and shipping address after deleting last item. --- .../Model/QuoteRepository/SaveHandler.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php index 67310a1cc17cf..8be9da8fc2792 100644 --- a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php +++ b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php @@ -10,7 +10,11 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\InputException; +use Magento\Quote\Api\Data\AddressInterfaceFactory; +/** + * Handler for saving quote. + */ class SaveHandler { /** @@ -38,19 +42,26 @@ class SaveHandler */ private $addressRepository; + /** + * @var AddressInterfaceFactory + */ + private $quoteAddressFactory; + /** * @param \Magento\Quote\Model\ResourceModel\Quote $quoteResource * @param \Magento\Quote\Model\Quote\Item\CartItemPersister $cartItemPersister * @param \Magento\Quote\Model\Quote\Address\BillingAddressPersister $billingAddressPersister * @param \Magento\Quote\Model\Quote\ShippingAssignment\ShippingAssignmentPersister $shippingAssignmentPersister * @param AddressRepositoryInterface $addressRepository + * @param AddressInterfaceFactory|null $addressFactory */ public function __construct( \Magento\Quote\Model\ResourceModel\Quote $quoteResource, \Magento\Quote\Model\Quote\Item\CartItemPersister $cartItemPersister, \Magento\Quote\Model\Quote\Address\BillingAddressPersister $billingAddressPersister, \Magento\Quote\Model\Quote\ShippingAssignment\ShippingAssignmentPersister $shippingAssignmentPersister, - AddressRepositoryInterface $addressRepository = null + AddressRepositoryInterface $addressRepository = null, + AddressInterfaceFactory $addressFactory = null ) { $this->quoteResourceModel = $quoteResource; $this->cartItemPersister = $cartItemPersister; @@ -58,6 +69,8 @@ public function __construct( $this->shippingAssignmentPersister = $shippingAssignmentPersister; $this->addressRepository = $addressRepository ?: ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $this->quoteAddressFactory = $addressFactory ?:ObjectManager::getInstance() + ->get(AddressInterfaceFactory::class); } /** @@ -80,6 +93,9 @@ public function save(CartInterface $quote) /** @var \Magento\Quote\Model\Quote\Item $item */ if (!$item->isDeleted()) { $quote->setLastAddedItem($this->cartItemPersister->save($quote, $item)); + } elseif (count($items) === 1) { + $quote->setBillingAddress($this->quoteAddressFactory->create()); + $quote->setShippingAddress($this->quoteAddressFactory->create()); } } } From 4e4ec53f8dd373906ccd3f98121021f189b25737 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova Date: Mon, 25 Mar 2019 18:23:54 +0300 Subject: [PATCH 017/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Add webapi test --- .../Quote/Api/GuestCartAddingItemsTest.php | 122 ++++++++++++++++++ ...roduct_without_options_with_stock_data.php | 28 ++++ ...thout_options_with_stock_data_rollback.php | 25 ++++ 3 files changed, 175 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php new file mode 100644 index 0000000000000..27e1731a0dcfb --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -0,0 +1,122 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * Test price for cart after deleting and adding product to. + * + * @magentoApiDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @return void + */ + public function testPriceForCreatingQuoteFromEmptyCart() + { + // Creating empty cart + $serviceInfoForCreatingEmptyCart = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'CreateEmptyCart', + ], + ]; + $quoteId = $this->_webApiCall($serviceInfoForCreatingEmptyCart); + + // Adding item to the cart + $serviceInfoForAddingProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', + ], + ]; + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple', + 'qty' => 1 + ] + ]; + $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); + $this->assertNotEmpty($item); + + // Delete the item for the cart + $serviceInfoForDeleteProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'deleteById', + ], + ]; + $response = (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? + $this->_webApiCall($serviceInfoForDeleteProduct, ['cartId' => $quoteId, 'itemId' => $item['item_id']]) + : $this->_webApiCall($serviceInfoForDeleteProduct); + $this->assertTrue($response); + + // Add one more item and check price for this item + $serviceInfoForAddingProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', + ], + ]; + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple', + 'qty' => 1 + ] + ]; + $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); + $this->assertNotEmpty($item); + $this->assertEquals($item['price'], 10); + + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + $quote->load($quoteId); + $quote->delete(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php new file mode 100644 index 0000000000000..6821062ccf320 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php @@ -0,0 +1,28 @@ +create(\Magento\Catalog\Model\Product::class); +$product->setTypeId('simple') + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product Without Custom Options') + ->setSku('simple') + ->setPrice(10) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setQty(100) + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ])->save(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php new file mode 100644 index 0000000000000..9e545c85df0cd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php @@ -0,0 +1,25 @@ +get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +$repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Catalog\Model\ProductRepository::class +); +try { + $product = $repository->get('simple', false, null, true); + $product->delete(); +} catch (\Magento\Framework\Exception\NoSuchEntityException $e) { + //Entity already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From fcea05347e641e2d0537cd50781f47425a556220 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Fri, 11 Jan 2019 19:30:04 +0100 Subject: [PATCH 018/464] fix clean_cache plugin flush mode --- .../Framework/App/Cache/FlushCacheByTags.php | 63 +++++++++---------- .../Test/Unit/Cache/FlushCacheByTagsTest.php | 63 ++++++++++--------- 2 files changed, 66 insertions(+), 60 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Cache/FlushCacheByTags.php b/lib/internal/Magento/Framework/App/Cache/FlushCacheByTags.php index e2392b198492b..8f8dfd3baf1b6 100644 --- a/lib/internal/Magento/Framework/App/Cache/FlushCacheByTags.php +++ b/lib/internal/Magento/Framework/App/Cache/FlushCacheByTags.php @@ -1,18 +1,24 @@ cachePool = $cachePool; $this->cacheState = $cacheState; @@ -54,17 +58,14 @@ public function __construct( /** * Clean cache on save object * - * @param \Magento\Framework\Model\ResourceModel\AbstractResource $subject + * @param AbstractResource $subject * @param \Closure $proceed - * @param \Magento\Framework\Model\AbstractModel $object - * @return \Magento\Framework\Model\ResourceModel\AbstractResource + * @param AbstractModel $object + * @return AbstractResource * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSave( - \Magento\Framework\Model\ResourceModel\AbstractResource $subject, - \Closure $proceed, - \Magento\Framework\Model\AbstractModel $object - ) { + public function aroundSave(AbstractResource $subject, \Closure $proceed, AbstractModel $object): AbstractResource + { $result = $proceed($object); $tags = $this->tagResolver->getTags($object); $this->cleanCacheByTags($tags); @@ -75,39 +76,37 @@ public function aroundSave( /** * Clean cache on delete object * - * @param \Magento\Framework\Model\ResourceModel\AbstractResource $subject + * @param AbstractResource $subject * @param \Closure $proceed - * @param \Magento\Framework\Model\AbstractModel $object - * @return \Magento\Framework\Model\ResourceModel\AbstractResource + * @param AbstractModel $object + * @return AbstractResource * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundDelete( - \Magento\Framework\Model\ResourceModel\AbstractResource $subject, - \Closure $proceed, - \Magento\Framework\Model\AbstractModel $object - ) { + public function aroundDelete(AbstractResource $subject, \Closure $proceed, AbstractModel $object): AbstractResource + { $tags = $this->tagResolver->getTags($object); $result = $proceed($object); $this->cleanCacheByTags($tags); + return $result; } /** * Clean cache by tags * - * @param string[] $tags + * @param string[] $tags * @return void */ - private function cleanCacheByTags($tags) + private function cleanCacheByTags(array $tags): void { - if (empty($tags)) { + if (!$tags) { return; } foreach ($this->cacheList as $cacheType) { if ($this->cacheState->isEnabled($cacheType)) { $this->cachePool->get($cacheType)->clean( - \Zend_Cache::CLEANING_MODE_MATCHING_TAG, - array_unique($tags) + \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, + \array_unique($tags) ); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php index e05399cd0bfcb..60dba582177eb 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/FlushCacheByTagsTest.php @@ -3,9 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\App\Test\Unit\Cache; +use Magento\Framework\App\Cache\FlushCacheByTags; +use Magento\Framework\App\Cache\StateInterface; +use Magento\Framework\App\Cache\Tag\Resolver; +use Magento\Framework\App\Cache\Type\FrontendPool; +use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\ResourceModel\AbstractResource; + +/** + * Unit tests for the \Magento\Framework\App\Cache\FlushCacheByTags class. + */ class FlushCacheByTagsTest extends \PHPUnit\Framework\TestCase { /** @@ -28,13 +39,16 @@ class FlushCacheByTagsTest extends \PHPUnit\Framework\TestCase */ private $plugin; + /** + * @inheritdoc + */ protected function setUp() { - $this->cacheState = $this->getMockForAbstractClass(\Magento\Framework\App\Cache\StateInterface::class); - $this->frontendPool = $this->createMock(\Magento\Framework\App\Cache\Type\FrontendPool::class); - $this->tagResolver = $this->createMock(\Magento\Framework\App\Cache\Tag\Resolver::class); + $this->cacheState = $this->getMockForAbstractClass(StateInterface::class); + $this->frontendPool = $this->createMock(FrontendPool::class); + $this->tagResolver = $this->createMock(Resolver::class); - $this->plugin = new \Magento\Framework\App\Cache\FlushCacheByTags( + $this->plugin = new FlushCacheByTags( $this->frontendPool, $this->cacheState, ['test'], @@ -42,14 +56,19 @@ protected function setUp() ); } - public function testAroundSave() + /** + * @return void + */ + public function testAroundSave(): void { - $resource = $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\AbstractResource::class) + $resource = $this->getMockBuilder(AbstractResource::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $model = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class) + $model = $this->getMockBuilder(AbstractModel::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); + $this->tagResolver->expects($this->atLeastOnce())->method('getTags')->with($model)->willReturn([]); + $result = $this->plugin->aroundSave( $resource, function () use ($resource) { @@ -57,17 +76,23 @@ function () use ($resource) { }, $model ); + $this->assertSame($resource, $result); } - public function testAroundDelete() + /** + * @return void + */ + public function testAroundDelete(): void { - $resource = $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\AbstractResource::class) + $resource = $this->getMockBuilder(AbstractResource::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $model = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class) + $model = $this->getMockBuilder(AbstractModel::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); + $this->tagResolver->expects($this->atLeastOnce())->method('getTags')->with($model)->willReturn([]); + $result = $this->plugin->aroundDelete( $resource, function () use ($resource) { @@ -75,25 +100,7 @@ function () use ($resource) { }, $model ); - $this->assertSame($resource, $result); - } - public function testAroundSaveWithInterface() - { - $resource = $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\AbstractResource::class) - - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $model = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $result = $this->plugin->aroundSave( - $resource, - function () use ($resource) { - return $resource; - }, - $model - ); $this->assertSame($resource, $result); } } From 9c9b3126ece8a455fed0668971de95e35162a9a8 Mon Sep 17 00:00:00 2001 From: Karan Shah Date: Mon, 15 Apr 2019 15:43:43 +0530 Subject: [PATCH 019/464] Apply-coupoun-and-scroll-top-to-check.-applied-successfully-or-not --- .../Magento/Sales/view/adminhtml/web/order/create/scripts.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index c508a5ecdfa58..23912c9071553 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -561,6 +561,9 @@ define([ applyCoupon : function(code){ this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, {'order[coupon][code]':code, reset_shipping: 0}); this.orderItemChanged = false; + jQuery('html, body').animate({ + scrollTop: 0 + }); }, addProduct : function(id){ From 1f7a9b45bb65d4a5fd7403924703fcaab5d70965 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova Date: Tue, 16 Apr 2019 12:18:25 +0300 Subject: [PATCH 020/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Fix for registered customer --- .../Magento/Quote/Model/QuoteManagement.php | 25 ++++++++++++-- .../Model/QuoteRepository/SaveHandler.php | 2 ++ .../Test/Unit/Model/QuoteManagementTest.php | 33 +++++++++++++++++-- .../Quote/Api/GuestCartAddingItemsTest.php | 2 -- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index 2fcfd2dfadabb..36d85b07d9749 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Quote\Model; @@ -249,6 +250,8 @@ public function createEmptyCartForCustomer($customerId) $storeId = $this->storeManager->getStore()->getStoreId(); $quote = $this->createCustomerCart($customerId, $storeId); + $this->_prepareCustomerQuote($quote); + try { $this->quoteRepository->save($quote); } catch (\Exception $e) { @@ -281,6 +284,7 @@ public function assignCustomer($cartId, $customerId, $storeId) throw new StateException( __("The customer can't be assigned to the cart because the customer already has an active cart.") ); + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { } @@ -559,7 +563,14 @@ protected function _prepareCustomerQuote($quote) if ($shipping && !$shipping->getSameAsBilling() && (!$shipping->getCustomerId() || $shipping->getSaveInAddressBook()) ) { - $shippingAddress = $shipping->exportCustomerAddress(); + if ($shipping->getQuoteId()) { + $shippingAddress = $shipping->exportCustomerAddress(); + } else { + $defaultShipping = $this->customerRepository->getById($customer->getId())->getDefaultShipping(); + if ($defaultShipping) { + $shippingAddress = $this->addressRepository->getById($defaultShipping); + } + } if (!$hasDefaultShipping) { //Make provided address as default shipping address $shippingAddress->setIsDefaultShipping(true); @@ -579,7 +590,14 @@ protected function _prepareCustomerQuote($quote) } if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { - $billingAddress = $billing->exportCustomerAddress(); + if ($billing->getQuoteId()) { + $billingAddress = $billing->exportCustomerAddress(); + } else { + $defaultBilling = $this->customerRepository->getById($customer->getId())->getDefaultBilling(); + if ($defaultBilling) { + $billingAddress = $this->addressRepository->getById($defaultBilling); + } + } if (!$hasDefaultBilling) { //Make provided address as default shipping address if (!$hasDefaultShipping) { @@ -627,12 +645,13 @@ private function rollbackAddresses( 'exception' => $e, ] ); + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $consecutiveException) { $message = sprintf( "An exception occurred on 'sales_model_service_quote_submit_failure' event: %s", $consecutiveException->getMessage() ); - + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception($message, 0, $e); } } diff --git a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php index 8be9da8fc2792..12a71648690d4 100644 --- a/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php +++ b/app/code/Magento/Quote/Model/QuoteRepository/SaveHandler.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Quote\Model\QuoteRepository; use Magento\Quote\Api\Data\CartInterface; diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php index b61f95b4eee6c..fc8e4aed73c19 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Quote\Test\Unit\Model; @@ -284,6 +285,14 @@ public function testCreateEmptyCartForCustomer() ->method('getActiveForCustomer') ->with($userId) ->willThrowException(new NoSuchEntityException()); + $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + ->setMethods(['getDefaultBilling'])->disableOriginalConstructor()->getMockForAbstractClass(); + $quoteAddress = $this->createPartialMock( + \Magento\Quote\Model\Quote\Address::class, + ['getCustomerId'] + ); + $quoteAddress->expects($this->atLeastOnce())->method('getCustomerId')->willReturn(567); + $quoteMock->expects($this->atLeastOnce())->method('getBillingAddress')->willReturn($quoteAddress); $this->quoteFactoryMock->expects($this->once())->method('create')->willReturn($quoteMock); $quoteMock->expects($this->any())->method('setStoreId')->with($storeId); @@ -291,6 +300,8 @@ public function testCreateEmptyCartForCustomer() $this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock); $quoteMock->expects($this->once())->method('getId')->willReturn($quoteId); + $this->customerRepositoryMock->expects($this->atLeastOnce())->method('getById')->willReturn($customer); + $customer->expects($this->atLeastOnce())->method('getDefaultBilling')->willReturn(0); $this->storeManagerMock->expects($this->once())->method('getStore')->willReturnSelf(); $this->storeManagerMock->expects($this->once())->method('getStoreId')->willReturn($storeId); @@ -310,6 +321,17 @@ public function testCreateEmptyCartForCustomerReturnExistsQuote() ->method('getActiveForCustomer') ->with($userId)->willReturn($quoteMock); + $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + ->setMethods(['getDefaultBilling'])->disableOriginalConstructor()->getMockForAbstractClass(); + $quoteAddress = $this->createPartialMock( + \Magento\Quote\Model\Quote\Address::class, + ['getCustomerId'] + ); + $quoteAddress->expects($this->atLeastOnce())->method('getCustomerId')->willReturn(567); + $quoteMock->expects($this->atLeastOnce())->method('getBillingAddress')->willReturn($quoteAddress); + $this->customerRepositoryMock->expects($this->atLeastOnce())->method('getById')->willReturn($customer); + $customer->expects($this->atLeastOnce())->method('getDefaultBilling')->willReturn(0); + $this->quoteFactoryMock->expects($this->never())->method('create')->willReturn($quoteMock); $this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock); @@ -541,7 +563,10 @@ public function testSubmit() $quoteId = 1; $quoteItem = $this->createMock(\Magento\Quote\Model\Quote\Item::class); $billingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class); - $shippingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class); + $shippingAddress = $this->createPartialMock( + \Magento\Quote\Model\Quote\Address::class, + ['getQuoteId', 'getShippingMethod', 'getId'] + ); $payment = $this->createMock(\Magento\Quote\Model\Quote\Payment::class); $baseOrder = $this->createMock(\Magento\Sales\Api\Data\OrderInterface::class); $convertedBilling = $this->createPartialMockForAbstractClass(OrderAddressInterface::class, ['setData']); @@ -842,6 +867,7 @@ protected function getQuote( $quote->expects($this->any()) ->method('getShippingAddress') ->willReturn($shippingAddress); + $shippingAddress->expects($this->any())->method('getQuoteId')->willReturn($id); } $quote->expects($this->any()) ->method('getBillingAddress') @@ -991,7 +1017,10 @@ public function testSubmitForCustomer() $quoteId = 1; $quoteItem = $this->createMock(\Magento\Quote\Model\Quote\Item::class); $billingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class); - $shippingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class); + $shippingAddress = $this->createPartialMock( + \Magento\Quote\Model\Quote\Address::class, + ['getQuoteId', 'getShippingMethod', 'getId', 'exportCustomerAddress'] + ); $payment = $this->createMock(\Magento\Quote\Model\Quote\Payment::class); $baseOrder = $this->createMock(\Magento\Sales\Api\Data\OrderInterface::class); $convertedBilling = $this->createPartialMockForAbstractClass(OrderAddressInterface::class, ['setData']); diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index 27e1731a0dcfb..2067393b0bc2e 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -18,8 +18,6 @@ class GuestCartAddingItemsTest extends WebapiAbstract const SERVICE_NAME = 'quoteGuestCartManagementV1'; const RESOURCE_PATH = '/V1/guest-carts/'; - protected $createdQuotes = []; - /** * @var \Magento\TestFramework\ObjectManager */ From 564fbaace598594733381ebca177009a2fd913ce Mon Sep 17 00:00:00 2001 From: Yurii Borysov Date: Tue, 16 Apr 2019 18:42:40 +0300 Subject: [PATCH 021/464] MAGETWO-80120: Magento\Framework\App\Test\Unit\BootstrapTest reset error handler to \Exception - Restore error handler after Bootstrap run command --- .../Magento/Framework/App/Test/Unit/BootstrapTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php index 32e495ed00a82..b9f0023f2b6e8 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php @@ -298,4 +298,13 @@ public function assertInstalledDataProvider() [true, false], ]; } + + /** + * Restore error handler after Bootstrap->run method + */ + public function tearDown() + { + restore_error_handler(); + setCustomErrorHandler(); + } } From f3a868117903a80d0314183df97aec5acd289f47 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova Date: Thu, 18 Apr 2019 11:42:34 +0300 Subject: [PATCH 022/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Fix webapi and integration test; - Add webapi test. --- .../Magento/Quote/Model/QuoteManagement.php | 56 ++++++----- .../Magento/Quote/Api/CartAddingItemsTest.php | 95 +++++++++++++++++++ .../Magento/Quote/Api/CartManagementTest.php | 10 +- ...thout_options_with_stock_data_rollback.php | 1 + .../Customer/_files/customer_one_address.php | 78 +++++++++++++++ .../_files/customer_one_address_rollback.php | 34 +++++++ 6 files changed, 245 insertions(+), 29 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/Quote/Api/CartAddingItemsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address_rollback.php diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index 36d85b07d9749..c22ac1c1e2167 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -543,7 +543,7 @@ protected function submitQuote(QuoteEntity $quote, $orderData = []) } /** - * Prepare quote for customer order submit + * Prepare address for customer quote. * * @param Quote $quote * @return void @@ -571,22 +571,24 @@ protected function _prepareCustomerQuote($quote) $shippingAddress = $this->addressRepository->getById($defaultShipping); } } - if (!$hasDefaultShipping) { - //Make provided address as default shipping address - $shippingAddress->setIsDefaultShipping(true); - $hasDefaultShipping = true; - if (!$hasDefaultBilling && !$billing->getSaveInAddressBook()) { - $shippingAddress->setIsDefaultBilling(true); - $hasDefaultBilling = true; + if (isset($shippingAddress)) { + if (!$hasDefaultShipping) { + //Make provided address as default shipping address + $shippingAddress->setIsDefaultShipping(true); + $hasDefaultShipping = true; + if (!$hasDefaultBilling && !$billing->getSaveInAddressBook()) { + $shippingAddress->setIsDefaultBilling(true); + $hasDefaultBilling = true; + } } + //save here new customer address + $shippingAddress->setCustomerId($quote->getCustomerId()); + $this->addressRepository->save($shippingAddress); + $quote->addCustomerAddress($shippingAddress); + $shipping->setCustomerAddressData($shippingAddress); + $this->addressesToSync[] = $shippingAddress->getId(); + $shipping->setCustomerAddressId($shippingAddress->getId()); } - //save here new customer address - $shippingAddress->setCustomerId($quote->getCustomerId()); - $this->addressRepository->save($shippingAddress); - $quote->addCustomerAddress($shippingAddress); - $shipping->setCustomerAddressData($shippingAddress); - $this->addressesToSync[] = $shippingAddress->getId(); - $shipping->setCustomerAddressId($shippingAddress->getId()); } if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { @@ -598,20 +600,22 @@ protected function _prepareCustomerQuote($quote) $billingAddress = $this->addressRepository->getById($defaultBilling); } } - if (!$hasDefaultBilling) { - //Make provided address as default shipping address - if (!$hasDefaultShipping) { + if (isset($billingAddress)) { + if (!$hasDefaultBilling) { //Make provided address as default shipping address - $billingAddress->setIsDefaultShipping(true); + if (!$hasDefaultShipping) { + //Make provided address as default shipping address + $billingAddress->setIsDefaultShipping(true); + } + $billingAddress->setIsDefaultBilling(true); } - $billingAddress->setIsDefaultBilling(true); + $billingAddress->setCustomerId($quote->getCustomerId()); + $this->addressRepository->save($billingAddress); + $quote->addCustomerAddress($billingAddress); + $billing->setCustomerAddressData($billingAddress); + $this->addressesToSync[] = $billingAddress->getId(); + $billing->setCustomerAddressId($billingAddress->getId()); } - $billingAddress->setCustomerId($quote->getCustomerId()); - $this->addressRepository->save($billingAddress); - $quote->addCustomerAddress($billingAddress); - $billing->setCustomerAddressData($billingAddress); - $this->addressesToSync[] = $billingAddress->getId(); - $billing->setCustomerAddressId($billingAddress->getId()); } if ($shipping && !$shipping->getCustomerId() && !$hasDefaultBilling) { $shipping->setIsDefaultBilling(true); diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartAddingItemsTest.php new file mode 100644 index 0000000000000..b52c4fb6f0b78 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartAddingItemsTest.php @@ -0,0 +1,95 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * Test price for cart after adding product to. + * + * @magentoApiDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @magentoApiDataFixture Magento/Customer/_files/customer_one_address.php + * @return void + */ + public function testPriceForCreatingQuoteFromEmptyCart() + { + $this->_markTestAsRestOnly(); + + // Get customer ID token + /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */ + $customerTokenService = $this->objectManager->create( + \Magento\Integration\Api\CustomerTokenServiceInterface::class + ); + $token = $customerTokenService->createCustomerAccessToken( + 'customer_one_address@test.com', + 'password' + ); + + // Creating empty cart for registered customer. + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/carts/mine', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + 'token' => $token + ] + ]; + + $quoteId = $this->_webApiCall($serviceInfo, ['customerId' => 999]); // customerId 999 will get overridden + $this->assertGreaterThan(0, $quoteId); + + // Adding item to the cart + $serviceInfoForAddingProduct = [ + 'rest' => [ + 'resourcePath' => '/V1/carts/mine/items', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + 'token' => $token + ] + ]; + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple', + 'qty' => 1 + ] + ]; + $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); + $this->assertNotEmpty($item); + $this->assertEquals(10, $item['price']); + + // Get payment information + $serviceInfoForGettingPaymentInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/carts/mine/payment-information', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + 'token' => $token + ] + ]; + $paymentInfo = $this->_webApiCall($serviceInfoForGettingPaymentInfo); + $this->assertEquals($paymentInfo['totals']['grand_total'], 10); + + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + $quote->load($quoteId); + $quote->delete(); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php index 80a4acbc563d6..6d585561ae3a9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Quote\Api; @@ -66,7 +67,7 @@ public function testCreateEmptyCartForGuest() } /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_one_address.php */ public function testCreateEmptyCartForCustomer() { @@ -94,7 +95,7 @@ public function testCreateEmptyCartForCustomer() } /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_one_address.php */ public function testCreateEmptyCartAndGetCartForCustomer() { @@ -105,7 +106,10 @@ public function testCreateEmptyCartAndGetCartForCustomer() $customerTokenService = $this->objectManager->create( \Magento\Integration\Api\CustomerTokenServiceInterface::class ); - $token = $customerTokenService->createCustomerAccessToken('customer@example.com', 'password'); + $token = $customerTokenService->createCustomerAccessToken( + 'customer_one_address@test.com', + 'password' + ); $serviceInfo = [ 'rest' => [ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php index 9e545c85df0cd..41d06e5f25526 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php @@ -17,6 +17,7 @@ try { $product = $repository->get('simple', false, null, true); $product->delete(); +// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { //Entity already deleted } diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address.php new file mode 100644 index 0000000000000..1ae532e32a958 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address.php @@ -0,0 +1,78 @@ +create(CustomerRepositoryInterface::class); +/** @var Customer $customer */ +$customer = $objectManager->create(Customer::class); +/** @var CustomerRegistry $customerRegistry */ +$customerRegistry = $objectManager->get(CustomerRegistry::class); +$customer->setWebsiteId(1) + ->setEmail('customer_one_address@test.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setPrefix('Mr.') + ->setFirstname('John') + ->setMiddlename('A') + ->setLastname('Smith') + ->setSuffix('Esq.') + ->setTaxvat('12') + ->setGender(0) + ->setId(1); + +$customer->isObjectNew(true); +$customer->save(); +$customerRegistry->remove($customer->getId()); + +//Creating address +/** @var Address $customerAddress */ +$customerAddress = $objectManager->create(Address::class); +$customerAddress->isObjectNew(true); +$customerAddress->setData( + [ + 'attribute_set_id' => 2, + 'telephone' => 3468676, + 'postcode' => 75477, + 'country_id' => 'US', + 'city' => 'CityM', + 'company' => 'CompanyName', + 'street' => 'CustomerAddress1', + 'lastname' => 'Smith', + 'firstname' => 'John', + 'parent_id' => $customer->getId(), + 'region_id' => 1, + ] +); +$customerAddress->save(); +/** @var AddressRepositoryInterface $addressRepository */ +$addressRepository = $objectManager->get(AddressRepositoryInterface::class); +$customerAddress = $addressRepository->getById($customerAddress->getId()); +$customerAddress->setCustomerId($customer->getId()); +$customerAddress->isDefaultBilling(true); +$customerAddress->setIsDefaultShipping(true); +$customerAddress = $addressRepository->save($customerAddress); + +$customer->setDefaultBilling($customerAddress->getId()); +$customer->setDefaultShipping($customerAddress->getId()); +$customer->save(); + +$customerRegistry->remove($customerAddress->getCustomerId()); +/** @var AddressRegistry $addressRegistry */ +$addressRegistry = $objectManager->get(AddressRegistry::class); +$addressRegistry->remove($customerAddress->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address_rollback.php new file mode 100644 index 0000000000000..441700389840d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address_rollback.php @@ -0,0 +1,34 @@ +get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var CustomerRepositoryInterface $customerRepo */ +$customerRepo = $objectManager->get(CustomerRepositoryInterface::class); +try { + $customer = $customerRepo->get('customer_with_addresses@test.com'); + /** @var AddressRepositoryInterface $addressRepo */ + $addressRepo = $objectManager->get(AddressRepositoryInterface::class); + foreach ($customer->getAddresses() as $address) { + $addressRepo->delete($address); + } + $customerRepo->delete($customer); +// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock +} catch (NoSuchEntityException $exception) { + //Already deleted +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From b86316b1e1f300244c757663375cc1e84381c3d3 Mon Sep 17 00:00:00 2001 From: DmytroPaidych Date: Fri, 19 Apr 2019 14:46:05 +0300 Subject: [PATCH 023/464] MC-5822: Update tax rule, fixed zip --- .../app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml index 277bdbb7f5466..8b864b0eaba9b 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml @@ -48,7 +48,6 @@ - stable:no tax_rule_with_custom_tax_classes United States Idaho From 1eb55fee6644907592151e42225761c583a938d3 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Mon, 22 Apr 2019 15:56:59 +0300 Subject: [PATCH 024/464] MAGETWO-70681: Store View name DB field is too short --- app/code/Magento/Sales/etc/db_schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/etc/db_schema.xml b/app/code/Magento/Sales/etc/db_schema.xml index d6ea9b7d54861..82e6d5d10b53a 100644 --- a/app/code/Magento/Sales/etc/db_schema.xml +++ b/app/code/Magento/Sales/etc/db_schema.xml @@ -219,7 +219,7 @@ - + Date: Mon, 22 Apr 2019 16:47:20 +0300 Subject: [PATCH 025/464] MC-12666: Verify Shopping Cart Persistence under long-term cookie --- .../AssertCustomerLoggedInActionGroup.xml | 1 + ...ssertRegistrationPageFieldsActionGroup.xml | 19 +++ .../Customer/Test/Mftf/Data/CustomerData.xml | 10 ++ .../StorefrontCustomerSignInFormSection.xml | 1 + ...stentRegistrationPageFieldsActionGroup.xml | 14 ++ .../StorefrontCustomerActionGroup.xml | 14 ++ ...ssertCustomerWelcomeMessageActionGroup.xml | 23 +++ .../Test/Mftf/Data/PersistentData.xml | 57 +++++++ .../Mftf/Metadata/persistent_config-meta.xml | 32 +++- ...CartPersistenceUnderLongTermCookieTest.xml | 159 ++++++++++++++++++ 10 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentRegistrationPageFieldsActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml index d9da950fe7115..d2d4d86d7f964 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml @@ -12,6 +12,7 @@ + diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml new file mode 100644 index 0000000000000..d76277d2e5e45 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 06c23a2864984..b871d022ca528 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -203,4 +203,14 @@ 0 0 + + 1 + john.smith@example.com + John + Smith + John Smith + pwdTest123! + 0 + 0 + diff --git a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml index 7bc057b8be7b7..3e5d00f4dada1 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml @@ -13,6 +13,7 @@ +
diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentRegistrationPageFieldsActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentRegistrationPageFieldsActionGroup.xml new file mode 100644 index 0000000000000..34409480c9ecf --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentRegistrationPageFieldsActionGroup.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml index 293fa04d80462..8c0f26dd11d90 100644 --- a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml @@ -19,4 +19,18 @@ before="clickSignInAccountButton" stepKey="unCheckRememberMe"/> + + + + + + + + + + + + + + diff --git a/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml new file mode 100644 index 0000000000000..2e57c8f8e1ee8 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/Persistent/Test/Mftf/Data/PersistentData.xml b/app/code/Magento/Persistent/Test/Mftf/Data/PersistentData.xml index 39e55693811e9..9ae0ac6ef2437 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Data/PersistentData.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Data/PersistentData.xml @@ -34,4 +34,61 @@ 0 + + + + + persistentEnabledState + SecondsOfPersistentLifetime + EnablePersistentRememberMe + EnablePersistentRememberMeDefaultValue + PersistentDisableLogoutClear + EnablePersistentShoppingCart + + + + 31536000 + + + 1 + + + 1 + + + 1 + + + + + RestorePersistentOptionsEnabled + RestorePersistentOptionsLifetime + RestorePersistentOptionsRememberEnabled + RestorePersistentOptionsRememberDefault + RestorePersistentOptionsLogout + RestorePersistentOptionsShoppingCart + + + + PersistentOptionsUseInherit + + + PersistentOptionsUseInherit + + + PersistentOptionsUseInherit + + + PersistentOptionsUseInherit + + + PersistentOptionsUseInherit + + + PersistentOptionsUseInherit + + + + 1 + diff --git a/app/code/Magento/Persistent/Test/Mftf/Metadata/persistent_config-meta.xml b/app/code/Magento/Persistent/Test/Mftf/Metadata/persistent_config-meta.xml index 7f0e12f8bef93..5abcfa8a00045 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Metadata/persistent_config-meta.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Metadata/persistent_config-meta.xml @@ -7,15 +7,45 @@ --> - + string + + integer + string + + integer + + + + string + + integer + + + + string + + integer + + + + string + + integer + + + + string + + integer + diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml new file mode 100644 index 0000000000000..e50fc4af83107 --- /dev/null +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml @@ -0,0 +1,159 @@ + + + + + + + + + + <description value="Verify Shopping Cart Persistence under long-term cookie"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-12666"/> + <group value="persistent"/> + <group value="customer"/> + </annotations> + <before> + <!--Enable Persistence--> + <createData entity="PersistentConfigSettings" stepKey="persistentConfigSetting"/> + <!--Create Simple Product 1 and Product 2 --> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimple1"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="_defaultProduct" stepKey="createSimple2"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <!-- Set Defaults Persistence configuration--> + <createData entity="PersistentConfigUseSystemValue" stepKey="persistentDefaultsConfiguration"/> + <!--Delete Simple Product 1, Product 2 and Category--> + <deleteData createDataKey="createSimple1" stepKey="deleteSimple1"/> + <deleteData createDataKey="createSimple2" stepKey="deleteSimple2"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteJohnSmithCustomer"> + <argument name="customerEmail" value="John_Smith_Customer.email"/> + </actionGroup> + <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteJohnDoeCustomer"> + <argument name="customerEmail" value="Simple_Customer_Without_Address.email"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- 1. Go to storefront and click the Create an Account link--> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnHomePage"/> + <click selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}" stepKey="clickCreateAnAccountLink" /> + <actionGroup ref="StorefrontAssertPersistentRegistrationPageFields" stepKey="assertPersistentRegistrationPageFields"/> + + <!-- 2. Fill fields for registration, set password and unselect the Remember Me checkbox--> + <actionGroup ref="StorefrontCreateCustomerOnRegisterPageDoNotRememberMe" stepKey="registrationJohnSmithCustomer"> + <argument name="Customer" value="John_Smith_Customer"/> + </actionGroup> + <!--Check customer name and last name in welcome message--> + <actionGroup ref="AssertMessageCustomerCreateAccountActionGroup" stepKey="customerCreatedSuccessMessageForJohnSmith"/> + <actionGroup ref="AssertCustomerWelcomeMessageActionGroup" stepKey="seeWelcomeMessageForJohnSmithCustomer"> + <argument name="customerFullName" value="{{John_Smith_Customer.fullname}}"/> + </actionGroup> + + <!-- 3. Put Simple Product 1 into Shopping Cart --> + <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple1ProductToCartForJohnSmithCustomer"> + <argument name="product" value="$$createSimple1$$"/> + </actionGroup> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnSmithCustomer"> + <argument name="productName" value="$$createSimple1.name$$"/> + </actionGroup> + + <!-- 4. Click Sign Out --> + <actionGroup ref="CustomerLogoutStorefrontByMenuItemsActionGroup" stepKey="logoutJohnSmithCustomer"/> + <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeLogoutSuccessPageUrlAfterLogOutJohnSmithCustomer"/> + <waitForPageLoad stepKey="waitForRedirectToHomePage"/> + <waitForText selector="{{StorefrontCMSPageSection.mainContent}}" userInput="CMS homepage content goes here." stepKey="waitForLoadContentMessage"/> + <actionGroup ref="StorefrontAssertPersistentCustomerWelcomeMessageNotPresentActionGroup" stepKey="dontSeeWelcomeJohnSmithCustomerNotYouMessage"> + <argument name="customerFullName" value="{{John_Smith_Customer.fullname}}"/> + </actionGroup> + <actionGroup ref="assertMiniCartEmpty" stepKey="assertMiniCartEmptyAfterJohnSmithSignOut" /> + + <!-- 5. Click the Create an Account link again and fill fields for registration of another customer, set password and check the Remember Me checkbox --> + <amOnPage url="{{StorefrontCustomerCreatePage.url}}" stepKey="amOnCustomerAccountCreatePage"/> + <actionGroup ref="StorefrontRegisterCustomerRememberMe" stepKey="registrationJohnDoeCustomer"> + <argument name="Customer" value="Simple_Customer_Without_Address"/> + </actionGroup> + <!--Check customer name and last name in welcome message--> + <actionGroup ref="AssertMessageCustomerCreateAccountActionGroup" stepKey="customerCreatedSuccessMessageForJohnDoe"/> + <actionGroup ref="AssertCustomerWelcomeMessageActionGroup" stepKey="seeWelcomeMessageForJohnDoeCustomer"> + <argument name="customerFullName" value="{{Simple_Customer_Without_Address.fullname}}"/> + </actionGroup> + <!-- 6. Add Simple Product 1 to Shopping Cart --> + <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple1ProductToCartForJohnDoeCustomer"> + <argument name="product" value="$$createSimple1$$"/> + </actionGroup> + <see selector="{{StorefrontMinicartSection.productCount}}" userInput="1" stepKey="miniCartContainsOneProductForJohnDoeCustomer"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnDoeCustomer"> + <argument name="productName" value="$$createSimple1.name$$"/> + </actionGroup> + + <!-- 7. Click Log Out --> + <actionGroup ref="CustomerLogoutStorefrontByMenuItemsActionGroup" stepKey="logoutJohnDoeCustomer"/> + <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeLogoutSuccessPageUrlAfterLogOutJohnDoeCustomer"/> + <actionGroup ref="StorefrontAssertPersistentCustomerWelcomeMessageActionGroup" stepKey="seeWelcomeForJohnDoeCustomer"> + <argument name="customerFullName" value="{{Simple_Customer_Without_Address.fullname}}"/> + </actionGroup> + <waitForPageLoad stepKey="waitForHomePageLoad"/> + <waitForText selector="{{StorefrontCMSPageSection.mainContent}}" userInput="CMS homepage content goes here." stepKey="waitForLoadContentMessageOnHomePage"/> + <waitForElementVisible selector="{{StorefrontMinicartSection.productCount}}" stepKey="waitForCartCounterVisible"/> + <see selector="{{StorefrontMinicartSection.productCount}}" userInput="1" stepKey="miniCartContainsOneProductForGuest"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForGuestCustomer"> + <argument name="productName" value="$$createSimple1.name$$"/> + </actionGroup> + + <!-- 8. Go to Shopping Cart and verify Simple Product 1 is present there --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCart" /> + <see selector="{{CheckoutCartProductSection.productName}}" userInput="$$createSimple1.name$$" stepKey="checkSimple1InShoppingCart"/> + + <!-- 9. Add Simple Product 2 to Shopping Cart --> + <actionGroup ref="AddSimpleProductToCart" stepKey="addSimple2ProductToCartForGuest"> + <argument name="product" value="$$createSimple2$$"/> + </actionGroup> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForGuestCustomerSecondTime"> + <argument name="productName" value="$$createSimple1.name$$"/> + </actionGroup> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple2InMiniCartForGuestCustomer"> + <argument name="productName" value="$$createSimple2.name$$"/> + </actionGroup> + <see selector="{{StorefrontMinicartSection.productCount}}" userInput="2" stepKey="miniCartContainsTwoProductForGuest"/> + + <!-- 10. Go to My Account section --> + <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="amOnCustomerAccountPage"/> + <seeInCurrentUrl url="{{StorefrontCustomerSignInPage.url}}" stepKey="redirectToCustomerAccountLoginPage"/> + <seeElement selector="{{StorefrontCustomerSignInFormSection.customerLoginBlock}}" stepKey="checkSystemRequiresToLogIn"/> + + <!-- 11. Log in as John Doe --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="logInAsJohnDoeCustomer"> + <argument name="Customer" value="Simple_Customer_Without_Address"/> + </actionGroup> + <see selector="{{StorefrontMinicartSection.productCount}}" userInput="2" stepKey="miniCartContainsTwoProductForJohnDoeCustomer"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple1InMiniCartForJohnDoeCustomerSecondTime"> + <argument name="productName" value="$$createSimple1.name$$"/> + </actionGroup> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="checkSimple2InMiniCartForJohnDoeCustomer"> + <argument name="productName" value="$$createSimple2.name$$"/> + </actionGroup> + + <!-- 12. Sign out and click the Not you? link --> + <actionGroup ref="CustomerLogoutStorefrontByMenuItemsActionGroup" stepKey="logoutJohnDoeCustomerSecondTime"/> + <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeLogoutSuccessPageUrlAfterLogOutJohnSmithCustomerSecondTime"/> + <waitForPageLoad stepKey="waitForHomePageLoadAfter5Seconds"/> + <waitForText selector="{{StorefrontCMSPageSection.mainContent}}" userInput="CMS homepage content goes here." stepKey="waitForLoadMainContentMessageOnHomePage"/> + <click selector="{{StorefrontPanelHeaderSection.notYouLink}}" stepKey="clickOnNotYouLink" /> + <waitForPageLoad stepKey="waitForCustomerLoginPageLoad"/> + <actionGroup ref="assertMiniCartEmpty" stepKey="assertMiniCartEmptyAfterJohnDoeSignOut" /> + </test> +</tests> From 92682b3b2d4d10a1c3b2612f84293d556ed434fa Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Mon, 22 Apr 2019 14:12:18 -0500 Subject: [PATCH 026/464] MQE-1367: XSD Schema validation must be triggered before merging to mainline Fixed XSD schema validation errors for CE, EE, B2B for 2.3-develop --- .../ActionGroup/AdminProductGridActionGroup.xml | 2 +- .../Mftf/ActionGroup/CustomOptionsActionGroup.xml | 4 ++-- .../Test/AdminAddImageToWYSIWYGProductTest.xml | 14 +++++++------- .../Test/Mftf/ActionGroup/CheckoutActionGroup.xml | 2 +- ...estCheckoutFillNewBillingAddressActionGroup.xml | 2 +- .../Mftf/Test/StorefrontCustomerCheckoutTest.xml | 2 +- .../GeneralConfigurationActionGroup.xml | 6 +++--- .../Mftf/Section/AdminNewAttributePanelSection.xml | 4 ++-- ...igurableProductPriceAdditionalStoreViewTest.xml | 2 +- ...lowedCountriesRestrictionApplyOnBackendTest.xml | 2 +- ...inConfigPaymentsConflictResolutionForPayPal.xml | 12 ++++++------ .../Mftf/Test/PayPalSmartButtonInCheckoutPage.xml | 2 +- ...tWelcomeMessageAfterCustomerIsLoggedOutTest.xml | 4 ++-- .../Section/StorefrontProductInfoMainSection.xml | 8 ++++---- .../Test/Mftf/Section/OrderReportMainSection.xml | 4 ++-- .../Mftf/Page/StorefrontOrderInformationPage.xml | 2 +- .../Mftf/Page/StorefrontOrdersAndReturnsPage.xml | 2 +- .../Mftf/Section/AdminOrderFormAccountSection.xml | 2 +- .../StorefrontOrderAndReturnInformationSection.xml | 4 ++-- .../StorefrontOrderInformationMainSection.xml | 4 ++-- .../Wishlist/Test/Mftf/Data/WishlistData.xml | 4 ++-- 21 files changed, 44 insertions(+), 44 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index ad32b8edbd243..3e967cb9c6901 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -256,7 +256,7 @@ <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> <click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/> - <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled" parameterized="true"/> + <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/> <waitForPageLoad stepKey="waitForStatusToBeChanged"/> <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/> <waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml index b914d5e20712d..838ac7d288ead 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml @@ -55,7 +55,7 @@ <actionGroup name="AddProductCustomOptionField"> <arguments> <argument name="option" defaultValue="ProductOptionField"/> - <argiment name="optionIndex" type="string"/> + <argument name="optionIndex" type="string"/> </arguments> <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> @@ -90,7 +90,7 @@ <actionGroup name="checkCustomizableOptionImport"> <arguments> <argument name="option" defaultValue="ProductOptionField"/> - <argiment name="optionIndex" type="string"/> + <argument name="optionIndex" type="string"/> </arguments> <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionTitleInput(optionIndex)}}" stepKey="grabOptionTitle"/> <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionPrice(optionIndex)}}" stepKey="grabOptionPrice"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index 03f3e93bb30ec..fd27b232053b8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -47,9 +47,9 @@ <conditionalClick selector="{{ProductDescriptionWYSIWYGToolbarSection.WysiwygArrow}}" dependentSelector="{{ProductDescriptionWYSIWYGToolbarSection.checkIfWysiwygArrowExpand}}" stepKey="clickWysiwygArrowIfClosed" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder1" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder1" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading4" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading4"/> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage1"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload1" timeout="30"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload1"/> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage1" /> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.imageSelected(ImageUpload1.value)}}" stepKey="seeImageSelected1" /> <see selector="{{ProductDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn1"/> @@ -60,7 +60,7 @@ <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="dontSeeImage1" /> <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn2" /> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage2"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload2" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload2"/> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage2" /> <click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn1" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" stepKey="waitForImageDescriptionButton1" /> @@ -72,12 +72,12 @@ <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.CancelBtn}}" stepKey="waitForCancelButton2"/> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn2" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading13" timeout="30"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading13"/> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn2" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading14" timeout="40"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading14"/> <dontSeeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn3" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage3"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload3" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload3"/> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage3" /> <waitForElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" stepKey="waitForDeletebtn" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn2"/> @@ -86,7 +86,7 @@ <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete2" /> <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn4" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage4"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload4" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload4"/> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading11" /> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml index b67b7451d5968..94c6e3fd76972 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml @@ -110,7 +110,7 @@ <argument name="paymentMethod" type="string"/> </arguments> <remove keyForRemoval="checkMessage"/> - <dontsee selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" parametrized="true" stepKey="paymentMethodDoesNotAvailable"/> + <dontSee selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" stepKey="paymentMethodDoesNotAvailable"/> </actionGroup> <!-- Logged in user checkout filling shipping section --> <actionGroup name="LoggedInUserCheckoutFillingShippingSectionActionGroup"> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 34f2cfe7f7fff..59e997eccecc0 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -70,6 +70,6 @@ <argument name="paymentMethod" type="string"/> </arguments> <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="waitForLoading3" stepKey="waitForPaymentSectionLoaded"/> - <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" parametrized="true" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> + <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index fadc9ec50ad8d..3c80faf24aae2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -252,7 +252,7 @@ <click stepKey="clickNextButton" selector="{{CheckoutShippingMethodsSection.next}}" /> <waitForPageLoad stepKey="waitBillingForm"/> <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <dontsee selector="{{CheckoutPaymentSection.paymentMethodByName('Check / Money order')}}" stepKey="paymentMethodDoesNotAvailable"/> + <dontSee selector="{{CheckoutPaymentSection.paymentMethodByName('Check / Money order')}}" stepKey="paymentMethodDoesNotAvailable"/> <!-- Fill UK Address and verify that payment available and checkout successful --> <uncheckOption selector="{{StorefrontCheckoutPaymentMethodSection.billingAddressSameAsShippingShared}}" stepKey="uncheckBillingAddressSameAsShippingCheckCheckBox"/> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml index f05cf5be3448e..14eca30d0f730 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml @@ -22,7 +22,7 @@ <actionGroup name="SelectTopDestinationsCountry"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <selectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/> <click selector="#save" stepKey="saveConfig"/> @@ -31,7 +31,7 @@ <actionGroup name="UnSelectTopDestinationsCountry"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <unselectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/> <click selector="#save" stepKey="saveConfig"/> @@ -40,7 +40,7 @@ <actionGroup name="SelectCountriesWithRequiredRegion"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminConfigGeneralPage"/> <conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab" /> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml index 658e7a5fec9b3..573f1265931aa 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml @@ -16,8 +16,8 @@ <element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/> <element name="useInProductListing" type="select" selector="#used_in_product_listing"/> <element name="usedForStoringInProductListing" type="select" selector="#used_for_sort_by"/> - <element name="storefrontPropertiesTab" selector="#front_fieldset-wrapper"/> - <element name="storefrontPropertiesTitle" selector="//span[text()='Storefront Properties']"/> + <element name="storefrontPropertiesTab" type="button" selector="#front_fieldset-wrapper"/> + <element name="storefrontPropertiesTitle" type="text" selector="//span[text()='Storefront Properties']"/> <element name="container" type="text" selector="#create_new_attribute"/> <element name="saveAttribute" type="button" selector="#save"/> <element name="newAttributeIFrame" type="iframe" selector="create_new_attribute_container"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml index 232dfe8391468..a71f51526c8ab 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml @@ -207,6 +207,6 @@ <click userInput="$$createCategory.name$$" stepKey="clickOnCategoryName"/> <waitForPageLoad stepKey="waitForPageLoad4"/> <see userInput="$$createConfigProduct.name$$" stepKey="assertProductPresent"/> - <See userInput="$$createConfigChildProduct1.price$$" stepKey="assertProductPricePresent"/> + <see userInput="$$createConfigChildProduct1.price$$" stepKey="assertProductPricePresent"/> </test> </tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index f39394ef312e4..23c07326bab35 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -113,6 +113,6 @@ <waitForPageLoad stepKey="waitForCustomersGrid"/> <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomersGrid"/> <executeJS function="var len = document.querySelectorAll('{{AdminCustomerFiltersSection.countryOptions}}').length; return len-1;" stepKey="countriesAmount2"/> - <assertEquals expected='($countriesAmount)' expectedType="integer" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> + <assertEquals expected='($countriesAmount)' expectedType="int" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> </test> </tests> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml index b485fcb2a8f9a..9ebd524d8ebbd 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml @@ -14,7 +14,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in United Kingdom"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country United Kingdom"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> @@ -79,7 +79,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in Japan"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country Japan"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> @@ -119,7 +119,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in France"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country France"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> @@ -159,7 +159,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in Hong Kong"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country Hong Kong"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> @@ -199,7 +199,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in Italy"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country Italy"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> @@ -239,7 +239,7 @@ <stories value="Payment methods"/> <title value="Conflict resolution for PayPal in Spain"/> <description value="A popup should show when enabling different paypal solutions when one is already enabled for merchant country Spain"/> - <severity value="Major"/> + <severity value="MAJOR"/> <testCaseId value="MC-13146"/> <group value="paypal"/> </annotations> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/PayPalSmartButtonInCheckoutPage.xml b/app/code/Magento/Paypal/Test/Mftf/Test/PayPalSmartButtonInCheckoutPage.xml index 1858ee130a347..079b46dc1b0cb 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/PayPalSmartButtonInCheckoutPage.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/PayPalSmartButtonInCheckoutPage.xml @@ -104,7 +104,7 @@ <executeJS function="jQuery('.zoid-component-frame.zoid-visible').attr('id', 'myIframe')" stepKey="clickOrderLink"/> <!--switch to iframe of PayPal group button--> <comment userInput="switch to iframe of PayPal group button" stepKey="commentSwitchToIframe"/> - <switchToIframe userInput="myIframe" stepKey="clickPrintOrderLink"/> + <switchToIFrame userInput="myIframe" stepKey="clickPrintOrderLink"/> <waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/> <seeElement selector="{{PayPalButtonOnStorefront.label(PayPalLabel.credit)}}{{PayPalButtonOnStorefront.size(PayPalSize.medium)}}" stepKey="seeButtonInMediumSize"/> <seeElement selector="{{PayPalButtonOnStorefront.label(PayPalLabel.credit)}}{{PayPalButtonOnStorefront.shape(PayPalShape.pill)}}" stepKey="seeButtonInPillShape"/> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml index 2b58e5c7bf62b..61710cbc98082 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontCorrectWelcomeMessageAfterCustomerIsLoggedOutTest.xml @@ -54,7 +54,7 @@ stepKey="seeLoggedInCustomerWelcomeMessage"/> <!--Logout and check default welcome message--> <actionGroup ref="CustomerLogoutStorefrontByMenuItemsActionGroup" stepKey="storefrontCustomerLogout"/> - <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" wait="5" stepKey="seeCustomerSignOutPageUrl"/> + <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeCustomerSignOutPageUrl"/> <see userInput="Default welcome msg!" selector="{{StorefrontHeaderSection.welcomeMessage}}" stepKey="seeDefaultWelcomeMessage"/> @@ -71,7 +71,7 @@ <!--Logout and check persistent customer welcome message--> <actionGroup ref="CustomerLogoutStorefrontByMenuItemsActionGroup" stepKey="storefrontCustomerLogout1"/> - <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" wait="5" stepKey="seeCustomerSignOutPageUrl1"/> + <seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeCustomerSignOutPageUrl1"/> <see userInput="Welcome, $$createCustomerForPersistent.firstname$$ $$createCustomerForPersistent.lastname$$! Not you?" selector="{{StorefrontHeaderSection.welcomeMessage}}" stepKey="seePersistentWelcomeMessage"/> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/ProductVideo/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index c8e1ebcf12d94..e94d426ba7638 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontProductInfoMainSection"> <element name="productVideo" type="text" selector="//*[@class='product-video' and @data-type='{{videoType}}']" parameterized="true"/> - <element name="clickInVideo" type="video" selector="//*[@class='fotorama__stage__shaft']"/> - <element name="videoPausedMode" type="video" selector="//*[contains(@class, 'paused-mode')]"/> - <element name="videoPlayedMode" type="video" selector="//*[contains(@class,'playing-mode')]"/> - <element name="frameVideo" type="video" selector="widget2"/> + <element name="clickInVideo" type="button" selector="//*[@class='fotorama__stage__shaft']"/> + <element name="videoPausedMode" type="button" selector="//*[contains(@class, 'paused-mode')]"/> + <element name="videoPlayedMode" type="button" selector="//*[contains(@class,'playing-mode')]"/> + <element name="frameVideo" type="button" selector="widget2"/> </section> </sections> diff --git a/app/code/Magento/Reports/Test/Mftf/Section/OrderReportMainSection.xml b/app/code/Magento/Reports/Test/Mftf/Section/OrderReportMainSection.xml index 7ad9bdfa8c12c..6b1dcbb110583 100644 --- a/app/code/Magento/Reports/Test/Mftf/Section/OrderReportMainSection.xml +++ b/app/code/Magento/Reports/Test/Mftf/Section/OrderReportMainSection.xml @@ -17,8 +17,8 @@ <element name="dateFrom" type="input" selector="#sales_report_from"/> <element name="dateTo" type="input" selector="#sales_report_to"/> <element name="orderStatus" type="select" selector="#sales_report_show_order_statuses"/> - <element name="optionAny" type="option" selector="//select[@id='sales_report_show_order_statuses']/option[contains(text(), 'Any')]"/> - <element name="optionSpecified" type="option" selector="//select[@id='sales_report_show_order_statuses']/option[contains(text(), 'Specified')]"/> + <element name="optionAny" type="select" selector="//select[@id='sales_report_show_order_statuses']/option[contains(text(), 'Any')]"/> + <element name="optionSpecified" type="select" selector="//select[@id='sales_report_show_order_statuses']/option[contains(text(), 'Specified')]"/> <element name="orderStatusSpecified" type="select" selector="#sales_report_order_statuses"/> </section> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml index 4159f9435c866..a9281be1bed08 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml @@ -8,7 +8,7 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="StorefrontOrderInformationPage" url="sales/guest/view" area="guest" module="Magento_Sales"> + <page name="StorefrontOrderInformationPage" url="sales/guest/view" area="storefront" module="Magento_Sales"> <section name="StorefrontOrderInformationMainSection"/> </page> </pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml index ee546174d9680..cd15a27fa8c3d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml @@ -8,7 +8,7 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="StorefrontOrdersAndReturnsPage" url="sales/guest/form" area="guest" module="Magento_Sales"> + <page name="StorefrontOrdersAndReturnsPage" url="sales/guest/form" area="storefront" module="Magento_Sales"> <section name="StorefrontOrderAndReturnInformationSection"/> </page> </pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml index 11d973d1e19de..71050f487ef75 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml @@ -13,6 +13,6 @@ <element name="email" type="input" selector="#email"/> <element name="requiredGroup" type="text" selector=".admin__field.required[data-ui-id='billing-address-fieldset-element-form-field-group-id']"/> <element name="requiredEmail" type="text" selector=".admin__field.required[data-ui-id='billing-address-fieldset-element-form-field-email']"/> - <element name="defaultGeneral" type="text" selector="//*[contains(text(),'General')]" time="15"/> + <element name="defaultGeneral" type="text" selector="//*[contains(text(),'General')]" timeout="15"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml index aa57dd9bc17ba..55396ce4a0f8d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml @@ -14,7 +14,7 @@ <element name="findOrderBy" type="select" selector="#quick-search-type-id"/> <element name="email" type="input" selector="#oar_email"/> <element name="bilingZipCode" type="input" selector="//input[@id='oar_zip']"/> - <element name="continueButton" type="submit" selector="//button[@title='Continue']"/> - <element name="ordersAndReturnsTitle" type="span" selector="//span[@id='page-title-wrapper']"/> + <element name="continueButton" type="button" selector="//button[@title='Continue']"/> + <element name="ordersAndReturnsTitle" type="text" selector="//span[@id='page-title-wrapper']"/> </section> </sections> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml index e42c301206152..463edaffece7f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml @@ -9,7 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontOrderInformationMainSection"> - <element name="orderTitle" type="span" selector="#page-title-wrapper"/> - <element name="return" type="span" selector="//span[contains(text(), 'Return')]"/> + <element name="orderTitle" type="text" selector="#page-title-wrapper"/> + <element name="return" type="text" selector="//span[contains(text(), 'Return')]"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml index c6a9704698b05..a8220ad0cfca3 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Data/WishlistData.xml @@ -12,7 +12,7 @@ <var key="product" entityType="product" entityKey="id"/> <var key="customer_email" entityType="customer" entityKey="email"/> <var key="customer_password" entityType="customer" entityKey="password"/> - <data key="shareInfo_emails" entityType="customer" >JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> - <data key="shareInfo_message" entityType="customer">Sharing message.</data> + <data key="shareInfo_emails">JohnDoe123456789@example.com,JohnDoe987654321@example.com,JohnDoe123456abc@example.com</data> + <data key="shareInfo_message">Sharing message.</data> </entity> </entities> From dd2f57fca1ef17d278b3a50979fc5c514ce725d4 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov <evgeny_petrov@epam.com> Date: Wed, 24 Apr 2019 09:02:47 +0300 Subject: [PATCH 027/464] MAGETWO-70681: Store View name DB field is too short --- app/code/Magento/Sales/etc/db_schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/etc/db_schema.xml b/app/code/Magento/Sales/etc/db_schema.xml index 82e6d5d10b53a..821eb74228ddc 100644 --- a/app/code/Magento/Sales/etc/db_schema.xml +++ b/app/code/Magento/Sales/etc/db_schema.xml @@ -219,7 +219,7 @@ <column xsi:type="varchar" name="remote_ip" nullable="true" length="45" comment="Remote Ip"/> <column xsi:type="varchar" name="shipping_method" nullable="true" length="120"/> <column xsi:type="varchar" name="store_currency_code" nullable="true" length="3" comment="Store Currency Code"/> - <column xsi:type="varchar" name="store_name" nullable="true" length="255" comment="Store Name"/> + <column xsi:type="text" name="store_name" nullable="true" comment="Store Name"/> <column xsi:type="varchar" name="x_forwarded_for" nullable="true" length="32" comment="X Forwarded For"/> <column xsi:type="text" name="customer_note" nullable="true" comment="Customer Note"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" From 4dfa1b71de8e37f4e818c29c96e479667184b794 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Thu, 25 Apr 2019 13:07:15 +0300 Subject: [PATCH 028/464] MC-5301: Create retail customer group --- .../Mftf/Page/AdminNewCatalogRulePage.xml | 13 ++++ ...merGroupOnCartPriceRuleFormActionGroup.xml | 17 +++++ ...GroupOnCatalogPriceRuleFormActionGroup.xml | 17 +++++ ...CustomerGroupOnCustomerFormActionGroup.xml | 17 +++++ ...tCustomerGroupOnProductFormActionGroup.xml | 19 +++++ ...tCustomerGroupPresentInGridActionGroup.xml | 14 ++++ ...eCustomerGroupAlreadyExistsActionGroup.xml | 14 ++++ ...inCreateCustomerGroupAlreadyExistsTest.xml | 39 ++++++++++ .../AdminCreateRetailCustomerGroupTest.xml | 71 +++++++++++++++++++ .../AdminCreateTaxClassCustomerGroupTest.xml | 53 ++++++++++++++ 10 files changed, 274 insertions(+) create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml new file mode 100644 index 0000000000000..c5307bf4e22f9 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminNewCatalogRulePage" url="catalog_rule/promo_catalog/new/" module="Magento_CatalogRule" area="admin"> + </page> +</pages> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml new file mode 100644 index 0000000000000..15fac66ba4e6f --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnCartPriceRuleForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{PriceRuleNewPage.url}}" stepKey="amOnCartPriceRuleCreateCreatePage"/> + <see selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresentOnCartPriceRuleForm"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml new file mode 100644 index 0000000000000..7bb6c1945c38e --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnCatalogPriceRuleForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminNewCatalogRulePage.url}}" stepKey="amOnCatalogPriceRuleCreatePage"/> + <see selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresentOnCatalogPriceRuleForm"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml new file mode 100644 index 0000000000000..a517d564b7ed7 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnCustomerForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="amOnCustomerCreatePage"/> + <see selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml new file mode 100644 index 0000000000000..9edc8d0faff42 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnProductForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="amOnProductCreatePage"/> + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="clickAddButton"/> + <see selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml new file mode 100644 index 0000000000000..248c93a16def8 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupPresentInGrid" extends="AdminFilterCustomerGroupByNameActionGroup"> + <!--- Assume we are on admin customer group page. --> + <see selector="{{AdminDataGridTableSection.column('Group')}}" userInput="{{customerGroupName}}" after="clickApplyFiltersButton" stepKey="seeCustomerGroupNameInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml new file mode 100644 index 0000000000000..81e999938dc68 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertErrorMessageCustomerGroupAlreadyExists" extends="AdminCreateCustomerGroupActionGroup"> + <remove keyForRemoval="seeCustomerGroupSaveMessage"/> + <see selector="{{AdminMessagesSection.errorMessage}}" userInput="Customer Group already exists." stepKey="seeErrorMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml new file mode 100644 index 0000000000000..6b1c1f29f97fc --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCustomerGroupAlreadyExistsTest"> + <annotations> + <features value="Create customer group already exists"/> + <stories value="Create customer group"/> + <title value="Create customer group already exists"/> + <description value="Create customer group already exists"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5302"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set: Group Name "General", Tax Class "Retail customer" + 5. Click "Save Customer Group" button. --> + <!-- Assert "Customer Group already exists." error message displayed --> + <actionGroup ref="AdminAssertErrorMessageCustomerGroupAlreadyExists" stepKey="seeErrorMessageCustomerGroupAlreadyExists"> + <argument name="groupName" value="{{GeneralCustomerGroup.code}}"/> + <argument name="taxClass" value="{{GeneralCustomerGroup.tax_class_name}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml new file mode 100644 index 0000000000000..4f1d88ffe99f5 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateRetailCustomerGroupTest"> + <annotations> + <features value="Create retail customer group"/> + <stories value="Create customer group"/> + <title value="Create retail customer group"/> + <description value="Create retail customer group"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5301"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set. Tax Class - "Retail customer" + 5. Click "Save Customer Group" button. --> + <!-- Assert "You saved the customer group." success message displayed --> + <!-- Assert created Customer Group displayed In Grid --> + <actionGroup ref="AdminCreateCustomerGroupActionGroup" stepKey="createCustomerGroup"> + <argument name="groupName" value="{{CustomCustomerGroup.code}}"/> + <argument name="taxClass" value="{{CustomCustomerGroup.tax_class_name}}"/> + </actionGroup> + <actionGroup ref="AdminAssertCustomerGroupPresentInGrid" stepKey="assertCustomerGroupDisplayedInGrid"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 6. Go to Catalog -> Products -> click "Add Product" button -> click "Advanced Pricing" link -> Customer Group Price -> click "Add" button --> + <!-- Assert: Customer Group Displayed On Product Form --> + <actionGroup ref="AdminAssertCustomerGroupOnProductForm" stepKey="assertCustomerGroupDisplayedOnProductForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 7. Go to Customers -> All Customers -> click "Add New Customer" button --> + <!-- Assert created Customer Group displayed On Customer Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCustomerForm" stepKey="assertCustomerGroupDisplayedOnCustomerForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 8. Go to Marketing - Catalog Price Rule - click "Add New Rule" button --> + <!-- Assert created Customer Group displayed On Catalog Price Rule Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCatalogPriceRuleForm" stepKey="assertCustomerGroupDisplayedOnCatalogPriceRuleForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 9. Go to Marketing - Cart Price Rule - click "Add New Rule" button --> + <!-- Assert created Customer Group displayed On Cart Price Rule Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCartPriceRuleForm" stepKey="assertCustomerGroupDisplayedOnCartPriceRuleForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml new file mode 100644 index 0000000000000..7f0faaddac2bb --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxClassCustomerGroupTest"> + <annotations> + <features value="Create tax class customer group"/> + <stories value="Create customer group"/> + <title value="Create tax class customer group"/> + <description value="Create tax class customer group"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5303"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Tax Class "Customer tax class"--> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClassData"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set: Tax Class "Customer tax class" + 5. Click "Save Customer Group" button. --> + <!-- Assert "You saved the customer group." success message displayed --> + <!-- Assert created Customer Group displayed In Grid --> + <actionGroup ref="AdminCreateCustomerGroupActionGroup" stepKey="createNewCustomerGroup"> + <argument name="groupName" value="{{CustomCustomerGroup.code}}"/> + <argument name="taxClass" value="$$customerTaxClassData.class_name$$"/> + </actionGroup> + <actionGroup ref="AdminAssertCustomerGroupPresentInGrid" stepKey="assertCustomerGroupDisplayedInGrid"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + </test> +</tests> From 7b2eef9419983ea8c22ee6a613960ae75a0abbf3 Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Thu, 25 Apr 2019 15:29:03 +0400 Subject: [PATCH 029/464] MAGETWO-94004: Magento Admin can not configure properly bundle/grouped/configurable product with shared catalog enabled and if they were added by sku to an order - Updated automated test script --- .../ActionGroup/AdminOrderActionGroup.xml | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index 13a9d7531b66c..5827d434af521 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -144,8 +144,8 @@ </actionGroup> <actionGroup name="AdminOrderConfigureConfigurableProduct"> <arguments> - <argument name="optionName" type="string"/> - <argument name="productQty" type="string"/> + <argument name="optionName" type="string" defaultValue="option1"/> + <argument name="productQty" type="string" defaultValue="1"/> </arguments> <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> <waitForPageLoad stepKey="waitForConfigurePageLoad"/> @@ -153,27 +153,21 @@ <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> </actionGroup> - <actionGroup name="AdminOrderConfigureBundleProduct"> + <actionGroup name="AdminOrderConfigureBundleProduct" extends="AdminOrderConfigureConfigurableProduct"> <arguments> <argument name="productName" type="string"/> - <argument name="productQty" type="string"/> <argument name="productNumber" type="string"/> </arguments> - <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> - <waitForPageLoad stepKey="waitForConfigurePageLoad"/> - <checkOption selector="{{AdminOrderFormConfigureProductSection.bundleProductCheckbox(productNumber)}}" stepKey="checkProduct"/> - <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <remove keyForRemoval="selectOption"/> + <checkOption selector="{{AdminOrderFormConfigureProductSection.bundleProductCheckbox(productNumber)}}" stepKey="checkProduct" after="waitForConfigurePageLoad"/> </actionGroup> - <actionGroup name="AdminOrderConfigureGroupedProduct"> + <actionGroup name="AdminOrderConfigureGroupedProduct" extends="AdminOrderConfigureConfigurableProduct"> <arguments> <argument name="productSku" type="string"/> - <argument name="productQty" type="string"/> </arguments> - <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> - <waitForPageLoad stepKey="waitForConfigurePageLoad"/> - <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(productSku)}}" userInput="{{productQty}}" stepKey="fillOptionQuantity"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + <remove keyForRemoval="selectOption"/> + <remove keyForRemoval="fillProductQty"/> + <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(productSku)}}" userInput="{{productQty}}" stepKey="fillOptionQuantity" after="waitForConfigurePageLoad"/> </actionGroup> <!--Add configurable product to order --> From dfaee8e70d76f47e39396922d7a05287150945cb Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Thu, 25 Apr 2019 18:56:20 +0530 Subject: [PATCH 030/464] Fixed magento text swatch switches product image even if attribute feature is disabled --- .../Swatches/Block/Product/Renderer/Configurable.php | 3 +++ .../Swatches/view/frontend/web/js/swatch-renderer.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php index 6143b8e659059..fe9c7cdd07de2 100644 --- a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php +++ b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php @@ -182,6 +182,9 @@ public function getJsonSwatchConfig() $attributeDataArray ); } + if (isset($attributeDataArray['additional_data'])) { + $config[$attributeId]['additional_data'] = $attributeDataArray['additional_data']; + } } return $this->jsonEncoder->encode($config); diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index 2571c0385dab7..fd383e00789be 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -753,7 +753,12 @@ define([ $widget.options.jsonConfig.optionPrices ]); - $widget._loadMedia(); + const checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId].additional_data); + + if (checkAdditionalData.update_product_preview_image == 1) { + $widget._loadMedia(); + } + $input.trigger('change'); }, From a0bf34d6fc8d4107202fe9de0b0aec6634980597 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Fri, 26 Apr 2019 11:49:43 +0300 Subject: [PATCH 031/464] MC-5301: Create retail customer group --- ...tomerGroupOnCatalogPriceRuleFormActionGroup.xml | 1 + ...nOpenNewCatalogPriceRuleFormPageActionGroup.xml | 2 +- .../Test/Mftf/Page/CatalogRuleNewPage.xml | 14 -------------- ...ssertCustomerGroupOnCustomerFormActionGroup.xml | 1 + ...AssertCustomerGroupOnProductFormActionGroup.xml | 2 ++ ...essageCustomerGroupAlreadyExistsActionGroup.xml | 1 + .../Test/AdminCreateTaxClassCustomerGroupTest.xml | 7 ++++++- ...CustomerGroupOnCartPriceRuleFormActionGroup.xml | 1 + 8 files changed, 13 insertions(+), 16 deletions(-) rename app/code/Magento/{Customer => CatalogRule}/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml (86%) delete mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml rename app/code/Magento/{Customer => SalesRule}/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml (86%) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml similarity index 86% rename from app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml rename to app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml index 7bb6c1945c38e..ef498b95a5dca 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml @@ -12,6 +12,7 @@ <argument name="customerGroupName" type="string"/> </arguments> <amOnPage url="{{AdminNewCatalogRulePage.url}}" stepKey="amOnCatalogPriceRuleCreatePage"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRule.customerGroups}}" stepKey="waitForElementVisible"/> <see selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresentOnCatalogPriceRuleForm"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml index 072e8b24b0336..8651a17cb969e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOpenNewCatalogPriceRuleFormPageActionGroup"> - <amOnPage url="{{CatalogRuleNewPage.url}}" stepKey="openNewCatalogPriceRulePage" /> + <amOnPage url="{{AdminNewCatalogRulePage.url}}" stepKey="openNewCatalogPriceRulePage" /> <waitForPageLoad stepKey="waitForPageLoad" /> </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml b/app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml deleted file mode 100644 index ad3e40b37c5b0..0000000000000 --- a/app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="CatalogRuleNewPage" url="catalog_rule/promo_catalog/new/" module="Magento_CatalogRule" area="admin"> - <section name="AdminNewCatalogPriceRule"/> - </page> -</pages> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml index a517d564b7ed7..3112f2b3efee0 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml @@ -12,6 +12,7 @@ <argument name="customerGroupName" type="string"/> </arguments> <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="amOnCustomerCreatePage"/> + <waitForElementVisible selector="{{AdminCustomerAccountInformationSection.group}}" stepKey="waitForElementVisible"/> <see selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml index 9edc8d0faff42..0f6d6a5fcfd98 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml @@ -12,7 +12,9 @@ <argument name="customerGroupName" type="string"/> </arguments> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="amOnProductCreatePage"/> + <waitForElementVisible selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="waitForAdvancedPricingLinkVisible"/> <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForAddButtonVisible"/> <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="clickAddButton"/> <see selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml index 81e999938dc68..5eb52630d906b 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml @@ -9,6 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminAssertErrorMessageCustomerGroupAlreadyExists" extends="AdminCreateCustomerGroupActionGroup"> <remove keyForRemoval="seeCustomerGroupSaveMessage"/> + <waitForElementVisible selector="{{AdminMessagesSection.errorMessage}}" stepKey="waitForElementVisible"/> <see selector="{{AdminMessagesSection.errorMessage}}" userInput="Customer Group already exists." stepKey="seeErrorMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml index 7f0faaddac2bb..c1893549b32b4 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -28,11 +28,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> + <deleteData createDataKey="createCustomerTaxClass" after="deleteCustomerGroup" stepKey="deleteCustomerTaxClass"/> <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> - <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. @@ -49,5 +49,10 @@ <actionGroup ref="AdminAssertCustomerGroupPresentInGrid" stepKey="assertCustomerGroupDisplayedInGrid"> <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> + <!-- 6. Go to Customers -> All Customers -> click "Add New Customer" button --> + <!-- Assert created Customer Group displayed On Customer Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCustomerForm" stepKey="assertCustomerGroupDisplayedOnCustomerForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> </test> </tests> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml similarity index 86% rename from app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml rename to app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml index 15fac66ba4e6f..083e220d0e937 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml @@ -12,6 +12,7 @@ <argument name="customerGroupName" type="string"/> </arguments> <amOnPage url="{{PriceRuleNewPage.url}}" stepKey="amOnCartPriceRuleCreateCreatePage"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.customerGroups}}" stepKey="waitForElementVisible"/> <see selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresentOnCartPriceRuleForm"/> </actionGroup> </actionGroups> From 6ce20262a90e0f9045691f3207d9acaa2b7b3f40 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 26 Apr 2019 12:37:23 +0300 Subject: [PATCH 032/464] magento/magento2#19184: Static test fix. --- .../Block/Product/Renderer/Configurable.php | 15 ++++++++++++++- .../view/frontend/web/js/swatch-renderer.js | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php index fe9c7cdd07de2..0848f566f67bb 100644 --- a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php +++ b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php @@ -192,6 +192,7 @@ public function getJsonSwatchConfig() /** * Get number of swatches from config to show on product listing. + * * Other swatches can be shown after click button 'Show more' * * @return string @@ -231,6 +232,8 @@ public function getProduct() } /** + * Get swatch attributes data. + * * @return array */ protected function getSwatchAttributesData() @@ -239,6 +242,8 @@ protected function getSwatchAttributesData() } /** + * Init isProductHasSwatchAttribute. + * * @deprecated 100.1.5 Method isProductHasSwatchAttribute() is used instead of this. * * @codeCoverageIgnore @@ -367,6 +372,8 @@ protected function getVariationMedia($attributeCode, $optionId) } /** + * Get swatch product image. + * * @param Product $childProduct * @param string $imageType * @return string @@ -387,6 +394,8 @@ protected function getSwatchProductImage(Product $childProduct, $imageType) } /** + * Check if product have image. + * * @param Product $product * @param string $imageType * @return bool @@ -397,6 +406,8 @@ protected function isProductHasImage(Product $product, $imageType) } /** + * Get configurable options ids. + * * @param array $attributeData * @return array * @since 100.0.3 @@ -456,8 +467,8 @@ protected function getRendererTemplate() } /** + * @inheritDoc * @deprecated 100.1.5 Now is used _toHtml() directly - * @return string */ protected function getHtmlOutput() { @@ -465,6 +476,8 @@ protected function getHtmlOutput() } /** + * Get media callback url. + * * @return string */ public function getMediaCallback() diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index fd383e00789be..ae5014f77254d 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -753,9 +753,9 @@ define([ $widget.options.jsonConfig.optionPrices ]); - const checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId].additional_data); + var checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId]['additional_data']); - if (checkAdditionalData.update_product_preview_image == 1) { + if (1 == checkAdditionalData['update_product_preview_image']) { $widget._loadMedia(); } From de9745b3d15ae99c9c7333b3459d69f93a90012b Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Fri, 26 Apr 2019 16:21:28 +0300 Subject: [PATCH 033/464] MC-5301: Create retail customer group --- .../Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml index c1893549b32b4..875a67d908109 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -28,12 +28,12 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <deleteData createDataKey="createCustomerTaxClass" after="deleteCustomerGroup" stepKey="deleteCustomerTaxClass"/> <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> <actionGroup ref="logout" stepKey="logout"/> + <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> </after> <!-- Steps: 1. Log in to backend as admin user. 2. Navigate to Stores > Other Settings > Customer Groups. From 01e8ff1c99557f267ca5ecc5eb450218bba6fc0b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 26 Apr 2019 16:23:23 +0300 Subject: [PATCH 034/464] magento/magento2#19184: MFTF test fix --- .../Test/Mftf/Section/AdminCreateProductAttributeSection.xml | 1 + .../Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml index d24c501152b78..7ca2c0a56f224 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml @@ -13,6 +13,7 @@ <element name="DefaultLabel" type="input" selector="#attribute_label"/> <element name="InputType" type="select" selector="#frontend_input"/> <element name="ValueRequired" type="select" selector="#is_required"/> + <element name="UpdateProductPreviewImage" type="select" selector="[name='update_product_preview_image']"/> <element name="AdvancedProperties" type="button" selector="#advanced_fieldset-wrapper"/> <element name="DefaultValue" type="input" selector="#default_value_text"/> <element name="Scope" type="select" selector="#is_global"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index e4c96ab3a2ba7..b82fce84a550b 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -41,6 +41,9 @@ <!-- Select visual swatch --> <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="swatch_visual" stepKey="selectInputType"/> + <!-- Set Update Product Preview Image to Yes--> + <selectOption selector="{{AttributePropertiesSection.UpdateProductPreviewImage}}" userInput="Yes" stepKey="setUpdateProductPreviewImage"/> + <!-- This hack is because the same <input type="file"> is re-purposed used for all uploads. --> <executeJS function="HTMLInputElement.prototype.click = function() { if(this.type !== 'file') HTMLElement.prototype.click.call(this); };" stepKey="disableClick"/> From 54fac7699e1b1ed6814469cbe86255016401168e Mon Sep 17 00:00:00 2001 From: Evgeny Petrov <evgeny_petrov@epam.com> Date: Thu, 25 Apr 2019 14:37:26 +0300 Subject: [PATCH 035/464] MAGETWO-36337: Not user-friendly behaviour of "Save in address book" check-box inside "Shipping Address" section on "create Order" Admin page --- .../Block/Adminhtml/Order/Create/Shipping/Address.php | 10 ++++++++++ .../Sales/view/adminhtml/web/order/create/scripts.js | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php index 7a8f3effef07e..8809ac575e5e7 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php @@ -81,6 +81,15 @@ public function getIsAsBilling() */ public function getDontSaveInAddressBook() { + $shippingIsTheSameAsBilling = $this->getIsAsBilling() && $this->getIsShipping(); + $params = $this->getRequest()->getParams(); + if ($shippingIsTheSameAsBilling && $params) { + $save = $params['order']['billing_address']['save_in_address_book'] ?? false; + return !$save; + } + if ($shippingIsTheSameAsBilling) { + return !($this->getIsAsBilling() && $this->getIsShipping()); + } return $this->getIsAsBilling(); } @@ -121,6 +130,7 @@ public function getAddress() /** * Return is address disabled flag + * * Return true is the quote is virtual * * @return bool diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index c508a5ecdfa58..e11fb42f513b1 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -259,7 +259,7 @@ define([ data = data.toObject(); if (type === 'billing' && this.shippingAsBilling) { - this.syncAddressField(this.shippingAddressContainer, field.name, field.value); + this.syncAddressField(this.shippingAddressContainer, field.name, field); resetShipping = true; } @@ -308,7 +308,11 @@ define([ $(container).select('[name="' + syncName + '"]').each(function (element) { if (~['input', 'textarea', 'select'].indexOf(element.tagName.toLowerCase())) { - element.value = fieldValue; + if (element.type === "checkbox") { + element.checked = fieldValue.checked; + } else { + element.value = fieldValue.value; + } } }); }, From a8ae3b609397027db5f492af1437be40ade07e86 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Fri, 26 Apr 2019 16:29:16 +0300 Subject: [PATCH 036/464] MC-5301: Create retail customer group --- .../Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml index 875a67d908109..7d54ede7c1612 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -32,8 +32,8 @@ <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> + <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. 2. Navigate to Stores > Other Settings > Customer Groups. From 06515aeaa2d20bb213e2d35446adf6699c3082d5 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Sun, 28 Apr 2019 21:33:12 -0500 Subject: [PATCH 037/464] MQE-1367: XSD Schema validation must be triggered before merging to mainline Delete empty section --- .../Test/Mftf/Section/StorefrontFooterSection.xml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 app/code/Magento/Theme/Test/Mftf/Section/StorefrontFooterSection.xml diff --git a/app/code/Magento/Theme/Test/Mftf/Section/StorefrontFooterSection.xml b/app/code/Magento/Theme/Test/Mftf/Section/StorefrontFooterSection.xml deleted file mode 100644 index d9854b7a80b9b..0000000000000 --- a/app/code/Magento/Theme/Test/Mftf/Section/StorefrontFooterSection.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontFooterSection"> - </section> -</sections> From 4c55aa19fee322df2ba55b3232dd6624935674c0 Mon Sep 17 00:00:00 2001 From: Dmitriy Kogut <kogut.dmitriy@gmail.com> Date: Tue, 30 Apr 2019 10:56:06 +0300 Subject: [PATCH 038/464] MC-5274: Create product that visible only in search and check min/max qty allowed in the shopping cart --- .../TestCase/Product/CreateSimpleProductEntityPartOneTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityPartOneTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityPartOneTest.xml index f97735304baa5..ffaefdd945565 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityPartOneTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityPartOneTest.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Product\CreateSimpleProductEntityPartOneTest" summary="Create Simple Product" ticketId="MAGETWO-23414"> <variation name="CreateSimpleProductEntityTestVariation12" summary="Create product that visible only in search and check min/max qty allowed in the shopping cart" ticketId="MAGETWO-43376, MAGETWO-43359"> - <data name="issue" xsi:type="string">MAGETWO-63217: Error message doesn't appear on add in the cart less products than configured</data> <data name="configData" xsi:type="string">inventory_min_qty_3, inventory_max_qty_5</data> <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> From 73ef11915ffa0ed8f8d38b785d59d3ad8ace9218 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 30 Apr 2019 13:12:43 +0300 Subject: [PATCH 039/464] magento/magento2#19184: Static test fix. --- .../Swatches/view/frontend/web/js/swatch-renderer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index ae5014f77254d..7e12f89738d39 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -713,7 +713,8 @@ define([ $wrapper = $this.parents('.' + $widget.options.classes.attributeOptionsWrapper), $label = $parent.find('.' + $widget.options.classes.attributeSelectedOptionLabelClass), attributeId = $parent.attr('attribute-id'), - $input = $parent.find('.' + $widget.options.classes.attributeInput); + $input = $parent.find('.' + $widget.options.classes.attributeInput), + checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId]['additional_data']); if ($widget.inProductList) { $input = $widget.productForm.find( @@ -753,9 +754,7 @@ define([ $widget.options.jsonConfig.optionPrices ]); - var checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId]['additional_data']); - - if (1 == checkAdditionalData['update_product_preview_image']) { + if (checkAdditionalData['update_product_preview_image'] === '1') { $widget._loadMedia(); } From 85e856e6f63ff1f027b334c480dea4eed73c0456 Mon Sep 17 00:00:00 2001 From: Dmitriy Kogut <kogut.dmitriy@gmail.com> Date: Tue, 30 Apr 2019 17:21:55 +0300 Subject: [PATCH 040/464] MC-5274: Create product that visible only in search and check min/max qty allowed in the shopping cart --- .../Catalog/Test/Block/Product/View.php | 19 +++++++++++++++++++ .../AssertProductInventoryMaxAllowedQty.php | 4 ++-- .../AssertProductInventoryMinAllowedQty.php | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php index 990906b7e302a..c4ac7f32a94bf 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php @@ -220,6 +220,13 @@ class View extends AbstractConfigureBlock */ private $thresholdMessage = '.availability.only'; + /** + * Qty field error message selector. + * + * @var string + */ + private $qtyErrorMessage = '#qty-error'; + /** * Checks if threshold message is displayed. * @@ -677,4 +684,16 @@ public function checkVideoDataPresence($videoData) $dataVideoSelector = $this->productVideo . '[data-code="' . $videoData. '"]'; return $this->_rootElement->find($dataVideoSelector)->isPresent(); } + + /** + * Resolve qty field error message. + * + * @return string + */ + public function getQtyErrorMessage() + { + $this->waitForElementVisible($this->qtyErrorMessage); + + return $this->_rootElement->find($this->qtyErrorMessage)->getText(); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMaxAllowedQty.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMaxAllowedQty.php index cb05b289105ff..fadd9e1476334 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMaxAllowedQty.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMaxAllowedQty.php @@ -22,7 +22,7 @@ class AssertProductInventoryMaxAllowedQty extends AbstractConstraint * * @var string */ - private $errorMessage = 'The most you may purchase is %s.'; + private $errorMessage = 'The maximum you may purchase is %s.'; /** * Check if max qty setting is working correctly. @@ -48,8 +48,8 @@ public function processAssert( $catalogProductView->getViewBlock()->waitLoader(); $catalogProductView->getViewBlock()->setQtyAndClickAddToCart($maxQty * 2); \PHPUnit\Framework\Assert::assertEquals( - $catalogProductView->getMessagesBlock()->getErrorMessage(), sprintf($this->errorMessage, $maxQty), + $catalogProductView->getViewBlock()->getQtyErrorMessage(), 'The maximum purchase warning message is not appears.' ); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMinAllowedQty.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMinAllowedQty.php index b950fb216b1c5..8c0831578473b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMinAllowedQty.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInventoryMinAllowedQty.php @@ -48,8 +48,8 @@ public function processAssert( $catalogProductView->getViewBlock()->waitLoader(); $catalogProductView->getViewBlock()->setQtyAndClickAddToCart(1); \PHPUnit\Framework\Assert::assertEquals( - $catalogProductView->getMessagesBlock()->getErrorMessage(), sprintf($this->errorMessage, $minQty), + $catalogProductView->getViewBlock()->getQtyErrorMessage(), 'The minimum purchase warning message is not appears.' ); From 19e7380ec70ab4df8cc1d1704024dcce4600d24c Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Wed, 1 May 2019 09:32:37 +0530 Subject: [PATCH 041/464] Fixed wrong URL redirect when edit product review from Customer view page and edit product page --- .../Review/Block/Adminhtml/Edit/Form.php | 17 ++++++++++++----- .../Controller/Adminhtml/Product/Save.php | 4 ++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php index 4f7237a0b44be..346d5b60aad1b 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php @@ -75,6 +75,17 @@ protected function _prepareForm() $review = $this->_coreRegistry->registry('review_data'); $product = $this->_productFactory->create()->load($review->getEntityPkValue()); + $formActionParams = [ + 'id' => $this->getRequest()->getParam('id'), + 'ret' => $this->_coreRegistry->registry('ret') + ]; + if ($this->getRequest()->getParam('productId')) { + $formActionParams['productId'] = $this->getRequest()->getParam('productId'); + } + if ($this->getRequest()->getParam('customerId')) { + $formActionParams['customerId'] = $this->getRequest()->getParam('customerId'); + } + /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create( [ @@ -82,11 +93,7 @@ protected function _prepareForm() 'id' => 'edit_form', 'action' => $this->getUrl( 'review/*/save', - [ - 'id' => $this->getRequest()->getParam('id'), - 'ret' => $this->_coreRegistry->registry('ret'), - 'productId' => $this->getRequest()->getParam('productId') - ] + $formActionParams ), 'method' => 'post', ], diff --git a/app/code/Magento/Review/Controller/Adminhtml/Product/Save.php b/app/code/Magento/Review/Controller/Adminhtml/Product/Save.php index 57b1e538ddb6b..d9498580c39ba 100644 --- a/app/code/Magento/Review/Controller/Adminhtml/Product/Save.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product/Save.php @@ -77,6 +77,10 @@ public function execute() if ($productId) { $resultRedirect->setPath("catalog/product/edit/id/$productId"); } + $customerId = (int)$this->getRequest()->getParam('customerId'); + if ($customerId) { + $resultRedirect->setPath("customer/index/edit/id/$customerId"); + } return $resultRedirect; } $resultRedirect->setPath('review/*/'); From c931257ca299049d146a9015e36a41276859b9be Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Thu, 2 May 2019 12:57:05 +0400 Subject: [PATCH 042/464] MAGETWO-94004: Magento Admin can not configure properly bundle/grouped/configurable product with shared catalog enabled and if they were added by sku to an order - Updated automated test script --- .../AdminOrderBundleProductActionGroup.xml | 23 +++++++++++ .../AdminOrderBundleProductSection.xml | 14 +++++++ ...minOrderConfigurableProductActionGroup.xml | 22 +++++++++++ .../AdminOrderGroupedProductActionGroup.xml | 21 ++++++++++ .../ActionGroup/AdminOrderActionGroup.xml | 38 ------------------- .../AdminOrderFormConfigureProductSection.xml | 1 - 6 files changed, 80 insertions(+), 39 deletions(-) create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml new file mode 100644 index 0000000000000..77f6bbec646cf --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderConfigureBundleProduct"> + <arguments> + <argument name="productName" type="string"/> + <argument name="productNumber" type="string"/> + <argument name="productQty" type="string"/> + </arguments> + <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> + <waitForPageLoad stepKey="waitForConfigurePageLoad"/> + <checkOption selector="{{AdminOrderBundleProductSection.bundleProductCheckbox(productNumber)}}" stepKey="checkProduct"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml new file mode 100644 index 0000000000000..2773616971295 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> +<section name="AdminOrderBundleProductSection"> + <element name="bundleProductCheckbox" type="checkbox" selector="(//input[contains(@class, 'admin__control-checkbox') and contains(@class, 'bundle-option')])[{{row}}]" parameterized="true"/> +</section> +</sections> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..40a03874aaa21 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderConfigureConfigurableProduct"> + <arguments> + <argument name="optionName" type="string"/> + <argument name="productQty" type="string"/> + </arguments> + <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> + <waitForPageLoad stepKey="waitForConfigurePageLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.attributeSelect}}" userInput="{{optionName}}" stepKey="selectOption"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml new file mode 100644 index 0000000000000..69023d0a14931 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderConfigureGroupedProduct"> + <arguments> + <argument name="productSku" type="string"/> + <argument name="productQty" type="string"/> + </arguments> + <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> + <waitForPageLoad stepKey="waitForConfigurePageLoad"/> + <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(productSku)}}" userInput="{{productQty}}" stepKey="fillOptionQuantity"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index 5827d434af521..0e09f3933c1aa 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -131,44 +131,6 @@ <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> </actionGroup> - <actionGroup name="AdminAddProductToOrderBySKU"> - <arguments> - <argument name="productSKU" type="string"/> - <argument name="productQty" type="string"/> - <argument name="productNumber" type="string"/> - </arguments> - <click selector="{{AdminOrderFormItemsOrderedSection.addProductsBySku}}" stepKey="clickAddProduct"/> - <fillField selector="{{AdminOrderFormItemsSection.skuNumber(productNumber)}}" userInput="{{productSKU}}" stepKey="fillProductSKU"/> - <fillField selector="{{AdminOrderFormItemsSection.qty(productNumber)}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - <click selector="{{AdminOrderFormItemsSection.addToOrder}}" stepKey="clickAddToOrder"/> - </actionGroup> - <actionGroup name="AdminOrderConfigureConfigurableProduct"> - <arguments> - <argument name="optionName" type="string" defaultValue="option1"/> - <argument name="productQty" type="string" defaultValue="1"/> - </arguments> - <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> - <waitForPageLoad stepKey="waitForConfigurePageLoad"/> - <selectOption selector="{{AdminOrderFormConfigureProductSection.attributeSelect}}" userInput="{{optionName}}" stepKey="selectOption"/> - <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> - <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> - </actionGroup> - <actionGroup name="AdminOrderConfigureBundleProduct" extends="AdminOrderConfigureConfigurableProduct"> - <arguments> - <argument name="productName" type="string"/> - <argument name="productNumber" type="string"/> - </arguments> - <remove keyForRemoval="selectOption"/> - <checkOption selector="{{AdminOrderFormConfigureProductSection.bundleProductCheckbox(productNumber)}}" stepKey="checkProduct" after="waitForConfigurePageLoad"/> - </actionGroup> - <actionGroup name="AdminOrderConfigureGroupedProduct" extends="AdminOrderConfigureConfigurableProduct"> - <arguments> - <argument name="productSku" type="string"/> - </arguments> - <remove keyForRemoval="selectOption"/> - <remove keyForRemoval="fillProductQty"/> - <fillField selector="{{AdminOrderFormGroupedProductSection.optionQty(productSku)}}" userInput="{{productQty}}" stepKey="fillOptionQuantity" after="waitForConfigurePageLoad"/> - </actionGroup> <!--Add configurable product to order --> <actionGroup name="addConfigurableProductToOrderFromAdmin" extends="addConfigurableProductToOrder"> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml index aa430bced2659..584afff2b5e8d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormConfigureProductSection.xml @@ -13,6 +13,5 @@ <element name="quantity" type="input" selector="#product_composite_configure_input_qty"/> <element name="ok" type="button" selector=".modal-header .page-actions button[data-role='action']" timeout="30"/> <element name="attributeSelect" type="select" selector="//div[contains(@class, 'product-options')]//select" timeout="30"/> - <element name="bundleProductCheckbox" type="checkbox" selector="(//input[contains(@class, 'admin__control-checkbox') and contains(@class, 'bundle-option')])[{{row}}]" parameterized="true"/> </section> </sections> From 1f8736cc041426c5852394661b361ca34adcf71e Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 2 May 2019 11:28:23 -0500 Subject: [PATCH 043/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Magento/AdminNotification/Model/Feed.php | 10 +++++++++- .../Block/Adminhtml/Template/Preview.php | 10 +++++++++- app/code/Magento/SendFriend/Model/SendFriend.php | 8 ++++---- .../Magento/Translation/Model/Inline/Parser.php | 16 ++++++++++++---- .../Model/ResourceModel/StringUtils.php | 10 +++++++++- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index d3b0b8501c864..931053099d55f 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -37,6 +37,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel */ protected $_backendConfig; + /** + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * @var \Magento\AdminNotification\Model\InboxFactory */ @@ -69,6 +74,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Backend\App\ConfigInterface $backendConfig + * @param \Magento\Framework\Escaper $escaper * @param InboxFactory $inboxFactory * @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig @@ -83,6 +89,7 @@ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, + \Magento\Framework\Escaper $escaper, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\Framework\App\DeploymentConfig $deploymentConfig, @@ -94,6 +101,7 @@ public function __construct( ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_backendConfig = $backendConfig; + $this->escaper = $escaper; $this->_inboxFactory = $inboxFactory; $this->curlFactory = $curlFactory; $this->_deploymentConfig = $deploymentConfig; @@ -252,6 +260,6 @@ public function getFeedXml() */ private function escapeString(\SimpleXMLElement $data) { - return htmlspecialchars((string)$data); + return $this->escaper->escapeHtml((string)$data); } } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php index f9474da452cac..f783dc0efbc58 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php @@ -30,20 +30,28 @@ class Preview extends \Magento\Backend\Block\Widget */ protected $_subscriberFactory; + /** + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @param \Magento\Framework\Escaper $escaper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, + \Magento\Framework\Escaper $escaper, array $data = [] ) { $this->_templateFactory = $templateFactory; $this->_subscriberFactory = $subscriberFactory; + $this->escaper = $escaper; parent::__construct($context, $data); } @@ -84,7 +92,7 @@ protected function _toHtml() $template->revertDesign(); if ($template->isPlain()) { - $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>"; + $templateProcessed = "<pre>" . $this->escaper->escapeHtml($templateProcessed) . "</pre>"; } \Magento\Framework\Profiler::stop($this->profilerName); diff --git a/app/code/Magento/SendFriend/Model/SendFriend.php b/app/code/Magento/SendFriend/Model/SendFriend.php index 825cac2bae10b..2410a56cf339b 100644 --- a/app/code/Magento/SendFriend/Model/SendFriend.php +++ b/app/code/Magento/SendFriend/Model/SendFriend.php @@ -145,7 +145,7 @@ public function __construct( $this->_transportBuilder = $transportBuilder; $this->_catalogImage = $catalogImage; $this->_sendfriendData = $sendfriendData; - $this->_escaper = $escaper; + $this->escaper = $escaper; $this->remoteAddress = $remoteAddress; $this->cookieManager = $cookieManager; $this->inlineTranslation = $inlineTranslation; @@ -178,10 +178,10 @@ public function send() $this->inlineTranslation->suspend(); - $message = nl2br(htmlspecialchars($this->getSender()->getMessage())); + $message = nl2br($this->escaper->escapeHtml($this->getSender()->getMessage())); $sender = [ - 'name' => $this->_escaper->escapeHtml($this->getSender()->getName()), - 'email' => $this->_escaper->escapeHtml($this->getSender()->getEmail()), + 'name' => $this->escaper->escapeHtml($this->getSender()->getName()), + 'email' => $this->escaper->escapeHtml($this->getSender()->getEmail()), ]; foreach ($this->getRecipients()->getEmails() as $k => $email) { diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index e0b2ce40405d1..ab824b8286e3f 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -111,6 +111,11 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface */ protected $_appState; + /** + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * @var \Magento\Framework\Translate\InlineInterface */ @@ -153,6 +158,7 @@ private function getCacheManger() * @param \Magento\Translation\Model\ResourceModel\StringUtilsFactory $resource * @param \Zend_Filter_Interface $inputFilter * @param \Magento\Framework\App\State $appState + * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\App\Cache\TypeListInterface $appCache * @param \Magento\Framework\Translate\InlineInterface $translateInline * @param array $relatedCacheTypes @@ -162,6 +168,7 @@ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\Framework\App\State $appState, + \Magento\Framework\Escaper $escaper, \Magento\Framework\App\Cache\TypeListInterface $appCache, \Magento\Framework\Translate\InlineInterface $translateInline, array $relatedCacheTypes = [] @@ -170,6 +177,7 @@ public function __construct( $this->_storeManager = $storeManager; $this->_inputFilter = $inputFilter; $this->_appState = $appState; + $this->escaper = $escaper; $this->_appCache = $appCache; $this->_translateInline = $translateInline; $this->relatedCacheTypes = $relatedCacheTypes; @@ -344,7 +352,7 @@ protected function _applySpecialTagsFormat($tagHtml, $tagName, $trArr) { $specialTags = $tagHtml . '<span class="translate-inline-' . $tagName . '" ' . $this->_getHtmlAttribute( self::DATA_TRANSLATE, - '[' . htmlspecialchars(join(',', $trArr)) . ']' + '[' . $this->escaper->escapeHtml(join(',', $trArr)) . ']' ); $additionalAttr = $this->_getAdditionalHtmlAttribute($tagName); if ($additionalAttr !== null) { @@ -372,7 +380,7 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) strlen($tagName) + 1 ) . ' ' . $this->_getHtmlAttribute( self::DATA_TRANSLATE, - htmlspecialchars('[' . join(',', $trArr) . ']') + $this->escaper->escapeHtml('[' . join(',', $trArr) . ']') ); $additionalAttr = $this->_getAdditionalHtmlAttribute($tagName); if ($additionalAttr !== null) { @@ -446,7 +454,7 @@ private function _prepareTagAttributesForContent(&$content) $tagHtml = str_replace($matches[0], '', $tagHtml); $trAttr = ' ' . $this->_getHtmlAttribute( self::DATA_TRANSLATE, - '[' . htmlspecialchars($matches[1]) . ',' . str_replace("\"", "'", join(',', $trArr)) . ']' + '[' . $this->escaper->escapeHtml($matches[1]) . ',' . str_replace("\"", "'", join(',', $trArr)) . ']' ); } else { $trAttr = ' ' . $this->_getHtmlAttribute( @@ -649,7 +657,7 @@ private function _otherText() ); $spanHtml = $this->_getDataTranslateSpan( - '[' . htmlspecialchars($translateProperties) . ']', + '[' . $this->escaper->escapeJs($translateProperties) . ']', $matches[1][0] ); $this->_content = substr_replace($this->_content, $spanHtml, $matches[0][1], strlen($matches[0][0])); diff --git a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php index 4be4e055a7d83..650e61d799f29 100644 --- a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php +++ b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php @@ -22,10 +22,16 @@ class StringUtils extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $scope; + /** + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver + * @param \Magento\Framework\Escaper $escaper * @param string $connectionName * @param string|null $scope */ @@ -33,11 +39,13 @@ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\App\ScopeResolverInterface $scopeResolver, + \Magento\Framework\Escaper $escaper, $connectionName = null, $scope = null ) { $this->_localeResolver = $localeResolver; $this->scopeResolver = $scopeResolver; + $this->escaper = $escaper; $this->scope = $scope; parent::__construct($context, $connectionName); } @@ -211,7 +219,7 @@ public function saveTranslate($string, $translate, $locale = null, $storeId = nu $string = htmlspecialchars_decode($string); $connection = $this->getConnection(); $table = $this->getMainTable(); - $translate = htmlspecialchars($translate, ENT_QUOTES); + $translate = $this->escaper->escapeHtml($translate); if ($locale === null) { $locale = $this->_localeResolver->getLocale(); From 2670e4824aaf46ba521c87be2c6e6b9faebbb431 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 2 May 2019 14:53:00 -0500 Subject: [PATCH 044/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Magento/AdminNotification/Model/Feed.php | 18 +++++++-------- .../Directory/Model/ResourceModel/Country.php | 14 +++++++++--- .../Block/Adminhtml/Template/Preview.php | 20 +++++++++-------- .../Magento/SendFriend/Model/SendFriend.php | 8 +++---- .../Translation/Model/Inline/Parser.php | 22 +++++++++---------- .../Model/ResourceModel/StringUtils.php | 18 +++++++-------- 6 files changed, 55 insertions(+), 45 deletions(-) diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 931053099d55f..eab76d2a63c32 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -25,6 +25,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update'; + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Feed url * @@ -37,11 +42,6 @@ class Feed extends \Magento\Framework\Model\AbstractModel */ protected $_backendConfig; - /** - * @var \Magento\Framework\Escaper - */ - protected $escaper; - /** * @var \Magento\AdminNotification\Model\InboxFactory */ @@ -74,7 +74,6 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Backend\App\ConfigInterface $backendConfig - * @param \Magento\Framework\Escaper $escaper * @param InboxFactory $inboxFactory * @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig @@ -83,13 +82,13 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data + * @param \Magento\Framework\Escaper|null $escaper * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, - \Magento\Framework\Escaper $escaper, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, \Magento\Framework\App\DeploymentConfig $deploymentConfig, @@ -97,16 +96,17 @@ public function __construct( \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], + \Magento\Framework\Escaper $escaper = null ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_backendConfig = $backendConfig; - $this->escaper = $escaper; $this->_inboxFactory = $inboxFactory; $this->curlFactory = $curlFactory; $this->_deploymentConfig = $deploymentConfig; $this->productMetadata = $productMetadata; $this->urlBuilder = $urlBuilder; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); } /** diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country.php b/app/code/Magento/Directory/Model/ResourceModel/Country.php index 59fb2de85c8a3..a39f6542d2544 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country.php @@ -13,14 +13,22 @@ */ class Country extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Resource initialization * + * @param \Magento\Framework\Escaper|null $escaper * @return void */ - protected function _construct() - { + protected function _construct( + \Magento\Framework\Escaper $escaper = null + ) { $this->_init('directory_country', 'country_id'); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); } /** @@ -44,7 +52,7 @@ public function loadByCode(\Magento\Directory\Model\Country $country, $code) default: throw new \Magento\Framework\Exception\LocalizedException( - __('Please correct the country code: %1.', htmlspecialchars($code)) + __('Please correct the country code: %1.', $this->escaper->escapeHtml($code)) ); } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php index f783dc0efbc58..b1f10677934d3 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php @@ -13,6 +13,11 @@ */ class Preview extends \Magento\Backend\Block\Widget { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Name for profiler * @@ -30,28 +35,23 @@ class Preview extends \Magento\Backend\Block\Widget */ protected $_subscriberFactory; - /** - * @var \Magento\Framework\Escaper - */ - protected $escaper; - /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Framework\Escaper $escaper * @param array $data + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Framework\Escaper $escaper, - array $data = [] + array $data = [], + \Magento\Framework\Escaper $escaper = null ) { $this->_templateFactory = $templateFactory; $this->_subscriberFactory = $subscriberFactory; - $this->escaper = $escaper; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); parent::__construct($context, $data); } @@ -150,6 +150,8 @@ protected function getStoreId() } /** + * Return template + * * @param \Magento\Newsletter\Model\Template $template * @param string $id * @return $this diff --git a/app/code/Magento/SendFriend/Model/SendFriend.php b/app/code/Magento/SendFriend/Model/SendFriend.php index 2410a56cf339b..164b95a6ca88b 100644 --- a/app/code/Magento/SendFriend/Model/SendFriend.php +++ b/app/code/Magento/SendFriend/Model/SendFriend.php @@ -145,7 +145,7 @@ public function __construct( $this->_transportBuilder = $transportBuilder; $this->_catalogImage = $catalogImage; $this->_sendfriendData = $sendfriendData; - $this->escaper = $escaper; + $this->_escaper = $escaper; $this->remoteAddress = $remoteAddress; $this->cookieManager = $cookieManager; $this->inlineTranslation = $inlineTranslation; @@ -178,10 +178,10 @@ public function send() $this->inlineTranslation->suspend(); - $message = nl2br($this->escaper->escapeHtml($this->getSender()->getMessage())); + $message = nl2br($this->_escaper->escapeHtml($this->getSender()->getMessage())); $sender = [ - 'name' => $this->escaper->escapeHtml($this->getSender()->getName()), - 'email' => $this->escaper->escapeHtml($this->getSender()->getEmail()), + 'name' => $this->_escaper->escapeHtml($this->getSender()->getName()), + 'email' => $this->_escaper->escapeHtml($this->getSender()->getEmail()), ]; foreach ($this->getRecipients()->getEmails() as $k => $email) { diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index ab824b8286e3f..b723dc124f902 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -19,6 +19,11 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface */ const DATA_TRANSLATE = 'data-translate'; + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Response body or JSON content string * @@ -111,11 +116,6 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface */ protected $_appState; - /** - * @var \Magento\Framework\Escaper - */ - protected $escaper; - /** * @var \Magento\Framework\Translate\InlineInterface */ @@ -158,29 +158,29 @@ private function getCacheManger() * @param \Magento\Translation\Model\ResourceModel\StringUtilsFactory $resource * @param \Zend_Filter_Interface $inputFilter * @param \Magento\Framework\App\State $appState - * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\App\Cache\TypeListInterface $appCache * @param \Magento\Framework\Translate\InlineInterface $translateInline * @param array $relatedCacheTypes + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Translation\Model\ResourceModel\StringUtilsFactory $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\Framework\App\State $appState, - \Magento\Framework\Escaper $escaper, \Magento\Framework\App\Cache\TypeListInterface $appCache, \Magento\Framework\Translate\InlineInterface $translateInline, - array $relatedCacheTypes = [] + array $relatedCacheTypes = [], + \Magento\Framework\Escaper $escaper = null ) { $this->_resourceFactory = $resource; $this->_storeManager = $storeManager; $this->_inputFilter = $inputFilter; $this->_appState = $appState; - $this->escaper = $escaper; $this->_appCache = $appCache; $this->_translateInline = $translateInline; $this->relatedCacheTypes = $relatedCacheTypes; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); } /** @@ -380,7 +380,7 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) strlen($tagName) + 1 ) . ' ' . $this->_getHtmlAttribute( self::DATA_TRANSLATE, - $this->escaper->escapeHtml('[' . join(',', $trArr) . ']') + $this->escaper->escapeHtml('[' . join(',', $trArr) . ']') ); $additionalAttr = $this->_getAdditionalHtmlAttribute($tagName); if ($additionalAttr !== null) { @@ -657,7 +657,7 @@ private function _otherText() ); $spanHtml = $this->_getDataTranslateSpan( - '[' . $this->escaper->escapeJs($translateProperties) . ']', + '[' . $this->escaper->escapeHtmlAttr($translateProperties) . ']', $matches[1][0] ); $this->_content = substr_replace($this->_content, $spanHtml, $matches[0][1], strlen($matches[0][0])); diff --git a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php index 650e61d799f29..e106b9327c6a5 100644 --- a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php +++ b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php @@ -7,6 +7,11 @@ class StringUtils extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var \Magento\Framework\Locale\ResolverInterface */ @@ -22,31 +27,26 @@ class StringUtils extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $scope; - /** - * @var \Magento\Framework\Escaper - */ - protected $escaper; - /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver - * @param \Magento\Framework\Escaper $escaper * @param string $connectionName * @param string|null $scope + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\App\ScopeResolverInterface $scopeResolver, - \Magento\Framework\Escaper $escaper, $connectionName = null, - $scope = null + $scope = null, + \Magento\Framework\Escaper $escaper = null ) { $this->_localeResolver = $localeResolver; $this->scopeResolver = $scopeResolver; - $this->escaper = $escaper; $this->scope = $scope; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); parent::__construct($context, $connectionName); } From 1c63159e7dad72ceb707d5c9f3e8cba8b3f37867 Mon Sep 17 00:00:00 2001 From: Davit_Zakharyan <davit_zakharyan@epam.com> Date: Fri, 3 May 2019 14:13:35 +0400 Subject: [PATCH 045/464] MAGETWO-36337: Not user-friendly behaviour of "Save in address book" check-box inside "Shipping Address" section on "create Order" Admin page - Added automated test script. --- ...dminSaveInAddressBookCheckboxStateTest.xml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml new file mode 100644 index 0000000000000..993537fe00588 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminSaveInAddressBookCheckboxStateTest"> + <annotations> + <title value="'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> + <description value="'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> + <features value="Sales"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-36337"/> + <useCaseId value="MAGETWO-99320"/> + <group value="sales"/> + </annotations> + <before> + <!-- Create customer, category, product and log in --> + <comment userInput="Create customer, category, product and log in" stepKey="createTestData"/> + <createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="ApiSimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <actionGroup ref="LoginActionGroup" stepKey="login"/> + </before> + <after> + <!-- Delete created data and log out --> + <comment userInput="Delete created data and log out" stepKey="deleteDataAndLogOut"/> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logOut"/> + </after> + <!-- Create new order and choose an existing customer --> + <comment userInput="Create new order and choose an existing customer" stepKey="createOrderAndAddCustomer"/> + <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage"> + <argument name="customer" value="$$createCustomer$$"/> + </actionGroup> + <!-- Add simple product to order --> + <comment userInput="Add simple product to order" stepKey="addSimpleProdToOrder"/> + <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <!-- Just in case uncheck and check 'Same as Billing Address checkbox' --> + <comment userInput="Just in case uncheck and check 'Same as Billing Address checkbox'" stepKey="uncheckAndCheckAgain"/> + <uncheckOption selector="{{AdminOrderFormShippingAddressSection.SameAsBilling}}" stepKey="unCheckSameAsShippingAddressCheckbox"/> + <waitForPageLoad stepKey="waitPageToLoad1"/> + <checkOption selector="{{AdminOrderFormShippingAddressSection.SameAsBilling}}" stepKey="checkSameAsShippingAddressCheckbox"/> + <waitForPageLoad stepKey="waitPageToLoad2"/> + <!-- Check 'Save in address book' checkbox in 'Billing Address' section --> + <comment userInput="Check 'Save in address book' checkbox in Billing Address section" stepKey="checkSaveInAddressBookCheckbox"/> + <checkOption selector="{{AdminOrderFormBillingAddressSection.SaveAddress}}" stepKey="checkSaveBillingAddressCheckbox"/> + <!-- See if 'Save in Address Book' checkbox is selected in 'Shipping Address' section --> + <comment userInput="'Save in Address Book' checkbox is checked in 'Shipping Address' section" stepKey="checkIfCheckboxIsChecked"/> + <seeCheckboxIsChecked selector="{{AdminOrderFormShippingAddressSection.SaveAddress}}" stepKey="seeCheckBoxIsSelected"/> + <!-- Uncheck 'Save in Address Book' checkbox in 'Billing Address' section --> + <comment userInput="Uncheck 'Save in Address Book' checkbox in 'Billing Address' section" stepKey="uncheckCheckboxInBillingAddressSection"/> + <uncheckOption selector="{{AdminOrderFormBillingAddressSection.SaveAddress}}" stepKey="uncheckSaveBillingAddressCheckbox"/> + <!-- See if 'Save in Address Book' checkbox is deselected in 'Shipping Address' section --> + <comment userInput="See if 'Save in Address Book' checkbox is unchecked in 'Shipping Address' section" stepKey="seeIfCheckboxIsUnchecked"/> + <dontSeeCheckboxIsChecked selector="{{AdminOrderFormShippingAddressSection.SaveAddress}}" stepKey="seeCheckBoxIsUnchecked"/> + </test> +</tests> From 0c4c71964fd467aea9588428f5890c7987e4aa17 Mon Sep 17 00:00:00 2001 From: nehaguptacedcoss <40159259+nehaguptacedcoss@users.noreply.github.com> Date: Fri, 3 May 2019 20:34:33 +0530 Subject: [PATCH 046/464] typo error --- lib/web/css/docs/source/_icons.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/docs/source/_icons.less b/lib/web/css/docs/source/_icons.less index b3d14f5e1fd77..367e05ff5888e 100644 --- a/lib/web/css/docs/source/_icons.less +++ b/lib/web/css/docs/source/_icons.less @@ -256,7 +256,7 @@ // <td>@icon-sprite__grid</td> // <td class="vars_value">26px</td> // <td class="vars_value">'' | false | value</td> -// <td>The size of the grid (in pixels) that the individal images are placed on</td> +// <td>The size of the grid (in pixels) that the individual images are placed on</td> // </tr> // <tr> // <th>@_icon-sprite-position</th> From ec8964c3fe2af4093b4a89555c8002618c5e6f7d Mon Sep 17 00:00:00 2001 From: nehaguptacedcoss <40159259+nehaguptacedcoss@users.noreply.github.com> Date: Fri, 3 May 2019 20:38:01 +0530 Subject: [PATCH 047/464] resolved typo error. --- lib/web/css/docs/source/_responsive.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/docs/source/_responsive.less b/lib/web/css/docs/source/_responsive.less index 46c19bc23a66c..8e7397d6ad6f3 100644 --- a/lib/web/css/docs/source/_responsive.less +++ b/lib/web/css/docs/source/_responsive.less @@ -81,7 +81,7 @@ // // ## Gathering // -// Everything that you include in collector mixins above will go in place where they declarated. +// Everything that you include in collector mixins above will go in place where they declared. // As example all // ```css // .media-width(@extremum, @break) { From f85274cf033d4e8bb5ec37a42803d5b53c28a3d3 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 3 May 2019 15:00:33 -0500 Subject: [PATCH 048/464] MAGETWO-99479: Use Escaper methods - fix static code sniffs --- app/code/Magento/AdminNotification/Model/Feed.php | 5 ++++- .../Magento/Directory/Model/ResourceModel/Country.php | 4 +++- .../Newsletter/Block/Adminhtml/Template/Preview.php | 4 +++- app/code/Magento/Translation/Model/Inline/Parser.php | 11 ++++++++--- .../Translation/Model/ResourceModel/StringUtils.php | 7 ++++++- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index eab76d2a63c32..88466f14a64bc 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -106,13 +106,16 @@ public function __construct( $this->_deploymentConfig = $deploymentConfig; $this->productMetadata = $productMetadata; $this->urlBuilder = $urlBuilder; - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** * Init model * * @return void + * phpcs:disable Magento2.CodeAnalysis.EmptyBlock */ protected function _construct() { diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country.php b/app/code/Magento/Directory/Model/ResourceModel/Country.php index a39f6542d2544..f6c1b6788ea74 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country.php @@ -28,7 +28,9 @@ protected function _construct( \Magento\Framework\Escaper $escaper = null ) { $this->_init('directory_country', 'country_id'); - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php index b1f10677934d3..137e4464b6b97 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php @@ -51,7 +51,9 @@ public function __construct( ) { $this->_templateFactory = $templateFactory; $this->_subscriberFactory = $subscriberFactory; - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($context, $data); } diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index b723dc124f902..8812eaddd2032 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -137,6 +137,8 @@ class Parser implements \Magento\Framework\Translate\Inline\ParserInterface private $relatedCacheTypes; /** + * Return cache manager + * * @return \Magento\Translation\Model\Inline\CacheManager * * @deprecated 100.1.0 @@ -164,8 +166,8 @@ private function getCacheManger() * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( - \Magento\Translation\Model\ResourceModel\StringUtilsFactory $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Translation\Model\ResourceModel\StringUtilsFactory $resource, \Zend_Filter_Interface $inputFilter, \Magento\Framework\App\State $appState, \Magento\Framework\App\Cache\TypeListInterface $appCache, @@ -180,7 +182,9 @@ public function __construct( $this->_appCache = $appCache; $this->_translateInline = $translateInline; $this->relatedCacheTypes = $relatedCacheTypes; - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -454,7 +458,8 @@ private function _prepareTagAttributesForContent(&$content) $tagHtml = str_replace($matches[0], '', $tagHtml); $trAttr = ' ' . $this->_getHtmlAttribute( self::DATA_TRANSLATE, - '[' . $this->escaper->escapeHtml($matches[1]) . ',' . str_replace("\"", "'", join(',', $trArr)) . ']' + '[' . $this->escaper->escapeHtml($matches[1]) . ',' . + str_replace("\"", "'", join(',', $trArr)) . ']' ); } else { $trAttr = ' ' . $this->_getHtmlAttribute( diff --git a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php index e106b9327c6a5..769336419d89b 100644 --- a/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php +++ b/app/code/Magento/Translation/Model/ResourceModel/StringUtils.php @@ -5,6 +5,9 @@ */ namespace Magento\Translation\Model\ResourceModel; +/** + * String translation utilities + */ class StringUtils extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** @@ -46,7 +49,9 @@ public function __construct( $this->_localeResolver = $localeResolver; $this->scopeResolver = $scopeResolver; $this->scope = $scope; - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($context, $connectionName); } From 6b55d52ad63f002fff98b7440d20012f087e6c3d Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 3 May 2019 15:48:58 -0500 Subject: [PATCH 049/464] MAGETWO-99479: Use Escaper methods - fix static code sniffs --- app/code/Magento/Translation/Model/Inline/Parser.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index 8812eaddd2032..a753a989602fb 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -7,8 +7,7 @@ namespace Magento\Translation\Model\Inline; /** - * This class is responsible for parsing content and applying necessary html element - * wrapping and client scripts for inline translation. + * Parse content, applying necessary html element wrapping and client scripts for inline translation. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -249,7 +248,7 @@ protected function _validateTranslationParams(array $translateParams) * Apply input filter to values of translation parameters * * @param array &$translateParams - * @param array $fieldNames Names of fields values of which are to be filtered + * @param array $fieldNames * @return void */ protected function _filterTranslationParams(array &$translateParams, array $fieldNames) @@ -372,7 +371,7 @@ protected function _applySpecialTagsFormat($tagHtml, $tagName, $trArr) * Format translation for simple tags. Added translate mode attribute for vde requests. * * @param string $tagHtml - * @param string $tagName + * @param string $tagName * @param array $trArr * @return string */ @@ -397,8 +396,8 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) /** * Get translate data by regexp * - * @param string $regexp - * @param string &$text + * @param string $regexp + * @param string &$text * @param string|array $locationCallback * @param array $options * @return array From 6339cd370399ccb024884924335a9c7ac3b8f5b8 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 3 May 2019 16:14:57 -0500 Subject: [PATCH 050/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- app/code/Magento/Sales/Helper/Admin.php | 2 +- app/code/Magento/Webapi/Model/Soap/Fault.php | 22 +++++++++++++++---- .../Widget/Setup/LayoutUpdateConverter.php | 14 ++++++++++-- .../Wishlist/Controller/Index/Send.php | 15 ++++++++++--- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index 7053a696dcab5..e40c08a711eb1 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -165,7 +165,7 @@ public function escapeHtmlWithLinks($data, $allowedTags = null) //Recreate a minimalistic secure a tag $links[] = sprintf( '<a href="%s">%s</a>', - htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false), + $this->escaper->escapeHtml($url), $this->escaper->escapeHtml($text) ); $data = str_replace($matches[0], '%' . $i . '$s', $data); diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index 74b1b41ee1bf5..a0036b885cab0 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -9,6 +9,9 @@ use Magento\Framework\App\State; +/** + * Webapi Fault Model for Soap. + */ class Fault { const FAULT_REASON_INTERNAL = 'Internal Error.'; @@ -39,6 +42,11 @@ class Fault const NODE_DETAIL_WRAPPER = 'GenericFault'; /**#@-*/ + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var string */ @@ -108,13 +116,15 @@ class Fault * @param \Magento\Framework\Webapi\Exception $exception * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param State $appState + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Framework\App\RequestInterface $request, Server $soapServer, \Magento\Framework\Webapi\Exception $exception, \Magento\Framework\Locale\ResolverInterface $localeResolver, - State $appState + State $appState, + \Magento\Framework\Escaper $escaper = null ) { $this->_soapFaultCode = $exception->getOriginator(); $this->_parameters = $exception->getDetails(); @@ -125,6 +135,9 @@ public function __construct( $this->_soapServer = $soapServer; $this->_localeResolver = $localeResolver; $this->appState = $appState; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -286,14 +299,15 @@ protected function _convertDetailsToXml($details) { $detailsXml = ''; foreach ($details as $detailNode => $detailValue) { - $detailNode = htmlspecialchars($detailNode); + $detailNode = $this->escaper->escapeHtml($detailNode); if (is_numeric($detailNode)) { continue; } switch ($detailNode) { case self::NODE_DETAIL_TRACE: if (is_string($detailValue) || is_numeric($detailValue)) { - $detailsXml .= "<m:{$detailNode}>" . htmlspecialchars($detailValue) . "</m:{$detailNode}>"; + $detailsXml .= "<m:{$detailNode}>" . $this->escaper->escapeHtml($detailValue) . + "</m:{$detailNode}>"; } break; case self::NODE_DETAIL_PARAMETERS: @@ -331,7 +345,7 @@ protected function _getParametersXml($parameters) $parameterName++; } $paramsXml .= "<m:$parameterNode><m:$keyNode>$parameterName</m:$keyNode><m:$valueNode>" - . htmlspecialchars($parameterValue) . "</m:$valueNode></m:$parameterNode>"; + . $this->escaper->escapeHtml($parameterValue) . "</m:$valueNode></m:$parameterNode>"; } } if (!empty($paramsXml)) { diff --git a/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php b/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php index 54c364dcc49a4..1b9010c3de2fc 100644 --- a/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php +++ b/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php @@ -16,6 +16,11 @@ */ class LayoutUpdateConverter extends SerializedToJson { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var Normalizer */ @@ -27,13 +32,18 @@ class LayoutUpdateConverter extends SerializedToJson * @param Serialize $serialize * @param Json $json * @param Normalizer $normalizer + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( Serialize $serialize, Json $json, - Normalizer $normalizer + Normalizer $normalizer, + \Magento\Framework\Escaper $escaper = null ) { $this->normalizer = $normalizer; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($serialize, $json); } @@ -85,7 +95,7 @@ protected function unserializeValue($value) */ protected function encodeJson($value) { - return htmlspecialchars( + return $this->escaper->escapeJs( $this->normalizer->replaceReservedCharacters(parent::encodeJson($value)) ); } diff --git a/app/code/Magento/Wishlist/Controller/Index/Send.php b/app/code/Magento/Wishlist/Controller/Index/Send.php index a4e8258b9d67e..20a5c64ab20c0 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Send.php +++ b/app/code/Magento/Wishlist/Controller/Index/Send.php @@ -31,6 +31,11 @@ */ class Send extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var \Magento\Customer\Helper\View */ @@ -105,6 +110,7 @@ class Send extends \Magento\Wishlist\Controller\AbstractIndex implements Action\ * @param StoreManagerInterface $storeManager * @param CaptchaHelper|null $captchaHelper * @param CaptchaStringResolver|null $captchaStringResolver + * @param \Magento\Framework\Escaper|null $escaper * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -120,7 +126,8 @@ public function __construct( ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, ?CaptchaHelper $captchaHelper = null, - ?CaptchaStringResolver $captchaStringResolver = null + ?CaptchaStringResolver $captchaStringResolver = null, + \Magento\Framework\Escaper $escaper = null ) { $this->_formKeyValidator = $formKeyValidator; $this->_customerSession = $customerSession; @@ -135,7 +142,9 @@ public function __construct( $this->captchaHelper = $captchaHelper ?: ObjectManager::getInstance()->get(CaptchaHelper::class); $this->captchaStringResolver = $captchaStringResolver ? : ObjectManager::getInstance()->get(CaptchaStringResolver::class); - + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($context); } @@ -189,7 +198,7 @@ public function execute() if (strlen($message) > $textLimit) { $error = __('Message length must not exceed %1 symbols', $textLimit); } else { - $message = nl2br(htmlspecialchars($message)); + $message = nl2br($this->escaper->escapeHtml($message)); if (empty($emails)) { $error = __('Please enter an email address.'); } else { From 4a3fb1f692880a4926c2651f6c898df56ad96ae9 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Sat, 4 May 2019 10:32:04 +0530 Subject: [PATCH 051/464] Fixed #22484 Customer address States are duplicated in backend --- .../Magento/Ui/Component/Form/Element/AbstractOptionsField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php b/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php index 09583f65bf157..93ab1bacbbc26 100644 --- a/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php +++ b/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php @@ -59,7 +59,7 @@ public function prepare() if (empty($config['rawOptions'])) { $options = $this->convertOptionsValueToString($options); } - $config['options'] = array_values(array_merge_recursive($config['options'], $options)); + $config['options'] = array_values(array_replace_recursive($config['options'], $options)); } $this->setData('config', (array)$config); parent::prepare(); From b8bc2885b4059fe6c0f932a26a6495d6f7399896 Mon Sep 17 00:00:00 2001 From: Surabhi Srivastava <surabhisrivastava@cedcoss.com> Date: Sat, 4 May 2019 06:04:57 +0000 Subject: [PATCH 052/464] Fixed Issue #22087 Fixed Issue #22087 --- .../Reports/Model/ResourceModel/Product/Sold/Collection.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index 61dc77d188438..cd628c7a19c2b 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -79,6 +79,10 @@ public function addOrderedQty($from = '', $to = '') )->having( 'order_items.qty_ordered > ?', 0 + )->columns( + 'SUM(order_items.qty_ordered) as ordered_qty' + )->group( + 'order_items.product_id' ); return $this; } From 2962ee64db97ab80de8ddcefc8ac3f56bce21144 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Sat, 4 May 2019 11:30:58 +0300 Subject: [PATCH 053/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Add try catch for case if customer has address that doesn't exist. --- app/code/Magento/Quote/Model/QuoteManagement.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index 69fe8a0dc3071..796abc06a97a4 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -594,7 +594,12 @@ protected function _prepareCustomerQuote($quote) } else { $defaultShipping = $this->customerRepository->getById($customer->getId())->getDefaultShipping(); if ($defaultShipping) { - $shippingAddress = $this->addressRepository->getById($defaultShipping); + try { + $shippingAddress = $this->addressRepository->getById($defaultShipping); + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock + } catch (LocalizedException $e) { + // no address + } } } if (isset($shippingAddress)) { @@ -623,7 +628,12 @@ protected function _prepareCustomerQuote($quote) } else { $defaultBilling = $this->customerRepository->getById($customer->getId())->getDefaultBilling(); if ($defaultBilling) { - $billingAddress = $this->addressRepository->getById($defaultBilling); + try { + $billingAddress = $this->addressRepository->getById($defaultBilling); + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock + } catch (LocalizedException $e) { + // no address + } } } if (isset($billingAddress)) { From 595a7a8f56571a5bd2753096bef9db27d46020ff Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Sat, 4 May 2019 16:14:33 +0530 Subject: [PATCH 054/464] Fixed #22004 can't update attribute for all product --- app/code/Magento/Ui/view/base/web/js/grid/massactions.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js index 3626f52806881..a1884c20da2e8 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js @@ -153,11 +153,6 @@ define([ var itemsType = data.excludeMode ? 'excluded' : 'selected', selections = {}; - if (itemsType === 'excluded' && data.selected && data.selected.length) { - itemsType = 'selected'; - data[itemsType] = _.difference(data.selected, data.excluded); - } - selections[itemsType] = data[itemsType]; if (!selections[itemsType].length) { From 690ca8ea5a0ced6d5d4751f198122768fc24f925 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Mon, 6 May 2019 11:24:57 +0300 Subject: [PATCH 055/464] Fix static tests. --- .../Magento/Ui/Component/Form/Element/AbstractOptionsField.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php b/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php index 93ab1bacbbc26..cc5ae614ca729 100644 --- a/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php +++ b/app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php @@ -9,6 +9,8 @@ use Magento\Framework\View\Element\UiComponent\ContextInterface; /** + * Bse abstract form element. + * * @api * @since 100.1.0 */ From 82d09dcee2e57733c454e34dd48cb322bcccc17b Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Mon, 6 May 2019 13:13:59 +0300 Subject: [PATCH 056/464] magento/magento2#22646 static-test-fix --- .../Reports/Model/ResourceModel/Product/Sold/Collection.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index cd628c7a19c2b..35a14e09e314f 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -14,6 +14,8 @@ use Magento\Framework\DB\Select; /** + * Data collection. + * * @SuppressWarnings(PHPMD.DepthOfInheritance) * @api * @since 100.0.2 @@ -21,7 +23,7 @@ class Collection extends \Magento\Reports\Model\ResourceModel\Order\Collection { /** - * Set Date range to collection + * Set Date range to collection. * * @param int $from * @param int $to @@ -120,6 +122,8 @@ public function setOrder($attribute, $dir = self::SORT_ORDER_DESC) } /** + * @inheritdoc + * * @return Select * @since 100.2.0 */ From 46d01a8b2e5a04c0d0aad17b0a581085307988c7 Mon Sep 17 00:00:00 2001 From: Maikel <maikel@h-o.nl> Date: Mon, 6 May 2019 15:25:20 +0200 Subject: [PATCH 057/464] Take maximum line limit of 120 chars into account Fixes integration tests --- .../Magento/Checkout/Model/ShippingInformationManagement.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php index f4d5c5e7c8287..ae155f17fead9 100644 --- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php +++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php @@ -177,7 +177,9 @@ public function saveAddressInformation( $shippingAddress = $quote->getShippingAddress(); - if (!$quote->getIsVirtual() && !$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod())) { + if (!$quote->getIsVirtual() + && !$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod()) + ) { throw new NoSuchEntityException( __('Carrier with such method not found: %1, %2', $carrierCode, $methodCode) ); From 8032c4b3fc3720744c4512879cd6237ce0aebfe5 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 6 May 2019 11:08:32 -0500 Subject: [PATCH 058/464] MAGETWO-99479: Use Escaper methods - fix static code sniffs --- app/code/Magento/Sales/Helper/Admin.php | 1 + .../Translation/Model/Inline/Parser.php | 32 +++++++++++-------- app/code/Magento/Webapi/Model/Soap/Fault.php | 2 ++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index e40c08a711eb1..ab212f77ce935 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -188,6 +188,7 @@ private function filterUrl(string $url): string if ($url) { //Revert the sprintf escaping $url = str_replace('%%', '%', $url); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $urlScheme = parse_url($url, PHP_URL_SCHEME); $urlScheme = $urlScheme ? strtolower($urlScheme) : ''; if ($urlScheme !== 'http' && $urlScheme !== 'https') { diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index a753a989602fb..d63b4e8f29414 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -247,8 +247,8 @@ protected function _validateTranslationParams(array $translateParams) /** * Apply input filter to values of translation parameters * - * @param array &$translateParams - * @param array $fieldNames + * @param array &$translateParams + * @param array $fieldNames * @return void */ protected function _filterTranslationParams(array &$translateParams, array $fieldNames) @@ -396,13 +396,13 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) /** * Get translate data by regexp * - * @param string $regexp - * @param string &$text - * @param string|array $locationCallback - * @param array $options + * @param string $regexp + * @param string &$text + * @param callable $locationCallback + * @param array $options * @return array */ - private function _getTranslateData($regexp, &$text, $locationCallback, $options = []) + private function _getTranslateData(string $regexp, string &$text, callable $locationCallback, array $options = []) { $trArr = []; $next = 0; @@ -412,7 +412,7 @@ private function _getTranslateData($regexp, &$text, $locationCallback, $options 'shown' => htmlspecialchars_decode($matches[1][0]), 'translated' => htmlspecialchars_decode($matches[2][0]), 'original' => htmlspecialchars_decode($matches[3][0]), - 'location' => htmlspecialchars_decode(call_user_func($locationCallback, $matches, $options)), + 'location' => htmlspecialchars_decode($locationCallback($matches, $options)), ] ); $text = substr_replace($text, $matches[1][0], $matches[0][1], strlen($matches[0][0])); @@ -524,6 +524,10 @@ private function _getHtmlQuote() */ private function _specialTags() { + $this->_translateTags($this->_content, $this->_allowedTagsGlobal, + function ($tagHtml, $tagName, $trArr) { + $this->_applySpecialTagsFormat($tagHtml, $tagName, $trArr); + }); $this->_translateTags($this->_content, $this->_allowedTagsGlobal, '_applySpecialTagsFormat'); $this->_translateTags($this->_content, $this->_allowedTagsSimple, '_applySimpleTagsFormat'); } @@ -531,12 +535,12 @@ private function _specialTags() /** * Prepare simple tags * - * @param string &$content - * @param array $tagsList - * @param string|array $formatCallback + * @param string &$content + * @param array $tagsList + * @param callable $formatCallback * @return void */ - private function _translateTags(&$content, $tagsList, $formatCallback) + private function _translateTags(string &$content, array $tagsList, callable $formatCallback): void { $nextTag = 0; $tagRegExpBody = '#<(body)(/?>| \s*[^>]*+/?>)#iSU'; @@ -587,10 +591,10 @@ private function _translateTags(&$content, $tagsList, $formatCallback) if (array_key_exists($tagName, $this->_allowedTagsGlobal) && $tagBodyOpenStartPosition > $tagMatch[0][1] ) { - $tagHtmlHead = call_user_func([$this, $formatCallback], $tagHtml, $tagName, $trArr); + $tagHtmlHead = $formatCallback($tagHtml, $tagName, $trArr); $headTranslateTags .= substr($tagHtmlHead, strlen($tagHtml)); } else { - $tagHtml = call_user_func([$this, $formatCallback], $tagHtml, $tagName, $trArr); + $tagHtml = $formatCallback($tagHtml, $tagName, $trArr); } } diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index a0036b885cab0..7214f37d04468 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -223,6 +223,8 @@ public function getLanguage() } /** + * Retrieve message + * * @return string */ public function getMessage() From 15e63dad71403c8c547e6f14e48bc63990c1bb0f Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 6 May 2019 11:48:35 -0500 Subject: [PATCH 059/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- app/code/Magento/Widget/Setup/LayoutUpdateConverter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php b/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php index 1b9010c3de2fc..39b3d3c4b5a6e 100644 --- a/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php +++ b/app/code/Magento/Widget/Setup/LayoutUpdateConverter.php @@ -95,7 +95,7 @@ protected function unserializeValue($value) */ protected function encodeJson($value) { - return $this->escaper->escapeJs( + return $this->escaper->escapeHtml( $this->normalizer->replaceReservedCharacters(parent::encodeJson($value)) ); } From 828f949bcb9b172caae6a8260684ea56670bdcd7 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 6 May 2019 14:14:38 -0500 Subject: [PATCH 060/464] MAGETWO-99479: Use Escaper methods - fix static code sniff warnings --- .../Translation/Model/Inline/Parser.php | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index d63b4e8f29414..6ef64b3c2ef83 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -524,12 +524,27 @@ private function _getHtmlQuote() */ private function _specialTags() { - $this->_translateTags($this->_content, $this->_allowedTagsGlobal, + $this->_translateTags( + $this->_content, + $this->_allowedTagsGlobal, function ($tagHtml, $tagName, $trArr) { - $this->_applySpecialTagsFormat($tagHtml, $tagName, $trArr); - }); - $this->_translateTags($this->_content, $this->_allowedTagsGlobal, '_applySpecialTagsFormat'); - $this->_translateTags($this->_content, $this->_allowedTagsSimple, '_applySimpleTagsFormat'); + return $this->_applySpecialTagsFormat($tagHtml, $tagName, $trArr); + } + ); + $this->_translateTags( + $this->_content, + $this->_allowedTagsGlobal, + function () { + return '_applySpecialTagsFormat'; + } + ); + $this->_translateTags( + $this->_content, + $this->_allowedTagsSimple, + function () { + return '_applySimpleTagsFormat'; + } + ); } /** @@ -540,7 +555,7 @@ function ($tagHtml, $tagName, $trArr) { * @param callable $formatCallback * @return void */ - private function _translateTags(string &$content, array $tagsList, callable $formatCallback): void + private function _translateTags(string &$content, array $tagsList, callable $formatCallback) { $nextTag = 0; $tagRegExpBody = '#<(body)(/?>| \s*[^>]*+/?>)#iSU'; From aa23860090672a9b844bc1eb5f8ad9a693303a26 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Mon, 6 May 2019 23:34:33 +0300 Subject: [PATCH 061/464] magento/graphql-ce#675: [Test coverage] Generate customer token --- .../Customer/GenerateCustomerTokenTest.php | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php index e13c1974e3067..83c24c8508d44 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php @@ -8,7 +8,6 @@ namespace Magento\GraphQl\Customer; use Magento\TestFramework\TestCase\GraphQlAbstract; -use PHPUnit\Framework\TestResult; /** * Class GenerateCustomerTokenTest @@ -23,14 +22,14 @@ class GenerateCustomerTokenTest extends GraphQlAbstract */ public function testGenerateCustomerValidToken() { - $userName = 'customer@example.com'; + $email = 'customer@example.com'; $password = 'password'; $mutation = <<<MUTATION mutation { generateCustomerToken( - email: "{$userName}" + email: "{$email}" password: "{$password}" ) { token @@ -48,14 +47,14 @@ public function testGenerateCustomerValidToken() */ public function testGenerateCustomerTokenWithInvalidCredentials() { - $userName = 'customer@example.com'; + $email = 'customer@example.com'; $password = 'bad-password'; $mutation = <<<MUTATION mutation { generateCustomerToken( - email: "{$userName}" + email: "{$email}" password: "{$password}" ) { token @@ -69,6 +68,28 @@ public function testGenerateCustomerTokenWithInvalidCredentials() $this->graphQlMutation($mutation); } + /** + * Verify customer with invalid email + */ + public function testGenerateCustomerTokenWithInvalidEmail() + { + $email = 'customer@example'; + $password = 'password'; + + $mutation + = <<<MUTATION +mutation { + generateCustomerToken( + email: "{$email}" + password: "{$password}" + ) { + token + } +} +MUTATION; + $this->graphQlMutation($mutation); + } + /** * Verify customer with empty email */ From 59fc4ea96e34b2c884b33ef9bc5f52fcf6cf9737 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 6 May 2019 15:45:42 -0500 Subject: [PATCH 062/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Catalog/Block/Adminhtml/Product/Edit.php | 19 ++++++++++++-- .../Tab/Newsletter/Grid/Renderer/Action.php | 15 +++++++++-- .../Wishlist/Grid/Renderer/Description.php | 25 ++++++++++++++++++- .../Model/Address/Validator/Country.php | 16 +++++++++--- app/code/Magento/Sitemap/Model/Sitemap.php | 20 +++++++++------ 5 files changed, 79 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index 285caa974fd17..c6350567c73e5 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -12,8 +12,17 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product; +/** + * Class Edit + * @package Magento\Catalog\Block\Adminhtml\Product + */ class Edit extends \Magento\Backend\Block\Widget { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var string */ @@ -48,6 +57,7 @@ class Edit extends \Magento\Backend\Block\Widget * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Helper\Product $productHelper * @param array $data + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Backend\Block\Template\Context $context, @@ -55,12 +65,16 @@ public function __construct( \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory, \Magento\Framework\Registry $registry, \Magento\Catalog\Helper\Product $productHelper, - array $data = [] + array $data = [], + \Magento\Framework\Escaper $escaper = null ) { $this->_productHelper = $productHelper; $this->_attributeSetFactory = $attributeSetFactory; $this->_coreRegistry = $registry; $this->jsonEncoder = $jsonEncoder; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($context, $data); } @@ -279,7 +293,8 @@ public function getAttributeSetName() */ public function getSelectedTabId() { - return addslashes(htmlspecialchars($this->getRequest()->getParam('tab'))); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return addslashes($this->escaper->escapeHtml($this->getRequest()->getParam('tab'))); } /** diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php index 43d9af36a5652..ad0bde48e8226 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -10,6 +10,11 @@ */ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Core registry * @@ -21,13 +26,18 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract * @param \Magento\Backend\Block\Context $context * @param \Magento\Framework\Registry $registry * @param array $data + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Framework\Registry $registry, - array $data = [] + array $data = [], + \Magento\Framework\Escaper $escaper = null ) { $this->_coreRegistry = $registry; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); parent::__construct($context, $data); } @@ -62,7 +72,8 @@ public function render(\Magento\Framework\DataObject $row) */ protected function _getEscapedValue($value) { - return addcslashes(htmlspecialchars($value), '\\\''); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return addcslashes($this->escaper->escapeHtml($value), '\\\''); } /** diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php index d0b47886dca7e..d10526e417faf 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -5,11 +5,34 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Wishlist\Grid\Renderer; +use \Magento\Backend\Block\Context; + /** * Adminhtml customers wishlist grid item renderer for item visibility */ class Description extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + + /** + * @param \Magento\Backend\Block\Context $context + * @param array $data + * @param \Magento\Framework\Escaper|null $escaper + */ + public function __construct( + Context $context, + array $data = [], + \Magento\Framework\Escaper $escaper = null + ) { + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); + parent::__construct($context, $data); + } + /** * Render the description of given row. * @@ -18,6 +41,6 @@ class Description extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abs */ public function render(\Magento\Framework\DataObject $row) { - return nl2br(htmlspecialchars($row->getData($this->getColumn()->getIndex()))); + return nl2br($this->escaper->escapeHtml($row->getData($this->getColumn()->getIndex()))); } } diff --git a/app/code/Magento/Customer/Model/Address/Validator/Country.php b/app/code/Magento/Customer/Model/Address/Validator/Country.php index fdc5510d1d2e0..43859dc102a7c 100644 --- a/app/code/Magento/Customer/Model/Address/Validator/Country.php +++ b/app/code/Magento/Customer/Model/Address/Validator/Country.php @@ -16,6 +16,11 @@ */ class Country implements ValidatorInterface { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var Data */ @@ -29,13 +34,18 @@ class Country implements ValidatorInterface /** * @param Data $directoryData * @param AllowedCountries $allowedCountriesReader + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( Data $directoryData, - AllowedCountries $allowedCountriesReader + AllowedCountries $allowedCountriesReader, + \Magento\Framework\Escaper $escaper = null ) { $this->directoryData = $directoryData; $this->allowedCountriesReader = $allowedCountriesReader; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -67,7 +77,7 @@ private function validateCountry(AbstractAddress $address) //Checking if such country exists. $errors[] = __( 'Invalid value of "%value" provided for the %fieldName field.', - ['fieldName' => 'countryId', 'value' => htmlspecialchars($countryId)] + ['fieldName' => 'countryId', 'value' => $this->escaper->escapeHtml($countryId)] ); } @@ -104,7 +114,7 @@ private function validateRegion(AbstractAddress $address) //If a region is selected then checking if it exists. $errors[] = __( 'Invalid value of "%value" provided for the %fieldName field.', - ['fieldName' => 'regionId', 'value' => htmlspecialchars($regionId)] + ['fieldName' => 'regionId', 'value' => $this->escaper->escapeHtml($regionId)] ); } diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index c35e20d997d85..dc4bd3614e3cc 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -236,7 +236,9 @@ public function __construct( SitemapConfigReaderInterface $configReader = null, \Magento\Sitemap\Model\SitemapItemInterfaceFactory $sitemapItemFactory = null ) { - $this->_escaper = $escaper; + $this->_escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); $this->_sitemapData = $sitemapData; $documentRoot = $documentRoot ?: ObjectManager::getInstance()->get(DocumentRoot::class); $this->_directory = $filesystem->getDirectoryWrite($documentRoot->getPath()); @@ -539,7 +541,7 @@ protected function _isSplitRequired($row) protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $priority = null, $images = null) { $url = $this->_getUrl($url); - $row = '<loc>' . htmlspecialchars($url) . '</loc>'; + $row = '<loc>' . $this->_escaper->escapeUrl($url) . '</loc>'; if ($lastmod) { $row .= '<lastmod>' . $this->_getFormattedLastmodDate($lastmod) . '</lastmod>'; } @@ -553,17 +555,17 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr // Add Images to sitemap foreach ($images->getCollection() as $image) { $row .= '<image:image>'; - $row .= '<image:loc>' . htmlspecialchars($image->getUrl()) . '</image:loc>'; - $row .= '<image:title>' . htmlspecialchars($images->getTitle()) . '</image:title>'; + $row .= '<image:loc>' . $this->_escaper->escapeUrl($image->getUrl()) . '</image:loc>'; + $row .= '<image:title>' . $this->_escaper->escapeHtml($images->getTitle()) . '</image:title>'; if ($image->getCaption()) { - $row .= '<image:caption>' . htmlspecialchars($image->getCaption()) . '</image:caption>'; + $row .= '<image:caption>' . $this->_escaper->escapeHtml($image->getCaption()) . '</image:caption>'; } $row .= '</image:image>'; } // Add PageMap image for Google web search $row .= '<PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail">'; - $row .= '<Attribute name="name" value="' . htmlspecialchars($images->getTitle()) . '"/>'; - $row .= '<Attribute name="src" value="' . htmlspecialchars($images->getThumbnail()) . '"/>'; + $row .= '<Attribute name="name" value="' . $this->_escaper->escapeHtmlAttr($images->getTitle()) . '"/>'; + $row .= '<Attribute name="src" value="' . $this->_escaper->escapeHtmlAttr($images->getThumbnail()) . '"/>'; $row .= '</DataObject></PageMap>'; } @@ -580,7 +582,7 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr protected function _getSitemapIndexRow($sitemapFilename, $lastmod = null) { $url = $this->getSitemapUrl($this->getSitemapPath(), $sitemapFilename); - $row = '<loc>' . htmlspecialchars($url) . '</loc>'; + $row = '<loc>' . $this->_escaper->escapeUrl($url) . '</loc>'; if ($lastmod) { $row .= '<lastmod>' . $this->_getFormattedLastmodDate($lastmod) . '</lastmod>'; } @@ -722,6 +724,7 @@ protected function _getFormattedLastmodDate($date) */ protected function _getDocumentRoot() { + // phpcs:ignore Magento2.Functions.DiscouragedFunction return realpath($this->_request->getServer('DOCUMENT_ROOT')); } @@ -732,6 +735,7 @@ protected function _getDocumentRoot() */ protected function _getStoreBaseDomain() { + // phpcs:ignore Magento2.Functions.DiscouragedFunction $storeParsedUrl = parse_url($this->_getStoreBaseUrl()); $url = $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host']; From bd870358ed7b359e28c7a7130e340f8d76a65f04 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Tue, 7 May 2019 01:09:40 +0300 Subject: [PATCH 063/464] magento/graphql-ce#675: [Test coverage] Generate customer token --- .../Customer/GenerateCustomerTokenTest.php | 77 ++++++++++++++----- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php index 83c24c8508d44..1b79e8e85c778 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php @@ -10,8 +10,7 @@ use Magento\TestFramework\TestCase\GraphQlAbstract; /** - * Class GenerateCustomerTokenTest - * @package Magento\GraphQl\Customer + * API-functional tests cases for generateCustomerToken mutation */ class GenerateCustomerTokenTest extends GraphQlAbstract { @@ -43,12 +42,16 @@ public function testGenerateCustomerValidToken() } /** - * Verify customer with invalid credentials + * Verify customer with invalid email + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later. */ - public function testGenerateCustomerTokenWithInvalidCredentials() + public function testGenerateCustomerTokenWithInvalidEmail() { - $email = 'customer@example.com'; - $password = 'bad-password'; + $email = 'customer@example'; + $password = 'password'; $mutation = <<<MUTATION @@ -61,19 +64,17 @@ public function testGenerateCustomerTokenWithInvalidCredentials() } } MUTATION; - - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors: The account sign-in' . ' ' . - 'was incorrect or your account is disabled temporarily. Please wait and try again later.'); $this->graphQlMutation($mutation); } /** - * Verify customer with invalid email + * Verify customer with empty email + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php */ - public function testGenerateCustomerTokenWithInvalidEmail() + public function testGenerateCustomerTokenWithEmptyEmail() { - $email = 'customer@example'; + $email = ''; $password = 'password'; $mutation @@ -87,15 +88,22 @@ public function testGenerateCustomerTokenWithInvalidEmail() } } MUTATION; + + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: Specify the "email" value.'); $this->graphQlMutation($mutation); } /** - * Verify customer with empty email + * Verify customer with invalid credentials + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later. */ - public function testGenerateCustomerTokenWithEmptyEmail() + public function testGenerateCustomerTokenWithIncorrectPassword() { - $email = ''; + $email = 'customer@example.com'; $password = 'bad-password'; $mutation @@ -110,15 +118,15 @@ public function testGenerateCustomerTokenWithEmptyEmail() } MUTATION; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors: Specify the "email" value.'); $this->graphQlMutation($mutation); } /** * Verify customer with empty password + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php */ - public function testGenerateCustomerTokenWithEmptyPassword() + public function testGenerateCustomerTokenWithInvalidPassword() { $email = 'customer@example.com'; $password = ''; @@ -139,4 +147,35 @@ public function testGenerateCustomerTokenWithEmptyPassword() $this->expectExceptionMessage('GraphQL response contains errors: Specify the "password" value.'); $this->graphQlMutation($mutation); } + + /** + * Verify customer with empty password + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + */ + public function testRegenerateCustomerToken() + { + $email = 'customer@example.com'; + $password = 'password'; + + $mutation + = <<<MUTATION +mutation { + generateCustomerToken( + email: "{$email}" + password: "{$password}" + ) { + token + } +} +MUTATION; + + $response1 = $this->graphQlMutation($mutation); + $token1 = $response1['generateCustomerToken']['token']; + + $response2 = $this->graphQlMutation($mutation); + $token2 = $response2['generateCustomerToken']['token']; + + $this->assertNotEquals($token1, $token2, 'Tokens should not be identical!'); + } } From 8522a14fefe581e64691bdaebf8f6589a927978b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Tue, 7 May 2019 00:12:53 +0200 Subject: [PATCH 064/464] Fix #19872 - replace DirectoryList::PUB with string --- app/code/Magento/Catalog/Model/Category/FileInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php index 94189a67d6e74..a474eb764d2c0 100644 --- a/app/code/Magento/Catalog/Model/Category/FileInfo.php +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -178,7 +178,7 @@ private function getMediaDirectoryPathRelativeToBaseDirectoryPath(string $filePa $mediaDirectoryPath = $this->getMediaDirectory()->getAbsolutePath(); $mediaDirectoryRelativeSubpath = substr($mediaDirectoryPath, strlen($baseDirectoryPath)); - $pubDirectory = DirectoryList::PUB . DIRECTORY_SEPARATOR; + $pubDirectory = 'pub' . DIRECTORY_SEPARATOR; if (strpos($mediaDirectoryRelativeSubpath, $pubDirectory) === 0 && strpos($filePath, $pubDirectory) !== 0) { $mediaDirectoryRelativeSubpath = substr($mediaDirectoryRelativeSubpath, strlen($pubDirectory)); From eda3d3464f7c35c18102c40031e31fc43e78dcd3 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 09:48:53 -0500 Subject: [PATCH 065/464] MAGETWO-99479: Use Escaper methods - fix static code sniff errors --- .../Catalog/Block/Adminhtml/Product/Edit.php | 30 +++++++++++++++++++ .../Tab/Newsletter/Grid/Renderer/Action.php | 6 ++++ .../Translation/Model/Inline/Parser.php | 18 +++++------ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index c6350567c73e5..8a1dc084afc98 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -79,6 +79,8 @@ public function __construct( } /** + * Edit Product constructor + * * @return void */ protected function _construct() @@ -158,6 +160,8 @@ protected function _prepareLayout() } /** + * Retrieve back button html + * * @return string */ public function getBackButtonHtml() @@ -166,6 +170,8 @@ public function getBackButtonHtml() } /** + * Retrieve cancel button html + * * @return string */ public function getCancelButtonHtml() @@ -174,6 +180,8 @@ public function getCancelButtonHtml() } /** + * Retrieve save button html + * * @return string */ public function getSaveButtonHtml() @@ -182,6 +190,8 @@ public function getSaveButtonHtml() } /** + * Retrieve save and edit button html + * * @return string */ public function getSaveAndEditButtonHtml() @@ -190,6 +200,8 @@ public function getSaveAndEditButtonHtml() } /** + * Retrieve delete button html + * * @return string */ public function getDeleteButtonHtml() @@ -208,6 +220,8 @@ public function getSaveSplitButtonHtml() } /** + * Retrieve validation url + * * @return string */ public function getValidationUrl() @@ -216,6 +230,8 @@ public function getValidationUrl() } /** + * Retrieve save url + * * @return string */ public function getSaveUrl() @@ -224,6 +240,8 @@ public function getSaveUrl() } /** + * Retrieve save and continue url + * * @return string */ public function getSaveAndContinueUrl() @@ -235,6 +253,8 @@ public function getSaveAndContinueUrl() } /** + * Retrieve product id + * * @return mixed */ public function getProductId() @@ -243,6 +263,8 @@ public function getProductId() } /** + * Retrieve product set id + * * @return mixed */ public function getProductSetId() @@ -255,6 +277,8 @@ public function getProductSetId() } /** + * Retrieve duplicate url + * * @return string */ public function getDuplicateUrl() @@ -263,6 +287,8 @@ public function getDuplicateUrl() } /** + * Retrieve product header + * * @deprecated 101.1.0 * @return string */ @@ -277,6 +303,8 @@ public function getHeader() } /** + * Get product attribute set name + * * @return string */ public function getAttributeSetName() @@ -289,6 +317,8 @@ public function getAttributeSetName() } /** + * Retrieve id of selected tab + * * @return string */ public function getSelectedTabId() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php index ad0bde48e8226..500646c8e05a7 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -42,6 +42,8 @@ public function __construct( } /** + * Render actions + * * @param \Magento\Framework\DataObject $row * @return string */ @@ -67,6 +69,8 @@ public function render(\Magento\Framework\DataObject $row) } /** + * Retrieve escaped value + * * @param string $value * @return string */ @@ -77,6 +81,8 @@ protected function _getEscapedValue($value) } /** + * Actions to html + * * @param array $actions * @return string */ diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index 6ef64b3c2ef83..0a42557402588 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -247,8 +247,8 @@ protected function _validateTranslationParams(array $translateParams) /** * Apply input filter to values of translation parameters * - * @param array &$translateParams - * @param array $fieldNames + * @param array &$translateParams + * @param array $fieldNames * @return void */ protected function _filterTranslationParams(array &$translateParams, array $fieldNames) @@ -396,10 +396,10 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) /** * Get translate data by regexp * - * @param string $regexp - * @param string &$text - * @param callable $locationCallback - * @param array $options + * @param string $regexp + * @param string &$text + * @param callable $locationCallback + * @param array $options * @return array */ private function _getTranslateData(string $regexp, string &$text, callable $locationCallback, array $options = []) @@ -550,9 +550,9 @@ function () { /** * Prepare simple tags * - * @param string &$content - * @param array $tagsList - * @param callable $formatCallback + * @param string &$content + * @param array $tagsList + * @param callable $formatCallback * @return void */ private function _translateTags(string &$content, array $tagsList, callable $formatCallback) From a285d9b8275e752da7ccdc5f312347dafdf86513 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 7 May 2019 17:49:19 +0300 Subject: [PATCH 066/464] MAGETWO-99378: Product short description changing for each update in multiple schedule update --- .../Section/AdminSlideOutDialogSection.xml | 2 +- .../Cms/Test/Mftf/Data/WysiwygConfigData.xml | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml index a01e025ba3dca..2f799721a8cef 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminSlideOutDialogSection"> - <element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/> + <element name="closeButton" type="button" selector=".modal-slide._show [data-role="closeBtn"]" timeout="30"/> <element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/> <element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/> <element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml b/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml new file mode 100644 index 0000000000000..46a968959407f --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="WysiwygEnabledByDefault"> + <data key="path">cms/wysiwyg/enabled</data> + <data key="scope_id">0</data> + <data key="value">enabled</data> + </entity> + <entity name="WysiwygDisabledByDefault"> + <data key="path">cms/wysiwyg/enabled</data> + <data key="scope_id">0</data> + <data key="value">hidden</data> + </entity> + <entity name="WysiwygTinyMCE3Enable"> + <data key="path">cms/wysiwyg/editor</data> + <data key="scope_id">0</data> + <data key="value">Magento_Tinymce3/tinymce3Adapter</data> + </entity> + <entity name="WysiwygTinyMCE4Enable"> + <data key="path">cms/wysiwyg/editor</data> + <data key="scope_id">0</data> + <data key="value">mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter</data> + </entity> +</entities> From 179bf3d52f0c7caa8522e281103e91f4363a9574 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 10:28:38 -0500 Subject: [PATCH 067/464] MAGETWO-99479: Use Escaper methods - fix mhi --- .../Directory/Model/ResourceModel/Country.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country.php b/app/code/Magento/Directory/Model/ResourceModel/Country.php index f6c1b6788ea74..da6b478a9d664 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country.php @@ -19,18 +19,29 @@ class Country extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb private $escaper; /** - * Resource initialization - * + * @param \Magento\Framework\Model\ResourceModel\Db\Context $context + * @param null|string $connectionName * @param \Magento\Framework\Escaper|null $escaper - * @return void */ - protected function _construct( + public function __construct( + \Magento\Framework\Model\ResourceModel\Db\Context $context, + ?string $connectionName = null, \Magento\Framework\Escaper $escaper = null ) { - $this->_init('directory_country', 'country_id'); $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( \Magento\Framework\Escaper::class ); + parent::__construct($context, $connectionName); + } + + /** + * Resource initialization + * + * @return void + */ + protected function _construct() + { + $this->_init('directory_country', 'country_id'); } /** From 37242c929496546128e5f014db041939a0f9ce35 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 11:19:26 -0500 Subject: [PATCH 068/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- app/code/Magento/Sitemap/Model/Sitemap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index dc4bd3614e3cc..e5959a77a077d 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -564,8 +564,8 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr } // Add PageMap image for Google web search $row .= '<PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail">'; - $row .= '<Attribute name="name" value="' . $this->_escaper->escapeHtmlAttr($images->getTitle()) . '"/>'; - $row .= '<Attribute name="src" value="' . $this->_escaper->escapeHtmlAttr($images->getThumbnail()) . '"/>'; + $row .= '<Attribute name="name" value="' . $this->_escaper->escapeHtml($images->getTitle()) . '"/>'; + $row .= '<Attribute name="src" value="' . $this->_escaper->escapeUrl($images->getThumbnail()) . '"/>'; $row .= '</DataObject></PageMap>'; } From ffd9ae8b3450a277879b29104276a71847978906 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 11:31:42 -0500 Subject: [PATCH 069/464] MAGETWO-99479: Use Escaper methods - fix static code sniff errors --- app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php | 1 + app/code/Magento/Translation/Model/Inline/Parser.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index 8a1dc084afc98..41227540c9406 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -14,6 +14,7 @@ /** * Class Edit + * * @package Magento\Catalog\Block\Adminhtml\Product */ class Edit extends \Magento\Backend\Block\Widget diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index 0a42557402588..c6145d3dc69f8 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -247,7 +247,7 @@ protected function _validateTranslationParams(array $translateParams) /** * Apply input filter to values of translation parameters * - * @param array &$translateParams + * @param array $translateParams * @param array $fieldNames * @return void */ @@ -397,7 +397,7 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) * Get translate data by regexp * * @param string $regexp - * @param string &$text + * @param string $text * @param callable $locationCallback * @param array $options * @return array @@ -550,7 +550,7 @@ function () { /** * Prepare simple tags * - * @param string &$content + * @param string $content * @param array $tagsList * @param callable $formatCallback * @return void From 614e430c0b41e7d8f768dcf9d1240adf531c0d40 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 26 Apr 2019 11:21:13 -0500 Subject: [PATCH 070/464] MAGETWO-53347: Char flag update - update char flag --- lib/internal/Magento/Framework/Escaper.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index c4150851ec40d..8b18563a10ffd 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -13,6 +13,11 @@ */ class Escaper { + /** + * HTML special characters flag + */ + const HTMLSPECIALCHARS_FLAG = ENT_QUOTES | ENT_SUBSTITUTE; + /** * @var \Magento\Framework\ZendEscaper */ @@ -98,7 +103,7 @@ function ($errorNumber, $errorString) { preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches); return !empty($matches) ? $matches[1] : ''; } else { - $result = htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', false); + $result = htmlspecialchars($data, self::HTMLSPECIALCHARS_FLAG, 'UTF-8', false); } } else { $result = $data; @@ -217,7 +222,7 @@ public function escapeHtmlAttr($string, $escapeSingleQuote = true) if ($escapeSingleQuote) { return $this->getEscaper()->escapeHtmlAttr((string) $string); } - return htmlspecialchars((string)$string, ENT_COMPAT, 'UTF-8', false); + return htmlspecialchars((string)$string, self::HTMLSPECIALCHARS_FLAG, 'UTF-8', false); } /** @@ -314,7 +319,7 @@ public function escapeXssInUrl($data) { return htmlspecialchars( $this->escapeScriptIdentifiers((string)$data), - ENT_COMPAT | ENT_HTML5 | ENT_HTML401, + self::HTMLSPECIALCHARS_FLAG | ENT_HTML5 | ENT_HTML401, 'UTF-8', false ); @@ -351,7 +356,7 @@ public function escapeQuote($data, $addSlashes = false) if ($addSlashes === true) { $data = addslashes($data); } - return htmlspecialchars($data, ENT_QUOTES, null, false); + return htmlspecialchars($data, self::HTMLSPECIALCHARS_FLAG, null, false); } /** From 8492be37696265ef74081cddebaf51ab8e51d12d Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 12:46:02 -0500 Subject: [PATCH 071/464] MAGETWO-53347: Char flag update - fix existing static warnings --- lib/internal/Magento/Framework/Escaper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 8b18563a10ffd..abee409796bd6 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -79,6 +79,7 @@ public function escapeHtml($data, $allowedTags = null) $domDocument = new \DOMDocument('1.0', 'UTF-8'); set_error_handler( function ($errorNumber, $errorString) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception($errorString, $errorNumber); } ); @@ -88,6 +89,7 @@ function ($errorNumber, $errorString) { $domDocument->loadHTML( '<html><body id="' . $wrapperElementId . '">' . $string . '</body></html>' ); + // phpcs:disable Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { restore_error_handler(); $this->getLogger()->critical($e); From 5fe0058580c7101df3ae6a0a9e6375e89cc21324 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 7 May 2019 16:51:53 -0500 Subject: [PATCH 072/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Adminhtml/Template/Grid/Renderer/Action.php | 3 ++- .../Adminhtml/Template/Grid/Renderer/Sender.php | 2 +- .../Email/Block/Adminhtml/Template/Preview.php | 2 +- app/code/Magento/Email/Model/Template/Filter.php | 14 ++++++++++++-- .../Adminhtml/Template/Grid/Renderer/Sender.php | 7 +++++-- app/code/Magento/Reports/Block/Adminhtml/Grid.php | 5 ++++- app/code/Magento/Rule/Block/Editable.php | 2 +- .../Block/Adminhtml/Reorder/Renderer/Action.php | 5 ++++- 8 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php index a2ba63d78d144..65f9e41b074a3 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Action.php @@ -41,7 +41,8 @@ public function render(\Magento\Framework\DataObject $row) */ protected function _getEscapedValue($value) { - return addcslashes(htmlspecialchars($value), '\\\''); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return addcslashes($this->escapeHtml($value), '\\\''); } /** diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php index 24c39884661ca..005d211a8962e 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -23,7 +23,7 @@ public function render(\Magento\Framework\DataObject $row) $str = ''; if ($row->getTemplateSenderName()) { - $str .= htmlspecialchars($row->getTemplateSenderName()) . ' '; + $str .= $this->escapeHtml($row->getTemplateSenderName()) . ' '; } if ($row->getTemplateSenderEmail()) { diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php index 5f22a36510c4e..0e81da3420150 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php @@ -80,7 +80,7 @@ protected function _toHtml() $template->revertDesign(); if ($template->isPlain()) { - $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>"; + $templateProcessed = "<pre>" . $this->escapeHtml($templateProcessed) . "</pre>"; } \Magento\Framework\Profiler::stop($this->profilerName); diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index 1d8218f90a0b2..aeaa972d9984c 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -321,6 +321,8 @@ public function setDesignParams(array $designParams) } /** + * Retrieve CSS processor + * * @deprecated 100.1.2 * @return Css\Processor */ @@ -333,6 +335,8 @@ private function getCssProcessor() } /** + * Retrieve pub directory + * * @deprecated 100.1.2 * @param string $dirType * @return ReadInterface @@ -516,6 +520,7 @@ public function viewDirective($construction) */ public function mediaDirective($construction) { + // phpcs:disable Magento2.Functions.DiscouragedFunction $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES)); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; @@ -523,6 +528,7 @@ public function mediaDirective($construction) /** * Retrieve store URL directive + * * Support url and direct_url properties * * @param string[] $construction @@ -607,7 +613,7 @@ protected function getTransParameters($value) if (preg_match(self::TRANS_DIRECTIVE_REGEX, $value, $matches) !== 1) { return ['', []]; // malformed directive body; return without breaking list } - + // phpcs:disable Magento2.Functions.DiscouragedFunction $text = stripslashes($matches[2]); $params = []; @@ -683,6 +689,7 @@ protected function applyModifiers($value, $modifiers) $callback = $modifier; } array_unshift($params, $value); + // phpcs:disable Magento2.Functions.DiscouragedFunction $value = call_user_func_array($callback, $params); } } @@ -700,7 +707,7 @@ public function modifierEscape($value, $type = 'html') { switch ($type) { case 'html': - return htmlspecialchars($value, ENT_QUOTES); + return $this->_escaper->escapeHtml($value); case 'htmlentities': return htmlentities($value, ENT_QUOTES); @@ -950,6 +957,7 @@ public function getCssFilesContent(array $files) } } catch (ContentProcessorException $exception) { $css = $exception->getMessage(); + // phpcs:disable Magento2.Exceptions.ThrowCatch } catch (\Magento\Framework\View\Asset\File\NotFoundException $exception) { $css = ''; } @@ -958,6 +966,8 @@ public function getCssFilesContent(array $files) } /** + * Apply Inline CSS + * * Merge HTML and CSS and return HTML that has CSS styles applied "inline" to the HTML tags. This is necessary * in order to support all email clients. * diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php index 04fb07d1261b6..0e9aada7b030d 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Grid/Renderer/Sender.php @@ -11,6 +11,9 @@ */ namespace Magento\Newsletter\Block\Adminhtml\Template\Grid\Renderer; +/** + * Class Sender + */ class Sender extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** @@ -23,10 +26,10 @@ public function render(\Magento\Framework\DataObject $row) { $str = ''; if ($row->getTemplateSenderName()) { - $str .= htmlspecialchars($row->getTemplateSenderName()) . ' '; + $str .= $this->escapeHtml($row->getTemplateSenderName()) . ' '; } if ($row->getTemplateSenderEmail()) { - $str .= '[' . htmlspecialchars($row->getTemplateSenderEmail()) . ']'; + $str .= '[' . $this->escapeHtml($row->getTemplateSenderEmail()) . ']'; } if ($str == '') { $str .= '---'; diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index 7bbbac644bfeb..a80e87f3c70d5 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -87,7 +87,9 @@ protected function _prepareCollection() if (is_string($filter)) { $data = []; + // phpcs:ignore Magento2.Functions.DiscouragedFunction $filter = base64_decode($filter); + // phpcs:ignore Magento2.Functions.DiscouragedFunction parse_str(urldecode($filter), $data); if (!isset($data['report_from'])) { @@ -113,6 +115,7 @@ protected function _prepareCollection() $this->_setFilterValues($data); } elseif ($filter && is_array($filter)) { $this->_setFilterValues($filter); + // phpcs:ignore Magento2.Functions.DiscouragedFunction } elseif (0 !== sizeof($this->_defaultFilter)) { $this->_setFilterValues($this->_defaultFilter); } @@ -328,7 +331,7 @@ public function getFilter($name) if (isset($this->_filters[$name])) { return $this->_filters[$name]; } else { - return $this->getRequest()->getParam($name) ? htmlspecialchars($this->getRequest()->getParam($name)) : ''; + return $this->getRequest()->getParam($name) ? $this->escapeHtml($this->getRequest()->getParam($name)) : ''; } } diff --git a/app/code/Magento/Rule/Block/Editable.php b/app/code/Magento/Rule/Block/Editable.php index d53213a7df876..0ea85dcff36c5 100644 --- a/app/code/Magento/Rule/Block/Editable.php +++ b/app/code/Magento/Rule/Block/Editable.php @@ -62,7 +62,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele '" data-form-part="' . $element->getData('data-form-part') . '"/> ' . - htmlspecialchars( + $this->escapeHtml( $valueName ) . ' '; } else { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php b/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php index e6e5d6ec3df3f..566ea1214d91f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Reorder/Renderer/Action.php @@ -41,6 +41,8 @@ public function __construct( } /** + * Render actions + * * @param \Magento\Framework\DataObject $row * @return string */ @@ -71,7 +73,8 @@ public function render(\Magento\Framework\DataObject $row) */ protected function _getEscapedValue($value) { - return addcslashes(htmlspecialchars($value), '\\\''); + // phpcs:ignore Magento2.Functions.DiscouragedFunction + return addcslashes($this->escapeHtml($value), '\\\''); } /** From f44c83d968bf670b45a112ce9219b3745532b677 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 8 May 2019 09:50:09 -0500 Subject: [PATCH 073/464] MAGETWO-99479: Use Escaper methods - fix mhi - fix static warnings --- .../Email/Block/Adminhtml/Template/Preview.php | 2 ++ .../Block/Adminhtml/Template/Preview.php | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php index 0e81da3420150..1ea6e3f921bc6 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Preview.php @@ -12,6 +12,8 @@ namespace Magento\Email\Block\Adminhtml\Template; /** + * Template Preview Block + * * @api * @since 100.0.2 */ diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php index 137e4464b6b97..58a904248e978 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview.php @@ -13,11 +13,6 @@ */ class Preview extends \Magento\Backend\Block\Widget { - /** - * @var \Magento\Framework\Escaper - */ - private $escaper; - /** * Name for profiler * @@ -40,20 +35,15 @@ class Preview extends \Magento\Backend\Block\Widget * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param array $data - * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - array $data = [], - \Magento\Framework\Escaper $escaper = null + array $data = [] ) { $this->_templateFactory = $templateFactory; $this->_subscriberFactory = $subscriberFactory; - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\Framework\Escaper::class - ); parent::__construct($context, $data); } @@ -94,7 +84,7 @@ protected function _toHtml() $template->revertDesign(); if ($template->isPlain()) { - $templateProcessed = "<pre>" . $this->escaper->escapeHtml($templateProcessed) . "</pre>"; + $templateProcessed = "<pre>" . $this->escapeHtml($templateProcessed) . "</pre>"; } \Magento\Framework\Profiler::stop($this->profilerName); From ad477cb4dc026dd2464a24df00204bae56a07f76 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 8 May 2019 10:52:09 -0500 Subject: [PATCH 074/464] MAGETWO-99479: Use Escaper methods - fix unit - use inherited escaper --- .../Wishlist/Grid/Renderer/Description.php | 25 +------------------ .../Model/Address/Validator/CountryTest.php | 6 +++++ 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php index d10526e417faf..aef91184fc782 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -5,34 +5,11 @@ */ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Wishlist\Grid\Renderer; -use \Magento\Backend\Block\Context; - /** * Adminhtml customers wishlist grid item renderer for item visibility */ class Description extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { - /** - * @var \Magento\Framework\Escaper - */ - private $escaper; - - /** - * @param \Magento\Backend\Block\Context $context - * @param array $data - * @param \Magento\Framework\Escaper|null $escaper - */ - public function __construct( - Context $context, - array $data = [], - \Magento\Framework\Escaper $escaper = null - ) { - $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\Framework\Escaper::class - ); - parent::__construct($context, $data); - } - /** * Render the description of given row. * @@ -41,6 +18,6 @@ public function __construct( */ public function render(\Magento\Framework\DataObject $row) { - return nl2br($this->escaper->escapeHtml($row->getData($this->getColumn()->getIndex()))); + return nl2br($this->escapeHtml($row->getData($this->getColumn()->getIndex()))); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/Validator/CountryTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/Validator/CountryTest.php index f26a5ba2dbb76..1e5d44e22adcb 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/Validator/CountryTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/Validator/CountryTest.php @@ -35,11 +35,17 @@ protected function setUp() \Magento\Directory\Model\AllowedCountries::class, ['getAllowedCountries'] ); + + $escaper = $this->objectManager->getObject( + \Magento\Framework\Escaper::class + ); + $this->model = $this->objectManager->getObject( \Magento\Customer\Model\Address\Validator\Country::class, [ 'directoryData' => $this->directoryDataMock, 'allowedCountriesReader' => $this->allowedCountriesReaderMock, + 'escaper' => $escaper ] ); } From 8e154030d6474b95a72eb00f54b5ab29a6d04820 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 8 May 2019 14:09:03 -0500 Subject: [PATCH 075/464] MAGETWO-99479: Use Escaper methods - fix unit --- .../Adminhtml/Template/Grid/Renderer/SenderTest.php | 10 +++++++++- .../Email/Test/Unit/Model/Template/FilterTest.php | 4 +--- .../Adminhtml/Template/Grid/Renderer/SenderTest.php | 8 +++++++- .../Test/Unit/Block/Adminhtml/Template/PreviewTest.php | 6 +++++- .../Magento/Sitemap/Test/Unit/Model/SitemapTest.php | 4 ++++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php index b9a555c3207fc..1a493e23adb53 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php @@ -18,7 +18,15 @@ class SenderTest extends \PHPUnit\Framework\TestCase protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->sender = $objectManager->getObject(\Magento\Email\Block\Adminhtml\Template\Grid\Renderer\Sender::class); + $escaper = $objectManager->getObject( + \Magento\Framework\Escaper::class + ); + $this->sender = $objectManager->getObject( + \Magento\Email\Block\Adminhtml\Template\Grid\Renderer\Sender::class, + [ + 'escaper' => $escaper + ] + ); } /** diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php index b5b2cb095a4a6..eac7008da4511 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php @@ -104,9 +104,7 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class) - ->disableOriginalConstructor() - ->getMock(); + $this->escaper = $this->objectManager->getObject(\Magento\Framework\Escaper::class); $this->assetRepo = $this->getMockBuilder(\Magento\Framework\View\Asset\Repository::class) ->disableOriginalConstructor() diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php index 8d760100d1469..219531d8d7b9d 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php @@ -26,8 +26,14 @@ class SenderTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManagerHelper->getObject( + \Magento\Framework\Escaper::class + ); $this->sender = $this->objectManagerHelper->getObject( - \Magento\Newsletter\Block\Adminhtml\Template\Grid\Renderer\Sender::class + \Magento\Newsletter\Block\Adminhtml\Template\Grid\Renderer\Sender::class, + [ + 'escaper' => $escaper + ] ); } diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php index 70407b50cacc0..46c8888b7906c 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php @@ -54,6 +54,9 @@ protected function setUp() ); $this->objectManagerHelper = new ObjectManagerHelper($this); + $escaper = $this->objectManagerHelper->getObject( + \Magento\Framework\Escaper::class + ); $this->preview = $this->objectManagerHelper->getObject( \Magento\Newsletter\Block\Adminhtml\Template\Preview::class, [ @@ -61,7 +64,8 @@ protected function setUp() 'storeManager' => $this->storeManager, 'request' => $this->request, 'templateFactory' => $templateFactory, - 'subscriberFactory' => $this->subscriberFactory + 'subscriberFactory' => $this->subscriberFactory, + 'escaper' => $escaper ] ); } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index f805d4471553b..bc8f93f9bef7e 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -598,6 +598,9 @@ private function getModelConstructorArgs() ->getMockForAbstractClass(); $objectManager = new ObjectManager($this); + $escaper = $objectManager->getObject( + \Magento\Framework\Escaper::class + ); $constructArguments = $objectManager->getConstructArguments( Sitemap::class, [ @@ -609,6 +612,7 @@ private function getModelConstructorArgs() 'filesystem' => $this->filesystemMock, 'itemProvider' => $this->itemProviderMock, 'configReader' => $this->configReaderMock, + 'escaper' => $escaper ] ); $constructArguments['resource'] = null; From b2b78c7791aa4bc5fa269aec93363d61a444265c Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 8 May 2019 14:36:24 -0500 Subject: [PATCH 076/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Controller/Adminhtml/Rate/AjaxSave.php | 30 ++++++++++++++++++- .../adminhtml/templates/renderer/tax.phtml | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php index f6cd0fff9c9b0..2f136fa740fb0 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php @@ -8,8 +8,36 @@ use Magento\Framework\Controller\ResultFactory; +/** + * Tax Rate AjaxSave Controller + */ class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + + /** + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Framework\Registry $coreRegistry + * @param \Magento\Tax\Model\Calculation\Rate\Converter $taxRateConverter + * @param \Magento\Tax\Api\TaxRateRepositoryInterface $taxRateRepository + * @param \Magento\Framework\Escaper|null $escaper + */ + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Framework\Registry $coreRegistry, + \Magento\Tax\Model\Calculation\Rate\Converter $taxRateConverter, + \Magento\Tax\Api\TaxRateRepositoryInterface $taxRateRepository, + \Magento\Framework\Escaper $escaper = null + ) { + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); + parent::__construct($context, $coreRegistry, $taxRateConverter, $taxRateRepository); + } + /** * Save Tax Rate via AJAX * @@ -27,7 +55,7 @@ public function execute() 'success' => true, 'error_message' => '', 'tax_calculation_rate_id' => $taxRate->getId(), - 'code' => htmlspecialchars($taxRate->getCode()), + 'code' => $this->escaper->escapeHtml($taxRate->getCode()), ]; } catch (\Magento\Framework\Exception\LocalizedException $e) { $responseContent = [ diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index 01ecaca435d15..a62422d21baf8 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -63,7 +63,7 @@ $data = ['fptAttribute' => [ name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][country]" class="<?= /* @escapeNotVerified */ $block->getElement()->getClass() ?> country required-entry" data-role="select-country"> <?php foreach ($block->getCountries() as $_country): ?> - <option value="<?= /* @escapeNotVerified */ $_country['value'] ?>"><?= /* @escapeNotVerified */ htmlspecialchars($_country['label']) ?></option> + <option value="<?= /* @escapeNotVerified */ $_country['value'] ?>"><?= /* @escapeNotVerified */ $block->escapeHtml($_country['label']) ?></option> <?php endforeach ?> </select> <select id="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_state" From a765dd1b8a165f04d0361d6fea0b313783c25d90 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 8 May 2019 16:08:53 -0500 Subject: [PATCH 077/464] MAGETWO-99479: Use Escaper methods - fix static code sniff warnings --- .../Test/Unit/Block/Adminhtml/Template/PreviewTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php index 46c8888b7906c..4fc2bcc732088 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php @@ -8,6 +8,9 @@ use Magento\Framework\App\TemplateTypesInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Test for \Magento\Newsletter\Block\Adminhtml\Template\Preview + */ class PreviewTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\Newsletter\Block\Adminhtml\Template\Preview */ From 636a8351a918cfed579a0123d79170de6a8f500d Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin <dyushkin@adobe.com> Date: Wed, 8 May 2019 16:25:57 -0500 Subject: [PATCH 078/464] MAGETWO-99140: Naming product attributes as container_attributename and attributename and placing them one after another causes error --- .../Magento/Eav/Model/Validator/Attribute/Code.php | 11 +++++++++++ .../Test/Unit/Model/Validator/Attribute/CodeTest.php | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Code.php b/app/code/Magento/Eav/Model/Validator/Attribute/Code.php index f3ee37721b8ce..6447507ea175a 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Code.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Code.php @@ -7,6 +7,7 @@ namespace Magento\Eav\Model\Validator\Attribute; +use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Eav\Model\Entity\Attribute; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Validator\AbstractValidator; @@ -65,6 +66,16 @@ public function isValid($attributeCode): bool ); } + /** + * Check attribute_code for prohibited prefix + */ + if (strpos($attributeCode, AbstractModifier::CONTAINER_PREFIX) === 0) { + $errorMessages[] = __( + '"%1" prefix is reserved by the system and cannot be used in attribute code names.', + AbstractModifier::CONTAINER_PREFIX + ); + } + $this->_addMessages($errorMessages); return !$this->hasMessages(); diff --git a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/CodeTest.php b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/CodeTest.php index 9db290bcba3e1..7216fad0ae70b 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/CodeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/CodeTest.php @@ -61,7 +61,10 @@ public function isValidDataProvider(): array ], [ 'more_than_60_chars_more_than_60_chars_more_than_60_chars_more', false - ] + ], [ + 'container_attribute', + false, + ], ]; } } From c8936eef96ba34f35f27dc04bd73208fee947353 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 9 May 2019 14:50:57 -0500 Subject: [PATCH 079/464] MAGETWO-99479: Use Escaper methods - fix mhi --- app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php index 2f136fa740fb0..ad6df50e1971f 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php @@ -6,12 +6,13 @@ */ namespace Magento\Tax\Controller\Adminhtml\Rate; +use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Controller\ResultFactory; /** * Tax Rate AjaxSave Controller */ -class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate +class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate implements HttpPostActionInterface { /** * @var \Magento\Framework\Escaper From e62b933ff211867c509ca6286780df24985b42a2 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 9 May 2019 15:50:00 -0500 Subject: [PATCH 080/464] MAGETWO-99479: Use Escaper methods - fix translate tags --- app/code/Magento/Translation/Model/Inline/Parser.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index c6145d3dc69f8..79e51536b7d56 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -531,18 +531,11 @@ function ($tagHtml, $tagName, $trArr) { return $this->_applySpecialTagsFormat($tagHtml, $tagName, $trArr); } ); - $this->_translateTags( - $this->_content, - $this->_allowedTagsGlobal, - function () { - return '_applySpecialTagsFormat'; - } - ); $this->_translateTags( $this->_content, $this->_allowedTagsSimple, - function () { - return '_applySimpleTagsFormat'; + function ($tagHtml, $tagName, $trArr) { + return $this->_applySimpleTagsFormat($tagHtml, $tagName, $trArr); } ); } From dfdd808e486907e50845a38c6bb6aebe49001338 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Fri, 10 May 2019 06:57:09 +0000 Subject: [PATCH 081/464] #16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 333e9e03706b9..731f55ca7c9d0 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -172,11 +172,18 @@ public function getRegionCollection() /** * Returns region html select * + * @param null|string $defValue + * @param string $name + * @param string $id + * @param string $title * @return string */ - public function getRegionHtmlSelect() + public function getRegionHtmlSelect($defValue = null,$name = 'region', $id = 'state', $title = 'State/Province') { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); + if ($defValue === null) { + $defValue = (int)$this->getRegionId(); + } $cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . $this->_storeManager->getStore()->getId(); $cache = $this->_configCacheType->load($cacheKey); if ($cache) { @@ -188,15 +195,15 @@ public function getRegionHtmlSelect() $html = $this->getLayout()->createBlock( \Magento\Framework\View\Element\Html\Select::class )->setName( - 'region' + $name )->setTitle( - __('State/Province') + __($title) )->setId( - 'state' + $id )->setClass( 'required-entry validate-state' )->setValue( - (int)$this->getRegionId() + $defValue )->setOptions( $options )->getHtml(); From 2a7f6a336cdf20472bd2619fcd092dafc0632a3e Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 10 May 2019 09:53:26 -0500 Subject: [PATCH 082/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../Customer/Model/CustomerAuthUpdate.php | 28 +++++++++++--- .../Unit/Model/CustomerAuthUpdateTest.php | 37 ++++++++++++++----- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Customer/Model/CustomerAuthUpdate.php b/app/code/Magento/Customer/Model/CustomerAuthUpdate.php index 06de649524e71..a805c1957df99 100644 --- a/app/code/Magento/Customer/Model/CustomerAuthUpdate.php +++ b/app/code/Magento/Customer/Model/CustomerAuthUpdate.php @@ -6,31 +6,43 @@ namespace Magento\Customer\Model; +use Magento\Customer\Model\ResourceModel\Customer as CustomerResourceModel; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\NoSuchEntityException; + /** * Customer Authentication update model. */ class CustomerAuthUpdate { /** - * @var \Magento\Customer\Model\CustomerRegistry + * @var CustomerRegistry */ protected $customerRegistry; /** - * @var \Magento\Customer\Model\ResourceModel\Customer + * @var CustomerResourceModel */ protected $customerResourceModel; /** - * @param \Magento\Customer\Model\CustomerRegistry $customerRegistry - * @param \Magento\Customer\Model\ResourceModel\Customer $customerResourceModel + * @var Customer + */ + private $customerModel; + + /** + * @param CustomerRegistry $customerRegistry + * @param CustomerResourceModel $customerResourceModel + * @param Customer|null $customerModel */ public function __construct( - \Magento\Customer\Model\CustomerRegistry $customerRegistry, - \Magento\Customer\Model\ResourceModel\Customer $customerResourceModel + CustomerRegistry $customerRegistry, + CustomerResourceModel $customerResourceModel, + Customer $customerModel = null ) { $this->customerRegistry = $customerRegistry; $this->customerResourceModel = $customerResourceModel; + $this->customerModel = $customerModel ?: ObjectManager::getInstance()->get(Customer::class); } /** @@ -38,6 +50,7 @@ public function __construct( * * @param int $customerId * @return $this + * @throws NoSuchEntityException */ public function saveAuth($customerId) { @@ -53,6 +66,9 @@ public function saveAuth($customerId) $this->customerResourceModel->getConnection()->quoteInto('entity_id = ?', $customerId) ); + $this->customerResourceModel->load($this->customerModel, $customerId); + $this->customerModel->reindex(); + return $this; } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerAuthUpdateTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerAuthUpdateTest.php index a1a243066bb7d..81a612c519f52 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CustomerAuthUpdateTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerAuthUpdateTest.php @@ -5,7 +5,14 @@ */ namespace Magento\Customer\Test\Unit\Model; +use Magento\Customer\Model\Customer as CustomerModel; use Magento\Customer\Model\CustomerAuthUpdate; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Customer\Model\Data\CustomerSecure; +use Magento\Customer\Model\ResourceModel\Customer as CustomerResourceModel; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** * Class CustomerAuthUpdateTest @@ -18,17 +25,22 @@ class CustomerAuthUpdateTest extends \PHPUnit\Framework\TestCase protected $model; /** - * @var \Magento\Customer\Model\CustomerRegistry|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $customerRegistry; /** - * @var \Magento\Customer\Model\ResourceModel\Customer|\PHPUnit_Framework_MockObject_MockObject + * @var CustomerResourceModel|\PHPUnit_Framework_MockObject_MockObject */ protected $customerResourceModel; /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + * @var CustomerModel|\PHPUnit_Framework_MockObject_MockObject + */ + protected $customerModel; + + /** + * @var ObjectManager */ protected $objectManager; @@ -37,32 +49,36 @@ class CustomerAuthUpdateTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->objectManager = new ObjectManager($this); $this->customerRegistry = - $this->createMock(\Magento\Customer\Model\CustomerRegistry::class); + $this->createMock(CustomerRegistry::class); $this->customerResourceModel = - $this->createMock(\Magento\Customer\Model\ResourceModel\Customer::class); + $this->createMock(CustomerResourceModel::class); + $this->customerModel = + $this->createMock(CustomerModel::class); $this->model = $this->objectManager->getObject( - \Magento\Customer\Model\CustomerAuthUpdate::class, + CustomerAuthUpdate::class, [ 'customerRegistry' => $this->customerRegistry, 'customerResourceModel' => $this->customerResourceModel, + 'customerModel' => $this->customerModel ] ); } /** * test SaveAuth + * @throws NoSuchEntityException */ public function testSaveAuth() { $customerId = 1; - $customerSecureMock = $this->createMock(\Magento\Customer\Model\Data\CustomerSecure::class); + $customerSecureMock = $this->createMock(CustomerSecure::class); - $dbAdapter = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class); + $dbAdapter = $this->createMock(AdapterInterface::class); $this->customerRegistry->expects($this->once()) ->method('retrieveSecureData') @@ -98,6 +114,9 @@ public function testSaveAuth() $customerId ); + $this->customerModel->expects($this->once()) + ->method('reindex'); + $this->model->saveAuth($customerId); } } From 29af9a7d34255083af79229dda563704eb28740a Mon Sep 17 00:00:00 2001 From: Andrea Parmeggiani <info@textarea.it> Date: Fri, 10 May 2019 18:03:38 +0200 Subject: [PATCH 083/464] Updated customer_account_forgotpassword.xml Missing question mark in Customer Account Forgot Password page title --- .../view/frontend/layout/customer_account_forgotpassword.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml index 9a701c14a0307..24cede5f0232a 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml @@ -7,7 +7,7 @@ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> - <title>Forgot Your Password + Forgot Your Password? From 3c5ae49c8ca20435f53a5c1ad1d544ac195cdac7 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Fri, 10 May 2019 16:13:47 -0500 Subject: [PATCH 084/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../CollectionReindexOnAccountLockTest.php | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php new file mode 100644 index 0000000000000..d7a559b4f907f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php @@ -0,0 +1,103 @@ +getBootstrap() + ->getApplication() + ->getDbInstance(); + if (!$db->isDbDumpExists()) { + throw new LogicException('DB dump does not exist.'); + } + $db->restoreFromDbDump(); + + parent::setUpBeforeClass(); + } + + /** + * Trigger customer account lock by making 10 failed authentication attempts + */ + private function lockCustomerAccountWithInvalidAuthentications() + { + /** @var AccountManagementInterface */ + $accountManagement = Bootstrap::getObjectManager()->create(AccountManagementInterface::class); + + for ($i = 0; $i < 10; $i++) { + try { + $accountManagement->authenticate('roni_cost@example.com', 'wrongPassword'); + } catch (InvalidEmailOrPasswordException $e) { + } + } + } + + /** + * @return mixed + * @throws NoSuchEntityException + */ + private function getCustomerLockExpire(): ?string + { + /** @var CustomerRegistry $customerRegistry */ + $customerRegistry = Bootstrap::getObjectManager()->create(CustomerRegistry::class); + $customerModel = $customerRegistry->retrieve(1); + + return $customerModel->getData('lock_expires'); + } + + /** + * @return mixed + */ + private function getCustomerGridLockExpire(): ?string + { + /** @var Collection */ + $gridCustomerCollection = Bootstrap::getObjectManager()->create(Collection::class); + $gridCustomerItem = $gridCustomerCollection->getItemById(1); + + return $gridCustomerItem->getData('lock_expires'); + } + + /** + * Test if customer account lock on too many failed authentication attempts triggers customer grid reindex + */ + public function testCustomerAccountReindexOnLock() + { + $this->assertSame( + $this->getCustomerGridLockExpire(), + $this->getCustomerLockExpire() + ); + + $this->lockCustomerAccountWithInvalidAuthentications(); + + $this->assertSame( + $this->getCustomerGridLockExpire(), + $this->getCustomerLockExpire() + ); + } + + /** + * teardown + */ + public function tearDown() + { + parent::tearDown(); + } +} From eecedddf13acf2c59978a6817b86b7a7fe045880 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Sat, 11 May 2019 11:33:00 +0300 Subject: [PATCH 085/464] MAGETWO-70681: Store View name DB field is too short --- app/code/Magento/Sales/etc/db_schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/etc/db_schema.xml b/app/code/Magento/Sales/etc/db_schema.xml index 821eb74228ddc..82e6d5d10b53a 100644 --- a/app/code/Magento/Sales/etc/db_schema.xml +++ b/app/code/Magento/Sales/etc/db_schema.xml @@ -219,7 +219,7 @@ - + Date: Sat, 11 May 2019 20:23:51 +0300 Subject: [PATCH 086/464] #682: [Test coverage] added test cases for missed parameters at 'setBillingAddressMutation' --- .../Customer/SetBillingAddressOnCartTest.php | 86 ++++++++++++++++++- .../Guest/SetBillingAddressOnCartTest.php | 81 +++++++++++++++++ ...tishipping_with_two_shipping_addresses.php | 26 ++++++ 3 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index fc73d88be1f87..6206a8f4b1209 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -321,6 +321,89 @@ public function testSetNewBillingAddressAndFromAddressBookAtSameTime() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php + */ + public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php + */ + public function testSetNewBillingAddressWithUseForShippingAndMultishipping() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * _security * @magentoApiDataFixture Magento/Customer/_files/customer.php @@ -470,9 +553,6 @@ public function testSetBillingAddressOnNonExistentCart() */ public function testSetBillingAddressWithoutRequiredParameters(string $input, string $message) { - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $input = str_replace('cart_id_value', $maskedQuoteId, $input); - $query = <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query); + } + + /** + * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php + */ + public function testSetNewBillingAddressWithUseForShippingAndMultishipping() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query); + } + /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php new file mode 100644 index 0000000000000..c7ff96bc7e3d7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php @@ -0,0 +1,26 @@ +get(QuoteFactory::class); +/** @var QuoteResource $quoteResource */ +$quoteResource = Bootstrap::getObjectManager()->get(QuoteResource::class); + +$quote = $quoteFactory->create(); +$quoteResource->load($quote, 'test_quote', 'reserved_order_id'); + +require __DIR__ . '/../../../Multishipping/Fixtures/shipping_address_list.php'; + +/** @var CartRepositoryInterface $quoteRepository */ +$quoteRepository = $objectManager->get(CartRepositoryInterface::class); +$quote->collectTotals(); +$quoteRepository->save($quote); \ No newline at end of file From 468767eda6c283aa5eb966e380dafd89095cf999 Mon Sep 17 00:00:00 2001 From: Sinisa Nedeljkovic Date: Sun, 12 May 2019 11:14:11 -0700 Subject: [PATCH 087/464] GraphQl-484: [Test Coverage] 'SetShippingAddressOnCart' functionality --- .../Customer/SetShippingAddressOnCartTest.php | 95 ++++++++++++++++--- .../Guest/SetShippingAddressOnCartTest.php | 65 ++++++++++--- 2 files changed, 134 insertions(+), 26 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php index 5d7a073d2d6d5..62ba64ae4105b 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingAddressOnCartTest.php @@ -383,23 +383,19 @@ public function testSetShippingAddressToAnotherCustomerCart() public function testSetNewShippingAddressWithMissedRequiredParameters(string $input, string $message) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $input = str_replace('cart_id_value', $maskedQuoteId, $input); $query = << [ - '', - 'The shipping address must contain either "customer_address_id" or "address".', + 'missed_shipping_addresses' => [ + 'cart_id: "cart_id_value"', + 'Field SetShippingAddressesOnCartInput.shipping_addresses of required type [ShippingAddressInput]! was not provided.', ], 'missed_city' => [ - 'address: { save_in_address_book: false }', + 'shipping_addresses: [ { address: { save_in_address_book: false } } ]', 'Field CartAddressInput.city of required type String! was not provided' + ], + 'missed_cart_id' => [ + 'shipping_addresses: {}', + 'Required parameter "cart_id" is missing' ] ]; } @@ -532,6 +532,75 @@ public function testSetNewShippingAddressOnCartWithRedundantStreetLine() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @expectedException \Exception + * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" + */ + public function testSetShippingAddressOnNonExistentCart() + { + $maskedQuoteId = 'non_existent_masked_id'; + $query = <<graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * _security + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php + */ + public function testSetShippingAddressToGuestCart() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<expectExceptionMessage( + "The current user cannot perform operations on cart \"{$maskedQuoteId}\"" + ); + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * Verify the all the whitelisted fields for a New Address Object * diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php index c58098c6c2547..d51341f590490 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingAddressOnCartTest.php @@ -221,23 +221,19 @@ public function testSetShippingAddressToCustomerCart() public function testSetNewShippingAddressWithMissedRequiredParameters(string $input, string $message) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $input = str_replace('cart_id_value', $maskedQuoteId, $input); $query = << [ - '', - 'The shipping address must contain either "customer_address_id" or "address".', + 'missed_shipping_addresses' => [ + 'cart_id: "cart_id_value"', + 'Field SetShippingAddressesOnCartInput.shipping_addresses of required type [ShippingAddressInput]! was not provided.', ], 'missed_city' => [ - 'address: { save_in_address_book: false }', + 'shipping_addresses: [ { address: { save_in_address_book: false } } ]', 'Field CartAddressInput.city of required type String! was not provided' + ], + 'missed_cart_id' => [ + 'shipping_addresses: {}', + 'Required parameter "cart_id" is missing' ] ]; } @@ -367,6 +367,45 @@ public function testSetMultipleNewShippingAddresses() $this->graphQlMutation($query); } + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" + */ + public function testSetShippingAddressOnNonExistentCart() + { + $maskedQuoteId = 'non_existent_masked_id'; + $query = <<graphQlMutation($query); + } + /** * Verify the all the whitelisted fields for a New Address Object * From 68599ef842d75cede88c045104b10c17e264fe63 Mon Sep 17 00:00:00 2001 From: Mila Lesechko Date: Sun, 12 May 2019 13:39:22 -0500 Subject: [PATCH 088/464] MC-170: Admin should be able to create new group in an Attribute Set --- .../AdminProductAttributeSetEditSection.xml | 7 ++ .../Mftf/Section/AdminProductFormSection.xml | 2 + ...AdminCreateNewGroupForAttributeSetTest.xml | 110 ++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml index 0814c7ea7dc3e..df8915a499843 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml @@ -17,9 +17,16 @@ + + + + + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index f515171e835db..35773fcfc87cd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -207,5 +207,7 @@ + + \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml new file mode 100644 index 0000000000000..fcef85352169b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml @@ -0,0 +1,110 @@ + + + + + + + + + <description value="The test verifies creating a new group in an attribute set and a validation message in case of empty group name"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-170"/> + <group value="Catalog"/> + </annotations> + <before> + <!-- Create a custom attribute set and custom product attribute --> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + </before> + <after> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Login to Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + + <!-- Navigate to Stores > Attributes > Attribute Set --> + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + + <!-- Search and open Attribute Set from preconditions --> + <actionGroup ref="goToAttributeSetByName" stepKey="searchAttribute"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- Click 'Add New': Show 'New Group' Modal --> + <click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddNew"/> + <waitForAjaxLoad stepKey="waitForAjax"/> + + <!-- Fill 'name' for new group and click 'Ok': Name = <empty> --> + <fillField userInput="" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOk"/> + + <!-- Error message 'This is a required field.' is displayed --> + <see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/> + + <!-- Fill 'name' for new group and click 'Ok': Name = Custom group --> + <fillField userInput="Custom group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/> + + <!-- Group is created and displayed in 'Groups' block --> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom group')}}" stepKey="assertCustomGroup"/> + + <!-- Move custom Product Attribute to new 'Custom group' Group --> + <waitForAjaxLoad stepKey="waitForAjaxLoad"/> + <click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="click"/> + <waitForPageLoad stepKey="waitForPageLoadAfterClick"/> + <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="moveAttribute"/> + <waitForPageLoad stepKey="waitForDragAndDrop"/> + + <!-- Attribute is displayed in the new group --> + <see userInput="$$createConfigProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttribute"/> + + <!-- Click 'Save' --> + <actionGroup ref="SaveAttributeSet" stepKey="saveAttribute"/> + + <actionGroup ref="goToAttributeSetByName" stepKey="backTohAttributeSet"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- Create another group: Name = Empty group --> + <click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddEmptyGroup"/> + <waitForAjaxLoad stepKey="waitForLoad"/> + + <fillField userInput="Empty group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOnOk"/> + <waitForPageLoad stepKey="waitForNewGroup"/> + + <!-- Empty group is created. No attributes are assigned to it. --> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Empty group')}}" stepKey="assertEmptyGroup"/> + <dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup('Empty group')}}" stepKey="seeNoAttributes"/> + + <!-- Navigate to Catalog > Products --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Start to create a new simple product with the custom attribute set from the preconditions --> + <click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddProduct"/> + <waitForPageLoad stepKey="waitForNewProductPage"/> + + <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttribute"> + <argument name="attributeSetName" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- New Section 'Custom group' is present in form. The section contains the attribute from preconditions --> + <seeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="seeSectionCustomGroup"/> + <click selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="openCustomGroupSection"/> + <waitForAjaxLoad stepKey="waitForOpenSection"/> + <scrollTo selector="//footer" stepKey="scrollToFooter"/> + <seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName('Custom group')}}" stepKey="seeAttributePresent"/> + + <!-- Empty section is absent in Product Form --> + <dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Empty group')}}" stepKey="dontSeeEmptyGroup"/> + </test> +</tests> From a90b4937b08b59286f6d9b9fc9f2e80c92677d97 Mon Sep 17 00:00:00 2001 From: Matthew O'Loughlin <matthew.oloughlin@aligent.com.au> Date: Mon, 13 May 2019 05:57:24 +0930 Subject: [PATCH 089/464] GraphQl-673: Add email validity check on isEmailAvailable query, and add test coverage for negative cases --- .../Model/Resolver/IsEmailAvailable.php | 17 ++++++- .../GraphQl/Customer/IsEmailAvailableTest.php | 51 +++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsEmailAvailable.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsEmailAvailable.php index ddf1aec275ece..a16c539081959 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/IsEmailAvailable.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/IsEmailAvailable.php @@ -13,6 +13,7 @@ use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\Validator\EmailAddress as EmailValidator; /** * Is Customer Email Available @@ -24,13 +25,21 @@ class IsEmailAvailable implements ResolverInterface */ private $accountManagement; + /** + * @var EmailValidator + */ + private $emailValidator; + /** * @param AccountManagementInterface $accountManagement + * @param EmailValidator $emailValidator */ public function __construct( - AccountManagementInterface $accountManagement + AccountManagementInterface $accountManagement, + EmailValidator $emailValidator ) { $this->accountManagement = $accountManagement; + $this->emailValidator = $emailValidator; } /** @@ -44,7 +53,11 @@ public function resolve( array $args = null ) { if (!isset($args['email']) || empty($args['email'])) { - throw new GraphQlInputException(__('"Email should be specified')); + throw new GraphQlInputException(__('Email should be specified')); + } + + if (!$this->emailValidator->isValid($args['email'])) { + throw new GraphQlInputException(__('Email is invalid')); } try { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php index 37693fbba7fef..3e0f97081da2d 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php @@ -47,4 +47,55 @@ public function testEmailAvailable() self::assertArrayHasKey('is_email_available', $response['isEmailAvailable']); self::assertTrue($response['isEmailAvailable']['is_email_available']); } + + /** + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: Email should be specified + */ + public function testEmailAvailableEmptyValue() + { + $query = + <<<QUERY +{ + isEmailAvailable(email: "") { + is_email_available + } +} +QUERY; + $response = $this->graphQlQuery($query); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: Field "isEmailAvailable" argument "email" of type "String!" is required but not provided. + */ + public function testEmailAvailableMissingValue() + { + $query = + <<<QUERY +{ + isEmailAvailable { + is_email_available + } +} +QUERY; + $response = $this->graphQlQuery($query); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage GraphQL response contains errors: Email is invalid + */ + public function testEmailAvailableInvalidValue() + { + $query = + <<<QUERY +{ + isEmailAvailable(email: "invalid-email") { + is_email_available + } +} +QUERY; + $response = $this->graphQlQuery($query); + } } From cc13123f7379f9359903e54d52e083a5ef2a9b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= <rafaelcg_stz@hotmail.com> Date: Sun, 12 May 2019 14:18:32 -0700 Subject: [PATCH 090/464] GraphQL-676: Test unsubscribe customer --- .../Customer/SubscriptionStatusTest.php | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php index 2b54c97cd1e97..d7b77ce3bc7bc 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php @@ -7,6 +7,8 @@ namespace Magento\GraphQl\Customer; +use Exception; +use Magento\Framework\Exception\AuthenticationException; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\Newsletter\Model\SubscriberFactory; use Magento\TestFramework\Helper\Bootstrap; @@ -55,7 +57,7 @@ public function testGetSubscriptionStatusTest() } /** - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage The current customer isn't authorized. */ public function testGetSubscriptionStatusIfUserIsNotAuthorizedTest() @@ -101,7 +103,7 @@ public function testChangeSubscriptionStatusTest() } /** - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage The current customer isn't authorized. */ public function testChangeSubscriptionStatuIfUserIsNotAuthorizedTest() @@ -122,10 +124,37 @@ public function testChangeSubscriptionStatuIfUserIsNotAuthorizedTest() $this->graphQlMutation($query); } + /** + * @magentoApiDataFixture Magento/Newsletter/_files/subscribers.php + */ + public function testUnsubscribeCustomer() + { + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + + $query = <<<QUERY +mutation { + updateCustomer( + input: { + is_subscribed: false + } + ) { + customer { + is_subscribed + } + } +} +QUERY; + $response = $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + $this->assertFalse($response['updateCustomer']['customer']['is_subscribed']); + } + /** * @param string $email * @param string $password + * * @return array + * @throws AuthenticationException */ private function getCustomerAuthHeaders(string $email, string $password): array { From 062c5735458ef9578994f8ff2fe007c4b040e556 Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Mon, 13 May 2019 11:32:42 +0400 Subject: [PATCH 091/464] MAGETWO-94004: Magento Admin can not configure properly bundle/grouped/configurable product with shared catalog enabled and if they were added by sku to an order - Updated automated test script --- .../Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml | 6 +++--- .../AdminOrderConfigurableProductActionGroup.xml | 4 ++-- .../ActionGroup/AdminOrderGroupedProductActionGroup.xml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml index 77f6bbec646cf..d73d31c4498f8 100644 --- a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOrderConfigureBundleProduct"> <arguments> - <argument name="productName" type="string"/> - <argument name="productNumber" type="string"/> - <argument name="productQty" type="string"/> + <argument name="productName" type="string" defaultValue="{{SimpleProduct.sku}}"/> + <argument name="productNumber" type="string" defaultValue="1"/> + <argument name="productQty" type="string" defaultValue="1"/> </arguments> <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> <waitForPageLoad stepKey="waitForConfigurePageLoad"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml index 40a03874aaa21..8858b8c9627d5 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml @@ -10,8 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOrderConfigureConfigurableProduct"> <arguments> - <argument name="optionName" type="string"/> - <argument name="productQty" type="string"/> + <argument name="optionName" type="string" defaultValue="option1"/> + <argument name="productQty" type="string" defaultValue="1"/> </arguments> <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> <waitForPageLoad stepKey="waitForConfigurePageLoad"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml index 69023d0a14931..7028d1c8a6f76 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml @@ -10,8 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOrderConfigureGroupedProduct"> <arguments> - <argument name="productSku" type="string"/> - <argument name="productQty" type="string"/> + <argument name="productSku" type="string" defaultValue="{{SimpleProduct.sku}}"/> + <argument name="productQty" type="string" defaultValue="1"/> </arguments> <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> <waitForPageLoad stepKey="waitForConfigurePageLoad"/> From 9512b1ac745c9fe729c21fe58e38b4a99ef25195 Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Mon, 13 May 2019 12:03:58 +0400 Subject: [PATCH 092/464] MAGETWO-94004: Magento Admin can not configure properly bundle/grouped/configurable product with shared catalog enabled and if they were added by sku to an order - Updated automated test script --- .../Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml index 2773616971295..915b11ebdbbaa 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml @@ -9,6 +9,6 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminOrderBundleProductSection"> - <element name="bundleProductCheckbox" type="checkbox" selector="(//input[contains(@class, 'admin__control-checkbox') and contains(@class, 'bundle-option')])[{{row}}]" parameterized="true"/> + <element name="bundleProductCheckbox" type="checkbox" selector="(//input[contains(@class, 'admin__control-checkbox') and contains(@class, 'bundle-option')])[{{productNumber}}]" parameterized="true"/> </section> </sections> From ec3293a7fa46ec137d33e8831b017264675ae845 Mon Sep 17 00:00:00 2001 From: Davit_Zakharyan <davit_zakharyan@epam.com> Date: Mon, 13 May 2019 17:52:45 +0400 Subject: [PATCH 093/464] MAGETWO-36337: Not user-friendly behaviour of "Save in address book" check-box inside "Shipping Address" section on "create Order" Admin page - Updated automated test script. --- .../Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml index 993537fe00588..e6f40b586d2ae 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml @@ -10,8 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminSaveInAddressBookCheckboxStateTest"> <annotations> - <title value="'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> - <description value="'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> + <title value="The state of 'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> + <description value="The state of 'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> <features value="Sales"/> <severity value="MAJOR"/> <testCaseId value="MAGETWO-36337"/> From 9a5b1e3b4668ecffdeba26f9e9f749a62d6bbe76 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Mon, 13 May 2019 12:44:39 -0500 Subject: [PATCH 094/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../CollectionReindexOnAccountLockTest.php | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php index d7a559b4f907f..58b4d79d4516c 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php @@ -6,7 +6,6 @@ namespace Magento\Customer\Model\ResourceModel\Grid; -use LogicException; use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Model\CustomerRegistry; use Magento\Framework\Exception\InvalidEmailOrPasswordException; @@ -17,23 +16,11 @@ /** * Test if customer account lock on too many failed authentication attempts triggers customer grid reindex + * + * @SuppressWarnings(PHPMD) */ class CollectionReindexOnAccountLockTest extends TestCase { - public static function setUpBeforeClass() - { - $db = Bootstrap::getInstance() - ->getBootstrap() - ->getApplication() - ->getDbInstance(); - if (!$db->isDbDumpExists()) { - throw new LogicException('DB dump does not exist.'); - } - $db->restoreFromDbDump(); - - parent::setUpBeforeClass(); - } - /** * Trigger customer account lock by making 10 failed authentication attempts */ @@ -44,7 +31,7 @@ private function lockCustomerAccountWithInvalidAuthentications() for ($i = 0; $i < 10; $i++) { try { - $accountManagement->authenticate('roni_cost@example.com', 'wrongPassword'); + $accountManagement->authenticate('customer@example.com', 'wrongPassword'); } catch (InvalidEmailOrPasswordException $e) { } } @@ -59,6 +46,7 @@ private function getCustomerLockExpire(): ?string /** @var CustomerRegistry $customerRegistry */ $customerRegistry = Bootstrap::getObjectManager()->create(CustomerRegistry::class); $customerModel = $customerRegistry->retrieve(1); + $this->assertNotEmpty($customerModel); return $customerModel->getData('lock_expires'); } @@ -71,12 +59,15 @@ private function getCustomerGridLockExpire(): ?string /** @var Collection */ $gridCustomerCollection = Bootstrap::getObjectManager()->create(Collection::class); $gridCustomerItem = $gridCustomerCollection->getItemById(1); + $this->assertNotEmpty($gridCustomerItem); return $gridCustomerItem->getData('lock_expires'); } /** * Test if customer account lock on too many failed authentication attempts triggers customer grid reindex + * + * @magentoDataFixture Magento/Customer/_files/customer.php */ public function testCustomerAccountReindexOnLock() { @@ -92,12 +83,4 @@ public function testCustomerAccountReindexOnLock() $this->getCustomerLockExpire() ); } - - /** - * teardown - */ - public function tearDown() - { - parent::tearDown(); - } } From 1c81c10c392e3adc916b99a8f13250e470c62940 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Mon, 13 May 2019 14:01:28 -0500 Subject: [PATCH 095/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../ResourceModel/Grid/CollectionReindexOnAccountLockTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php index 58b4d79d4516c..1fc4f9136b3fe 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php @@ -32,6 +32,7 @@ private function lockCustomerAccountWithInvalidAuthentications() for ($i = 0; $i < 10; $i++) { try { $accountManagement->authenticate('customer@example.com', 'wrongPassword'); + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock } catch (InvalidEmailOrPasswordException $e) { } } From c915749844d81b0b826d0b56db9e1d31f6d8559a Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 13 May 2019 14:19:11 -0500 Subject: [PATCH 096/464] MAGETWO-99479: Use Escaper methods - fix unit --- .../Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php index 219f9127d4ad8..3fc97d2ee9fbd 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php @@ -81,6 +81,7 @@ protected function setUp() $queueFactory->expects($this->any())->method('create')->will($this->returnValue($this->queue)); $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManager->getObject(\Magento\Framework\Escaper::class); $this->preview = $this->objectManager->getObject( \Magento\Newsletter\Block\Adminhtml\Queue\Preview::class, [ @@ -88,6 +89,7 @@ protected function setUp() 'templateFactory' => $templateFactory, 'subscriberFactory' => $subscriberFactory, 'queueFactory' => $queueFactory, + 'escaper' => $escaper ] ); } From e77d295fd32f5f87b77cc696edca5765e3a49c38 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Mon, 13 May 2019 14:41:33 -0500 Subject: [PATCH 097/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../ResourceModel/Grid/CollectionReindexOnAccountLockTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php index 1fc4f9136b3fe..a665046ceef0d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionReindexOnAccountLockTest.php @@ -69,6 +69,8 @@ private function getCustomerGridLockExpire(): ?string * Test if customer account lock on too many failed authentication attempts triggers customer grid reindex * * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled */ public function testCustomerAccountReindexOnLock() { From c50975a7b3dd61cbc0d030cb56b4f0099a61921d Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Mon, 8 Apr 2019 16:47:00 +0300 Subject: [PATCH 098/464] getUrlInStore() does not allow to override the scope in backend context --- app/code/Magento/Backend/Model/Url.php | 21 ++++++++-- .../Magento/Catalog/Model/Product/UrlTest.php | 40 +++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index f199fd0fe7bf1..ba0c3d1cfacee 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -13,6 +13,7 @@ * Class \Magento\Backend\Model\UrlInterface * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @api * @since 100.0.2 */ @@ -366,6 +367,19 @@ protected function _getMenu() return $this->_menu; } + /** + * Set scope entity + * + * @param mixed $scopeId + * @return \Magento\Framework\UrlInterface + */ + public function setScope($scopeId) + { + parent::setScope($scopeId); + $this->_scope = $this->_scopeResolver->getScope($scopeId); + return $this; + } + /** * Set custom auth session * @@ -402,13 +416,13 @@ public function getAreaFrontName() } /** - * Retrieve action path. - * Add backend area front name as a prefix to action path + * Retrieve action path, add backend area front name as a prefix to action path * * @return string */ protected function _getActionPath() { + $path = parent::_getActionPath(); if ($path) { if ($this->getAreaFrontName()) { @@ -448,8 +462,7 @@ protected function _getConfigCacheId($path) } /** - * Get config data by path - * Use only global config values for backend + * Get config data by path, use only global config values for backend * * @param string $path * @return null|string diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/UrlTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/UrlTest.php index f9075a58c39ef..4cf059d4bf692 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/UrlTest.php @@ -42,6 +42,46 @@ public function testGetUrlInStore() $this->assertStringEndsWith('simple-product.html', $this->_model->getUrlInStore($product)); } + /** + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoConfigFixture default_store web/unsecure/base_url http://sample.com/ + * @magentoConfigFixture default_store web/unsecure/base_link_url http://sample.com/ + * @magentoConfigFixture fixturestore_store web/unsecure/base_url http://sample-second.com/ + * @magentoConfigFixture fixturestore_store web/unsecure/base_link_url http://sample-second.com/ + * @magentoDataFixture Magento/Catalog/_files/product_simple_multistore.php + * @dataProvider getUrlsWithSecondStoreProvider + * @magentoAppArea adminhtml + */ + public function testGetUrlInStoreWithSecondStore($storeCode, $expectedProductUrl) + { + $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Catalog\Model\ProductRepository::class + ); + /** @var \Magento\Store\Model\Store $store */ + $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Store\Model\Store::class); + $store->load($storeCode, 'code'); + /** @var \Magento\Store\Model\Store $store */ + + $product = $repository->get('simple'); + + $this->assertEquals( + $expectedProductUrl, + $this->_model->getUrlInStore($product, ['_scope' => $store->getId(), '_nosid' => true]) + ); + } + + /** + * @return array + */ + public function getUrlsWithSecondStoreProvider() + { + return [ + 'case1' => ['fixturestore', 'http://sample-second.com/index.php/simple-product-one.html'], + 'case2' => ['default', 'http://sample.com/index.php/simple-product-one.html'] + ]; + } + public function testGetProductUrl() { $repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( From 2cd9f9742d05a9647a1179243bdc96fbec1d0e37 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Tue, 14 May 2019 09:59:37 -0500 Subject: [PATCH 099/464] MAGETWO-99493: Account lock status not showing correctly in Customer Grid --- .../Magento/Customer/Model/CustomerAuthUpdate.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Model/CustomerAuthUpdate.php b/app/code/Magento/Customer/Model/CustomerAuthUpdate.php index a805c1957df99..bc9bffb6ffdf0 100644 --- a/app/code/Magento/Customer/Model/CustomerAuthUpdate.php +++ b/app/code/Magento/Customer/Model/CustomerAuthUpdate.php @@ -56,18 +56,23 @@ public function saveAuth($customerId) { $customerSecure = $this->customerRegistry->retrieveSecureData($customerId); + $this->customerResourceModel->load($this->customerModel, $customerId); + $currentLockExpiresVal = $this->customerModel->getData('lock_expires'); + $newLockExpiresVal = $customerSecure->getData('lock_expires'); + $this->customerResourceModel->getConnection()->update( $this->customerResourceModel->getTable('customer_entity'), [ 'failures_num' => $customerSecure->getData('failures_num'), 'first_failure' => $customerSecure->getData('first_failure'), - 'lock_expires' => $customerSecure->getData('lock_expires'), + 'lock_expires' => $newLockExpiresVal, ], $this->customerResourceModel->getConnection()->quoteInto('entity_id = ?', $customerId) ); - $this->customerResourceModel->load($this->customerModel, $customerId); - $this->customerModel->reindex(); + if ($currentLockExpiresVal !== $newLockExpiresVal) { + $this->customerModel->reindex(); + } return $this; } From a1bd4d9e0619703d27274d14c75e4c161e2cdb7e Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Mon, 13 May 2019 19:52:59 -0500 Subject: [PATCH 100/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../adminhtml/templates/items/price/row.phtml | 11 ++--- .../templates/items/price/total.phtml | 5 +-- .../templates/items/price/unit.phtml | 11 ++--- .../order/create/items/price/row.phtml | 11 ++--- .../order/create/items/price/total.phtml | 11 ++--- .../order/create/items/price/unit.phtml | 11 ++--- .../view/adminhtml/templates/rate/form.phtml | 3 -- .../view/adminhtml/templates/rate/js.phtml | 5 +-- .../view/adminhtml/templates/rate/title.phtml | 15 +++---- .../view/adminhtml/templates/rule/edit.phtml | 32 +++++++------- .../adminhtml/templates/rule/rate/form.phtml | 3 +- .../templates/toolbar/class/add.phtml | 11 ----- .../templates/toolbar/class/save.phtml | 24 ----------- .../templates/toolbar/rate/add.phtml | 3 -- .../templates/toolbar/rate/save.phtml | 5 +-- .../templates/toolbar/rule/add.phtml | 11 ----- .../templates/toolbar/rule/save.phtml | 25 ----------- .../base/templates/pricing/adjustment.phtml | 9 ++-- .../templates/pricing/adjustment/bundle.phtml | 11 ++--- .../checkout/cart/item/price/sidebar.phtml | 10 ++--- .../templates/checkout/grandtotal.phtml | 28 ++++++------ .../templates/checkout/shipping.phtml | 32 +++++++------- .../templates/checkout/shipping/price.phtml | 11 ++--- .../templates/checkout/subtotal.phtml | 26 ++++++----- .../frontend/templates/checkout/tax.phtml | 22 +++++----- .../templates/email/items/price/row.phtml | 11 ++--- .../frontend/templates/item/price/row.phtml | 6 +-- .../item/price/total_after_discount.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 6 +-- .../view/frontend/templates/order/tax.phtml | 21 ++++----- .../adminhtml/templates/items/price/row.phtml | 15 +++---- .../templates/items/price/total.phtml | 5 +-- .../templates/items/price/unit.phtml | 15 +++---- .../order/create/items/price/row.phtml | 23 +++++----- .../order/create/items/price/total.phtml | 23 +++++----- .../order/create/items/price/unit.phtml | 23 +++++----- .../adminhtml/templates/renderer/tax.phtml | 43 +++++++++---------- .../base/templates/pricing/adjustment.phtml | 23 +++++----- .../checkout/cart/item/price/sidebar.phtml | 18 ++++---- .../review/item/price/row_excl_tax.phtml | 16 +++---- .../review/item/price/row_incl_tax.phtml | 16 +++---- .../review/item/price/unit_excl_tax.phtml | 16 +++---- .../review/item/price/unit_incl_tax.phtml | 16 +++---- .../templates/email/items/price/row.phtml | 19 ++++---- .../frontend/templates/item/price/row.phtml | 30 ++++++------- .../item/price/total_after_discount.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 30 ++++++------- 47 files changed, 275 insertions(+), 454 deletions(-) delete mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml delete mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml delete mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml delete mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml index 5e914fdc5a558..890e876cf02fc 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -16,18 +13,18 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> <div class="price-excl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?> + <?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?> </div> <?php endif; ?> <?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> <div class="price-incl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> <?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($_item); ?> - <?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?> + <?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/total.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/total.phtml index 501ec61d34815..f8a32492a566d 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/total.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/total.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -13,4 +10,4 @@ $_item = $block->getItem(); ?> -<?= /* @escapeNotVerified */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?> +<?= /* @noEscape */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml index 82d82192d45e4..35ca03ffbd5af 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -16,21 +13,21 @@ $_item = $block->getItem(); <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <div class="price-excl-tax"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?> + <?= /* @noEscape */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?> </div> <?php endif; ?> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceInclTax()): ?> <div class="price-incl-tax"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> <?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBasePriceInclTax($_item); ?> - <?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?> + <?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml index 17f7f39529a74..63c55526e2417 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -15,15 +12,15 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices($block->getStore())): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($_item->getRowTotal()) ?> + <?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?> <?php endif; ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?> + <?= /* @noEscape */ $block->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml index 860b4662fd369..480fb84feb8cc 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -16,16 +13,16 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php $_rowTotalWithoutDiscount = $_item->getRowTotal() - $_item->getTotalDiscountAmount(); ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> + <?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> <?php endif; ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices($block->getStore())): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $block->getTotalAmount($_item); ?> - <?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?> + <?= /* @noEscape */ $block->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml index 2846307979df0..a229c0bba8340 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -15,16 +12,16 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($_item->getCalculationPrice()) ?> + <?= /* @noEscape */ $block->formatPrice($_item->getCalculationPrice()) ?> <?php endif; ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?> + <?= /* @noEscape */ $block->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/form.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/form.phtml index 30b5e954da5d2..304020c3af279 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/form.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/form.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div class="entry-edit form-inline"> <?= $block->getFormHtml() ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml index 16c23624c38e6..4a3d20d4394f1 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <script> require([ @@ -13,7 +10,7 @@ require([ "mage/adminhtml/form" ], function(jQuery){ - var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @escapeNotVerified */ $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable'); + var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @noEscape */ $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable'); updater.disableRegionValidation(); (function ($) { diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml index 682968e34479b..e729a7ef3c2e3 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml @@ -3,21 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <fieldset id="tax-rate-titles-table" class="admin__fieldset"> <?php $_labels = $block->getTitles() ?> <?php foreach ($block->getStores() as $_store): ?> <div class="admin__field"> - <label class="admin__field-label"><span><?= /* @escapeNotVerified */ $_store->getName() ?></span></label> + <label class="admin__field-label"> + <span><?= $block->escapeHtml($_store->getName()) ?></span> + </label> <div class="admin__field-control"> <input class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>" type="text" - name="title[<?= /* @escapeNotVerified */ $_store->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_labels[$_store->getId()] ?>" /> + name="title[<?= $block->escapeHtml($_store->getId()) ?>]" + value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>" /> </div> </div> <?php endforeach; ?> @@ -25,8 +24,8 @@ <div class="messages"> <div class="message message-notice"> <div> - <strong><?= /* @escapeNotVerified */ __('Note:') ?></strong> - <?= /* @escapeNotVerified */ __('Leave this field empty if you wish to use the tax identifier.') ?> + <strong><?= $block->escapeHtml(__('Note:')) ?></strong> + <?= $block->escapeHtml(__('Leave this field empty if you wish to use the tax identifier.')) ?> </div> </div> </div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml index fced077015f4e..a84361f7052cd 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Tax\Block\Adminhtml\Rule\Edit\Form */ ?> <script> @@ -78,7 +76,7 @@ require([ $.ajax({ type: "POST", data: {id:id}, - url: '<?= /* @escapeNotVerified */ $block->getTaxRateLoadUrl() ?>', + url: '<?= $block->escapeUrl($block->getTaxRateLoadUrl()) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -95,14 +93,14 @@ require([ }); else alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); }, dataType: "json" @@ -113,7 +111,7 @@ require([ var options = { mselectContainer: '#tax_rate + section.mselect-list', toggleAddButton:false, - addText: '<?= /* @escapeNotVerified */ __('Add New Tax Rate') ?>', + addText: '<?= $block->escapeJs(__('Add New Tax Rate')) ?>', parse: null, nextPageUrl: '<?php echo $block->escapeHtml($block->getTaxRatesPageUrl())?>', selectedValues: this.settings.selected_values, @@ -138,7 +136,7 @@ require([ var taxRate = $('#tax_rate'), taxRateField = taxRate.parent(), taxRateForm = $('#tax-rate-form'), - taxRateFormElement = $('#<?= /* @escapeNotVerified */ \Magento\Tax\Block\Adminhtml\Rate\Form::FORM_ELEMENT_ID ?>'); + taxRateFormElement = $('#<?= /* @noEscape */ \Magento\Tax\Block\Adminhtml\Rate\Form::FORM_ELEMENT_ID ?>'); if (!this.isEntityEditable) { // Override default layout of editable multiselect @@ -162,7 +160,7 @@ require([ taxRateField.find('.mselect-list') .on('click.mselect-edit', '.mselect-edit', this.edit) .on("click.mselect-delete", ".mselect-delete", function () { - if (!confirm('<?= /* @escapeNotVerified */ __('Do you really want to delete this tax rate?') ?>')) { + if (!confirm('<?= $block->escapeJs(__('Do you really want to delete this tax rate?')) ?>')) { return; } @@ -178,7 +176,7 @@ require([ form_key: $('input[name="form_key"]').val() }, dataType: 'json', - url: '<?= /* @escapeNotVerified */ $block->getTaxRateDeleteUrl() ?>', + url: '<?= $block->escapeUrl($block->getTaxRateDeleteUrl()) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -196,14 +194,14 @@ require([ }); else alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); } }; @@ -224,15 +222,15 @@ require([ taxRateFormElement.mage('form').mage('validation'); taxRateForm.dialogRates({ - title: '<?= /* @escapeNotVerified */ __('Tax Rate') ?>', + title: '<?= $block->escapeJs(__('Tax Rate')) ?>', type: 'slide', - id: '<?= /* @escapeNotVerified */ $block->getJsId() ?>', + id: '<?= $block->escapeJs($block->getJsId()) ?>', modalClass: 'tax-rate-popup', closed: function () { taxRateFormElement.data('validation').clearError(); }, buttons: [{ - text: '<?= /* @escapeNotVerified */ __('Save') ?>', + text: '<?= $block->escapeJs(__('Save')) ?>', 'class': 'action-save action-primary', click: function() { this.updateItemRate(); @@ -252,7 +250,7 @@ require([ type: 'POST', data: itemRateData, dataType: 'json', - url: '<?= /* @escapeNotVerified */ $block->getTaxRateSaveUrl() ?>', + url: '<?= $block->escapeUrl($block->getTaxRateSaveUrl()) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -277,14 +275,14 @@ require([ }); else alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>' + content: '<?= $block->escapeJs(__('An error occurred')) ?>' }); } }; diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml index c0d185c36b0d6..6e526d06cbc1e 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml @@ -10,8 +10,7 @@ <div class="grid-loader"></div> </div> -<div class="form-inline" id="<?= /* @escapeNotVerified */ $block->getNameInLayout() ?>" style="display:none"> +<div class="form-inline" id="<?= $block->escapeHtml($block->getNameInLayout()) ?>" style="display:none"> <?= $block->getFormHtml() ?> <?= $block->getChildHtml('form_after') ?> </div> - diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml deleted file mode 100644 index ed7e543989e78..0000000000000 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> - <button type="button" onclick="window.location.href='<?= /* @escapeNotVerified */ $createUrl ?>'"> - <?= /* @escapeNotVerified */ __('Add New Class') ?> - </button> -</div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml deleted file mode 100644 index e0255d52e4dc3..0000000000000 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml +++ /dev/null @@ -1,24 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -// @codingStandardsIgnoreFile - -?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> - <?= $block->getBackButtonHtml() ?> - <?= $block->getResetButtonHtml() ?> - <?= $block->getSaveButtonHtml() ?> -</div> -<?php if ($form): ?> -<?= $form->toHtml() ?> -<script> -require(['jquery', "mage/mage"], function(jQuery){ - - jQuery('#<?= /* @escapeNotVerified */ $form->getForm()->getId() ?>').mage('form').mage('validation'); - -}); -</script> -<?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/add.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/add.phtml index 902c6932f0ae1..c0928f4723b50 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/add.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/add.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml('grid') ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml index 3128b82b69e60..eb446ecb092ac 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($form): ?> <?= $form->toHtml() ?> @@ -16,7 +13,7 @@ require([ "mage/mage" ], function($){ - $('#<?= /* @escapeNotVerified */ $form->getForm()->getId() ?>').mage('form').mage('validation'); + $('#<?= $block->escapeHtml($form->getForm()->getId()) ?>').mage('form').mage('validation'); $(document).ready(function () { 'use strict'; diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml deleted file mode 100644 index b3d8a01e1eff1..0000000000000 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> - <button type="button" onclick="window.location.href='<?= /* @escapeNotVerified */ $createUrl ?>'"> - <?= /* @escapeNotVerified */ __('Add New Tax Rule') ?> - </button> -</div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml deleted file mode 100644 index 10c0e796ea4f1..0000000000000 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -// @codingStandardsIgnoreFile - -?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> - <?= $block->getBackButtonHtml() ?> - <?= $block->getResetButtonHtml() ?> - <?= $block->getSaveButtonHtml() ?> - <?= $block->getDeleteButtonHtml() ?> -</div> -<?php if ($form): ?> -<?= $form->toHtml() ?> -<script> -require(['jquery', "mage/mage"], function(jQuery){ - - jQuery('#<?= /* @escapeNotVerified */ $form->getForm()->getId() ?>').mage('form').mage('validation'); - -}); -</script> -<?php endif; ?> diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml index c6d3d51ff22a8..775c35d6a0d4a 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml @@ -3,18 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?> <?php if ($block->displayBothPrices()): ?> - <span id="<?= /* @escapeNotVerified */ $block->buildIdWithPrefix('price-excluding-tax-') ?>" + <span id="<?= /* @noEscape */ $block->buildIdWithPrefix('price-excluding-tax-') ?>" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>" - data-price-amount="<?= /* @escapeNotVerified */ $block->getRawAmount() ?>" + data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>" data-price-type="basePrice" class="price-wrapper price-excluding-tax"> - <span class="price"><?= /* @escapeNotVerified */ $block->getDisplayAmountExclTax() ?></span></span> + <span class="price"><?= /* @noEscape */ $block->getDisplayAmountExclTax() ?></span></span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml index 999af81186fae..72f0bcd297d84 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml @@ -3,19 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?> <?php if ($block->displayPriceIncludingTax()): ?> - <?= /* @escapeNotVerified */ $block->getDisplayAmount() ?> + <?= /* @noEscape */ $block->getDisplayAmount() ?> <?php elseif ($block->displayPriceExcludingTax()): ?> - <?= /* @escapeNotVerified */ $block->getDisplayAmountExclTax() ?> + <?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> <?php elseif ($block->displayBothPrices()): ?> - <?= /* @escapeNotVerified */ $block->getDisplayAmount() ?> + <?= /* @noEscape */ $block->getDisplayAmount() ?> <?php if ($block->getDisplayAmountExclTax() !== $block->getDisplayAmount()): ?> - (+<?= /* @escapeNotVerified */ $block->getDisplayAmountExclTax() ?> Excl. Tax) + (+<?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> <?= $block->escapeHtml(__('Excl. Tax'))?>) <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index 9395bd47ca3e7..dfa829aac7119 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -4,19 +4,17 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Tax\Block\Item\Price\Renderer */ ?> <?php $_item = $block->getItem() ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <span class="price-wrapper price-including-tax" data-label="<?= /* @escapeNotVerified */ __('Incl. Tax') ?>"> + <span class="price-wrapper price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> </span> <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-wrapper price-excluding-tax" data-label="<?= /* @escapeNotVerified */ __('Excl. Tax') ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + <span class="price-wrapper price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml index 5bcbde0e24c4e..967b6c33d537f 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml @@ -4,37 +4,35 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\Tax\Block\Checkout\Grandtotal */ ?> <?php if ($block->includeTax() && $block->getTotalExclTax() >= 0):?> <tr class="grand totals excl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <strong><?= /* @escapeNotVerified */ __('Grand Total Excl. Tax') ?></strong> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <strong><?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?></strong> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?>"> - <strong><?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotalExclTax()) ?></strong> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?>"> + <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotalExclTax()) ?></strong> </td> </tr> -<?= /* @escapeNotVerified */ $block->renderTotals('taxes', $block->getColspan()) ?> +<?= /* @noEscape */ $block->renderTotals('taxes', $block->getColspan()) ?> <tr class="grand totals incl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <strong><?= /* @escapeNotVerified */ __('Grand Total Incl. Tax') ?></strong> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <strong><?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?></strong> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?>"> - <strong><?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?>"> + <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> <?php else:?> <tr class="grand totals"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <strong><?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?></strong> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <strong><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></strong> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <strong><?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml index 203dd72041296..c0321543b001f 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\Tax\Block\Checkout\Shipping * @see \Magento\Tax\Block\Checkout\Shipping @@ -14,37 +12,37 @@ <?php if ($block->displayShipping()):?> <?php if ($block->displayBoth()):?> <tr class="totals shipping excl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ $block->getExcludeTaxLabel() ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml($block->getExcludeTaxLabel()) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getExcludeTaxLabel()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getExcludeTaxLabel()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <tr class="totals shipping incl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ $block->getIncludeTaxLabel() ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml($block->getIncludeTaxLabel()) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getIncludeTaxLabel()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getIncludeTaxLabel()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php elseif ($block->displayIncludeTax()) : ?> <tr class="totals shipping incl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php else:?> <tr class="totals shipping excl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml index 2aedc85221344..5b1be558d4206 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml @@ -3,25 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Tax\Block\Checkout\Shipping\Price */ ?> <?php $_excl = $block->getShippingPriceExclTax(); ?> <?php $_incl = $block->getShippingPriceInclTax(); ?> <?php if ($block->displayShippingPriceExclTax()): ?> - <span class="price"><?= /* @escapeNotVerified */ $_excl ?></span> + <span class="price"><?= /* @noEscape */ $_excl ?></span> <?php else: ?> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - <span class="price-including-tax" data-label="<?= /* @escapeNotVerified */ __('Incl. Tax') ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php endif; ?> - <span class="price"><?= /* @escapeNotVerified */ $_incl ?></span> + <span class="price"><?= /* @noEscape */ $_incl ?></span> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> </span> <?php endif; ?> <?php endif; ?> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - <span class="price-excluding-tax" data-label="<?= /* @escapeNotVerified */ __('Excl. Tax') ?>"><span class="price"><?= /* @escapeNotVerified */ $_excl ?></span></span> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"><span class="price"><?= /* @noEscape */ $_excl ?></span></span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml index d295ba7bc7bbc..b7d6729215f94 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\Tax\Block\Checkout\Subtotal * @see \Magento\Tax\Block\Checkout\Subtotal @@ -13,28 +11,28 @@ ?> <?php if ($block->displayBoth()):?> <tr class="totals sub excl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ __('Subtotal (Excl. Tax)') ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueExclTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueExclTax()) ?> </td> </tr> <tr class="totals sub incl"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ __('Subtotal (Incl. Tax)') ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueInclTax()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueInclTax()) ?> </td> </tr> <?php else : ?> <tr class="totals sub"> - <th style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> - <?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?> + <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?> + <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?> </td> </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml index 50fa6c425c223..7f9a9c71604c9 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\Tax\Block\Checkout\Tax * @see \Magento\Tax\Block\Checkout\Tax @@ -24,16 +22,16 @@ } ?> -<tr <?= /* @escapeNotVerified */ $attributes ?>> - <th style="<?= /* @escapeNotVerified */ $_style ?>" class="mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> +<tr <?= /* @noEscape */ $attributes ?>> + <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> - <span class="detailed"><?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?></span> + <span class="detailed"><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></span> <?php else: ?> - <?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?> + <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> <?php endif;?> </th> - <td style="<?= /* @escapeNotVerified */ $_style ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_value) ?> + <td style="<?= /* @noEscape */ $_style ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_value) ?> </td> </tr> @@ -48,17 +46,17 @@ <?php $isFirst = 1; ?> <?php foreach ($rates as $rate): ?> - <tr class="totals-tax-details details-<?= /* @escapeNotVerified */ $taxIter ?>"> - <th class="mark" style="<?= /* @escapeNotVerified */ $_style ?>" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" scope="row"> + <tr class="totals-tax-details details-<?= /* @noEscape */ $taxIter ?>"> + <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> <?= $block->escapeHtml($rate['title']) ?> <?php if (!is_null($rate['percent'])): ?> (<?= (float)$rate['percent'] ?>%) <?php endif; ?> </th> <?php if ($isFirst): ?> - <td style="<?= /* @escapeNotVerified */ $_style ?>" class="amount" rowspan="<?= count($rates) ?>" + <td style="<?= /* @noEscape */ $_style ?>" class="amount" rowspan="<?= count($rates) ?>" data-th="<?= $block->escapeHtml($rate['title']) ?><?php if (!is_null($rate['percent'])): ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($amount) ?> + <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($amount) ?> </td> <?php endif; ?> </tr> diff --git a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml index bd6841268d509..88088ed5b503d 100644 --- a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Tax\Block\Item\Price\Renderer $block */ @@ -17,16 +14,16 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $_order->formatPrice($_item->getRowTotal()) ?> + <?= /* @noEscape */ $_order->formatPrice($_item->getRowTotal()) ?> <?php endif; ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?= /* @escapeNotVerified */ $_order->formatPrice($_incl) ?> + <?= /* @noEscape */ $_order->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml index 856909cbb4240..a667e3b48bfae 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Tax\Block\Item\Price\Renderer */ $_item = $block->getItem(); @@ -13,7 +11,7 @@ $_item = $block->getItem(); <?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <span class="cart-price"> - <?= /* @escapeNotVerified */ $block->formatPrice($_item->getRowTotalInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($_item->getRowTotalInclTax()) ?> </span> </span> <?php endif; ?> @@ -21,7 +19,7 @@ $_item = $block->getItem(); <?php if (($block->displayPriceExclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <span class="cart-price"> - <?= /* @escapeNotVerified */ $block->formatPrice($_item->getRowTotal()) ?> + <?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/total_after_discount.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/total_after_discount.phtml index f0066d9024139..3356c2514c20f 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/total_after_discount.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/total_after_discount.phtml @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Tax\Block\Item\Price\Renderer $block */ $_item = $block->getItem(); ?> <?php $_order = $block->getItem()->getOrderItem()->getOrder() ?> -<?= /* @escapeNotVerified */ $_order->formatPrice($block->getTotalAmount($_item)) ?> +<?= /* @noEscape */ $_order->formatPrice($block->getTotalAmount($_item)) ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml index 5fd1fed49c33c..9b6aedab15267 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Tax\Block\Item\Price\Renderer */ $_item = $block->getItem(); @@ -15,7 +13,7 @@ $_item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> <span class="cart-price"> - <?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?> + <?= /* @noEscape */ $block->formatPrice($_incl) ?> </span> </span> <?php endif; ?> @@ -23,7 +21,7 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <span class="cart-price"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getItemDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getItemDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml index b329f00973b5a..e1965905556ab 100644 --- a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_order = $block->getOrder(); @@ -22,16 +19,16 @@ $baseAmount = $info['base_tax_amount']; $title = $info['title']; ?> - <tr class="totals tax details details-<?= /* @escapeNotVerified */ $taxIter ?> <?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> - <td <?= /* @escapeNotVerified */ $block->getLabelProperties() ?>> + <tr class="totals tax details details-<?= /* @noEscape */ $taxIter ?> <?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> + <td <?= /* @noEscape */ $block->getLabelProperties() ?>> <?= $block->escapeHtml($title) ?> <?php if (!is_null($percent)): ?> (<?= (float)$percent ?>%) <?php endif; ?> <br /> </td> - <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?> rowspan="1"> - <?= /* @escapeNotVerified */ $_order->formatPrice($amount) ?> + <td <?= /* @noEscape */ $block->getValueProperties() ?> rowspan="1"> + <?= /* @noEscape */ $_order->formatPrice($amount) ?> </td> </tr> <?php endforeach; ?> @@ -44,14 +41,14 @@ <?php else: ?> <tr class="totals-tax"> <?php endif; ?> - <th <?= /* @escapeNotVerified */ $block->getLabelProperties() ?> scope="row"> + <th <?= /* @noEscape */ $block->getLabelProperties() ?> scope="row"> <?php if ($block->displayFullSummary()): ?> - <div class="detailed"><?= /* @escapeNotVerified */ __('Tax') ?></div> + <div class="detailed"><?= $block->escapeHtml(__('Tax')) ?></div> <?php else: ?> - <?= /* @escapeNotVerified */ __('Tax') ?> + <?= $block->escapeHtml(__('Tax')) ?> <?php endif;?> </th> - <td <?= /* @escapeNotVerified */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtml(__('Tax')) ?>"> - <?= /* @escapeNotVerified */ $_order->formatPrice($_source->getTaxAmount()) ?> + <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtml(__('Tax')) ?>"> + <?= /* @noEscape */ $_order->formatPrice($_source->getTaxAmount()) ?> </td> </tr> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml b/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml index ea35eff438c0d..6e968a47306c8 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Adminhtml\Items\Price\Renderer $block */ @@ -19,7 +16,7 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> <div class="price-excl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getRowPriceExclTaxHtml() ?> @@ -28,14 +25,14 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->displayPrices($tax['base_row_amount'], $tax['row_amount']) ?></span> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_row_amount'], $tax['row_amount']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalRowPriceExclTaxHtml() ?> </span> <?php endif; ?> @@ -45,7 +42,7 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> <div class="price-incl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getRowPriceInclTaxHtml() ?> @@ -54,14 +51,14 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']) ?></span> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalRowPriceInclTaxHtml() ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/items/price/total.phtml b/app/code/Magento/Weee/view/adminhtml/templates/items/price/total.phtml index fa55009fb5b6f..b0f29e2f03def 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/items/price/total.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/items/price/total.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Adminhtml\Items\Price\Renderer $block */ @@ -13,4 +10,4 @@ $_item = $block->getItem(); ?> -<?= /* @escapeNotVerified */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?> +<?= /* @noEscape */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml b/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml index 13eca4afd2e8e..7802028860502 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Adminhtml\Items\Price\Renderer $block */ @@ -19,7 +16,7 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> <div class="price-excl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getUnitPriceExclTaxHtml() ?> @@ -29,14 +26,14 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->displayPrices($tax['base_amount'], $tax['amount']) ?></span> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_amount'], $tax['amount']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalUnitPriceExclTaxHtml() ?> </span> <?php endif; ?> @@ -46,7 +43,7 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> <div class="price-incl-tax"> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getUnitPriceInclTaxHtml() ?> @@ -55,14 +52,14 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']) ?></span> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalUnitPriceInclTaxHtml() ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml index d9bd79e65a153..f3222ae68e79d 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ @@ -15,9 +12,9 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> @@ -25,15 +22,15 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> <?php endif; ?> <?php endif; ?> @@ -41,22 +38,22 @@ $_item = $block->getItem(); <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml index bda7b807c6094..c3c8547510ee7 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ @@ -17,9 +14,9 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php $_rowTotalWithoutDiscount = $block->getRowDisplayPriceExclTax() - $_item->getTotalDiscountAmount(); ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> + <?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> @@ -27,15 +24,15 @@ $_item = $block->getItem(); <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax() - $_item->getTotalDiscountAmount()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax() - $_item->getTotalDiscountAmount()) ?> </span> <?php endif; ?> <?php endif; ?> @@ -44,23 +41,23 @@ $_item = $block->getItem(); <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $block->getTotalAmount($_item); ?> - <?= /* @escapeNotVerified */ $block->formatPrice(max(0, $_incl)) ?> + <?= /* @noEscape */ $block->formatPrice(max(0, $_incl)) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax() - $_item->getTotalDiscountAmount()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax() - $_item->getTotalDiscountAmount()) ?> </span> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml index d56e0fc3ebb3f..6b0cc43af95f5 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ @@ -15,24 +12,24 @@ $_item = $block->getItem(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> <?php endif; ?> <?php endif; ?> @@ -41,23 +38,23 @@ $_item = $block->getItem(); <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>:<br /> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> + <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index 01ecaca435d15..f3b02fba936a3 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Weee\Block\Renderer\Weee\Tax */ @@ -20,16 +17,16 @@ $data = ['fptAttribute' => [ <div id="attribute-<?= $block->getElement()->getHtmlId() ?>-container" class="field" data-attribute-code="<?= $block->getElement()->getHtmlId() ?>" data-mage-init="<?= $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data)) ?>"> - <label class="label"><span><?= /* @escapeNotVerified */ $block->getElement()->getLabel() ?></span></label> + <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> <div class="control"> <table class="data-table"> <thead> <tr> - <th class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none;"<?php endif; ?>><?= /* @escapeNotVerified */ __('Website') ?></th> - <th class="col-country required"><?= /* @escapeNotVerified */ __('Country/State') ?></th> - <th class="col-tax required"><?= /* @escapeNotVerified */ __('Tax') ?></th> - <th class="col-action"><?= /* @escapeNotVerified */ __('Action') ?></th> + <th class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none;"<?php endif; ?>><?= $block->escapeHtml(__('Website')) ?></th> + <th class="col-country required"><?= $block->escapeHtml(__('Country/State')) ?></th> + <th class="col-tax required"><?= $block->escapeHtml(__('Tax')) ?></th> + <th class="col-action"><?= $block->escapeHtml(__('Action')) ?></th> </tr> </thead> <tfoot> @@ -44,41 +41,41 @@ $data = ['fptAttribute' => [ Hidden field below with attribute code id is necessary for jQuery validation plugin. Validation message will be displayed after this field. --> - <input type="hidden" name="<?= $block->getElement()->getHtmlId() ?>" id="<?= $block->getElement()->getHtmlId() ?>" disabled="disabled"> + <input type="hidden" name="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>" id="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>" disabled="disabled"> </div> <script data-role="row-template" type="text/x-magento-template"> <tr id="<?= $block->getElement()->getHtmlId() ?>_weee_tax_row_<%- data.index %>" data-role="fpt-item-row"> <td class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> - <select id="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_website" - name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][website_id]" - class="<?= /* @escapeNotVerified */ $block->getElement()->getClass() ?> website required-entry" data-role="select-website"> + <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_website" + name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][website_id]" + class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> website required-entry" data-role="select-website"> <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> - <option value="<?= /* @escapeNotVerified */ $_websiteId ?>"><?= /* @escapeNotVerified */ $_info['name'] ?><?php if (!empty($_info['currency'])): ?>[<?= /* @escapeNotVerified */ $_info['currency'] ?>]<?php endif; ?></option> + <option value="<?= /* @noEscape */ $_websiteId ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])): ?>[<?= /* @noEscape */ $_info['currency'] ?>]<?php endif; ?></option> <?php endforeach ?> </select> </td> <td class="col-country"> - <select id="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_country" - name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][country]" - class="<?= /* @escapeNotVerified */ $block->getElement()->getClass() ?> country required-entry" data-role="select-country"> + <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_country" + name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][country]" + class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> country required-entry" data-role="select-country"> <?php foreach ($block->getCountries() as $_country): ?> - <option value="<?= /* @escapeNotVerified */ $_country['value'] ?>"><?= /* @escapeNotVerified */ htmlspecialchars($_country['label']) ?></option> + <option value="<?= $block->escapeHtml($_country['value']) ?>"><?= $block->escapeHtml($_country['label']) ?></option> <?php endforeach ?> </select> - <select id="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_state" - name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][state]" - class="<?= /* @escapeNotVerified */ $block->getElement()->getClass() ?> state" disabled="" data-role="select-state"> + <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_state" + name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][state]" + class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> state" disabled="" data-role="select-state"> <option value="0">*</option> </select> </td> <td class="col-tax"> - <input name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][price]" - class="<?= /* @escapeNotVerified */ $block->getElement()->getClass() ?> required-entry validate-greater-than-zero" + <input name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][price]" + class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> required-entry validate-greater-than-zero" type="text" value="<%- data.value %>"/> </td> <td class="col-action"> - <input name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[<%- data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> + <input name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> <?= $block->getChildHtml('delete_button') ?> </td> </tr> diff --git a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml index c05d48cab6a43..5e0510bbcfd16 100644 --- a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -23,22 +20,22 @@ $priceDisplay = $block->isPriceIncludesTax(); <?php if ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX): ?> <span class="weee" data-price-type="weee" - data-label="<?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeName($weeeTaxAttribute) ?>"> - <?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> + data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute)) ?>"> + <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX): ?> <span class="weee" data-price-type="weee" - data-label="<?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeName($weeeTaxAttribute) ?>"> - <?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> + data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute)) ?>"> + <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH): ?> <span class="weee" data-price-type="weee" - data-label="<?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' Incl. Tax' ?>"> - <?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> + data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' ' . __('Incl. Tax')) ?>"> + <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> <span class="weee" data-price-type="weee" - data-label="<?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' Excl. Tax' ?>"> - <?= /* @escapeNotVerified */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> + data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' ' . __('Excl. Tax')) ?>"> + <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> <?php endif; ?> <?php endforeach; ?> <?php endif; ?> @@ -46,6 +43,6 @@ $priceDisplay = $block->isPriceIncludesTax(); <?php if ($block->showExclDescrIncl()): // excl. + weee + final ?> <span class="price-final price-final_price" data-price-type="weeePrice" - data-price-amount="<?= /* @escapeNotVerified */ $block->getRawFinalAmount() ?>" - data-label="<?= /* @escapeNotVerified */ __('Final Price') ?>"><?= /* @escapeNotVerified */ $block->getFinalAmount() ?></span> + data-price-amount="<?= /* @noEscape */ $block->getRawFinalAmount() ?>" + data-label="<?= $block->escapeHtml(__('Final Price')) ?>"><?= /* @noEscape */ $block->getFinalAmount() ?></span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index 9c7a77c54a373..2204add57b4c8 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); @@ -22,15 +20,15 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php else: ?> <span class="minicart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <span class="minicart-tax-info"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </span> @@ -38,7 +36,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($block->displayFinalPrice()): ?> <span class="minicart-tax-total"> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> <?php endif; ?> @@ -54,15 +52,15 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php else: ?> <span class="minicart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <span class="minicart-tax-info"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> </span> @@ -70,7 +68,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($block->displayFinalPrice()): ?> <span class="minicart-tax-total"> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml index bc63a5eff642b..6761c332ea960 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -4,33 +4,31 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> -<?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> +<?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"><?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> - <span class="weee" data-label="<?= /* @escapeNotVerified */ __('Total') ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml index a85904e197bfb..f8d72e6eab6df 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); @@ -14,26 +12,26 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <?php $_incl = $_item->getRowTotalInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> -<?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> +<?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="subtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"><?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> - <span class="weee" data-label="<?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml index dc1d22ff3b0dd..a243609d796f7 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -4,34 +4,32 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> -<?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> +<?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>" style="display:none;"> + <span class="cart-tax-info" id="eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display:none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"><?= /* @escapeNotVerified */ $block->formatPrice($tax['amount'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> - <span class="weee" data-label="<?= /* @escapeNotVerified */ __('Total') ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml index 3b7c2f530d3be..1f5fad501edc5 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); @@ -14,27 +12,27 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <?php $_incl = $_item->getPriceInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> -<?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> +<?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"><?= /* @escapeNotVerified */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $_item->getId() ?>"}}'> - <span class="weee" data-label="<?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml index bd0eefd9d2b98..0b3b4b7ca5c1d 100644 --- a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ @@ -20,23 +17,23 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $_order->formatPrice($tax['row_amount'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $_order->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total') ?>:<br /> <?= /* @escapeNotVerified */ $_order->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?></span> + <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= /* @noEscape */ $_order->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?></span> <?php endif; ?> <?php endif; ?> <?php endif; ?> @@ -44,21 +41,21 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span> + <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?= /* @escapeNotVerified */ $_order->formatPrice($block->getRowDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $_order->formatPrice($block->getRowDisplayPriceInclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?= /* @escapeNotVerified */ $tax['title'] ?>: <?= /* @escapeNotVerified */ $_order->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> + <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $_order->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> - <span class="nobr"><?= /* @escapeNotVerified */ __('Total Incl. Tax') ?>:<br /> <?= /* @escapeNotVerified */ $_order->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?></span> + <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> <?= /* @noEscape */ $_order->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?></span> <?php endif; ?> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml index dc128902ef4d2..f645e67ec62e5 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); @@ -14,27 +12,27 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <div class="cart-tax-info" id="subtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>" style="display: none;"> + <div class="cart-tax-info" id="subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </div> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> </span> <?php endif; ?> @@ -46,28 +44,28 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>" + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['row_amount'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?> </span> <?php endforeach; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/total_after_discount.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/total_after_discount.phtml index 03c050e0a0b04..46d16ad13ea6e 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/total_after_discount.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/total_after_discount.phtml @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ $_item = $block->getItem(); ?> <?php $_order = $block->getItem()->getOrderItem()->getOrder() ?> -<?= /* @escapeNotVerified */ $_order->formatPrice($block->getTotalAmount($_item)) ?> +<?= /* @noEscape */ $_order->formatPrice($block->getTotalAmount($_item)) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml index 575a0dd6c9aa8..5dc268c325074 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); @@ -14,27 +12,27 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> <?php endif; ?> @@ -46,28 +44,28 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>" + <span class="cart-tax-info" id="eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount'], true, true) ?> + <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> - <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> + <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> <?php endif; ?> From b091b925c07199f35ffa99eef44473407d558ecd Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Tue, 14 May 2019 12:57:57 -0500 Subject: [PATCH 101/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../view/adminhtml/templates/rate/title.phtml | 2 +- .../view/adminhtml/templates/rule/edit.phtml | 26 +++++++++---------- .../adminhtml/templates/renderer/tax.phtml | 2 +- .../review/item/price/row_excl_tax.phtml | 6 ++--- .../review/item/price/row_incl_tax.phtml | 6 ++--- .../review/item/price/unit_excl_tax.phtml | 6 ++--- .../review/item/price/unit_incl_tax.phtml | 6 ++--- .../frontend/templates/item/price/row.phtml | 12 ++++----- .../frontend/templates/item/price/unit.phtml | 12 ++++----- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml index e729a7ef3c2e3..347923dfff773 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml @@ -15,7 +15,7 @@ <input class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>" type="text" - name="title[<?= $block->escapeHtml($_store->getId()) ?>]" + name="title[<?= (int)$_store->getId() ?>]" value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>" /> </div> </div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml index a84361f7052cd..3edf5a7736c6e 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml @@ -76,7 +76,7 @@ require([ $.ajax({ type: "POST", data: {id:id}, - url: '<?= $block->escapeUrl($block->getTaxRateLoadUrl()) ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getTaxRateLoadUrl())) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -93,14 +93,14 @@ require([ }); else alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); }, dataType: "json" @@ -111,7 +111,7 @@ require([ var options = { mselectContainer: '#tax_rate + section.mselect-list', toggleAddButton:false, - addText: '<?= $block->escapeJs(__('Add New Tax Rate')) ?>', + addText: '<?= $block->escapeJs($block->escapeHtml(__('Add New Tax Rate'))) ?>', parse: null, nextPageUrl: '<?php echo $block->escapeHtml($block->getTaxRatesPageUrl())?>', selectedValues: this.settings.selected_values, @@ -176,7 +176,7 @@ require([ form_key: $('input[name="form_key"]').val() }, dataType: 'json', - url: '<?= $block->escapeUrl($block->getTaxRateDeleteUrl()) ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getTaxRateDeleteUrl())) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -194,14 +194,14 @@ require([ }); else alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); } }; @@ -222,15 +222,15 @@ require([ taxRateFormElement.mage('form').mage('validation'); taxRateForm.dialogRates({ - title: '<?= $block->escapeJs(__('Tax Rate')) ?>', + title: '<?= $block->escapeJs($block->escapeHtml(__('Tax Rate'))) ?>', type: 'slide', - id: '<?= $block->escapeJs($block->getJsId()) ?>', + id: '<?= /* @noEscape */ $block->getJsId() ?>', modalClass: 'tax-rate-popup', closed: function () { taxRateFormElement.data('validation').clearError(); }, buttons: [{ - text: '<?= $block->escapeJs(__('Save')) ?>', + text: '<?= $block->escapeJs($block->escapeHtml(__('Save'))) ?>', 'class': 'action-save action-primary', click: function() { this.updateItemRate(); @@ -250,7 +250,7 @@ require([ type: 'POST', data: itemRateData, dataType: 'json', - url: '<?= $block->escapeUrl($block->getTaxRateSaveUrl()) ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getTaxRateSaveUrl())) ?>', success: function(result, status) { $('body').trigger('processStop'); if (result.success) { @@ -275,14 +275,14 @@ require([ }); else alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); } }, error: function () { $('body').trigger('processStop'); alert({ - content: '<?= $block->escapeJs(__('An error occurred')) ?>' + content: '<?= $block->escapeJs($block->escapeHtml(__('An error occurred'))) ?>' }); } }; diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index f3b02fba936a3..b834c99a3bce1 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -16,7 +16,7 @@ $data = ['fptAttribute' => [ ?> <div id="attribute-<?= $block->getElement()->getHtmlId() ?>-container" class="field" data-attribute-code="<?= $block->getElement()->getHtmlId() ?>" - data-mage-init="<?= $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data)) ?>"> + data-mage-init="<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data) ?>"> <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> <div class="control"> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml index 6761c332ea960..70066211b320e 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -9,7 +9,7 @@ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -17,7 +17,7 @@ $_item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> @@ -26,7 +26,7 @@ $_item = $block->getItem(); </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml index f8d72e6eab6df..8de3696092bf6 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -12,7 +12,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <?php $_incl = $_item->getRowTotalInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -20,7 +20,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> + <span class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> @@ -29,7 +29,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml index a243609d796f7..5aafda7e7d9b4 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -9,7 +9,7 @@ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -18,7 +18,7 @@ $_item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display:none;"> + <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$_item->getId() ?>" style="display:none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> @@ -27,7 +27,7 @@ $_item = $block->getItem(); </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml index 1f5fad501edc5..3b33066bc3c28 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -12,7 +12,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <?php $_incl = $_item->getPriceInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -21,7 +21,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> @@ -30,7 +30,7 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); </span> <?php if ($block->displayFinalPrice()): ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($_item->getId()) ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml index f645e67ec62e5..a3baea35e1211 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -12,7 +12,7 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -20,7 +20,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <div class="cart-tax-info" id="subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> + <div class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> @@ -30,7 +30,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> @@ -44,7 +44,7 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -52,7 +52,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> @@ -63,7 +63,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml index 5dc268c325074..9e61515783dd1 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -12,7 +12,7 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -20,7 +20,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> @@ -30,7 +30,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> @@ -44,7 +44,7 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> <?php else: ?> <span class="cart-price"> <?php endif; ?> @@ -52,7 +52,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>" + <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> @@ -63,7 +63,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= $block->escapeHtml($item->getId()) ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> From 114fb6f4d40bb3dd6a08577a1c89f11e46c31c47 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Tue, 14 May 2019 15:02:13 -0500 Subject: [PATCH 102/464] MAGETWO-55101: Use escaper methods - refactored to use escaper methods --- .../templates/notification/window.phtml | 12 +- .../adminhtml/templates/system/messages.phtml | 26 ++-- .../templates/system/messages/popup.phtml | 13 +- .../adminhtml/templates/toolbar_entry.phtml | 36 +++--- .../Block/Page/System/Config/Robots/Reset.php | 9 ++ .../adminhtml/templates/backup/dialogs.phtml | 105 ++++++++++------ .../adminhtml/templates/backup/left.phtml | 2 +- .../page/system/config/robots/reset.phtml | 8 +- .../templates/system/config/edit.phtml | 16 +-- .../system/config/form/field/array.phtml | 112 ++++++++++-------- .../templates/system/config/js.phtml | 15 +-- .../templates/system/config/switcher.phtml | 40 ++++--- .../templates/system/config/tabs.phtml | 14 +-- .../view/adminhtml/templates/grid.phtml | 31 ++--- .../system/currency/rate/matrix.phtml | 23 ++-- .../system/currency/rate/services.phtml | 5 +- .../templates/system/currency/rates.phtml | 5 +- .../view/adminhtml/templates/grid.phtml | 61 +++++----- .../templates/report/grid/container.phtml | 3 +- .../adminhtml/templates/report/wishlist.phtml | 14 +-- .../adminhtml/templates/store/switcher.phtml | 18 ++- .../templates/store/switcher/enhanced.phtml | 16 +-- .../templates/product/widget/viewed.phtml | 8 +- .../product/widget/viewed/item.phtml | 39 +++--- .../column/compared_default_list.phtml | 39 +++--- .../column/compared_images_list.phtml | 12 +- .../compared/column/compared_names_list.phtml | 12 +- .../compared/content/compared_grid.phtml | 51 ++++---- .../compared/content/compared_list.phtml | 57 ++++----- .../viewed/column/viewed_default_list.phtml | 38 +++--- .../viewed/column/viewed_images_list.phtml | 10 +- .../viewed/column/viewed_names_list.phtml | 12 +- .../widget/viewed/content/viewed_grid.phtml | 50 ++++---- .../widget/viewed/content/viewed_list.phtml | 52 ++++---- 34 files changed, 477 insertions(+), 487 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml index 3f79e803ccca2..84d2a628e6207 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @see \Magento\AdminNotification\Block\Window */ @@ -19,11 +15,13 @@ "autoOpen": true, "buttons": false, "modalClass": "modal-system-messages", - "title": "<?= /* @escapeNotVerified */ $block->getHeaderText() ?>" + "title": "<?= $block->escapeHtml($block->getHeaderText()) ?>" } }'> <li class="message message-warning warning"> - <?= /* @escapeNotVerified */ $block->getNoticeMessageText() ?><br/> - <a href="<?= /* @escapeNotVerified */ $block->getNoticeMessageUrl() ?>"><?= /* @escapeNotVerified */ $block->getReadDetailsText() ?></a> + <?= $block->escapeHtml($block->getNoticeMessageText()) ?><br/> + <a href="<?= $block->escapeUrl($block->getNoticeMessageUrl()) ?>"> + <?= $block->escapeHtml($block->getReadDetailsText()) ?> + </a> </li> </ul> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml index 01d6fdcb29571..e77a5ff1cd057 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml @@ -4,41 +4,41 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\AdminNotification\Block\System\Messages */ ?> -<?php /** @var $block \Magento\AdminNotification\Block\System\Messages */ ?> <?php $lastCritical = $block->getLastCritical();?> -<div id="system_messages" class="message-system<?php if ($lastCritical): ?> message-system-unread<?php endif; ?>"> +<div id="system_messages" + class="message-system<?php if ($lastCritical) : ?> + message-system-unread<?php endif; ?>"> <div class="message-system-inner"> - <?php if ($lastCritical): ?> + <?php if ($lastCritical) : ?> <ul class="message-system-list"> <li class="message message-warning error"> - <?= /* @escapeNotVerified */ $lastCritical->getText() ?> + <?= $block->escapeHtml($lastCritical->getText()) ?> </li> </ul> <?php endif; ?> <div class="message-system-short"> <span class="message-system-short-label"> - <?= /* @escapeNotVerified */ __('System Messages:') ?> + <?= $block->escapeHtml(__('System Messages:')) ?> </span> - <?php if ($block->getCriticalCount()): ?> + <?php if ($block->getCriticalCount()) : ?> <div class="message message-warning error"> <a class="message-link" href="#" title="<?= $block->escapeHtml(__('Critical System Messages')) ?>"> - <?= /* @escapeNotVerified */ $block->getCriticalCount() ?> + <?= $block->escapeHtml($block->getCriticalCount()) ?> </a> </div> - <?php endif;?> + <?php endif; ?> - <?php if ($block->getMajorCount()): ?> + <?php if ($block->getMajorCount()) : ?> <div class="message message-warning warning"> <a class="message-link" href="#" title="<?= $block->escapeHtml(__('Major System Messages')) ?>"> - <?= /* @escapeNotVerified */ $block->getMajorCount() ?> + <?= $block->escapeHtml($block->getMajorCount()) ?> </a> </div> - <?php endif;?> + <?php endif; ?> </div> <div id="message-system-all" title="<?= $block->escapeHtml(__('System messages')) ?>" data-mage-init='<?= $block->escapeHtml($block->getSystemMessageDialogJson()) ?>'></div> </div> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index 0448daaf17644..56d4ef8812c32 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -4,16 +4,15 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup */ ?> -<?php /** @var $block \Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup */ ?> -<div style="display:none" id="system_messages_list" data-role="system_messages_list" title="<?= $block->escapeHtml($block->getPopupTitle()) ?>"> +<div style="display:none" id="system_messages_list" data-role="system_messages_list" + title="<?= $block->escapeHtml($block->getPopupTitle()) ?>"> <ul class="message-system-list messages"> - <?php foreach ($block->getUnreadMessages() as $message): ?> - <li class="message message-warning <?= /* @escapeNotVerified */ $block->getItemClass($message) ?>"> - <?= /* @escapeNotVerified */ $message->getText() ?> + <?php foreach ($block->getUnreadMessages() as $message) : ?> + <li class="message message-warning <?= $block->escapeHtml($block->getItemClass($message)) ?>"> + <?= $block->escapeHtml($message->getText()) ?> </li> <?php endforeach;?> </ul> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml index 777448cdd82b4..15d4c4c097d16 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml @@ -9,31 +9,31 @@ ?> <?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?> <?php - $notificationCount = $block->getUnreadNotificationCount(); - $notificationCounterMax = $block->getNotificationCounterMax(); + $notificationCount = $block->escapeHtml($block->getUnreadNotificationCount()); + $notificationCounterMax = $block->escapeHtml($block->getNotificationCounterMax()); ?> <div data-mage-init='{"toolbarEntry": {}}' class="notifications-wrapper admin__action-dropdown-wrap" - data-notification-count="<?= /* @escapeNotVerified */ $notificationCount ?>"> + data-notification-count="<?= $notificationCount ?>"> <?php if ($notificationCount > 0) : ?> <a - href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>" + href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" class="notifications-action admin__action-dropdown" data-mage-init='{"dropdown":{}}' - title="<?= /* @escapeNotVerified */ __('Notifications') ?>" + title="<?= $block->escapeHtml(__('Notifications')) ?>" data-toggle="dropdown"> <span class="notifications-counter"> - <?= /* @escapeNotVerified */ ($notificationCount > $notificationCounterMax) ? $notificationCounterMax . '+' : $notificationCount ?> + <?= ($notificationCount > $notificationCounterMax) ? $notificationCounterMax . '+' : $notificationCount ?> </span> </a> <ul class="admin__action-dropdown-menu" - data-mark-as-read-url="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/ajaxMarkAsRead') ?>"> + data-mark-as-read-url="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/ajaxMarkAsRead')) ?>"> <?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?> - <?php /** @var $notification \Magento\AdminNotification\Model\Inbox*/ ?> + <?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?> <li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>" - data-notification-id="<?= /* @escapeNotVerified */ $notification->getId() ?>" + data-notification-id="<?= $block->escapeHtml($notification->getId()) ?>" data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>"> <?php $notificationDescription = $block->escapeHtml($notification->getDescription()); @@ -45,40 +45,40 @@ <?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?> <p class="notifications-entry-description _cutted"> <span class="notifications-entry-description-start"> - <?= /* @escapeNotVerified */ substr($notificationDescription, 0, $notificationDescriptionLength) ?> + <?= substr($notificationDescription, 0, $notificationDescriptionLength) ?> </span> <span class="notifications-entry-description-end"> - <?= /* @escapeNotVerified */ substr($notificationDescription, $notificationDescriptionLength) ?> + <?= substr($notificationDescription, $notificationDescriptionLength) ?> </span> </p> <?php else : ?> <p class="notifications-entry-description"> - <?= /* @escapeNotVerified */ $notificationDescription ?> + <?= $notificationDescription ?> </p> <?php endif; ?> <time class="notifications-entry-time"> - <?= /* @escapeNotVerified */ $block->formatNotificationDate($notification->getDateAdded()) ?> + <?= $block->formatNotificationDate($notification->getDateAdded()) ?> </time> <button type="button" class="notifications-close" - title="<?= /* @escapeNotVerified */ __('Close') ?>" + title="<?= $block->escapeHtml(__('Close')) ?>" ></button> </li> <?php endforeach; ?> <li class="notifications-entry notifications-entry-last"> <a - href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>" + href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" class="action-tertiary action-more"> - <?= /* @escapeNotVerified */ __('See All (') ?><span class="notifications-counter"><?= /* @escapeNotVerified */ $notificationCount ?></span><?= /* @escapeNotVerified */ __(' unread)') ?> + <?= $block->escapeHtml(__('See All (')) ?><span class="notifications-counter"><?= $notificationCount ?></span><?= $block->escapeHtml(__(' unread)')) ?> </a> </li> </ul> <?php else : ?> <a class="notifications-action admin__action-dropdown" - href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/notification/index') ?>" - title="<?= /* @escapeNotVerified */ __('Notifications') ?>"> + href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" + title="<?= $block->escapeHtml(__('Notifications')) ?>"> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php index 2abb987db0723..dc287cf2d959b 100644 --- a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php +++ b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php @@ -21,15 +21,24 @@ class Reset extends \Magento\Config\Block\System\Config\Form\Field */ const XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS = 'design/search_engine_robots/default_custom_instructions'; + /** + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $jsonSerializer; + /** * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, + \Magento\Framework\Serialize\Serializer\Json $jsonSerializer = null, array $data = [] ) { parent::__construct($context, $data); + $this->jsonSerializer = $jsonSerializer ?? \Magento\Framework\App\ObjectManager::getInstance() + ->create(\Magento\Framework\Serialize\Serializer\Json::class); } /** diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml index 304a60c60cad7..fab16aefd3a6d 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml @@ -3,14 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <!-- TODO: refactor form styles and js --> <script type="text/x-magento-template" id="rollback-warning-template"> -<p><?= /* @escapeNotVerified */ __('You will lose any data created since the backup was made, including admin users, customers and orders.') ?></p> -<p><?= /* @escapeNotVerified */ __('Are you sure you want to continue?') ?></p> +<p><?= $block->escapeHtml(__('You will lose any data created since the backup was made, including admin users, ' + . 'customers and orders.')) ?></p> +<p><?= $block->escapeHtml(__('Are you sure you want to continue?')) ?></p> </script> <script type="text/x-magento-template" id="backup-options-template"> <div class="backup-messages" style="display: none;"> @@ -18,39 +16,54 @@ </div> <div class="messages"> <div class="message message-warning"> - <?= /* @escapeNotVerified */ __('This may take a few moments.') ?> - <?= /* @escapeNotVerified */ __('Be sure your store is in maintenance mode during backup.') ?></div> + <?= $block->escapeHtml(__('This may take a few moments.')) ?> + <?= $block->escapeHtml(__('Be sure your store is in maintenance mode during backup.')) ?></div> </div> <form action="" method="post" id="backup-form" class="form-inline"> <fieldset class="admin__fieldset form-list question"> <div class="admin__field field _required"> - <label for="backup_name" class="admin__field-label"><span><?= /* @escapeNotVerified */ __('Backup Name') ?></span></label> + <label for="backup_name" class="admin__field-label"><span> + <?= $block->escapeHtml(__('Backup Name')) ?> + </span></label> <div class="admin__field-control"> <input type="text" name="backup_name" id="backup_name" - class="admin__control-text required-entry validate-alphanum-with-spaces validate-length maximum-length-50" + class="admin__control-text required-entry validate-alphanum-with-spaces + validate-length maximum-length-50" maxlength="50" /> <div class="admin__field-note"> - <?= /* @escapeNotVerified */ __('Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.') ?> + <?= $block->escapeHtml(__('Please use only letters (a-z or A-Z), numbers (0-9) or spaces ' + . 'in this field.')) ?> </div> </div> </div> <div class="admin__field field maintenance-checkbox-container"> - <label for="backup_maintenance_mode" class="admin__field-label"><span><?= /* @escapeNotVerified */ __('Maintenance mode') ?></span></label> + <label for="backup_maintenance_mode" class="admin__field-label"><span> + <?= $block->escapeHtml(__('Maintenance mode')) ?> + </span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" id="backup_maintenance_mode"/> - <label class="admin__field-label" for="backup_maintenance_mode"><?= /* @escapeNotVerified */ __('Please put your store into maintenance mode during backup.') ?></label> + <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" + value="1" id="backup_maintenance_mode"/> + <label class="admin__field-label" for="backup_maintenance_mode"> + <?= $block->escapeHtml(__('Please put your store into maintenance mode during backup.')) ?> + </label> </div> </div> </div> - <div class="admin__field field maintenance-checkbox-container" id="exclude-media-checkbox-container" style="display: none;"> - <label for="exclude_media" class="admin__field-label"><span><?= /* @escapeNotVerified */ __('Exclude') ?></span></label> + <div class="admin__field field maintenance-checkbox-container" id="exclude-media-checkbox-container" + style="display: none;"> + <label for="exclude_media" class="admin__field-label"><span> + <?= $block->escapeHtml(__('Exclude')) ?> + </span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="exclude_media" value="1" id="exclude_media"/> - <label class="admin__field-label" for="exclude_media"><?= /* @escapeNotVerified */ __('Exclude media folder from backup') ?></label> + <input class="admin__control-checkbox" type="checkbox" name="exclude_media" value="1" + id="exclude_media"/> + <label class="admin__field-label" for="exclude_media"> + <?= $block->escapeHtml(__('Exclude media folder from backup')) ?> + </label> </div> </div> </div> @@ -64,67 +77,89 @@ </div> <div class="messages"> <div class="message message-warning"> - <?= /* @escapeNotVerified */ __('Please enter the password to confirm rollback.') ?><br> - <?= /* @escapeNotVerified */ __('This action cannot be undone.') ?> - <p><?= /* @escapeNotVerified */ __('Are you sure you want to continue?') ?></p> + <?= $block->escapeHtml(__('Please enter the password to confirm rollback.')) ?><br> + <?= $block->escapeHtml(__('This action cannot be undone.')) ?> + <p><?= $block->escapeHtml(__('Are you sure you want to continue?')) ?></p> </div> </div> <form action="" method="post" id="rollback-form" class="form-inline"> <fieldset class="admin__fieldset password-box-container"> <div class="admin__field field _required"> - <label for="password" class="admin__field-label"><span><?= /* @escapeNotVerified */ __('User Password') ?></span></label> - <div class="admin__field-control"><input type="password" name="password" id="password" class="admin__control-text required-entry" autocomplete="new-password"></div> + <label for="password" class="admin__field-label"><span> + <?= $block->escapeHtml(__('User Password')) ?> + </span></label> + <div class="admin__field-control"> + <input type="password" name="password" id="password" class="admin__control-text required-entry" + autocomplete="new-password"> + </div> </div> <div class="admin__field field maintenance-checkbox-container"> - <label for="rollback_maintenance_mode" class="admin__field-label"><span><?= /* @escapeNotVerified */ __('Maintenance mode') ?></span></label> + <label for="rollback_maintenance_mode" class="admin__field-label"><span> + <?= $block->escapeHtml(__('Maintenance mode')) ?> + </span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" id="rollback_maintenance_mode"/> - <label class="admin__field-label" for="rollback_maintenance_mode"><?= /* @escapeNotVerified */ __('Please put your store into maintenance mode during rollback processing.') ?></label> + <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" + id="rollback_maintenance_mode"/> + <label class="admin__field-label" for="rollback_maintenance_mode"> + <?= $block->escapeHtml(__('Please put your store into maintenance mode during rollback ' + . 'processing.')) ?> + </label> </div> </div> </div> - <div class="admin__field field maintenance-checkbox-container" id="use-ftp-checkbox-row" style="display: none;"> + <div class="admin__field field maintenance-checkbox-container" id="use-ftp-checkbox-row" + style="display: none;"> <label for="use_ftp" class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('FTP') ?></span> + <span><?= $block->escapeHtml(__('FTP')) ?></span> </label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="use_ftp" value="1" id="use_ftp" onclick="backup.toggleFtpCredentialsForm(event)"/> - <label class="admin__field-label" for="use_ftp"><?= /* @escapeNotVerified */ __('Use FTP Connection') ?></label> + <input class="admin__control-checkbox" type="checkbox" name="use_ftp" value="1" id="use_ftp" + onclick="backup.toggleFtpCredentialsForm(event)"/> + <label class="admin__field-label" for="use_ftp"> + <?= $block->escapeHtml(__('Use FTP Connection')) ?> + </label> </div> </div> </div> </fieldset> <div class="entry-edit" id="ftp-credentials-container" style="display: none;"> <fieldset class="admin__fieldset"> - <legend class="admin__legend legend"><span><?= /* @escapeNotVerified */ __('FTP credentials') ?></span></legend><br /> + <legend class="admin__legend legend"><span> + <?= $block->escapeHtml(__('FTP credentials')) ?> + </span></legend><br /> <div class="admin__field field _required"> - <label class="admin__field-label" for="ftp_host"><span><?= /* @escapeNotVerified */ __('FTP Host') ?></span></label> + <label class="admin__field-label" for="ftp_host"><span> + ?= $block->escapeHtml(__('FTP Host')) ?> + </span></label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_host" id="ftp_host"> </div> </div> <div class="admin__field field _required"> - <label class="admin__field-label" for="ftp_user"><span><?= /* @escapeNotVerified */ __('FTP Login') ?></span></label> + <label class="admin__field-label" for="ftp_user"><span> + <?= $block->escapeHtml(__('FTP Login')) ?> + </span></label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_user" id="ftp_user"> </div> </div> <div class="admin__field field _required"> <label class="admin__field-label" for="ftp_pass"> - <span><?= /* @escapeNotVerified */ __('FTP Password') ?></span> + <span><?= $block->escapeHtml(__('FTP Password')) ?></span> </label> <div class="admin__field-control"> - <input type="password" class="admin__control-text" name="ftp_pass" id="ftp_pass" autocomplete="new-password"> + <input type="password" class="admin__control-text" name="ftp_pass" id="ftp_pass" + autocomplete="new-password"> </div> </div> <div class="admin__field field"> <label class="admin__field-label" for="ftp_path"> - <span><?= /* @escapeNotVerified */ __('Magento root directory') ?></span> + <span><?= $block->escapeHtml(__('Magento root directory')) ?></span> </label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_path" id="ftp_path"> diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/left.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/left.phtml index 1196f7e443820..cecff38611bfd 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/left.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/left.phtml @@ -4,4 +4,4 @@ * See COPYING.txt for license details. */ ?> -<h3><?= /* @escapeNotVerified */ __('Create Backup') ?></h3> +<h3><?= $block->escapeHtml(__('Create Backup')) ?></h3> diff --git a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml index e8082dae94d98..2145eec660ba2 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml @@ -4,14 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @deprecated * @var $block \Magento\Backend\Block\Page\System\Config\Robots\Reset - * @var $jsonHelper \Magento\Framework\Json\Helper\Data */ -$jsonHelper = $this->helper('Magento\Framework\Json\Helper\Data'); ?> <script> @@ -19,8 +15,8 @@ $jsonHelper = $this->helper('Magento\Framework\Json\Helper\Data'); 'jquery' ], function ($) { window.resetRobotsToDefault = function(){ - $('#design_search_engine_robots_custom_instructions').val(<?php - /* @escapeNotVerified */ echo $jsonHelper->jsonEncode($block->getRobotsDefaultCustomInstructions()) + $('#design_search_engine_robots_custom_instructions').val(<?= + /* @noEscape */ $block-getViewModel()->serialize($block->getRobotsDefaultCustomInstructions()) ?>); } }); diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml index a1e26b7805d4b..b452fcd414cd3 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -22,7 +19,8 @@ background-color: #DFF7FF!important; } </style> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" id="config-edit-form" enctype="multipart/form-data"> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" id="config-edit-form" + enctype="multipart/form-data"> <?= $block->getBlockHtml('formkey') ?> <div class="accordion"> <?= $block->getChildHtml('form') ?> @@ -159,7 +157,9 @@ require([ var elId = $el.id; $el.replace($el.outerHTML); events.each(function(event) { - Event.observe(Element.extend(document.getElementById(elId)), event.eventName, event.handler); + Event.observe( + Element.extend(document.getElementById(elId)), event.eventName, event.handler + ); }); } else { el.stopObserving('change', adminSystemConfig.onchangeSharedElement); @@ -296,7 +296,9 @@ require([ if (!scopeElement || !scopeElement.checked) { eventObj.element.enable(); eventObj.requires.each(function(required) { - adminSystemConfig.checkRequired.call(Element.extend(required), eventObj.element, eventObj.callback); + adminSystemConfig.checkRequired.call( + Element.extend(required), eventObj.element, eventObj.callback + ); }.bind(this)); } }, @@ -383,6 +385,6 @@ require([ registry.set('adminSystemConfig', adminSystemConfig); - adminSystemConfig.navigateToElement(<?php echo /* @noEscape */ $block->getConfigSearchParamsJson(); ?>); + adminSystemConfig.navigateToElement(<?= /* @noEscape */ $block->getConfigSearchParamsJson(); ?>); }); </script> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index cf235d368b9bc..b0e983e7c8003 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -13,30 +10,31 @@ $_htmlId = $block->getHtmlId() ? $block->getHtmlId() : '_' . uniqid(); $_colspan = $block->isAddAfter() ? 2 : 1; ?> -<div class="design_theme_ua_regexp" id="grid<?= /* @escapeNotVerified */ $_htmlId ?>"> +<div class="design_theme_ua_regexp" id="grid<?= $block->escapeHtml($_htmlId) ?>"> <div class="admin__control-table-wrapper"> - <table class="admin__control-table" id="<?= /* @escapeNotVerified */ $block->getElement()->getId() ?>"> + <table class="admin__control-table" id="<?= $block->escapeHtml($block->getElement()->getId()) ?>"> <thead> <tr> - <?php foreach ($block->getColumns() as $columnName => $column): ?> - <th><?= /* @escapeNotVerified */ $column['label'] ?></th> - <?php endforeach;?> - <th class="col-actions" colspan="<?= /* @escapeNotVerified */ $_colspan ?>"><?= /* @escapeNotVerified */ __('Action') ?></th> + <?php foreach ($block->getColumns() as $columnName => $column) : ?> + <th><?= $block->escapeHtml($column['label']) ?></th> + <?php endforeach; ?> + <th class="col-actions" colspan="<?= $block->escapeHtml($_colspan) ?>"><?= $block->escapeHtml(__('Action')) ?></th> </tr> </thead> <tfoot> <tr> <td colspan="<?= count($block->getColumns())+$_colspan ?>" class="col-actions-add"> - <button id="addToEndBtn<?= /* @escapeNotVerified */ $_htmlId ?>" class="action-add" title="<?= /* @escapeNotVerified */ __('Add') ?>" type="button"> - <span><?= /* @escapeNotVerified */ $block->getAddButtonLabel() ?></span> + <button id="addToEndBtn<?= $block->escapeHtml($_htmlId) ?>" class="action-add" + title="<?= $block->escapeHtml(__('Add')) ?>" type="button"> + <span><?= $block->escapeHtml($block->getAddButtonLabel()) ?></span> </button> </td> </tr> </tfoot> - <tbody id="addRow<?= /* @escapeNotVerified */ $_htmlId ?>"></tbody> + <tbody id="addRow<?= $block->escapeHtml($_htmlId) ?>"></tbody> </table> </div> - <input type="hidden" name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>[__empty]" value="" /> + <input type="hidden" name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[__empty]" value="" /> <script> require([ @@ -44,23 +42,28 @@ $_colspan = $block->isAddAfter() ? 2 : 1; 'prototype' ], function (mageTemplate) { // create row creator - window.arrayRow<?= /* @escapeNotVerified */ $_htmlId ?> = { + window.arrayRow<?= $block->escapeHtml($_htmlId) ?> = { // define row prototypeJS template template: mageTemplate( '<tr id="<%- _id %>">' - <?php foreach ($block->getColumns() as $columnName => $column): ?> - + '<td>' - + '<?= /* @escapeNotVerified */ $block->renderCellTemplate($columnName) ?>' - + '<\/td>' - <?php endforeach; ?> - - <?php if ($block->isAddAfter()): ?> - + '<td><button class="action-add" type="button" id="addAfterBtn<%- _id %>"><span><?= /* @escapeNotVerified */ __('Add after') ?><\/span><\/button><\/td>' - <?php endif; ?> + <?php foreach ($block->getColumns() as $columnName => $column) : ?> + + '<td>' + + '<?= $block->escapeHtml($block->renderCellTemplate($columnName)) ?>' + + '<\/td>' + <?php endforeach; ?> - + '<td class="col-actions"><button onclick="arrayRow<?= /* @escapeNotVerified */ $_htmlId ?>.del(\'<%- _id %>\')" class="action-delete" type="button"><span><?= /* @escapeNotVerified */ __('Delete') ?><\/span><\/button><\/td>' - +'<\/tr>' + <?php if ($block->isAddAfter()) : ?> + + '<td><button class="action-add" type="button" id="addAfterBtn<%- _id %>"><span>' + + '<?= $block->escapeHtml(__('Add after')) ?>' + + '<\/span><\/button><\/td>' + <?php endif; ?> + + + '<td class="col-actions"><button ' + + 'onclick="arrayRow<?= $block->escapeHtml($_htmlId) ?>.del(\'<%- _id %>\')" ' + + 'class="action-delete" type="button">' + + '<span><?= $block->escapeHtml(__('Delete')) ?><\/span><\/button><\/td>' + + '<\/tr>' ), add: function(rowData, insertAfterId) { @@ -73,56 +76,61 @@ $_colspan = $block->isAddAfter() ? 2 : 1; } else { var d = new Date(); templateValues = { - <?php foreach ($block->getColumns() as $columnName => $column): ?> - <?= /* @escapeNotVerified */ $columnName ?>: '', - 'option_extra_attrs': {}, - <?php endforeach; ?> + <?php foreach ($block->getColumns() as $columnName => $column) : ?> + <?= $block->escapeHtml($columnName) ?>: '', + 'option_extra_attrs': {}, + <?php endforeach; ?> _id: '_' + d.getTime() + '_' + d.getMilliseconds() }; } // Insert new row after specified row or at the bottom if (insertAfterId) { - Element.insert($(insertAfterId), {after: this.template(templateValues)}); - } else { - Element.insert($('addRow<?= /* @escapeNotVerified */ $_htmlId ?>'), {bottom: this.template(templateValues)}); - } + Element.insert($(insertAfterId), {after: this.template(templateValues)}); + } else { + Element.insert($('addRow<?= $block->escapeHtml($_htmlId) ?>'), {bottom: this.template(templateValues)}); + } - // Fill controls with data - if (rowData) { - var rowInputElementNames = Object.keys(rowData.column_values); - for (var i = 0; i < rowInputElementNames.length; i++) { - if ($(rowInputElementNames[i])) { - $(rowInputElementNames[i]).setValue(rowData.column_values[rowInputElementNames[i]]); + // Fill controls with data + if (rowData) { + var rowInputElementNames = Object.keys(rowData.column_values); + for (var i = 0; i < rowInputElementNames.length; i++) { + if ($(rowInputElementNames[i])) { + $(rowInputElementNames[i]).setValue(rowData.column_values[rowInputElementNames[i]]); + } } } - } - // Add event for {addAfterBtn} button - <?php if ($block->isAddAfter()): ?> - Event.observe('addAfterBtn' + templateValues._id, 'click', this.add.bind(this, false, templateValues._id)); + // Add event for {addAfterBtn} button + <?php if ($block->isAddAfter()) : ?> + Event.observe('addAfterBtn' + templateValues._id, 'click', this.add.bind(this, false, templateValues._id)); <?php endif; ?> - }, + }, - del: function(rowId) { - $(rowId).remove(); - } + del: function(rowId) { + $(rowId).remove(); + } } // bind add action to "Add" button in last row - Event.observe('addToEndBtn<?= /* @escapeNotVerified */ $_htmlId ?>', 'click', arrayRow<?= /* @escapeNotVerified */ $_htmlId ?>.add.bind(arrayRow<?= /* @escapeNotVerified */ $_htmlId ?>, false, false)); + Event.observe('addToEndBtn<?= $block->escapeHtml($_htmlId) ?>', + 'click', + arrayRow<?= $block->escapeHtml($_htmlId) ?>.add.bind( + arrayRow<?= $block->escapeHtml($_htmlId) ?>, false, false + ) + ); // add existing rows <?php foreach ($block->getArrayRows() as $_rowId => $_row) { - /* @escapeNotVerified */ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ");\n"; + echo $block->escapeHtml("arrayRow{$_htmlId}.add(" . $_row->toJson() . ");\n"); } ?> // Toggle the grid availability, if element is disabled (depending on scope) - <?php if ($block->getElement()->getDisabled()):?> - toggleValueElements({checked: true}, $('grid<?= /* @escapeNotVerified */ $_htmlId ?>').parentNode); - <?php endif;?> + <?php if ($block->getElement()->getDisabled()) : ?> + toggleValueElements({checked: true}, $('grid<?= $block->escapeHtml($_htmlId) ?>').parentNode); + <?php endif; ?> }); </script> </div> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml index b703641acadb8..161364c7d7fd5 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <script> require([ @@ -71,7 +68,7 @@ originModel.prototype = { { this.reload = false; this.loader = new varienLoader(true); - this.regionsUrl = "<?= /* @escapeNotVerified */ $block->getUrl('directory/json/countryRegion') ?>"; + this.regionsUrl = "<?= $block->escapeUrl($block->getUrl('directory/json/countryRegion')) ?>"; this.bindCountryRegionRelation(); }, @@ -146,11 +143,14 @@ originModel.prototype = { var value = this.regionElement.value; var disabled = this.regionElement.disabled; if (data.length) { - var html = '<select name="'+this.regionElement.name+'" id="'+this.regionElement.id+'" class="required-entry select" title="'+this.regionElement.title+'"'+(disabled?" disabled":"")+'>'; + var html = '<select name="'+this.regionElement.name+'" id="'+this.regionElement.id+'" ' + + 'class="required-entry select" title="'+this.regionElement.title+'"'+(disabled?" disabled":"")+'>'; for (var i in data) { if (data[i].label) { html+= '<option value="'+data[i].value+'"'; - if (this.regionElement.value && (this.regionElement.value == data[i].value || this.regionElement.value == data[i].label)) { + if (this.regionElement.value && + (this.regionElement.value == data[i].value || this.regionElement.value == data[i].label) + ) { html+= ' selected'; } html+='>'+data[i].label+'<\/option>'; @@ -168,7 +168,8 @@ originModel.prototype = { } }, clearRegionField: function(disabled) { - var html = '<input type="text" name="' + this.regionElement.name + '" id="' + this.regionElement.id + '" class="input-text" title="' + this.regionElement.title + '"' + (disabled ? " disabled" : "") + '>'; + var html = '<input type="text" name="' + this.regionElement.name + '" id="' + this.regionElement.id + '" ' + + 'class="input-text" title="' + this.regionElement.title + '"' + (disabled ? " disabled" : "") + '>'; var parentNode = this.regionElement.parentNode; var regionElementId = this.regionElement.id; parentNode.innerHTML = html; diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml index 6677b80076478..d31a7dc21d51b 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml @@ -3,34 +3,38 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Backend\Block\Template */ ?> <div class="field field-store-switcher"> - <label class="label" for="store_switcher"><?= /* @escapeNotVerified */ __('Current Configuration Scope:') ?></label> + <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Current Configuration Scope:')) ?></label> <div class="control"> - <select id="store_switcher" class="system-config-store-switcher" onchange="location.href=this.options[this.selectedIndex].getAttribute('url')"> - <?php foreach ($block->getStoreSelectOptions() as $_value => $_option): ?> - <?php if (isset($_option['is_group'])): ?> - <?php if ($_option['is_close']): ?> - </optgroup> - <?php else: ?> - <optgroup label="<?= $block->escapeHtml($_option['label']) ?>" style="<?= /* @escapeNotVerified */ $_option['style'] ?>"> + <select id="store_switcher" class="system-config-store-switcher" + onchange="location.href=this.options[this.selectedIndex].getAttribute('url')"> + <?php foreach ($block->getStoreSelectOptions() as $_value => $_option) : ?> + <?php if (isset($_option['is_group'])) : ?> + <?php if ($_option['is_close']) : ?> + </optgroup> + <?php else : ?> + <optgroup label="<?= $block->escapeHtml($_option['label']) ?>" + style="<?= $block->escapeHtml($_option['style']) ?>"> + <?php endif; ?> + <?php continue ?> <?php endif; ?> - <?php continue ?> - <?php endif; ?> - <option value="<?= $block->escapeHtml($_value) ?>" url="<?= /* @escapeNotVerified */ $_option['url'] ?>" <?= $_option['selected'] ? 'selected="selected"' : '' ?> style="<?= /* @escapeNotVerified */ $_option['style'] ?>"> - <?= $block->escapeHtml($_option['label']) ?> - </option> + <option value="<?= $block->escapeHtml($_value) ?>" + url="<?= $block->escapeUrl($_option['url']) ?>" + <?= $_option['selected'] ? 'selected="selected"' : '' ?> + style="<?= $block->escapeHtml($_option['style']) ?>"> + <?= $block->escapeHtml($_option['label']) ?> + </option> <?php endforeach ?> </select> </div> <?= $block->getHintHtml() ?> - <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::store')): ?> + <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::store')) : ?> <div class="actions"> - <a href="<?= /* @escapeNotVerified */ $block->getUrl('*/system_store') ?>"><?= /* @escapeNotVerified */ __('Stores') ?></a> + <a href="<?= $block->escapeUrl($block->getUrl('*/system_store')) ?>"> + <?= $block->escapeHtml(__('Stores')) ?> + </a> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml index d7000f28b5ef3..8e21eafb623b5 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml @@ -10,7 +10,7 @@ ?> <?php if ($block->getTabs()): ?> - <div id="<?= /* @escapeNotVerified */ $block->getId() ?>" class="config-nav"> + <div id="<?= $block->getId() ?>" class="config-nav"> <?php /** @var $_tab \Magento\Config\Model\Config\Structure\Element\Tab */ foreach ($block->getTabs() as $_tab): @@ -27,15 +27,15 @@ <div class="config-nav-block admin__page-nav _collapsed <?php if ($_tab->getClass()): ?> - <?= /* @escapeNotVerified */ $_tab->getClass() ?> + <?= $block->escapeHtml($_tab->getClass()) ?> <?php endif ?>" - data-mage-init='{"collapsible":{"active": "<?= /* @escapeNotVerified */ $activeCollapsible ?>", + data-mage-init='{"collapsible":{"active": "<?= $activeCollapsible ?>", "openedState": "_show", "closedState": "_hide", "collapsible": true, "animate": 200}}'> <div class="admin__page-nav-title title _collapsible" data-role="title"> - <strong><?= /* @escapeNotVerified */ $_tab->getLabel() ?></strong> + <strong><?= $block->escapeHtml($_tab->getLabel()) ?></strong> </div> <ul class="admin__page-nav-items items" data-role="content"> @@ -44,12 +44,12 @@ /** @var $_section \Magento\Config\Model\Config\Structure\Element\Section */ foreach ($_tab->getChildren() as $_section): ?> <li class="admin__page-nav-item item - <?= /* @escapeNotVerified */ $_section->getClass() ?> + <?= $block->escapeHtml($_section->getClass()) ?> <?php if ($block->isSectionActive($_section)): ?> _active<?php endif ?> <?= $_tab->getChildren()->isLast($_section) ? ' _last' : '' ?>"> - <a href="<?= /* @escapeNotVerified */ $block->getSectionUrl($_section) ?>" + <a href="<?= $block->escapeUrl($block->getSectionUrl($_section)) ?>" class="admin__page-nav-link item-nav"> - <span><?= /* @escapeNotVerified */ $_section->getLabel() ?></span> + <span><?= $block->escapeHtml($_section->getLabel()) ?></span> </a> </li> <?php $_iterator++; ?> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 6e9b9a396ec2f..a58f05fb8d96a 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,28 +10,34 @@ */ ?> -<form id="currency-symbols-form" action="<?= /* @escapeNotVerified */ $block->getFormActionUrl() ?>" method="post"> - <input name="form_key" type="hidden" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /> +<form id="currency-symbols-form" action="<?= $block->escapeUrl($block->getFormActionUrl()) ?>" method="post"> + <input name="form_key" type="hidden" value="<?= $block->escapeHtml($block->getFormKey()) ?>" /> <fieldset class="admin__fieldset"> - <?php foreach ($block->getCurrencySymbolsData() as $code => $data): ?> + <?php foreach ($block->getCurrencySymbolsData() as $code => $data) : ?> <div class="admin__field _required"> - <label class="admin__field-label" for="custom_currency_symbol<?= /* @escapeNotVerified */ $code ?>"> - <span><?= /* @escapeNotVerified */ $code ?> (<?= /* @escapeNotVerified */ $data['displayName'] ?>)</span> + <label class="admin__field-label" for="custom_currency_symbol<?= $block->escapeHtml($code) ?>"> + <span><?= $block->escapeHtml($code) ?> (<?= $block->escapeHtml($data['displayName']) ?>)</span> </label> <div class="admin__field-control"> - <input id="custom_currency_symbol<?= /* @escapeNotVerified */ $code ?>" + <input id="custom_currency_symbol<?= $block->escapeHtml($code) ?>" class="required-entry admin__control-text <?= $data['inherited'] ? 'disabled' : '' ?>" type="text" value="<?= $block->escapeHtmlAttr($data['displaySymbol']) ?>" - name="custom_currency_symbol[<?= /* @escapeNotVerified */ $code ?>]"> + name="custom_currency_symbol[<?= $block->escapeHtml($code) ?>]"> <div class="admin__field admin__field-option"> - <input id="custom_currency_symbol_inherit<?= /* @escapeNotVerified */ $code ?>" + <input id="custom_currency_symbol_inherit<?= $block->escapeHtml($code) ?>" class="admin__control-checkbox" type="checkbox" - onclick="toggleUseDefault(<?= /* @escapeNotVerified */ '\'' . $code . '\',\'' . $block->escapeJs($data['parentSymbol']) . '\'' ?>)" + onclick="toggleUseDefault(<?= '\'' . $block->escapeHtml($code) . '\',\'' . + $block->escapeJs($data['parentSymbol']) . '\'' ?>)" <?= $data['inherited'] ? ' checked="checked"' : '' ?> value="1" - name="inherit_custom_currency_symbol[<?= /* @escapeNotVerified */ $code ?>]"> - <label class="admin__field-label" for="custom_currency_symbol_inherit<?= /* @escapeNotVerified */ $code ?>"><span><?= /* @escapeNotVerified */ $block->getInheritText() ?></span></label> + name="inherit_custom_currency_symbol[<?= $block->escapeHtml($code) ?>]"> + <label class="admin__field-label" + for="custom_currency_symbol_inherit<?= $block->escapeHtml($code) ?>"> + <span> + <?= $block->escapeHtml($block->getInheritText()) ?> + </span> + </label> </div> </div> </div> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml index 8a16eb71e0853..fc1825dc55477 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -18,9 +15,9 @@ $_newRates = $block->getNewRates(); $_rates = ($_newRates) ? $_newRates : $_oldRates; ?> <?php if (empty($_rates)): ?> - <div class="message message-warning warning"><p><?= /* @escapeNotVerified */ __('You must first configure currency options before being able to see currency rates.') ?></p></div> + <div class="message message-warning warning"><p><?= $block->escapeHtml(__('You must first configure currency options before being able to see currency rates.')) ?></p></div> <?php else: ?> - <form name="rateForm" id="rate-form" method="post" action="<?= /* @escapeNotVerified */ $block->getRatesFormAction() ?>"> + <form name="rateForm" id="rate-form" method="post" action="<?= $block->escapeUrl($block->getRatesFormAction()) ?>"> <?= $block->getBlockHtml('formkey') ?> <div class="admin__control-table-wrapper"> <table class="admin__control-table"> @@ -28,7 +25,7 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; <tr> <th> </th> <?php $_i = 0; foreach ($block->getAllowedCurrencies() as $_currencyCode): ?> - <th><span><?= /* @escapeNotVerified */ $_currencyCode ?></span></th> + <th><span><?= $block->escapeHtml($_currencyCode) ?></span></th> <?php endforeach; ?> </tr> </thead> @@ -37,26 +34,26 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; <?php if (isset($_rates[$_currencyCode]) && is_array($_rates[$_currencyCode])): ?> <?php foreach ($_rates[$_currencyCode] as $_rate => $_value): ?> <?php if (++$_j == 1): ?> - <td><span class="admin__control-support-text"><?= /* @escapeNotVerified */ $_currencyCode ?></span></td> + <td><span class="admin__control-support-text"><?= $block->escapeHtml($_currencyCode) ?></span></td> <td> <input type="text" - name="rate[<?= /* @escapeNotVerified */ $_currencyCode ?>][<?= /* @escapeNotVerified */ $_rate ?>]" - value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $_value : (isset($_oldRates[$_currencyCode][$_rate]) ? $_oldRates[$_currencyCode][$_rate] : '')) ?>" + name="rate[<?= $block->escapeHtml($_currencyCode) ?>][<?= $block->escapeHtml($_rate) ?>]" + value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?> - <div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <strong><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></strong></div> + <div class="admin__field-note"><?= $block->escapeHtml(__('Old rate:')) ?> <strong><?= $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) ?></strong></div> <?php endif; ?> </td> <?php else: ?> <td> <input type="text" - name="rate[<?= /* @escapeNotVerified */ $_currencyCode ?>][<?= /* @escapeNotVerified */ $_rate ?>]" - value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $_value : (isset($_oldRates[$_currencyCode][$_rate]) ? $_oldRates[$_currencyCode][$_rate] : '')) ?>" + name="rate[<?= $block->escapeHtml($_currencyCode) ?>][<?= $block->escapeHtml($_rate) ?>]" + value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?> - <div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <strong><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></strong></div> + <div class="admin__field-note"><?= $block->escapeHtml(__('Old rate:')) ?> <strong><?= $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) ?></strong></div> <?php endif; ?> </td> <?php endif; ?> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/services.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/services.phtml index 985831c5de79f..471a4a05daa59 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/services.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/services.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,7 +10,7 @@ */ ?> <div class="admin__field"> - <label class="admin__field-label"><span><?= /* @escapeNotVerified */ __('Import Service') ?></span></label> + <label class="admin__field-label"><span><?= $block->escapeHtml(__('Import Service')) ?></span></label> <div class="admin__field-control"> <?= $block->getChildHtml('import_services') ?> </div> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml index 42b2affa2c176..f5390bee3e4e3 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,7 +10,7 @@ */ ?> -<form action="<?= /* @escapeNotVerified */ $block->getImportFormAction() ?>" method="post" class="import-service"> +<form action="<?= $block->escapeUrl($block->getImportFormAction()) ?>" method="post" class="import-service"> <?= $block->getBlockHtml('formkey') ?> <fieldset class="admin__fieldset admin__fieldset-import-service"> <?= $block->getServicesHtml() ?> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml index 00766acac16fd..4a636fa066e90 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Reports\Block\Adminhtml\Grid */ @@ -13,7 +10,7 @@ $numColumns = sizeof($block->getColumns()); ?> <?php if ($block->getCollection()): ?> <?php if ($block->canDisplayContainer()): ?> - <div id="<?= /* @escapeNotVerified */ $block->getId() ?>"> + <div id="<?= $block->escapeHtml($block->getId()) ?>"> <?php else: ?> <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> @@ -21,41 +18,41 @@ $numColumns = sizeof($block->getColumns()); <div class="admin__data-grid-header admin__data-grid-toolbar"> <div class="admin__data-grid-header-row"> <?php if ($block->getDateFilterVisibility()): ?> - <div class="admin__filter-actions" data-role="filter-form" id="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_range') ?>"> + <div class="admin__filter-actions" data-role="filter-form" id="<?= $block->escapeHtml($block->getSuffixId('period_date_range')) ?>"> <span class="field-row"> - <label for="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from') ?>" + <label for="<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" class="admin__control-support-text"> - <span><?= /* @escapeNotVerified */ __('From') ?>:</span> + <span><?= $block->escapeHtml(__('From')) ?>:</span> </label> <input class="input-text no-changes required-entry admin__control-text" type="text" - id="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from') ?>" + id="<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" name="report_from" value="<?= $block->escapeHtml($block->getFilter('report_from')) ?>"> - <span id="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from_advice') ?>"></span> + <span id="<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>"></span> </span> <span class="field-row"> - <label for="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to') ?>" + <label for="<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" class="admin__control-support-text"> - <span><?= /* @escapeNotVerified */ __('To') ?>:</span> + <span><?= $block->escapeHtml(__('To')) ?>:</span> </label> <input class="input-text no-changes required-entry admin__control-text" type="text" - id="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to') ?>" + id="<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" name="report_to" value="<?= $block->escapeHtml($block->getFilter('report_to')) ?>"/> - <span id="<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to_advice') ?>"></span> + <span id="<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>"></span> </span> <span class="field-row admin__control-filter"> - <label for="<?= /* @escapeNotVerified */ $block->getSuffixId('report_period') ?>" + <label for="<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>" class="admin__control-support-text"> - <span><?= /* @escapeNotVerified */ __('Show By') ?>:</span> + <span><?= $block->escapeHtml(__('Show By')) ?>:</span> </label> - <select name="report_period" id="<?= /* @escapeNotVerified */ $block->getSuffixId('report_period') ?>" class="admin__control-select"> + <select name="report_period" id="<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>" class="admin__control-select"> <?php foreach ($block->getPeriods() as $_value => $_label): ?> - <option value="<?= /* @escapeNotVerified */ $_value ?>" <?php if ($block->getFilter('report_period') == $_value): ?> selected<?php endif; ?>><?= /* @escapeNotVerified */ $_label ?></option> + <option value="<?= $block->escapeHtml($_value) ?>" <?php if ($block->getFilter('report_period') == $_value): ?> selected<?php endif; ?>><?= $block->escapeHtml($_label) ?></option> <?php endforeach; ?> </select> <?= $block->getRefreshButtonHtml() ?> @@ -66,14 +63,14 @@ $numColumns = sizeof($block->getColumns()); "mage/calendar" ], function($){ - $("#<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_range') ?>").dateRange({ - dateFormat:"<?= /* @escapeNotVerified */ $block->getDateFormat() ?>", - buttonText:"<?= /* @escapeNotVerified */ __('Select Date') ?>", + $("#<?= $block->escapeHtml($block->getSuffixId('period_date_range')) ?>").dateRange({ + dateFormat:"<?= $block->escapeHtml($block->getDateFormat()) ?>", + buttonText:"<?= $block->escapeHtml(__('Select Date')) ?>", from:{ - id:"<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from') ?>" + id:"<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" }, to:{ - id:"<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to') ?>" + id:"<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" } }); }); @@ -87,7 +84,7 @@ $numColumns = sizeof($block->getColumns()); </div> <?php endif; ?> <div class="admin__data-grid-wrap admin__data-grid-wrap-static"> - <table class="data-grid" id="<?= /* @escapeNotVerified */ $block->getId() ?>_table"> + <table class="data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> <?= $block->getChildHtml('grid.columnSet') ?> </table> </div> @@ -102,14 +99,14 @@ $numColumns = sizeof($block->getColumns()); ], function(jQuery){ //<![CDATA[ - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?> = new varienGrid('<?= /* @escapeNotVerified */ $block->getId() ?>', '<?= /* @escapeNotVerified */ $block->getGridUrl() ?>', '<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameSort() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameDir() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameFilter() ?>'); - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.useAjax = '<?php if ($block->getUseAjax()): /* @escapeNotVerified */ echo $block->getUseAjax(); endif; ?>'; + <?= $block->escapeHtml($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= $block->escapeUrl($block->getGridUrl()) ?>', '<?= $block->escapeHtml($block->getVarNamePage()) ?>', '<?= $block->escapeHtml($block->getVarNameSort()) ?>', '<?= $block->escapeHtml($block->getVarNameDir()) ?>', '<?= $block->escapeHtml($block->getVarNameFilter()) ?>'); + <?= $block->escapeHtml($block->getJsObjectName()) ?>.useAjax = '<?php if ($block->getUseAjax()): echo $block->escapeHtml($block->getUseAjax()); endif; ?>'; <?php if ($block->getDateFilterVisibility()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.doFilterCallback = validateFilterDate; - var period_date_from = $('<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from') ?>'); - var period_date_to = $('<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to') ?>'); - period_date_from.adviceContainer = $('<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from_advice') ?>'); - period_date_to.adviceContainer = $('<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to_advice') ?>'); + <?= $block->escapeHtml($block->getJsObjectName()) ?>.doFilterCallback = validateFilterDate; + var period_date_from = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>'); + var period_date_to = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>'); + period_date_from.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>'); + period_date_to.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>'); var validateFilterDate = function() { if (period_date_from && period_date_to) { @@ -138,9 +135,9 @@ $numColumns = sizeof($block->getColumns()); if (obj.switchParams) { storeParam += obj.switchParams; } - var formParam = new Array('<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_from') ?>', '<?= /* @escapeNotVerified */ $block->getSuffixId('period_date_to') ?>', '<?= /* @escapeNotVerified */ $block->getSuffixId('report_period') ?>'); + var formParam = new Array('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>', '<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>', '<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>'); var paramURL = ''; - var switchURL = '<?= /* @escapeNotVerified */ $block->getAbsoluteGridUrl(['_current' => false]) ?>'.replace(/(store|group|website)\/\d+\//, ''); + var switchURL = '<?= $block->escapeUrl($block->getAbsoluteGridUrl(['_current' => false])) ?>'.replace(/(store|group|website)\/\d+\//, ''); for (var i = 0; i < formParam.length; i++) { if ($(formParam[i]).value && $(formParam[i]).name) { diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml index 6f93cd157a4f0..9701dc6d9fcb7 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - ?> <div class="reports-content"> @@ -32,7 +31,7 @@ require([ } if (jQuery('#filter_form').valid()) { - setLocation('<?= /* @escapeNotVerified */ $block->getFilterUrl() ?>filter/'+ + setLocation('<?= $block->escapeUrl($block->getFilterUrl()) ?>filter/'+ Base64.encode(Form.serializeElements(elements))+'/' ); } diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml index 16b99744c42e4..7cfd4022dd6b4 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml @@ -3,28 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <?= $block->getChildHtml('grid') ?> <div class="switcher f-left" style="margin: 10px 10px 10px 0px; padding:15px;"> <?php - /* @escapeNotVerified */ echo __('Customers that have Wish List: %1', $block->getCustomerWithWishlist()) + echo $block->escapeHtml(__('Customers that have Wish List: %1', $block->getCustomerWithWishlist())) ?> </div> <div class="switcher" style="float: right; margin: 10px 0px 10px 10px; padding:15px;"> <?php - /* @escapeNotVerified */ echo __('Number of Wish Lists: %1', $block->getWishlistsCount()) + echo $block->escapeHtml(__('Number of Wish Lists: %1', $block->getWishlistsCount())) ?><br /> <?php - /* @escapeNotVerified */ echo __('Number of items bought from a Wish List: %1', $block->getItemsBought()) + echo $block->escapeHtml(__('Number of items bought from a Wish List: %1', $block->getItemsBought())) ?><br /> - <?php /* @escapeNotVerified */ echo __('Number of times Wish Lists have been shared (emailed): %1', $block->getSharedCount()) + <?php echo $block->escapeHtml(__('Number of times Wish Lists have been shared (emailed): %1', $block->getSharedCount())) ?><br /> - <?php /* @escapeNotVerified */ echo __('Number of Wish List referrals: %1', $block->getReferralsCount()) + <?php echo $block->escapeHtml(__('Number of Wish List referrals: %1', $block->getReferralsCount())) ?><br /> - <?php /* @escapeNotVerified */ echo __('Number of Wish List conversions: %1', $block->getConversionsCount()) + <?php echo $block->escapeHtml(__('Number of Wish List conversions: %1', $block->getConversionsCount())) ?><br /> </div> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml index 0a1dc5dacd99d..cad73c762476c 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml @@ -4,24 +4,20 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @see \Magento\Backend\Block\Store\Switcher */ ?> <?php if ($block->isShow()): ?> <div class="field field-store-switcher"> - <label class="label" for="store_switcher"><?= /* @escapeNotVerified */ __('Show Report For:') ?></label> + <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Show Report For:')) ?></label> <div class="control"> <select id="store_switcher" class="admin__control-select" name="store_switcher" onchange="return switchStore(this);"> - <option value=""><?= /* @escapeNotVerified */ __('All Websites') ?></option> + <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> <?php foreach ($block->getWebsiteCollection() as $_website): ?> <?php $showWebsite = false; ?> <?php foreach ($block->getGroupCollection($_website) as $_group): ?> @@ -29,15 +25,15 @@ <?php foreach ($block->getStoreCollection($_group) as $_store): ?> <?php if ($showWebsite == false): ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= /* @escapeNotVerified */ $_website->getId() ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected<?php endif; ?>> - <?= /* @escapeNotVerified */ $_website->getName() ?> + <option website="true" value="<?= $block->escapeHtml($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected<?php endif; ?>> + <?= $block->escapeHtml($_website->getName()) ?> </option> <?php endif; ?> <?php if ($showGroup == false): ?> <?php $showGroup = true; ?> - <option group="true" value="<?= /* @escapeNotVerified */ $_group->getId() ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected<?php endif; ?>>   <?= /* @escapeNotVerified */ $_group->getName() ?></option> + <option group="true" value="<?= $block->escapeHtml($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= /* @escapeNotVerified */ $_store->getId() ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= /* @escapeNotVerified */ $_store->getName() ?></option> + <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> @@ -60,7 +56,7 @@ require(['prototype'], function(){ if(obj.switchParams){ storeParam+= obj.switchParams; } - setLocation('<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>'+storeParam); + setLocation('<?= $block->escapeHtml($block->getSwitchUrl()) ?>'+storeParam); } }); diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml index 7edeee628be4a..e2d35171883b4 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @see \Magento\Backend\Block\Store\Switcher */ @@ -19,14 +15,14 @@ <?php if ($block->isShow()): ?> <div class="field field-store-switcher"> - <label class="label" for="store_switcher"><?= /* @escapeNotVerified */ __('Show Report For:') ?></label> + <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Show Report For:')) ?></label> <div class="control"> <select id="store_switcher" class="admin__control-select" name="store_switcher" onchange="return switchStore(this);"> - <option value=""><?= /* @escapeNotVerified */ __('All Websites') ?></option> + <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> <?php foreach ($block->getWebsiteCollection() as $_website): ?> <?php $showWebsite = false; ?> <?php foreach ($block->getGroupCollection($_website) as $_group): ?> @@ -34,13 +30,13 @@ <?php foreach ($block->getStoreCollection($_group) as $_store): ?> <?php if ($showWebsite == false): ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= /* @escapeNotVerified */ implode(',', $_website->getStoreIds()) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())): ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> + <option website="true" value="<?= implode(',', $block->escapeHtml($_website->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())): ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> <?php endif; ?> <?php if ($showGroup == false): ?> <?php $showGroup = true; ?> - <option group="true" value="<?= /* @escapeNotVerified */ implode(',', $_group->getStoreIds()) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())): ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= implode(',', $block->escapeHtml($_group->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())): ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= /* @escapeNotVerified */ $_store->getId() ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php if ($showGroup): ?> </optgroup> @@ -59,7 +55,7 @@ require(['prototype'], function(){ if(obj.switchParams){ storeParam+= obj.switchParams; } - setLocation('<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>'+storeParam); + setLocation('<?= $block->escapeUrl($block->getSwitchUrl()) ?>'+storeParam); } }); diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml index a6e2f3dc72261..627df114586ba 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Reports\Block\Product\Widget\Viewed */ ?> @@ -15,12 +13,12 @@ $type = $block->getType() . '-' . $mode; $class = 'widget viewed' . ' ' . $mode; $title = __('Recently Viewed'); ?> -<div class="block <?= /* @escapeNotVerified */ $class ?>" id="recently_viewed_container" data-mage-init='{"recentlyViewedProducts":{}}' data-count="<?= /* @escapeNotVerified */ $block->getCount() ?>" style="display: none;"> +<div class="block <?= $block->escapeHtml($class) ?>" id="recently_viewed_container" data-mage-init='{"recentlyViewedProducts":{}}' data-count="<?= $block->escapeHtml($block->getCount()) ?>" style="display: none;"> <div class="title"> - <strong><?= /* @escapeNotVerified */ $title ?></strong> + <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="content"> - <ol class="products list items <?= /* @escapeNotVerified */ $type ?>"> + <ol class="products list items <?= $block->escapeHtml($type) ?>"> </ol> </div> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index 579239d63e11e..f0e3704264353 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - /* @var $block \Magento\Reports\Block\Product\Widget\Viewed\Item */ ?> @@ -17,26 +14,26 @@ $item = $block->getProduct(); $image = $block->getImageType(); $rating = 'short'; ?> -<div class="block" id="widget_viewed_item" data-sku="<?= /* @escapeNotVerified */ $item->getSku() ?>" style="display: none;"> +<div class="block" id="widget_viewed_item" data-sku="<?= $block->escapeHtml($item->getSku()) ?>" style="display: none;"> <li class="item product"> <div class="product"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" class="product photo"> + <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> + <a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" class="product photo"> <?= $block->getImage($item, $image)->toHtml() ?> </a> <div class="product details"> - <strong class="product name"><a title="<?= $block->escapeHtml($item->getName()) ?>" href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>"> + <strong class="product name"><a title="<?= $block->escapeHtml($item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> <?= $block->escapeHtml($item->getName()) ?></a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - ) ?> + )) ?> <?php if ($rating): ?> <?= $block->getReviewsSummaryHtml($item, $rating) ?> @@ -46,32 +43,32 @@ $rating = 'short'; <div class="primary"> <?php if ($item->isSaleable()): ?> <?php if ($item->getTypeInstance()->hasRequiredOptions($item)): ?> - <button class="action tocart" data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($item) ?>"}}' type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <button class="action tocart" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($item), ['product' => $item->getEntityId()]) ?> <button class="action tocart" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml($postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> <?php else: ?> <?php if ($item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <div class="secondary-addto-links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()): ?> - <a href="#" data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + <a href="#" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($item)) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl()): ?> @@ -79,10 +76,10 @@ $rating = 'short'; $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($item) ?>' + data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($item)) ?>' data-role="add-to-links" - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index 56368aa0e7fed..1c9154512c434 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($exist = $block->getRecentlyComparedProducts()) { @@ -26,43 +23,43 @@ if ($exist = $block->getRecentlyComparedProducts()) { } ?> <?php if ($exist): ?> -<div class="block widget block-compared-products-<?= /* @escapeNotVerified */ $mode ?>"> +<div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ $title ?></strong> + <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-compared-<?= /* @escapeNotVerified */ $suffix ?>"> + <ol class="product-items" id="widget-compared-<?= $block->escapeHtml($suffix) ?>"> <?php foreach ($items as $_product): ?> <li class="product-item"> <div class="product-item-info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>)"> + <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-widget-compared-' . $suffix ] - ) ?> + )) ?> <div class="product-item-actions"> <?php if ($_product->isSaleable()): ?> <div class="actions-primary"> <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_product) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php @@ -70,17 +67,17 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml($postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> </div> <?php else: ?> <?php if ($_product->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml index e125467b71f77..e94c205c858d7 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($exist = $block->getRecentlyComparedProducts()) { @@ -25,15 +22,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($exist): ?> <div class="block widget block-compared-products-images"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ $title ?></strong> + <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-compared-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-images"> + <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-images"> <?php $i = 0; foreach ($items as $_product): ?> <li class="product-item"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml index ee24db7d693bd..c945169a165dd 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml @@ -3,23 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($_products = $block->getRecentlyComparedProducts()): ?> <div class="block widget block-compared-products-names"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('Recently Compared') ?></span></strong> + <strong><?= $block->escapeHtml(__('Recently Compared')) ?></span></strong> </div> <div class="block-content"> - <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-compared-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-names"> + <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-names"> <?php $i = 0; foreach ($_products as $_product): ?> <li class="product-item"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product-item-link"> + <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index d798fe9e58127..c8a55bd628083 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -4,11 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> - -<?php /** @var \Magento\Catalog\Block\Product\Compare\ListCompare $block */ if ($exist = $block->getRecentlyComparedProducts()) { $type = 'widget-compared'; @@ -29,35 +24,35 @@ if ($exist = $block->getRecentlyComparedProducts()) { ?> <?php if ($exist):?> - <div class="block widget block-compared-products-<?= /* @escapeNotVerified */ $mode ?>"> + <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> + <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> + <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> + <ol class="product-items <?= $block->escapeHtml($type)?>"> <?php foreach ($items as $_item): ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl(block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-link"> + href="<?= /$block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - ) ?> + )) ?> <?php if ($rating): ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -68,9 +63,9 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->isSaleable()): ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php @@ -78,16 +73,16 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml(postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> @@ -97,19 +92,19 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' + data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" class="action towishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare): ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index be1c7672a128a..af9e6518c90cb 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -4,11 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> - -<?php /** @var \Magento\Catalog\Block\Product\Compare\ListCompare $block */ if ($exist = $block->getRecentlyComparedProducts()) { $type = 'widget-compared'; @@ -30,35 +25,35 @@ if ($exist = $block->getRecentlyComparedProducts()) { ?> <?php if ($exist):?> - <div class="block widget block-compared-products-<?= /* @escapeNotVerified */ $mode ?>"> + <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> + <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> + <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> + <ol class="product-items <?= $block->escapeHtml($type) ?>"> <?php foreach ($items as $_item): ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-link"> + href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - ) ?> + )) ?> <?php if ($rating): ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -69,9 +64,9 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->isSaleable()): ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtml($block->getAddToCartUrl($_item) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php @@ -79,16 +74,16 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml($postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> @@ -98,19 +93,19 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' + data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" class="action towishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare): ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> @@ -119,10 +114,10 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php endif; ?> <?php if ($description):?> <div class="product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index aa7d5a7166a6a..9b8ac733f65d0 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @var $block \Magento\Reports\Block\Product\Viewed */ @@ -31,60 +27,60 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr } ?> <?php if ($exist): ?> -<div class="block widget block-viewed-products-<?= /* @escapeNotVerified */ $mode ?>"> +<div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ $title ?></strong> + <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-viewed-<?= /* @escapeNotVerified */ $suffix ?>"> + <ol class="product-items" id="widget-viewed-<?= $block->escapeHtml($suffix) ?>"> <?php foreach ($items as $_product): ?> <li class="product-item"> <div class="product-item-info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>" + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-widget-viewed-' . $suffix ] - ) ?> + )) ?> <div class="product-item-actions"> <?php if ($_product->isSaleable()): ?> <div class="actions-primary"> <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_product) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); ?> - <button type="button" class="action tocart primary" data-post='<?= /* @escapeNotVerified */ $postData ?>'> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <button type="button" class="action tocart primary" data-post='<?= $block->escapeHtml($postData) ?>'> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> </div> <?php else: ?> <?php if ($_product->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index 86f7b4db3da23..70d0ec68708a4 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @var $block \Magento\Reports\Block\Product\Viewed */ @@ -30,14 +26,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($exist): ?> <div class="block widget block-viewed-products-images"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ $title ?></strong> + <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-viewed-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-images"> + <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-images"> <?php foreach ($items as $_product): ?> <li class="product-item"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml index 25cc6c3c921d7..f4a6a8a2ac372 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @var $block \Magento\Reports\Block\Product\Viewed */ @@ -15,16 +11,16 @@ <?php if (($_products = $block->getRecentlyViewedProducts()) && $_products->getSize()): ?> <div class="block widget block-viewed-products-names"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('Recently Viewed') ?></strong> + <strong><?= $block->escapeHtml(__('Recently Viewed')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-viewed-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-names"> + <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-names"> <?php foreach ($_products as $_product): ?> <li class="product-item"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product-item-link"> + <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index a1d41ada04a5a..414e08bafc8aa 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @var $block \Magento\Reports\Block\Product\Viewed */ @@ -31,35 +27,35 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr } ?> <?php if ($exist):?> - <div class="block widget block-viewed-products-<?= /* @escapeNotVerified */ $mode ?>"> + <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> + <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> + <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> + <ol class="product-items <?= $block->escapeHtml($type) ?>"> <?php foreach ($items as $_item): ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-link"> + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - ) ?> + )) ?> <?php if ($rating): ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -70,9 +66,9 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($_item->isSaleable()): ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php @@ -80,16 +76,16 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml($postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> @@ -99,17 +95,17 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare): ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index c9cff81d30a53..751e8d415f889 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -33,35 +33,35 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ?> <?php if ($exist):?> - <div class="block widget block-viewed-products-<?= /* @escapeNotVerified */ $mode ?>"> + <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> + <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> + <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> + <ol class="product-items <?= $block->escapeHtml($type) ?>"> <?php foreach ($items as $_item): ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-link"> + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php /* @escapeNotVerified */ echo $block->getProductPriceHtml( + <?php echo $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - ) ?> + )) ?> <?php if ($rating): ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -72,9 +72,9 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($_item->isSaleable()): ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else: ?> <?php @@ -82,16 +82,16 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= $block->escapeHtml($postData) ?>' + type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> @@ -102,17 +102,17 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare): ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> @@ -121,10 +121,10 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php endif; ?> <?php if ($description):?> <div class="product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> From 4405689a65b562824c4c0d1417b5ab7bc8fffbbb Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Tue, 14 May 2019 16:57:07 -0500 Subject: [PATCH 103/464] MAGETWO-55101: Use escaper methods - refactored to use escaper methods --- .../adminhtml/templates/toolbar_entry.phtml | 25 ++++++++----------- .../Block/Page/System/Config/Robots/Reset.php | 9 ------- .../page/system/config/robots/reset.phtml | 8 ++++-- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml index 15d4c4c097d16..e16c47f0ca0fc 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml @@ -4,18 +4,15 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ -?> -<?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?> -<?php - $notificationCount = $block->escapeHtml($block->getUnreadNotificationCount()); - $notificationCounterMax = $block->escapeHtml($block->getNotificationCounterMax()); + $notificationCount = $block->getUnreadNotificationCount(); + $notificationCounterMax = $block->getNotificationCounterMax(); ?> <div data-mage-init='{"toolbarEntry": {}}' class="notifications-wrapper admin__action-dropdown-wrap" - data-notification-count="<?= $notificationCount ?>"> + data-notification-count="<?= $block->escapeHtml($notificationCount) ?>"> <?php if ($notificationCount > 0) : ?> <a href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" @@ -24,7 +21,7 @@ title="<?= $block->escapeHtml(__('Notifications')) ?>" data-toggle="dropdown"> <span class="notifications-counter"> - <?= ($notificationCount > $notificationCounterMax) ? $notificationCounterMax . '+' : $notificationCount ?> + <?= ($notificationCount > $notificationCounterMax) ? $block->escapeHtml($notificationCounterMax) . '+' : $block->escapeHtml($notificationCount) ?> </span> </a> <ul @@ -36,7 +33,7 @@ data-notification-id="<?= $block->escapeHtml($notification->getId()) ?>" data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>"> <?php - $notificationDescription = $block->escapeHtml($notification->getDescription()); + $notificationDescription = $notification->getDescription(); $notificationDescriptionLength = $block->getNotificationDescriptionLength(); ?> <strong class="notifications-entry-title"> @@ -45,19 +42,19 @@ <?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?> <p class="notifications-entry-description _cutted"> <span class="notifications-entry-description-start"> - <?= substr($notificationDescription, 0, $notificationDescriptionLength) ?> + <?= $block->escapeHtml(substr($notificationDescription, 0, $notificationDescriptionLength)) ?> </span> <span class="notifications-entry-description-end"> - <?= substr($notificationDescription, $notificationDescriptionLength) ?> + <?= $block->escapeHtml(substr($notificationDescription, $notificationDescriptionLength)) ?> </span> </p> <?php else : ?> <p class="notifications-entry-description"> - <?= $notificationDescription ?> + <?= $block->escapeHtml($notificationDescription) ?> </p> <?php endif; ?> <time class="notifications-entry-time"> - <?= $block->formatNotificationDate($notification->getDateAdded()) ?> + <?= $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())) ?> </time> <button type="button" @@ -70,7 +67,7 @@ <a href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" class="action-tertiary action-more"> - <?= $block->escapeHtml(__('See All (')) ?><span class="notifications-counter"><?= $notificationCount ?></span><?= $block->escapeHtml(__(' unread)')) ?> + <?= $block->escapeHtml(__('See All (')) ?><span class="notifications-counter"><?= $block->escapeHtml($notificationCount) ?></span><?= $block->escapeHtml(__(' unread)')) ?> </a> </li> </ul> diff --git a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php index dc287cf2d959b..2abb987db0723 100644 --- a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php +++ b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php @@ -21,24 +21,15 @@ class Reset extends \Magento\Config\Block\System\Config\Form\Field */ const XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS = 'design/search_engine_robots/default_custom_instructions'; - /** - * @var \Magento\Framework\Serialize\Serializer\Json - */ - private $jsonSerializer; - /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Framework\Serialize\Serializer\Json $jsonSerializer = null, array $data = [] ) { parent::__construct($context, $data); - $this->jsonSerializer = $jsonSerializer ?? \Magento\Framework\App\ObjectManager::getInstance() - ->create(\Magento\Framework\Serialize\Serializer\Json::class); } /** diff --git a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml index 2145eec660ba2..e8082dae94d98 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml @@ -4,10 +4,14 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + /** * @deprecated * @var $block \Magento\Backend\Block\Page\System\Config\Robots\Reset + * @var $jsonHelper \Magento\Framework\Json\Helper\Data */ +$jsonHelper = $this->helper('Magento\Framework\Json\Helper\Data'); ?> <script> @@ -15,8 +19,8 @@ 'jquery' ], function ($) { window.resetRobotsToDefault = function(){ - $('#design_search_engine_robots_custom_instructions').val(<?= - /* @noEscape */ $block-getViewModel()->serialize($block->getRobotsDefaultCustomInstructions()) + $('#design_search_engine_robots_custom_instructions').val(<?php + /* @escapeNotVerified */ echo $jsonHelper->jsonEncode($block->getRobotsDefaultCustomInstructions()) ?>); } }); From 36e604a41f406b333bf09a6cc98812c8189a39ea Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Tue, 14 May 2019 15:28:18 -0700 Subject: [PATCH 104/464] MC-12084: Address is not lost for Guest checkout if Guest refresh page during checkout --- ...rontRefreshPageDuringGuestCheckoutTest.xml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml new file mode 100644 index 0000000000000..f032e7e254afc --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontRefreshPageDuringGuestCheckoutTest"> + <annotations> + <features value="Checkout"/> + <stories value="Guest checkout"/> + <title value="Storefront refresh page during guest checkout test"/> + <description value="Address is not lost for guest checkout if guest refresh page during checkout"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-12084"/> + <group value="checkout"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + </before> + <after> + <!-- Delete simple product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + + <!-- Logout admin --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Add simple product to cart as Guest --> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Go to Checkout page --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> + <waitForPageLoad stepKey="waitForProceedToCheckout"/> + + <!-- Fill email field and addresses form and go next --> + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"> + <argument name="shippingMethod" value="Flat Rate"/> + </actionGroup> + + <!-- Refresh page --> + <reloadPage stepKey="refreshPage"/> + + <!-- Click Place Order and assert order is placed --> + <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <!-- Order review page has address that was created during checkout --> + <amOnPage url="{{AdminOrderPage.url({$grabOrderNumber})}}" stepKey="navigateToOrderPage"/> + <waitForPageLoad stepKey="waitForCreatedOrderPage"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}} {{CustomerAddressSimple.city}}, {{CustomerAddressSimple.state}}, {{CustomerAddressSimple.postcode}}" stepKey="checkShippingAddress"/> + </test> +</tests> From 1c05b797c32d2df6b32f1baf332132e8b7e47e23 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Tue, 30 Apr 2019 10:40:50 +0300 Subject: [PATCH 105/464] magento/magento2#21674 static-test-fix --- app/code/Magento/Email/Model/AbstractTemplate.php | 7 +++---- .../Magento/Email/Test/Unit/Model/BackendTemplateTest.php | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index db4a5f1d8c58b..5eae1d1462184 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -17,8 +17,9 @@ use Magento\MediaStorage\Helper\File\Storage\Database; /** - * Template model class + * Template model class. * + * phpcs:disable Magento2.Classes.AbstractApi * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) @@ -505,7 +506,6 @@ protected function addEmailVariables($variables, $storeId) /** * Apply design config so that emails are processed within the context of the appropriate area/store/theme. - * Can be called multiple times without issue. * * @return bool */ @@ -679,8 +679,7 @@ public function getTemplateFilter() } /** - * Save current design config and replace with design config from specified store - * Event is not dispatched. + * Save current design config and replace with design config from specified store. Event is not dispatched. * * @param null|bool|int|string $storeId * @param string $area diff --git a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php index bfe5005ee7351..1ceccd4414cc0 100644 --- a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php @@ -12,6 +12,9 @@ use Magento\Email\Model\BackendTemplate; use Magento\Framework\ObjectManagerInterface; +/** + * Tests for adminhtml email template model. + */ class BackendTemplateTest extends \PHPUnit\Framework\TestCase { /** @@ -72,13 +75,13 @@ protected function setUp() ->method('get') ->willReturnCallback( function ($value) { - switch($value) { + switch ($value) { case \Magento\MediaStorage\Helper\File\Storage\Database::class: return ($this->databaseHelperMock); case \Magento\Email\Model\ResourceModel\Template::class: return ($this->resourceModelMock); default: - return(NULL); + return(null); } } ); From 5d8da38bdb9a6247c9526a50a46b5537ed8d87ea Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Wed, 15 May 2019 10:46:55 -0500 Subject: [PATCH 106/464] MAGETWO-55101: Use escaper methods - refactored to use escaper methods --- .../Config/view/adminhtml/templates/system/config/tabs.phtml | 2 -- .../templates/widget/compared/content/compared_list.phtml | 2 +- .../templates/widget/viewed/content/viewed_list.phtml | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml index 8e21eafb623b5..54e6fb21111ef 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Config\Block\System\Config\Tabs */ ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index af9e6518c90cb..2200926a75dfe 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -64,7 +64,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->isSaleable()): ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtml($block->getAddToCartUrl($_item) ?>"}}' + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtml($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index 751e8d415f889..981da1a6bfe9d 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -4,10 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> -<?php /** * @var $block \Magento\Reports\Block\Product\Viewed */ From 87a5fa05a7aff5f9405619cceef5ba13702dbe12 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 15 May 2019 09:02:18 -0700 Subject: [PATCH 107/464] MC-6421: Admin search displays settings and content items --- .../Mftf/Section/AdminGlobalSearchSection.xml | 15 +++++ .../AdminGlobalSearchOnProductPageTest.xml | 65 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml create mode 100644 app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml diff --git a/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml b/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml new file mode 100644 index 0000000000000..7036bc346b24d --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminGlobalSearchSection"> + <element name="globalSearch" type="button" selector="//label[contains(concat(' ',normalize-space(@class),' '),' search-global-label ')]"/> + <element name="globalSearchActive" type="block" selector="//div[contains(concat(' ',normalize-space(@class),' '),' search-global-field _active ')]"/> + </section> +</sections> diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml new file mode 100644 index 0000000000000..2a1f5369a0228 --- /dev/null +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminGlobalSearchOnProductPageTest"> + <annotations> + <features value="Search"/> + <stories value="Backend global search"/> + <title value="Admin global search on product page test"/> + <description value="Admin search displays settings and content items"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-6421"/> + <group value="Search"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <!-- Delete product --> + <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> + <argument name="sku" value="{{SimpleProduct.sku}}"/> + </actionGroup> + + <!-- Delete category --> + <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> + <argument name="categoryEntity" value="_defaultCategory"/> + </actionGroup> + + <!-- Logout --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Create Simple Product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> + + <!-- Create new category for product --> + <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <argument name="categoryName" value="{{_defaultCategory.name}}"/> + </actionGroup> + + <!-- Save product form --> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + + <!-- Click on the magnifying glass to start searching --> + <click selector="{{AdminGlobalSearchSection.globalSearch}}" stepKey="clickSearchBtn"/> + + <!-- The search input is expanded and active --> + <seeElement selector="{{AdminGlobalSearchSection.globalSearchActive}}" stepKey="seeActiveSearch"/> + </test> +</tests> From 8f4234be43aeeb62bc4391b90325db9f92c0cf0f Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 15 May 2019 11:02:28 -0500 Subject: [PATCH 108/464] MAGETWO-53347: Char flag update - add visibility scope to constants --- lib/internal/Magento/Framework/Escaper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index abee409796bd6..f243fb2c99b4f 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -16,7 +16,7 @@ class Escaper /** * HTML special characters flag */ - const HTMLSPECIALCHARS_FLAG = ENT_QUOTES | ENT_SUBSTITUTE; + private const HTMLSPECIALCHARS_FLAG = ENT_QUOTES | ENT_SUBSTITUTE; /** * @var \Magento\Framework\ZendEscaper From 443f31784c2e9ca769d259ee2e4397e6b5a53039 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 26 Apr 2019 14:44:10 -0500 Subject: [PATCH 109/464] MAGETWO-53347: Char flag update - update existing tests --- .../Magento/Ui/Test/Unit/Component/Control/ButtonTest.php | 2 +- .../Widget/Grid/Column/Renderer/Button/DeleteTest.php | 8 ++++---- .../Widget/Grid/Column/Renderer/Button/EditTest.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php b/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php index bc7c3ac677e10..cb0352386057d 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php @@ -55,7 +55,7 @@ public function testGetType() public function testGetAttributesHtml() { $expected = 'type="button" class="action- scalable classValue disabled" ' - . 'onclick="location.href = \'url2\';" disabled="disabled" data-attributeKey="attributeValue" '; + . 'onclick="location.href = 'url2';" disabled="disabled" data-attributeKey="attributeValue" '; $this->button->setDisabled(true); $this->button->setData('url', 'url2'); $this->button->setData('class', 'classValue'); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php index 92ae76b0d9a4d..c6cc68582ae6b 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/DeleteTest.php @@ -39,8 +39,8 @@ public function testRender() $buttonHtml = $this->deleteButtonBlock->render($integration); $this->assertContains('title="Remove"', $buttonHtml); $this->assertContains( - 'onclick="this.setAttribute(\'data-url\', ' - . '\'http://localhost/index.php/backend/admin/integration/delete/id/' + 'onclick="this.setAttribute('data-url', ' + . ''http://localhost/index.php/backend/admin/integration/delete/id/' . $integration->getId(), $buttonHtml ); @@ -54,8 +54,8 @@ public function testRenderDisabled() $buttonHtml = $this->deleteButtonBlock->render($integration); $this->assertContains('title="Uninstall the extension to remove this integration"', $buttonHtml); $this->assertContains( - 'onclick="this.setAttribute(\'data-url\', ' - . '\'http://localhost/index.php/backend/admin/integration/delete/id/' + 'onclick="this.setAttribute('data-url', ' + . ''http://localhost/index.php/backend/admin/integration/delete/id/' . $integration->getId(), $buttonHtml ); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php index df180d020888a..0463053e6b5f1 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/EditTest.php @@ -40,7 +40,7 @@ public function testRenderEdit() $this->assertContains('title="Edit"', $buttonHtml); $this->assertContains('class="action edit"', $buttonHtml); $this->assertContains( - 'onclick="window.location.href=\'http://localhost/index.php/backend/admin/integration/edit/id/' + 'onclick="window.location.href='http://localhost/index.php/backend/admin/integration/edit/id/' . $integration->getId(), $buttonHtml ); From 2b78c40f89bc3153a2c08b8a83c09ca272f494c8 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 15 May 2019 11:36:05 -0500 Subject: [PATCH 110/464] MAGETWO-53347: Char flag update - add doc block --- app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php b/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php index cb0352386057d..97c77c158c147 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Control/ButtonTest.php @@ -10,6 +10,9 @@ use Magento\Framework\View\Element\Template\Context; use Magento\Ui\Component\Control\Button; +/** + * Class ButtonTest + */ class ButtonTest extends \PHPUnit\Framework\TestCase { /** From eafe18fb5dbf1da131e8d205a56ec8a5e34da0fd Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 15 May 2019 12:36:45 -0500 Subject: [PATCH 111/464] MAGETWO-99479: Use Escaper methods - fix unit --- .../Block/Adminhtml/Template/Grid/Renderer/SenderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php index 219531d8d7b9d..bcb3479d65b47 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/Grid/Renderer/SenderTest.php @@ -81,8 +81,8 @@ public function rendererDataProvider() 'sender_email' => "<br>'email@example.com'</br>", ], [ - 'sender' => "<br>'Sender'</br>", - 'sender_email' => "<br>'email@example.com'</br>", + 'sender' => "<br>'Sender'</br>", + 'sender_email' => "<br>'email@example.com'</br>", ], ], [ From 6974929e7997b923b36f7844c77a5bb9b4cb8879 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Wed, 15 May 2019 12:53:57 -0500 Subject: [PATCH 112/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../view/adminhtml/templates/rate/title.phtml | 2 +- .../adminhtml/templates/rule/rate/form.phtml | 2 +- .../base/templates/pricing/adjustment.phtml | 2 +- .../checkout/cart/item/price/sidebar.phtml | 4 +-- .../templates/checkout/grandtotal.phtml | 18 ++++++---- .../templates/checkout/shipping.phtml | 20 ++++++----- .../templates/checkout/shipping/price.phtml | 4 +-- .../templates/checkout/subtotal.phtml | 18 ++++++---- .../frontend/templates/checkout/tax.phtml | 10 +++--- .../frontend/templates/item/price/row.phtml | 4 +-- .../frontend/templates/item/price/unit.phtml | 5 ++- .../view/frontend/templates/order/tax.phtml | 2 +- .../adminhtml/templates/renderer/tax.phtml | 36 ++++++++++--------- .../base/templates/pricing/adjustment.phtml | 13 ++++--- .../checkout/cart/item/price/sidebar.phtml | 12 +++---- .../review/item/price/row_excl_tax.phtml | 4 +-- .../review/item/price/row_incl_tax.phtml | 4 +-- .../review/item/price/unit_excl_tax.phtml | 4 +-- .../review/item/price/unit_incl_tax.phtml | 4 +-- .../frontend/templates/item/price/row.phtml | 12 +++---- .../frontend/templates/item/price/unit.phtml | 12 +++---- .../_files/whitelist/exempt_modules/ce.php | 2 -- 22 files changed, 105 insertions(+), 89 deletions(-) diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml index 347923dfff773..e63398f32a26a 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml @@ -16,7 +16,7 @@ class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>" type="text" name="title[<?= (int)$_store->getId() ?>]" - value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>" /> + value="<?= $block->escapeHtmlAttr($_labels[$_store->getId()]) ?>" /> </div> </div> <?php endforeach; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml index 6e526d06cbc1e..f09af05303f36 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml @@ -10,7 +10,7 @@ <div class="grid-loader"></div> </div> -<div class="form-inline" id="<?= $block->escapeHtml($block->getNameInLayout()) ?>" style="display:none"> +<div class="form-inline" id="<?= $block->escapeHtmlAttr($block->getNameInLayout()) ?>" style="display:none"> <?= $block->getFormHtml() ?> <?= $block->getChildHtml('form_after') ?> </div> diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml index 775c35d6a0d4a..c49cd989ddd88 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml @@ -9,7 +9,7 @@ <?php if ($block->displayBothPrices()): ?> <span id="<?= /* @noEscape */ $block->buildIdWithPrefix('price-excluding-tax-') ?>" - data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>" + data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>" data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>" data-price-type="basePrice" class="price-wrapper price-excluding-tax"> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index dfa829aac7119..a4181e7918b40 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -8,13 +8,13 @@ ?> <?php $_item = $block->getItem() ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <span class="price-wrapper price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-wrapper price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> </span> <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-wrapper price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-wrapper price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml index 967b6c33d537f..3106ef4f4693b 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml @@ -9,29 +9,33 @@ */ ?> <?php if ($block->includeTax() && $block->getTotalExclTax() >= 0):?> +<?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); +?> <tr class="grand totals excl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <strong><?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?></strong> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Excl. Tax')) ?>"> <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotalExclTax()) ?></strong> </td> </tr> -<?= /* @noEscape */ $block->renderTotals('taxes', $block->getColspan()) ?> +<?= /* @noEscape */ $block->renderTotals('taxes', $colspan) ?> <tr class="grand totals incl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <strong><?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?></strong> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Incl. Tax')) ?>"> <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> <?php else:?> <tr class="grand totals"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <strong><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></strong> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml index c0321543b001f..b0cdec6d4643a 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml @@ -10,38 +10,42 @@ */ ?> <?php if ($block->displayShipping()):?> +<?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); +?> <?php if ($block->displayBoth()):?> <tr class="totals shipping excl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getExcludeTaxLabel()) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getExcludeTaxLabel()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getExcludeTaxLabel()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <tr class="totals shipping incl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getIncludeTaxLabel()) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getIncludeTaxLabel()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getIncludeTaxLabel()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php elseif ($block->displayIncludeTax()) : ?> <tr class="totals shipping incl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php else:?> <tr class="totals shipping excl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml index 5b1be558d4206..af9cf4cf6db45 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml @@ -12,7 +12,7 @@ <span class="price"><?= /* @noEscape */ $_excl ?></span> <?php else: ?> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php endif; ?> <span class="price"><?= /* @noEscape */ $_incl ?></span> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> @@ -20,5 +20,5 @@ <?php endif; ?> <?php endif; ?> <?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"><span class="price"><?= /* @noEscape */ $_excl ?></span></span> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"><span class="price"><?= /* @noEscape */ $_excl ?></span></span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml index b7d6729215f94..1e25ff1aec6a6 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml @@ -9,29 +9,33 @@ * @see \Magento\Tax\Block\Checkout\Subtotal */ ?> -<?php if ($block->displayBoth()):?> +<?php if ($block->displayBoth()) :?> +<?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); +?> <tr class="totals sub excl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Subtotal (Excl. Tax)')) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueExclTax()) ?> </td> </tr> <tr class="totals sub incl"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Subtotal (Incl. Tax)')) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueInclTax()) ?> </td> </tr> <?php else : ?> <tr class="totals sub"> - <th style="<?= /* @noEscape */ $block->getStyle() ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> - <td style="<?= /* @noEscape */ $block->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?> </td> </tr> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml index 7f9a9c71604c9..88d083cf0a563 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml @@ -11,7 +11,7 @@ ?> <?php $_value = $block->getTotal()->getValue(); - $_style = $block->getTotal()->getStyle(); + $_style = $block->escapeHtmlAttr($block->getTotal()->getStyle()); ?> <?php global $taxIter; $taxIter++; ?> @@ -23,14 +23,14 @@ ?> <tr <?= /* @noEscape */ $attributes ?>> - <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= (int)$block->getColspan() ?>" scope="row"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> <span class="detailed"><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></span> <?php else: ?> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> <?php endif;?> </th> - <td style="<?= /* @noEscape */ $_style ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> + <td style="<?= /* @noEscape */ $_style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_value) ?> </td> </tr> @@ -47,7 +47,7 @@ <?php foreach ($rates as $rate): ?> <tr class="totals-tax-details details-<?= /* @noEscape */ $taxIter ?>"> - <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= /* @noEscape */ $block->getColspan() ?>" scope="row"> + <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= (int)$block->getColspan() ?>" scope="row"> <?= $block->escapeHtml($rate['title']) ?> <?php if (!is_null($rate['percent'])): ?> (<?= (float)$rate['percent'] ?>%) @@ -55,7 +55,7 @@ </th> <?php if ($isFirst): ?> <td style="<?= /* @noEscape */ $_style ?>" class="amount" rowspan="<?= count($rates) ?>" - data-th="<?= $block->escapeHtml($rate['title']) ?><?php if (!is_null($rate['percent'])): ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> + data-th="<?= $block->escapeHtmlAttr($rate['title']) ?><?php if (!is_null($rate['percent'])): ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($amount) ?> </td> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml index a667e3b48bfae..f9444d025d56a 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml @@ -9,7 +9,7 @@ $_item = $block->getItem(); ?> <?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($_item->getRowTotalInclTax()) ?> </span> @@ -17,7 +17,7 @@ $_item = $block->getItem(); <?php endif; ?> <?php if (($block->displayPriceExclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?> </span> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml index 9b6aedab15267..e672ad64ba874 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml @@ -8,9 +8,8 @@ $_item = $block->getItem(); ?> - <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($_incl) ?> @@ -19,7 +18,7 @@ $_item = $block->getItem(); <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($block->getItemDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml index e1965905556ab..da3f7a9f9134c 100644 --- a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml @@ -48,7 +48,7 @@ <?= $block->escapeHtml(__('Tax')) ?> <?php endif;?> </th> - <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtml(__('Tax')) ?>"> + <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtmlAttr(__('Tax')) ?>"> <?= /* @noEscape */ $_order->formatPrice($_source->getTaxAmount()) ?> </td> </tr> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index b834c99a3bce1..097cbc8d36b9b 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -14,8 +14,8 @@ $data = ['fptAttribute' => [ 'bundlePriceType' => '#price_type', ]]; ?> -<div id="attribute-<?= $block->getElement()->getHtmlId() ?>-container" class="field" - data-attribute-code="<?= $block->getElement()->getHtmlId() ?>" +<div id="attribute-<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>-container" class="field" + data-attribute-code="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>" data-mage-init="<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data) ?>"> <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> @@ -45,37 +45,41 @@ $data = ['fptAttribute' => [ </div> <script data-role="row-template" type="text/x-magento-template"> - <tr id="<?= $block->getElement()->getHtmlId() ?>_weee_tax_row_<%- data.index %>" data-role="fpt-item-row"> + <?php + $elementName = $block->escapeHtmlAttr($block->getElement()->getName()); + $elementClass = $block->escapeHtmlAttr($block->getElement()->getClass()); + ?> + <tr id="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>_weee_tax_row_<%- data.index %>" data-role="fpt-item-row"> <td class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> - <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_website" - name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][website_id]" - class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> website required-entry" data-role="select-website"> + <select id="<?= /* @noEscape */ $elementName ?>_weee_tax_row_<%- data.index %>_website" + name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][website_id]" + class="<?= /* @noEscape */ $elementClass ?> website required-entry" data-role="select-website"> <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> <option value="<?= /* @noEscape */ $_websiteId ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])): ?>[<?= /* @noEscape */ $_info['currency'] ?>]<?php endif; ?></option> <?php endforeach ?> </select> </td> <td class="col-country"> - <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_country" - name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][country]" - class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> country required-entry" data-role="select-country"> + <select id="<?= /* @noEscape */ $elementName ?>_weee_tax_row_<%- data.index %>_country" + name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][country]" + class="<?= /* @noEscape */ $elementClass ?> country required-entry" data-role="select-country"> <?php foreach ($block->getCountries() as $_country): ?> - <option value="<?= $block->escapeHtml($_country['value']) ?>"><?= $block->escapeHtml($_country['label']) ?></option> + <option value="<?= $block->escapeHtmlAttr($_country['value']) ?>"><?= $block->escapeHtml($_country['label']) ?></option> <?php endforeach ?> </select> - <select id="<?= $block->escapeHtml($block->getElement()->getName()) ?>_weee_tax_row_<%- data.index %>_state" - name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][state]" - class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> state" disabled="" data-role="select-state"> + <select id="<?= /* @noEscape */ $elementName ?>_weee_tax_row_<%- data.index %>_state" + name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][state]" + class="<?= /* @noEscape */ $elementClass ?> state" disabled="" data-role="select-state"> <option value="0">*</option> </select> </td> <td class="col-tax"> - <input name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][price]" - class="<?= $block->escapeHtml($block->getElement()->getClass()) ?> required-entry validate-greater-than-zero" + <input name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][price]" + class="<?= /* @noEscape */ $elementClass ?> required-entry validate-greater-than-zero" type="text" value="<%- data.value %>"/> </td> <td class="col-action"> - <input name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[<%- data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> + <input name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> <?= $block->getChildHtml('delete_button') ?> </td> </tr> diff --git a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml index 5e0510bbcfd16..01f003246e8f9 100644 --- a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml @@ -17,24 +17,27 @@ $priceDisplay = $block->isPriceIncludesTax(); <?php if ($block->showInclDescr() || $block->showExclDescrIncl()): // incl. + weee || excl. + weee + final ?> <?php foreach ($block->getWeeeTaxAttributes() as $weeeTaxAttribute): ?> + <?php + $attributeName = $block->escapeHtmlAttr($block->renderWeeeTaxAttributeName($weeeTaxAttribute)); + ?> <?php if ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX): ?> <span class="weee" data-price-type="weee" - data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute)) ?>"> + data-label="<?= /* @noEscape */ $attributeName ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX): ?> <span class="weee" data-price-type="weee" - data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute)) ?>"> + data-label="<?= /* @noEscape */ $attributeName ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH): ?> <span class="weee" data-price-type="weee" - data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' ' . __('Incl. Tax')) ?>"> + data-label="<?= /* @noEscape */ $attributeName . ' ' . $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> <span class="weee" data-price-type="weee" - data-label="<?= $block->escapeHtml($block->renderWeeeTaxAttributeName($weeeTaxAttribute) . ' ' . __('Excl. Tax')) ?>"> + data-label="<?= /* @noEscape */ $attributeName . ' ' . $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> <?php endif; ?> <?php endforeach; ?> @@ -44,5 +47,5 @@ $priceDisplay = $block->isPriceIncludesTax(); <span class="price-final price-final_price" data-price-type="weeePrice" data-price-amount="<?= /* @noEscape */ $block->getRawFinalAmount() ?>" - data-label="<?= $block->escapeHtml(__('Final Price')) ?>"><?= /* @noEscape */ $block->getFinalAmount() ?></span> + data-label="<?= $block->escapeHtmlAttr(__('Final Price')) ?>"><?= /* @noEscape */ $block->getFinalAmount() ?></span> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index 2204add57b4c8..8bb545d0f535e 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -14,7 +14,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="minicart-tax-total"> <?php else: ?> @@ -27,7 +27,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <span class="minicart-tax-info"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> @@ -35,7 +35,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($block->displayFinalPrice()): ?> <span class="minicart-tax-total"> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> @@ -46,7 +46,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="minicart-tax-total"> <?php else: ?> @@ -59,7 +59,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <span class="minicart-tax-info"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> @@ -67,7 +67,7 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); <?php if ($block->displayFinalPrice()): ?> <span class="minicart-tax-total"> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml index 70066211b320e..ad98039519cea 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -20,14 +20,14 @@ $_item = $block->getItem(); <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml index 8de3696092bf6..e0513f522a770 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -23,14 +23,14 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); <span class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml index 5aafda7e7d9b4..cf2693842b8d3 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -21,14 +21,14 @@ $_item = $block->getItem(); <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$_item->getId() ?>" style="display:none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml index 3b33066bc3c28..b4389dea160c3 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -24,14 +24,14 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml index a3baea35e1211..c78cb30dd9d56 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -9,7 +9,7 @@ $item = $block->getItem(); ?> <?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$item->getNoSubtotal()): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> @@ -22,7 +22,7 @@ $item = $block->getItem(); <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <div class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> @@ -31,7 +31,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> </span> @@ -41,7 +41,7 @@ $item = $block->getItem(); <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> @@ -55,7 +55,7 @@ $item = $block->getItem(); <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?> </span> <?php endforeach; ?> @@ -64,7 +64,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml index 9e61515783dd1..5b50c82255b3a 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -9,7 +9,7 @@ $item = $block->getItem(); ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> @@ -22,7 +22,7 @@ $item = $block->getItem(); <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> @@ -31,7 +31,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> </span> @@ -41,7 +41,7 @@ $item = $block->getItem(); <?php endif; ?> <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> + <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> @@ -55,7 +55,7 @@ $item = $block->getItem(); <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> - <span class="weee" data-label="<?= $block->escapeHtml($tax['title']) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> @@ -64,7 +64,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()): ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> - <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>"> + <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> </span> diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php index 0d99320b15e7f..5e39e37286fe1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php @@ -41,11 +41,9 @@ 'Magento_Store', 'Magento_Swagger', 'Magento_Swatches', - 'Magento_Tax', 'Magento_TaxImportExport', 'Magento_Theme', 'Magento_Translation', 'Magento_Ui', 'Magento_User', - 'Magento_Weee', ]; From ba4eb3c4046c6d62f3dc1fc29bba75703c04e0a2 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 15 May 2019 14:25:06 -0500 Subject: [PATCH 113/464] MAGETWO-99479: Use Escaper methods - fix unit - fix static --- .../Block/Adminhtml/Queue/PreviewTest.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php index 3fc97d2ee9fbd..b64453594df41 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php @@ -81,15 +81,17 @@ protected function setUp() $queueFactory->expects($this->any())->method('create')->will($this->returnValue($this->queue)); $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManager->getObject(\Magento\Framework\Escaper::class); + $context->expects($this->once())->method('getEscaper')->willReturn($escaper); + $this->preview = $this->objectManager->getObject( \Magento\Newsletter\Block\Adminhtml\Queue\Preview::class, [ 'context' => $context, 'templateFactory' => $templateFactory, 'subscriberFactory' => $subscriberFactory, - 'queueFactory' => $queueFactory, - 'escaper' => $escaper + 'queueFactory' => $queueFactory ] ); } @@ -105,12 +107,14 @@ public function testToHtmlEmpty() public function testToHtmlWithId() { - $this->request->expects($this->any())->method('getParam')->will($this->returnValueMap( - [ - ['id', null, 1], - ['store_id', null, 0] - ] - )); + $this->request->expects($this->any())->method('getParam')->will( + $this->returnValueMap( + [ + ['id', null, 1], + ['store_id', null, 0] + ] + ) + ); $this->queue->expects($this->once())->method('load')->will($this->returnSelf()); $this->template->expects($this->any())->method('isPlain')->will($this->returnValue(true)); /** @var \Magento\Store\Model\Store $store */ From bc4fa9d5c8d3357fb0b91e1cd43d169164df2246 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Wed, 15 May 2019 14:31:25 -0500 Subject: [PATCH 114/464] MAGETWO-55101: Use escaper methods - refactored to use escaper methods --- .../Config/view/adminhtml/templates/system/config/tabs.phtml | 4 ++-- .../templates/widget/compared/content/compared_grid.phtml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml index 54e6fb21111ef..ca207f66b8fee 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml @@ -8,7 +8,7 @@ ?> <?php if ($block->getTabs()): ?> - <div id="<?= $block->getId() ?>" class="config-nav"> + <div id="<?= $block->escapeHtml($block->getId()) ?>" class="config-nav"> <?php /** @var $_tab \Magento\Config\Model\Config\Structure\Element\Tab */ foreach ($block->getTabs() as $_tab): @@ -27,7 +27,7 @@ <?php if ($_tab->getClass()): ?> <?= $block->escapeHtml($_tab->getClass()) ?> <?php endif ?>" - data-mage-init='{"collapsible":{"active": "<?= $activeCollapsible ?>", + data-mage-init='{"collapsible":{"active": "<?= $block->escapeHtml($activeCollapsible) ?>", "openedState": "_show", "closedState": "_hide", "collapsible": true, diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index c8a55bd628083..dbf8d4a5f9869 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -35,13 +35,13 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php foreach ($items as $_item): ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= $block->escapeUrl(block->getProductUrl($_item)) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /$block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> From f4decd5268c491ee88f41adb0a23ad7e7ee80351 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Wed, 15 May 2019 14:39:37 -0500 Subject: [PATCH 115/464] MAGETWO-99664: Fix Unrelated Static Test Failures - fix static test failures --- .../adminhtml/templates/toolbar_entry.phtml | 68 +++++++++---------- .../templates/system/config/tabs.phtml | 28 +++----- .../system/currency/rate/matrix.phtml | 29 ++++---- .../view/adminhtml/templates/grid.phtml | 60 ++++++++-------- .../adminhtml/templates/report/wishlist.phtml | 21 ++---- .../adminhtml/templates/store/switcher.phtml | 18 ++--- .../templates/store/switcher/enhanced.phtml | 20 +++--- .../product/widget/viewed/item.phtml | 23 +++---- .../column/compared_default_list.phtml | 18 ++--- .../column/compared_images_list.phtml | 4 +- .../compared/column/compared_names_list.phtml | 4 +- .../compared/content/compared_grid.phtml | 30 ++++---- .../compared/content/compared_list.phtml | 32 ++++----- .../viewed/column/viewed_default_list.phtml | 18 ++--- .../viewed/column/viewed_images_list.phtml | 4 +- .../viewed/column/viewed_names_list.phtml | 4 +- .../widget/viewed/content/viewed_grid.phtml | 30 ++++---- .../widget/viewed/content/viewed_list.phtml | 32 ++++----- 18 files changed, 214 insertions(+), 229 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml index e16c47f0ca0fc..63fb0b6fce7fd 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml @@ -28,40 +28,40 @@ class="admin__action-dropdown-menu" data-mark-as-read-url="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/ajaxMarkAsRead')) ?>"> <?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?> - <?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?> - <li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>" - data-notification-id="<?= $block->escapeHtml($notification->getId()) ?>" - data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>"> - <?php - $notificationDescription = $notification->getDescription(); - $notificationDescriptionLength = $block->getNotificationDescriptionLength(); - ?> - <strong class="notifications-entry-title"> - <?= $block->escapeHtml($notification->getTitle()) ?> - </strong> - <?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?> - <p class="notifications-entry-description _cutted"> - <span class="notifications-entry-description-start"> - <?= $block->escapeHtml(substr($notificationDescription, 0, $notificationDescriptionLength)) ?> - </span> - <span class="notifications-entry-description-end"> - <?= $block->escapeHtml(substr($notificationDescription, $notificationDescriptionLength)) ?> - </span> - </p> - <?php else : ?> - <p class="notifications-entry-description"> - <?= $block->escapeHtml($notificationDescription) ?> - </p> - <?php endif; ?> - <time class="notifications-entry-time"> - <?= $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())) ?> - </time> - <button - type="button" - class="notifications-close" - title="<?= $block->escapeHtml(__('Close')) ?>" - ></button> - </li> + <?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?> + <li class="notifications-entry<?php if ($notification->getSeverity() == 1) : ?> notifications-critical<?php endif; ?>" + data-notification-id="<?= $block->escapeHtml($notification->getId()) ?>" + data-notification-severity="<?php if ($notification->getSeverity() == 1) : ?>1<?php endif; ?>"> + <?php + $notificationDescription = $notification->getDescription(); + $notificationDescriptionLength = $block->getNotificationDescriptionLength(); + ?> + <strong class="notifications-entry-title"> + <?= $block->escapeHtml($notification->getTitle()) ?> + </strong> + <?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?> + <p class="notifications-entry-description _cutted"> + <span class="notifications-entry-description-start"> + <?= $block->escapeHtml(substr($notificationDescription, 0, $notificationDescriptionLength)) ?> + </span> + <span class="notifications-entry-description-end"> + <?= $block->escapeHtml(substr($notificationDescription, $notificationDescriptionLength)) ?> + </span> + </p> + <?php else : ?> + <p class="notifications-entry-description"> + <?= $block->escapeHtml($notificationDescription) ?> + </p> + <?php endif; ?> + <time class="notifications-entry-time"> + <?= $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())) ?> + </time> + <button + type="button" + class="notifications-close" + title="<?= $block->escapeHtml(__('Close')) ?>" + ></button> + </li> <?php endforeach; ?> <li class="notifications-entry notifications-entry-last"> <a diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml index ca207f66b8fee..8967fc0ed8cda 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml @@ -7,24 +7,20 @@ /** @var $block \Magento\Config\Block\System\Config\Tabs */ ?> -<?php if ($block->getTabs()): ?> +<?php if ($block->getTabs()) : ?> <div id="<?= $block->escapeHtml($block->getId()) ?>" class="config-nav"> <?php /** @var $_tab \Magento\Config\Model\Config\Structure\Element\Tab */ - foreach ($block->getTabs() as $_tab): - ?> - - <?php - $activeCollapsible = false; - foreach ($_tab->getChildren() as $_section) { - if ($block->isSectionActive($_section)) { - $activeCollapsible = true; - } + foreach ($block->getTabs() as $_tab) : + $activeCollapsible = false; + foreach ($_tab->getChildren() as $_section) { + if ($block->isSectionActive($_section)) { + $activeCollapsible = true; } - ?> + } ?> <div class="config-nav-block admin__page-nav _collapsed - <?php if ($_tab->getClass()): ?> + <?php if ($_tab->getClass()) : ?> <?= $block->escapeHtml($_tab->getClass()) ?> <?php endif ?>" data-mage-init='{"collapsible":{"active": "<?= $block->escapeHtml($activeCollapsible) ?>", @@ -40,10 +36,10 @@ <?php $_iterator = 1; ?> <?php /** @var $_section \Magento\Config\Model\Config\Structure\Element\Section */ - foreach ($_tab->getChildren() as $_section): ?> + foreach ($_tab->getChildren() as $_section) : ?> <li class="admin__page-nav-item item <?= $block->escapeHtml($_section->getClass()) ?> - <?php if ($block->isSectionActive($_section)): ?> _active<?php endif ?> + <?php if ($block->isSectionActive($_section)) : ?> _active<?php endif ?> <?= $_tab->getChildren()->isLast($_section) ? ' _last' : '' ?>"> <a href="<?= $block->escapeUrl($block->getSectionUrl($_section)) ?>" class="admin__page-nav-link item-nav"> @@ -55,8 +51,6 @@ </ul> </div> - <?php - endforeach; - ?> + <?php endforeach; ?> </div> <?php endif; ?> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml index fc1825dc55477..ecbd772b05920 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml @@ -3,20 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -?> -<?php + /** * @var $block \Magento\CurrencySymbol\Block\Adminhtml\System\Currency\Rate\Matrix */ -?> -<?php + $_oldRates = $block->getOldRates(); $_newRates = $block->getNewRates(); $_rates = ($_newRates) ? $_newRates : $_oldRates; ?> -<?php if (empty($_rates)): ?> +<?php if (empty($_rates)) : ?> <div class="message message-warning warning"><p><?= $block->escapeHtml(__('You must first configure currency options before being able to see currency rates.')) ?></p></div> -<?php else: ?> +<?php else : ?> <form name="rateForm" id="rate-form" method="post" action="<?= $block->escapeUrl($block->getRatesFormAction()) ?>"> <?= $block->getBlockHtml('formkey') ?> <div class="admin__control-table-wrapper"> @@ -24,16 +22,16 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; <thead> <tr> <th> </th> - <?php $_i = 0; foreach ($block->getAllowedCurrencies() as $_currencyCode): ?> + <?php $_i = 0; foreach ($block->getAllowedCurrencies() as $_currencyCode) : ?> <th><span><?= $block->escapeHtml($_currencyCode) ?></span></th> <?php endforeach; ?> </tr> </thead> - <?php $_j = 0; foreach ($block->getDefaultCurrencies() as $_currencyCode): ?> + <?php $_j = 0; foreach ($block->getDefaultCurrencies() as $_currencyCode) : ?> <tr> - <?php if (isset($_rates[$_currencyCode]) && is_array($_rates[$_currencyCode])): ?> - <?php foreach ($_rates[$_currencyCode] as $_rate => $_value): ?> - <?php if (++$_j == 1): ?> + <?php if (isset($_rates[$_currencyCode]) && is_array($_rates[$_currencyCode])) : ?> + <?php foreach ($_rates[$_currencyCode] as $_rate => $_value) : ?> + <?php if (++$_j == 1) : ?> <td><span class="admin__control-support-text"><?= $block->escapeHtml($_currencyCode) ?></span></td> <td> <input type="text" @@ -41,23 +39,24 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> - <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?> + <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])) : ?> <div class="admin__field-note"><?= $block->escapeHtml(__('Old rate:')) ?> <strong><?= $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) ?></strong></div> <?php endif; ?> </td> - <?php else: ?> + <?php else : ?> <td> <input type="text" name="rate[<?= $block->escapeHtml($_currencyCode) ?>][<?= $block->escapeHtml($_rate) ?>]" value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> - <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?> + <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])) : ?> <div class="admin__field-note"><?= $block->escapeHtml(__('Old rate:')) ?> <strong><?= $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) ?></strong></div> <?php endif; ?> </td> <?php endif; ?> - <?php endforeach; $_j = 0; ?> + <?php endforeach; ?> + <?php $_j = 0; ?> <?php endif; ?> </tr> <?php endforeach; ?> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml index 4a636fa066e90..b5584d25f322b 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml @@ -6,18 +6,18 @@ ?> <?php /** @var $block \Magento\Reports\Block\Adminhtml\Grid */ -$numColumns = sizeof($block->getColumns()); +$numColumns = count($block->getColumns()); ?> -<?php if ($block->getCollection()): ?> - <?php if ($block->canDisplayContainer()): ?> +<?php if ($block->getCollection()) : ?> + <?php if ($block->canDisplayContainer()) : ?> <div id="<?= $block->escapeHtml($block->getId()) ?>"> - <?php else: ?> + <?php else : ?> <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> - <?php if ($block->getStoreSwitcherVisibility() || $block->getDateFilterVisibility()): ?> + <?php if ($block->getStoreSwitcherVisibility() || $block->getDateFilterVisibility()) : ?> <div class="admin__data-grid-header admin__data-grid-toolbar"> <div class="admin__data-grid-header-row"> - <?php if ($block->getDateFilterVisibility()): ?> + <?php if ($block->getDateFilterVisibility()) : ?> <div class="admin__filter-actions" data-role="filter-form" id="<?= $block->escapeHtml($block->getSuffixId('period_date_range')) ?>"> <span class="field-row"> <label for="<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" @@ -51,8 +51,8 @@ $numColumns = sizeof($block->getColumns()); <span><?= $block->escapeHtml(__('Show By')) ?>:</span> </label> <select name="report_period" id="<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>" class="admin__control-select"> - <?php foreach ($block->getPeriods() as $_value => $_label): ?> - <option value="<?= $block->escapeHtml($_value) ?>" <?php if ($block->getFilter('report_period') == $_value): ?> selected<?php endif; ?>><?= $block->escapeHtml($_label) ?></option> + <?php foreach ($block->getPeriods() as $_value => $_label) : ?> + <option value="<?= $block->escapeHtml($_value) ?>" <?php if ($block->getFilter('report_period') == $_value) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_label) ?></option> <?php endforeach; ?> </select> <?= $block->getRefreshButtonHtml() ?> @@ -77,7 +77,7 @@ $numColumns = sizeof($block->getColumns()); </script> </div> <?php endif; ?> - <?php if ($block->getChildBlock('grid.export')): ?> + <?php if ($block->getChildBlock('grid.export')) : ?> <?= $block->getChildHtml('grid.export') ?> <?php endif; ?> </div> @@ -89,7 +89,7 @@ $numColumns = sizeof($block->getColumns()); </table> </div> </div> - <?php if ($block->canDisplayContainer()): ?> + <?php if ($block->canDisplayContainer()) : ?> <script> require([ "jquery", @@ -100,28 +100,30 @@ $numColumns = sizeof($block->getColumns()); //<![CDATA[ <?= $block->escapeHtml($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= $block->escapeUrl($block->getGridUrl()) ?>', '<?= $block->escapeHtml($block->getVarNamePage()) ?>', '<?= $block->escapeHtml($block->getVarNameSort()) ?>', '<?= $block->escapeHtml($block->getVarNameDir()) ?>', '<?= $block->escapeHtml($block->getVarNameFilter()) ?>'); - <?= $block->escapeHtml($block->getJsObjectName()) ?>.useAjax = '<?php if ($block->getUseAjax()): echo $block->escapeHtml($block->getUseAjax()); endif; ?>'; - <?php if ($block->getDateFilterVisibility()): ?> - <?= $block->escapeHtml($block->getJsObjectName()) ?>.doFilterCallback = validateFilterDate; - var period_date_from = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>'); - var period_date_to = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>'); - period_date_from.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>'); - period_date_to.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>'); + <?= $block->escapeHtml($block->getJsObjectName()) ?>.useAjax = '<?php if ($block->getUseAjax()) : + echo $block->escapeHtml($block->getUseAjax()); + endif; ?>'; + <?php if ($block->getDateFilterVisibility()) : ?> + <?= $block->escapeHtml($block->getJsObjectName()) ?>.doFilterCallback = validateFilterDate; + var period_date_from = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>'); + var period_date_to = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>'); + period_date_from.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>'); + period_date_to.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>'); - var validateFilterDate = function() { - if (period_date_from && period_date_to) { - var valid = true; - jQuery(period_date_from).add(period_date_to).each(function() { - valid = Validation.validate(this) && valid; - }); - return valid; - } - else { - return true; + var validateFilterDate = function() { + if (period_date_from && period_date_to) { + var valid = true; + jQuery(period_date_from).add(period_date_to).each(function() { + valid = Validation.validate(this) && valid; + }); + return valid; + } + else { + return true; + } } - } <?php endif;?> - <?php if ($block->getStoreSwitcherVisibility()): ?> + <?php if ($block->getStoreSwitcherVisibility()) : ?> /* Overwrite function from switcher.phtml widget*/ switchStore = function(obj) { if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') { diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml index 7cfd4022dd6b4..c7ed650019a8e 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml @@ -7,22 +7,13 @@ <?= $block->getChildHtml('grid') ?> <div class="switcher f-left" style="margin: 10px 10px 10px 0px; padding:15px;"> -<?php - echo $block->escapeHtml(__('Customers that have Wish List: %1', $block->getCustomerWithWishlist())) -?> +<?= $block->escapeHtml(__('Customers that have Wish List: %1', $block->getCustomerWithWishlist())) ?> </div> <div class="switcher" style="float: right; margin: 10px 0px 10px 10px; padding:15px;"> - <?php - echo $block->escapeHtml(__('Number of Wish Lists: %1', $block->getWishlistsCount())) - ?><br /> - <?php - echo $block->escapeHtml(__('Number of items bought from a Wish List: %1', $block->getItemsBought())) - ?><br /> - <?php echo $block->escapeHtml(__('Number of times Wish Lists have been shared (emailed): %1', $block->getSharedCount())) - ?><br /> - <?php echo $block->escapeHtml(__('Number of Wish List referrals: %1', $block->getReferralsCount())) - ?><br /> - <?php echo $block->escapeHtml(__('Number of Wish List conversions: %1', $block->getConversionsCount())) - ?><br /> + <?= $block->escapeHtml(__('Number of Wish Lists: %1', $block->getWishlistsCount())) ?><br /> + <?= $block->escapeHtml(__('Number of items bought from a Wish List: %1', $block->getItemsBought())) ?><br /> + <?= $block->escapeHtml(__('Number of times Wish Lists have been shared (emailed): %1', $block->getSharedCount())) ?><br /> + <?= $block->escapeHtml(__('Number of Wish List referrals: %1', $block->getReferralsCount())) ?><br /> + <?= $block->escapeHtml(__('Number of Wish List conversions: %1', $block->getConversionsCount())) ?><br /> </div> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml index cad73c762476c..ae329b9e098a7 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml @@ -8,7 +8,7 @@ * @see \Magento\Backend\Block\Store\Switcher */ ?> -<?php if ($block->isShow()): ?> +<?php if ($block->isShow()) : ?> <div class="field field-store-switcher"> <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Show Report For:')) ?></label> <div class="control"> @@ -18,22 +18,22 @@ name="store_switcher" onchange="return switchStore(this);"> <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) : ?> <?php $showWebsite = false; ?> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <?php foreach ($block->getGroupCollection($_website) as $_group) : ?> <?php $showGroup = false; ?> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> - <?php if ($showWebsite == false): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) : ?> + <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= $block->escapeHtml($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected<?php endif; ?>> + <option website="true" value="<?= $block->escapeHtml($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()) : ?> selected<?php endif; ?>> <?= $block->escapeHtml($_website->getName()) ?> </option> <?php endif; ?> - <?php if ($showGroup == false): ?> + <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <option group="true" value="<?= $block->escapeHtml($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= $block->escapeHtml($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml index e2d35171883b4..04c819407ceb1 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml @@ -13,7 +13,7 @@ */ ?> -<?php if ($block->isShow()): ?> +<?php if ($block->isShow()) : ?> <div class="field field-store-switcher"> <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Show Report For:')) ?></label> <div class="control"> @@ -23,22 +23,22 @@ name="store_switcher" onchange="return switchStore(this);"> <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) : ?> <?php $showWebsite = false; ?> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <?php foreach ($block->getGroupCollection($_website) as $_group) : ?> <?php $showGroup = false; ?> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> - <?php if ($showWebsite == false): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) : ?> + <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= implode(',', $block->escapeHtml($_website->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())): ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> + <option website="true" value="<?= $block->escapeHtml(implode(',', $_website->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> <?php endif; ?> - <?php if ($showGroup == false): ?> + <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <option group="true" value="<?= implode(',', $block->escapeHtml($_group->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())): ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= $block->escapeHtml(implode(',', $_group->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> - <?php if ($showGroup): ?> + <?php if ($showGroup) : ?> </optgroup> <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index f0e3704264353..fbe9f191a592d 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -3,10 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + /* @var $block \Magento\Reports\Block\Product\Widget\Viewed\Item */ -?> -<?php $type = $block->getType() . '-' . $block->getViewMode(); $item = $block->getProduct(); @@ -26,7 +25,7 @@ $rating = 'short'; <?= $block->escapeHtml($item->getName()) ?></a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -35,18 +34,18 @@ $rating = 'short'; ] )) ?> - <?php if ($rating): ?> + <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($item, $rating) ?> <?php endif; ?> <div class="product actions"> <div class="primary"> - <?php if ($item->isSaleable()): ?> - <?php if ($item->getTypeInstance()->hasRequiredOptions($item)): ?> + <?php if ($item->isSaleable()) : ?> + <?php if ($item->getTypeInstance()->hasRequiredOptions($item)) : ?> <button class="action tocart" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($item), ['product' => $item->getEntityId()]) ?> @@ -56,22 +55,22 @@ $rating = 'short'; <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($item->getIsSalable()): ?> + <?php else : ?> + <?php if ($item->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <div class="secondary-addto-links" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()): ?> + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> <a href="#" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($item)) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl()): ?> + <?php if ($block->getAddToCompareUrl()) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index 1c9154512c434..5894891862633 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -22,7 +22,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { $description = false; } ?> -<?php if ($exist): ?> +<?php if ($exist) : ?> <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> @@ -30,7 +30,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> <ol class="product-items" id="widget-compared-<?= $block->escapeHtml($suffix) ?>"> - <?php foreach ($items as $_product): ?> + <?php foreach ($items as $_product) : ?> <li class="product-item"> <div class="product-item-info"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" @@ -44,7 +44,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -53,15 +53,15 @@ if ($exist = $block->getRecentlyComparedProducts()) { ] )) ?> <div class="product-item-actions"> - <?php if ($_product->isSaleable()): ?> + <?php if ($_product->isSaleable()) : ?> <div class="actions-primary"> - <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) @@ -73,10 +73,10 @@ if ($exist = $block->getRecentlyComparedProducts()) { </button> <?php endif; ?> </div> - <?php else: ?> - <?php if ($_product->getIsSalable()): ?> + <?php else : ?> + <?php if ($_product->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml index e94c205c858d7..b1a86d9e3e9c4 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml @@ -19,14 +19,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { $description = false; } ?> -<?php if ($exist): ?> +<?php if ($exist) : ?> <div class="block widget block-compared-products-images"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-images"> - <?php $i = 0; foreach ($items as $_product): ?> + <?php $i = 0; foreach ($items as $_product) : ?> <li class="product-item"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml index c945169a165dd..16971b8dc6b87 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml @@ -4,14 +4,14 @@ * See COPYING.txt for license details. */ ?> -<?php if ($_products = $block->getRecentlyComparedProducts()): ?> +<?php if ($_products = $block->getRecentlyComparedProducts()) : ?> <div class="block widget block-compared-products-names"> <div class="block-title"> <strong><?= $block->escapeHtml(__('Recently Compared')) ?></span></strong> </div> <div class="block-content"> <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-names"> - <?php $i = 0; foreach ($_products as $_product): ?> + <?php $i = 0; foreach ($_products as $_product) : ?> <li class="product-item"> <strong class="product-item-name"> <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product-item-link"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index dbf8d4a5f9869..470d9a69eee14 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -23,7 +23,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { } ?> -<?php if ($exist):?> +<?php if ($exist) : ?> <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> @@ -32,7 +32,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> <ol class="product-items <?= $block->escapeHtml($type)?>"> - <?php foreach ($items as $_item): ?> + <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> @@ -45,7 +45,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -53,21 +53,21 @@ if ($exist = $block->getRecentlyComparedProducts()) { 'price_id_suffix' => '-' . $type ] )) ?> - <?php if ($rating): ?> + <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) : ?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) : ?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <?php if ($_item->isSaleable()) : ?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) @@ -78,19 +78,19 @@ if ($exist = $block->getRecentlyComparedProducts()) { <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> + <?php else : ?> + <?php if ($_item->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) : ?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" @@ -99,7 +99,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index 2200926a75dfe..bca2b9fbb5c5f 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -24,7 +24,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { } ?> -<?php if ($exist):?> +<?php if ($exist) : ?> <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> @@ -33,7 +33,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> <ol class="product-items <?= $block->escapeHtml($type) ?>"> - <?php foreach ($items as $_item): ?> + <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> <a href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" class="product-item-photo"> @@ -46,7 +46,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -54,21 +54,21 @@ if ($exist = $block->getRecentlyComparedProducts()) { 'price_id_suffix' => '-' . $type ] )) ?> - <?php if ($rating): ?> + <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) : ?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) : ?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <?php if ($_item->isSaleable()) : ?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtml($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) @@ -79,19 +79,19 @@ if ($exist = $block->getRecentlyComparedProducts()) { <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> + <?php else : ?> + <?php if ($_item->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) : ?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" @@ -100,7 +100,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' @@ -112,7 +112,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php endif; ?> </div> <?php endif; ?> - <?php if ($description):?> + <?php if ($description) : ?> <div class="product-item-description"> <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> <a title="<?= $block->escapeHtml($_item->getName()) ?>" diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index 9b8ac733f65d0..c4a2879820d77 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -26,7 +26,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $description = false; } ?> -<?php if ($exist): ?> +<?php if ($exist) : ?> <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> @@ -34,7 +34,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> <ol class="product-items" id="widget-viewed-<?= $block->escapeHtml($suffix) ?>"> - <?php foreach ($items as $_product): ?> + <?php foreach ($items as $_product) : ?> <li class="product-item"> <div class="product-item-info"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" @@ -49,7 +49,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -58,15 +58,15 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ] )) ?> <div class="product-item-actions"> - <?php if ($_product->isSaleable()): ?> + <?php if ($_product->isSaleable()) : ?> <div class="actions-primary"> - <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); @@ -76,10 +76,10 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr </button> <?php endif; ?> </div> - <?php else: ?> - <?php if ($_product->getIsSalable()): ?> + <?php else : ?> + <?php if ($_product->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index 70d0ec68708a4..1c7c84af00d9f 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -23,7 +23,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $description = false; } ?> -<?php if ($exist): ?> +<?php if ($exist) : ?> <div class="block widget block-viewed-products-images"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> @@ -31,7 +31,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-images"> - <?php foreach ($items as $_product): ?> + <?php foreach ($items as $_product) : ?> <li class="product-item"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml index f4a6a8a2ac372..11e99f3d9e2ab 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml @@ -8,7 +8,7 @@ * @var $block \Magento\Reports\Block\Product\Viewed */ ?> -<?php if (($_products = $block->getRecentlyViewedProducts()) && $_products->getSize()): ?> +<?php if (($_products = $block->getRecentlyViewedProducts()) && $_products->getSize()) : ?> <div class="block widget block-viewed-products-names"> <div class="block-title"> <strong><?= $block->escapeHtml(__('Recently Viewed')) ?></strong> @@ -16,7 +16,7 @@ <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-names"> - <?php foreach ($_products as $_product): ?> + <?php foreach ($_products as $_product) : ?> <li class="product-item"> <strong class="product-item-name"> <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product-item-link"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index 414e08bafc8aa..766ea64d5c952 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -26,7 +26,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $description = ($mode == 'list') ? true : false; } ?> -<?php if ($exist):?> +<?php if ($exist) : ?> <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> @@ -35,7 +35,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> <ol class="product-items <?= $block->escapeHtml($type) ?>"> - <?php foreach ($items as $_item): ?> + <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> @@ -48,7 +48,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -56,21 +56,21 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr 'price_id_suffix' => '-' . $type ] )) ?> - <?php if ($rating): ?> + <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) : ?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) : ?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <?php if ($_item->isSaleable()) : ?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) @@ -81,18 +81,18 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> + <?php else : ?> + <?php if ($_item->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) : ?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' @@ -100,7 +100,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index 981da1a6bfe9d..f16620ad3aa8b 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -28,7 +28,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr } ?> -<?php if ($exist):?> +<?php if ($exist) : ?> <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> @@ -37,7 +37,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> <ol class="product-items <?= $block->escapeHtml($type) ?>"> - <?php foreach ($items as $_item): ?> + <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> @@ -50,7 +50,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php echo $block->escapeHtml($block->getProductPriceHtml( + <?= $block->escapeHtml($block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, @@ -58,21 +58,21 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr 'price_id_suffix' => '-' . $type ] )) ?> - <?php if ($rating): ?> + <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) : ?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) : ?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <?php if ($_item->isSaleable()) : ?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else : ?> <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); @@ -83,19 +83,19 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> + <?php else : ?> + <?php if ($_item->getIsSalable()) : ?> <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> - <?php else: ?> + <?php else : ?> <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) : ?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' @@ -103,7 +103,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' @@ -115,7 +115,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php endif; ?> </div> <?php endif; ?> - <?php if ($description):?> + <?php if ($description) : ?> <div class="product-item-description"> <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> <a title="<?= $block->escapeHtml($_item->getName()) ?>" From da6bebfc3265a12efe64ea055662947caabf4638 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 15 May 2019 14:49:03 -0500 Subject: [PATCH 116/464] MAGETWO-99479: Use Escaper methods - fix static --- .../Test/Unit/Model/Template/FilterTest.php | 36 +++++----- .../Block/Adminhtml/Template/PreviewTest.php | 7 +- app/code/Magento/Sitemap/Model/Sitemap.php | 68 +++++++++++-------- .../Sitemap/Test/Unit/Model/SitemapTest.php | 66 ++++++++++-------- 4 files changed, 98 insertions(+), 79 deletions(-) diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php index eac7008da4511..2c9fdae111fd8 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php @@ -156,23 +156,25 @@ protected function setUp() protected function getModel($mockedMethods = null) { return $this->getMockBuilder(\Magento\Email\Model\Template\Filter::class) - ->setConstructorArgs([ - $this->string, - $this->logger, - $this->escaper, - $this->assetRepo, - $this->scopeConfig, - $this->coreVariableFactory, - $this->storeManager, - $this->layout, - $this->layoutFactory, - $this->appState, - $this->backendUrlBuilder, - $this->emogrifier, - $this->configVariables, - [], - $this->cssInliner, - ]) + ->setConstructorArgs( + [ + $this->string, + $this->logger, + $this->escaper, + $this->assetRepo, + $this->scopeConfig, + $this->coreVariableFactory, + $this->storeManager, + $this->layout, + $this->layoutFactory, + $this->appState, + $this->backendUrlBuilder, + $this->emogrifier, + $this->configVariables, + [], + $this->cssInliner, + ] + ) ->setMethods($mockedMethods) ->getMock(); } diff --git a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php index 4fc2bcc732088..87fbca55e154e 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Template/PreviewTest.php @@ -39,7 +39,9 @@ protected function setUp() $this->request = $this->createMock(\Magento\Framework\App\RequestInterface::class); $this->appState = $this->createMock(\Magento\Framework\App\State::class); $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); - $this->template = $this->createPartialMock(\Magento\Newsletter\Model\Template::class, [ + $this->template = $this->createPartialMock( + \Magento\Newsletter\Model\Template::class, + [ 'setTemplateType', 'setTemplateText', 'setTemplateStyles', @@ -48,7 +50,8 @@ protected function setUp() 'revertDesign', 'getProcessedTemplate', 'load' - ]); + ] + ); $templateFactory = $this->createPartialMock(\Magento\Newsletter\Model\TemplateFactory::class, ['create']); $templateFactory->expects($this->once())->method('create')->willReturn($this->template); $this->subscriberFactory = $this->createPartialMock( diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index e5959a77a077d..715ff4bef08c4 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -310,29 +310,35 @@ public function collectSitemapItems() $helper = $this->_sitemapData; $storeId = $this->getStoreId(); - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getCategoryChangefreq($storeId), - 'priority' => $helper->getCategoryPriority($storeId), - 'collection' => $this->_categoryFactory->create()->getCollection($storeId), - ] - )); - - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getProductChangefreq($storeId), - 'priority' => $helper->getProductPriority($storeId), - 'collection' => $this->_productFactory->create()->getCollection($storeId), - ] - )); - - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getPageChangefreq($storeId), - 'priority' => $helper->getPagePriority($storeId), - 'collection' => $this->_cmsFactory->create()->getCollection($storeId), - ] - )); + $this->addSitemapItem( + new DataObject( + [ + 'changefreq' => $helper->getCategoryChangefreq($storeId), + 'priority' => $helper->getCategoryPriority($storeId), + 'collection' => $this->_categoryFactory->create()->getCollection($storeId), + ] + ) + ); + + $this->addSitemapItem( + new DataObject( + [ + 'changefreq' => $helper->getProductChangefreq($storeId), + 'priority' => $helper->getProductPriority($storeId), + 'collection' => $this->_productFactory->create()->getCollection($storeId), + ] + ) + ); + + $this->addSitemapItem( + new DataObject( + [ + 'changefreq' => $helper->getPageChangefreq($storeId), + 'priority' => $helper->getPagePriority($storeId), + 'collection' => $this->_cmsFactory->create()->getCollection($storeId), + ] + ) + ); } /** @@ -836,13 +842,15 @@ private function mapToSitemapItem() foreach ($this->_sitemapItems as $data) { foreach ($data->getCollection() as $item) { - $items[] = $this->sitemapItemFactory->create([ - 'url' => $item->getUrl(), - 'updatedAt' => $item->getUpdatedAt(), - 'images' => $item->getImages(), - 'priority' => $data->getPriority(), - 'changeFrequency' => $data->getChangeFrequency(), - ]); + $items[] = $this->sitemapItemFactory->create( + [ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $data->getPriority(), + 'changeFrequency' => $data->getChangeFrequency(), + ] + ); } } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index bc8f93f9bef7e..91fa6097c2d76 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -429,10 +429,12 @@ protected function prepareSitemapModelMock( if (count($expectedFile) == 1) { $this->directoryMock->expects($this->once()) ->method('renameFile') - ->willReturnCallback(function ($from, $to) { - \PHPUnit\Framework\Assert::assertEquals('/sitemap-1-1.xml', $from); - \PHPUnit\Framework\Assert::assertEquals('/sitemap.xml', $to); - }); + ->willReturnCallback( + function ($from, $to) { + \PHPUnit\Framework\Assert::assertEquals('/sitemap-1-1.xml', $from); + \PHPUnit\Framework\Assert::assertEquals('/sitemap.xml', $to); + } + ); } // Check robots txt @@ -524,32 +526,36 @@ protected function getModelMock($mockBeforeSave = false) $this->itemProviderMock->expects($this->any()) ->method('getItems') - ->willReturn([ - new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'), - new SitemapItem('/category/sub-category.html', '1.0', 'daily', '2012-12-21 00:00:00'), - new SitemapItem('product.html', '0.5', 'monthly', '0000-00-00 00:00:00'), - new SitemapItem( - 'product2.html', - '0.5', - 'monthly', - '2012-12-21 00:00:00', - new DataObject([ - 'collection' => [ - new DataObject( - [ - 'url' => $storeBaseMediaUrl . 'i/m/image1.png', - 'caption' => 'caption & > title < "' - ] - ), - new DataObject( - ['url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', 'caption' => null] - ), - ], - 'thumbnail' => $storeBaseMediaUrl . 't/h/thumbnail.jpg', - 'title' => 'Product & > title < "', - ]) - ) - ]); + ->willReturn( + [ + new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'), + new SitemapItem('/category/sub-category.html', '1.0', 'daily', '2012-12-21 00:00:00'), + new SitemapItem('product.html', '0.5', 'monthly', '0000-00-00 00:00:00'), + new SitemapItem( + 'product2.html', + '0.5', + 'monthly', + '2012-12-21 00:00:00', + new DataObject( + [ + 'collection' => [ + new DataObject( + [ + 'url' => $storeBaseMediaUrl . 'i/m/image1.png', + 'caption' => 'caption & > title < "' + ] + ), + new DataObject( + ['url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', 'caption' => null] + ), + ], + 'thumbnail' => $storeBaseMediaUrl . 't/h/thumbnail.jpg', + 'title' => 'Product & > title < "', + ] + ) + ) + ] + ); /** @var $model Sitemap */ $model = $this->getMockBuilder(Sitemap::class) From 14b73272246e274a01856846377c4b9a0fc354c5 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 15 May 2019 13:50:12 -0700 Subject: [PATCH 117/464] MC-12084: Address is not lost for Guest checkout if Guest refresh page during checkout --- .../Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml index f032e7e254afc..5537f2cec7379 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml @@ -17,7 +17,6 @@ <severity value="CRITICAL"/> <testCaseId value="MC-12084"/> <group value="checkout"/> - <group value="mtf_migrated"/> </annotations> <before> <!-- Login as admin --> From 9af30720d11557326c040b3f3c65046af572e3eb Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 15 May 2019 13:52:44 -0700 Subject: [PATCH 118/464] MC-6421: Admin search displays settings and content items --- .../Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml index 2a1f5369a0228..fe9991fe735c5 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml @@ -17,7 +17,6 @@ <severity value="CRITICAL"/> <testCaseId value="MC-6421"/> <group value="Search"/> - <group value="mtf_migrated"/> </annotations> <before> <!-- Login as admin --> From b5d85e1ee1854b16b4d42e93506f4e1c8197b443 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Wed, 15 May 2019 15:57:16 -0500 Subject: [PATCH 119/464] MAGETWO-99667: Fix Unrelated Static Test Failures --- .../adminhtml/templates/items/price/row.phtml | 15 +++-- .../templates/items/price/unit.phtml | 14 ++-- .../order/create/items/price/row.phtml | 12 ++-- .../order/create/items/price/total.phtml | 8 +-- .../order/create/items/price/unit.phtml | 12 ++-- .../view/adminhtml/templates/rate/js.phtml | 4 +- .../view/adminhtml/templates/rate/title.phtml | 4 +- .../view/adminhtml/templates/rule/edit.phtml | 2 +- .../templates/toolbar/rate/save.phtml | 59 +++++++++-------- .../base/templates/pricing/adjustment.phtml | 2 +- .../templates/pricing/adjustment/bundle.phtml | 8 +-- .../checkout/cart/item/price/sidebar.phtml | 10 +-- .../templates/checkout/grandtotal.phtml | 64 ++++++++++--------- .../templates/checkout/shipping.phtml | 24 +++---- .../templates/checkout/shipping/price.phtml | 18 +++--- .../templates/checkout/subtotal.phtml | 18 +++--- .../frontend/templates/checkout/tax.phtml | 38 ++++++----- .../templates/email/items/price/row.phtml | 12 ++-- .../frontend/templates/item/price/row.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 4 +- .../view/frontend/templates/order/tax.phtml | 23 +++---- .../adminhtml/templates/items/price/row.phtml | 28 ++++---- .../templates/items/price/unit.phtml | 28 ++++---- .../order/create/items/price/row.phtml | 26 ++++---- .../order/create/items/price/total.phtml | 29 +++++---- .../order/create/items/price/unit.phtml | 26 ++++---- .../adminhtml/templates/renderer/tax.phtml | 18 +++--- .../base/templates/pricing/adjustment.phtml | 12 ++-- .../checkout/cart/item/price/sidebar.phtml | 30 +++++---- .../review/item/price/row_excl_tax.phtml | 14 ++-- .../review/item/price/row_incl_tax.phtml | 16 +++-- .../review/item/price/unit_excl_tax.phtml | 15 +++-- .../review/item/price/unit_incl_tax.phtml | 16 +++-- .../templates/email/items/price/row.phtml | 28 ++++---- .../frontend/templates/item/price/row.phtml | 26 ++++---- .../frontend/templates/item/price/unit.phtml | 26 ++++---- 36 files changed, 368 insertions(+), 325 deletions(-) diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml index 890e876cf02fc..e6de067a4de64 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml @@ -3,28 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ $_item = $block->getItem(); ?> - -<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()) : ?> <div class="price-excl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?> </div> <?php endif; ?> -<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?> <div class="price-incl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(('Incl. Tax')) ?>:</span> <?php endif; ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($_item); ?> + <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?> + <?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBaseSubtotalInclTax($_item); ?> <?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml index 35ca03ffbd5af..817a6264e5eae 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -10,22 +12,22 @@ $_item = $block->getItem(); ?> -<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> +<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceExclTax()) : ?> <div class="price-excl-tax"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?> + <?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?> </div> <?php endif; ?> -<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceInclTax()): ?> +<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceInclTax()) : ?> <div class="price-incl-tax"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?> + <?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> - <?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBasePriceInclTax($_item); ?> + <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?> + <?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBasePriceInclTax($_item); ?> <?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml index 63c55526e2417..eeaf769542033 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -10,17 +12,17 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices($block->getStore())): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices($block->getStore())) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?> <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> + <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?> <?= /* @noEscape */ $block->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml index 480fb84feb8cc..462a1a65f97c3 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml @@ -10,17 +10,17 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <?php $_rowTotalWithoutDiscount = $_item->getRowTotal() - $_item->getTotalDiscountAmount(); ?> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices($block->getStore())): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices($block->getStore())) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $block->getTotalAmount($_item); ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml index a229c0bba8340..066b6a04fded4 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */ @@ -10,18 +12,18 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($_item->getCalculationPrice()) ?> <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> + <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?> <?= /* @noEscape */ $block->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml index 4a3d20d4394f1..fec108d53948f 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <script> require([ @@ -10,7 +12,7 @@ require([ "mage/adminhtml/form" ], function(jQuery){ - var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @noEscape */ $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable'); + var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, 'disable'); updater.disableRegionValidation(); (function ($) { diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml index e63398f32a26a..3d6d3d19dc314 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml @@ -6,14 +6,14 @@ ?> <fieldset id="tax-rate-titles-table" class="admin__fieldset"> <?php $_labels = $block->getTitles() ?> - <?php foreach ($block->getStores() as $_store): ?> + <?php foreach ($block->getStores() as $_store) : ?> <div class="admin__field"> <label class="admin__field-label"> <span><?= $block->escapeHtml($_store->getName()) ?></span> </label> <div class="admin__field-control"> <input - class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>" + class="admin__control-text<?php if ($_store->getId() == 0) : ?> required-entry<?php endif; ?>" type="text" name="title[<?= (int)$_store->getId() ?>]" value="<?= $block->escapeHtmlAttr($_labels[$_store->getId()]) ?>" /> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml index 3edf5a7736c6e..1ad16feef9690 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml @@ -113,7 +113,7 @@ require([ toggleAddButton:false, addText: '<?= $block->escapeJs($block->escapeHtml(__('Add New Tax Rate'))) ?>', parse: null, - nextPageUrl: '<?php echo $block->escapeHtml($block->getTaxRatesPageUrl())?>', + nextPageUrl: '<?= $block->escapeHtml($block->getTaxRatesPageUrl())?>', selectedValues: this.settings.selected_values, mselectInputSubmitCallback: function (value, options) { var select = $('#tax_rate'); diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml index eb446ecb092ac..5e3ef15da5482 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml @@ -4,44 +4,43 @@ * See COPYING.txt for license details. */ ?> -<?php if ($form): ?> -<?= $form->toHtml() ?> +<?php if ($form) : ?> + <?= $form->toHtml() ?> + <script> + require([ + "jquery", + "mage/mage" + ], function($){ -<script> -require([ - "jquery", - "mage/mage" -], function($){ + $('#<?= $block->escapeHtml($form->getForm()->getId()) ?>').mage('form').mage('validation'); - $('#<?= $block->escapeHtml($form->getForm()->getId()) ?>').mage('form').mage('validation'); + $(document).ready(function () { + 'use strict'; - $(document).ready(function () { - 'use strict'; + $('.field-zip_from').addClass('ignore-validate'); + $('.field-zip_to').addClass('ignore-validate'); - $('.field-zip_from').addClass('ignore-validate'); - $('.field-zip_to').addClass('ignore-validate'); + $('#zip_is_range').on('change.zipRange', function(){ - $('#zip_is_range').on('change.zipRange', function(){ + var elem = $(this), + zipFrom =$('.field-zip_from'), + zipTo =$('.field-zip_to'), + zipCode =$('.field-tax_postcode'); - var elem = $(this), - zipFrom =$('.field-zip_from'), - zipTo =$('.field-zip_to'), - zipCode =$('.field-tax_postcode'); + if (elem.is(':checked')) { + zipCode.addClass('hidden').addClass('ignore-validate'); + zipFrom.removeClass('hidden').removeClass('ignore-validate'); + zipTo.removeClass('hidden').removeClass('ignore-validate'); - if (elem.is(':checked')) { - zipCode.addClass('hidden').addClass('ignore-validate'); - zipFrom.removeClass('hidden').removeClass('ignore-validate'); - zipTo.removeClass('hidden').removeClass('ignore-validate'); - - } else { - zipCode.removeClass('hidden').removeClass('ignore-validate'); - zipFrom.addClass('hidden').addClass('ignore-validate'); - zipTo.addClass('hidden').addClass('ignore-validate'); - } + } else { + zipCode.removeClass('hidden').removeClass('ignore-validate'); + zipFrom.addClass('hidden').addClass('ignore-validate'); + zipTo.addClass('hidden').addClass('ignore-validate'); + } + }); }); - }); -}); -</script> + }); + </script> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml index c49cd989ddd88..3eba15da887a4 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml @@ -7,7 +7,7 @@ <?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?> -<?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayBothPrices()) : ?> <span id="<?= /* @noEscape */ $block->buildIdWithPrefix('price-excluding-tax-') ?>" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>" data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>" diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml index 72f0bcd297d84..9e60dc983e3ac 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml @@ -6,13 +6,13 @@ ?> <?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?> -<?php if ($block->displayPriceIncludingTax()): ?> +<?php if ($block->displayPriceIncludingTax()) : ?> <?= /* @noEscape */ $block->getDisplayAmount() ?> -<?php elseif ($block->displayPriceExcludingTax()): ?> +<?php elseif ($block->displayPriceExcludingTax()) : ?> <?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> -<?php elseif ($block->displayBothPrices()): ?> +<?php elseif ($block->displayBothPrices()) : ?> <?= /* @noEscape */ $block->getDisplayAmount() ?> - <?php if ($block->getDisplayAmountExclTax() !== $block->getDisplayAmount()): ?> + <?php if ($block->getDisplayAmountExclTax() !== $block->getDisplayAmount()) : ?> (+<?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> <?= $block->escapeHtml(__('Excl. Tax'))?>) <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index a4181e7918b40..74db5c24aecd0 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -4,17 +4,19 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Tax\Block\Item\Price\Renderer */ ?> <?php $_item = $block->getItem() ?> - <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> + <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> <span class="price-wrapper price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($_incl) ?> </span> <?php endif; ?> - <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> + <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <span class="price-wrapper price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()) ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml index 3106ef4f4693b..94814c5156610 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml @@ -4,39 +4,41 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** * @var $block \Magento\Tax\Block\Checkout\Grandtotal */ ?> -<?php if ($block->includeTax() && $block->getTotalExclTax() >= 0):?> -<?php - $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); -?> -<tr class="grand totals excl"> - <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> - <strong><?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?></strong> - </th> - <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Excl. Tax')) ?>"> - <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotalExclTax()) ?></strong> - </td> -</tr> -<?= /* @noEscape */ $block->renderTotals('taxes', $colspan) ?> -<tr class="grand totals incl"> - <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> - <strong><?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?></strong> - </th> - <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Incl. Tax')) ?>"> - <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> - </td> -</tr> -<?php else:?> -<tr class="grand totals"> - <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> - <strong><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></strong> - </th> - <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> - <strong><?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></strong> - </td> -</tr> +<?php if ($block->includeTax() && $block->getTotalExclTax() >= 0) : ?> + <?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); + ?> + <tr class="grand totals excl"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> + <strong><?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?></strong> + </th> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Excl. Tax')) ?>"> + <strong><?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotalExclTax()) ?></strong> + </td> + </tr> + <?= /* @noEscape */ $block->renderTotals('taxes', $colspan) ?> + <tr class="grand totals incl"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> + <strong><?= $block->escapeHtml(__('Grand Total Incl. Tax')) ?></strong> + </th> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Grand Total Incl. Tax')) ?>"> + <strong><?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) ?></strong> + </td> + </tr> +<?php else : ?> + <tr class="grand totals"> + <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> + <strong><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></strong> + </th> + <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> + <strong><?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) ?></strong> + </td> + </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml index b0cdec6d4643a..ffbb33487136d 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml @@ -4,23 +4,25 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** * @var $block \Magento\Tax\Block\Checkout\Shipping * @see \Magento\Tax\Block\Checkout\Shipping */ ?> -<?php if ($block->displayShipping()):?> -<?php - $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); -?> - <?php if ($block->displayBoth()):?> +<?php if ($block->displayShipping()) : ?> + <?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); + ?> + <?php if ($block->displayBoth()) : ?> <tr class="totals shipping excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getExcludeTaxLabel()) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getExcludeTaxLabel()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <tr class="totals shipping incl"> @@ -28,7 +30,7 @@ <?= $block->escapeHtml($block->getIncludeTaxLabel()) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getIncludeTaxLabel()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php elseif ($block->displayIncludeTax()) : ?> @@ -37,16 +39,16 @@ <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingIncludeTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> - <?php else:?> + <?php else :?> <tr class="totals shipping excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getShippingExcludeTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml index af9cf4cf6db45..6c91f8cec2dce 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping/price.phtml @@ -8,17 +8,17 @@ <?php $_excl = $block->getShippingPriceExclTax(); ?> <?php $_incl = $block->getShippingPriceInclTax(); ?> -<?php if ($block->displayShippingPriceExclTax()): ?> +<?php if ($block->displayShippingPriceExclTax()) : ?> <span class="price"><?= /* @noEscape */ $_excl ?></span> -<?php else: ?> -<?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> -<?php endif; ?> +<?php else : ?> + <?php if ($block->displayShippingBothPrices() && $_incl != $_excl) : ?> + <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> + <?php endif; ?> <span class="price"><?= /* @noEscape */ $_incl ?></span> -<?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> - </span> -<?php endif; ?> + <?php if ($block->displayShippingBothPrices() && $_incl != $_excl) : ?> + </span> + <?php endif; ?> <?php endif; ?> -<?php if ($block->displayShippingBothPrices() && $_incl != $_excl): ?> +<?php if ($block->displayShippingBothPrices() && $_incl != $_excl) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"><span class="price"><?= /* @noEscape */ $_excl ?></span></span> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml index 1e25ff1aec6a6..1dd3570f1c6f2 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml @@ -4,22 +4,24 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** * @var $block \Magento\Tax\Block\Checkout\Subtotal * @see \Magento\Tax\Block\Checkout\Subtotal */ ?> -<?php if ($block->displayBoth()) :?> -<?php - $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); -?> +<?php if ($block->displayBoth()) : ?> + <?php + $style = $block->escapeHtmlAttr($block->getStyle()); + $colspan = (int)$block->getColspan(); + ?> <tr class="totals sub excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Subtotal (Excl. Tax)')) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueExclTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValueExclTax()) ?> </td> </tr> <tr class="totals sub incl"> @@ -27,7 +29,7 @@ <?= $block->escapeHtml(__('Subtotal (Incl. Tax)')) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr(__('Subtotal (Incl. Tax)')) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValueInclTax()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValueInclTax()) ?> </td> </tr> <?php else : ?> @@ -36,7 +38,7 @@ <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> </th> <td style="<?= /* @noEscape */ $style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) ?> </td> </tr> <?php endif;?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml index 88d083cf0a563..01dbeb68a0344 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** * @var $block \Magento\Tax\Block\Checkout\Tax * @see \Magento\Tax\Block\Checkout\Tax @@ -12,51 +14,47 @@ <?php $_value = $block->getTotal()->getValue(); $_style = $block->escapeHtmlAttr($block->getTotal()->getStyle()); -?> -<?php global $taxIter; $taxIter++; ?> -<?php $attributes = 'class="totals-tax"'; - if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() && $_value != 0) { - $attributes = 'class="totals-tax-summary" data-mage-init=\'{"toggleAdvanced": {"selectorsToggleClass": "shown", "baseToggleClass": "expanded", "toggleContainers": ".totals-tax-details"}}\''; - } + +if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary() && $_value != 0) { + $attributes = 'class="totals-tax-summary" data-mage-init=\'{"toggleAdvanced": {"selectorsToggleClass": "shown", "baseToggleClass": "expanded", "toggleContainers": ".totals-tax-details"}}\''; +} ?> <tr <?= /* @noEscape */ $attributes ?>> <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= (int)$block->getColspan() ?>" scope="row"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> + <?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary()) : ?> <span class="detailed"><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></span> - <?php else: ?> + <?php else : ?> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> <?php endif;?> </th> <td style="<?= /* @noEscape */ $_style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_value) ?> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($_value) ?> </td> </tr> -<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() && $_value != 0): ?> - <?php foreach ($block->getTotal()->getFullInfo() as $info): ?> - <?php if (isset($info['hidden']) && $info['hidden']) { - continue; - } ?> +<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary() && $_value != 0) : ?> + <?php foreach ($block->getTotal()->getFullInfo() as $info) : ?> + <?php if (isset($info['hidden']) && $info['hidden']) { continue; } ?> <?php $percent = $info['percent']; ?> <?php $amount = $info['amount']; ?> <?php $rates = $info['rates']; ?> <?php $isFirst = 1; ?> - <?php foreach ($rates as $rate): ?> - <tr class="totals-tax-details details-<?= /* @noEscape */ $taxIter ?>"> + <?php foreach ($rates as $rate) : ?> + <tr class="totals-tax-details"> <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= (int)$block->getColspan() ?>" scope="row"> <?= $block->escapeHtml($rate['title']) ?> - <?php if (!is_null($rate['percent'])): ?> + <?php if ($rate['percent'] !== null) : ?> (<?= (float)$rate['percent'] ?>%) <?php endif; ?> </th> - <?php if ($isFirst): ?> + <?php if ($isFirst) : ?> <td style="<?= /* @noEscape */ $_style ?>" class="amount" rowspan="<?= count($rates) ?>" - data-th="<?= $block->escapeHtmlAttr($rate['title']) ?><?php if (!is_null($rate['percent'])): ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> - <?= /* @noEscape */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($amount) ?> + data-th="<?= $block->escapeHtmlAttr($rate['title']) ?><?php if ($rate['percent'] !== null) : ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> + <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($amount) ?> </td> <?php endif; ?> </tr> diff --git a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml index 88088ed5b503d..991fbf9c5c81f 100644 --- a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Tax\Block\Item\Price\Renderer $block */ @@ -12,18 +14,18 @@ $_item = $block->getItem(); $_order = $_item->getOrder(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $_order->formatPrice($_item->getRowTotal()) ?> <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> - <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> + <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?> <?= /* @noEscape */ $_order->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml index f9444d025d56a..12aa494f74e7a 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/row.phtml @@ -8,7 +8,7 @@ $_item = $block->getItem(); ?> -<?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> +<?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()) : ?> <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($_item->getRowTotalInclTax()) ?> @@ -16,7 +16,7 @@ $_item = $block->getItem(); </span> <?php endif; ?> -<?php if (($block->displayPriceExclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()): ?> +<?php if (($block->displayPriceExclTax() || $block->displayBothPrices()) && !$_item->getNoSubtotal()) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml index e672ad64ba874..e5fd756e2f373 100644 --- a/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/item/price/unit.phtml @@ -8,7 +8,7 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php $_incl = $_item->getPriceInclTax(); ?> <span class="cart-price"> @@ -17,7 +17,7 @@ $_item = $block->getItem(); </span> <?php endif; ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <span class="cart-price"> <?= /* @noEscape */ $block->formatPrice($block->getItemDisplayPriceExclTax()) ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml index da3f7a9f9134c..d1346b499975c 100644 --- a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml @@ -3,26 +3,27 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php $_order = $block->getOrder(); $_source = $block->getSource(); - $_fullInfo = $this->helper('Magento\Tax\Helper\Data')->getCalculatedTaxes($_source); - global $taxIter; $taxIter++; + $_fullInfo = $this->helper(\Magento\Tax\Helper\Data::class)->getCalculatedTaxes($_source); ?> -<?php if ($_fullInfo && $block->displayFullSummary()): ?> - <?php foreach ($_fullInfo as $info): ?> +<?php if ($_fullInfo && $block->displayFullSummary()) : ?> + <?php foreach ($_fullInfo as $info) : ?> <?php $percent = $info['percent']; $amount = $info['tax_amount']; $baseAmount = $info['base_tax_amount']; $title = $info['title']; ?> - <tr class="totals tax details details-<?= /* @noEscape */ $taxIter ?> <?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> + <tr class="totals tax details <?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> <td <?= /* @noEscape */ $block->getLabelProperties() ?>> <?= $block->escapeHtml($title) ?> - <?php if (!is_null($percent)): ?> + <?php if ($percent !== null) : ?> (<?= (float)$percent ?>%) <?php endif; ?> <br /> @@ -34,17 +35,17 @@ <?php endforeach; ?> <?php endif;?> -<?php if ($block->displayFullSummary() && $_fullInfo && !$block->getIsPlaneMode()): ?> +<?php if ($block->displayFullSummary() && $_fullInfo && !$block->getIsPlaneMode()) : ?> <tr class="totals-tax-summary"> -<?php elseif ($block->displayFullSummary() && $_fullInfo && $block->getIsPlaneMode()): ?> +<?php elseif ($block->displayFullSummary() && $_fullInfo && $block->getIsPlaneMode()) : ?> <tr class="totals-tax-summary plane"> -<?php else: ?> +<?php else : ?> <tr class="totals-tax"> <?php endif; ?> <th <?= /* @noEscape */ $block->getLabelProperties() ?> scope="row"> - <?php if ($block->displayFullSummary()): ?> + <?php if ($block->displayFullSummary()) : ?> <div class="detailed"><?= $block->escapeHtml(__('Tax')) ?></div> - <?php else: ?> + <?php else : ?> <?= $block->escapeHtml(__('Tax')) ?> <?php endif;?> </th> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml b/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml index 6e968a47306c8..0d8365ff4bd85 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/items/price/row.phtml @@ -3,34 +3,36 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Weee\Block\Adminhtml\Items\Price\Renderer $block */ /** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); $_item = $block->getItem(); ?> -<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()) : ?> <div class="price-excl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getRowPriceExclTaxHtml() ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_row_amount'], $tax['row_amount']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalRowPriceExclTaxHtml() ?> @@ -39,24 +41,24 @@ $_item = $block->getItem(); <?php endif; ?> </div> <?php endif; ?> -<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?> <div class="price-incl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getRowPriceInclTaxHtml() ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalRowPriceInclTaxHtml() ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml b/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml index 7802028860502..8dbaff2e2a6b1 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/items/price/unit.phtml @@ -3,35 +3,37 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Weee\Block\Adminhtml\Items\Price\Renderer $block */ /** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); $_item = $block->getItem(); ?> -<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()) : ?> <div class="price-excl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getUnitPriceExclTaxHtml() ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_amount'], $tax['amount']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalUnitPriceExclTaxHtml() ?> @@ -40,24 +42,24 @@ $_item = $block->getItem(); <?php endif; ?> </div> <?php endif; ?> -<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?> +<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?> <div class="price-incl-tax"> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= $block->getUnitPriceInclTaxHtml() ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']) ?></span> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= $block->getFinalUnitPriceInclTaxHtml() ?> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml index f3222ae68e79d..769e9e68e3a46 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/row.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ @@ -10,24 +12,24 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> @@ -36,22 +38,22 @@ $_item = $block->getItem(); <?php endif; ?> <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml index c3c8547510ee7..fceca17acf61e 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/total.phtml @@ -3,33 +3,34 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ - -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <?php $_rowTotalWithoutDiscount = $block->getRowDisplayPriceExclTax() - $_item->getTotalDiscountAmount(); ?> - <?php if ($block->displayBothPrices()): ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax() - $_item->getTotalDiscountAmount()) ?> @@ -39,23 +40,23 @@ $_item = $block->getItem(); <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $block->getTotalAmount($_item); ?> <?= /* @noEscape */ $block->formatPrice(max(0, $_incl)) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax() - $_item->getTotalDiscountAmount()) ?> </span> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml index 6b0cc43af95f5..362c88ecedd4b 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/order/create/items/price/unit.phtml @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ @@ -10,23 +12,23 @@ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> @@ -36,23 +38,23 @@ $_item = $block->getItem(); <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index 097cbc8d36b9b..1b77231640868 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -3,12 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var $block \Magento\Weee\Block\Renderer\Weee\Tax */ $data = ['fptAttribute' => [ - 'region' => $this->helper('Magento\Framework\Json\Helper\Data')->jsonDecode( - $this->helper('Magento\Directory\Helper\Data')->getRegionJson() + 'region' => $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonDecode( + $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ), 'itemsData' => $block->getValues(), 'bundlePriceType' => '#price_type', @@ -16,14 +18,14 @@ $data = ['fptAttribute' => [ ?> <div id="attribute-<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>-container" class="field" data-attribute-code="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>" - data-mage-init="<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data) ?>"> + data-mage-init="<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($data) ?>"> <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> <div class="control"> <table class="data-table"> <thead> <tr> - <th class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none;"<?php endif; ?>><?= $block->escapeHtml(__('Website')) ?></th> + <th class="col-website" <?php if (!$block->isMultiWebsites()) : ?>style="display: none;"<?php endif; ?>><?= $block->escapeHtml(__('Website')) ?></th> <th class="col-country required"><?= $block->escapeHtml(__('Country/State')) ?></th> <th class="col-tax required"><?= $block->escapeHtml(__('Tax')) ?></th> <th class="col-action"><?= $block->escapeHtml(__('Action')) ?></th> @@ -50,12 +52,12 @@ $data = ['fptAttribute' => [ $elementClass = $block->escapeHtmlAttr($block->getElement()->getClass()); ?> <tr id="<?= /* @noEscape */ $block->getElement()->getHtmlId() ?>_weee_tax_row_<%- data.index %>" data-role="fpt-item-row"> - <td class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> + <td class="col-website" <?php if (!$block->isMultiWebsites()) : ?>style="display: none"<?php endif; ?>> <select id="<?= /* @noEscape */ $elementName ?>_weee_tax_row_<%- data.index %>_website" name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][website_id]" class="<?= /* @noEscape */ $elementClass ?> website required-entry" data-role="select-website"> - <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> - <option value="<?= /* @noEscape */ $_websiteId ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])): ?>[<?= /* @noEscape */ $_info['currency'] ?>]<?php endif; ?></option> + <?php foreach ($block->getWebsites() as $_websiteId => $_info) : ?> + <option value="<?= /* @noEscape */ $_websiteId ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])) : ?>[<?= /* @noEscape */ $_info['currency'] ?>]<?php endif; ?></option> <?php endforeach ?> </select> </td> @@ -63,7 +65,7 @@ $data = ['fptAttribute' => [ <select id="<?= /* @noEscape */ $elementName ?>_weee_tax_row_<%- data.index %>_country" name="<?= /* @noEscape */ $elementName ?>[<%- data.index %>][country]" class="<?= /* @noEscape */ $elementClass ?> country required-entry" data-role="select-country"> - <?php foreach ($block->getCountries() as $_country): ?> + <?php foreach ($block->getCountries() as $_country) : ?> <option value="<?= $block->escapeHtmlAttr($_country['value']) ?>"><?= $block->escapeHtml($_country['label']) ?></option> <?php endforeach ?> </select> diff --git a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml index 01f003246e8f9..a2b5ad4f196e8 100644 --- a/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Weee/view/base/templates/pricing/adjustment.phtml @@ -15,22 +15,22 @@ $taxDisplay = $block->getTaxDisplayConfig(); $priceDisplay = $block->isPriceIncludesTax(); ?> -<?php if ($block->showInclDescr() || $block->showExclDescrIncl()): // incl. + weee || excl. + weee + final ?> - <?php foreach ($block->getWeeeTaxAttributes() as $weeeTaxAttribute): ?> +<?php if ($block->showInclDescr() || $block->showExclDescrIncl()) : // incl. + weee || excl. + weee + final ?> + <?php foreach ($block->getWeeeTaxAttributes() as $weeeTaxAttribute) : ?> <?php $attributeName = $block->escapeHtmlAttr($block->renderWeeeTaxAttributeName($weeeTaxAttribute)); ?> - <?php if ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX): ?> + <?php if ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_INCLUDING_TAX) : ?> <span class="weee" data-price-type="weee" data-label="<?= /* @noEscape */ $attributeName ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithTax($weeeTaxAttribute) ?></span> - <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX): ?> + <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX) : ?> <span class="weee" data-price-type="weee" data-label="<?= /* @noEscape */ $attributeName ?>"> <?= /* @noEscape */ $block->renderWeeeTaxAttributeWithoutTax($weeeTaxAttribute) ?></span> - <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH): ?> + <?php elseif ($taxDisplay == Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH) : ?> <span class="weee" data-price-type="weee" data-label="<?= /* @noEscape */ $attributeName . ' ' . $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> @@ -43,7 +43,7 @@ $priceDisplay = $block->isPriceIncludesTax(); <?php endforeach; ?> <?php endif; ?> -<?php if ($block->showExclDescrIncl()): // excl. + weee + final ?> +<?php if ($block->showExclDescrIncl()) : // excl. + weee + final ?> <span class="price-final price-final_price" data-price-type="weeePrice" data-price-amount="<?= /* @noEscape */ $block->getRawFinalAmount() ?>" diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml index 8bb545d0f535e..0cd1ca8057984 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); @@ -13,27 +15,27 @@ $originalZone = $block->getZone(); $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="minicart-tax-total"> - <?php else: ?> + <?php else : ?> <span class="minicart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <span class="minicart-tax-info"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="minicart-tax-total"> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> @@ -45,27 +47,27 @@ $block->setZone(\Magento\Framework\Pricing\Render::ZONE_CART); </span> <?php endif; ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="minicart-tax-total"> - <?php else: ?> + <?php else : ?> <span class="minicart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <span class="minicart-tax-info"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="minicart-tax-total"> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml index ad98039519cea..e1f4207f3740c 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -4,28 +4,30 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceWithWeeeDetails()): ?> +<?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> -<?php else: ?> +<?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> </span> -<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> +<?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml index e0513f522a770..1189c1b9ba2fb 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -4,31 +4,33 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); /** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); ?> <?php $_incl = $_item->getRowTotalInclTax(); ?> -<?php if ($block->displayPriceWithWeeeDetails()): ?> +<?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> -<?php else: ?> +<?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> </span> -<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> +<?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <span class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml index cf2693842b8d3..809d8ac90e12e 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -4,29 +4,30 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> -<?php if ($block->displayPriceWithWeeeDetails()): ?> +<?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> -<?php else: ?> +<?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> - -<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> +<?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$_item->getId() ?>" style="display:none;"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml index b4389dea160c3..81ec8c1c6795b 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -4,32 +4,34 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $_item = $block->getItem(); /** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); ?> <?php $_incl = $_item->getPriceInclTax(); ?> -<?php if ($block->displayPriceWithWeeeDetails()): ?> +<?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> -<?php else: ?> +<?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> -<?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> +<?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> <?php endforeach; ?> <?php endif; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml index 0b3b4b7ca5c1d..edcf73d2f9577 100644 --- a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml @@ -3,35 +3,37 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +// phpcs:disable Magento2.Templates.ThisInTemplate ?> <?php /** @var \Magento\Weee\Block\Item\Price\Renderer $block */ /** @var $_weeeHelper \Magento\Weee\Helper\Data */ -$_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); +$_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); $_item = $block->getItem(); /** @var \Magento\Sales\Model\Order $_order */ $_order = $_item->getOrder(); ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $_order->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <br /> <span class="nobr"><?= $block->escapeHtml(__('Total')) ?>:<br /> <?= /* @noEscape */ $_order->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?></span> <?php endif; ?> @@ -39,22 +41,22 @@ $_order = $_item->getOrder(); <?php endif; ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> - <?php if ($block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> + <?php if ($block->displayBothPrices()) : ?> <br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?= /* @noEscape */ $_order->formatPrice($block->getRowDisplayPriceInclTax()) ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> <br /> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <small> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="nobr"><?= $block->escapeHtml($tax['title']) ?>: <?= /* @noEscape */ $_order->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="nobr"><?= $block->escapeHtml(__('Total Incl. Tax')) ?>:<br /> <?= /* @noEscape */ $_order->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?></span> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml index c78cb30dd9d56..afecc8be030a4 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -4,31 +4,33 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); ?> -<?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$item->getNoSubtotal()): ?> +<?php if (($block->displayPriceInclTax() || $block->displayBothPrices()) && !$item->getNoSubtotal()) : ?> <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> - <?php else: ?> + <?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceInclTax()) ?> </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <div class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </div> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> @@ -40,28 +42,28 @@ $item = $block->getItem(); </span> <?php endif; ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> - <?php else: ?> + <?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getRowDisplayPriceExclTax()) ?> </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?> </span> <?php endforeach; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml index 5b50c82255b3a..8c52144aeb7eb 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -4,31 +4,33 @@ * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate + /** @var $block \Magento\Weee\Block\Item\Price\Renderer */ $item = $block->getItem(); ?> -<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?> <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> - <?php else: ?> + <?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?> </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> </span> <?php endforeach; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> @@ -40,28 +42,28 @@ $item = $block->getItem(); </span> <?php endif; ?> -<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> +<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> - <?php if ($block->displayPriceWithWeeeDetails()): ?> + <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> - <?php else: ?> + <?php else : ?> <span class="cart-price"> <?php endif; ?> <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> - <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?> + <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> - <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?> + <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?> </span> <?php endforeach; ?> </span> - <?php if ($block->displayFinalPrice()): ?> + <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> From e45e8603d62434be034758869dc462c22aa40707 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Wed, 15 May 2019 16:38:37 -0500 Subject: [PATCH 120/464] MQE-1367: XSD Schema validation must be triggered before merging to mainline More schema error fixes after pulling mainline updates --- .../ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml | 2 +- .../Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml | 2 +- .../Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml | 2 +- .../OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml | 2 +- .../Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml | 2 +- .../Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml index 88dd1d01c5f8f..06a49b856b5e2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml @@ -22,6 +22,6 @@ <doubleClick selector="{{CheckoutShippingSection.loginButton}}" stepKey="clickLoginBtn"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear3"/> <waitForPageLoad stepKey="waitToBeLoggedIn"/> - <waitForElementNotVisible selector="{{CheckoutShippingSection.email}}" userInput="{{customer.email}}" stepKey="waitForEmailInvisible" time ="60"/> + <waitForElementNotVisible selector="{{CheckoutShippingSection.email}}" stepKey="waitForEmailInvisible" time ="60"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml index 1c8d498edc206..95df25bf83301 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml @@ -27,7 +27,7 @@ <element name="ProductPriceByOption" type="text" selector="//*[contains(@class, 'item-options')]/dd[normalize-space(.)='{{var1}}']/ancestor::tr//td[contains(@class, 'price')]//span[@class='price']" parameterized="true"/> <element name="RemoveItem" type="button" selector="//table[@id='shopping-cart-table']//tbody//tr[contains(@class,'item-actions')]//a[contains(@class,'action-delete')]"/> - <element name="removeProductByName" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/> + <element name="removeProductByName" type="text" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/> <element name="productName" type="text" selector="//tbody[@class='cart item']//strong[@class='product-item-name']"/> <element name="nthItemOption" type="block" selector=".item:nth-of-type({{numElement}}) .item-options" parameterized="true"/> <element name="nthEditButton" type="block" selector=".item:nth-of-type({{numElement}}) .action-edit" parameterized="true"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml index a4c357141b9e2..bafad6f28a680 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout as customer using new address test"/> <description value="Checkout as customer using new address"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14740"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml index 7651e1dad8388..2c341a5c4c1ab 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout as customer using non default address test"/> <description value="Checkout as customer using non default address"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14739"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml index 24f6646ba2ff4..990459d7c81b7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout using sign in link test"/> <description value="Checkout using 'Sign In' link"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14738"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index b48475604868b..3ec73aec580d5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout with all product types test"/> <description value="Checkout with all product types"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14742"/> <group value="checkout"/> <group value="mtf_migrated"/> From c62c3c8778f20f355c0ebcf2b2266979f088f6f7 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Wed, 15 May 2019 17:11:53 -0500 Subject: [PATCH 121/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../Tax/view/frontend/templates/checkout/grandtotal.phtml | 8 ++++---- .../Tax/view/frontend/templates/checkout/subtotal.phtml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml index 94814c5156610..ee8ae505aa9e5 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml @@ -10,11 +10,11 @@ * @var $block \Magento\Tax\Block\Checkout\Grandtotal */ ?> +<?php +$style = $block->escapeHtmlAttr($block->getStyle()); +$colspan = (int)$block->getColspan(); +?> <?php if ($block->includeTax() && $block->getTotalExclTax() >= 0) : ?> - <?php - $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); - ?> <tr class="grand totals excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <strong><?= $block->escapeHtml(__('Grand Total Excl. Tax')) ?></strong> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml index 1dd3570f1c6f2..914e5bda9abc6 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml @@ -11,11 +11,11 @@ * @see \Magento\Tax\Block\Checkout\Subtotal */ ?> +<?php +$style = $block->escapeHtmlAttr($block->getStyle()); +$colspan = (int)$block->getColspan(); +?> <?php if ($block->displayBoth()) : ?> - <?php - $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); - ?> <tr class="totals sub excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml(__('Subtotal (Excl. Tax)')) ?> From cc6672dbff7222919c909f6c6fd8d5ba00982202 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Wed, 15 May 2019 17:45:39 -0500 Subject: [PATCH 122/464] MAGETWO-99647: Custom customer address attribute (dropdown) not getting populated for addresses for creation of orders in Admin --- .../Adminhtml/Order/Create/Form/Address.php | 12 +- .../Order/Create/Form/AddressTest.php | 263 ++++++++++++++++++ .../templates/order/create/form/address.phtml | 2 +- 3 files changed, 272 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Form/AddressTest.php diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 0e3d308df912e..e4b9dd4c63b93 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -9,6 +9,8 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\Data\Form\Element\AbstractElement; use Magento\Framework\Pricing\PriceCurrencyInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Eav\Model\AttributeDataFactory; /** * Order create address form @@ -191,17 +193,19 @@ public function getAddressCollectionJson() $emptyAddressForm = $this->_customerFormFactory->create( 'customer_address', 'adminhtml_customer_address', - [\Magento\Customer\Api\Data\AddressInterface::COUNTRY_ID => $defaultCountryId] + [AddressInterface::COUNTRY_ID => $defaultCountryId] ); - $data = [0 => $emptyAddressForm->outputData(\Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON)]; + $data = [0 => $emptyAddressForm->outputData(AttributeDataFactory::OUTPUT_FORMAT_JSON)]; foreach ($this->getAddressCollection() as $address) { $addressForm = $this->_customerFormFactory->create( 'customer_address', 'adminhtml_customer_address', - $this->addressMapper->toFlatArray($address) + $this->addressMapper->toFlatArray($address), + false, + false ); $data[$address->getId()] = $addressForm->outputData( - \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON + AttributeDataFactory::OUTPUT_FORMAT_JSON ); } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Form/AddressTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Form/AddressTest.php new file mode 100644 index 0000000000000..5b6d6ded1561a --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Form/AddressTest.php @@ -0,0 +1,263 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Sales\Test\Unit\Block\Adminhtml\Order\Create\Form; + +use Magento\Backend\Model\Session\Quote as QuoteSession; +use Magento\Store\Model\Store; +use Magento\Directory\Helper\Data as DirectoryHelper; +use Magento\Eav\Model\AttributeDataFactory; +use Magento\Sales\Block\Adminhtml\Order\Create\Form\Address; +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\Data\AddressSearchResultsInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Model\Metadata\Form; +use Magento\Customer\Model\Metadata\FormFactory; +use Magento\Customer\Model\Address\Mapper; +use Magento\Framework\Api\FilterBuilder; +use Magento\Framework\Api\Filter; +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Api\SearchCriteria; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class AddressTest extends TestCase +{ + /** + * @var QuoteSession|MockObject + */ + private $quoteSession; + + /** + * @var Store|MockObject + */ + private $store; + + /** + * @var DirectoryHelper|MockObject + */ + private $directoryHelper; + + /** + * @var int + */ + private $defaultCountryId; + + /** + * @var int + */ + private $customerId; + + /** + * @var int + */ + private $addressId; + + /** + * @var FormFactory|MockObject + */ + private $formFactory; + + /** + * @var FilterBuilder|MockObject + */ + private $filterBuilder; + + /** + * @var SearchCriteriaBuilder|MockObject + */ + private $criteriaBuilder; + + /** + * @var AddressInterface|MockObject + */ + private $addressItem; + + /** + * @var AddressRepositoryInterface|MockObject + */ + private $addressService; + + /** + * @var Mapper|MockObject + */ + private $addressMapper; + + /** + * @var Address + */ + private $address; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + + $this->defaultCountryId = 1; + $this->customerId = 10; + $this->addressId = 100; + + $this->quoteSession = $this->getMockBuilder(QuoteSession::class) + ->disableOriginalConstructor() + ->setMethods(['getStore', 'getCustomerId']) + ->getMock(); + $this->store = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->quoteSession->expects($this->any()) + ->method('getStore') + ->willReturn($this->store); + $this->quoteSession->expects($this->any()) + ->method('getCustomerId') + ->willReturn($this->customerId); + $this->directoryHelper = $this->getMockBuilder(DirectoryHelper::class) + ->disableOriginalConstructor() + ->setMethods(['getDefaultCountry']) + ->getMock(); + $this->directoryHelper->expects($this->any()) + ->method('getDefaultCountry') + ->willReturn($this->defaultCountryId); + $this->formFactory = $this->getMockBuilder(FormFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->filterBuilder = $this->getMockBuilder(FilterBuilder::class) + ->disableOriginalConstructor() + ->setMethods(['setField', 'setValue', 'setConditionType', 'create']) + ->getMock(); + $this->criteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) + ->disableOriginalConstructor() + ->setMethods(['create', 'addFilters']) + ->getMock(); + $this->addressService = $this->getMockBuilder(AddressRepositoryInterface::class) + ->setMethods(['getList']) + ->getMockForAbstractClass(); + $this->addressItem = $this->getMockBuilder(AddressInterface::class) + ->setMethods(['getId']) + ->getMockForAbstractClass(); + $this->addressItem->expects($this->any()) + ->method('getId') + ->willReturn($this->addressId); + $this->addressMapper = $this->getMockBuilder(Mapper::class) + ->disableOriginalConstructor() + ->setMethods(['toFlatArray']) + ->getMock(); + + $this->address = $this->objectManager->getObject( + Address::class, + [ + 'directoryHelper' => $this->directoryHelper, + 'sessionQuote' => $this->quoteSession, + 'customerFormFactory' => $this->formFactory, + 'filterBuilder' => $this->filterBuilder, + 'criteriaBuilder' => $this->criteriaBuilder, + 'addressService' => $this->addressService, + 'addressMapper' => $this->addressMapper + ] + ); + } + + public function testGetAddressCollectionJson() + { + /** @var Form|MockObject $emptyForm */ + $emptyForm = $this->getMockBuilder(Form::class) + ->disableOriginalConstructor() + ->setMethods(['outputData']) + ->getMock(); + $emptyForm->expects($this->once()) + ->method('outputData') + ->with(AttributeDataFactory::OUTPUT_FORMAT_JSON) + ->willReturn('emptyFormData'); + + /** @var Filter|MockObject $filter */ + $filter = $this->getMockBuilder(Filter::class) + ->disableOriginalConstructor() + ->getMock(); + $this->filterBuilder->expects($this->once()) + ->method('setField') + ->with('parent_id') + ->willReturnSelf(); + $this->filterBuilder->expects($this->once()) + ->method('setValue') + ->with($this->customerId) + ->willReturnSelf(); + $this->filterBuilder->expects($this->once()) + ->method('setConditionType') + ->with('eq') + ->willReturnSelf(); + $this->filterBuilder->expects($this->once()) + ->method('create') + ->willReturn($filter); + + /** @var SearchCriteria|MockObject $searchCriteria */ + $searchCriteria = $this->getMockBuilder(SearchCriteria::class) + ->disableOriginalConstructor() + ->getMock(); + $this->criteriaBuilder->expects($this->once()) + ->method('create') + ->willReturn($searchCriteria); + $this->criteriaBuilder->expects($this->once()) + ->method('addFilters') + ->with([$filter]); + + /** @var AddressSearchResultsInterface|MockObject $result */ + $result = $this->getMockBuilder(AddressSearchResultsInterface::class) + ->setMethods(['getList']) + ->getMockForAbstractClass(); + $result->expects($this->once()) + ->method('getItems') + ->willReturn([$this->addressItem]); + $this->addressService->expects($this->once()) + ->method('getList') + ->with($searchCriteria) + ->willReturn($result); + + /** @var Form|MockObject $emptyForm */ + $addressForm = $this->getMockBuilder(Form::class) + ->disableOriginalConstructor() + ->setMethods(['outputData']) + ->getMock(); + $addressForm->expects($this->once()) + ->method('outputData') + ->with(AttributeDataFactory::OUTPUT_FORMAT_JSON) + ->willReturn('addressFormData'); + $this->addressMapper->expects($this->once()) + ->method('toFlatArray') + ->with($this->addressItem) + ->willReturn([]); + + $this->directoryHelper->expects($this->once()) + ->method('getDefaultCountry') + ->with($this->store) + ->willReturn($this->defaultCountryId); + $this->formFactory->expects($this->at(0)) + ->method('create') + ->with( + 'customer_address', + 'adminhtml_customer_address', + [AddressInterface::COUNTRY_ID => $this->defaultCountryId] + ) + ->willReturn($emptyForm); + $this->formFactory->expects($this->at(1)) + ->method('create') + ->with('customer_address', 'adminhtml_customer_address', [], false, false) + ->willReturn($addressForm); + + $this->address->getAddressCollectionJson(); + } +} diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index ad2641577c4a7..89ed5feb66acf 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -32,7 +32,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @escapeVerfied */ $block->getAddressCollectionJson() ?>); + order.setAddresses(<?= /* @noEscapeCreate/Form/Address.php */ $block->getAddressCollectionJson() ?>); }); </script> From 392a418fb1bd188ca2b5c559495c0a2efcd1e147 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Wed, 15 May 2019 17:46:36 -0500 Subject: [PATCH 123/464] MAGETWO-99647: Custom customer address attribute (dropdown) not getting populated for addresses for creation of orders in Admin --- .../Block/Adminhtml/Order/Create/Form/AddressTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php index f5a22ec19ccf3..b908e870cbdd0 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AddressTest.php @@ -122,6 +122,10 @@ public function testGetAddressCollectionJson() 'postcode' => '90230', 'telephone' => '3468676', 'vat_id' => false, + 'prefix' => false, + 'middlename' => false, + 'suffix' => false, + 'fax' => false ], $addresses[1]->getId() => [ 'telephone' => '845454465', @@ -135,6 +139,10 @@ public function testGetAddressCollectionJson() 'region' => false, 'region_id' => 0, 'vat_id' => false, + 'prefix' => false, + 'middlename' => false, + 'suffix' => false, + 'fax' => false ] ]; From c1dd183a0f11fc0ed71e8a7f31a2d8c74f3093c2 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov <evgeny_petrov@epam.com> Date: Thu, 16 May 2019 08:45:45 +0300 Subject: [PATCH 124/464] MAGETWO-36337: Not user-friendly behaviour of "Save in address book" check-box inside "Shipping Address" section on "create Order" Admin page --- .../Sales/Block/Adminhtml/Order/Create/Shipping/Address.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php index 8809ac575e5e7..c4e8db28b48cb 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Address.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Sales\Block\Adminhtml\Order\Create\Shipping; /** @@ -88,7 +90,7 @@ public function getDontSaveInAddressBook() return !$save; } if ($shippingIsTheSameAsBilling) { - return !($this->getIsAsBilling() && $this->getIsShipping()); + return !$shippingIsTheSameAsBilling; } return $this->getIsAsBilling(); } From 4e11099e6163b5be250725c4727f85c0bba4847b Mon Sep 17 00:00:00 2001 From: Maksym Novik <m.novik@ism-ukraine.com> Date: Thu, 16 May 2019 11:33:28 +0300 Subject: [PATCH 125/464] Creating Customer without password is directly confirmed #14492 --- .../Controller/Account/CreatePassword.php | 33 +++++-- .../Customer/Model/AccountManagement.php | 99 +++++++++---------- .../ConfirmCustomerByToken.php | 58 +++++++++++ .../GetCustomerByToken.php | 89 +++++++++++++++++ .../Customer/Model/ResourceModel/Customer.php | 13 +-- .../Customer/Controller/AccountTest.php | 29 +++++- 6 files changed, 247 insertions(+), 74 deletions(-) create mode 100644 app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php create mode 100644 app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php diff --git a/app/code/Magento/Customer/Controller/Account/CreatePassword.php b/app/code/Magento/Customer/Controller/Account/CreatePassword.php index 124ac912a7ccf..d12ec57d3c339 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePassword.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePassword.php @@ -3,13 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Customer\Controller\Account; use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Model\ForgotPasswordToken\ConfirmCustomerByToken; use Magento\Customer\Model\Session; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\View\Result\PageFactory; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\ObjectManager; /** * Class CreatePassword @@ -34,20 +38,30 @@ class CreatePassword extends \Magento\Customer\Controller\AbstractAccount implem protected $resultPageFactory; /** - * @param Context $context - * @param Session $customerSession - * @param PageFactory $resultPageFactory - * @param AccountManagementInterface $accountManagement + * @var \Magento\Customer\Model\ForgotPasswordToken\ConfirmCustomerByToken + */ + private $confirmByToken; + + /** + * @param \Magento\Framework\App\Action\Context $context + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory + * @param \Magento\Customer\Api\AccountManagementInterface $accountManagement + * @param \Magento\Customer\Model\ForgotPasswordToken\ConfirmCustomerByToken $confirmByToken */ public function __construct( Context $context, Session $customerSession, PageFactory $resultPageFactory, - AccountManagementInterface $accountManagement + AccountManagementInterface $accountManagement, + ConfirmCustomerByToken $confirmByToken = null ) { $this->session = $customerSession; $this->resultPageFactory = $resultPageFactory; $this->accountManagement = $accountManagement; + $this->confirmByToken = $confirmByToken + ?? ObjectManager::getInstance()->get(ConfirmCustomerByToken::class); + parent::__construct($context); } @@ -67,6 +81,8 @@ public function execute() try { $this->accountManagement->validateResetPasswordLinkToken(null, $resetPasswordToken); + $this->confirmByToken->execute($resetPasswordToken); + if ($isDirectLink) { $this->session->setRpToken($resetPasswordToken); $resultRedirect = $this->resultRedirectFactory->create(); @@ -77,16 +93,17 @@ public function execute() /** @var \Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->getLayout() - ->getBlock('resetPassword') - ->setResetPasswordLinkToken($resetPasswordToken); + ->getBlock('resetPassword') + ->setResetPasswordLinkToken($resetPasswordToken); return $resultPage; } } catch (\Exception $exception) { - $this->messageManager->addError(__('Your password reset link has expired.')); + $this->messageManager->addErrorMessage(__('Your password reset link has expired.')); /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('*/*/forgotpassword'); + return $resultRedirect; } } diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 8439a3f2308c2..393a342420246 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -17,6 +17,7 @@ use Magento\Customer\Model\Config\Share as ConfigShare; use Magento\Customer\Model\Customer as CustomerModel; use Magento\Customer\Model\Customer\CredentialsValidator; +use Magento\Customer\Model\ForgotPasswordToken\GetCustomerByToken; use Magento\Customer\Model\Metadata\Validator; use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory; use Magento\Directory\Model\AllowedCountries; @@ -44,7 +45,6 @@ use Magento\Framework\Intl\DateTimeFactory; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Framework\Math\Random; -use Magento\Framework\Phrase; use Magento\Framework\Reflection\DataObjectProcessor; use Magento\Framework\Registry; use Magento\Framework\Session\SaveHandlerInterface; @@ -345,6 +345,11 @@ class AccountManagement implements AccountManagementInterface */ private $allowedCountriesReader; + /** + * @var GetCustomerByToken + */ + private $getByToken; + /** * @param CustomerFactory $customerFactory * @param ManagerInterface $eventManager @@ -377,10 +382,12 @@ class AccountManagement implements AccountManagementInterface * @param CollectionFactory|null $visitorCollectionFactory * @param SearchCriteriaBuilder|null $searchCriteriaBuilder * @param AddressRegistry|null $addressRegistry + * @param GetCustomerByToken|null $getByToken * @param AllowedCountries|null $allowedCountriesReader + * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.LongVariable) */ public function __construct( CustomerFactory $customerFactory, @@ -414,6 +421,7 @@ public function __construct( CollectionFactory $visitorCollectionFactory = null, SearchCriteriaBuilder $searchCriteriaBuilder = null, AddressRegistry $addressRegistry = null, + GetCustomerByToken $getByToken = null, AllowedCountries $allowedCountriesReader = null ) { $this->customerFactory = $customerFactory; @@ -439,23 +447,26 @@ public function __construct( $this->customerModel = $customerModel; $this->objectFactory = $objectFactory; $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; + $objectManager = ObjectManager::getInstance(); $this->credentialsValidator = - $credentialsValidator ?: ObjectManager::getInstance()->get(CredentialsValidator::class); - $this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class); - $this->accountConfirmation = $accountConfirmation ?: ObjectManager::getInstance() + $credentialsValidator ?: $objectManager->get(CredentialsValidator::class); + $this->dateTimeFactory = $dateTimeFactory ?: $objectManager->get(DateTimeFactory::class); + $this->accountConfirmation = $accountConfirmation ?: $objectManager ->get(AccountConfirmation::class); $this->sessionManager = $sessionManager - ?: ObjectManager::getInstance()->get(SessionManagerInterface::class); + ?: $objectManager->get(SessionManagerInterface::class); $this->saveHandler = $saveHandler - ?: ObjectManager::getInstance()->get(SaveHandlerInterface::class); + ?: $objectManager->get(SaveHandlerInterface::class); $this->visitorCollectionFactory = $visitorCollectionFactory - ?: ObjectManager::getInstance()->get(CollectionFactory::class); + ?: $objectManager->get(CollectionFactory::class); $this->searchCriteriaBuilder = $searchCriteriaBuilder - ?: ObjectManager::getInstance()->get(SearchCriteriaBuilder::class); + ?: $objectManager->get(SearchCriteriaBuilder::class); $this->addressRegistry = $addressRegistry - ?: ObjectManager::getInstance()->get(AddressRegistry::class); + ?: $objectManager->get(AddressRegistry::class); + $this->getByToken = $getByToken + ?: $objectManager->get(GetCustomerByToken::class); $this->allowedCountriesReader = $allowedCountriesReader - ?: ObjectManager::getInstance()->get(AllowedCountries::class); + ?: $objectManager->get(AllowedCountries::class); } /** @@ -521,8 +532,11 @@ public function activateById($customerId, $confirmationKey) * @param \Magento\Customer\Api\Data\CustomerInterface $customer * @param string $confirmationKey * @return \Magento\Customer\Api\Data\CustomerInterface - * @throws \Magento\Framework\Exception\State\InvalidTransitionException - * @throws \Magento\Framework\Exception\State\InputMismatchException + * @throws InputException + * @throws InputMismatchException + * @throws InvalidTransitionException + * @throws LocalizedException + * @throws NoSuchEntityException */ private function activateCustomer($customer, $confirmationKey) { @@ -630,42 +644,6 @@ public function initiatePasswordReset($email, $template, $websiteId = null) return false; } - /** - * Match a customer by their RP token. - * - * @param string $rpToken - * @throws ExpiredException - * @throws NoSuchEntityException - * @return CustomerInterface - * @throws LocalizedException - */ - private function matchCustomerByRpToken(string $rpToken): CustomerInterface - { - $this->searchCriteriaBuilder->addFilter( - 'rp_token', - $rpToken - ); - $this->searchCriteriaBuilder->setPageSize(1); - $found = $this->customerRepository->getList( - $this->searchCriteriaBuilder->create() - ); - if ($found->getTotalCount() > 1) { - //Failed to generated unique RP token - throw new ExpiredException( - new Phrase('Reset password token expired.') - ); - } - if ($found->getTotalCount() === 0) { - //Customer with such token not found. - throw NoSuchEntityException::singleField( - 'rp_token', - $rpToken - ); - } - //Unique customer found. - return $found->getItems()[0]; - } - /** * Handle not supported template * @@ -691,7 +669,7 @@ private function handleUnknownTemplate($template) public function resetPassword($email, $resetToken, $newPassword) { if (!$email) { - $customer = $this->matchCustomerByRpToken($resetToken); + $customer = $this->getByToken->execute($resetToken); $email = $customer->getEmail(); } else { $customer = $this->customerRepository->get($email); @@ -830,6 +808,8 @@ public function getConfirmationStatus($customerId) /** * @inheritdoc + * + * @throws LocalizedException */ public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '') { @@ -852,6 +832,8 @@ public function createAccount(CustomerInterface $customer, $password = null, $re /** * @inheritdoc + * + * @throws InputMismatchException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -987,6 +969,8 @@ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectU /** * @inheritdoc + * + * @throws InvalidEmailOrPasswordException */ public function changePassword($email, $currentPassword, $newPassword) { @@ -1000,6 +984,8 @@ public function changePassword($email, $currentPassword, $newPassword) /** * @inheritdoc + * + * @throws InvalidEmailOrPasswordException */ public function changePasswordById($customerId, $currentPassword, $newPassword) { @@ -1137,12 +1123,14 @@ public function isCustomerInStore($customerWebsiteId, $storeId) * * @param int $customerId * @param string $resetPasswordLinkToken + * * @return bool - * @throws \Magento\Framework\Exception\State\InputMismatchException If token is mismatched - * @throws \Magento\Framework\Exception\State\ExpiredException If token is expired - * @throws \Magento\Framework\Exception\InputException If token or customer id is invalid - * @throws \Magento\Framework\Exception\NoSuchEntityException If customer doesn't exist + * @throws ExpiredException If token is expired + * @throws InputException If token or customer id is invalid + * @throws InputMismatchException If token is mismatched * @throws LocalizedException + * @throws NoSuchEntityException If customer doesn't exist + * @SuppressWarnings(PHPMD.LongVariable) */ private function validateResetPasswordToken($customerId, $resetPasswordLinkToken) { @@ -1157,7 +1145,8 @@ private function validateResetPasswordToken($customerId, $resetPasswordLinkToken if ($customerId === null) { //Looking for the customer. - $customerId = $this->matchCustomerByRpToken($resetPasswordLinkToken) + $customerId = $this->getByToken + ->execute($resetPasswordLinkToken) ->getId(); } if (!is_string($resetPasswordLinkToken) || empty($resetPasswordLinkToken)) { diff --git a/app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php b/app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php new file mode 100644 index 0000000000000..6aadc814a4b9b --- /dev/null +++ b/app/code/Magento/Customer/Model/ForgotPasswordToken/ConfirmCustomerByToken.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Model\ForgotPasswordToken; + +use Magento\Customer\Api\CustomerRepositoryInterface; + +/** + * Confirm customer by reset password token + */ +class ConfirmCustomerByToken +{ + /** + * @var GetCustomerByToken + */ + private $getByToken; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * ConfirmByToken constructor. + * + * @param GetCustomerByToken $getByToken + * @param CustomerRepositoryInterface $customerRepository + */ + public function __construct( + GetCustomerByToken $getByToken, + CustomerRepositoryInterface $customerRepository + ) { + $this->getByToken = $getByToken; + $this->customerRepository = $customerRepository; + } + + /** + * Confirm customer account my rp_token + * + * @param string $resetPasswordToken + * + * @return void + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function execute(string $resetPasswordToken): void + { + $customer = $this->getByToken->execute($resetPasswordToken); + if ($customer->getConfirmation()) { + $this->customerRepository->save( + $customer->setConfirmation(null) + ); + } + } +} diff --git a/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php new file mode 100644 index 0000000000000..09af4e296bd92 --- /dev/null +++ b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php @@ -0,0 +1,89 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Model\ForgotPasswordToken; + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Exception\State\ExpiredException; +use Magento\Framework\Phrase; + +/** + * Get Customer By reset password token + * @SuppressWarnings(PHPMD.LongVariable) + */ +class GetCustomerByToken +{ + /** + * @var \Magento\Customer\Api\CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @var \Magento\Framework\Api\SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + + /** + * ForgotPassword constructor. + * + * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder + */ + public function __construct( + CustomerRepositoryInterface $customerRepository, + SearchCriteriaBuilder $searchCriteriaBuilder + ) { + $this->customerRepository = $customerRepository; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * Get customer by rp_token + * + * @param string $resetPasswordToken + * + * @return \Magento\Customer\Api\Data\CustomerInterface + * @throws ExpiredException + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function execute(string $resetPasswordToken):CustomerInterface + { + $this->searchCriteriaBuilder->addFilter( + 'rp_token', + $resetPasswordToken + ); + $this->searchCriteriaBuilder->setPageSize(1); + $found = $this->customerRepository->getList( + $this->searchCriteriaBuilder->create() + ); + + if ($found->getTotalCount() > 1) { + //Failed to generated unique RP token + throw new ExpiredException( + new Phrase('Reset password token expired.') + ); + } + if ($found->getTotalCount() === 0) { + //Customer with such token not found. + new NoSuchEntityException( + new Phrase( + 'No such entity with rp_token = %value', + [ + 'value' => $resetPasswordToken + ] + ) + ); + } + + //Unique customer found. + return $found->getItems()[0]; + } +} diff --git a/app/code/Magento/Customer/Model/ResourceModel/Customer.php b/app/code/Magento/Customer/Model/ResourceModel/Customer.php index 2eb1ef897e70e..94196df6fe093 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Customer.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Customer.php @@ -95,9 +95,12 @@ protected function _getDefaultAttributes() /** * Check customer scope, email and confirmation key before saving * - * @param \Magento\Framework\DataObject $customer + * @param \Magento\Framework\DataObject|\Magento\Customer\Api\Data\CustomerInterface $customer + * * @return $this - * @throws \Magento\Framework\Exception\LocalizedException + * @throws AlreadyExistsException + * @throws ValidatorException + * @throws \Magento\Framework\Exception\NoSuchEntityException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -141,9 +144,7 @@ protected function _beforeSave(\Magento\Framework\DataObject $customer) } // set confirmation key logic - if ($customer->getForceConfirmed() || $customer->getPasswordHash() == '') { - $customer->setConfirmation(null); - } elseif (!$customer->getId() && $customer->isConfirmationRequired()) { + if (!$customer->getId() && $customer->isConfirmationRequired()) { $customer->setConfirmation($customer->getRandomConfirmationKey()); } // remove customer confirmation key from database, if empty @@ -163,7 +164,7 @@ protected function _beforeSave(\Magento\Framework\DataObject $customer) * * @param \Magento\Customer\Model\Customer $customer * @return void - * @throws \Magento\Framework\Validator\Exception + * @throws ValidatorException */ protected function _validate($customer) { diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php index 10b632c002475..9377c872517ce 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php @@ -15,17 +15,17 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\Value; use Magento\Framework\App\Http; +use Magento\Framework\App\Request\Http as HttpRequest; use Magento\Framework\Data\Form\FormKey; use Magento\Framework\Message\MessageInterface; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Stdlib\CookieManagerInterface; use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Mail\Template\TransportBuilderMock; use Magento\TestFramework\Request; use Magento\TestFramework\Response; -use Zend\Stdlib\Parameters; -use Magento\Framework\App\Request\Http as HttpRequest; -use Magento\TestFramework\Mail\Template\TransportBuilderMock; -use Magento\Framework\Serialize\Serializer\Json; -use Magento\Framework\Stdlib\CookieManagerInterface; use Magento\Theme\Controller\Result\MessagePlugin; +use Zend\Stdlib\Parameters; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -169,6 +169,7 @@ public function testCreatepasswordActionWithDirectLink() $token = Bootstrap::getObjectManager()->get(\Magento\Framework\Math\Random::class) ->getUniqueHash(); $customer->changeResetPasswordLinkToken($token); + $customer->setData('confirmation', 'confirmation'); $customer->save(); $this->getRequest()->setParam('token', $token); @@ -187,6 +188,7 @@ public function testCreatepasswordActionWithDirectLink() $session = Bootstrap::getObjectManager()->get(Session::class); $this->assertEquals($token, $session->getRpToken()); $this->assertNotContains($token, $response->getHeader('Location')->getFieldValue()); + $this->assertCustomerConfirmationEquals(1, null); } /** @@ -201,6 +203,7 @@ public function testCreatepasswordActionWithSession() $token = Bootstrap::getObjectManager()->get(\Magento\Framework\Math\Random::class) ->getUniqueHash(); $customer->changeResetPasswordLinkToken($token); + $customer->setData('confirmation', 'confirmation'); $customer->save(); /** @var \Magento\Customer\Model\Session $customer */ @@ -213,6 +216,7 @@ public function testCreatepasswordActionWithSession() $response = $this->getResponse(); $text = $response->getBody(); $this->assertTrue((bool)preg_match('/' . $token . '/m', $text)); + $this->assertCustomerConfirmationEquals(1, null); } /** @@ -227,6 +231,7 @@ public function testCreatepasswordActionInvalidToken() $token = Bootstrap::getObjectManager()->get(\Magento\Framework\Math\Random::class) ->getUniqueHash(); $customer->changeResetPasswordLinkToken($token); + $customer->setData('confirmation', 'confirmation'); $customer->save(); $this->getRequest()->setParam('token', 'INVALIDTOKEN'); @@ -238,6 +243,19 @@ public function testCreatepasswordActionInvalidToken() $response = $this->getResponse(); $this->assertEquals(302, $response->getHttpResponseCode()); $this->assertContains('customer/account/forgotpassword', $response->getHeader('Location')->getFieldValue()); + $this->assertCustomerConfirmationEquals(1, 'confirmation'); + } + + /** + * @param int $customerId + * @param string|null $confirmation + */ + private function assertCustomerConfirmationEquals(int $customerId, string $confirmation = null) + { + /** @var \Magento\Customer\Model\Customer $customer */ + $customer = Bootstrap::getObjectManager() + ->create(\Magento\Customer\Model\Customer::class)->load($customerId); + $this->assertEquals($confirmation, $customer->getConfirmation()); } /** @@ -913,6 +931,7 @@ private function getConfirmationUrlFromMessageContent(string $content): string if (preg_match('<a\s*href="(?<url>.*?)".*>', $content, $matches)) { $confirmationUrl = $matches['url']; $confirmationUrl = str_replace('http://localhost/index.php/', '', $confirmationUrl); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $confirmationUrl = html_entity_decode($confirmationUrl); } From a7bdee7178d21fdefce5593222f0b40ab4a0faf0 Mon Sep 17 00:00:00 2001 From: Vaha <vaha@atwix.com> Date: Thu, 16 May 2019 13:58:49 +0300 Subject: [PATCH 126/464] #681: [Test coverage] added test cases for missed or empty cart_id in cart operations --- .../Customer/AddSimpleProductToCartTest.php | 111 +++++++++++++++++- .../Customer/AddVirtualProductToCartTest.php | 111 +++++++++++++++++- .../GraphQl/Quote/Customer/GetCartTest.php | 40 ++++++- .../GraphQl/Quote/Customer/PlaceOrderTest.php | 34 ++++++ .../Customer/RemoveCouponFromCartTest.php | 41 ++++++- .../Guest/AddSimpleProductToCartTest.php | 107 ++++++++++++++++- .../Guest/AddVirtualProductToCartTest.php | 107 ++++++++++++++++- .../GraphQl/Quote/Guest/GetCartTest.php | 38 +++++- .../GraphQl/Quote/Guest/PlaceOrderTest.php | 32 +++++ .../Quote/Guest/RemoveCouponFromCartTest.php | 39 +++++- 10 files changed, 640 insertions(+), 20 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php index aca13e53875dd..e1b93e0bdb857 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Customer; +use Exception; use Magento\Framework\Exception\AuthenticationException; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; @@ -53,11 +54,117 @@ public function testAddSimpleProductToCart() self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddSimpleProductToCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddSimpleProductToCartIfCartIdIsEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddSimpleProductToCartIfCartItemsAreMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id" + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddSimpleProductToCartIfCartItemsAreEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testAddProductToNonExistentCart() @@ -74,7 +181,7 @@ public function testAddProductToNonExistentCart() * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a product with SKU "simple_product" */ public function testNonExistentProductToCart() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php index 86573dcde2e35..ae0208ca3101b 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Customer; +use Exception; use Magento\Framework\Exception\AuthenticationException; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; @@ -53,11 +54,117 @@ public function testAddVirtualProductToCart() self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddVirtualProductToCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddVirtualProductToCartIfCartIdIsEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddVirtualProductToCartIfCartItemsAreMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id" + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddVirtualProductToCartIfCartItemsAreEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testAddVirtualToNonExistentCart() @@ -74,7 +181,7 @@ public function testAddVirtualToNonExistentCart() * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a product with SKU "virtual_product" */ public function testNonExistentProductToCart() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCartTest.php index 99e1c0bbd1579..77c69ee3e2b83 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Customer; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -94,10 +95,41 @@ public function testGetAnotherCustomerCart() $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com')); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testGetCartIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlQuery($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Field "cart" argument "cart_id" of type "String!" is required but not provided. + */ + public function testGetCartIfCartIdIsMissed() + { + $query = <<<QUERY +{ + cart { + email + } +} +QUERY; + + $this->graphQlQuery($query, [], '', $this->getHeaderMap()); + } + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testGetNonExistentCart() @@ -113,7 +145,7 @@ public function testGetNonExistentCart() * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/make_cart_inactive.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Current user does not have an active cart. */ public function testGetInactiveCart() @@ -145,7 +177,7 @@ public function testGetCartWithNotDefaultStore() * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php * @magentoApiDataFixture Magento/Store/_files/second_store.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Wrong store code specified for cart */ public function testGetCartWithWrongStore() @@ -162,7 +194,7 @@ public function testGetCartWithWrongStore() /** * @magentoApiDataFixture Magento/Checkout/_files/active_quote_customer_not_default_store.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Requested store is not found */ public function testGetCartWithNotExistingStore() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php index 47d0d661fb33c..591bac1c35ba6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/PlaceOrderTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Customer; +use Exception; use Magento\Framework\Registry; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; @@ -83,6 +84,39 @@ public function testPlaceOrder() self::assertEquals($reservedOrderId, $response['placeOrder']['order']['order_id']); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testPlaceOrderIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testPlaceOrderIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + placeOrder(input: {}) { + order { + order_id + } + } +} +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php index ce1c85417b165..f906b33fe19d1 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveCouponFromCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Customer; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -58,7 +59,43 @@ public function testRemoveCouponFromCart() /** * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException \Exception + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testRemoveCouponFromCartIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testRemoveCouponFromCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + removeCouponFromCart(input: {}) { + cart { + applied_coupon { + code + } + } + } +} + +QUERY; + + $this->graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testRemoveCouponFromNonExistentCart() @@ -72,7 +109,7 @@ public function testRemoveCouponFromNonExistentCart() /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Cart does not contain products */ public function testRemoveCouponFromEmptyCart() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php index 9a943cf4b204e..4deed99243f9d 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Guest; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -48,10 +49,112 @@ public function testAddSimpleProductToCart() self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddSimpleProductToCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddSimpleProductToCartIfCartIdIsEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddSimpleProductToCartIfCartItemsAreMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id" + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddSimpleProductToCartIfCartItemsAreEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testAddProductToNonExistentCart() @@ -67,7 +170,7 @@ public function testAddProductToNonExistentCart() /** * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a product with SKU "simple_product" */ public function testNonExistentProductToCart() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php index cadbec857c2d6..131ff0c480d64 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Guest; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -48,10 +49,112 @@ public function testAddVirtualProductToCart() self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddVirtualProductToCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testAddVirtualProductToCartIfCartIdIsEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddVirtualProductToCartIfCartItemsAreMissed() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id" + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_items" is missing + */ + public function testAddVirtualProductToCartIfCartItemsAreEmpty() + { + $query = <<<QUERY +mutation { + addSimpleProductsToCart( + input: { + cart_id: "cart_id", + cart_items: [] + } + ) { + cart { + items { + id + } + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/virtual_product.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testAddVirtualToNonExistentCart() @@ -67,7 +170,7 @@ public function testAddVirtualToNonExistentCart() /** * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Could not find a product with SKU "virtual_product" */ public function testNonExistentProductToCart() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetCartTest.php index b35d689af7d20..d39f1b42459c7 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Guest; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -71,7 +72,36 @@ public function testGetCustomerCart() } /** - * @expectedException \Exception + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testGetCartIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlQuery($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Field "cart" argument "cart_id" of type "String!" is required but not provided. + */ + public function testGetCartIfCartIdIsMissed() + { + $query = <<<QUERY +{ + cart { + email + } +} +QUERY; + + $this->graphQlQuery($query); + } + + /** + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testGetNonExistentCart() @@ -86,7 +116,7 @@ public function testGetNonExistentCart() * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/make_cart_inactive.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Current user does not have an active cart. */ public function testGetInactiveCart() @@ -116,7 +146,7 @@ public function testGetCartWithNotDefaultStore() * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php * @magentoApiDataFixture Magento/Store/_files/second_store.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Wrong store code specified for cart */ public function testGetCartWithWrongStore() @@ -132,7 +162,7 @@ public function testGetCartWithWrongStore() * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Checkout/_files/active_quote_guest_not_default_store.php * - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Requested store is not found */ public function testGetCartWithNotExistingStore() diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php index 30ad69eada29d..828bddcadebcb 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Guest; +use Exception; use Magento\Framework\Registry; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Sales\Api\OrderRepositoryInterface; @@ -76,6 +77,37 @@ public function testPlaceOrder() self::assertEquals($reservedOrderId, $response['placeOrder']['order']['order_id']); } + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testPlaceOrderIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testPlaceOrderIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + placeOrder(input: {}) { + order { + order_id + } + } +} +QUERY; + + $this->graphQlMutation($query); + } + /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php index 5adb6ce65db6f..57a13e2f1bc03 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveCouponFromCartTest.php @@ -7,6 +7,7 @@ namespace Magento\GraphQl\Quote\Guest; +use Exception; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -49,7 +50,41 @@ public function testRemoveCouponFromCart() } /** - * @expectedException \Exception + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testRemoveCouponFromCartIfCartIdIsEmpty() + { + $maskedQuoteId = ''; + $query = $this->getQuery($maskedQuoteId); + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Required parameter "cart_id" is missing + */ + public function testRemoveCouponFromCartIfCartIdIsMissed() + { + $query = <<<QUERY +mutation { + removeCouponFromCart(input: {}) { + cart { + applied_coupon { + code + } + } + } +} + +QUERY; + + $this->graphQlMutation($query); + } + + /** + * @expectedException Exception * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id" */ public function testRemoveCouponFromNonExistentCart() @@ -62,7 +97,7 @@ public function testRemoveCouponFromNonExistentCart() /** * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php - * @expectedException \Exception + * @expectedException Exception * @expectedExceptionMessage Cart does not contain products */ public function testRemoveCouponFromEmptyCart() From 43821ef2f6103cfa3b3506d9b58d43feb79531a6 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 16 May 2019 09:44:11 -0500 Subject: [PATCH 127/464] MAGETWO-99479: Use Escaper methods - fix unit --- app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 91fa6097c2d76..86d57815e02be 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -162,7 +162,7 @@ public function testNotAllowedPath() * Check not exists sitemap path validation * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please create the specified folder "" before saving the sitemap. + * @expectedExceptionMessage Please create the specified folder "/" before saving the sitemap. */ public function testPathNotExists() { From 1929be0f45d85fe329395e206e0b220af90797b9 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Thu, 16 May 2019 09:52:45 -0500 Subject: [PATCH 128/464] MAGETWO-99647: Custom customer address attribute (dropdown) not getting populated for addresses for creation of orders in Admin --- .../view/adminhtml/templates/order/create/form/address.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 89ed5feb66acf..128efb08ec78f 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -32,7 +32,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @noEscapeCreate/Form/Address.php */ $block->getAddressCollectionJson() ?>); + order.setAddresses(<?= /* @noEscapeCreate */ $block->getAddressCollectionJson() ?>); }); </script> From e0992e90ce667199cd050fb0e2b4ff39766d2791 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Thu, 16 May 2019 09:55:00 -0500 Subject: [PATCH 129/464] MAGETWO-99647: Custom customer address attribute (dropdown) not getting populated for addresses for creation of orders in Admin --- .../view/adminhtml/templates/order/create/form/address.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 128efb08ec78f..22db07d046fc9 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -32,7 +32,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @noEscapeCreate */ $block->getAddressCollectionJson() ?>); + order.setAddresses(<?= /* @noEscape */ $block->getAddressCollectionJson() ?>); }); </script> From ddbbae2e3826e731fe7fcf5029dbf6b778ecf74d Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 16 May 2019 14:13:16 -0500 Subject: [PATCH 130/464] MAGETWO-99479: Use Escaper methods - fix integration - update to escaper method --- .../Tax/Controller/Adminhtml/RateTest.php | 4 ++-- .../Magento/Framework/Convert/Excel.php | 22 +++++++++++++++---- .../Data/Form/Element/AbstractElement.php | 3 ++- .../Framework/Data/Form/Filter/Escapehtml.php | 21 +++++++++++++++++- .../Framework/View/Element/Html/Date.php | 2 +- 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php index c2f7b498e63e3..ae5f81817ddbf 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php @@ -17,7 +17,7 @@ class RateTest extends \Magento\TestFramework\TestCase\AbstractBackendController */ public function testAjaxSaveAction($postData, $expectedData) { - $this->getRequest()->setPostValue($postData); + $this->getRequest()->setPostValue($postData)->setMethod('POST'); $this->dispatch('backend/tax/rate/ajaxSave'); @@ -85,7 +85,7 @@ public function ajaxSaveActionDataProvider() */ public function testAjaxSaveActionInvalidData($postData, $expectedData) { - $this->getRequest()->setPostValue($postData); + $this->getRequest()->setPostValue($postData)->setMethod('POST'); $this->dispatch('backend/tax/rate/ajaxSave'); diff --git a/lib/internal/Magento/Framework/Convert/Excel.php b/lib/internal/Magento/Framework/Convert/Excel.php index 09acd88b38a7f..13d8c0fa9d56b 100644 --- a/lib/internal/Magento/Framework/Convert/Excel.php +++ b/lib/internal/Magento/Framework/Convert/Excel.php @@ -12,6 +12,11 @@ */ class Excel { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * \ArrayIterator Object * @@ -45,15 +50,23 @@ class Excel * * @param \Iterator $iterator * @param array $rowCallback + * @param \Magento\Framework\Escaper|null $escaper */ - public function __construct(\Iterator $iterator, $rowCallback = []) - { + public function __construct( + \Iterator $iterator, + $rowCallback = [], + \Magento\Framework\Escaper $escaper = null + ) { $this->_iterator = $iterator; $this->_rowCallback = $rowCallback; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** * Retrieve Excel XML Document Header XML Fragment + * * Append data header if it is available * * @param string $sheetName @@ -65,7 +78,7 @@ protected function _getXmlHeader($sheetName = '') $sheetName = 'Sheet 1'; } - $sheetName = htmlspecialchars($sheetName); + $sheetName = $this->escaper->escapeHtml($sheetName); $xmlHeader = '<' . '?xml version="1.0"?' . @@ -98,6 +111,7 @@ protected function _getXmlHeader($sheetName = '') /** * Retrieve Excel XML Document Footer XML Fragment + * * Append data footer if it is available * * @return string @@ -133,7 +147,7 @@ protected function _getXmlRow($row, $useCallback) $xmlData[] = '<Row>'; foreach ($row as $value) { - $value = htmlspecialchars($value); + $value = $this->escaper->escapeHtml($value); $dataType = is_numeric($value) && $value[0] !== '+' && $value[0] !== '0' ? 'Number' : 'String'; /** diff --git a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php index 14f4df7208b04..ff1e3ba63ba8a 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php @@ -13,6 +13,7 @@ /** * Data form abstract class * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.NumberOfChildren) @@ -291,7 +292,7 @@ public function removeClass($class) */ protected function _escape($string) { - return htmlspecialchars($string, ENT_COMPAT); + return $this->_escaper->escapeHtml($string); } /** diff --git a/lib/internal/Magento/Framework/Data/Form/Filter/Escapehtml.php b/lib/internal/Magento/Framework/Data/Form/Filter/Escapehtml.php index 6feca703f15fe..54821217ca124 100644 --- a/lib/internal/Magento/Framework/Data/Form/Filter/Escapehtml.php +++ b/lib/internal/Magento/Framework/Data/Form/Filter/Escapehtml.php @@ -11,8 +11,27 @@ */ namespace Magento\Framework\Data\Form\Filter; +/** + * EscapeHtml Form Filter Data + */ class Escapehtml implements \Magento\Framework\Data\Form\Filter\FilterInterface { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + + /** + * @param \Magento\Framework\Escaper|null $escaper + */ + public function __construct( + \Magento\Framework\Escaper $escaper = null + ) { + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); + } + /** * Returns the result of filtering $value * @@ -32,6 +51,6 @@ public function inputFilter($value) */ public function outputFilter($value) { - return htmlspecialchars($value); + return $this->escaper->escapeHtml($value); } } diff --git a/lib/internal/Magento/Framework/View/Element/Html/Date.php b/lib/internal/Magento/Framework/View/Element/Html/Date.php index 558e39427cb44..909938256b133 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Date.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Date.php @@ -78,7 +78,7 @@ public function getEscapedValue() if ($this->getFormat() && $this->getValue()) { return strftime($this->getFormat(), strtotime($this->getValue())); } - return htmlspecialchars($this->getValue()); + return $this->escapeHtml($this->getValue()); } /** From f40f24c3ff971fe49480a470868f443b6061d349 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Thu, 16 May 2019 14:18:09 -0500 Subject: [PATCH 131/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../Adminhtml/Product/Edit/AttributeSet.php | 6 +- .../Product/Edit/Tab/Attributes/Search.php | 2 +- .../Magento/Catalog/Block/Product/Gallery.php | 2 +- .../Catalog/Block/Product/ListProduct.php | 2 +- .../Magento/Catalog/Block/Product/View.php | 10 +- .../Catalog/Block/Product/View/Gallery.php | 2 +- .../catalog/category/checkboxes/tree.phtml | 1 - .../templates/catalog/category/edit.phtml | 6 +- .../category/edit/assign_products.phtml | 4 +- .../templates/catalog/category/tree.phtml | 47 +- .../catalog/category/widget/tree.phtml | 33 +- .../form/renderer/fieldset/element.phtml | 47 +- .../adminhtml/templates/catalog/product.phtml | 3 - .../catalog/product/attribute/form.phtml | 10 +- .../catalog/product/attribute/js.phtml | 19 +- .../catalog/product/attribute/labels.phtml | 18 +- .../catalog/product/attribute/options.phtml | 24 +- .../catalog/product/attribute/set/main.phtml | 39 +- .../product/attribute/set/toolbar/add.phtml | 2 +- .../product/attribute/set/toolbar/main.phtml | 3 - .../catalog/product/composite/configure.phtml | 7 +- .../product/composite/fieldset/options.phtml | 24 +- .../fieldset/options/type/date.phtml | 132 ++-- .../fieldset/options/type/file.phtml | 45 +- .../fieldset/options/type/select.phtml | 11 +- .../fieldset/options/type/text.phtml | 29 +- .../product/composite/fieldset/qty.phtml | 11 +- .../templates/catalog/product/edit.phtml | 37 +- .../product/edit/action/attribute.phtml | 11 +- .../product/edit/action/inventory.phtml | 208 +++-- .../product/edit/action/websites.phtml | 48 +- .../catalog/product/edit/attribute_set.phtml | 6 +- .../product/edit/category/new/form.phtml | 2 +- .../catalog/product/edit/options.phtml | 7 +- .../catalog/product/edit/options/option.phtml | 84 +- .../product/edit/options/type/date.phtml | 8 +- .../product/edit/options/type/file.phtml | 45 +- .../product/edit/options/type/select.phtml | 12 +- .../product/edit/options/type/text.phtml | 10 +- .../catalog/product/edit/price/tier.phtml | 76 +- .../catalog/product/edit/serializer.phtml | 9 +- .../catalog/product/edit/websites.phtml | 41 +- .../catalog/product/helper/gallery.phtml | 212 +++-- .../templates/catalog/product/js.phtml | 12 +- .../templates/catalog/product/tab/alert.phtml | 4 +- .../catalog/product/tab/inventory.phtml | 734 ++++++++++-------- .../product/edit/attribute/search.phtml | 16 +- .../templates/product/edit/tabs.phtml | 65 +- .../product/edit/tabs/child_tab.phtml | 4 +- .../product/grid/massaction_extended.phtml | 45 +- .../adminhtml/templates/rss/grid/link.phtml | 6 +- .../view/base/templates/js/components.phtml | 3 - .../fieldset/options/view/checkable.phtml | 69 +- .../product/price/amount/default.phtml | 31 +- .../templates/product/price/default.phtml | 5 +- .../templates/product/price/final_price.phtml | 25 +- .../templates/product/price/tier_prices.phtml | 66 +- .../frontend/templates/category/cms.phtml | 5 +- .../templates/category/description.phtml | 13 +- .../frontend/templates/category/image.phtml | 19 +- .../templates/category/products.phtml | 5 +- .../frontend/templates/category/rss.phtml | 8 +- .../category/widget/link/link_block.phtml | 4 +- .../category/widget/link/link_href.phtml | 1 - .../category/widget/link/link_inline.phtml | 4 +- .../templates/frontend_storage_manager.phtml | 8 +- .../messages/addCompareSuccessMessage.phtml | 12 +- .../frontend/templates/navigation/left.phtml | 24 +- .../templates/product/compare/link.phtml | 8 +- .../templates/product/compare/list.phtml | 108 +-- .../templates/product/compare/sidebar.phtml | 20 +- .../frontend/templates/product/gallery.phtml | 52 +- .../frontend/templates/product/image.phtml | 10 +- .../product/image_with_borders.phtml | 16 +- .../frontend/templates/product/list.phtml | 77 +- .../product/list/addto/compare.phtml | 5 +- .../templates/product/list/items.phtml | 205 ++--- .../templates/product/list/toolbar.phtml | 15 +- .../product/list/toolbar/amount.phtml | 35 +- .../product/list/toolbar/limiter.phtml | 18 +- .../product/list/toolbar/sorter.phtml | 32 +- .../product/list/toolbar/viewmode.phtml | 56 +- .../frontend/templates/product/listing.phtml | 131 ++-- .../templates/product/view/additional.phtml | 7 +- .../templates/product/view/addto.phtml | 2 - .../product/view/addto/compare.phtml | 8 +- .../templates/product/view/addtocart.phtml | 18 +- .../templates/product/view/attribute.phtml | 20 +- .../templates/product/view/attributes.phtml | 12 +- .../templates/product/view/counter.phtml | 2 +- .../templates/product/view/description.phtml | 8 +- .../templates/product/view/details.phtml | 32 +- .../templates/product/view/form.phtml | 22 +- .../templates/product/view/gallery.phtml | 30 +- .../templates/product/view/mailto.phtml | 9 +- .../product/view/opengraph/currency.phtml | 5 +- .../product/view/opengraph/general.phtml | 15 +- .../templates/product/view/options.phtml | 8 +- .../product/view/options/type/date.phtml | 31 +- .../product/view/options/type/default.phtml | 3 - .../product/view/options/type/file.phtml | 47 +- .../product/view/options/type/select.phtml | 13 +- .../product/view/options/type/text.phtml | 47 +- .../product/view/options/wrapper.phtml | 6 +- .../templates/product/view/price_clone.phtml | 3 - .../templates/product/view/review.phtml | 3 - .../templates/product/view/type/default.phtml | 17 +- .../product/widget/link/link_block.phtml | 4 +- .../product/widget/link/link_inline.phtml | 4 +- .../widget/new/column/new_default_list.phtml | 63 +- .../widget/new/column/new_images_list.phtml | 16 +- .../widget/new/column/new_names_list.phtml | 20 +- .../product/widget/new/content/new_grid.phtml | 100 +-- .../product/widget/new/content/new_list.phtml | 104 +-- .../product/widget/viewed/grid.phtml | 9 +- .../product/widget/viewed/list.phtml | 9 +- app/code/Magento/Wishlist/Helper/Data.php | 21 +- .../Framework/View/Element/AbstractBlock.php | 2 +- 118 files changed, 2090 insertions(+), 1961 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php index 3467c7aac289b..c22e29008aa4e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php @@ -42,12 +42,14 @@ public function __construct( public function getSelectorOptions() { return [ - 'source' => $this->getUrl('catalog/product/suggestAttributeSets'), + 'source' => $this->escapeUrl($this->getUrl('catalog/product/suggestAttributeSets')), 'className' => 'category-select', 'showRecent' => true, 'storageKey' => 'product-template-key', 'minLength' => 0, - 'currentlySelected' => $this->_coreRegistry->registry('product')->getAttributeSetId() + 'currentlySelected' => $this->escapeHtml( + $this->_coreRegistry->registry('product')->getAttributeSetId() + ) ]; } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index e1b97f996c769..b3e6890adb368 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -68,7 +68,7 @@ public function getSelectorOptions() { $templateId = $this->_coreRegistry->registry('product')->getAttributeSetId(); return [ - 'source' => $this->getUrl('catalog/product/suggestAttributes'), + 'source' => $this->escapeUrl($this->getUrl('catalog/product/suggestAttributes')), 'minLength' => 0, 'ajaxOptions' => ['data' => ['template_id' => $templateId]], 'template' => '[data-template-for="product-attribute-search-' . $this->getGroupId() . '"]', diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index e7c7b81ec29c9..577708c257d35 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -115,7 +115,7 @@ public function getImageWidth() if ($size[0] > 600) { return 600; } else { - return $size[0]; + return (int) $size[0]; } } } diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index c1d79894162ae..144cb682e2d22 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -373,7 +373,7 @@ public function getAddToCartPostParams(Product $product) return [ 'action' => $url, 'data' => [ - 'product' => $product->getEntityId(), + 'product' => (int) $product->getEntityId(), ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl($url), ] ]; diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 8b53223de0b9f..8157279f4cb12 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -189,22 +189,22 @@ public function getJsonConfig() $tierPrices = []; $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); foreach ($tierPricesList as $tierPrice) { - $tierPrices[] = $tierPrice['price']->getValue(); + $tierPrices[] = $tierPrice['price']->getValue() * 1; } $config = [ - 'productId' => $product->getId(), + 'productId' => (int)$product->getId(), 'priceFormat' => $this->_localeFormat->getPriceFormat(), 'prices' => [ 'oldPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), + 'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue() * 1, 'adjustments' => [] ], 'basePrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(), + 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount() * 1, 'adjustments' => [] ], 'finalPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(), + 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() * 1, 'adjustments' => [] ] ], diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 8b98fbdc8f7ef..7d84b2dbc2cee 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -114,7 +114,7 @@ public function getGalleryImages() */ public function getMagnifier() { - return $this->jsonEncoder->encode($this->getVar('magnifier')); + return $this->jsonEncoder->encode($this->escapeJs($this->getVar('magnifier'))); } /** diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml index ee67acd0ebd46..cea54e883d2aa 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** * @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree */ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml index f58b39a819a0c..c77b66733afc4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml @@ -5,18 +5,18 @@ */ /** - * Template for \Magento\Catalog\Block\Adminhtml\Category\Edit + * @var $block \Magento\Catalog\Block\Adminhtml\Category\Edit */ ?> <div data-id="information-dialog-category" class="messages" style="display: none;"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('This operation can take a long time') ?></div> + <div><?= $block->escapeHtml(__('This operation can take a long time')) ?></div> </div> </div> <script type="text/x-magento-init"> { "*": { - "categoryForm": {"refreshUrl": "<?= /* @escapeNotVerified */ $block->getRefreshPathUrl() ?>"} + "categoryForm": {"refreshUrl": "<?= $block->escapeJs($block->escapeUrl($block->getRefreshPathUrl())) ?>"} } } </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml index 4691a709cadeb..af7aec12a57ed 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml @@ -16,8 +16,8 @@ $gridJsObjectName = $blockGrid->getJsObjectName(); { "*": { "Magento_Catalog/catalog/category/assign-products": { - "selectedProducts": <?= /* @escapeNotVerified */ $block->getProductsJson() ?>, - "gridJsObjectName": <?= /* @escapeNotVerified */ '"' . $gridJsObjectName . '"' ?: '{}' ?> + "selectedProducts": <?= /* @noEscape */ $block->getProductsJson() ?>, + "gridJsObjectName": <?= /* @noEscape */ '"' . $gridJsObjectName . '"' ?: '{}' ?> } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index f448edc692ce2..382f5b4016742 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -4,27 +4,26 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree */ ?> <div class="categories-side-col"> <div class="sidebar-actions"> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <?= $block->getAddRootButtonHtml() ?><br/> <?= $block->getAddSubButtonHtml() ?> <?php endif; ?> </div> <div class="tree-actions"> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <?php //echo $block->getCollapseButtonHtml() ?> <?php //echo $block->getExpandButtonHtml() ?> <a href="#" - onclick="tree.collapseTree(); return false;"><?= /* @escapeNotVerified */ __('Collapse All') ?></a> + onclick="tree.collapseTree(); return false;"><?= $block->escapeHtml(__('Collapse All')) ?></a> <span class="separator">|</span> <a href="#" - onclick="tree.expandTree(); return false;"><?= /* @escapeNotVerified */ __('Expand All') ?></a> + onclick="tree.expandTree(); return false;"><?= $block->escapeHtml(_('Expand All')) ?></a> <?php endif; ?> </div> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <div class="tree-holder"> <div id="tree-div" class="tree-wrapper"></div> </div> @@ -32,7 +31,7 @@ <div data-id="information-dialog-tree" class="messages" style="display: none;"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('This operation can take a long time') ?></div> + <div><?= $block->escapeHtml(__('This operation can take a long time')) ?></div> </div> </div> <script> @@ -172,7 +171,7 @@ if (!this.collapsed) { this.collapsed = true; - this.loader.dataUrl = '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl(false) ?>'; + this.loader.dataUrl = '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl(false))) ?>'; this.request(this.loader.dataUrl, false); } }, @@ -181,7 +180,7 @@ this.expandAll(); if (this.collapsed) { this.collapsed = false; - this.loader.dataUrl = '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl(true) ?>'; + this.loader.dataUrl = '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl(true))) ?>'; this.request(this.loader.dataUrl, false); } }, @@ -216,7 +215,7 @@ if (tree && switcherParams) { var url; if (switcherParams.useConfirm) { - if (!confirm("<?= /* @escapeNotVerified */ __('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")) { + if (!confirm("<?= $block->escapeJs(__('Please confirm site switching. All data that hasn\'t been saved will be lost.')) ?>")) { return false; } } @@ -259,7 +258,7 @@ } }); } else { - var baseUrl = '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>'; + var baseUrl = '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>'; var urlExt = switcherParams.scopeParams + 'id/' + tree.currentNodeId + '/'; url = parseSidUrl(baseUrl, urlExt); setLocation(url); @@ -296,7 +295,7 @@ if (scopeParams) { url = url + scopeParams; } - <?php if ($block->isClearEdit()): ?> + <?php if ($block->isClearEdit()) :?> if (selectedNode) { url = url + 'id/' + config.parameters.category_id; } @@ -307,7 +306,7 @@ jQuery(function () { categoryLoader = new Ext.tree.TreeLoader({ - dataUrl: '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl() ?>' + dataUrl: '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl())) ?>' }); categoryLoader.processResponse = function (response, parent, callback) { @@ -389,26 +388,26 @@ enableDD: true, containerScroll: true, selModel: new Ext.tree.CheckNodeMultiSelectionModel(), - rootVisible: '<?= /* @escapeNotVerified */ $block->getRoot()->getIsVisible() ?>', - useAjax: <?= /* @escapeNotVerified */ $block->getUseAjax() ?>, - switchTreeUrl: '<?= /* @escapeNotVerified */ $block->getSwitchTreeUrl() ?>', - editUrl: '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>', - currentNodeId: <?= /* @escapeNotVerified */ (int)$block->getCategoryId() ?>, - baseUrl: '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>' + rootVisible: '<?= (bool)$block->getRoot()->getIsVisible() ?>', + useAjax: <?= (bool)$block->getUseAjax() ?>, + switchTreeUrl: '<?= $block->escapeJs($block->escapeUrl($block->getSwitchTreeUrl())) ?>', + editUrl: '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>', + currentNodeId: <?= (int)$block->getCategoryId() ?>, + baseUrl: '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>' }; defaultLoadTreeParams = { parameters: { - text: <?= /* @escapeNotVerified */ json_encode(htmlentities($block->getRoot()->getName())) ?>, + text: <?= /* @noEscape */ json_encode(htmlentities($block->getRoot()->getName())) ?>, draggable: false, - allowDrop: <?php if ($block->getRoot()->getIsVisible()): ?>true<?php else : ?>false<?php endif; ?>, + allowDrop: <?php if ($block->getRoot()->getIsVisible()) :?>true<?php else :?>false<?php endif; ?>, id: <?= (int)$block->getRoot()->getId() ?>, expanded: <?= (int)$block->getIsWasExpanded() ?>, store_id: <?= (int)$block->getStore()->getId() ?>, category_id: <?= (int)$block->getCategoryId() ?>, parent: <?= (int)$block->getRequest()->getParam('parent') ?> }, - data: <?= /* @escapeNotVerified */ $block->getTreeJson() ?> + data: <?= /* @noEscape */ $block->getTreeJson() ?> }; reRenderTree(); @@ -486,7 +485,7 @@ click: function () { (function ($) { $.ajax({ - url: '<?= /* @escapeNotVerified */ $block->getMoveUrl() ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getMoveUrl())) ?>', method: 'POST', data: registry.get('pd'), showLoader: true diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml index 69737b8a37c1c..4113a52877ef1 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml @@ -3,24 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_divId = 'tree' . $block->getId() ?> -<div id="<?= /* @escapeNotVerified */ $_divId ?>" class="tree"></div> +<div id="<?= $block->escapeHtmlAttr($_divId) ?>" class="tree"></div> <!--[if IE]> <script id="ie-deferred-loader" defer="defer" src="//:"></script> <![endif]--> <script> require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){ -var tree<?= /* @escapeNotVerified */ $block->getId() ?>; +var tree<?= $block->escapeJs($block->getId()) ?>; -var useMassaction = <?= /* @escapeNotVerified */ $block->getUseMassaction() ? 1 : 0 ?>; +var useMassaction = <?= $block->getUseMassaction() ? 1 : 0 ?>; -var isAnchorOnly = <?= /* @escapeNotVerified */ $block->getIsAnchorOnly() ? 1 : 0 ?>; +var isAnchorOnly = <?= $block->getIsAnchorOnly() ? 1 : 0 ?>; Ext.tree.TreePanel.Enhanced = function(el, config) { @@ -44,8 +41,8 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { this.setRootNode(root); if (firstLoad) { - <?php if ($block->getNodeClickListener()): ?> - this.addListener('click', <?= /* @escapeNotVerified */ $block->getNodeClickListener() ?>.createDelegate(this)); + <?php if ($block->getNodeClickListener()) :?> + this.addListener('click', <?= $block->escapeJs($block->getNodeClickListener()) ?>.createDelegate(this)); <?php endif; ?> } @@ -58,10 +55,10 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { jQuery(function() { - var emptyNodeAdded = <?= /* @escapeNotVerified */ ($block->getWithEmptyNode() ? 'false' : 'true') ?>; + var emptyNodeAdded = <?= ($block->getWithEmptyNode() ? 'false' : 'true') ?>; var categoryLoader = new Ext.tree.TreeLoader({ - dataUrl: '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl() ?>' + dataUrl: '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl())) ?>' }); categoryLoader.buildCategoryTree = function(parent, config) @@ -80,7 +77,7 @@ jQuery(function() // Add empty node to reset category filter if(!emptyNodeAdded) { var empty = Object.clone(_node); - empty.text = '<?= /* @escapeNotVerified */ __('None') ?>'; + empty.text = '<?= $block->escapeJs(__('None')) ?>'; empty.children = []; empty.id = 'none'; empty.path = '1/none'; @@ -151,11 +148,11 @@ jQuery(function() }; categoryLoader.on("beforeload", function(treeLoader, node) { - $('<?= /* @escapeNotVerified */ $_divId ?>').fire('category:beforeLoad', {treeLoader:treeLoader}); + $('<?= $block->escapeJs($_divId) ?>').fire('category:beforeLoad', {treeLoader:treeLoader}); treeLoader.baseParams.id = node.attributes.id; }); - tree<?= /* @escapeNotVerified */ $block->getId() ?> = new Ext.tree.TreePanel.Enhanced('<?= /* @escapeNotVerified */ $_divId ?>', { + tree<?= $block->escapeJs($block->getId()) ?> = new Ext.tree.TreePanel.Enhanced('<?= $block->escapeJs($_divId) ?>', { animate: false, loader: categoryLoader, enableDD: false, @@ -167,9 +164,9 @@ jQuery(function() }); if (useMassaction) { - tree<?= /* @escapeNotVerified */ $block->getId() ?>.on('check', function(node) { - $('<?= /* @escapeNotVerified */ $_divId ?>').fire('node:changed', {node:node}); - }, tree<?= /* @escapeNotVerified */ $block->getId() ?>); + tree<?= $block->escapeJs($block->getId()) ?>.on('check', function(node) { + $('<?= $block->escapeJs($_divId) ?>').fire('node:changed', {node:node}); + }, tree<?= $block->escapeJs($block->getId()) ?>); } // set the root node @@ -181,7 +178,7 @@ jQuery(function() category_id: <?= (int) $block->getCategoryId() ?> }; - tree<?= /* @escapeNotVerified */ $block->getId() ?>.loadTree({parameters:parameters, data:<?= /* @escapeNotVerified */ $block->getTreeJson() ?>},true); + tree<?= $block->escapeJs($block->getId()) ?>.loadTree({parameters:parameters, data:<?= /* @noEscape */ $block->getTreeJson() ?>},true); }); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml index 680361eae448e..cbda491a64740 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml @@ -3,19 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php -/** - * @see \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element - */ +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + +/** @var $block \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element */ ?> <?php /* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */ $element = $block->getElement(); -$note = $element->getNote() ? '<div class="note admin__field-note">' . $element->getNote() . '</div>' : ''; +$note = $element->getNote() ? '<div class="note admin__field-note">' . $block->escapeHtml($element->getNote()) . '</div>' : ''; $elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio'; $addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml(); $fieldId = ($element->getHtmlId()) ? ' id="attribute-' . $element->getHtmlId() . '-container"' : ''; @@ -27,8 +24,8 @@ $fieldClass .= ($element->getRequired()) ? ' required' : ''; $fieldClass .= ($note) ? ' with-note' : ''; $fieldClass .= ($entity && $entity->getIsUserDefined()) ? ' user-defined type-' . $entity->getFrontendInput() : ''; -$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' - . $block->getUiId('form-field', $element->getId()); +$fieldAttributes = $fieldId . ' class="' . $block->escapeHtmlAttr($fieldClass) . '" ' + . $block->getUiId('form-field', $block->escapeHtmlAttr($element->getId())); ?> <?php $block->checkFieldDisable() ?> @@ -36,38 +33,38 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' $elementToggleCode = $element->getToggleCode() ? $element->getToggleCode() : 'toggleValueElements(this, this.parentNode.parentNode.parentNode)'; ?> -<?php if (!$element->getNoDisplay()): ?> - <?php if ($element->getType() == 'hidden'): ?> +<?php if (!$element->getNoDisplay()) :?> + <?php if ($element->getType() == 'hidden') :?> <?= $element->getElementHtml() ?> - <?php else: ?> - <div<?= /* @escapeNotVerified */ $fieldAttributes ?> data-attribute-code="<?= $element->getHtmlId() ?>" - data-apply-to="<?= $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + <?php else :?> + <div<?= /* @noEscape */ $fieldAttributes ?> data-attribute-code="<?= $element->getHtmlId() ?>" + data-apply-to="<?= $block->escapeHtmlAttr($this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : [] ))?>" > - <?php if ($elementBeforeLabel): ?> + <?php if ($elementBeforeLabel) :?> <?= $block->getElementHtml() ?> <?= $element->getLabelHtml('', $block->getScopeLabel()) ?> - <?= /* @escapeNotVerified */ $note ?> - <?php else: ?> + <?= /* @noEscape */ $note ?> + <?php else :?> <?= $element->getLabelHtml('', $block->getScopeLabel()) ?> <div class="admin__field-control control"> - <?= /* @escapeNotVerified */ ($addOn) ? '<div class="addon">' . $block->getElementHtml() . '</div>' : $block->getElementHtml() ?> - <?= /* @escapeNotVerified */ $note ?> + <?= ($addOn) ? '<div class="addon">' . $block->getElementHtml() . '</div>' : $block->getElementHtml() ?> + <?= /* @noEscape */ $note ?> </div> <?php endif; ?> <div class="field-service"> - <?php if ($block->canDisplayUseDefault()): ?> + <?php if ($block->canDisplayUseDefault()) :?> <label for="<?= $element->getHtmlId() ?>_default" class="choice use-default"> - <input <?php if ($element->getReadonly()):?> disabled="disabled"<?php endif; ?> + <input <?php if ($element->getReadonly()) :?> disabled="disabled"<?php endif; ?> type="checkbox" name="use_default[]" class="use-default-control" id="<?= $element->getHtmlId() ?>_default" - <?php if ($block->usedDefault()): ?> checked="checked"<?php endif; ?> - onclick="<?= /* @escapeNotVerified */ $elementToggleCode ?>" - value="<?= /* @escapeNotVerified */ $block->getAttributeCode() ?>"/> - <span class="use-default-label"><?= /* @escapeNotVerified */ __('Use Default Value') ?></span> + <?php if ($block->usedDefault()) :?> checked="checked"<?php endif; ?> + onclick="<?= $block->escapeHtmlAttr($elementToggleCode) ?>" + value="<?= $block->escapeHtmlAttr($block->getAttributeCode()) ?>"/> + <span class="use-default-label"><?= $block->escapeHtml(__('Use Default Value')) ?></span> </label> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml index ce4d8450f5e63..9b9fff2cfc344 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml index 124194519b978..e30b981ff36a6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml @@ -4,16 +4,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** * @var $block \Magento\Backend\Block\Widget\Form\Container */ ?> -<?= /* @escapeNotVerified */ $block->getFormInitScripts() ?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions attribute-popup-actions" <?= /* @escapeNotVerified */ $block->getUiId('content-header') ?>> +<?= /* @noEscape */ $block->getFormInitScripts() ?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions attribute-popup-actions" <?= /* @noEscape */ $block->getUiId('content-header') ?>> <?= $block->getButtonsHtml('header') ?> </div> @@ -25,9 +23,9 @@ { "#edit_form": { "Magento_Catalog/catalog/product/edit/attribute": { - "validationUrl": "<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>" + "validationUrl": "<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>" } } } </script> -<?= /* @escapeNotVerified */ $block->getFormScripts() ?> +<?= /* @noEscape */ $block->getFormScripts() ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml index ddcec99f2108c..2dc39b97c3d95 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <script> require([ @@ -197,22 +196,22 @@ function switchDefaultValueField() setRowVisibility('frontend_class', false); break; - <?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?> - case '<?= /* @escapeNotVerified */ $type ?>': + <?php foreach ($this->helper(Magento\Catalog\Helper\Data::class)->getAttributeHiddenFields() as $type => $fields) :?> + case '<?= $block->escapeJs($type) ?>': var isFrontTabHidden = false; - <?php foreach ($fields as $one): ?> - <?php if ($one == '_front_fieldset'): ?> + <?php foreach ($fields as $one) :?> + <?php if ($one == '_front_fieldset') :?> getFrontTab().hide(); isFrontTabHidden = true; - <?php elseif ($one == '_default_value'): ?> + <?php elseif ($one == '_default_value') :?> defaultValueTextVisibility = defaultValueTextareaVisibility = defaultValueDateVisibility = defaultValueYesnoVisibility = false; - <?php elseif ($one == '_scope'): ?> + <?php elseif ($one == '_scope') :?> scopeVisibility = false; - <?php else: ?> - setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false); + <?php else :?> + setRowVisibility('<?= $block->escapeJs($one) ?>', false); <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml index f3d39257c266c..6c614bf8a439a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Labels */ ?> <div class="fieldset-wrapper admin__collapsible-block-wrapper opened" id="manage-titles-wrapper"> <div class="fieldset-wrapper-title"> <strong class="admin__collapsible-title" data-toggle="collapse" data-target="#manage-titles-content"> - <span><?= /* @escapeNotVerified */ __('Manage Titles (Size, Color, etc.)') ?></span> + <span><?= $block->escapeHtml(__('Manage Titles (Size, Color, etc.)')) ?></span> </strong> </div> <div class="fieldset-wrapper-content in collapse" id="manage-titles-content"> @@ -21,17 +19,23 @@ <table class="admin__control-table" id="attribute-labels-table"> <thead> <tr> - <?php foreach ($block->getStores() as $_store): ?> - <th class="col-store-view"><?= /* @escapeNotVerified */ $_store->getName() ?></th> + <?php foreach ($block->getStores() as $_store) :?> + <th class="col-store-view"><?= $block->escapeHtml($_store->getName()) ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <tr> <?php $_labels = $block->getLabelValues() ?> - <?php foreach ($block->getStores() as $_store): ?> + <?php foreach ($block->getStores() as $_store) :?> <td class="col-store-view"> - <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?= /* @escapeNotVerified */ $_store->getId() ?>]" value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/> + <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option<?php endif; ?>" + type="text" + name="frontend_label[<?= $block->escapeHtmlAttr($_store->getId()) ?>]" + value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>" + <?php if ($block->getReadOnly()) :?> + disabled="disabled" + <?php endif;?>/> </td> <?php endforeach; ?> </tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index f812a27f87ad9..e5f8a360c334c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options */ $stores = $block->getStoresSortedBySortOrder(); @@ -23,8 +21,8 @@ $stores = $block->getStoresSortedBySortOrder(); <span><?= $block->escapeHtml(__('Is Default')) ?></span> </th> <?php - foreach ($stores as $_store): ?> - <th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>> + foreach ($stores as $_store) :?> + <th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> class="_required"<?php endif; ?>> <span><?= $block->escapeHtml(__($_store->getName())) ?></span> </th> <?php endforeach; @@ -43,7 +41,7 @@ $stores = $block->getStoresSortedBySortOrder(); </tr> <tr> <th colspan="<?= (int) $storetotal ?>" class="col-actions-add"> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <button id="add_new_option_button" data-action="add_new_row" title="<?= $block->escapeHtml(__('Add Option')) ?>" type="button" class="action- scalable add"> @@ -59,22 +57,22 @@ $stores = $block->getStoresSortedBySortOrder(); <script id="row-template" type="text/x-magento-template"> <tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>> <td class="col-draggable"> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <div data-role="draggable-handle" class="draggable-handle" title="<?= $block->escapeHtml(__('Sort Option')) ?>"> </div> <?php endif; ?> - <input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/> + <input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif; ?>/> </td> <td class="col-default control-table-actions-cell"> - <input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/> + <input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()) :?>disabled="disabled"<?php endif;?>/> </td> - <?php foreach ($stores as $_store): ?> - <td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> + <?php foreach ($stores as $_store) :?> + <td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif;?>/></td> <?php endforeach; ?> <td id="delete_button_container_<%- data.id %>" class="col-delete"> <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" /> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <button id="delete_button_<%- data.id %>" title="<?= $block->escapeHtml(__('Delete')) ?>" type="button" class="action- scalable delete delete-option" > @@ -86,9 +84,9 @@ $stores = $block->getStoresSortedBySortOrder(); </script> <?php $values = []; - foreach($block->getOptionValues() as $value) { + foreach ($block->getOptionValues() as $value) { $value = $value->getData(); - $values[] = is_array($value) ? array_map(function($str) { + $values[] = is_array($value) ? array_map(function ($str) { return htmlspecialchars_decode($str, ENT_QUOTES); }, $value) : $value; } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 9621b9a57168c..630de719b9216 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main */ ?> <div class="attribute-set"> @@ -31,11 +30,11 @@ </div> <div class="attribute-set-col fieldset-wrapper"> <div class="fieldset-wrapper-title"> - <span class="title"><?= /* @escapeNotVerified */ __('Groups') ?></span> + <span class="title"><?= $block->escapeHtml(__('Groups')) ?></span> </div> - <?php if (!$block->getIsReadOnly()): ?> - <?= /* @escapeNotVerified */ $block->getAddGroupButton() ?> <?= /* @escapeNotVerified */ $block->getDeleteGroupButton() ?> - <p class="note-block"><?= /* @escapeNotVerified */ __('Double click on a group to rename it.') ?></p> + <?php if (!$block->getIsReadOnly()) :?> + <?= /* @noEscape */ $block->getAddGroupButton() ?> <?= /* @noEscape */ $block->getDeleteGroupButton() ?> + <p class="note-block"><?= $block->escapeHtml(__('Double click on a group to rename it.')) ?></p> <?php endif; ?> <?= $block->getSetsFilterHtml() ?> @@ -43,7 +42,7 @@ </div> <div class="attribute-set-col fieldset-wrapper"> <div class="fieldset-wrapper-title"> - <span class="title"><?= /* @escapeNotVerified */ __('Unassigned Attributes') ?></span> + <span class="title"><?= $block->escapeHtml(__('Unassigned Attributes')) ?></span> </div> <div id="tree-div2" class="attribute-set-tree"></div> <script id="ie-deferred-loader" defer="defer" src="//:"></script> @@ -58,8 +57,8 @@ ], function(jQuery, prompt, alert){ //<![CDATA[ - var allowDragAndDrop = <?= /* @escapeNotVerified */ ($block->getIsReadOnly() ? 'false' : 'true') ?>; - var canEditGroups = <?= /* @escapeNotVerified */ ($block->getIsReadOnly() ? 'false' : 'true') ?>; + var allowDragAndDrop = <?= ($block->getIsReadOnly() ? 'false' : 'true') ?>; + var canEditGroups = <?= ($block->getIsReadOnly() ? 'false' : 'true') ?>; var TreePanels = function() { // shorthand @@ -86,7 +85,7 @@ }); tree.setRootNode(this.root); - buildCategoryTree(this.root, <?= /* @escapeNotVerified */ $block->getGroupTreeJson() ?>); + buildCategoryTree(this.root, <?= /* @noEscape */ $block->getGroupTreeJson() ?>); // render the tree tree.render(); this.root.expand(false, false); @@ -94,7 +93,7 @@ this.ge = new Ext.tree.TreeEditor(tree, { allowBlank:false, - blankText:'<?= /* @escapeNotVerified */ __('A name is required.') ?>', + blankText:'<?= $block->escapeJs(__('A name is required.')) ?>', selectOnFocus:true, cls:'folder' }); @@ -125,7 +124,7 @@ id:'free' }); tree2.setRootNode(this.root2); - buildCategoryTree(this.root2, <?= /* @escapeNotVerified */ $block->getAttributeTreeJson() ?>); + buildCategoryTree(this.root2, <?= /* @noEscape */ $block->getAttributeTreeJson() ?>); this.root2.addListener('beforeinsert', editSet.rightBeforeInsert); this.root2.addListener('beforeappend', editSet.rightBeforeAppend); @@ -196,14 +195,14 @@ } } } - } - node.appendChild(newNode); - newNode.addListener('click', editSet.unregister); } + node.appendChild(newNode); + newNode.addListener('click', editSet.unregister); } } } } + } editSet = function () { @@ -280,8 +279,8 @@ addGroup : function() { prompt({ - title: "<?= /* @escapeNotVerified */ __('Add New Group') ?>", - content: "<?= /* @escapeNotVerified */ __('Please enter a new group name.') ?>", + title: "<?= $block->escapeJs(__('Add New Group')) ?>", + content: "<?= $block->escapeJs(__('Please enter a new group name.')) ?>", value: "", validation: true, validationRules: ['required-entry'], @@ -346,7 +345,7 @@ } for (var i=0; i < TreePanels.root.childNodes.length; i++) { if (TreePanels.root.childNodes[i].text.toLowerCase() == name.toLowerCase() && TreePanels.root.childNodes[i].id != exceptNodeId) { - errorText = '<?= /* @escapeNotVerified */ __('An attribute group named "/name/" already exists.') ?>'; + errorText = '<?= $block->escapeJs(__('An attribute group named "/name/" already exists.')) ?>'; alert({ content: errorText.replace("/name/",name) }); @@ -374,7 +373,7 @@ editSet.req.form_key = FORM_KEY; } var req = {data : Ext.util.JSON.encode(editSet.req)}; - var con = new Ext.lib.Ajax.request('POST', '<?= /* @escapeNotVerified */ $block->getMoveUrl() ?>', {success:editSet.success,failure:editSet.failure}, req); + var con = new Ext.lib.Ajax.request('POST', '<?= $block->escapeJs($block->escapeUrl($block->getMoveUrl())) ?>', {success:editSet.success,failure:editSet.failure}, req); }, success : function(o) { @@ -449,7 +448,7 @@ rightRemove : function(tree, nodeThis, node) { if( nodeThis.firstChild == null && node.id != 'empty' ) { var newNode = new Ext.tree.TreeNode({ - text : '<?= /* @escapeNotVerified */ __('Empty') ?>', + text : '<?= $block->escapeJs(__('Empty')) ?>', id : 'empty', cls : 'folder', is_user_defined : 1, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml index c1af14389fe59..227ed4be81fae 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml @@ -8,7 +8,7 @@ <script> require(['jquery', "mage/mage"], function(jQuery){ - jQuery('#<?= /* @escapeNotVerified */ $block->getFormId() ?>').mage('form').mage('validation'); + jQuery('#<?= $block->escapeJs($block->getFormId()) ?>').mage('form').mage('validation'); }); </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml index 902c6932f0ae1..c0928f4723b50 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml('grid') ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml index 75027d5e043fb..32466a1dfa965 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml @@ -3,10 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - - ?> +?> <div id="product_composite_configure" class="product-configure-popup" style="display:none;"> <iframe name="product_composite_configure_iframe" id="product_composite_configure_iframe" style="width:0; height:0; border:0px solid #fff; position:absolute; top:-1000px; left:-1000px" onload="window.productConfigure && productConfigure.onLoadIFrame()"></iframe> <form action="" method="post" id="product_composite_configure_form" enctype="multipart/form-data" onsubmit="productConfigure.onConfirmBtn(); return false;" target="product_composite_configure_iframe"> @@ -19,7 +16,7 @@ <div id="product_composite_configure_form_confirmed" style="display:none;"></div> </div> <input type="hidden" name="as_js_varname" value="iFrameResponse" /> - <input type="hidden" name="form_key" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /> + <input type="hidden" name="form_key" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /> </form> <div id="product_composite_configure_confirmed" style="display:none;"></div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml index acc80fa6ea6b0..6a83ece330441 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml @@ -3,24 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Options */ ?> <?php $options = $block->decorateArray($block->getOptions()); ?> -<?php if (count($options)): ?> +<?php if (count($options)) :?> -<?= $block->getChildHtml('options_js') ?> + <?= $block->getChildHtml('options_js') ?> -<fieldset id="product_composite_configure_fields_options" class="fieldset admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> - <legend class="legend admin__legend"> - <span><?= /* @escapeNotVerified */ __('Custom Options') ?></span> - </legend><br> - <?php foreach ($options as $option): ?> - <?= $block->getOptionHtml($option) ?> - <?php endforeach;?> -</fieldset> + <fieldset id="product_composite_configure_fields_options" + class="fieldset admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> + <legend class="legend admin__legend"> + <span><?= $block->escapeHtml(__('Custom Options')) ?></span> + </legend><br> + <?php foreach ($options as $option) :?> + <?= $block->getOptionHtml($option) ?> + <?php endforeach;?> + </fieldset> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml index 30c05c2ec689b..8adffb752187b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml @@ -3,82 +3,82 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?> <?php $_option = $block->getOption(); ?> -<?php $_optionId = $_option->getId(); ?> -<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> - <label class="label admin__field-label"> - <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> - </label> - <div class="admin__field-control control"> +<?php $_optionId = (int)$_option->getId(); ?> +<div class="admin__field field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> + <label class="label admin__field-label"> + <?= $block->escapeHtml($_option->getTitle()) ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> + </label> + <div class="admin__field-control control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE): ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE) :?> - <?= $block->getDateHtml() ?> + <?= $block->getDateHtml() ?> - <?php if (!$block->useCalendar()): ?> - <script> -require([ - "prototype", - "Magento_Catalog/catalog/product/composite/configure" -], function(){ + <?php if (!$block->useCalendar()) :?> + <script> + require([ + "prototype", + "Magento_Catalog/catalog/product/composite/configure" + ], function(){ - window.dateOption = productConfigure.opConfig.dateOption; - Event.observe('options_<?= /* @escapeNotVerified */ $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption)); - Event.observe('options_<?= /* @escapeNotVerified */ $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption)); -}); -</script> - <?php endif; ?> + window.dateOption = productConfigure.opConfig.dateOption; + Event.observe('options_<?= /* @noEscape */ $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption)); + Event.observe('options_<?= /* @noEscape */ $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption)); + }); + </script> + <?php endif; ?> - <?php endif; ?> + <?php endif; ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME): ?> - <span class="time-picker"><?= $block->getTimeHtml() ?></span> - <?php endif; ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME) :?> + <span class="time-picker"><?= $block->getTimeHtml() ?></span> + <?php endif; ?> - <input type="hidden" name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" value="" /> - <script> -require([ - "jquery", - "mage/backend/validation" -], function(jQuery){ + <input type="hidden" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" + value="" /> + <script> + require([ + "jquery", + "mage/backend/validation" + ], function(jQuery){ - //<![CDATA[ -<?php if ($_option->getIsRequire()): ?> - jQuery.validator.addMethod('validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>', function(v) { - var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @escapeNotVerified */ $_optionId ?>"]'); - for (var i=0; i < dateTimeParts.length; i++) { - if (dateTimeParts[i].value == "") return false; - } - return true; - }, '<?= $block->escapeJs(__('This is a required option.')) ?>'); -<?php else: ?> - jQuery.validator.addMethod('validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>', function(v) { - var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @escapeNotVerified */ $_optionId ?>"]'); - var hasWithValue = false, hasWithNoValue = false; - var pattern = /day_part$/i; - for (var i=0; i < dateTimeParts.length; i++) { - if (! pattern.test(dateTimeParts[i].id)) { - if (dateTimeParts[i].value === "") { - hasWithValue = true; - } else { - hasWithNoValue = true; + //<![CDATA[ + <?php if ($_option->getIsRequire()) :?> + jQuery.validator.addMethod('validate-datetime-<?= /* @noEscape */ $_optionId ?>', function(v) { + var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @noEscape */ $_optionId ?>"]'); + for (var i=0; i < dateTimeParts.length; i++) { + if (dateTimeParts[i].value == "") return false; } - } - } - return hasWithValue ^ hasWithNoValue; - }, '<?= $block->escapeJs(__('The field isn\'t complete.')) ?>'); -<?php endif; ?> - //]]> - -}); -</script> - </div> + return true; + }, '<?= $block->escapeJs(__('This is a required option.')) ?>'); + <?php else :?> + jQuery.validator.addMethod('validate-datetime-<?= /* @noEscape */ $_optionId ?>', function(v) { + var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @noEscape */ $_optionId ?>"]'); + var hasWithValue = false, hasWithNoValue = false; + var pattern = /day_part$/i; + for (var i=0; i < dateTimeParts.length; i++) { + if (! pattern.test(dateTimeParts[i].id)) { + if (dateTimeParts[i].value === "") { + hasWithValue = true; + } else { + hasWithNoValue = true; + } + } + } + return hasWithValue ^ hasWithNoValue; + }, '<?= $block->escapeJs(__('The field isn\'t complete.')) ?>'); + <?php endif; ?> + //]]> + + }); + </script> + </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml index 4ad7a95c91980..da0b3b36d561e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?> <?php $_option = $block->getOption(); ?> <?php $_fileInfo = $block->getFileInfo(); ?> <?php $_fileExists = $_fileInfo->hasData() ? true : false; ?> -<?php $_fileName = 'options_' . $_option->getId() . '_file'; ?> +<?php $_fileName = 'options_' . (int)$_option->getId() . '_file'; ?> <?php $_fieldNameAction = $_fileName . '_action'; ?> <?php $_fieldValueAction = $_fileExists ? 'save_old' : 'save_new'; ?> <?php $_fileNamed = $_fileName . '_name'; ?> @@ -21,11 +18,11 @@ require(['prototype'], function(){ //<![CDATA[ - opFile<?= /* @escapeNotVerified */ $_rand ?> = { + opFile<?= /* @noEscape */ $_rand ?> = { initializeFile: function(inputBox) { - this.inputFile = inputBox.select('input[name="<?= /* @escapeNotVerified */ $_fileName ?>"]')[0]; - this.inputFileAction = inputBox.select('input[name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>"]')[0]; - this.fileNameBox = inputBox.up('dd').select('.<?= /* @escapeNotVerified */ $_fileNamed ?>')[0]; + this.inputFile = inputBox.select('input[name="<?= /* @noEscape */ $_fileName ?>"]')[0]; + this.inputFileAction = inputBox.select('input[name="<?= /* @noEscape */ $_fieldNameAction ?>"]')[0]; + this.fileNameBox = inputBox.up('dd').select('.<?= /* @noEscape */ $_fileNamed ?>')[0]; }, toggleFileChange: function(inputBox) { @@ -62,42 +59,42 @@ require(['prototype'], function(){ }); </script> -<div class="admin__field <?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="admin__field <?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="admin__field-label label"> <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="admin__field-control control"> - <?php if ($_fileExists): ?> + <?php if ($_fileExists) :?> <span class="<?= /* @noEscape */ $_fileNamed ?>"><?= $block->escapeHtml($_fileInfo->getTitle()) ?></span> - <a href="javascript:void(0)" class="label" onclick="opFile<?= /* @escapeNotVerified */ $_rand ?>.toggleFileChange($(this).next('.input-box'))"> - <?= /* @escapeNotVerified */ __('Change') ?> + <a href="javascript:void(0)" class="label" onclick="opFile<?= /* @noEscape */ $_rand ?>.toggleFileChange($(this).next('.input-box'))"> + <?= $block->escapeHtml(__('Change')) ?> </a>  - <?php if (!$_option->getIsRequire()): ?> - <input type="checkbox" onclick="opFile<?= /* @escapeNotVerified */ $_rand ?>.toggleFileDelete($(this), $(this).next('.input-box'))" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>"/> - <span class="label"><?= /* @escapeNotVerified */ __('Delete') ?></span> + <?php if (!$_option->getIsRequire()) :?> + <input type="checkbox" onclick="opFile<?= /* @noEscape */ $_rand ?>.toggleFileDelete($(this), $(this).next('.input-box'))" price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>"/> + <span class="label"><?= $block->escapeHtml(__('Delete')) ?></span> <?php endif; ?> <?php endif; ?> <div class="input-box" <?= $_fileExists ? 'style="display:none"' : '' ?>> <!-- ToDo UI: add appropriate file class when z-index issue in ui dialog will be resolved --> - <input type="file" name="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required-entry' : '' ?>" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>" <?= $_fileExists ? 'disabled="disabled"' : '' ?>/> - <input type="hidden" name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>" value="<?= /* @escapeNotVerified */ $_fieldValueAction ?>" /> + <input type="file" name="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required-entry' : '' ?>" price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>" <?= $_fileExists ? 'disabled="disabled"' : '' ?>/> + <input type="hidden" name="<?= /* @noEscape */ $_fieldNameAction ?>" value="<?= /* @noEscape */ $_fieldValueAction ?>" /> - <?php if ($_option->getFileExtension()): ?> + <?php if ($_option->getFileExtension()) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Compatible file extensions to upload') ?>: <strong><?= /* @escapeNotVerified */ $_option->getFileExtension() ?></strong></span> + <span><?= $block->escapeHtml(__('Compatible file extensions to upload')) ?>: <strong><?= $block->escapeHtml($_option->getFileExtension()) ?></strong></span> </div> <?php endif; ?> - <?php if ($_option->getImageSizeX() > 0): ?> + <?php if ($_option->getImageSizeX() > 0) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Maximum image width') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeX() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong></span> + <span><?= $block->escapeHtml(__('Maximum image width')) ?>: <strong><?= (int)$_option->getImageSizeX() ?> <?= $block->escapeHtml(__('px.')) ?></strong></span> </div> <?php endif; ?> - <?php if ($_option->getImageSizeY() > 0): ?> + <?php if ($_option->getImageSizeY() > 0) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Maximum image height') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeY() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong></span> + <span><?= $block->escapeHtml(__('Maximum image height')) ?>: <strong><?= (int)$_option->getImageSizeY() ?> <?= $block->escapeHtml(__('px.')) ?></strong></span> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml index af09bbe0acd9d..2218ce5d29671 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml @@ -3,21 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?> <?php $_option = $block->getOption(); ?> -<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="admin__field field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="label admin__field-label"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control admin__field-control"> <?= $block->getValuesHtml() ?> - <?php if ($_option->getIsRequire()): ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX): ?> - <span id="options-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></span> + <?php if ($_option->getIsRequire()) :?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX) :?> + <span id="options-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></span> <?php endif; ?> <?php endif;?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml index 11fba22ea8139..d1a019911d581 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml @@ -3,26 +3,33 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?> <?php $_option = $block->getOption(); ?> -<div class="field admin__field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="field admin__field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="admin__field-label label"> <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="control admin__field-control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?> - <input type="text" id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" class="input-text admin__control-text <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= /* @escapeNotVerified */ $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" value="<?= $block->escapeHtml($block->getDefaultValue()) ?>" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>" /> - <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA): ?> - <textarea id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" class="admin__control-textarea <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= /* @escapeNotVerified */ $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" rows="5" cols="25" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD) :?> + <input type="text" + id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" + class="input-text admin__control-text <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= $_option->getMaxCharacters() ? ' validate-length maximum-length-' . (int) $_option->getMaxCharacters() : '' ?> product-custom-option" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($block->getDefaultValue()) ?>" + price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>" /> + <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) :?> + <textarea id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" + class="admin__control-textarea <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= $_option->getMaxCharacters() ? ' validate-length maximum-length-' . (int) $_option->getMaxCharacters() : '' ?> product-custom-option" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + rows="5" + cols="25" + price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> <?php endif;?> - <?php if ($_option->getMaxCharacters()): ?> - <p class="note"><?= /* @escapeNotVerified */ __('Maximum number of characters:') ?> <strong><?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?></strong></p> + <?php if ($_option->getMaxCharacters()) :?> + <p class="note"><?= $block->escapeHtml(__('Maximum number of characters:')) ?> <strong><?= (int) $_option->getMaxCharacters() ?></strong></p> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml index 487c9b8e8f2b7..d456a8ef61469 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Qty */ ?> @@ -13,9 +10,13 @@ <fieldset id="product_composite_configure_fields_qty" class="fieldset product-composite-qty-block admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> <div class="field admin__field"> - <label class="label admin__field-label"><span><?= /* @escapeNotVerified */ __('Quantity') ?></span></label> + <label class="label admin__field-label"><span><?= $block->escapeHtml(__('Quantity')) ?></span></label> <div class="control admin__field-control"> - <input id="product_composite_configure_input_qty" class="input-text admin__control-text qty" type="text" name="qty" value="<?= /* @escapeNotVerified */ $block->getQtyValue() * 1 ?>"> + <input id="product_composite_configure_input_qty" + class="input-text admin__control-text qty" + type="text" + name="qty" + value="<?= $block->getQtyValue() * 1 ?>"> </div> </div> </fieldset> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml index 7c25c3686eadc..66df098a194ae 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml @@ -3,11 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit */ @@ -17,11 +16,11 @@ <div id="product-template-suggest-container" class="suggest-expandable"> <div class="action-dropdown"> <button type="button" class="action-toggle" data-mage-init='{"dropdown":{}}' data-toggle="dropdown"> - <span><?= /* @escapeNotVerified */ $block->getAttributeSetName() ?></span> + <span><?= $block->escapeHtml($block->getAttributeSetName()) ?></span> </button> <ul class="dropdown-menu"> <li><input type="text" id="product-template-suggest" class="search" - placeholder="<?= /* @noEscape */ __('start typing to search template') ?>"/></li> + placeholder="<?= $block->escapeHtmlAttr(__('start typing to search template')) ?>"/></li> </ul> </div> </div> @@ -30,32 +29,32 @@ <input type="checkbox" id="product-online-switcher" name="product-online-switcher" /> <label class="switcher-label" for="product-online-switcher" - data-text-on="<?= /* @escapeNotVerified */ __('Product online') ?>" - data-text-off="<?= /* @escapeNotVerified */ __('Product offline') ?>" - title="<?= /* @escapeNotVerified */ __('Product online status') ?>"></label> + data-text-on="<?= $block->escapeHtmlAttr(__('Product online')) ?>" + data-text-off="<?= $block->escapeHtmlAttr(__('Product offline')) ?>" + title="<?= $block->escapeHtmlAttr(__('Product online status')) ?>"></label> </div> - <?php if ($block->getProductId()): ?> + <?php if ($block->getProductId()) :?> <?= $block->getDeleteButtonHtml() ?> <?php endif; ?> - <?php if ($block->getProductSetId()): ?> + <?php if ($block->getProductSetId()) :?> <?= $block->getChangeAttributeSetButtonHtml() ?> <?= $block->getSaveSplitButtonHtml() ?> <?php endif; ?> <?= $block->getBackButtonHtml() ?> </div> </div> -<?php if ($block->getUseContainer()): ?> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" enctype="multipart/form-data" - data-form="edit-product" data-product-id="<?= /* @escapeNotVerified */ $block->getProduct()->getId() ?>"> +<?php if ($block->getUseContainer()) :?> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" enctype="multipart/form-data" + data-form="edit-product" data-product-id="<?= $block->escapeHtmlAttr($block->getProduct()->getId()) ?>"> <?php endif; ?> <?= $block->getBlockHtml('formkey') ?> <div data-role="tabs" id="product-edit-form-tabs"></div> <?php /* @TODO: remove id after elimination of setDestElementId('product-edit-form-tabs') */?> <?= $block->getChildHtml('product-type-tabs') ?> - <input type="hidden" id="product_type_id" value="<?= /* @escapeNotVerified */ $block->getProduct()->getTypeId() ?>"/> - <input type="hidden" id="attribute_set_id" value="<?= /* @escapeNotVerified */ $block->getProduct()->getAttributeSetId() ?>"/> + <input type="hidden" id="product_type_id" value="<?= $block->escapeHtmlAttr($block->getProduct()->getTypeId()) ?>"/> + <input type="hidden" id="attribute_set_id" value="<?= $block->escapeHtmlAttr($block->getProduct()->getAttributeSetId()) ?>"/> <button type="submit" class="hidden"></button> -<?php if ($block->getUseContainer()): ?> +<?php if ($block->getUseContainer()) :?> </form> <?php endif; ?> <script> @@ -130,10 +129,10 @@ require([ } } }); - $form.mage('validation', {validationUrl: '<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>'}); + $form.mage('validation', {validationUrl: '<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>'}); - var masks = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getFieldsAutogenerationMasks()) ?>; - var availablePlaceholders = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getAttributesAllowedForAutogeneration()) ?>; + var masks = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getFieldsAutogenerationMasks()) ?>; + var availablePlaceholders = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getAttributesAllowedForAutogeneration()) ?>; var Autogenerator = function(masks) { this._masks = masks || {}; this._fieldReverseIndex = this._buildReverseIndex(this._masks); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml index a3b0b32e4c29a..056cf014f769a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml @@ -4,18 +4,21 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute */ ?> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" id="attributes-edit-form" class="attributes-edit-form" enctype="multipart/form-data"> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" + method="post" + id="attributes-edit-form" + class="attributes-edit-form" + enctype="multipart/form-data"> <?= $block->getBlockHtml('formkey') ?> </form> <script type="text/x-magento-init"> { "#attributes-edit-form": { "Magento_Catalog/catalog/product/edit/attribute": { - "validationUrl": "<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>" + "validationUrl": "<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>" } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml index 64c8ba7dcf49f..792af12494af6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory $block */ ?> <script> @@ -40,326 +39,363 @@ if (!is_numeric($defaultMinSaleQty)) { <div class="fieldset-wrapper form-inline advanced-inventory-edit"> <div class="fieldset-wrapper-title"> <strong class="title"> - <span><?= /* @escapeNotVerified */ __('Advanced Inventory') ?></span> + <span><?= $block->escapeHtml(__('Advanced Inventory')) ?></span> </strong> </div> <div class="fieldset-wrapper-content"> <fieldset class="fieldset" id="table_cataloginventory"> <div class="field"> <label class="label" for="inventory_manage_stock"> - <span><?= /* @escapeNotVerified */ __('Manage Stock') ?></span> + <span><?= $block->escapeHtml(__('Manage Stock')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> - <select id="inventory_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[manage_stock]" + <select id="inventory_manage_stock" name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[manage_stock]" class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option - value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0" + <?php if ($block->getFieldValue('manage_stock') == 0) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> </select> </div> <div class="field choice"> - <input name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox" + <input name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox" id="inventory_use_config_manage_stock" data-role="toggle-editability" value="1" checked="checked" disabled="disabled"/> <label for="inventory_use_config_manage_stock" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_manage_stock_checkbox" data-role="toggle-editability-all"/> <label for="inventory_manage_stock_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field required"> <label class="label" for="inventory_qty"> - <span><?= /* @escapeNotVerified */ __('Qty') ?></span> + <span><?= $block->escapeHtml(__('Qty')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text required-entry validate-number" id="inventory_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('qty') * 1 ?>" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty]" + value="<?= $block->getDefaultConfigValue('qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field with-addon"> <label class="label" for="inventory_min_qty"> - <span><?= /* @escapeNotVerified */ __('Out-of-Stock Threshold') ?></span> + <span><?= $block->escapeHtml(__('Out-of-Stock Threshold')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_min_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_qty]" + value="<?= $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_min_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_min_qty]" value="1" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> <label for="inventory_use_config_min_qty" class="label"> - <span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span> + <span><?= $block->escapeHtml(__('Use Config Settings')) ?></span> </label> </div> <div class="field choice"> <input type="checkbox" id="inventory_min_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_min_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_min_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Minimum Qty Allowed in Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Minimum Qty Allowed in Shopping Cart')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_sale_qty]" - value="<?= /* @escapeNotVerified */ $defaultMinSaleQty ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_sale_qty]" + value="<?= $defaultMinSaleQty * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_min_sale_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_sale_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_min_sale_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_min_sale_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_min_sale_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_max_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Maximum Qty Allowed in Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Maximum Qty Allowed in Shopping Cart')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_max_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[max_sale_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('max_sale_qty') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[max_sale_qty]" + value="<?= $block->getDefaultConfigValue('max_sale_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_max_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_max_sale_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_max_sale_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_max_sale_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_max_sale_checkbox" data-role="toggle-editability-all"/> <label for="inventory_max_sale_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_is_qty_decimal"> - <span><?= /* @escapeNotVerified */ __('Qty Uses Decimals') ?></span> + <span><?= $block->escapeHtml(__('Qty Uses Decimals')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_is_qty_decimal" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[is_qty_decimal]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_qty_decimal]" + class="select" disabled="disabled"> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option - value="1"<?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1" + <?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_is_qty_decimal_checkbox" data-role="toggle-editability-all"/> <label for="inventory_is_qty_decimal_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_backorders"> - <span><?= /* @escapeNotVerified */ __('Backorders') ?></span> + <span><?= $block->escapeHtml(__('Backorders')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> - <select id="inventory_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[backorders]" - class="select" disabled="disabled"> - <?php foreach ($block->getBackordersOption() as $option): ?> + <select id="inventory_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[backorders]" + class="select" + disabled="disabled"> + <?php foreach ($block->getBackordersOption() as $option) :?> <?php $_selected = ($option['value'] == $block->getDefaultConfigValue('backorders')) ? ' selected="selected"' : '' ?> <option - value="<?= /* @escapeNotVerified */ $option['value'] ?>"<?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> + value="<?= $block->escapeHtmlAttr($option['value']) ?>"<?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> <?php endforeach; ?> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_backorders" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_backorders]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_backorders]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_backorders" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_backorders_checkbox" data-role="toggle-editability-all"/> - <label for="inventory_backorders_checkbox" class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + <label for="inventory_backorders_checkbox" + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_notify_stock_qty"> - <span><?= /* @escapeNotVerified */ __('Notify for Quantity Below') ?></span> + <span><?= $block->escapeHtml(__('Notify for Quantity Below')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[notify_stock_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('notify_stock_qty') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[notify_stock_qty]" + value="<?= $block->getDefaultConfigValue('notify_stock_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_notify_stock_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_notify_stock_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_notify_stock_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_notify_stock_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_notify_stock_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_notify_stock_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_enable_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Enable Qty Increments') ?></span> + <span><?= $block->escapeHtml(__('Enable Qty Increments')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_enable_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[enable_qty_increments]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[enable_qty_increments]" + class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option - value="0"<?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0" + <?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_enable_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_enable_qty_increments" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_enable_qty_increments_checkbox" data-role="toggle-editability-all"/> <label for="inventory_enable_qty_increments_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Qty Increments') ?></span> + <span><?= $block->escapeHtml(__('Qty Increments')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[qty_increments]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('qty_increments') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty_increments]" + value="<?= $block->getDefaultConfigValue('qty_increments') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_qty_increments]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_qty_increments]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_qty_increments" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_qty_increments_checkbox" data-role="toggle-editability-all"/> <label for="inventory_qty_increments_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_stock_availability"> - <span><?= /* @escapeNotVerified */ __('Stock Availability') ?></span> + <span><?= $block->escapeHtml(__('Stock Availability')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_stock_availability" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[is_in_stock]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_in_stock]" class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('In Stock') ?></option> - <option - value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0): ?> selected<?php endif; ?>><?= /* @escapeNotVerified */ __('Out of Stock') ?></option> + <option value="1"><?= $block->escapeHtml(__('In Stock')) ?></option> + <option value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0) :?> selected<?php endif; ?>><?= $block->escapeHtml(__('Out of Stock')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_stock_availability_checkbox" data-role="toggle-editability-all"/> <label for="inventory_stock_availability_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> </fieldset> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml index cd297a7bbf27b..98b06050e0d1d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml @@ -4,29 +4,35 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Websites */ ?> <div class="fieldset-wrapper" id="add-products-to-website-wrapper"> <fieldset class="fieldset" id="grop_fields"> <legend class="legend"> - <span><?= /* @escapeNotVerified */ __('Add Product To Websites') ?></span> + <span><?= $block->escapeHtml(__('Add Product To Websites')) ?></span> </legend> <br> <div class="store-scope"> <div class="store-tree" id="add-products-to-website-content"> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) :?> <div class="website-name"> - <input name="add_website_ids[]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->getWebsitesReadonly()): ?>disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox" /> - <label for="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="add_website_ids[]" + value="<?= $block->escapeHtmlAttr($_website->getId()) ?>" + <?php if ($block->getWebsitesReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>" + type="checkbox" /> + <label for="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" id="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd class="group-stores"> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> </li> @@ -44,27 +50,35 @@ <div class="fieldset-wrapper" id="remove-products-to-website-wrapper"> <fieldset class="fieldset" id="grop_fields"> <legend class="legend"> - <span><?= /* @escapeNotVerified */ __('Remove Product From Websites') ?></span> + <span><?= $block->escapeHtml(__('Remove Product From Websites')) ?></span> </legend> <br> <div class="messages"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('To hide an item in catalog or search results, set the status to "Disabled".') ?></div> + <div><?= $block->escapeHtml(__('To hide an item in catalog or search results, set the status to "Disabled".')) ?></div> </div> </div> <div class="store-scope"> <div class="store-tree" id="remove-products-to-website-content"> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) :?> <div class="website-name"> - <input name="remove_website_ids[]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->getWebsitesReadonly()): ?>disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox" /> - <label for="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="remove_website_ids[]" + value="<?= $block->escapeHtmlAttr($_website->getId()) ?>" + <?php if ($block->getWebsitesReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>" + type="checkbox" /> + <label for="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" + id="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd class="group-stores"> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml index a7e8564e7a1d8..d073053e2f854 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis - /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\AttributeSet */ +/* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\AttributeSet */ ?> <script id="product-template-selector-template" type="text/x-magento-template"> <% if (!data.term && data.items.length && !data.allShown()) { %> @@ -32,7 +32,7 @@ } }); $suggest - .mage('suggest',<?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSelectorOptions()) ?>) + .mage('suggest',<?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSelectorOptions()) ?>) .on('suggestselect', function (e, ui) { if (ui.item.id) { $('[data-form=edit-product]').trigger('changeAttributeSet', ui.item); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml index 84c3257840259..f12a99e6c7843 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml @@ -5,7 +5,7 @@ */ /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\NewCategory */ ?> -<div id="<?= /* @escapeNotVerified */ $block->getNameInLayout() ?>" style="display:none"> +<div id="<?= $block->escapeHtmlAttr($block->getNameInLayout()) ?>" style="display:none"> <?= $block->getFormHtml() ?> <?= $block->getAfterElementHtml() ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml index 2570a5d712675..ad38d250a3345 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml @@ -3,16 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options */ ?> <div class="fieldset-wrapper" id="product-custom-options-wrapper" data-block="product-custom-options"> <div class="fieldset-wrapper-title"> <strong class="title"> - <span><?= /* @escapeNotVerified */ __('Custom Options') ?></span> + <span><?= $block->escapeHtml(__('Custom Options')) ?></span> </strong> </div> <div class="fieldset-wrapper-content" id="product-custom-options-content" data-role="product-custom-options-content"> @@ -20,7 +17,7 @@ <div class="messages"> <div class="message message-error" id="dynamic-price-warning" style="display: none;"> <div class="message-inner"> - <div class="message-content"><?= /* @escapeNotVerified */ __('We can\'t save custom-defined options for bundles with dynamic pricing.') ?></div> + <div class="message-content"><?= $block->escapeHtml(__('We can\'t save custom-defined options for bundles with dynamic pricing.')) ?></div> </div> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml index d2bca5ce17321..713366e73aba5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Option */ ?> <?= $block->getTemplatesHtml() ?> @@ -19,30 +18,52 @@ <span id="option_<%- data.id %>_header_title"><%- data.title %></span> </strong> <div class="actions"> - <button type="button" title="<?= /* @escapeNotVerified */ __('Delete Custom Option') ?>" class="action-delete" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_delete"> - <span><?= /* @escapeNotVerified */ __('Delete Custom Option') ?></span> + <button type="button" + title="<?= $block->escapeHtmlAttr(__('Delete Custom Option')) ?>" + class="action-delete" + id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_delete"> + <span><?= $block->escapeHtml(__('Delete Custom Option')) ?></span> </button> </div> - <div id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_move" data-role="draggable-handle" class="draggable-handle" - title="<?= /* @escapeNotVerified */ __('Sort Custom Options') ?>"></div> + <div id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_move" + data-role="draggable-handle" + class="draggable-handle" + title="<?= $block->escapeHtmlAttr(__('Sort Custom Options')) ?>"></div> </div> <div class="fieldset-wrapper-content in collapse" id="<%- data.id %>-content"> <fieldset class="fieldset"> - <fieldset class="fieldset-alt" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_is_delete" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][is_delete]" type="hidden" value=""/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_previous_type" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][previous_type]" type="hidden" value="<%- data.type %>"/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_previous_group" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][previous_group]" type="hidden" value=""/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_id" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][id]" type="hidden" value="<%- data.id %>"/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_option_id" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][option_id]" type="hidden" value="<%- data.option_id %>"/> - <input name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"/> + <fieldset class="fieldset-alt" id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>"> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_is_delete" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][is_delete]" + type="hidden" + value=""/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_previous_type" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][previous_type]" + type="hidden" + value="<%- data.type %>"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_previous_group" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][previous_group]" + type="hidden" + value=""/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_id" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][id]" + type="hidden" + value="<%- data.id %>"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_option_id" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][option_id]" + type="hidden" + value="<%- data.option_id %>"/> + <input name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][sort_order]" + type="hidden" + value="<%- data.sort_order %>"/> <div class="field field-option-title required"> - <label class="label" for="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title"> - <?= /* @escapeNotVerified */ __('Option Title') ?> + <label class="label" for="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title"> + <?= $block->escapeHtml(__('Option Title')) ?> </label> <div class="control"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][title]" + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][title]" class="required-entry input-text" type="text" value="<%- data.title %>" @@ -54,8 +75,8 @@ </div> <div class="field field-option-input-type required"> - <label class="label" for="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title"> - <?= /* @escapeNotVerified */ __('Input Type') ?> + <label class="label" for="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title"> + <?= $block->escapeHtml(__('Input Type')) ?> </label> <div class="control opt-type"> <?= $block->getTypeSelectHtml() ?> @@ -64,9 +85,12 @@ <div class="field field-option-req"> <div class="control"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_required" class="is-required" type="checkbox" checked="checked"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_required" + class="is-required" + type="checkbox" + checked="checked"/> <label for="field-option-req"> - <?= /* @escapeNotVerified */ __('Required') ?> + <?= $block->escapeHtml(__('Required')) ?> </label> <span style="display:none"><?= $block->getRequireSelectHtml() ?></span> </div> @@ -78,7 +102,7 @@ </script> <div id="import-container" style="display: none;"></div> -<?php if (!$block->isReadonly()): ?> +<?php if (!$block->isReadonly()) :?> <div><input type="hidden" name="affect_product_custom_options" value="1"/></div> <?php endif; ?> <script> @@ -89,21 +113,21 @@ require([ jQuery(function ($) { var fieldSet = $('[data-block=product-custom-options]'); - fieldSet.customOptions(<?php /* @escapeNotVerified */ echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + fieldSet.customOptions(<?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( [ 'fieldId' => $block->getFieldId(), - 'productGridUrl' => $block->getProductGridUrl(), + 'productGridUrl' => $block->escapeUrl($block->getProductGridUrl()), 'formKey' => $block->getFormKey(), - 'customOptionsUrl' => $block->getCustomOptionsUrl(), - 'isReadonly' => $block->isReadonly(), - 'itemCount' => $block->getItemCount(), - 'currentProductId' => $block->getCurrentProductId(), + 'customOptionsUrl' => $block->escapeUrl($block->getCustomOptionsUrl()), + 'isReadonly' => (bool) $block->isReadonly(), + 'itemCount' => (int) $block->getItemCount(), + 'currentProductId' => (int) $block->getCurrentProductId(), ] )?>); //adding data to templates <?php /** @var $_value \Magento\Framework\DataObject */ ?> - <?php foreach ($block->getOptionValues() as $_value): ?> - fieldSet.customOptions('addOption', <?= /* @escapeNotVerified */ $_value->toJson() ?>); + <?php foreach ($block->getOptionValues() as $_value) :?> + fieldSet.customOptions('addOption', <?= /* @noEscape */ $_value->toJson() ?>); <?php endforeach; ?> }); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml index 07ce6e5d86256..2063609bf0568 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Date */ ?> <script id="custom-option-date-type-template" type="text/x-magento-template"> @@ -14,10 +12,10 @@ <thead> <tr class="headings"> <?php if ($block->getCanReadPrice() !== false) : ?> - <th><?= /* @escapeNotVerified */ __('Price') ?></th> - <th><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th><?= $block->escapeHtml(__('Price')) ?></th> + <th><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th><?= /* @escapeNotVerified */ __('SKU') ?></th> + <th><?= $block->escapeHtml(__('SKU')) ?></th> </tr> </thead> <tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml index 693c98fc02cab..c0e61c5de9988 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\File */ ?> <script id="custom-option-file-type-template" type="text/x-magento-template"> @@ -14,27 +12,27 @@ <thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <th><?= /* @escapeNotVerified */ __('Price') ?></th> - <th><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th><?= $block->escapeHtml(__('Price')) ?></th> + <th><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th><?= /* @escapeNotVerified */ __('SKU') ?></th> - <th><?= /* @escapeNotVerified */ __('Compatible File Extensions') ?></th> - <th><?= /* @escapeNotVerified */ __('Maximum Image Size') ?></th> + <th><?= $block->escapeHtml(__('SKU')) ?></th> + <th><?= $block->escapeHtml(__('Compatible File Extensions')) ?></th> + <th><?= $block->escapeHtml(__('Maximum Image Size')) ?></th> </tr> </thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <td class="opt-price"> - <input name="product[options][<%- data.option_id %>][price]" data-store-label="<%- data.price %>" - class="input-text validate-zero-or-greater" type="text" value="<%- data.price %>" - <?php if ($block->getCanEditPrice() === false) : ?> - disabled="disabled" - <?php endif; ?>> - </td> - <td class="opt-price-type"><?= $block->getPriceTypeSelectHtml('data-attr="price-type"') ?><%- data.checkboxScopePrice %></td> + <td class="opt-price"> + <input name="product[options][<%- data.option_id %>][price]" data-store-label="<%- data.price %>" + class="input-text validate-zero-or-greater" type="text" value="<%- data.price %>" + <?php if ($block->getCanEditPrice() === false) : ?> + disabled="disabled" + <?php endif; ?>> + </td> + <td class="opt-price-type"><?= $block->getPriceTypeSelectHtml('data-attr="price-type"') ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input name="product[options][<%- data.option_id %>][price]" type="hidden"> - <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> + <input name="product[options][<%- data.option_id %>][price]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> <?php endif; ?> <td> <input name="product[options][<%- data.option_id %>][sku]" class="input-text" type="text" value="<%- data.sku %>"> @@ -42,10 +40,15 @@ <td> <input name="product[options][<%- data.option_id %>][file_extension]" class="input-text" type="text" value="<%- data.file_extension %>"> </td> - <td class="col-file"><?php /* @escapeNotVerified */ echo __('%1 <span>x</span> %2 <span>px.</span>', - '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_x]" value="<%- data.image_size_x %>">', - '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_y]" value="<%- data.image_size_y %>">') ?> - <div class="note"><?= /* @escapeNotVerified */ __('Please leave blank if it is not an image.') ?></div> + <td class="col-file"><?= $block->escapeHtml( + __( + '%1 <span>x</span> %2 <span>px.</span>', + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_x]" value="<%- data.image_size_x %>">', + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_y]" value="<%- data.image_size_y %>">' + ), + ['span', 'input'] + ) ?> + <div class="note"><?= $block->escapeHtml(__('Please leave blank if it is not an image.')) ?></div> </td> </tr> </table> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml index e8c398228a469..e906b753b99cd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select */ ?> <script id="custom-option-select-type-template" type="text/x-magento-template"> @@ -14,12 +12,12 @@ <thead> <tr> <th class="col-draggable"> </th> - <th class="col-name required"><?= /* @escapeNotVerified */ __('Title') ?><span class="required">*</span></th> + <th class="col-name required"><?= $block->escapeHtml(__('Title')) ?><span class="required">*</span></th> <?php if ($block->getCanReadPrice() !== false) : ?> - <th class="col-price"><?= /* @escapeNotVerified */ __('Price') ?></th> - <th class="col-price-type"><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th class="col-price"><?= $block->escapeHtml(__('Price')) ?></th> + <th class="col-price-type"><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th class="col-sku"><?= /* @escapeNotVerified */ __('SKU') ?></th> + <th class="col-sku"><?= $block->escapeHtml(__('SKU')) ?></th> <th class="col-actions"> </th> </tr> </thead> @@ -38,7 +36,7 @@ <tr id="product_option_<%- data.id %>_select_<%- data.select_id %>"> <td class="col-draggable"> <div data-role="draggable-handle" class="draggable-handle" - title="<?= /* @escapeNotVerified */ __('Sort Custom Option') ?>"></div> + title="<?= $block->escapeHtmlAttr(__('Sort Custom Option')) ?>"></div> <input name="product[options][<%- data.id %>][values][<%- data.select_id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"> </td> <td class="col-name select-opt-title"> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml index c9d7190589ff5..89da5d633ef4d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Text */ ?> <script id="custom-option-text-type-template" type="text/x-magento-template"> @@ -14,11 +12,11 @@ <thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <th class="type-price"><?= /* @escapeNotVerified */ __('Price') ?></th> - <th class="type-type"><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th class="type-price"><?= $block->escapeHtml(__('Price')) ?></th> + <th class="type-type"><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th class="type-sku"><?= /* @escapeNotVerified */ __('SKU') ?></th> - <th class="type-last last"><?= /* @escapeNotVerified */ __('Max Characters') ?></th> + <th class="type-sku"><?= $block->escapeHtml(__('SKU')) ?></th> + <th class="type-last last"><?= $block->escapeHtml(__('Max Characters')) ?></th> </tr> </thead> <tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml index 57715744823d6..4e8d6b2200187 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Tier */ $element = $block->getElement(); @@ -20,28 +20,28 @@ $element = $block->getElement(); <?php $_showWebsite = $block->isShowWebsiteColumn(); ?> <?php $_showWebsite = $block->isMultiWebsites(); ?> -<div class="field" id="attribute-<?= /* @escapeNotVerified */ $_htmlId ?>-container" data-attribute-code="<?= /* @escapeNotVerified */ $_htmlId ?>" +<div class="field" id="attribute-<?= /* @noEscape */ $_htmlId ?>-container" data-attribute-code="<?= /* @noEscape */ $_htmlId ?>" data-apply-to="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : [] ) )?>"> - <label class="label"><span><?= /* @escapeNotVerified */ $block->getElement()->getLabel() ?></span></label> + <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> <div class="control"> <table class="admin__control-table tiers_table" id="tiers_table"> <thead> <tr> - <th class="col-websites" <?php if (!$_showWebsite): ?>style="display:none"<?php endif; ?>><?= /* @escapeNotVerified */ __('Web Site') ?></th> - <th class="col-customer-group"><?= /* @escapeNotVerified */ __('Customer Group') ?></th> - <th class="col-qty required"><?= /* @escapeNotVerified */ __('Quantity') ?></th> - <th class="col-price required"><?= /* @escapeNotVerified */ $block->getPriceColumnHeader(__('Item Price')) ?></th> - <th class="col-delete"><?= /* @escapeNotVerified */ __('Action') ?></th> + <th class="col-websites" <?php if (!$_showWebsite) :?>style="display:none"<?php endif; ?>><?= $block->escapeHtml(__('Web Site')) ?></th> + <th class="col-customer-group"><?= $block->escapeHtml(__('Customer Group')) ?></th> + <th class="col-qty required"><?= $block->escapeHtml(__('Quantity')) ?></th> + <th class="col-price required"><?= $block->escapeHtml($block->getPriceColumnHeader(__('Item Price'))) ?></th> + <th class="col-delete"><?= $block->escapeHtml(__('Action')) ?></th> </tr> </thead> - <tbody id="<?= /* @escapeNotVerified */ $_htmlId ?>_container"></tbody> + <tbody id="<?= /* @noEscape */ $_htmlId ?>_container"></tbody> <tfoot> <tr> - <td colspan="<?php if (!$_showWebsite): ?>4<?php else: ?>5<?php endif; ?>" class="col-actions-add"><?= $block->getAddButtonHtml() ?></td> + <td colspan="<?php if (!$_showWebsite) :?>4<?php else :?>5<?php endif; ?>" class="col-actions-add"><?= $block->getAddButtonHtml() ?></td> </tr> </tfoot> </table> @@ -55,39 +55,39 @@ require([ //<![CDATA[ var tierPriceRowTemplate = '<tr>' - + '<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' - + '<select class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' - <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> - + '<option value="<?= /* @escapeNotVerified */ $_websiteId ?>"><?= $block->escapeJs($_info['name']) ?><?php if (!empty($_info['currency'])): ?> [<?= $block->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' + + '<td class="col-websites"<?php if (!$_showWebsite) :?> style="display:none"<?php endif; ?>>' + + '<select class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' + <?php foreach ($block->getWebsites() as $_websiteId => $_info) :?> + + '<option value="<?= $block->escapeHtmlAttr($_websiteId) ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])) :?> [<?= $block->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' <?php endforeach ?> + '</select></td>' - + '<td class="col-customer-group"><select class="<?= /* @escapeNotVerified */ $_htmlClass ?> custgroup required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' - <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName): ?> - + '<option value="<?= /* @escapeNotVerified */ $_groupId ?>"><?= $block->escapeJs($_groupName) ?></option>' + + '<td class="col-customer-group"><select class="<?= $block->escapeHtmlAttr($_htmlClass) ?> custgroup required-entry" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' + <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName) :?> + + '<option value="<?= $block->escapeHtmlAttr($_groupId) ?>"><?= $block->escapeHtml($_groupName) ?></option>' <?php endforeach ?> + '</select></td>' + '<td class="col-qty">' - + '<input class="<?= /* @escapeNotVerified */ $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' - + '<span><?= /* @escapeNotVerified */ __("and above") ?></span>' + + '<input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' + + '<span><?= $block->escapeHtml(__("and above")) ?></span>' + '</td>' - + '<td class="col-price"><input class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry <?= /* @escapeNotVerified */ $_priceValueValidation ?>" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' - + '<td class="col-delete"><input type="hidden" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' - + '<button title="<?= /* @escapeNotVerified */ $block->escapeHtml(__('Delete Tier')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' - + '<span><?= /* @escapeNotVerified */ __("Delete") ?></span></button></td>' + + '<td class="col-price"><input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry <?= /* @noEscape */ $_priceValueValidation ?>" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' + + '<td class="col-delete"><input type="hidden" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' + + '<button title="<?= $block->escapeHtml(__('Delete Tier')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' + + '<span><?= $block->escapeHtml(__("Delete")) ?></span></button></td>' + '</tr>'; var tierPriceControl = { template: mageTemplate(tierPriceRowTemplate), itemsCount: 0, addItem : function () { - <?php if ($_readonly): ?> + <?php if ($_readonly) :?> if (arguments.length < 4) { return; } <?php endif; ?> var data = { - website_id: '<?= /* @escapeNotVerified */ $block->getDefaultWebsite() ?>', - group: '<?= /* @escapeNotVerified */ $block->getDefaultCustomerGroup() ?>', + website_id: '<?= (int) $block->getDefaultWebsite() ?>', + group: '<?= (int) $block->getDefaultCustomerGroup() ?>', qty: '', price: '', readOnly: false, @@ -104,7 +104,7 @@ var tierPriceControl = { data.readOnly = arguments[4]; } - Element.insert($('<?= /* @escapeNotVerified */ $_htmlId ?>_container'), { + Element.insert($('<?= $block->escapeJs($_htmlId) ?>_container'), { bottom : this.template({ data: data }) @@ -113,7 +113,7 @@ var tierPriceControl = { $('tier_price_row_' + data.index + '_cust_group').value = data.group; $('tier_price_row_' + data.index + '_website').value = data.website_id; - <?php if ($block->isShowWebsiteColumn() && !$block->isAllowChangeWebsite()):?> + <?php if ($block->isShowWebsiteColumn() && !$block->isAllowChangeWebsite()) :?> var wss = $('tier_price_row_' + data.index + '_website'); var txt = wss.options[wss.selectedIndex].text; @@ -128,11 +128,11 @@ var tierPriceControl = { $('tier_price_row_'+data.index+'_delete_button').hide(); } - <?php if ($_readonly): ?> - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').select('input', 'select').each(this.disableElement); - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').up('table').select('button').each(this.disableElement); - <?php else: ?> - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').select('input', 'select').each(function(el){ Event.observe(el, 'change', el.setHasChanges.bind(el)); }); + <?php if ($_readonly) :?> + $('<?= $block->escapeJs($_htmlId) ?>_container').select('input', 'select').each(this.disableElement); + $('<?= $block->escapeJs($_htmlId) ?>_container').up('table').select('button').each(this.disableElement); + <?php else :?> + $('<?= $block->escapeJs($_htmlId) ?>_container').select('input', 'select').each(function(el){ Event.observe(el, 'change', el.setHasChanges.bind(el)); }); <?php endif; ?> }, disableElement: function(el) { @@ -150,11 +150,11 @@ var tierPriceControl = { return false; } }; -<?php foreach ($block->getValues() as $_item): ?> -tierPriceControl.addItem('<?= /* @escapeNotVerified */ $_item['website_id'] ?>', '<?= /* @escapeNotVerified */ $_item['cust_group'] ?>', '<?= /* @escapeNotVerified */ $_item['price_qty']*1 ?>', '<?= /* @escapeNotVerified */ $_item['price'] ?>', <?= (int)!empty($_item['readonly']) ?>); +<?php foreach ($block->getValues() as $_item) :?> +tierPriceControl.addItem('<?= $block->escapeJs($_item['website_id']) ?>', '<?= $block->escapeJs($_item['cust_group']) ?>', '<?= $_item['price_qty']*1 ?>', '<?= $block->escapeJs($_item['price']) ?>', <?= (int)!empty($_item['readonly']) ?>); <?php endforeach; ?> -<?php if ($_readonly): ?> -$('<?= /* @escapeNotVerified */ $_htmlId ?>_container').up('table').select('button') +<?php if ($_readonly) :?> +$('<?= $block->escapeJs($_htmlId) ?>_container').up('table').select('button') .each(tierPriceControl.disableElement); <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml index 44fdb75cdac21..0c1da98c7d85a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml @@ -4,9 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer */ ?> +// phpcs:disable Magento2.Security.InsecureFunction.DiscouragedWithAlternative <?php $_id = 'id_' . md5(microtime()) ?> -<input type="hidden" name="<?= /* @escapeNotVerified */ $block->getInputElementName() ?>" value="" id="<?= /* @escapeNotVerified */ $_id ?>" /> +<input type="hidden" + name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>" + value="" + id="<?= /* @noEscape */ $_id ?>" /> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml index 8f7f20f32d982..0193d7764cbb5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml @@ -4,16 +4,15 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Websites */ ?> <fieldset id="grop_fields" class="fieldset"> - <legend class="legend"><span><?= /* @escapeNotVerified */ __('Product In Websites') ?></span></legend> + <legend class="legend"><span><?= $block->escapeHtml(__('Product In Websites')) ?></span></legend> <br> - <?php if ($block->getProductId()): ?> + <?php if ($block->getProductId()) :?> <div class="messages"> <div class="message message-notice"> - <?= /* @escapeNotVerified */ __('To hide an item in catalog or search results, set the status to "Disabled".') ?> + <?= $block->escapeHtml(__('To hide an item in catalog or search results, set the status to "Disabled".')) ?> </div> </div> <?php endif; ?> @@ -21,22 +20,36 @@ <?= $block->getHintHtml() ?> <div class="store-tree"> <?php $_websites = $block->getWebsiteCollection() ?> - <?php foreach ($_websites as $_website): ?> + <?php foreach ($_websites as $_website) :?> <div class="website-name"> - <input name="product[website_ids][]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->isReadonly()): ?> disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox"<?php if ($block->hasWebsite($_website->getId()) || !$block->getProductId() && count($_websites) === 1): ?> checked="checked"<?php endif; ?> /> - <label for="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="product[website_ids][]" + value="<?= (int) $_website->getId() ?>" + <?php if ($block->isReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="product_website_<?= (int) $_website->getId() ?>" + type="checkbox" + <?php if ($block->hasWebsite($_website->getId()) || !$block->getProductId() && count($_websites) === 1) :?> + checked="checked" + <?php endif; ?> + /> + <label for="product_website_<?= (int) $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" id="product_website_<?= (int) $_website->getId() ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> - <?php if ($block->getWebsites() && !$block->hasWebsite($_website->getId())): ?> - <span class="website-<?= /* @escapeNotVerified */ $_website->getId() ?>-select" style="display:none"> - <?= __('(Copy data from: %1)', $block->getChooseFromStoreHtml($_store)) ?> + <?php if ($block->getWebsites() && !$block->hasWebsite($_website->getId())) :?> + <span class="website-<?= (int) $_website->getId() ?>-select" style="display:none"> + <?= $block->escapeHtml( + __('(Copy data from: %1)', $block->getChooseFromStoreHtml($_store)), + ['select', 'option', 'optgroup'] + ) ?> </span> <?php endif; ?> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml index 574c9ee81af7d..befdce30fc8f0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content */ $elementName = $block->getElement()->getName() . '[images]'; @@ -16,61 +16,60 @@ $formName = $block->getFormName(); data-parent-component="<?= $block->escapeHtml($block->getData('config/parentComponent')) ?>" data-images="<?= $block->escapeHtml($block->getImagesJson()) ?>" data-types="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getImageTypes()) + $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getImageTypes()) ) ?>" - > +> <?php if (!$block->getElement()->getReadonly()) {?> <div class="image image-placeholder"> <?= $block->getUploaderHtml() ?> <div class="product-image-wrapper"> <p class="image-placeholder-text"> - <?= /* @escapeNotVerified */ __('Browse to find or drag image here') ?> + <?= $block->escapeHtml(__('Browse to find or drag image here')) ?> </p> </div> </div> <?php } ?> <?php foreach ($block->getImageTypes() as $typeData) { - ?> - <input name="<?= $block->escapeHtml($typeData['name']) ?>" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - class="image-<?= $block->escapeHtml($typeData['code']) ?>" + ?> + <input name="<?= $block->escapeHtmlAttr($typeData['name']) ?>" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + class="image-<?= $block->escapeHtmlAttr($typeData['code']) ?>" type="hidden" - value="<?= $block->escapeHtml($typeData['value']) ?>"/> - <?php - + value="<?= $block->escapeHtmlAttr($typeData['value']) ?>"/> + <?php } ?> <script id="<?= $block->getHtmlId() ?>-template" type="text/x-magento-template"> <div class="image item<% if (data.disabled == 1) { %> hidden-for-front<% } %>" data-role="image"> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][position]" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][position]" value="<%- data.position %>" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" class="position"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][file]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][file]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.file %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][value_id]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][value_id]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.value_id %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][label]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][label]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.label %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][disabled]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][disabled]" + data-form-part="<?= $block->escapeHtmlAttr(formName) ?>" value="<%- data.disabled %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][media_type]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][media_type]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="image"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][removed]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][removed]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="" class="is-removed"/> @@ -84,21 +83,21 @@ $formName = $block->getFormName(); <button type="button" class="action-remove" data-role="delete-button" - title="<?= /* @escapeNotVerified */ __('Delete image') ?>"> + title="<?= $block->escapeHtmlAttr(__('Delete image')) ?>"> <span> - <?= /* @escapeNotVerified */ __('Delete image') ?> + <?= $block->escapeHtml(__('Delete image')) ?> </span> </button> <div class="draggable-handle"></div> </div> - <div class="image-fade"><span><?= /* @escapeNotVerified */ __('Hidden') ?></span></div> + <div class="image-fade"><span><?= $block->escapeHtml(__('Hidden')) ?></span></div> </div> <div class="item-description"> <div class="item-title" data-role="img-title"><%- data.label %></div> <div class="item-size"> - <span data-role="image-dimens"></span>, <span data-role="image-size"><%- data.sizeLabel %></span> + <span data-role="image-dimens"></span>, <span data-role="image-size"><%- data.sizeLabel %></span> </div> </div> @@ -106,12 +105,9 @@ $formName = $block->getFormName(); <?php foreach ($block->getImageTypes() as $typeData) { ?> - <li data-role-code="<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $typeData['code'] - ) ?>" class="item-role item-role-<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $typeData['code'] - ) ?>"> - <?= /* @escapeNotVerified */ $block->escapeHtml($typeData['label']) ?> + <li data-role-code="<?= $block->escapeHtmlAttr($typeData['code']) ?>" + class="item-role item-role-<?= $block->escapeHtmlAttr($typeData['code']) ?>"> + <?= $block->escapeHtml($typeData['label']) ?> </li> <?php } @@ -121,98 +117,94 @@ $formName = $block->getFormName(); </script> <script data-role="img-dialog-container-tmpl" type="text/x-magento-template"> - <div class="image-panel" data-role="dialog"> - </div> + <div class="image-panel" data-role="dialog"> + </div> </script> <script data-role="img-dialog-tmpl" type="text/x-magento-template"> - <div class="image-panel-preview"> - <img src="<%- data.url %>" alt="<%- data.label %>" /> - </div> - <div class="image-panel-controls"> - <strong class="image-name"><%- data.label %></strong> + <div class="image-panel-preview"> + <img src="<%- data.url %>" alt="<%- data.label %>" /> + </div> + <div class="image-panel-controls"> + <strong class="image-name"><%- data.label %></strong> - <fieldset class="admin__fieldset fieldset-image-panel"> - <div class="admin__field field-image-description"> - <label class="admin__field-label" for="image-description"> - <span><?= /* @escapeNotVerified */ __('Alt Text') ?></span> - </label> + <fieldset class="admin__fieldset fieldset-image-panel"> + <div class="admin__field field-image-description"> + <label class="admin__field-label" for="image-description"> + <span><?= $block->escapeHtml(__('Alt Text')) ?></span> + </label> - <div class="admin__field-control"> + <div class="admin__field-control"> <textarea data-role="image-description" rows="3" class="admin__control-textarea" - name="<?php /* @escapeNotVerified */ - echo $elementName - ?>[<%- data.file_id %>][label]"><%- data.label %></textarea> - </div> - </div> + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][label]"><%- data.label %></textarea> + </div> + </div> - <div class="admin__field field-image-role"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Role') ?></span> - </label> - <div class="admin__field-control"> - <ul class="multiselect-alt"> - <?php - foreach ($block->getMediaAttributes() as $attribute) : - ?> - <li class="item"> - <label> - <input class="image-type" - data-role="type-selector" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - type="checkbox" - value="<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" - /> - <?php /* @escapeNotVerified */ echo $block->escapeHtml( - $attribute->getFrontendLabel() - ) ?> - </label> - </li> + <div class="admin__field field-image-role"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Role')) ?></span> + </label> + <div class="admin__field-control"> + <ul class="multiselect-alt"> + <?php + foreach ($block->getMediaAttributes() as $attribute) : + ?> + <li class="item"> + <label> + <input class="image-type" + data-role="type-selector" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + type="checkbox" + value="<?= $block->escapeHtmlAttr($attribute->getAttributeCode()) ?>" + /> + <?= $block->escapeHtml( + $attribute->getFrontendLabel() + ) ?> + </label> + </li> <?php endforeach; - ?> - </ul> - </div> + ?> + </ul> </div> + </div> - <div class="admin__field admin__field-inline field-image-size" data-role="size"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Image Size') ?></span> - </label> - <div class="admin__field-value" data-message="<?= /* @escapeNotVerified */ __('{size}') ?>"></div> - </div> + <div class="admin__field admin__field-inline field-image-size" data-role="size"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Image Size')) ?></span> + </label> + <div class="admin__field-value" data-message="<?= $block->escapeHtmlAttr(_('{size}')) ?>"></div> + </div> - <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Image Resolution') ?></span> - </label> - <div class="admin__field-value" data-message="<?= /* @escapeNotVerified */ __('{width}^{height} px') ?>"></div> - </div> + <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Image Resolution')) ?></span> + </label> + <div class="admin__field-value" data-message="<?= $block->escapeHtmlAttr(__('{width}^{height} px')) ?>"></div> + </div> - <div class="admin__field field-image-hide"> - <div class="admin__field-control"> - <div class="admin__field admin__field-option"> - <input type="checkbox" - id="hide-from-product-page" - data-role="visibility-trigger" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - value="1" - class="admin__control-checkbox" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][disabled]" - <% if (data.disabled == 1) { %>checked="checked"<% } %> /> - - <label for="hide-from-product-page" class="admin__field-label"> - <?= /* @escapeNotVerified */ __('Hide from Product Page') ?> - </label> - </div> + <div class="admin__field field-image-hide"> + <div class="admin__field-control"> + <div class="admin__field admin__field-option"> + <input type="checkbox" + id="hide-from-product-page" + data-role="visibility-trigger" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + value="1" + class="admin__control-checkbox" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][disabled]" + <% if (data.disabled == 1) { %>checked="checked"<% } %> /> + + <label for="hide-from-product-page" class="admin__field-label"> + <?= $block->escapeHtml(__('Hide from Product Page')) ?> + </label> </div> </div> - </fieldset> - </div> + </div> + </fieldset> + </div> </script> <?= $block->getChildHtml('new-video') ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml index 4134392c0f52b..0a13aee5930ad 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var \Magento\Catalog\Block\Adminhtml\Product\Edit\Js $block */ ?> @@ -30,8 +30,8 @@ function registerTaxRecalcs() { Event.observe($('tax_class_id'), 'change', recalculateTax); } -var priceFormat = <?= /* @escapeNotVerified */ $this->helper('Magento\Tax\Helper\Data')->getPriceFormat($block->getStore()) ?>; -var taxRates = <?= /* @escapeNotVerified */ $block->getAllRatesByProductClassJson() ?>; +var priceFormat = <?= /* @noEscape */ $this->helper(Magento\Tax\Helper\Data::class)->getPriceFormat($block->getStore()) ?>; +var taxRates = <?= /* @noEscape */ $block->getAllRatesByProductClassJson() ?>; function recalculateTax() { if (typeof dynamicTaxes == 'undefined') { @@ -75,10 +75,10 @@ function bindActiveProductTab(event, ui) { jQuery(document).on('tabsactivate', bindActiveProductTab); // bind active tab -<?php if ($tabsBlock = $block->getLayout()->getBlock('product_tabs')): ?> +<?php if ($tabsBlock = $block->getLayout()->getBlock('product_tabs')) :?> jQuery(function () { - if (jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').length && jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').is(':mage-tabs')) { - var activeAnchor = jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').tabs('activeAnchor'); + if (jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').length && jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').is(':mage-tabs')) { + var activeAnchor = jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').tabs('activeAnchor'); if (activeAnchor && $('store_switcher')) { $('store_switcher').switchParams = 'active_tab/' + activeAnchor.prop('name') + '/'; } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml index 5b07121de49dc..7c3bee3d4d2fc 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,7 +12,7 @@ ?> <div id="alert_messages_block"><?= $block->getMessageHtml() ?></div> <div> - <h4 class="icon-head head-edit-form"><?= /* @escapeNotVerified */ __('Product Alerts') ?></h4> + <h4 class="icon-head head-edit-form"><?= $block->escapeHtml(__('Product Alerts')) ?></h4> </div> <div class="clear"></div> <?= $block->getAccordionHtml() ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml index 2c62bbf8db3e9..5028d3c1e83d0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml @@ -4,382 +4,448 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory */ ?> -<?php if ($block->isReadonly()): ?> -<?php $_readonly = ' disabled="disabled" '; ?> -<?php else: ?> -<?php $_readonly = ''; ?> +<?php if ($block->isReadonly()) :?> + <?php $_readonly = ' disabled="disabled" '; ?> +<?php else :?> + <?php $_readonly = ''; ?> <?php endif; ?> <fieldset class="fieldset form-inline"> -<legend class="legend"><span><?= /* @escapeNotVerified */ __('Advanced Inventory') ?></span></legend> -<br> -<div id="table_cataloginventory"> -<div class="field"> - <label class="label" for="inventory_manage_stock"> - <span><?= /* @escapeNotVerified */ __('Manage Stock') ?></span> - </label> - <div class="control"> - <select id="inventory_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][manage_stock]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> - </select> - <input type="hidden" id="inventory_manage_stock_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('manage_stock') ?>"> - <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_manage_stock"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <legend class="legend"><span><?= $block->escapeHtml(__('Advanced Inventory')) ?></span></legend> + <br> + <div id="table_cataloginventory"> + <div class="field"> + <label class="label" for="inventory_manage_stock"> + <span><?= $block->escapeHtml(__('Manage Stock')) ?></span> + </label> + <div class="control"> + <select id="inventory_manage_stock" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][manage_stock]" <?= /* @noEscape */ $_readonly ?>> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0"<?php if ($block->getFieldValue('manage_stock') == 0) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> + </select> + <input type="hidden" + id="inventory_manage_stock_default" + value="<?= $block->escapeHtmlAttr($block->getDefaultConfigValue('manage_stock')) ?>"> + <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_manage_stock" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_manage_stock"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<?php if (!$block->getProduct()->isComposite()): ?> -<div class="field"> - <label class="label" for="inventory_qty"> - <span><?= /* @escapeNotVerified */ __('Qty') ?></span> - </label> - <div class="control"> - <?php if (!$_readonly): ?> - <input type="hidden" id="original_inventory_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][original_inventory_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty') * 1 ?>"> - <?php endif;?> - <input type="text" class="input-text validate-number" id="inventory_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <?php if (!$block->getProduct()->isComposite()) :?> + <div class="field"> + <label class="label" for="inventory_qty"> + <span><?= $block->escapeHtml(__('Qty')) ?></span> + </label> + <div class="control"> + <?php if (!$_readonly) :?> + <input type="hidden" + id="original_inventory_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][original_inventory_qty]" + value="<?= $block->getFieldValue('qty') * 1 ?>"> + <?php endif;?> + <input type="text" + class="input-text validate-number" + id="inventory_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][qty]" + value="<?= $block->getFieldValue('qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_min_qty"> - <span><?= /* @escapeNotVerified */ __('Out-of-Stock Threshold') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> + <div class="field"> + <label class="label" for="inventory_min_qty"> + <span><?= $block->escapeHtml(__('Out-of-Stock Threshold')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_min_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][min_qty]" + value="<?= $block->getFieldValue('min_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_min_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_min_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_min_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_min_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(["prototype"], function(){ -toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <?php if (!$block->isReadonly()) :?> + <script> + require(["prototype"], function(){ + toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_min_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Minimum Qty Allowed in Shopping Cart') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_sale_qty]" - value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_min_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_min_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="field"> + <label class="label" for="inventory_min_sale_qty"> + <span><?= $block->escapeHtml(__('Minimum Qty Allowed in Shopping Cart')) ?></span> + </label> + <div class="control"> + <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][min_sale_qty]" + value="<?= $block->getFieldValue('min_sale_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_min_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" + class="checkbox" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_min_sale_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_max_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Maximum Qty Allowed in Shopping Cart') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][max_sale_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('max_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <div class="control-inner-wrap"> - <input type="checkbox" id="inventory_use_config_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_max_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="field"> + <label class="label" for="inventory_max_sale_qty"> + <span><?= $block->escapeHtml(__('Maximum Qty Allowed in Shopping Cart')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][max_sale_qty]" + value="<?= $block->getFieldValue('max_sale_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <div class="control-inner-wrap"> + <input type="checkbox" + id="inventory_use_config_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" + class="checkbox" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_max_sale_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php if ($block->canUseQtyDecimals()): ?> - <div class="field"> - <label class="label" for="inventory_is_qty_decimal"> - <span><?= /* @escapeNotVerified */ __('Qty Uses Decimals') ?></span> - </label> - <div class="control"> - <select id="inventory_is_qty_decimal" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_qty_decimal]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option value="1"<?php if ($block->getFieldValue('is_qty_decimal') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - </select> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> - </div> + <?php if ($block->canUseQtyDecimals()) :?> + <div class="field"> + <label class="label" for="inventory_is_qty_decimal"> + <span><?= $block->escapeHtml(__('Qty Uses Decimals')) ?></span> + </label> + <div class="control"> + <select id="inventory_is_qty_decimal" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_qty_decimal]" <?= /* @noEscape */ $_readonly ?>> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1"<?php if ($block->getFieldValue('is_qty_decimal') == 1) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php if (!$block->isVirtual()) : ?> - <div class="field"> - <label class="label" for="inventory_is_decimal_divided"> - <span><?= /* @escapeNotVerified */ __('Allow Multiple Boxes for Shipping') ?></span> - </label> - <div class="control"> - <select id="inventory_is_decimal_divided" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_decimal_divided]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option value="1"<?php if ($block->getFieldValue('is_decimal_divided') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - </select> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> + <?php if (!$block->isVirtual()) :?> + <div class="field"> + <label class="label" for="inventory_is_decimal_divided"> + <span><?= $block->escapeHtml(__('Allow Multiple Boxes for Shipping')) ?></span> + </label> + <div class="control"> + <select id="inventory_is_decimal_divided" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_decimal_divided]" <?= /* @noEscape */ $_readonly ?>> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1"<?php if ($block->getFieldValue('is_decimal_divided') == 1) :?> + selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> + <?php endif; ?> <?php endif; ?> - </div> - <?php endif; ?> - <?php endif; ?> -<div class="field"> - <label class="label" for="inventory_backorders"> - <span><?= /* @escapeNotVerified */ __('Backorders') ?></span> - </label> - <div class="control"> - <select id="inventory_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][backorders]" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php foreach ($block->getBackordersOption() as $option): ?> - <?php $_selected = ($option['value'] == $block->getFieldValue('backorders')) ? 'selected="selected"' : '' ?> - <option value="<?= /* @escapeNotVerified */ $option['value'] ?>" <?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> - <?php endforeach; ?> - </select> + <div class="field"> + <label class="label" for="inventory_backorders"> + <span><?= $block->escapeHtml(__('Backorders')) ?></span> + </label> + <div class="control"> + <select id="inventory_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][backorders]" <?= /* @noEscape */ $_readonly ?>> + <?php foreach ($block->getBackordersOption() as $option) :?> + <?php $_selected = ($option['value'] == $block->getFieldValue('backorders')) ? 'selected="selected"' : '' ?> + <option value="<?= $block->escapeHtmlAttr($option['value']) ?>" <?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> + <?php endforeach; ?> + </select> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_backorders]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_backorders"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_backorders]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_backorders"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_notify_stock_qty"> - <span><?= /* @escapeNotVerified */ __('Notify for Quantity Below') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][notify_stock_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('notify_stock_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> + <div class="field"> + <label class="label" for="inventory_notify_stock_qty"> + <span><?= $block->escapeHtml(__('Notify for Quantity Below')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][notify_stock_qty]" + value="<?= $block->getFieldValue('notify_stock_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_notify_stock_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_notify_stock_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php endif; ?> -<div class="field"> - <label class="label" for="inventory_enable_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Enable Qty Increments') ?></span> - </label> - <div class="control"> - <?php $qtyIncrementsEnabled = $block->getFieldValue('enable_qty_increments'); ?> - <select id="inventory_enable_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][enable_qty_increments]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="1"<?php if ($qtyIncrementsEnabled): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option value="0"<?php if (!$qtyIncrementsEnabled): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> - </select> - <input type="hidden" id="inventory_enable_qty_increments_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('enable_qty_increments') ?>"> + <?php endif; ?> + <div class="field"> + <label class="label" for="inventory_enable_qty_increments"> + <span><?= $block->escapeHtml(__('Enable Qty Increments')) ?></span> + </label> + <div class="control"> + <?php $qtyIncrementsEnabled = $block->getFieldValue('enable_qty_increments'); ?> + <select id="inventory_enable_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][enable_qty_increments]" <?= /* @noEscape */ $_readonly ?>> + <option value="1"<?php if ($qtyIncrementsEnabled) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0"<?php if (!$qtyIncrementsEnabled) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> + </select> + <input type="hidden" + id="inventory_enable_qty_increments_default" + value="<?= $block->escapeHtmlAttr($block->getDefaultConfigValue('enable_qty_increments')) ?>"> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_enable_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_enable_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_enable_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_enable_qty_increments"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -<div class="field"> - <label class="label" for="inventory_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Qty Increments') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-digits" id="inventory_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][qty_increments]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty_increments') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> + <div class="field"> + <label class="label" for="inventory_qty_increments"> + <span><?= $block->escapeHtml(__('Qty Increments')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-digits" + id="inventory_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][qty_increments]" + value="<?= $block->getFieldValue('qty_increments') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_qty_increments"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -<div class="field"> - <label class="label" for="inventory_stock_availability"> - <span><?= /* @escapeNotVerified */ __('Stock Availability') ?></span> - </label> - <div class="control"> - <select id="inventory_stock_availability" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_in_stock]" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php foreach ($block->getStockOption() as $option): ?> - <?php $_selected = ($block->getFieldValue('is_in_stock') !== null && $option['value'] == $block->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?> - <option value="<?= /* @escapeNotVerified */ $option['value'] ?>" <?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> - <?php endforeach; ?> - </select> + <div class="field"> + <label class="label" for="inventory_stock_availability"> + <span><?= $block->escapeHtml(__('Stock Availability')) ?></span> + </label> + <div class="control"> + <select id="inventory_stock_availability" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_in_stock]" <?= /* @noEscape */ $_readonly ?>> + <?php foreach ($block->getStockOption() as $option) :?> + <?php $_selected = ($block->getFieldValue('is_in_stock') !== null && $option['value'] == $block->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?> + <option value="<?= $block->escapeHtmlAttr($option['value']) ?>" <?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> + <?php endforeach; ?> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -</div> </fieldset> <script> -require(["jquery","prototype"], function(jQuery){ + require(["jquery","prototype"], function(jQuery){ - //<![CDATA[ - function changeManageStockOption() - { - var manageStock = $('inventory_use_config_manage_stock').checked + //<![CDATA[ + function changeManageStockOption() + { + var manageStock = $('inventory_use_config_manage_stock').checked ? $('inventory_manage_stock_default').value : $('inventory_manage_stock').value; - var catalogInventoryNotManageStockFields = { - inventory_min_sale_qty: true, - inventory_max_sale_qty: true, - inventory_enable_qty_increments : true, - inventory_qty_increments: true - }; - - $$('#table_cataloginventory > div').each(function(el) { - if (el == $('inventory_manage_stock').up(1)) { - return; - } + var catalogInventoryNotManageStockFields = { + inventory_min_sale_qty: true, + inventory_max_sale_qty: true, + inventory_enable_qty_increments : true, + inventory_qty_increments: true + }; - for (field in catalogInventoryNotManageStockFields) { - if ($(field) && ($(field).up(1) == el)) { + $$('#table_cataloginventory > div').each(function(el) { + if (el == $('inventory_manage_stock').up(1)) { return; } - } - el[manageStock == 1 ? 'show' : 'hide'](); - }); + for (field in catalogInventoryNotManageStockFields) { + if ($(field) && ($(field).up(1) == el)) { + return; + } + } - return true; - } + el[manageStock == 1 ? 'show' : 'hide'](); + }); - function applyEnableQtyIncrements() { - var enableQtyIncrements = $('inventory_use_config_enable_qty_increments').checked - ? $('inventory_enable_qty_increments_default').value - : $('inventory_enable_qty_increments').value; + return true; + } - $('inventory_qty_increments').up('.field')[enableQtyIncrements == 1 ? 'show' : 'hide'](); - } + function applyEnableQtyIncrements() { + var enableQtyIncrements = $('inventory_use_config_enable_qty_increments').checked + ? $('inventory_enable_qty_increments_default').value + : $('inventory_enable_qty_increments').value; - function applyEnableDecimalDivided() { - <?php if (!$block->isVirtual()) : ?> - $('inventory_is_decimal_divided').up('.field').hide(); - <?php endif; ?> - $('inventory_qty_increments').removeClassName('validate-digits').removeClassName('validate-number'); - $('inventory_min_sale_qty').removeClassName('validate-digits').removeClassName('validate-number'); - if ($('inventory_is_qty_decimal').value == 1) { - <?php if (!$block->isVirtual()) : ?> - $('inventory_is_decimal_divided').up('.field').show(); - <?php endif; ?> - $('inventory_qty_increments').addClassName('validate-number'); - $('inventory_min_sale_qty').addClassName('validate-number'); - } else { - $('inventory_qty_increments').addClassName('validate-digits'); - $('inventory_min_sale_qty').addClassName('validate-digits'); + $('inventory_qty_increments').up('.field')[enableQtyIncrements == 1 ? 'show' : 'hide'](); } - } - Event.observe(window, 'load', function() { - if ($('inventory_manage_stock') && $('inventory_use_config_manage_stock')) { - Event.observe($('inventory_manage_stock'), 'change', changeManageStockOption); - Event.observe($('inventory_use_config_manage_stock'), 'change', changeManageStockOption); - changeManageStockOption(); + function applyEnableDecimalDivided() { + <?php if (!$block->isVirtual()) :?> + $('inventory_is_decimal_divided').up('.field').hide(); + <?php endif; ?> + $('inventory_qty_increments').removeClassName('validate-digits').removeClassName('validate-number'); + $('inventory_min_sale_qty').removeClassName('validate-digits').removeClassName('validate-number'); + if ($('inventory_is_qty_decimal').value == 1) { + <?php if (!$block->isVirtual()) :?> + $('inventory_is_decimal_divided').up('.field').show(); + <?php endif; ?> + $('inventory_qty_increments').addClassName('validate-number'); + $('inventory_min_sale_qty').addClassName('validate-number'); + } else { + $('inventory_qty_increments').addClassName('validate-digits'); + $('inventory_min_sale_qty').addClassName('validate-digits'); + } } - if ($('inventory_enable_qty_increments') && $('inventory_use_config_enable_qty_increments')) { - //Delegation is used because of events, which are not firing while the input is disabled - jQuery('#inventory_enable_qty_increments').parent() + + Event.observe(window, 'load', function() { + if ($('inventory_manage_stock') && $('inventory_use_config_manage_stock')) { + Event.observe($('inventory_manage_stock'), 'change', changeManageStockOption); + Event.observe($('inventory_use_config_manage_stock'), 'change', changeManageStockOption); + changeManageStockOption(); + } + if ($('inventory_enable_qty_increments') && $('inventory_use_config_enable_qty_increments')) { + //Delegation is used because of events, which are not firing while the input is disabled + jQuery('#inventory_enable_qty_increments').parent() .on('change', '#inventory_enable_qty_increments', applyEnableQtyIncrements); - Event.observe($('inventory_use_config_enable_qty_increments'), 'change', applyEnableQtyIncrements); - applyEnableQtyIncrements(); - } - if ($('inventory_is_qty_decimal') && $('inventory_qty_increments') && $('inventory_min_sale_qty')) { - Event.observe($('inventory_is_qty_decimal'), 'change', applyEnableDecimalDivided); - applyEnableDecimalDivided(); - } - }); + Event.observe($('inventory_use_config_enable_qty_increments'), 'change', applyEnableQtyIncrements); + applyEnableQtyIncrements(); + } + if ($('inventory_is_qty_decimal') && $('inventory_qty_increments') && $('inventory_min_sale_qty')) { + Event.observe($('inventory_is_qty_decimal'), 'change', applyEnableDecimalDivided); + applyEnableDecimalDivided(); + } + }); - window.applyEnableDecimalDivided = applyEnableDecimalDivided; - window.applyEnableQtyIncrements = applyEnableQtyIncrements; - window.changeManageStockOption = changeManageStockOption; - //]]> + window.applyEnableDecimalDivided = applyEnableDecimalDivided; + window.applyEnableQtyIncrements = applyEnableQtyIncrements; + window.changeManageStockOption = changeManageStockOption; + //]]> -}); + }); </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml index 04ccfb5aee8d0..17fb517b32547 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml @@ -4,24 +4,24 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Search */ ?> <div id="product-attribute-search-container" class="suggest-expandable attribute-selector"> <div class="action-dropdown"> <button type="button" class="action-toggle action-choose" data-mage-init='{"dropdown":{}}' data-toggle="dropdown"> - <span><?= /* @escapeNotVerified */ __('Add Attribute') ?></span> + <span><?= $block->escapeHtml(__('Add Attribute')) ?></span> </button> <div class="dropdown-menu"> <input data-role="product-attribute-search" - data-group="<?= $block->escapeHtml($block->getGroupCode()) ?>" + data-group="<?= $block->escapeHtmlAttr($block->getGroupCode()) ?>" class="search" type="text" - placeholder="<?= /* @noEscape */ __('start typing to search attribute') ?>" /> + placeholder="<?= $block->escapeHtmlAttr(__('start typing to search attribute')) ?>" /> </div> </div> -<script data-template-for="product-attribute-search-<?= /* @escapeNotVerified */ $block->getGroupId() ?>" type="text/x-magento-template"> +<script data-template-for="product-attribute-search-<?= $block->escapeHtmlAttr($block->getGroupId()) ?>" type="text/x-magento-template"> <ul data-mage-init='{"menu":[]}'> <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> @@ -29,7 +29,7 @@ <% }); %> <% } else { %><span class="mage-suggest-no-records"><%- data.noRecordsText %></span><% } %> </ul> - <div class="actions"><?= /* @escapeNotVerified */ $block->getAttributeCreate() ?></div> + <div class="actions"><?= $block->escapeHtml($block->getAttributeCreate()) ?></div> </script> <script> @@ -51,13 +51,13 @@ }); }); - $suggest.mage('suggest', <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSelectorOptions()) ?>) + $suggest.mage('suggest', <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSelectorOptions()) ?>) .on('suggestselect', function (e, ui) { $(this).val(''); var templateId = $('#attribute_set_id').val(); if (ui.item.id) { $.ajax({ - url: '<?= /* @escapeNotVerified */ $block->getAddAttributeUrl() ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getAddAttributeUrl())) ?>', type: 'POST', dataType: 'json', data: {attribute_id: ui.item.id, template_id: templateId, group: $(this).data('group')}, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml index 6a62f01f97b65..427027fdb67e0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml @@ -4,40 +4,38 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs */ ?> -<?php if (!empty($tabs)): ?> +<?php if (!empty($tabs)) :?> <?php $tabGroups = [ \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::BASIC_TAB_GROUP_CODE, \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::ADVANCED_TAB_GROUP_CODE, ];?> - <div id="<?= /* @escapeNotVerified */ $block->getId() ?>" + <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>" data-mage-init='{"tabs":{ - "active": "<?= /* @escapeNotVerified */ $block->getActiveTabId() ?>", - "destination": "#<?= /* @escapeNotVerified */ $block->getDestElementId() ?>", - "shadowTabs": "<?= /* @escapeNotVerified */ $block->getAllShadowTabs() ?>", - "tabsBlockPrefix": "<?= /* @escapeNotVerified */ $block->getId() ?>_", + "active": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getActiveTabId())) ?>", + "destination": "#<?= $block->escapeJs($block->escapeHtmlAttr($block->getDestElementId())) ?>", + "shadowTabs": "<?= /* @noEscape */ $block->getAllShadowTabs() ?>", + "tabsBlockPrefix": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getId())) ?>_", "tabIdArgument": "active_tab", - "tabPanelClass": "<?= /* @escapeNotVerified */ $block->getPanelsClass() ?>", - "excludedPanel": "<?= /* @escapeNotVerified */ $block->getExcludedPanel() ?>", + "tabPanelClass": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getPanelsClass())) ?>", + "excludedPanel": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getExcludedPanel())) ?>", "groups": "ul.tabs" }}'> - <?php foreach ($tabGroups as $tabGroupCode): ?> + <?php foreach ($tabGroups as $tabGroupCode) :?> <?php $tabGroupId = $block->getId() . '-' . $tabGroupCode; $isBasic = $tabGroupCode == \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::BASIC_TAB_GROUP_CODE; $activeCollapsible = $block->isAdvancedTabGroupActive() ? true : false; ?> - <div class="admin__page-nav <?php if (!$isBasic): ?> <?= '_collapsed' ?> <?php endif;?>" + <div class="admin__page-nav <?php if (!$isBasic) :?> <?= '_collapsed' ?> <?php endif;?>" data-role="container" - id="<?= /* @escapeNotVerified */ $tabGroupId ?>" - <?php if (!$isBasic): ?> + id="<?= $block->escapeHtmlAttr($tabGroupId) ?>" + <?php if (!$isBasic) :?> data-mage-init='{"collapsible":{ - "active": "<?= /* @escapeNotVerified */ $activeCollapsible ?>", + "active": "<?= /* @noEscape */ $activeCollapsible ?>", "openedState": "_show", "closedState": "_hide", "animate": 200, @@ -45,44 +43,45 @@ }}' <?php endif;?>> - <div class="admin__page-nav-title-wrap" <?= /* @escapeNotVerified */ $block->getUiId('title') ?> data-role="title"> - <div class="admin__page-nav-title <?php if (!$isBasic): ?> <?= '_collapsible' ?><?php endif;?>" + <div class="admin__page-nav-title-wrap" <?= /* @noEscape */ $block->getUiId('title') ?> data-role="title"> + <div class="admin__page-nav-title <?php if (!$isBasic) :?> <?= '_collapsible' ?><?php endif;?>" data-role="trigger"> <strong> - <?= /* @escapeNotVerified */ $isBasic ? __('Basic Settings') : __('Advanced Settings') ?> + <?= $block->escapeHtml($isBasic ? __('Basic Settings') : __('Advanced Settings')) ?> </strong> <span data-role="title-messages" class="admin__page-nav-title-messages"></span> </div> </div> - <ul <?= /* @escapeNotVerified */ $block->getUiId('tab', $tabGroupId) ?> class="tabs admin__page-nav-items" data-role="content"> - <?php foreach ($tabs as $_tab): ?> + <ul <?= /* @noEscape */ $block->getUiId('tab', $tabGroupId) ?> class="tabs admin__page-nav-items" data-role="content"> + <?php foreach ($tabs as $_tab) :?> <?php /** @var $_tab \Magento\Backend\Block\Widget\Tab\TabInterface */ ?> <?php if (!$block->canShowTab($_tab) || $_tab->getParentTab() || ($_tab->getGroupCode() && $_tab->getGroupCode() != $tabGroupCode) - || (!$_tab->getGroupCode() && $isBasic)): continue; endif;?> + || (!$_tab->getGroupCode() && $isBasic)) : continue; + endif;?> <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> - <li class="admin__page-nav-item <?php if ($block->getTabIsHidden($_tab)): ?> <?= "no-display" ?> <?php endif; ?> " <?= /* @escapeNotVerified */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> - <a href="<?= /* @escapeNotVerified */ $_tabHref ?>" id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>" - name="<?= /* @escapeNotVerified */ $block->getTabId($_tab, false) ?>" - title="<?= /* @escapeNotVerified */ $block->getTabTitle($_tab) ?>" - class="admin__page-nav-link <?= /* @escapeNotVerified */ $_tabClass ?>" - data-tab-type="<?= /* @escapeNotVerified */ $_tabType ?>" <?= /* @escapeNotVerified */ $block->getUiId('tab', 'link', $_tab->getId()) ?> + <li class="admin__page-nav-item <?php if ($block->getTabIsHidden($_tab)) :?> <?= "no-display" ?> <?php endif; ?> " <?= /* @noEscape */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> + <a href="<?= $block->escapeUrl($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" + name="<?= $block->escapeHtmlAttr($block->getTabId($_tab, false)) ?>" + title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" + class="admin__page-nav-link <?= $block->escapeHtmlAttr($_tabClass) ?>" + data-tab-type="<?= /* @noEscape */ $_tabType ?>" <?= /* @noEscape */ $block->getUiId('tab', 'link', $_tab->getId()) ?> > <span><?= $block->escapeHtml($block->getTabLabel($_tab)) ?></span> <span class="admin__page-nav-item-messages" data-role="item-messages"> <span class="admin__page-nav-item-message _changed"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('Changes have been made to this section that have not been saved.') ?> + <?= $block->escapeHtml(__('Changes have been made to this section that have not been saved.')) ?> </span> </span> <span class="admin__page-nav-item-message _error"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('This tab contains invalid data. Please resolve this before saving.') ?> + <?= $block->escapeHtml(__('This tab contains invalid data. Please resolve this before saving.')) ?> </span> </span> <span class="admin__page-nav-item-message-loader"> @@ -93,11 +92,11 @@ </span> </span> </a> - <div id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>_content" class="no-display" - data-tab-panel="<?= /* @escapeNotVerified */ $_tab->getTabId() ?>" - <?= /* @escapeNotVerified */ $block->getUiId('tab', 'content', $_tab->getId()) ?> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" class="no-display" + data-tab-panel="<?= $block->escapeHtmlAttr($_tab->getTabId()) ?>" + <?= /* @noEscape */ $block->getUiId('tab', 'content', $_tab->getId()) ?> > - <?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?> + <?= /* @noEscape */ $block->getTabContent($_tab) ?> <?= /* @noEscape */ $block->getAccordion($_tab) ?> </div> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml index 842ed17375f77..c4dc1ddc0b02b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml @@ -4,13 +4,11 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\ChildTab */ ?> <div class="fieldset-wrapper admin__collapsible-block-wrapper" data-tab="<?= /* @noEscape */ $block->getTabId() ?>" id="<?= /* @noEscape */ $block->getTabId() ?>-wrapper" data-mage-init='{"collapsible":{ - "active": <?= /* @noEscape */ $block->isTabOpened() ? 'true' : 'false' ?>, + "active": <?= $block->isTabOpened() ? 'true' : 'false' ?>, "openedState": "_show", "closedState": "_hide", "animate": 200, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml index 8df3e32b0a2c3..c814298d1dbc5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Grid */ ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) :?> <form action="" id="<?= $block->getHtmlId() ?>-form" method="post"> <?php endif ?> <div class="admin__grid-massaction-form"> @@ -16,43 +15,43 @@ <select id="<?= $block->getHtmlId() ?>-select" class="local-validation admin__control-select"> - <option class="admin__control-select-placeholder" value="" selected><?= /* @escapeNotVerified */ __('Actions') ?></option> - <?php foreach ($block->getItems() as $_item): ?> - <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> + <?php foreach ($block->getItems() as $_item) :?> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-additional"></span> <?= $block->getApplyButtonHtml() ?> </div> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) :?> </form> <?php endif ?> <div class="no-display"> - <?php foreach ($block->getItems() as $_item): ?> - <div id="<?= $block->getHtmlId() ?>-item-<?= /* @escapeNotVerified */ $_item->getId() ?>-block"> + <?php foreach ($block->getItems() as $_item) :?> + <div id="<?= $block->getHtmlId() ?>-item-<?= $block->escapeHtmlAttr($_item->getId()) ?>-block"> <?= $_item->getAdditionalActionBlockHtml() ?> </div> <?php endforeach; ?> </div> <div class="mass-select-wrap"> - <select id="<?= $block->getHtmlId() ?>-mass-select" data-menu="grid-mass-select"> - <optgroup label="<?= /* @escapeNotVerified */ __('Mass Actions') ?>"> + <select id="<?= $block->escapeHtmlAttr($block->getHtmlId()) ?>-mass-select" data-menu="grid-mass-select"> + <optgroup label="<?= $block->escapeHtmlAttr(__('Mass Actions')) ?>"> <option disabled selected></option> - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) :?> <option value="selectAll"> - <?= /* @escapeNotVerified */ __('Select All') ?> + <?= $block->escapeHtml(__('Select All')) ?> </option> <option value="unselectAll"> - <?= /* @escapeNotVerified */ __('Unselect All') ?> + <?= $block->escapeHtml(__('Unselect All')) ?> </option> <?php endif; ?> <option value="selectVisible"> - <?= /* @escapeNotVerified */ __('Select Visible') ?> + <?= $block->escapeHtml(__('Select Visible')) ?> </option> <option value="unselectVisible"> - <?= /* @escapeNotVerified */ __('Unselect Visible') ?> + <?= $block->escapeHtml(__('Unselect Visible')) ?> </option> </optgroup> </select> @@ -65,19 +64,19 @@ $('#<?= $block->getHtmlId() ?>-mass-select').change(function () { var massAction = $('option:selected', this).val(); switch (massAction) { - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) :?> case 'selectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break case 'unselectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectAll(); break <?php endif; ?> case 'selectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectVisible(); break case 'unselectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectVisible(); break } this.blur(); @@ -85,8 +84,8 @@ }); - <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setGridIds('<?= /* @escapeNotVerified */ $block->getGridIdsJson() ?>'); + <?php if (!$block->getParentBlock()->canDisplayContainer()) :?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml index fb450d19312fa..668dc4a28a6d9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Rss\Grid\Link */ ?> -<?php if ($block->isRssAllowed() && $block->getLink()): ?> -<a href="<?= /* @escapeNotVerified */ $block->getLink() ?>" class="link-feed"><?= /* @escapeNotVerified */ $block->getLabel() ?></a> +<?php if ($block->isRssAllowed() && $block->getLink()) :?> +<a href="<?= $block->escapeUrl($block->getLink()) ?>" class="link-feed"><?= $block->escapeHtml($block->getLabel()) ?></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/js/components.phtml b/app/code/Magento/Catalog/view/base/templates/js/components.phtml index bad5acc209b5f..5902a9f25cc4b 100644 --- a/app/code/Magento/Catalog/view/base/templates/js/components.phtml +++ b/app/code/Magento/Catalog/view/base/templates/js/components.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml() ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml index 0f3b4f481a288..fb48e369a528e 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile use Magento\Catalog\Model\Product\Option; /** - * @var \Magento\Catalog\Block\Product\View\Options\View\Checkable $block + * @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select\Checkable */ $option = $block->getOption(); if ($option) : ?> @@ -19,27 +18,21 @@ if ($option) : ?> $count = 1; ?> -<div class="options-list nested" id="options-<?php echo /* @noEscape */ -$option->getId() ?>-list"> - <?php if ($optionType === Option::OPTION_TYPE_RADIO && !$option->getIsRequire()): ?> +<div class="options-list nested" id="options-<?= $block->escapeHtmlAttr($option->getId()) ?>-list"> + <?php if ($optionType === Option::OPTION_TYPE_RADIO && !$option->getIsRequire()) :?> <div class="field choice admin__field admin__field-option"> <input type="radio" - id="options_<?php echo /* @noEscape */ - $option->getId() ?>" + id="options_<?= $block->escapeHtmlAttr($option->getId()) ?>" class="radio admin__control-radio product-custom-option" - name="options[<?php echo /* @noEscape */ - $option->getId() ?>]" - data-selector="options[<?php echo /* @noEscape */ - $option->getId() ?>]" - onclick="<?php echo $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" + name="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]" + onclick="<?= $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" value="" checked="checked" /> - <label class="label admin__field-label" for="options_<?php echo /* @noEscape */ - $option->getId() ?>"> + <label class="label admin__field-label" for="options_<?= $block->escapeHtmlAttr($option->getId()) ?>"> <span> - <?php echo /* @noEscape */ - __('None') ?> + <?= $block->escapeHtml(__('None')) ?> </span> </label> </div> @@ -60,39 +53,27 @@ $option->getId() ?>-list"> } ?> - <div class="field choice admin__field admin__field-option <?php echo /* @noEscape */ - $option->getIsRequire() ? 'required': '' ?>"> - <input type="<?php echo /* @noEscape */ - $optionType ?>" - class="<?php /** @noinspection DisconnectedForeachInstructionInspection */ - echo /* @noEscape */ - $optionType === Option::OPTION_TYPE_RADIO ? - 'radio admin__control-radio' : - 'checkbox admin__control-checkbox' ?> <?php echo /* @noEscape */ - $option->getIsRequire() ? 'required': '' ?> + <div class="field choice admin__field admin__field-option <?= /* @noEscape */ $option->getIsRequire() ? 'required': '' ?>"> + <input type="<?= $block->escapeHtmlAttr($optionType) ?>" + class="<?= $optionType === Option::OPTION_TYPE_RADIO + ? 'radio admin__control-radio' + : 'checkbox admin__control-checkbox' ?> <?= $option->getIsRequire() + ? 'required': '' ?> product-custom-option - <?php echo $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" - name="options[<?php echo $option->getId() ?>]<?php echo /* @noEscape */ - $arraySign ?>" - id="options_<?php echo /* @noEscape */ - $option->getId() . '_' . $count ?>" - value="<?php echo /* @noEscape */ - $value->getOptionTypeId() ?>" - <?php echo /* @noEscape */ - $checked ?> - data-selector="<?php echo /* @noEscape */ - $dataSelector ?>" - price="<?php echo /* @noEscape */ - $block->getCurrencyByStore($value) ?>" + <?= $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" + name="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]<?= /* @noEscape */ $arraySign ?>" + id="options_<?= $block->escapeHtmlAttr($option->getId()) . '_' . $count ?>" + value="<?= $block->escapeHtmlAttr($value->getOptionTypeId()) ?>" + <?= $block->escapeHtml($checked) ?> + data-selector="<?= $block->escapeHtmlAttr($dataSelector) ?>" + price="<?= $block->escapeHtmlAttr($block->getCurrencyByStore($value)) ?>" /> <label class="label admin__field-label" - for="options_<?php echo /* @noEscape */ - $option->getId() . '_' . $count ?>"> + for="options_<?= $block->escapeHtmlAttr($option->getId()) . '_' . $count ?>"> <span> - <?php echo $block->escapeHtml($value->getTitle()) ?> + <?= $block->escapeHtml($value->getTitle()) ?> </span> - <?php echo /* @noEscape */ - $block->formatPrice($value) ?> + <?= /* @noEscape */ $block->formatPrice($value) ?> </label> </div> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml index ce1561e382eed..b2c2acb7419bd 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml @@ -3,29 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?php /** @var \Magento\Framework\Pricing\Render\Amount $block */ ?> +<?php /** @var $block \Magento\Framework\Pricing\Render\Amount */ ?> -<span class="price-container <?= /* @escapeNotVerified */ $block->getAdjustmentCssClasses() ?>" +<span class="price-container <?= $block->escapeHtmlAttr($block->getAdjustmentCssClasses()) ?>" <?= $block->getSchema() ? ' itemprop="offers" itemscope itemtype="http://schema.org/Offer"' : '' ?>> - <?php if ($block->getDisplayLabel()): ?> - <span class="price-label"><?= /* @escapeNotVerified */ $block->getDisplayLabel() ?></span> + <?php if ($block->getDisplayLabel()) :?> + <span class="price-label"><?= $block->escapeHtml($block->getDisplayLabel()) ?></span> <?php endif; ?> - <span <?php if ($block->getPriceId()): ?> id="<?= /* @escapeNotVerified */ $block->getPriceId() ?>"<?php endif;?> - <?= ($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?> - data-price-amount="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>" - data-price-type="<?= /* @escapeNotVerified */ $block->getPriceType() ?>" - class="price-wrapper <?= /* @escapeNotVerified */ $block->getPriceWrapperCss() ?>" - ><?= /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?></span> - <?php if ($block->hasAdjustmentsHtml()): ?> + <span <?php if ($block->getPriceId()) :?> id="<?= $block->escapeHtmlAttr($block->getPriceId()) ?>"<?php endif;?> + <?= ($block->getPriceDisplayLabel()) ? 'data-label="' . $block->escapeHtmlAttr($block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes()) . '"' : '' ?> + data-price-amount="<?= $block->escapeHtmlAttr($block->getDisplayValue()) ?>" + data-price-type="<?= $block->escapeHtmlAttr($block->getPriceType()) ?>" + class="price-wrapper <?= $block->escapeHtmlAttr($block->getPriceWrapperCss()) ?>" + ><?= $block->escapeHtml($block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()), ['span']) ?></span> + <?php if ($block->hasAdjustmentsHtml()) :?> <?= $block->getAdjustmentsHtml() ?> <?php endif; ?> - <?php if ($block->getSchema()): ?> - <meta itemprop="price" content="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>" /> - <meta itemprop="priceCurrency" content="<?= /* @escapeNotVerified */ $block->getDisplayCurrencyCode() ?>" /> + <?php if ($block->getSchema()) :?> + <meta itemprop="price" content="<?= $block->escapeHtmlAttr($block->getDisplayValue()) ?>" /> + <meta itemprop="priceCurrency" content="<?= $block->escapeHtmlAttr($block->getDisplayCurrencyCode()) ?>" /> <?php endif; ?> </span> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml index b414f02a3d6fb..7005e65bcca80 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -15,7 +12,7 @@ /** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */ $priceModel = $block->getPriceType('regular_price'); -/* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [ +/* @noEscape */ echo $block->renderAmount($priceModel->getAmount(), [ 'price_id' => $block->getPriceId('product-price-'), 'include_container' => true ]); diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml index 6e281bdef7afb..e56804a06de22 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -21,9 +18,9 @@ $finalPriceModel = $block->getPriceType('final_price'); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $schema = ($block->getZone() == 'item_view') ? true : false; ?> -<?php if ($block->hasSpecialPrice()): ?> +<?php if ($block->hasSpecialPrice()) :?> <span class="special-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [ + <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'display_label' => __('Special Price'), 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', @@ -32,7 +29,7 @@ $schema = ($block->getZone() == 'item_view') ? true : false; ]); ?> </span> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [ + <?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [ 'display_label' => __('Regular Price'), 'price_id' => $block->getPriceId('old-price-' . $idSuffix), 'price_type' => 'oldPrice', @@ -40,8 +37,8 @@ $schema = ($block->getZone() == 'item_view') ? true : false; 'skip_adjustments' => true ]); ?> </span> -<?php else: ?> - <?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [ +<?php else :?> + <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', 'include_container' => true, @@ -49,14 +46,14 @@ $schema = ($block->getZone() == 'item_view') ? true : false; ]); ?> <?php endif; ?> -<?php if ($block->showMinimalPrice()): ?> - <?php if ($block->getUseLinkForAsLowAs()):?> - <a href="<?= /* @escapeNotVerified */ $block->getSaleableItem()->getProductUrl() ?>" class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> +<?php if ($block->showMinimalPrice()) :?> + <?php if ($block->getUseLinkForAsLowAs()) :?> + <a href="<?= $block->escapeUrl($block->getSaleableItem()->getProductUrl()) ?>" class="minimal-price-link"> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </a> - <?php else:?> + <?php else :?> <span class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </span> <?php endif?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml index c2b7fb4e60855..5949b54268a62 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml @@ -3,12 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate +// phpcs:disable Generic.WhiteSpace.ScopeIndent + /** @var \Magento\Catalog\Pricing\Render\PriceBox $block */ /** @var \Magento\Catalog\Pricing\Price\TierPrice $tierPriceModel */ @@ -18,17 +18,17 @@ $msrpShowOnGesture = $block->getPriceType('msrp_price')->isShowPriceOnGesture(); $product = $block->getSaleableItem(); ?> <?php if (count($tierPrices)) : ?> - <ul class="<?= /* @escapeNotVerified */ ($block->hasListClass() ? $block->getListClass() : 'prices-tier items') ?>"> - <?php foreach ($tierPrices as $index => $price) : ?> - <li class="item"> - <?php + <ul class="<?= $block->escapeHtmlAttr(($block->hasListClass() ? $block->getListClass() : 'prices-tier items')) ?>"> + <?php foreach ($tierPrices as $index => $price) : ?> + <li class="item"> + <?php $productId = $product->getId(); $isSaleable = $product->isSaleable(); $popupId = 'msrp-popup-' . $productId . $block->getRandomString(20); - if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()): + if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()) : $addToCartUrl = ''; if ($isSaleable) { - $addToCartUrl = $this->helper('\Magento\Checkout\Helper\Cart') + $addToCartUrl = $this->helper(\Magento\Checkout\Helper\Cart::class) ->getAddUrl($product, ['qty' => $price['price_qty']]); } $tierPriceData = [ @@ -54,13 +54,13 @@ $product = $block->getSaleableItem(); if ($block->getCanDisplayQty($product)) { $tierPriceData['qty'] = $price['price_qty']; } - ?> - <?= /* @escapeNotVerified */ __('Buy %1 for: ', $price['price_qty']) ?> - <a href="javascript:void(0);" - id="<?= /* @escapeNotVerified */ ($popupId) ?>" - data-tier-price="<?= $block->escapeHtml($block->jsonEncode($tierPriceData)) ?>"> - <?= /* @escapeNotVerified */ __('Click for price') ?></a> - <?php else: + ?> + <?= $block->escapeHtml(__('Buy %1 for: ', $price['price_qty'])) ?> + <a href="javascript:void(0);" + id="<?= $block->escapeHtmlAttr($popupId) ?>" + data-tier-price="<?= $block->escapeHtml($block->jsonEncode($tierPriceData)) ?>"> + <?= $block->escapeHtml(__('Click for price')) ?></a> + <?php else : $priceAmountBlock = $block->renderAmount( $price['price'], [ @@ -70,22 +70,22 @@ $product = $block->getSaleableItem(); 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION ] ); - ?> - <?php /* @escapeNotVerified */ echo ($block->getShowDetailedPrice() !== false) - ? __( - 'Buy %1 for %2 each and <strong class="benefit">save<span class="percent tier-%3"> %4</span>%</strong>', - $price['price_qty'], - $priceAmountBlock, - $index, - $block->formatPercent($price['percentage_value'] ?? $tierPriceModel->getSavePercent($price['price'])) - ) - : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock); - ?> - <?php endif; ?> - </li> - <?php endforeach; ?> + ?> + <?= /* @noEscape */ ($block->getShowDetailedPrice() !== false) + ? __( + 'Buy %1 for %2 each and <strong class="benefit">save<span class="percent tier-%3"> %4</span>%</strong>', + $price['price_qty'], + $priceAmountBlock, + $index, + $block->formatPercent($price['percentage_value'] ?? $tierPriceModel->getSavePercent($price['price'])) + ) + : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock); + ?> + <?php endif; ?> + </li> + <?php endforeach; ?> </ul> - <?php if ($msrpShowOnGesture):?> + <?php if ($msrpShowOnGesture) :?> <script type="text/x-magento-init"> { ".product-info-main": { @@ -95,9 +95,9 @@ $product = $block->getSaleableItem(); "inputQty": "#qty", "attr": "[data-tier-price]", "productForm": "#product_addtocart_form", - "productId": "<?= /* @escapeNotVerified */ $productId ?>", + "productId": "<?= (int) $productId ?>", "productIdInput": "input[type=hidden][name=product]", - "isSaleable": "<?= /* @escapeNotVerified */ $isSaleable ?>" + "isSaleable": "<?= (bool) $isSaleable ?>" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml index 3619ce94031c2..b50095e91d999 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,7 +11,7 @@ * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if ($block->isContentMode() || $block->isMixedMode()): ?> +<?php if ($block->isContentMode() || $block->isMixedMode()) :?> <div class="category-cms"> <?= $block->getCmsBlockHtml() ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml index 0efce1014f9c2..2f5b852575c78 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml @@ -3,19 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * Category view template * * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if ($_description = $block->getCurrentCategory()->getDescription()): ?> +<?php if ($_description = $block->getCurrentCategory()->getDescription()) :?> <div class="category-description"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($block->getCurrentCategory(), $_description, 'description') ?> + <?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->categoryAttribute( + $block->getCurrentCategory(), + $_description, + 'description' + ) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml index edff2147ad14b..02593d3b541a1 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,14 +10,24 @@ * * @var $block \Magento\Catalog\Block\Category\View */ + +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput ?> <?php - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_category = $block->getCurrentCategory(); $_imgHtml = ''; if ($_imgUrl = $_category->getImageUrl()) { - $_imgHtml = '<div class="category-image"><img src="' . $_imgUrl . '" alt="' . $block->escapeHtml($_category->getName()) . '" title="' . $block->escapeHtml($_category->getName()) . '" class="image" /></div>'; + $_imgHtml = '<div class="category-image"><img src="' + . $block->escapeUrl($_imgUrl) + . '" alt="' + . $block->escapeHtmlAttr($_category->getName()) + . '" title="' + . $block->escapeHtmlAttr($_category->getName()) + . '" class="image" /></div>'; $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); - /* @escapeNotVerified */ echo $_imgHtml; + /* @noEscape */ echo $_imgHtml; } ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml index c521cf03ad156..80a9ae0a03e66 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,6 +11,6 @@ * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if (!$block->isContentMode() || $block->isMixedMode()): ?> +<?php if (!$block->isContentMode() || $block->isMixedMode()) :?> <?= $block->getProductListHtml() ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml index 774aa8d839e87..65ee7ea789e46 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Category\Rss\Link */ ?> -<?php if ($block->isRssAllowed() && $block->getLink() && $block->isTopCategory()): ?> - <a href="<?= /* @escapeNotVerified */ $block->getLink() ?>" class="action link rss"><span><?= /* @escapeNotVerified */ $block->getLabel() ?></span></a> +<?php if ($block->isRssAllowed() && $block->getLink() && $block->isTopCategory()) :?> + <a href="<?= $block->escapeUrl($block->getLink()) ?>" + class="action link rss"><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml index 2b0098be6545b..15fdd30c2d93f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <div class="widget block block-category-link"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml index 91ab70b03769f..18ffee4b5f701 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var Magento\Catalog\Block\Widget\Link $block */ ?> <?= $block->escapeHtml($block->getHref()) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml index f53c1c1ed90d7..8f3b2ae613731 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <span class="widget block block-category-link-inline"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml b/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml index 4c103b40ba28c..52bec7858a919 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml @@ -3,7 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + +/** @var $block Magento\Catalog\Block\FrontendStorageManager */ ?> <script type="text/x-magento-init"> { @@ -12,9 +13,8 @@ "components": { "storage-manager": { "component": "Magento_Catalog/js/storage-manager", - "appendTo": "<?= /* @escapeNotVerified */ $block->getParentComponentName() ?>", - "storagesConfiguration" : - <?= /* @escapeNotVerified */ $block->getConfigurationJson() ?> + "appendTo": "<?= $block->escapeJs($block->getParentComponentName()) ?>", + "storagesConfiguration" : <?= /* @noEscape */ $block->getConfigurationJson() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml b/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml index 5f44c42e17c57..f5dca566abfed 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml @@ -3,12 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + /** @var \Magento\Framework\View\Element\Template $block */ ?> -<?= $block->escapeHtml(__( - 'You added product %1 to the <a href="%2">comparison list</a>.', - $block->getData('product_name'), - $block->getData('compare_list_url')), +<?= $block->escapeHtml( + __( + 'You added product %1 to the <a href="%2">comparison list</a>.', + $block->getData('product_name'), + $block->getData('compare_list_url') + ), ['a'] ); diff --git a/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml b/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml index 01820361744e0..6d5ddb95ab178 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Category left navigation * @@ -15,25 +13,29 @@ <?php if (!$block->getCategory()) { return; } ?> -<?php $_categories = $block->getCurrentChildCategories(); ?> +<?php $_categories = $block->getCurrentChildCategories() ;?> <?php $_count = is_array($_categories) ? count($_categories) : $_categories->count(); ?> -<?php if ($_count): ?> +<?php if ($_count) :?> <div class="block filter"> <div class="title"> - <strong><?= /* @escapeNotVerified */ __('Shop By') ?></strong> + <strong><?= $block->escapeHtml(__('Shop By')) ?></strong> </div> <div class="content"> - <strong class="subtitle"><?= /* @escapeNotVerified */ __('Shopping Options') ?></strong> + <strong class="subtitle"><?= $block->escapeHtml(__('Shopping Options')) ?></strong> <dl class="options" id="narrow-by-list2"> - <dt><?= /* @escapeNotVerified */ __('Category') ?></dt> + <dt><?= $block->escapeHtml(__('Category')) ?></dt> <dd> <ol class="items"> <?php /** @var \Magento\Catalog\Model\Category $_category */ ?> - <?php foreach ($_categories as $_category): ?> - <?php if ($_category->getIsActive()): ?> + <?php foreach ($_categories as $_category) :?> + <?php if ($_category->getIsActive()) :?> <li class="item"> - <a href="<?= /* @escapeNotVerified */ $block->getCategoryUrl($_category) ?>"<?php if ($block->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?= $block->escapeHtml($_category->getName()) ?></a> - <span class="count"><?= /* @escapeNotVerified */ $_category->getProductCount() ?></span> + <a href="<?= $block->escapeUrl($block->getCategoryUrl($_category)) ?>" + <?php if ($block->isCategoryActive($_category)) :?> + class="current" + <?php endif; ?> + ><?= $block->escapeHtml($_category->getName()) ?></a> + <span class="count"><?= $block->escapeHtml($_category->getProductCount()) ?></span> </li> <?php endif; ?> <?php endforeach ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml index b8595aae9d993..05a5649135ef5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $block Magento\Framework\View\Element\Template */ ?> <li class="item link compare" data-bind="scope: 'compareProducts'" data-role="compare-products-link"> - <a class="action compare no-display" title="<?= /* @escapeNotVerified */ __('Compare Products') ?>" + <a class="action compare no-display" title="<?= $block->escapeHtmlAttr(__('Compare Products')) ?>" data-bind="attr: {'href': compareProducts().listUrl}, css: {'no-display': !compareProducts().count}" > - <?= /* @escapeNotVerified */ __('Compare Products') ?> + <?= $block->escapeHtml(__('Compare Products')) ?> <span class="counter qty" data-bind="text: compareProducts().countCaption"></span> </a> </li> <script type="text/x-magento-init"> -{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}} +{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>}} </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index 7daf049980362..55772388d44bf 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -4,14 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable PSR2.ControlStructures.SwitchDeclaration +// phpcs:disable Generic.WhiteSpace.ScopeIndent /* @var $block \Magento\Catalog\Block\Product\Compare\ListCompare */ ?> <?php $total = $block->getItems()->getSize() ?> -<?php if ($total): ?> - <a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>"> - <span><?= /* @escapeNotVerified */ __('Print This Page') ?></span> +<?php if ($total) :?> + <a href="#" class="action print hidden-print" title="<?= $block->escapeHtmlAttr(__('Print This Page')) ?>"> + <span><?= $block->escapeHtml(__('Print This Page')) ?></span> </a> <div class="table-wrapper comparison"> <table class="data table table-comparison" id="product-comparison" @@ -21,19 +23,19 @@ "selectors":{ "productAddToCartSelector":"button.action.tocart"} }}'> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('Compare Products') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('Compare Products')) ?></caption> <thead> <tr> <?php $index = 0 ?> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> - <th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> + <th scope="row" class="cell label remove"><span><?= $block->escapeHtml(__('Remove Product')) ?></span></th> <?php endif; ?> <td class="cell remove product hidden-print"> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> - <a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($item) ?>' - class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>"> - <span><?= /* @escapeNotVerified */ __('Remove Product') ?></span> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class);?> + <a href="#" data-post='<?= /* @noEscape */ $compareHelper->getPostDataRemove($item) ?>' + class="action delete" title="<?= $block->escapeHtmlAttr(__('Remove Product')) ?>"> + <span><?= $block->escapeHtml(__('Remove Product')) ?></span> </a> </td> <?php endforeach; ?> @@ -42,44 +44,54 @@ <tbody> <tr> <?php $index = 0; ?> - <?php $helper = $this->helper('Magento\Catalog\Helper\Output'); ?> + <?php $helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> <?php /** @var $item \Magento\Catalog\Model\Product */ ?> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> - <th scope="row" class="cell label product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> + <th scope="row" class="cell label product"> + <span><?= $block->escapeHtml(__('Product')) ?></span> + </th> <?php endif; ?> - <td data-th="<?= $block->escapeHtml(__('Product')) ?>" class="cell product info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> + <td data-th="<?= $block->escapeHtmlAttr(__('Product')) ?>" class="cell product info"> + <a class="product-item-photo" + href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" + title="<?= /* @noEscape */ $block->stripTags($item->getName(), null, true) ?>"> <?= $block->getImage($item, 'product_comparison_list')->toHtml() ?> </a> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> - <?= /* @escapeNotVerified */ $helper->productAttribute($item, $item->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" + title="<?= /* @noEscape */ $block->stripTags($item->getName(), null, true) ?>"> + <?= /* @noEscape */ $helper->productAttribute($item, $item->getName(), 'name') ?> </a> </strong> <?= $block->getReviewsSummaryHtml($item, 'short') ?> - <?= /* @escapeNotVerified */ $block->getProductPrice($item, '-compare-list-top') ?> + <?= /* @noEscape */ $block->getProductPrice($item, '-compare-list-top') ?> <div class="product-item-actions hidden-print"> <div class="actions-primary"> - <?php if ($item->isSaleable()): ?> - <form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($item) ?>" method="post"> + <?php if ($item->isSaleable()) :?> + <form data-role="tocart-form" + action="<?= $block->escapeUrl($this->helper(Magento\Catalog\Helper\Product\Compare::class)->getAddToCartUrl($item)) ?>" + method="post"> <?= $block->getBlockHtml('formkey') ?> <button type="submit" class="action tocart primary"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> </form> - <?php else: ?> - <?php if ($item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow()) :?> <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> - <a href="#" data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($item) ?>' class="action towishlist" data-action="add-to-wishlist"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + <a href="#" + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($item) ?>' + class="action towishlist" + data-action="add-to-wishlist"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> </div> <?php endif; ?> @@ -89,12 +101,12 @@ </tr> </tbody> <tbody> - <?php foreach ($block->getAttributes() as $attribute): ?> + <?php foreach ($block->getAttributes() as $attribute) :?> <?php $index = 0; ?> - <?php if ($block->hasAttributeValueForProducts($attribute)): ?> + <?php if ($block->hasAttributeValueForProducts($attribute)) :?> <tr> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> <th scope="row" class="cell label"> <span class="attribute label"> <?= $block->escapeHtml($attribute->getStoreLabel() ? $attribute->getStoreLabel() : __($attribute->getFrontendLabel())) ?> @@ -105,21 +117,21 @@ <div class="attribute value"> <?php switch ($attribute->getAttributeCode()) { case "price": ?> - <?php - /* @escapeNotVerified */ echo $block->getProductPrice( - $item, - '-compare-list-' . $attribute->getCode() - ) + <?= + /* @noEscape */ $block->getProductPrice( + $item, + '-compare-list-' . $attribute->getCode() + ) ?> <?php break; case "small_image": ?> <?php $block->getImage($item, 'product_small_image')->toHtml(); ?> <?php break; - default: ?> - <?php if (is_string($block->getProductAttributeValue($item, $attribute))): ?> - <?= /* @escapeNotVerified */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?> + default :?> + <?php if (is_string($block->getProductAttributeValue($item, $attribute))) :?> + <?= /* @noEscape */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?> <?php endif; ?> - <?php break; + <?php break; } ?> </div> </td> @@ -130,7 +142,7 @@ </tbody> </table> </div> - <?php if (!$block->isRedirectToCartEnabled()) : ?> + <?php if (!$block->isRedirectToCartEnabled()) :?> <script type="text/x-magento-init"> { "[data-role=tocart-form]": { @@ -139,6 +151,6 @@ } </script> <?php endif; ?> -<?php else: ?> - <div class="message info empty"><div><?= /* @escapeNotVerified */ __('You have no items to compare.') ?></div></div> +<?php else :?> + <div class="message info empty"><div><?= $block->escapeHtml(__('You have no items to compare.')) ?></div></div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml index 8daa342454445..856ab4d86dde7 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml @@ -4,12 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /* @var $block \Magento\Framework\View\Element\Template */ ?> <div class="block block-compare" data-bind="scope: 'compareProducts'" data-role="compare-products-sidebar"> <div class="block-title"> - <strong id="block-compare-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ __('Compare Products') ?></strong> + <strong id="block-compare-heading" role="heading" aria-level="2"><?= $block->escapeHtml(__('Compare Products')) ?></strong> <span class="counter qty no-display" data-bind="text: compareProducts().countCaption, css: {'no-display': !compareProducts().count}"></span> </div> <!-- ko if: compareProducts().count --> @@ -20,27 +21,30 @@ <strong class="product-item-name"> <a data-bind="attr: {href: product_url}, html: name" class="product-item-link"></a> </strong> - <a href="#" data-bind="attr: {'data-post': remove_url}" title="<?= /* @escapeNotVerified */ __('Remove This Item') ?>" class="action delete"> - <span><?= /* @escapeNotVerified */ __('Remove This Item') ?></span> + <a href="#" + data-bind="attr: {'data-post': remove_url}" + title="<?= $block->escapeHtmlAttr(__('Remove This Item')) ?>" + class="action delete"> + <span><?= $block->escapeHtml(__('Remove This Item')) ?></span> </a> </li> </ol> <div class="actions-toolbar"> <div class="primary"> - <a data-bind="attr: {'href': compareProducts().listUrl}" class="action compare primary"><span><?= /* @escapeNotVerified */ __('Compare') ?></span></a> + <a data-bind="attr: {'href': compareProducts().listUrl}" class="action compare primary"><span><?= $block->escapeHtml(__('Compare')) ?></span></a> </div> <div class="secondary"> <a id="compare-clear-all" href="#" class="action clear" data-post="<?=$block->escapeHtml( - $this->helper('Magento\Catalog\Helper\Product\Compare')->getPostDataClearList() + $this->helper(Magento\Catalog\Helper\Product\Compare::class)->getPostDataClearList() ) ?>"> - <span><?= /* @escapeNotVerified */ __('Clear All') ?></span> + <span><?= $block->escapeHtml(__('Clear All')) ?></span> </a> </div> </div> </div> <!-- /ko --> <!-- ko ifnot: compareProducts().count --> - <div class="empty"><?= /* @escapeNotVerified */ __('You have no items to compare.') ?></div> + <div class="empty"><?= $block->escapeHtml(__('You have no items to compare.')) ?></div> <!-- /ko --> </div> <script type="text/x-magento-init"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml index c7abb0525b302..e9551793c86f5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml @@ -4,39 +4,45 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Catalog\Block\Product\Gallery $block */ ?> <?php $_width = $block->getImageWidth(); ?> -<div class="product-image-popup" style="width:<?= /* @escapeNotVerified */ $_width ?>px;"> - <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @escapeNotVerified */ __('Close Window') ?></span></a></div> - <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()): ?> +<div class="product-image-popup" style="width:<?= /* @noEscape */ $_width ?>px;"> + <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= $block->escapeHtml(__('Close Window')) ?></span></a></div> + <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()) :?> <div class="nav"> - <?php if ($_prevUrl = $block->getPreviousImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_prevUrl ?>" class="prev">« <?= /* @escapeNotVerified */ __('Prev') ?></a> - <?php endif; ?> - <?php if ($_nextUrl = $block->getNextImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_nextUrl ?>" class="next"><?= /* @escapeNotVerified */ __('Next') ?> »</a> - <?php endif; ?> + <?php if ($_prevUrl = $block->getPreviousImageUrl()) :?> + <a href="<?= $block->escapeUrl($_prevUrl) ?>" class="prev">« <?= $block->escapeHtml(__('Prev')) ?></a> + <?php endif; ?> + <?php if ($_nextUrl = $block->getNextImageUrl()) :?> + <a href="<?= $block->escapeUrl($_nextUrl) ?>" class="next"><?= $block->escapeHtml(__('Next')) ?> »</a> + <?php endif; ?> </div> <?php endif; ?> - <?php if ($_imageTitle = $block->escapeHtml($block->getCurrentImage()->getLabel())): ?> - <h1 class="image-label"><?= /* @escapeNotVerified */ $_imageTitle ?></h1> + <?php if ($_imageTitle = $block->escapeHtml($block->getCurrentImage()->getLabel())) :?> + <h1 class="image-label"><?= /* @noEscape */ $_imageTitle ?></h1> <?php endif; ?> <?php - $imageUrl = $block->getImageUrl(); + $imageUrl = $block->getImageUrl(); ?> - <img src="<?= /* @escapeNotVerified */ $imageUrl ?>"<?php if ($_width): ?> width="<?= /* @escapeNotVerified */ $_width ?>"<?php endif; ?> alt="<?= $block->escapeHtml($block->getCurrentImage()->getLabel()) ?>" title="<?= $block->escapeHtml($block->getCurrentImage()->getLabel()) ?>" id="product-gallery-image" class="image" data-mage-init='{"catalogGallery":{}}'/> - <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @escapeNotVerified */ __('Close Window') ?></span></a></div> - <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()): ?> + <img src="<?= $block->escapeUrl($imageUrl) ?>" + <?php if ($_width) :?> + width="<?= /* @noEscape */ $_width ?>" + <?php endif; ?> + alt="<?= $block->escapeHtmlAttr($block->getCurrentImage()->getLabel()) ?>" + title="<?= $block->escapeHtmlAttr($block->getCurrentImage()->getLabel()) ?>" + id="product-gallery-image" + class="image" + data-mage-init='{"catalogGallery":{}}'/> + <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @noEscape */ __('Close Window') ?></span></a></div> + <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()) :?> <div class="nav"> - <?php if ($_prevUrl = $block->getPreviousImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_prevUrl ?>" class="prev">« <?= /* @escapeNotVerified */ __('Prev') ?></a> - <?php endif; ?> - <?php if ($_nextUrl = $block->getNextImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_nextUrl ?>" class="next"><?= /* @escapeNotVerified */ __('Next') ?> »</a> - <?php endif; ?> + <?php if ($_prevUrl = $block->getPreviousImageUrl()) :?> + <a href="<?= $block->escapeUrl($_prevUrl) ?>" class="prev">« <?= $block->escapeHtml(__('Prev')) ?></a> + <?php endif; ?> + <?php if ($_nextUrl = $block->getNextImageUrl()) :?> + <a href="<?= $block->escapeUrl($_nextUrl) ?>" class="next"><?= $block->escapeHtml(__('Next')) ?> »</a> + <?php endif; ?> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml index 94b829eb92137..5a1b102ff6362 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml @@ -7,8 +7,8 @@ <?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> <img class="photo image" - <?= /* @escapeNotVerified */ $block->getCustomAttributes() ?> - src="<?= /* @escapeNotVerified */ $block->getImageUrl() ?>" - width="<?= /* @escapeNotVerified */ $block->getWidth() ?>" - height="<?= /* @escapeNotVerified */ $block->getHeight() ?>" - alt="<?= /* @escapeNotVerified */ $block->stripTags($block->getLabel(), null, true) ?>" /> + <?= $block->escapeHtml($block->getCustomAttributes()) ?> + src="<?= $block->escapeUrl($block->getImageUrl()) ?>" + width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" + height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>" /> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml index 8a907bd54aa6a..33f7620f1a1f5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml @@ -7,13 +7,13 @@ <?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> <span class="product-image-container" - style="width:<?= /* @escapeNotVerified */ $block->getWidth() ?>px;"> + style="width:<?= $block->escapeHtmlAttr($block->getWidth()) ?>px;"> <span class="product-image-wrapper" - style="padding-bottom: <?= /* @escapeNotVerified */ ($block->getRatio() * 100) ?>%;"> - <img class="<?= /* @escapeNotVerified */ $block->getClass() ?>" - <?= /* @escapeNotVerified */ $block->getCustomAttributes() ?> - src="<?= /* @escapeNotVerified */ $block->getImageUrl() ?>" - max-width="<?= /* @escapeNotVerified */ $block->getWidth() ?>" - max-height="<?= /* @escapeNotVerified */ $block->getHeight() ?>" - alt="<?= /* @escapeNotVerified */ $block->stripTags($block->getLabel(), null, true) ?>"/></span> + style="padding-bottom: <?= ($block->getRatio() * 100) ?>%;"> + <img class="<?= $block->escapeHtmlAttr($block->getClass()) ?>" + <?= $block->escapeHtmlAttr($block->getCustomAttributes()) ?> + src="<?= $block->escapeUrl($block->getImageUrl()) ?>" + max-width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" + max-height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>"/></span> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index e970ade6cee96..38d6f0d7bf057 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -5,10 +5,10 @@ */ use Magento\Framework\App\Action\Action; -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * Product list template * @@ -17,11 +17,11 @@ use Magento\Framework\App\Action\Action; ?> <?php $_productCollection = $block->getLoadedProductCollection(); -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> -<?php if (!$_productCollection->count()): ?> - <div class="message info empty"><div><?= /* @escapeNotVerified */ __('We can\'t find products matching the selection.') ?></div></div> -<?php else: ?> +<?php if (!$_productCollection->count()) :?> + <div class="message info empty"><div><?= $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></div></div> +<?php else :?> <?= $block->getToolbarHtml() ?> <?= $block->getAdditionalHtml() ?> <?php @@ -41,12 +41,12 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); */ $pos = $block->getPositioned(); ?> - <div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?> products-<?= /* @escapeNotVerified */ $viewMode ?>"> + <div class="products wrapper <?= /* @noEscape */ $viewMode ?> products-<?= /* @noEscape */ $viewMode ?>"> <ol class="products list items product-items"> <?php /** @var $_product \Magento\Catalog\Model\Product */ ?> - <?php foreach ($_productCollection as $_product): ?> + <?php foreach ($_productCollection as $_product) :?> <li class="item product product-item"> - <div class="product-item-info" data-container="product-<?= /* @escapeNotVerified */ $viewMode ?>"> + <div class="product-item-info" data-container="product-<?= /* @noEscape */ $viewMode ?>"> <?php $productImage = $block->getImage($_product, $imageDisplayArea); if ($pos != null) { @@ -55,7 +55,9 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); } ?> <?php // Product Image ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1"> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + class="product photo product-item-photo" + tabindex="-1"> <?= $productImage->toHtml() ?> </a> <div class="product details product-item-details"> @@ -64,48 +66,55 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> <strong class="product name product-item-name"> <a class="product-item-link" - href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?> + href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"> + <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> <?= $block->getReviewsSummaryHtml($_product, $templateType) ?> - <?= /* @escapeNotVerified */ $block->getProductPrice($_product) ?> + <?= /* @noEscape */ $block->getProductPrice($_product) ?> <?= $block->getProductDetailsHtml($_product) ?> <div class="product-item-inner"> - <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $position : '' ?>> - <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>> - <?php if ($_product->isSaleable()): ?> + <div class="product actions product-item-actions"<?= /* @noEscape */ strpos($pos, $viewMode . '-actions') ? $position : '' ?>> + <div class="actions-primary"<?= /* @noEscape */ strpos($pos, $viewMode . '-primary') ? $position : '' ?>> + <?php if ($_product->isSaleable()) :?> <?php $postParams = $block->getAddToCartPostParams($_product); ?> - <form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post"> - <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $postParams['data']['product'] ?>"> - <input type="hidden" name="<?= /* @escapeNotVerified */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @escapeNotVerified */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>"> + <form data-role="tocart-form" + data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" + action="<?= $block->escapeUrl($postParams['action']) ?>" + method="post"> + <input type="hidden" + name="product" + value="<?= /* @noEscape */ $postParams['data']['product'] ?>"> + <input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?>" + value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>"> <?= $block->getBlockHtml('formkey') ?> <button type="submit" - title="<?= $block->escapeHtml(__('Add to Cart')) ?>" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> </form> - <?php else: ?> - <?php if ($_product->isAvailable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_product->isAvailable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> - <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>> - <?php if ($addToBlock = $block->getChildBlock('addto')): ?> + <div data-role="add-to-links" class="actions-secondary"<?= /* @noEscape */ strpos($pos, $viewMode . '-secondary') ? $position : '' ?>> + <?php if ($addToBlock = $block->getChildBlock('addto')) :?> <?= $addToBlock->setProduct($_product)->getChildHtml() ?> <?php endif; ?> </div> </div> - <?php if ($showDescription):?> + <?php if ($showDescription) :?> <div class="product description product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" title="<?= /* @escapeNotVerified */ $_productNameStripped ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $_productNameStripped ?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> @@ -116,12 +125,12 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); </ol> </div> <?= $block->getToolbarHtml() ?> - <?php if (!$block->isRedirectToCartEnabled()) : ?> + <?php if (!$block->isRedirectToCartEnabled()) :?> <script type="text/x-magento-init"> { "[data-role=tocart-form], .form.map.checkout": { "catalogAddToCart": { - "product_sku": "<?= /* @NoEscape */ $_product->getSku() ?>" + "product_sku": "<?= /* @noEscape */ $_product->getSku() ?>" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml index 8798170e8c0b0..c23ee021ca3a8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml @@ -4,14 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var $block Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare */ ?> <a href="#" class="action tocompare" title="<?= $block->escapeHtml(__('Add to Compare')) ?>" aria-label="<?= $block->escapeHtml(__('Add to Compare')) ?>" - data-post='<?= /* @escapeNotVerified */ $block->getCompareHelper()->getPostDataParams($block->getProduct()) ?>' + data-post='<?= /* @noEscape */ $block->getCompareHelper()->getPostDataParams($block->getProduct()) ?>' role="button"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index ecc9700802d27..321771eeb4b5f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -4,7 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect /* @var $block \Magento\Catalog\Block\Product\AbstractProduct */ ?> @@ -29,7 +30,7 @@ switch ($type = $block->getType()) { $templateType = null; $description = false; } - break; + break; case 'related': /** @var \Magento\Catalog\Block\Product\ProductList\Related $block */ @@ -49,7 +50,7 @@ switch ($type = $block->getType()) { $templateType = null; $description = false; } - break; + break; case 'upsell-rule': if ($exist = $block->hasItems()) { @@ -68,7 +69,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'upsell': /** @var \Magento\Catalog\Block\Product\ProductList\Upsell $block */ @@ -88,7 +89,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'crosssell-rule': /** @var \Magento\Catalog\Block\Product\ProductList\Crosssell $block */ @@ -106,7 +107,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'crosssell': /** @var \Magento\Catalog\Block\Product\ProductList\Crosssell $block */ @@ -124,7 +125,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'new': if ($exist = $block->getProductCollection()) { @@ -144,117 +145,117 @@ switch ($type = $block->getType()) { $description = ($mode == 'list') ? true : false; $canItemsAddToCart = false; } - break; + break; default: $exist = null; } ?> -<?php if ($exist):?> +<?php if ($exist) :?> - <?php if ($type == 'related' || $type == 'upsell'): ?> - <?php if ($type == 'related'): ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= /* @escapeNotVerified */ $limit ?>" data-shuffle="<?= /* @escapeNotVerified */ $shuffle ?>"> - <?php else: ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= /* @escapeNotVerified */ $limit ?>" data-shuffle="<?= /* @escapeNotVerified */ $shuffle ?>"> +<?php if ($type == 'related' || $type == 'upsell') :?> +<?php if ($type == 'related') :?> +<div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> + <?php else :?> + <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> <?php endif; ?> - <?php else: ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>"> - <?php endif; ?> - <div class="block-title title"> - <strong id="block-<?= /* @escapeNotVerified */ $class ?>-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> - </div> - <div class="block-content content" aria-labelledby="block-<?= /* @escapeNotVerified */ $class ?>-heading"> - <?php if ($type == 'related' && $canItemsAddToCart): ?> - <div class="block-actions"> - <?= /* @escapeNotVerified */ __('Check items to add to the cart or') ?> - <button type="button" class="action select" role="button"><span><?= /* @escapeNotVerified */ __('select all') ?></span></button> - </div> - <?php endif; ?> - <div class="products wrapper grid products-grid products-<?= /* @escapeNotVerified */ $type ?>"> - <ol class="products list items product-items"> - <?php foreach ($items as $_item): ?> - <?php $available = ''; ?> - <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> - <?php if (!$_item->getRequiredOptions()): ?> - <?php $available = 'related-available'; ?> - <?php endif; ?> - <?php endif; ?> - <?php if ($type == 'related' || $type == 'upsell'): ?> - <li class="item product product-item" style="display: none;"> - <?php else: ?> - <li class="item product product-item"> + <?php else :?> + <div class="block <?= $block->escapeHtmlAttr($class) ?>"> + <?php endif; ?> + <div class="block-title title"> + <strong id="block-<?= $block->escapeHtmlAttr($class) ?>-heading" role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> + </div> + <div class="block-content content" aria-labelledby="block-<?= $block->escapeHtmlAttr($class) ?>-heading"> + <?php if ($type == 'related' && $canItemsAddToCart) :?> + <div class="block-actions"> + <?= $block->escapeHtml(__('Check items to add to the cart or')) ?> + <button type="button" class="action select" role="button"><span><?= $block->escapeHtml(__('select all')) ?></span></button> + </div> <?php endif; ?> - <div class="product-item-info <?= /* @escapeNotVerified */ $available ?>"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product photo product-item-photo"> - <?= $block->getImage($_item, $image)->toHtml() ?> - </a> - <div class="product details product-item-details"> - <strong class="product name product-item-name"><a class="product-item-link" title="<?= $block->escapeHtml($_item->getName()) ?>" href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>"> - <?= $block->escapeHtml($_item->getName()) ?></a> - </strong> - - <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?> - - <?php if ($templateType): ?> - <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> - <?php endif; ?> - - <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> - <?php if (!$_item->getRequiredOptions()): ?> - <div class="field choice related"> - <input type="checkbox" class="checkbox related" id="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>" name="related_products[]" value="<?= /* @escapeNotVerified */ $_item->getId() ?>" /> - <label class="label" for="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>"><span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span></label> - </div> + <div class="products wrapper grid products-grid products-<?= $block->escapeHtmlAttr($type) ?>"> + <ol class="products list items product-items"> + <?php foreach ($items as $_item) :?> + <?php $available = ''; ?> + <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> + <?php if (!$_item->getRequiredOptions()) :?> + <?php $available = 'related-available'; ?> <?php endif; ?> <?php endif; ?> + <?php if ($type == 'related' || $type == 'upsell') :?> + <li class="item product product-item" style="display: none;"> + <?php else :?> + <li class="item product product-item"> + <?php endif; ?> + <div class="product-item-info <?= /* @noEscape */ $available ?>"> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product photo product-item-photo"> + <?= $block->getImage($_item, $image)->toHtml() ?> + </a> + <div class="product details product-item-details"> + <strong class="product name product-item-name"><a class="product-item-link" title="<?= $block->escapeHtml($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"> + <?= $block->escapeHtml($_item->getName()) ?></a> + </strong> + + <?= /* @noEscape */ $block->getProductPrice($_item) ?> + + <?php if ($templateType) :?> + <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> + <?php endif; ?> - <?php if ($showAddTo || $showCart): ?> - <div class="product actions product-item-actions"> - <?php if ($showCart): ?> - <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> - <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> - </button> - <?php else: ?> - <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> - </button> - <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> - <?php endif; ?> - <?php endif; ?> - </div> + <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> + <?php if (!$_item->getRequiredOptions()) :?> + <div class="field choice related"> + <input type="checkbox" class="checkbox related" id="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>" name="related_products[]" value="<?= $block->escapeHtmlAttr($_item->getId()) ?>" /> + <label class="label" for="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>"><span><?= $block->escapeHtml(__('Add to Cart')) ?></span></label> + </div> + <?php endif; ?> <?php endif; ?> - <?php if ($showAddTo): ?> - <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> - <?php if ($addToBlock = $block->getChildBlock('addto')): ?> - <?= $addToBlock->setProduct($_item)->getChildHtml() ?> + <?php if ($showAddTo || $showCart) :?> + <div class="product actions product-item-actions"> + <?php if ($showCart) :?> + <div class="actions-primary"> + <?php if ($_item->isSaleable()) :?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) :?> + <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> + </button> + <?php else :?> + <?php $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_item)), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart primary" + data-post='<?= /* @noEscape */ $postData ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> + </button> + <?php endif; ?> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> + <?php endif; ?> + <?php endif; ?> + </div> + <?php endif; ?> + + <?php if ($showAddTo) :?> + <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> + <?php if ($addToBlock = $block->getChildBlock('addto')) :?> + <?= $addToBlock->setProduct($_item)->getChildHtml() ?> + <?php endif; ?> + </div> <?php endif; ?> </div> <?php endif; ?> </div> - <?php endif; ?> - </div> - </div> - </li> - <?php endforeach ?> - </ol> + </div> + </li> + <?php endforeach ?> + </ol> + </div> + </div> </div> - </div> -</div> -<?php endif;?> + <?php endif;?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml index 02a6e999ad51f..b2ae8b9f7ab13 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,11 +10,13 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; + +// phpcs:disable Magento2.Security.IncludeFile.FoundIncludeFile +// phpcs:disable PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket ?> -<?php if ($block->getCollection()->getSize()): ?> - <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'> - <?php if ($block->isExpanded()): ?> +<?php if ($block->getCollection()->getSize()) :?> + <div class="toolbar toolbar-products" data-mage-init='<?= /* @noEscape */ $block->getWidgetOptionsJson() ?>'> + <?php if ($block->isExpanded()) :?> <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?> <?php endif; ?> @@ -27,7 +26,7 @@ use Magento\Catalog\Model\Product\ProductList\Toolbar; <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?> - <?php if ($block->isExpanded()): ?> + <?php if ($block->isExpanded()) :?> <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml index b4ff1afa1c606..a8f504d6a4f17 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,19 +10,27 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <p class="toolbar-amount" id="toolbar-amount"> - <?php if ($block->getLastPageNum() > 1): ?> - <?php /* @escapeNotVerified */ echo __('Items %1-%2 of %3', - '<span class="toolbar-number">' . $block->getFirstNum() . '</span>', - '<span class="toolbar-number">' . $block->getLastNum() . '</span>', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> - <?php elseif ($block->getTotalNum() == 1): ?> - <?php /* @escapeNotVerified */ echo __('%1 Item', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> - <?php else: ?> - <?php /* @escapeNotVerified */ echo __('%1 Items', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> + <?php if ($block->getLastPageNum() > 1) :?> + <?= $block->escapeHtml( + __( + 'Items %1-%2 of %3', + '<span class="toolbar-number">' . $block->getFirstNum() . '</span>', + '<span class="toolbar-number">' . $block->getLastNum() . '</span>', + '<span class="toolbar-number">' . $block->getTotalNum() . '</span>' + ), + ['span'] + ) ?> + <?php elseif ($block->getTotalNum() == 1) :?> + <?= $block->escapeHtml( + __('%1 Item', '<span class="toolbar-number">' . $block->getTotalNum() . '</span>'), + ['span'] + ) ?> + <?php else :?> + <?= $block->escapeHtml( + __('%1 Items', '<span class="toolbar-number">' . $block->getTotalNum() . '</span>'), + ['span'] + ) ?> <?php endif; ?> </p> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml index ec4541bde5ca6..4ded219748c64 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,21 +10,22 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <div class="field limiter"> <label class="label" for="limiter"> - <span><?= /* @escapeNotVerified */ __('Show') ?></span> + <span><?= $block->escapeHtml(__('Show')) ?></span> </label> <div class="control"> <select id="limiter" data-role="limiter" class="limiter-options"> - <?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?> - <option value="<?= /* @escapeNotVerified */ $_key ?>"<?php if ($block->isLimitCurrent($_key)): ?> - selected="selected"<?php endif ?>> - <?= /* @escapeNotVerified */ $_limit ?> + <?php foreach ($block->getAvailableLimit() as $_key => $_limit) :?> + <option value="<?= $block->escapeHtmlAttr($_key) ?>" + <?php if ($block->isLimitCurrent($_key)) :?> + selected="selected" + <?php endif ?>> + <?= $block->escapeHtml($_limit) ?> </option> <?php endforeach; ?> </select> </div> - <span class="limiter-text"><?= /* @escapeNotVerified */ __('per page') ?></span> + <span class="limiter-text"><?= $block->escapeHtml(__('per page')) ?></span> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml index 92514c5b8ea50..58dde199998bc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,14 +10,13 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <div class="toolbar-sorter sorter"> - <label class="sorter-label" for="sorter"><?= /* @escapeNotVerified */ __('Sort By') ?></label> + <label class="sorter-label" for="sorter"><?= $block->escapeHtml(__('Sort By')) ?></label> <select id="sorter" data-role="sorter" class="sorter-options"> - <?php foreach ($block->getAvailableOrders() as $_key => $_order): ?> - <option value="<?= /* @escapeNotVerified */ $_key ?>" - <?php if ($block->isOrderCurrent($_key)): ?> + <?php foreach ($block->getAvailableOrders() as $_key => $_order) :?> + <option value="<?= $block->escapeHtmlAttr($_key) ?>" + <?php if ($block->isOrderCurrent($_key)) :?> selected="selected" <?php endif; ?> > @@ -28,13 +24,21 @@ use Magento\Catalog\Model\Product\ProductList\Toolbar; </option> <?php endforeach; ?> </select> - <?php if ($block->getCurrentDirection() == 'desc'): ?> - <a title="<?= /* @escapeNotVerified */ __('Set Ascending Direction') ?>" href="#" class="action sorter-action sort-desc" data-role="direction-switcher" data-value="asc"> - <span><?= /* @escapeNotVerified */ __('Set Ascending Direction') ?></span> + <?php if ($block->getCurrentDirection() == 'desc') :?> + <a title="<?= $block->escapeHtmlAttr(__('Set Ascending Direction')) ?>" + href="#" + class="action sorter-action sort-desc" + data-role="direction-switcher" + data-value="asc"> + <span><?= $block->escapeHtml(__('Set Ascending Direction')) ?></span> </a> - <?php else: ?> - <a title="<?= /* @escapeNotVerified */ __('Set Descending Direction') ?>" href="#" class="action sorter-action sort-asc" data-role="direction-switcher" data-value="desc"> - <span><?= /* @escapeNotVerified */ __('Set Descending Direction') ?></span> + <?php else :?> + <a title="<?= $block->escapeHtmlAttr(__('Set Descending Direction')) ?>" + href="#" + class="action sorter-action sort-asc" + data-role="direction-switcher" + data-value="desc"> + <span><?= $block->escapeHtml(__('Set Descending Direction')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml index 366dfba71b0d1..955897f315d6f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,32 +10,31 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> -<?php if ($block->isEnabledViewSwitcher()): ?> -<div class="modes"> - <?php $_modes = $block->getModes(); ?> - <?php if ($_modes && count($_modes) > 1): ?> - <strong class="modes-label" id="modes-label"><?= /* @escapeNotVerified */ __('View as') ?></strong> - <?php foreach ($block->getModes() as $_code => $_label): ?> - <?php if ($block->isModeActive($_code)): ?> - <strong title="<?= /* @escapeNotVerified */ $_label ?>" - class="modes-mode active mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - data-value="<?= /* @escapeNotVerified */ strtolower($_code) ?>"> - <span><?= /* @escapeNotVerified */ $_label ?></span> - </strong> - <?php else: ?> - <a class="modes-mode mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - title="<?= /* @escapeNotVerified */ $_label ?>" - href="#" - data-role="mode-switcher" - data-value="<?= /* @escapeNotVerified */ strtolower($_code) ?>" - id="mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - aria-labelledby="modes-label mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>"> - <span><?= /* @escapeNotVerified */ $_label ?></span> - </a> - <?php endif; ?> - <?php endforeach; ?> - <?php endif; ?> -</div> +<?php if ($block->isEnabledViewSwitcher()) :?> + <div class="modes"> + <?php $_modes = $block->getModes(); ?> + <?php if ($_modes && count($_modes) > 1) :?> + <strong class="modes-label" id="modes-label"><?= $block->escapeHtml(__('View as')) ?></strong> + <?php foreach ($block->getModes() as $_code => $_label) :?> + <?php if ($block->isModeActive($_code)) :?> + <strong title="<?= $block->escapeHtmlAttr($_label) ?>" + class="modes-mode active mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"> + <span><?= $block->escapeHtml($_label) ?></span> + </strong> + <?php else :?> + <a class="modes-mode mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + title="<?= $block->escapeHtmlAttr($_label) ?>" + href="#" + data-role="mode-switcher" + data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + id="mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + aria-labelledby="modes-label mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"> + <span><?= $block->escapeHtml($_label) ?></span> + </a> + <?php endif; ?> + <?php endforeach; ?> + <?php endif; ?> + </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml index f2d5e40cca4e5..cc6c9d3c579f7 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml @@ -3,28 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput + /** * Product list template * - * @see \Magento\Catalog\Block\Product\ListProduct + * @var $block \Magento\Catalog\Block\Product\ListProduct */ ?> <?php $start = microtime(true); $_productCollection = $block->getLoadedProductCollection(); -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> -<?php if (!$_productCollection->count()): ?> -<p class="message note"><?= /* @escapeNotVerified */ __('We can\'t find products matching the selection.') ?></p> -<?php else: ?> -<?= $block->getToolbarHtml() ?> -<?= $block->getAdditionalHtml() ?> -<?php +<?php if (!$_productCollection->count()) :?> + <p class="message note"><?= $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></p> +<?php else :?> + <?= $block->getToolbarHtml() ?> + <?= $block->getAdditionalHtml() ?> + <?php if ($block->getMode() == 'grid') { $viewMode = 'grid'; $image = 'category_page_grid'; @@ -36,65 +37,65 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); $showDescription = true; $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW; } -?> -<div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?>"> - <ol class="products list items"> - <?php foreach ($_productCollection as $_product): ?> - <li class="item product"> - <div class="product"> - <?php // Product Image ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo"> - <?= $block->getImage($_product, $image)->toHtml() ?> - </a> - <div class="product details"> - <?php + ?> + <div class="products wrapper <?= /* @noEscape */ $viewMode ?>"> + <ol class="products list items"> + <?php foreach ($_productCollection as $_product) :?> + <li class="item product"> + <div class="product"> + <?php // Product Image ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product photo"> + <?= $block->getImage($_product, $image)->toHtml() ?> + </a> + <div class="product details"> + <?php - $info = []; - $info['name'] = '<strong class="product name">' - . ' <a href="' . $_product->getProductUrl() . '" title="' - . $block->stripTags($_product->getName(), null, true) . '">' - . $_helper->productAttribute($_product, $_product->getName(), 'name') - . '</a></strong>'; - $info['price'] = $block->getProductPrice($_product); - $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); + $info = []; + $info['name'] = '<strong class="product name">' + . ' <a href="' . $block->escapeUrl($_product->getProductUrl()) . '" title="' + . $block->stripTags($_product->getName(), null, true) . '">' + . $_helper->productAttribute($_product, $_product->getName(), 'name') + . '</a></strong>'; + $info['price'] = $block->getProductPrice($_product); + $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); - if ($_product->isSaleable()) { - $info['button'] = '<button type="button" title="' . __('Add to Cart') . '" class="action tocart"' - . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->getAddToCartUrl($_product) . '"} }\'>' - . '<span>' . __('Add to Cart') . '</span></button>'; - } else { - $info['button'] = $_product->getIsSalable() ? '<div class="stock available"><span>' . __('In stock') . '</span></div>' : - '<div class="stock unavailable"><span>' . __('Out of stock') . '</span></div>'; - } + if ($_product->isSaleable()) { + $info['button'] = '<button type="button" title="' . $block->escapeHtmlAttr(__('Add to Cart')) . '" class="action tocart"' + . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_product))) . '"} }\'>' + . '<span>' . $block->escapeHtml(__('Add to Cart')) . '</span></button>'; + } else { + $info['button'] = $_product->getIsSalable() ? '<div class="stock available"><span>' . $block->escapeHtml(__('In stock')) . '</span></div>' : + '<div class="stock unavailable"><span>' . $block->escapeHtml(__('Out of stock')) . '</span></div>'; + } - $info['links'] = '<div class="product links" data-role="add-to-links">' - . '<a href="#" data-post=\'' . $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) . '\' class="action towishlist" data-action="add-to-wishlist">' - . '<span>' . __('Add to Wish List') . '</span></a>' - . '<a href="' . $block->getAddToCompareUrl($_product) . '" class="action tocompare">' - . '<span>' . __('Add to Compare') . '</span></a></div>'; - $info['actions'] = '<div class="product action">' . $info['button'] . $info['links'] . '</div>'; + $info['links'] = '<div class="product links" data-role="add-to-links">' + . '<a href="#" data-post=\'' . $this->helper(Magento\Wishlist\Helper\Data::class)->getAddParams($_product) . '\' class="action towishlist" data-action="add-to-wishlist">' + . '<span>' . $block->escapeHtml(__('Add to Wish List')) . '</span></a>' + . '<a href="' . $block->escapeUrl($block->getAddToCompareUrl($_product)) . '" class="action tocompare">' + . '<span>' . $block->escapeHtml(__('Add to Compare')) . '</span></a></div>'; + $info['actions'] = '<div class="product action">' . $info['button'] . $info['links'] . '</div>'; - if ($showDescription) { - $info['description'] = '<div class="product description">' - . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') - . ' <a href="' . $_product->getProductUrl() . '" class="action more">' - . __('Learn More') . '</a></div>'; - } else { - $info['description'] = ''; - } + if ($showDescription) { + $info['description'] = '<div class="product description">' + . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') + . ' <a href="' . $block->escapeUrl($_product->getProductUrl()) . '" class="action more">' + . $block->escapeHtml(__('Learn More')) . '</a></div>'; + } else { + $info['description'] = ''; + } - $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; - foreach ($details as $detail) { - /* @escapeNotVerified */ echo $info[$detail]; - } - ?> + $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; + foreach ($details as $detail) { + /* @noEscape */ echo $info[$detail]; + } + ?> + </div> </div> - </div> - </li> - <?php endforeach; ?> - </ol> -</div> -<?= $block->getToolbarHtml() ?> + </li> + <?php endforeach; ?> + </ol> + </div> + <?= $block->getToolbarHtml() ?> <?php endif; ?> -<?= /* @escapeNotVerified */ $time_taken = microtime(true) - $start ?> +<?= $time_taken = microtime(true) - $start ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml index 2d89e24cc7aac..316fdb06592e2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml @@ -4,9 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Product\View\Additional */ ?> -<?php foreach ($block->getChildHtmlList() as $_html): ?> - <?= /* @escapeNotVerified */ $_html ?> +<?php foreach ($block->getChildHtmlList() as $_html) :?> + <?= /* @noEscape */ $_html ?> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml index 0893cfab0bbf8..1924175764555 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View*/ ?> <div class="product-addto-links" data-role="add-to-links"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml index 194a472d81d58..9183e65181c48 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View\Addto\Compare */ ?> <?php $viewModel = $block->getData('addToCompareViewModel'); ?> -<?php if ($viewModel->isAvailableForCompare($block->getProduct())): ?> -<a href="#" data-post='<?= /* @escapeNotVerified */ $block->getPostDataParams() ?>' +<?php if ($viewModel->isAvailableForCompare($block->getProduct())) :?> +<a href="#" data-post='<?= /* @noEscape */ $block->getPostDataParams() ?>' data-role="add-to-links" - class="action tocompare"><span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span></a> + class="action tocompare"><span><?= $block->escapeHtml(__('Add to Compare')) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml index 71452a2d65e97..60fcc8c2c167a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml @@ -4,37 +4,35 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php $buttonTitle = __('Add to Cart'); ?> -<?php if ($_product->isSaleable()): ?> +<?php if ($_product->isSaleable()) :?> <div class="box-tocart"> <div class="fieldset"> - <?php if ($block->shouldRenderQuantity()): ?> + <?php if ($block->shouldRenderQuantity()) :?> <div class="field qty"> - <label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label> + <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label> <div class="control"> <input type="number" name="qty" id="qty" min="0" - value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>" - title="<?= /* @escapeNotVerified */ __('Qty') ?>" + value="<?= $block->getProductDefaultQty() * 1 ?>" + title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="input-text qty" - data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" + data-validate="<?= /* @noEscape */ json_encode($block->getQuantityValidators()) ?>" /> </div> </div> <?php endif; ?> <div class="actions"> <button type="submit" - title="<?= /* @escapeNotVerified */ $buttonTitle ?>" + title="<?= $block->escapeHtmlAttr($buttonTitle) ?>" class="action primary tocart" id="product-addtocart-button" disabled> - <span><?= /* @escapeNotVerified */ $buttonTitle ?></span> + <span><?= $block->escapeHtml($buttonTitle) ?></span> </button> <?= $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml index 86f97cf6f6aaf..6077fa8f8cabf 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product view template * - * @see \Magento\Catalog\Block\Product\View\Description + * @var $block \Magento\Catalog\Block\Product\View\Description */ ?> <?php -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_product = $block->getProduct(); $_call = $block->getAtCall(); $_code = $block->getAtCode(); @@ -32,15 +32,19 @@ if ($_attributeLabel && $_attributeLabel == 'default') { $_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel(); } if ($_attributeType && $_attributeType == 'text') { - $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : ''; + $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) + ? $_product->getAttributeText($_code) + : ''; } else { $_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code); } ?> -<?php if ($_attributeValue): ?> -<div class="product attribute <?= /* @escapeNotVerified */ $_className ?>"> - <?php if ($renderLabel): ?><strong class="type"><?= /* @escapeNotVerified */ $_attributeLabel ?></strong><?php endif; ?> - <div class="value" <?= /* @escapeNotVerified */ $_attributeAddAttribute ?>><?= /* @escapeNotVerified */ $_attributeValue ?></div> +<?php if ($_attributeValue) :?> +<div class="product attribute <?= $block->escapeHtmlAttr($_className) ?>"> + <?php if ($renderLabel) :?> + <strong class="type"><?= $block->escapeHtml($_attributeLabel) ?></strong> + <?php endif; ?> + <div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>><?= $block->escapeHtmlAttr($_attributeValue) ?></div> </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml index 1c4a37fedebe3..a4f0fb3efab9e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product additional attributes template @@ -13,18 +13,18 @@ */ ?> <?php - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_product = $block->getProduct(); ?> -<?php if ($_additional = $block->getAdditionalData()): ?> +<?php if ($_additional = $block->getAdditionalData()) :?> <div class="additional-attributes-wrapper table-wrapper"> <table class="data table additional-attributes" id="product-attribute-specs-table"> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('More Information') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('More Information')) ?></caption> <tbody> - <?php foreach ($_additional as $_data): ?> + <?php foreach ($_additional as $_data) :?> <tr> <th class="col label" scope="row"><?= $block->escapeHtml($_data['label']) ?></th> - <td class="col data" data-th="<?= $block->escapeHtml($_data['label']) ?>"><?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> + <td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> </tr> <?php endforeach; ?> </tbody> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml index 4414214f99a6e..a4aa675b2c346 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml @@ -13,7 +13,7 @@ { "*": { "Magento_Catalog/js/product/view/provider": { - "data": <?= /* @escapeNotVerified */ $block->getCurrentProductData() ?> + "data": <?= /* @noEscape */ $block->getCurrentProductData() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml index b5cdd1a2a31ba..c08c4d771b34a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product description template @@ -12,4 +12,8 @@ * @var $block \Magento\Catalog\Block\Product\View\Description */ ?> -<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?> +<?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute( + $block->getProduct(), + $block->getProduct()->getDescription(), + 'description' +) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml index 57eabbf1d8c8a..d25b19ee217f0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml @@ -4,36 +4,34 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Catalog\Block\Product\View\Details $block */ ?> -<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')):?> +<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')) :?> <div class="product info detailed"> <?php $layout = $block->getLayout(); ?> <div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'> - <?php foreach ($detailedInfoGroup as $name):?> + <?php foreach ($detailedInfoGroup as $name) :?> <?php - $html = $layout->renderElement($name); - if (!trim($html)) { - continue; - } - $alias = $layout->getElementAlias($name); - $label = $block->getChildData($alias, 'title'); + $html = $layout->renderElement($name); + if (!trim($html)) { + continue; + } + $alias = $layout->getElementAlias($name); + $label = $block->getChildData($alias, 'title'); ?> <div class="data item title" - data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>"> + data-role="collapsible" id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>"> <a class="data switch" tabindex="-1" data-toggle="trigger" - href="#<?= /* @escapeNotVerified */ $alias ?>" - id="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"> - <?= /* @escapeNotVerified */ $label ?> + href="#<?= $block->escapeUrl($alias) ?>" + id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title"> + <?= $block->escapeHtml($label) ?> </a> </div> - <div class="data item content" - aria-labelledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title" id="<?= /* @escapeNotVerified */ $alias ?>" data-role="content"> - <?= /* @escapeNotVerified */ $html ?> + <div class="data item content" + aria-labelledby="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title" id="<?= $block->escapeHtmlAttr($alias) ?>" data-role="content"> + <?= /* @noEscape */ $html ?> </div> <?php endforeach;?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml index 9c5cce7865532..0b1a2c4d6a6dc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product view template @@ -12,28 +12,28 @@ * @var $block \Magento\Catalog\Block\Product\View */ ?> -<?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> +<?php $_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> <?php $_product = $block->getProduct(); ?> <div class="product-add-form"> <form data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" - action="<?= /* @NoEscape */ $block->getSubmitUrl($_product) ?>" method="post" - id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> - <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $_product->getId() ?>" /> + action="<?= $block->escapeJs($block->escapeUrl($block->getSubmitUrl($_product))) ?>" method="post" + id="product_addtocart_form"<?php if ($_product->getOptions()) :?> enctype="multipart/form-data"<?php endif; ?>> + <input type="hidden" name="product" value="<?= (int)$_product->getId() ?>" /> <input type="hidden" name="selected_configurable_option" value="" /> <input type="hidden" name="related_product" id="related-products-field" value="" /> - <input type="hidden" name="item" value="<?= /* @noEscape */ $block->getRequest()->getParam('id') ?>" /> + <input type="hidden" name="item" value="<?= $block->escapeHtmlAttr($block->getRequest()->getParam('id')) ?>" /> <?= $block->getBlockHtml('formkey') ?> <?= $block->getChildHtml('form_top') ?> - <?php if (!$block->hasOptions()):?> + <?php if (!$block->hasOptions()) :?> <?= $block->getChildHtml('product_info_form_content') ?> - <?php else:?> - <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?> + <?php else :?> + <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1') :?> <?= $block->getChildChildHtml('options_container') ?> <?php endif;?> <?php endif; ?> - <?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'):?> + <?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2') :?> <?= $block->getChildChildHtml('options_container') ?> <?php endif;?> <?= $block->getChildHtml('form_bottom') ?> @@ -52,6 +52,6 @@ return !$(elem).find('.price-from').length; }); - priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>}); + priceBoxes.priceBox({'priceConfig': <?= /* @noEscape */ $block->getJsonConfig() ?>}); }); </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml index 1f06b90758d0b..4b33864aef47a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Product media data template * @@ -14,19 +12,19 @@ ?> <?php - $images = $block->getGalleryImages()->getItems(); - $mainImage = current(array_filter($images, function ($img) use ($block) { - return $block->isMainImage($img); - })); +$images = $block->getGalleryImages()->getItems(); +$mainImage = current(array_filter($images, function ($img) use ($block) { + return $block->isMainImage($img); +})); - if (!empty($images) && empty($mainImage)) { - $mainImage = $block->getGalleryImages()->getFirstItem(); - } +if (!empty($images) && empty($mainImage)) { + $mainImage = $block->getGalleryImages()->getFirstItem(); +} - $helper = $block->getData('imageHelper'); - $mainImageData = $mainImage ? - $mainImage->getData('medium_image_url') : - $helper->getDefaultPlaceholderUrl('image'); +$helper = $block->getData('imageHelper'); +$mainImageData = $mainImage ? + $mainImage->getData('medium_image_url') : + $helper->getDefaultPlaceholderUrl('image'); ?> @@ -43,11 +41,11 @@ "[data-gallery-role=gallery-placeholder]": { "mage/gallery/gallery": { "mixins":["magnifier/magnify"], - "magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>, - "data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>, + "magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>, + "data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>, "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>, "fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>, - "breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?> + "breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml index d52b594ededdf..f57c9b68ddbd2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php $_product = $block->getProduct() ?> -<?php if ($block->canEmailToFriend()): ?> - <a href="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product')->getEmailToFriendUrl($_product) ?>" - class="action mailto friend"><span><?= /* @escapeNotVerified */ __('Email') ?></span></a> +<?php if ($block->canEmailToFriend()) :?> + <a href="<?= $block->escapeUrl($this->helper(Magento\Catalog\Helper\Product::class)->getEmailToFriendUrl($_product)) ?>" + class="action mailto friend"><span><?= $block->escapeHtml(__('Email')) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml index 87655797f40e5..7f14b71a60c7a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Directory\Block\Currency */ ?> -<meta property="product:price:currency" content="<?= /* @escapeNotVerified */ $block->stripTags($block->getCurrentCurrencyCode()) ?>"/> +<meta property="product:price:currency" + content="<?= /* @noEscape */ $block->stripTags($block->getCurrentCurrencyCode()) ?>"/> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml index 40f86c7e68d6c..4d4a34c6239d4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml @@ -4,17 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View */ ?> <meta property="og:type" content="product" /> -<meta property="og:title" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" /> -<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> -<meta property="og:description" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" /> +<meta property="og:title" + content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" /> +<meta property="og:image" + content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> +<meta property="og:description" + content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" /> <meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" /> -<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()):?> - <meta property="product:price:amount" content="<?= /* @escapeNotVerified */ $priceAmount ?>"/> +<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()) :?> + <meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/> <?= $block->getChildHtml('meta.currency') ?> <?php endif;?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml index 3ebfa76860950..d9a0c845b9f83 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml @@ -4,26 +4,24 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Catalog\Block\Product\View\Options */ ?> <?php $_options = $block->decorateArray($block->getOptions()) ?> <?php $_productId = $block->getProduct()->getId() ?> -<?php if (count($_options)):?> +<?php if (count($_options)) :?> <script type="text/x-magento-init"> { "#product_addtocart_form": { "priceOptions": { - "optionConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>, + "optionConfig": <?= /* @noEscape */ $block->getJsonConfig() ?>, "controlContainer": ".field", "priceHolderSelector": "[data-product-id='<?= $block->escapeHtml($_productId) ?>'][data-role=priceBox]" } } } </script> - <?php foreach ($_options as $_option): ?> + <?php foreach ($_options as $_option) :?> <?= $block->getOptionHtml($_option) ?> <?php endforeach; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml index 66895fa1eabf9..b7cd64277fe40 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml @@ -3,46 +3,43 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?> <?php $_option = $block->getOption() ?> -<?php $_optionId = $_option->getId() ?> +<?php $_optionId = $block->escapeHtmlAttr($_option->getId()) ?> <?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field date<?= /* @escapeNotVerified */ $class ?>" +<div class="field date<?= /* @noEscape */ $class ?>" data-mage-init='{"priceOptionDate":{"fromSelector":"#product_addtocart_form"}}'> - <fieldset class="fieldset fieldset-product-options-inner<?= /* @escapeNotVerified */ $class ?>"> + <fieldset class="fieldset fieldset-product-options-inner<?= /* @noEscape */ $class ?>"> <legend class="legend"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </legend> <div class="control"> <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE): ?> + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE) :?> <?= $block->getDateHtml() ?> <?php endif; ?> <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME): ?> + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME) :?> <?= $block->getTimeHtml() ?> <?php endif; ?> - <?php if ($_option->getIsRequire()): ?> + <?php if ($_option->getIsRequire()) :?> <input type="hidden" - name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" - class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" value="" - data-validate="{'validate-required-datetime':<?= /* @escapeNotVerified */ $_optionId ?>}"/> - <?php else: ?> + data-validate="{'validate-required-datetime':<?= /* @noEscape */ $_optionId ?>}"/> + <?php else :?> <input type="hidden" - name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" - class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" value="" - data-validate="{'validate-optional-datetime':<?= /* @escapeNotVerified */ $_optionId ?>}"/> + data-validate="{'validate-optional-datetime':<?= /* @noEscape */ $_optionId ?>}"/> <?php endif; ?> <script type="text/x-magento-init"> { diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml index 2006bf6e9f414..c25dab8b70a5c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_option = $block->getOption() ?> <div class="field"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml index adb729c6d86ec..e83e55ad2a03c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml @@ -3,65 +3,62 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?> <?php $_option = $block->getOption(); ?> <?php $_fileInfo = $block->getFileInfo(); ?> <?php $_fileExists = $_fileInfo->hasData(); ?> -<?php $_fileName = 'options_' . $_option->getId() . '_file'; ?> +<?php $_fileName = 'options_' . $block->escapeHtmlAttr($_option->getId()) . '_file'; ?> <?php $_fieldNameAction = $_fileName . '_action'; ?> <?php $_fieldValueAction = $_fileExists ? 'save_old' : 'save_new'; ?> <?php $_fileNamed = $_fileName . '_name'; ?> <?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field file<?= /* @escapeNotVerified */ $class ?>"> +<div class="field file<?= /* @noEscape */ $class ?>"> <label class="label" for="<?= /* @noEscape */ $_fileName ?>" id="<?= /* @noEscape */ $_fileName ?>-label"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> - <?php if ($_fileExists): ?> + <?php if ($_fileExists) :?> <div class="control"> <span class="<?= /* @noEscape */ $_fileNamed ?>"><?= $block->escapeHtml($_fileInfo->getTitle()) ?></span> <a href="javascript:void(0)" class="label" id="change-<?= /* @noEscape */ $_fileName ?>" > - <?= /* @escapeNotVerified */ __('Change') ?> + <?= $block->escapeHtml(__('Change')) ?> </a> - <?php if (!$_option->getIsRequire()): ?> - <input type="checkbox" id="delete-<?= /* @escapeNotVerified */ $_fileName ?>" /> - <span class="label"><?= /* @escapeNotVerified */ __('Delete') ?></span> + <?php if (!$_option->getIsRequire()) :?> + <input type="checkbox" id="delete-<?= /* @noEscape */ $_fileName ?>" /> + <span class="label"><?= $block->escapeHtml(__('Delete')) ?></span> <?php endif; ?> </div> <?php endif; ?> - <div class="control" id="input-box-<?= /* @escapeNotVerified */ $_fileName ?>" + <div class="control" id="input-box-<?= /* @noEscape */ $_fileName ?>" data-mage-init='{"priceOptionFile":{ "fileName":"<?= /* @noEscape */ $_fileName ?>", "fileNamed":"<?= /* @noEscape */ $_fileNamed ?>", - "fieldNameAction":"<?= /* @escapeNotVerified */ $_fieldNameAction ?>", - "changeFileSelector":"#change-<?= /* @escapeNotVerified */ $_fileName ?>", - "deleteFileSelector":"#delete-<?= /* @escapeNotVerified */ $_fileName ?>"} + "fieldNameAction":"<?= /* @noEscape */ $_fieldNameAction ?>", + "changeFileSelector":"#change-<?= /* @noEscape */ $_fileName ?>", + "deleteFileSelector":"#delete-<?= /* @noEscape */ $_fileName ?>"} }' <?= $_fileExists ? 'style="display:none"' : '' ?>> <input type="file" - name="<?= /* @escapeNotVerified */ $_fileName ?>" - id="<?= /* @escapeNotVerified */ $_fileName ?>" + name="<?= /* @noEscape */ $_fileName ?>" + id="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required' : '' ?>" - <?= $_fileExists ? 'disabled="disabled"' : '' ?> /> - <input type="hidden" name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>" value="<?= /* @escapeNotVerified */ $_fieldValueAction ?>" /> - <?php if ($_option->getFileExtension()): ?> + <?= $_fileExists ? 'disabled="disabled"' : '' ?> /> + <input type="hidden" name="<?= /* @noEscape */ $_fieldNameAction ?>" value="<?= /* @noEscape */ $_fieldValueAction ?>" /> + <?php if ($_option->getFileExtension()) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Compatible file extensions to upload') ?>: <strong><?= /* @escapeNotVerified */ $_option->getFileExtension() ?></strong> + <?= $block->escapeHtml(__('Compatible file extensions to upload')) ?>: <strong><?= $block->escapeHtml($_option->getFileExtension()) ?></strong> </p> <?php endif; ?> - <?php if ($_option->getImageSizeX() > 0): ?> + <?php if ($_option->getImageSizeX() > 0) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Maximum image width') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeX() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong> + <?= $block->escapeHtml(__('Maximum image width')) ?>: <strong><?= (int)$_option->getImageSizeX() ?> <?= $block->escapeHtml(__('px.')) ?></strong> </p> <?php endif; ?> - <?php if ($_option->getImageSizeY() > 0): ?> + <?php if ($_option->getImageSizeY() > 0) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Maximum image height') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeY() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong> + <?= $block->escapeHtml(__('Maximum image height')) ?>: <strong><?= (int)$_option->getImageSizeY() ?> <?= $block->escapeHtml(__('px.')) ?></strong> </p> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml index 980b78f917cf2..c4c1d24423bb0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?> @@ -13,15 +10,15 @@ $_option = $block->getOption(); $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field<?= /* @escapeNotVerified */ $class ?>"> - <label class="label" for="select_<?= /* @escapeNotVerified */ $_option->getId() ?>"> +<div class="field<?= /* @noEscape */ $class ?>"> + <label class="label" for="select_<?= $block->escapeHtmlAttr($_option->getId()) ?>"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control"> <?= $block->getValuesHtml() ?> - <?php if ($_option->getIsRequire()): ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX): ?> - <span id="options-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></span> + <?php if ($_option->getIsRequire()) :?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX) :?> + <span id="options-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></span> <?php endif; ?> <?php endif;?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml index a04e366a43a2d..dd4c000d1f338 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?> <?php @@ -15,14 +12,14 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; <div class="field<?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) { echo ' textarea'; -} ?><?= /* @escapeNotVerified */ $class ?>"> - <label class="label" for="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text"> +} ?><?= /* @noEscape */ $class ?>"> + <label class="label" for="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD) :?> <?php $_textValidate = null; if ($_option->getIsRequire()) { $_textValidate['required'] = true; @@ -33,15 +30,15 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; $_textValidate['validate-no-utf8mb4-characters'] = true; ?> <input type="text" - id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" + id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" class="input-text product-custom-option" - <?php if (!empty($_textValidate)) {?> - data-validate="<?= $block->escapeHtml(json_encode($_textValidate)) ?>" - <?php } ?> - name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" + <?php if (!empty($_textValidate)) {?> + data-validate="<?= $block->escapeHtml(json_encode($_textValidate)) ?>" + <?php } ?> + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" value="<?= $block->escapeHtml($block->getDefaultValue()) ?>"/> - <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA): ?> + <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) :?> <?php $_textAreaValidate = null; if ($_option->getIsRequire()) { $_textAreaValidate['required'] = true; @@ -51,31 +48,31 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; } $_textAreaValidate['validate-no-utf8mb4-characters'] = true; ?> - <textarea id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" + <textarea id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" class="product-custom-option" <?php if (!empty($_textAreaValidate)) {?> data-validate="<?= $block->escapeHtml(json_encode($_textAreaValidate)) ?>" <?php } ?> - name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" rows="5" cols="25"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> <?php endif; ?> - <?php if ($_option->getMaxCharacters()): ?> - <p class="note note_<?= /* @escapeNotVerified */ $_option->getId() ?>"> - <?= /* @escapeNotVerified */ __('Maximum %1 characters', $_option->getMaxCharacters()) ?> + <?php if ($_option->getMaxCharacters()) :?> + <p class="note note_<?= $block->escapeHtmlAttr($_option->getId()) ?>"> + <?= $block->escapeHtml(__('Maximum %1 characters', $_option->getMaxCharacters())) ?> <span class="character-counter no-display"></span> </p> <?php endif; ?> </div> - <?php if ($_option->getMaxCharacters()): ?> + <?php if ($_option->getMaxCharacters()) :?> <script type="text/x-magento-init"> { - "[data-selector='options[<?= /* @escapeNotVerified */ $_option->getId() ?>]']": { + "[data-selector='options[<?= $block->escapeJs($_option->getId()) ?>]']": { "Magento_Catalog/js/product/remaining-characters": { - "maxLength": "<?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?>", - "noteSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?>", - "counterSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?> .character-counter" + "maxLength": "<?= (int)$_option->getMaxCharacters() ?>", + "noteSelector": ".note_<?= $block->escapeJs($_option->getId()) ?>", + "counterSelector": ".note_<?= $block->escapeJs($_option->getId()) ?> .character-counter" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml index ca6960a215a7a..88ee45bafe731 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml @@ -3,14 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** @var $block Magento\Catalog\Block\Product\View */ ?> <?php $required = ''; if ($block->hasRequiredOptions()) { - $required = ' data-hasrequired="' . __('* Required Fields') . '"'; + $required = ' data-hasrequired="' . $block->escapeHtmlAttr(__('* Required Fields')) . '"'; } ?> -<div class="product-options-wrapper" id="product-options-wrapper"<?= /* @escapeNotVerified */ $required ?>> +<div class="product-options-wrapper" id="product-options-wrapper"<?= /* @noEscape */ $required ?>> <div class="fieldset" tabindex="0"> <?= $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml index e8c0b32fd7692..979bab167c344 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Catalog\Block\Product\AbstractProduct $block */ ?> <?php $_product = $block->getProduct() ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml index 5575d00df7457..5250673436648 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Product\AbstractProduct */ ?> <?= $block->getReviewsSummaryHtml($block->getProduct(), false, true) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml index 7e522b4f88306..30edb2df03754 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml @@ -3,21 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\AbstractView */?> <?php $_product = $block->getProduct() ?> -<?php if ($block->displayProductStockStatus()): ?> - <?php if ($_product->isAvailable()): ?> - <div class="stock available" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> +<?php if ($block->displayProductStockStatus()) :?> + <?php if ($_product->isAvailable()) :?> + <div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </div> - <?php else: ?> - <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else :?> + <div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml index 2ec671b8de3ab..69f0319134ea0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <div class="widget block block-product-link"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml index 373eda1117455..8d9f6500894b4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <span class="widget block block-product-link-inline"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml index 45a206f3f92bf..44aad441e2942 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml @@ -4,60 +4,61 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-list"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol class="product-items" id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> <div class="product-item-info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>"> <?= $block->getImage($_product, 'side_column_widget_product_thumbnail')->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)" + class="product-item-link"> + <?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> - <?= /* @escapeNotVerified */ $block->getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> + <?= $block->getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> <div class="product-item-actions"> <div class="actions-primary"> - <?php if ($_product->isSaleable()): ?> - <?php if (!$_product->getTypeInstance()->isPossibleBuyFromList($_product)): ?> - <button type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" + <?php if ($_product->isSaleable()) :?> + <?php if (!$_product->getTypeInstance()->isPossibleBuyFromList($_product)) :?> + <button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_product) ?>"}}'> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_product))) ?>"}}'> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - <button type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_product)), ['product' => $_product->getEntityId()]); + ?> + <button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>'> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>'> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_product->getIsSalable()): ?> - <div class="stock available" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> + <?php else :?> + <?php if ($_product->getIsSalable()) :?> + <div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </div> - <?php else: ?> - <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else :?> + <div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml index 2c40f9f7d63dc..8a776adc95018 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml @@ -3,22 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-images"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-images"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>" + class="product-items product-items-images"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>"> <?php /* new_products_images_only_widget */ ?> <?= $block->getImage($_product, 'new_products_images_only_widget')->toHtml() ?> </a> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml index c0fb12df91137..371d4df7c0206 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml @@ -4,24 +4,26 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-names"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-names"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>" + class="product-items product-items-names"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)" + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <?= /* @noEscape */ $this->helper( + Magento\Catalog\Helper\Output::class + )->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> </li> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml index 93542c4c9095c..ac119c740b460 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,6 +10,10 @@ * * @var $block \Magento\Catalog\Block\Product\Widget\NewWidget */ + +// phpcs:disable Magento2.Files.LineLength.MaxExceeded +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())) { $type = 'widget-new-grid'; @@ -30,84 +31,93 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> } ?> -<?php if ($exist):?> - <div class="block widget block-new-products <?= /* @escapeNotVerified */ $mode ?>"> +<?php if ($exist) :?> + <div class="block widget block-new-products <?= /* @noEscape */ $mode ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> - <?php foreach ($items as $_item): ?> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>"> + <ol class="product-items <?= /* @noEscape */ $type ?>"> + <?php foreach ($items as $_item) :?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" + class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php - echo $block->getProductPriceHtml($_item, $type); - ?> + <?= $block->getProductPriceHtml($_item, $type); ?> - <?php if ($templateType): ?> + <?php if ($templateType) :?> <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) :?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) :?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?> + <?php if ($_item->isSaleable()) :?> + <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData( + $block->escapeUrl($block->getAddToCartUrl($_item)), + ['product' => (int) $_item->getEntityId()] + ) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> + </div> + <?php else :?> + <div class="stock unavailable"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> + </div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) :?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist) :?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' - class="action towishlist" data-action="add-to-wishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' + class="action towishlist" + data-action="add-to-wishlist" + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <?php if ($block->getAddToCompareUrl() && $showCompare) :?> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class);?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml index ad75a3a6f0743..987322c8a4864 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml @@ -3,11 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php + +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded + /** * Template for displaying new products widget * @@ -21,7 +22,8 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> $image = 'new_products_content_widget_list'; $title = __('New Products'); $items = $block->getProductCollection()->getItems(); - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + /** @var Magento\Catalog\Helper\Output $_helper */ + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $showWishlist = true; $showCompare = true; @@ -31,94 +33,102 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> } ?> -<?php if ($exist):?> - <div class="block widget block-new-products <?= /* @escapeNotVerified */ $mode ?>"> +<?php if ($exist) :?> + <div class="block widget block-new-products <?= /* @noEscape */ $mode ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> - <?php foreach ($items as $_item): ?> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>"> + <ol class="product-items <?= /* @noEscape */ $type ?>"> + <?php foreach ($items as $_item) :?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" + class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> <?= $block->getProductPriceHtml($_item, $type) ?> - <?php if ($templateType): ?> + <?php if ($templateType) :?> <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) :?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) :?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?> + <?php if ($_item->isSaleable()) :?> + <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item) + ) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) :?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist) :?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) :?> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class); ?> <a href="#" class="action tocompare" - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>'> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>" + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' + > + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> <?php endif; ?> </div> <?php endif; ?> - <?php if ($description):?> + <?php if ($description) :?> <div class="product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + <?= /* @noEscape */ $_helper->productAttribute( + $_item, + $_item->getShortDescription(), + 'short_description' + ) ?> + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item))?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml index 578630a11e930..d4db174dbe5e7 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml @@ -5,12 +5,13 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @escapeNotVerified */ $block->renderApp([ +<?php /* @noEscape */ echo $block->renderApp([ 'widget_columns' => [ 'displayMode' => 'grid' ], diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml index 3770c330ad73e..e03ac9ca692cc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml @@ -5,12 +5,13 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @escapeNotVerified */ $block->renderApp([ +<?php /* @noEscape */ echo $block->renderApp([ 'widget_columns' => [ 'displayMode' => 'list' ], diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 3d25e16294fcd..28bf422ca93b2 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -6,6 +6,8 @@ namespace Magento\Wishlist\Helper; use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Escaper; use Magento\Wishlist\Controller\WishlistProviderInterface; /** @@ -100,6 +102,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $productRepository; + /** + * @var Escaper + */ + private $escaper; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\Registry $coreRegistry @@ -110,6 +117,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Customer\Helper\View $customerViewHelper * @param WishlistProviderInterface $wishlistProvider * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + * @param Escaper $escaper */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -120,7 +128,8 @@ public function __construct( \Magento\Framework\Data\Helper\PostHelper $postDataHelper, \Magento\Customer\Helper\View $customerViewHelper, WishlistProviderInterface $wishlistProvider, - \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, + Escaper $escaper = null ) { $this->_coreRegistry = $coreRegistry; $this->_customerSession = $customerSession; @@ -130,6 +139,7 @@ public function __construct( $this->_customerViewHelper = $customerViewHelper; $this->wishlistProvider = $wishlistProvider; $this->productRepository = $productRepository; + $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class); parent::__construct($context); } @@ -323,10 +333,10 @@ public function getAddParams($item, array $params = []) { $productId = null; if ($item instanceof \Magento\Catalog\Model\Product) { - $productId = $item->getEntityId(); + $productId = (int) $item->getEntityId(); } if ($item instanceof \Magento\Wishlist\Model\Item) { - $productId = $item->getProductId(); + $productId = (int) $item->getProductId(); } $url = $this->_getUrlStore($item)->getUrl('wishlist/index/add'); @@ -334,7 +344,10 @@ public function getAddParams($item, array $params = []) $params['product'] = $productId; } - return $this->_postDataHelper->getPostData($url, $params); + return $this->_postDataHelper->getPostData( + $this->escaper->escapeUrl($url), + $params + ); } /** diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 6c4746d8218ea..f5c8df8d6e3e8 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -726,7 +726,7 @@ protected function _toHtml() */ public function getUiId($arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null) { - return ' data-ui-id="' . $this->getJsId($arg1, $arg2, $arg3, $arg4, $arg5) . '" '; + return ' data-ui-id="' . $this->escapeHtmlAttr($this->getJsId($arg1, $arg2, $arg3, $arg4, $arg5)) . '" '; } /** From eb3de5a26d6358c018e0b157b10518b2dbea8a0d Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 16 May 2019 15:28:09 -0500 Subject: [PATCH 132/464] MC-13414: Checkout flow if shipping rates are not available --- .../OpenStoreFrontProductPageActionGroup.xml | 18 +++ ...reFrontCheckoutShippingPageActionGroup.xml | 14 +++ .../Checkout/Test/Mftf/Data/ConfigData.xml | 84 ++++++++++++++ .../CheckoutShippingMethodsSection.xml | 1 + ...tGuestCheckoutForSpecificCountriesTest.xml | 104 ++++++++++++++++++ ...rtStoreFrontNoQuotesMessageActionGroup.xml | 15 +++ ...rontShippingMethodAvailableActionGroup.xml | 18 +++ ...ntShippingMethodUnavailableActionGroup.xml | 18 +++ 8 files changed, 272 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontNoQuotesMessageActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..511f1aca5ff35 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenStoreFrontProductPageActionGroup"> + <arguments> + <argument name="productUrlKey" type="string"/> + </arguments> + <amOnPage url="{{StorefrontProductPage.url(productUrlKey)}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + </actionGroup> +</actionGroups> + diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml new file mode 100644 index 0000000000000..cea9d968b58e1 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenStoreFrontCheckoutShippingPageActionGroup"> + <amOnPage url="{{CheckoutShippingPage.url}}" stepKey="amOnCheckoutShippingPage"/> + <waitForPageLoad stepKey="waitForCheckoutShippingPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml new file mode 100644 index 0000000000000..12974617d55ae --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <!-- Free shipping --> + <entity name="EnableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToSpecificCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToAfghanistanConfigData"> + <data key="path">carriers/freeshipping/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFreeShippingToAllAllowedCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> + + <!-- Flat Rate shipping --> + <entity name="EnableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToSpecificCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToAfghanistanConfigData"> + <data key="path">carriers/flatrate/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFlatRateToAllAllowedCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> +</entities> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml index 5c8060d508179..5b546e6d37c0a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml @@ -19,5 +19,6 @@ <element name="shipHereButton" type="button" selector="//div/following-sibling::div/button[contains(@class, 'action-select-shipping-item')]"/> <element name="shippingMethodLoader" type="button" selector="//div[contains(@class, 'checkout-shipping-method')]/following-sibling::div[contains(@class, 'loading-mask')]"/> <element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/> + <element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml new file mode 100644 index 0000000000000..d778620d8716b --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontGuestCheckoutForSpecificCountriesTest"> + <annotations> + <features value="One Page Checkout"/> + <stories value="Checkout for Specific Countries"/> + <title value="Storefront guest checkout for specific countries test"/> + <description value="Checkout flow if shipping rates are not available"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-13414"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + + <!-- Enable free shipping to specific country - Afghanistan --> + <magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/> + <magentoCLI command="config:set {{EnableFreeShippingToSpecificCountriesConfigData.path}} {{EnableFreeShippingToSpecificCountriesConfigData.value}}" stepKey="allowFreeShippingSpecificCountries"/> + <magentoCLI command="config:set {{EnableFreeShippingToAfghanistanConfigData.path}} {{EnableFreeShippingToAfghanistanConfigData.value}}" stepKey="enableFreeShippingToAfghanistan"/> + + <!-- Enable flat rate shipping to specific country - Afghanistan --> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> + <magentoCLI command="config:set {{EnableFlatRateToSpecificCountriesConfigData.path}} {{EnableFlatRateToSpecificCountriesConfigData.value}}" stepKey="allowFlatRateSpecificCountries"/> + <magentoCLI command="config:set {{EnableFlatRateToAfghanistanConfigData.path}} {{EnableFlatRateToAfghanistanConfigData.value}}" stepKey="enableFlatRateToAfghanistan"/> + </before> + <after> + <!-- Rollback all configurations --> + <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> + <magentoCLI command="config:set {{EnableFreeShippingToAllAllowedCountriesConfigData.path}} {{EnableFreeShippingToAllAllowedCountriesConfigData.value}}" stepKey="allowFreeShippingToAllCountries"/> + <magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/> + + <!-- Delete product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + </after> + + <!-- Add product to cart --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Go to checkout page --> + <actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/> + + <!-- Assert shipping methods are unavailable --> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMethod"> + <argument name="shippingMethodName" value="Flat Rate"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"> + <argument name="shippingMethodName" value="Free Shipping"/> + </actionGroup> + + <!-- Assert no quotes message --> + <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMessage"/> + + <!-- Assert Next button --> + <dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextButton"/> + + <!-- Fill form with valid data for US > California --> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{US_Address_CA.country}}" stepKey="selectCountry"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{US_Address_CA.state}}" stepKey="selectState"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="fillPostcode"/> + + <!-- Assert shipping methods are unavailable for US > California --> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMtd"> + <argument name="shippingMethodName" value="Flat Rate"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"> + <argument name="shippingMethodName" value="Free Shipping"/> + </actionGroup> + + <!-- Assert no quotes message for US > California --> + <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMsg"/> + + <!-- Assert Next button for US > California --> + <dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextBtn"/> + + <!-- Fill form for specific country - Afghanistan --> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="selectSpecificCountry"/> + + <!-- Assert shipping methods are available --> + <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"> + <argument name="shippingMethodName" value="Flat Rate"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFreeShippingMethod"> + <argument name="shippingMethodName" value="Free Shipping"/> + </actionGroup> + + <!-- Assert Next button is available --> + <seeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="seeNextButton"/> + </test> +</tests> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontNoQuotesMessageActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontNoQuotesMessageActionGroup.xml new file mode 100644 index 0000000000000..060e8a4f2e21e --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontNoQuotesMessageActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreFrontNoQuotesMessageActionGroup"> + <waitForElementVisible selector="{{CheckoutShippingMethodsSection.noQuotesMsg}}" stepKey="waitForNoQuotesMsgVisible"/> + <see selector="{{CheckoutShippingMethodsSection.noQuotesMsg}}" userInput="Sorry, no quotes are available for this order at this time" stepKey="assertNoQuotesMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml new file mode 100644 index 0000000000000..9ebeb39668590 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreFrontShippingMethodAvailableActionGroup"> + <arguments> + <argument name="shippingMethodName" type="string"/> + </arguments> + <waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodLoad"/> + <seeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="seeShippingMethod"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml new file mode 100644 index 0000000000000..44da1b24c0ad5 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertStoreFrontShippingMethodUnavailableActionGroup"> + <arguments> + <argument name="shippingMethodName" type="string"/> + </arguments> + <waitForElementNotVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodNotVisible"/> + <dontSeeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="dontSeeShippingMethod"/> + </actionGroup> +</actionGroups> From d60067141a454e566259fae33ca7694e2c5d05be Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 16 May 2019 15:33:16 -0500 Subject: [PATCH 133/464] MC-13414: Checkout flow if shipping rates are not available --- .../Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml index 511f1aca5ff35..4bfd5673e4a8b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml @@ -15,4 +15,3 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> </actionGroup> </actionGroups> - From f2446ba5382fb44b5ca35a1dd75e4470189c9dd2 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Thu, 16 May 2019 16:51:18 -0500 Subject: [PATCH 134/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../Magento/Tax/view/base/templates/pricing/adjustment.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml index 3eba15da887a4..e87d1c9eb96aa 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml @@ -8,7 +8,7 @@ <?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?> <?php if ($block->displayBothPrices()) : ?> - <span id="<?= /* @noEscape */ $block->buildIdWithPrefix('price-excluding-tax-') ?>" + <span id="<?= $block->escapeHtmlAttr($block->buildIdWithPrefix('price-excluding-tax-')) ?>" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>" data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>" data-price-type="basePrice" From b3a7610ecd98c3834f48735ab85bc709f2395e6b Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Fri, 17 May 2019 08:11:10 -0500 Subject: [PATCH 135/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../view/adminhtml/templates/product/edit/tabs.phtml | 10 +++++----- .../view/frontend/templates/product/list/items.phtml | 2 +- .../view/frontend/templates/product/listing.phtml | 2 +- .../templates/product/view/opengraph/general.phtml | 4 ++-- .../product/widget/new/column/new_default_list.phtml | 2 +- .../product/widget/new/content/new_grid.phtml | 2 +- .../product/widget/new/content/new_list.phtml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml index 427027fdb67e0..360694fceb241 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml @@ -14,13 +14,13 @@ <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>" data-mage-init='{"tabs":{ - "active": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getActiveTabId())) ?>", - "destination": "#<?= $block->escapeJs($block->escapeHtmlAttr($block->getDestElementId())) ?>", + "active": "<?= $block->escapeHtmlAttr($block->getActiveTabId()) ?>", + "destination": "#<?= $block->escapeHtmlAttr($block->getDestElementId()) ?>", "shadowTabs": "<?= /* @noEscape */ $block->getAllShadowTabs() ?>", - "tabsBlockPrefix": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getId())) ?>_", + "tabsBlockPrefix": "<?= $block->escapeHtmlAttr($block->getId()) ?>_", "tabIdArgument": "active_tab", - "tabPanelClass": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getPanelsClass())) ?>", - "excludedPanel": "<?= $block->escapeJs($block->escapeHtmlAttr($block->getExcludedPanel())) ?>", + "tabPanelClass": "<?= $block->escapeHtmlAttr($block->getPanelsClass()) ?>", + "excludedPanel": "<?= $block->escapeHtmlAttr($block->getExcludedPanel()) ?>", "groups": "ul.tabs" }}'> <?php foreach ($tabGroups as $tabGroupCode) :?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index 321771eeb4b5f..91e261900aef2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -218,7 +218,7 @@ switch ($type = $block->getType()) { <div class="actions-primary"> <?php if ($_item->isSaleable()) :?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) :?> - <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else :?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml index cc6c9d3c579f7..b776fd4f7e193 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml @@ -61,7 +61,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); if ($_product->isSaleable()) { $info['button'] = '<button type="button" title="' . $block->escapeHtmlAttr(__('Add to Cart')) . '" class="action tocart"' - . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_product))) . '"} }\'>' + . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->escapeUrl($block->getAddToCartUrl($_product)) . '"} }\'>' . '<span>' . $block->escapeHtml(__('Add to Cart')) . '</span></button>'; } else { $info['button'] = $_product->getIsSalable() ? '<div class="stock available"><span>' . $block->escapeHtml(__('In stock')) . '</span></div>' : diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml index 4d4a34c6239d4..eb2bde647f9b1 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml @@ -9,11 +9,11 @@ <meta property="og:type" content="product" /> <meta property="og:title" - content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" /> + content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getName()) ?>" /> <meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> <meta property="og:description" - content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" /> + content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getShortDescription()) ?>" /> <meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" /> <?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()) :?> <meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml index 44aad441e2942..53a0682311b1f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml @@ -37,7 +37,7 @@ <?php if (!$_product->getTypeInstance()->isPossibleBuyFromList($_product)) :?> <button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_product))) ?>"}}'> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}'> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else :?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml index ac119c740b460..5108c488aec19 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml @@ -68,7 +68,7 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> <?php if ($_item->isSaleable()) :?> <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml index 987322c8a4864..378cd49493a6e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml @@ -71,7 +71,7 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item) ) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeJs($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> From c065a2ba2762e80c6f1d5c372981eeec3b924c2c Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 17 May 2019 09:42:08 -0500 Subject: [PATCH 136/464] MAGETWO-53347: Char flag update - fix svc --- lib/internal/Magento/Framework/Escaper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index f243fb2c99b4f..216afc0409b50 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -16,7 +16,7 @@ class Escaper /** * HTML special characters flag */ - private const HTMLSPECIALCHARS_FLAG = ENT_QUOTES | ENT_SUBSTITUTE; + private $htmlSpecialCharsFlag = ENT_QUOTES | ENT_SUBSTITUTE; /** * @var \Magento\Framework\ZendEscaper @@ -105,7 +105,7 @@ function ($errorNumber, $errorString) { preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches); return !empty($matches) ? $matches[1] : ''; } else { - $result = htmlspecialchars($data, self::HTMLSPECIALCHARS_FLAG, 'UTF-8', false); + $result = htmlspecialchars($data, $this->htmlSpecialCharsFlag, 'UTF-8', false); } } else { $result = $data; @@ -224,7 +224,7 @@ public function escapeHtmlAttr($string, $escapeSingleQuote = true) if ($escapeSingleQuote) { return $this->getEscaper()->escapeHtmlAttr((string) $string); } - return htmlspecialchars((string)$string, self::HTMLSPECIALCHARS_FLAG, 'UTF-8', false); + return htmlspecialchars((string)$string, $this->htmlSpecialCharsFlag, 'UTF-8', false); } /** @@ -321,7 +321,7 @@ public function escapeXssInUrl($data) { return htmlspecialchars( $this->escapeScriptIdentifiers((string)$data), - self::HTMLSPECIALCHARS_FLAG | ENT_HTML5 | ENT_HTML401, + $this->htmlSpecialCharsFlag | ENT_HTML5 | ENT_HTML401, 'UTF-8', false ); @@ -358,7 +358,7 @@ public function escapeQuote($data, $addSlashes = false) if ($addSlashes === true) { $data = addslashes($data); } - return htmlspecialchars($data, self::HTMLSPECIALCHARS_FLAG, null, false); + return htmlspecialchars($data, $this->htmlSpecialCharsFlag, null, false); } /** From 6cd8ce1d89719a49a39b13189dc6d03f77abd587 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 17 May 2019 11:58:20 -0500 Subject: [PATCH 137/464] MAGETWO-99479: Use Escaper methods - fix unit --- .../Unit/Form/Element/AbstractElementTest.php | 8 ++++---- .../Data/Test/Unit/Form/Element/LabelTest.php | 16 ++++++++-------- .../Test/Unit/Form/Element/MultilineTest.php | 14 +++++++++++--- .../Data/Test/Unit/Form/Element/ObscureTest.php | 16 ++++++++-------- .../Test/Unit/Data/Form/Element/HiddenTest.php | 10 +++++++++- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php index d9dafddc571b8..2b142e6e390c2 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php @@ -242,9 +242,9 @@ public function testRemoveClass() */ public function testGetEscapedValueWithoutFilter() { - $this->_model->setValue('<a href="#hash_tag">my \'quoted\' string</a>'); + $this->_model->setValue('<a href="#hash_tag">my 'quoted' string</a>'); $this->assertEquals( - '<a href="#hash_tag">my \'quoted\' string</a>', + '<a href="#hash_tag">my 'quoted' string</a>', $this->_model->getEscapedValue() ); } @@ -254,8 +254,8 @@ public function testGetEscapedValueWithoutFilter() */ public function testGetEscapedValueWithFilter() { - $value = '<a href="#hash_tag">my \'quoted\' string</a>'; - $expectedValue = '<a href="#hash_tag">my \'quoted\' string</a>'; + $value = '<a href="#hash_tag">my 'quoted' string</a>'; + $expectedValue = '<a href="#hash_tag">my 'quoted' string</a>'; $filterMock = $this->createPartialMock(\Magento\Framework\DataObject::class, ['filter']); $filterMock->expects($this->once()) diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LabelTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LabelTest.php index 8420f8e421f7b..ec625a1cdd4a5 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LabelTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/LabelTest.php @@ -3,18 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Framework\Data\Test\Unit\Form\Element; /** * Tests for \Magento\Framework\Data\Form\Element\Label */ -namespace Magento\Framework\Data\Test\Unit\Form\Element; - class LabelTest extends \PHPUnit\Framework\TestCase { - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManagerMock; + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + private $objectManager; /** * @var \Magento\Framework\Data\Form\Element\Label @@ -25,11 +22,14 @@ protected function setUp() { $factoryMock = $this->createMock(\Magento\Framework\Data\Form\Element\Factory::class); $collectionFactoryMock = $this->createMock(\Magento\Framework\Data\Form\Element\CollectionFactory::class); - $escaperMock = $this->createMock(\Magento\Framework\Escaper::class); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManager->getObject( + \Magento\Framework\Escaper::class + ); $this->_label = new \Magento\Framework\Data\Form\Element\Label( $factoryMock, $collectionFactoryMock, - $escaperMock + $escaper ); } diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultilineTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultilineTest.php index 9a391da4d65dd..85482e05188ab 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultilineTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultilineTest.php @@ -5,8 +5,14 @@ */ namespace Magento\Framework\Data\Test\Unit\Form\Element; +/** + * Test for \Magento\Framework\Data\Form\Element\Multiline + */ class MultilineTest extends \PHPUnit\Framework\TestCase { + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + private $objectManager; + /** * @var \Magento\Framework\Data\Form\Element\Multiline */ @@ -37,9 +43,11 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class) - ->disableOriginalConstructor() - ->getMock(); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->escaper = $this->objectManager->getObject( + \Magento\Framework\Escaper::class + ); $this->element = new \Magento\Framework\Data\Form\Element\Multiline( $this->elementFactory, diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php index bb0b67a40abea..cec024fd4073b 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/ObscureTest.php @@ -3,18 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Framework\Data\Test\Unit\Form\Element; /** * Tests for \Magento\Framework\Data\Form\Element\Obscure */ -namespace Magento\Framework\Data\Test\Unit\Form\Element; - class ObscureTest extends \PHPUnit\Framework\TestCase { - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManagerMock; + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + private $objectManager; /** * @var \Magento\Framework\Data\Form\Element\Obscure @@ -25,11 +22,14 @@ protected function setUp() { $factoryMock = $this->createMock(\Magento\Framework\Data\Form\Element\Factory::class); $collectionFactoryMock = $this->createMock(\Magento\Framework\Data\Form\Element\CollectionFactory::class); - $escaperMock = $this->createMock(\Magento\Framework\Escaper::class); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManager->getObject( + \Magento\Framework\Escaper::class + ); $this->_model = new \Magento\Framework\Data\Form\Element\Obscure( $factoryMock, $collectionFactoryMock, - $escaperMock + $escaper ); $formMock = new \Magento\Framework\DataObject(); $formMock->getHtmlIdPrefix('id_prefix'); diff --git a/lib/internal/Magento/Framework/Test/Unit/Data/Form/Element/HiddenTest.php b/lib/internal/Magento/Framework/Test/Unit/Data/Form/Element/HiddenTest.php index 7d54337f377fa..7e80aac105090 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Data/Form/Element/HiddenTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Data/Form/Element/HiddenTest.php @@ -21,7 +21,15 @@ class HiddenTest extends \PHPUnit\Framework\TestCase protected function setUp() { $objectManager = new ObjectManager($this); - $this->element = $objectManager->getObject(\Magento\Framework\Data\Form\Element\Hidden::class); + $escaper = $objectManager->getObject( + \Magento\Framework\Escaper::class + ); + $this->element = $objectManager->getObject( + \Magento\Framework\Data\Form\Element\Hidden::class, + [ + 'escaper' => $escaper + ] + ); } /** From 00a55a5c7300273998a3cb2d4ae8bc22aa683fbc Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 17 May 2019 13:39:41 -0500 Subject: [PATCH 138/464] MAGETWO-99479: Use Escaper methods - fix static --- .../Data/Test/Unit/Form/Element/AbstractElementTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php index 2b142e6e390c2..2bd6a29477050 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php @@ -3,12 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Framework\Data\Test\Unit\Form\Element; /** * Tests for \Magento\Framework\Data\Form\Element\AbstractElement */ -namespace Magento\Framework\Data\Test\Unit\Form\Element; - class AbstractElementTest extends \PHPUnit\Framework\TestCase { /** From 15152b7345445128b071988bf7cc655351cca9b4 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 17 May 2019 13:50:31 -0500 Subject: [PATCH 139/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../Magento/Framework/View/Page/Config.php | 14 ++++++++++++-- .../Setup/Model/DependencyReadinessCheck.php | 14 ++++++++++++-- .../Setup/Model/UninstallDependencyCheck.php | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Page/Config.php b/lib/internal/Magento/Framework/View/Page/Config.php index b29a0feda9d60..4e57b2897a8d0 100644 --- a/lib/internal/Magento/Framework/View/Page/Config.php +++ b/lib/internal/Magento/Framework/View/Page/Config.php @@ -54,6 +54,11 @@ class Config */ const HTML_ATTRIBUTE_LANG = 'lang'; + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Allowed group of types * @@ -164,6 +169,7 @@ private function getAreaResolver() * @param Title $title * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param bool $isIncludesAvailable + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( View\Asset\Repository $assetRepo, @@ -172,7 +178,8 @@ public function __construct( View\Page\FaviconInterface $favicon, Title $title, \Magento\Framework\Locale\ResolverInterface $localeResolver, - $isIncludesAvailable = true + $isIncludesAvailable = true, + \Magento\Framework\Escaper $escaper = null ) { $this->assetRepo = $assetRepo; $this->pageAssets = $pageAssets; @@ -186,6 +193,9 @@ public function __construct( self::HTML_ATTRIBUTE_LANG, strstr($this->localeResolver->getLocale(), '_', true) ); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -245,7 +255,7 @@ public function getTitle() public function setMetadata($name, $content) { $this->build(); - $this->metadata[$name] = htmlspecialchars($content); + $this->metadata[$name] = $this->escaper->escapeHtml($content); } /** diff --git a/setup/src/Magento/Setup/Model/DependencyReadinessCheck.php b/setup/src/Magento/Setup/Model/DependencyReadinessCheck.php index 4adb3a6a49b0d..95912272dfa4c 100644 --- a/setup/src/Magento/Setup/Model/DependencyReadinessCheck.php +++ b/setup/src/Magento/Setup/Model/DependencyReadinessCheck.php @@ -17,6 +17,11 @@ */ class DependencyReadinessCheck { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var ComposerJsonFinder */ @@ -49,18 +54,23 @@ class DependencyReadinessCheck * @param DirectoryList $directoryList * @param File $file * @param MagentoComposerApplicationFactory $composerAppFactory + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( ComposerJsonFinder $composerJsonFinder, DirectoryList $directoryList, File $file, - MagentoComposerApplicationFactory $composerAppFactory + MagentoComposerApplicationFactory $composerAppFactory, + \Magento\Framework\Escaper $escaper = null ) { $this->composerJsonFinder = $composerJsonFinder; $this->directoryList = $directoryList; $this->file = $file; $this->requireUpdateDryRunCommand = $composerAppFactory->createRequireUpdateDryRunCommand(); $this->magentoComposerApplication = $composerAppFactory->create(); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -91,7 +101,7 @@ public function runReadinessCheck(array $packages) $this->requireUpdateDryRunCommand->run($packages, $workingDir); return ['success' => true]; } catch (\RuntimeException $e) { - $message = str_replace(PHP_EOL, '<br/>', htmlspecialchars($e->getMessage())); + $message = str_replace(PHP_EOL, '<br/>', $this->escaper->escapeHtml($e->getMessage())); return ['success' => false, 'error' => $message]; } } diff --git a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php index 757ee99f7f1ba..ac00af3b8c1db 100644 --- a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php +++ b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php @@ -15,6 +15,11 @@ */ class UninstallDependencyCheck { + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * @var ComposerInformation */ @@ -38,15 +43,20 @@ class UninstallDependencyCheck * @param ComposerInformation $composerInfo * @param DependencyChecker $dependencyChecker * @param ThemeDependencyCheckerFactory $themeDependencyCheckerFactory + * @param \Magento\Framework\Escaper|null $escaper */ public function __construct( ComposerInformation $composerInfo, DependencyChecker $dependencyChecker, - ThemeDependencyCheckerFactory $themeDependencyCheckerFactory + ThemeDependencyCheckerFactory $themeDependencyCheckerFactory, + \Magento\Framework\Escaper $escaper = null ) { $this->composerInfo = $composerInfo; $this->packageDependencyChecker = $dependencyChecker; $this->themeDependencyChecker = $themeDependencyCheckerFactory->create(); + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** @@ -97,7 +107,7 @@ public function runUninstallReadinessCheck(array $packages) return ['success' => true]; } catch (\RuntimeException $e) { - $message = str_replace(PHP_EOL, '<br/>', htmlspecialchars($e->getMessage())); + $message = str_replace(PHP_EOL, '<br/>', $this->escaper->escapeHtml($e->getMessage())); return ['success' => false, 'error' => $message]; } } From 2a37cb1a43afe98a7cadafdd5c907a469a76cf49 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Fri, 17 May 2019 14:51:41 -0500 Subject: [PATCH 140/464] MAGETWO-99479: Use Escaper methods - update to escaper methods --- .../testsuite/Magento/CatalogSearch/Controller/ResultTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php index 4cd0f124b6e46..4f8a279a59165 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/ResultTest.php @@ -33,13 +33,15 @@ public function testIndexActionTranslation() public function testIndexActionXSSQueryVerification() { + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Framework\Escaper::class); $this->getRequest()->setParam('q', '<script>alert(1)</script>'); $this->dispatch('catalogsearch/result'); $responseBody = $this->getResponse()->getBody(); $data = '<script>alert(1)</script>'; $this->assertNotContains($data, $responseBody); - $this->assertContains(htmlspecialchars($data, ENT_COMPAT, 'UTF-8', false), $responseBody); + $this->assertContains($escaper->escapeHtml($data), $responseBody); } /** From b85d14005e764273e32213ab23112ff798c4c148 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Fri, 17 May 2019 17:48:19 -0500 Subject: [PATCH 141/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../view/adminhtml/templates/catalog/category/tree.phtml | 2 +- .../Catalog/view/frontend/templates/product/view/form.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index 382f5b4016742..b2d33f0d12b9d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -389,7 +389,7 @@ containerScroll: true, selModel: new Ext.tree.CheckNodeMultiSelectionModel(), rootVisible: '<?= (bool)$block->getRoot()->getIsVisible() ?>', - useAjax: <?= (bool)$block->getUseAjax() ?>, + useAjax: <?= $block->escapeJs($block->getUseAjax()) ?>, switchTreeUrl: '<?= $block->escapeJs($block->escapeUrl($block->getSwitchTreeUrl())) ?>', editUrl: '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>', currentNodeId: <?= (int)$block->getCategoryId() ?>, diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml index 0b1a2c4d6a6dc..8d298aec9f1cb 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml @@ -17,7 +17,7 @@ <div class="product-add-form"> <form data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" - action="<?= $block->escapeJs($block->escapeUrl($block->getSubmitUrl($_product))) ?>" method="post" + action="<?= $block->escapeUrl($block->getSubmitUrl($_product)) ?>" method="post" id="product_addtocart_form"<?php if ($_product->getOptions()) :?> enctype="multipart/form-data"<?php endif; ?>> <input type="hidden" name="product" value="<?= (int)$_product->getId() ?>" /> <input type="hidden" name="selected_configurable_option" value="" /> From 430dd1ccb5d3667012fd39ff645d1072a528ce5c Mon Sep 17 00:00:00 2001 From: Aapo Kiiso <aapo@lamia.fi> Date: Sat, 18 May 2019 16:41:02 +0300 Subject: [PATCH 142/464] Mark Elasticsearch 6 support for synonyms --- .../Magento/Elasticsearch6/etc/search_engine.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/code/Magento/Elasticsearch6/etc/search_engine.xml diff --git a/app/code/Magento/Elasticsearch6/etc/search_engine.xml b/app/code/Magento/Elasticsearch6/etc/search_engine.xml new file mode 100644 index 0000000000000..40bc69bfd8298 --- /dev/null +++ b/app/code/Magento/Elasticsearch6/etc/search_engine.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<engines xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Search/etc/search_engine.xsd"> + <engine name="elasticsearch6"> + <feature name="synonyms" support="true" /> + </engine> +</engines> From b95b1517c6e7d955bba888c2a56a21c8affc1934 Mon Sep 17 00:00:00 2001 From: Yurii Borysov <yurii_borysov@epam.com> Date: Mon, 20 May 2019 12:31:39 +0300 Subject: [PATCH 143/464] MAGETWO-80120: Magento\Framework\App\Test\Unit\BootstrapTest reset error handler to \Exception - Fix failing unit tests --- .../Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php | 2 +- .../Framework/Unserialize/Test/Unit/UnserializeTest.php | 4 ++++ .../Framework/View/Test/Unit/TemplateEngine/PhpTest.php | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php index 4e0c129204012..b43a37a41388b 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php @@ -312,7 +312,7 @@ public function testBuildUnknownIndexColumn(array $columns, array $references, a Schema::class, ['resourceConnection' => $resourceConnectionMock] ); - $this->expectException(\Exception::class); + $this->expectException(\PHPUnit\Framework\Exception::class); $this->expectExceptionMessage( 'User Warning: Column unknown_column does not exist for index/constraint FIRST_INDEX in table second_table.' ); diff --git a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php index f053a9afff74d..11254c58f1fa4 100644 --- a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php +++ b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php @@ -52,6 +52,10 @@ public function testUnserializeArray() */ public function testUnserializeObject($serialized) { + $this->expectException(\PHPUnit\Framework\Exception::class); + $this->expectExceptionMessage( + 'String contains serialized object' + ); $this->assertFalse($this->unserialize->unserialize($serialized)); } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php index 5b9f8935a0938..5a29dae100d9e 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php @@ -55,7 +55,7 @@ public function testRender() * Test the render() function with a nonexistent filename. * * Expect an exception if the specified file does not exist. - * @expectedException \Exception + * @expectedException PHPUnit\Framework\Exception */ public function testRenderException() { @@ -66,6 +66,7 @@ public function testRenderException() )->disableOriginalConstructor()->getMock(); $filename = 'This_is_not_a_file'; + $this->_phpEngine->render($blockMock, $filename); } From 5e0dcaf9c80cbe8c045893365e6f4026bd57897e Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Mon, 20 May 2019 10:11:48 +0300 Subject: [PATCH 144/464] MAGETWO-99695: [MAGENTO CLOUD] The Update and Cancel buttons are missing in WYSIWYG editor in IE11 --- .../base/web/tiny_mce/themes/advanced/js/source_editor.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tiny_mce/themes/advanced/js/source_editor.js b/app/code/Magento/Tinymce3/view/base/web/tiny_mce/themes/advanced/js/source_editor.js index 9cf6b1a29cdaf..e90ee4d99628d 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tiny_mce/themes/advanced/js/source_editor.js +++ b/app/code/Magento/Tinymce3/view/base/web/tiny_mce/themes/advanced/js/source_editor.js @@ -10,8 +10,9 @@ function onLoadInit() { tinyMCEPopup.resizeToInnerSize(); // Remove Gecko spellchecking - if (tinymce.isGecko) - document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + if (tinymce.isGecko) { + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck", false); + } document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); From 323ab3d3595ee17c78cb8ffbccb7f3cbe6c1ce40 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 16:20:38 +0530 Subject: [PATCH 145/464] #16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 46 ++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 731f55ca7c9d0..b12956e5b3912 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -168,21 +168,57 @@ public function getRegionCollection() } return $collection; } + + /** + * @return string + * + * @deprecated + * @see getRegionSelect() method for more configuration + */ + public function getRegionHtmlSelect() + { + \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); + $cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . $this->_storeManager->getStore()->getId(); + $cache = $this->_configCacheType->load($cacheKey); + if ($cache) { + $options = $this->getSerializer()->unserialize($cache); + } else { + $options = $this->getRegionCollection()->toOptionArray(); + $this->_configCacheType->save($this->getSerializer()->serialize($options), $cacheKey); + } + $html = $this->getLayout()->createBlock( + \Magento\Framework\View\Element\Html\Select::class + )->setName( + 'region' + )->setTitle( + __('State/Province') + )->setId( + 'state' + )->setClass( + 'required-entry validate-state' + )->setValue( + intval($this->getRegionId()) + )->setOptions( + $options + )->getHtml(); + \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); + return $html; + } /** * Returns region html select * - * @param null|string $defValue + * @param null|string $value * @param string $name * @param string $id * @param string $title * @return string */ - public function getRegionHtmlSelect($defValue = null,$name = 'region', $id = 'state', $title = 'State/Province') + public function getRegionSelect($value = null, $name = 'region', $id = 'state', $title = 'State/Province') { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); - if ($defValue === null) { - $defValue = (int)$this->getRegionId(); + if ($value === null) { + $value = (int)$this->getRegionId(); } $cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . $this->_storeManager->getStore()->getId(); $cache = $this->_configCacheType->load($cacheKey); @@ -203,7 +239,7 @@ public function getRegionHtmlSelect($defValue = null,$name = 'region', $id = 'st )->setClass( 'required-entry validate-state' )->setValue( - $defValue + $value )->setOptions( $options )->getHtml(); From 79419c0054a1675afb3340cf05ac37ebb49abf6e Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 17:11:52 +0530 Subject: [PATCH 146/464] #16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 34 +++-------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index b12956e5b3912..68abf2f479b09 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -168,41 +168,15 @@ public function getRegionCollection() } return $collection; } - + /** * @return string - * * @deprecated - * @see getRegionSelect() method for more configuration + * @see getRegionSelect() method for more configurations */ public function getRegionHtmlSelect() { - \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); - $cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . $this->_storeManager->getStore()->getId(); - $cache = $this->_configCacheType->load($cacheKey); - if ($cache) { - $options = $this->getSerializer()->unserialize($cache); - } else { - $options = $this->getRegionCollection()->toOptionArray(); - $this->_configCacheType->save($this->getSerializer()->serialize($options), $cacheKey); - } - $html = $this->getLayout()->createBlock( - \Magento\Framework\View\Element\Html\Select::class - )->setName( - 'region' - )->setTitle( - __('State/Province') - )->setId( - 'state' - )->setClass( - 'required-entry validate-state' - )->setValue( - intval($this->getRegionId()) - )->setOptions( - $options - )->getHtml(); - \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); - return $html; + return $this->getRegionSelect(); } /** @@ -239,7 +213,7 @@ public function getRegionSelect($value = null, $name = 'region', $id = 'state', )->setClass( 'required-entry validate-state' )->setValue( - $value + (int)$value )->setOptions( $options )->getHtml(); From 53b038645a978be1d1d6386b0eaa68de528bfdb9 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 17:14:26 +0530 Subject: [PATCH 147/464] #16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 68abf2f479b09..034a84d410fb2 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. From f1093258df3752c1e2cc2effed3d5857b5146f1b Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 17:39:45 +0530 Subject: [PATCH 148/464] #16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 034a84d410fb2..257134bcd9f26 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -171,6 +171,8 @@ public function getRegionCollection() } /** + * Returns region html select + * * @return string * @deprecated * @see getRegionSelect() method for more configurations From 575feed9da4b607c32652a40b7973aa2a8b9b784 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 18:01:21 +0530 Subject: [PATCH 149/464] #16445 - getRegionHtmlSelect does not have configuration - resolved - static test fix --- app/code/Magento/Directory/Block/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 257134bcd9f26..6dfd8e791e68e 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -172,7 +172,7 @@ public function getRegionCollection() /** * Returns region html select - * + * * @return string * @deprecated * @see getRegionSelect() method for more configurations From 49bc991fb56630bbcf6642ee195d8f988d63111d Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Mon, 20 May 2019 18:14:21 +0530 Subject: [PATCH 150/464] #16445 - getRegionHtmlSelect does not have configuration - resolved - static test fix --- app/code/Magento/Directory/Block/Data.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 6dfd8e791e68e..516ee2c3c6bf1 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -1,5 +1,4 @@ <?php -declare(strict_types=1); /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. From 57c7a8be5b949af9632fc1649a8ab4ce88964dbe Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 20 May 2019 10:56:06 -0500 Subject: [PATCH 151/464] MAGETWO-99479: Use Escaper methods - fix static --- .../Framework/View/Test/Unit/Page/ConfigTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php index 44e6e878a18c1..a1d522032a188 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php @@ -19,6 +19,9 @@ */ class ConfigTest extends \PHPUnit\Framework\TestCase { + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + private $objectManager; + /** * @var Config */ @@ -90,6 +93,10 @@ protected function setUp() $this->localeMock->expects($this->any()) ->method('getLocale') ->willReturn(Resolver::DEFAULT_LOCALE); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $escaper = $this->objectManager->getObject( + \Magento\Framework\Escaper::class + ); $this->model = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject( \Magento\Framework\View\Page\Config::class, @@ -98,7 +105,8 @@ protected function setUp() 'pageAssets' => $this->pageAssets, 'scopeConfig' => $this->scopeConfig, 'favicon' => $this->favicon, - 'localeResolver' => $this->localeMock + 'localeResolver' => $this->localeMock, + 'escaper' => $escaper ] ); From 90765154e1df7f962706afd2b7a6e8061b36f8f4 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Mon, 20 May 2019 11:27:42 -0500 Subject: [PATCH 152/464] MC-16233: Be the First to Review Product' link is broken --- .../view/frontend/web/js/process-reviews.js | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Review/view/frontend/web/js/process-reviews.js b/app/code/Magento/Review/view/frontend/web/js/process-reviews.js index 690c7dd917f4b..9d1083d662d5a 100644 --- a/app/code/Magento/Review/view/frontend/web/js/process-reviews.js +++ b/app/code/Magento/Review/view/frontend/web/js/process-reviews.js @@ -50,18 +50,23 @@ define([ $(function () { $('.product-info-main .reviews-actions a').click(function (event) { - var anchor; + var anchor, addReviewBlock; event.preventDefault(); anchor = $(this).attr('href').replace(/^.*?(#|$)/, ''); - $('.product.data.items [data-role="content"]').each(function (index) { //eslint-disable-line - if (this.id == 'reviews') { //eslint-disable-line eqeqeq - $('.product.data.items').tabs('activate', index); - $('html, body').animate({ - scrollTop: $('#' + anchor).offset().top - 50 - }, 300); - } - }); + addReviewBlock = $('.block.review-add .block-content #' + anchor); + + if (addReviewBlock.length) { + $('.product.data.items [data-role="content"]').each(function (index) { //eslint-disable-line + if (this.id == 'reviews') { //eslint-disable-line eqeqeq + $('.product.data.items').tabs('activate', index); + } + }); + $('html, body').animate({ + scrollTop: addReviewBlock.offset().top - 50 + }, 300); + } + }); }); }; From 009142c4c17cd8f8ea8526bdedcf50339c5bb0c5 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Mon, 20 May 2019 14:49:06 -0500 Subject: [PATCH 153/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../view/adminhtml/templates/items/price/row.phtml | 2 +- .../Tax/view/adminhtml/templates/rate/title.phtml | 4 ++-- .../Tax/view/adminhtml/templates/rule/edit.phtml | 2 +- .../view/adminhtml/templates/toolbar/rate/save.phtml | 2 +- .../base/templates/pricing/adjustment/bundle.phtml | 2 +- .../frontend/templates/checkout/grandtotal.phtml | 4 ++-- .../view/frontend/templates/checkout/shipping.phtml | 6 +++--- .../view/frontend/templates/checkout/subtotal.phtml | 4 ++-- .../Tax/view/frontend/templates/checkout/tax.phtml | 12 ++++++------ .../Tax/view/frontend/templates/order/tax.phtml | 6 +++--- .../onepage/review/item/price/row_excl_tax.phtml | 6 +++--- .../onepage/review/item/price/row_incl_tax.phtml | 6 +++--- .../onepage/review/item/price/unit_excl_tax.phtml | 6 +++--- .../onepage/review/item/price/unit_incl_tax.phtml | 6 +++--- .../view/frontend/templates/item/price/row.phtml | 12 ++++++------ .../view/frontend/templates/item/price/unit.phtml | 12 ++++++------ 16 files changed, 46 insertions(+), 46 deletions(-) diff --git a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml index e6de067a4de64..4d680dc072e52 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml @@ -22,7 +22,7 @@ $_item = $block->getItem(); <?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?> <div class="price-incl-tax"> <?php if ($block->displayBothPrices()) : ?> - <span class="label"><?= $block->escapeHtml(('Incl. Tax')) ?>:</span> + <span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span> <?php endif; ?> <?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?> <?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBaseSubtotalInclTax($_item); ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml index 3d6d3d19dc314..7dd6f6cee8c63 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml @@ -15,8 +15,8 @@ <input class="admin__control-text<?php if ($_store->getId() == 0) : ?> required-entry<?php endif; ?>" type="text" - name="title[<?= (int)$_store->getId() ?>]" - value="<?= $block->escapeHtmlAttr($_labels[$_store->getId()]) ?>" /> + name="title[<?= (int) $_store->getId() ?>]" + value="<?= $block->escapeHtmlAttr($_labels[(int) $_store->getId()]) ?>" /> </div> </div> <?php endforeach; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml index 1ad16feef9690..81bdd874ead6c 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml @@ -113,7 +113,7 @@ require([ toggleAddButton:false, addText: '<?= $block->escapeJs($block->escapeHtml(__('Add New Tax Rate'))) ?>', parse: null, - nextPageUrl: '<?= $block->escapeHtml($block->getTaxRatesPageUrl())?>', + nextPageUrl: '<?= $block->escapeHtml($block->getTaxRatesPageUrl()) ?>', selectedValues: this.settings.selected_values, mselectInputSubmitCallback: function (value, options) { var select = $('#tax_rate'); diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml index 5e3ef15da5482..58c79bbfe9715 100644 --- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml @@ -12,7 +12,7 @@ "mage/mage" ], function($){ - $('#<?= $block->escapeHtml($form->getForm()->getId()) ?>').mage('form').mage('validation'); + $('#<?= $block->escapeJs($form->getForm()->getId()) ?>').mage('form').mage('validation'); $(document).ready(function () { 'use strict'; diff --git a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml index 9e60dc983e3ac..41430c0fbcfa8 100644 --- a/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml +++ b/app/code/Magento/Tax/view/base/templates/pricing/adjustment/bundle.phtml @@ -13,6 +13,6 @@ <?php elseif ($block->displayBothPrices()) : ?> <?= /* @noEscape */ $block->getDisplayAmount() ?> <?php if ($block->getDisplayAmountExclTax() !== $block->getDisplayAmount()) : ?> - (+<?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> <?= $block->escapeHtml(__('Excl. Tax'))?>) + (+<?= /* @noEscape */ $block->getDisplayAmountExclTax() ?> <?= $block->escapeHtml(__('Excl. Tax')) ?>) <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml index ee8ae505aa9e5..df177b6180511 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/grandtotal.phtml @@ -12,7 +12,7 @@ ?> <?php $style = $block->escapeHtmlAttr($block->getStyle()); -$colspan = (int)$block->getColspan(); +$colspan = (int) $block->getColspan(); ?> <?php if ($block->includeTax() && $block->getTotalExclTax() >= 0) : ?> <tr class="grand totals excl"> @@ -41,4 +41,4 @@ $colspan = (int)$block->getColspan(); <strong><?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> -<?php endif;?> +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml index ffbb33487136d..3f5a55e5fa325 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/shipping.phtml @@ -14,7 +14,7 @@ <?php if ($block->displayShipping()) : ?> <?php $style = $block->escapeHtmlAttr($block->getStyle()); - $colspan = (int)$block->getColspan(); + $colspan = (int) $block->getColspan(); ?> <?php if ($block->displayBoth()) : ?> <tr class="totals shipping excl"> @@ -42,7 +42,7 @@ <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> - <?php else :?> + <?php else : ?> <tr class="totals shipping excl"> <th style="<?= /* @noEscape */ $style ?>" class="mark" colspan="<?= /* @noEscape */ $colspan ?>" scope="row"> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> @@ -51,5 +51,5 @@ <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> - <?php endif;?> + <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml index 914e5bda9abc6..010a7b8dcfe4a 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/subtotal.phtml @@ -13,7 +13,7 @@ ?> <?php $style = $block->escapeHtmlAttr($block->getStyle()); -$colspan = (int)$block->getColspan(); +$colspan = (int) $block->getColspan(); ?> <?php if ($block->displayBoth()) : ?> <tr class="totals sub excl"> @@ -41,4 +41,4 @@ $colspan = (int)$block->getColspan(); <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) ?> </td> </tr> -<?php endif;?> +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml index 01dbeb68a0344..0329db406fa16 100644 --- a/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/checkout/tax.phtml @@ -23,12 +23,12 @@ if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary() && $_va ?> <tr <?= /* @noEscape */ $attributes ?>> - <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= (int)$block->getColspan() ?>" scope="row"> + <th style="<?= /* @noEscape */ $_style ?>" class="mark" colspan="<?= (int) $block->getColspan() ?>" scope="row"> <?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary()) : ?> <span class="detailed"><?= $block->escapeHtml($block->getTotal()->getTitle()) ?></span> <?php else : ?> <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> - <?php endif;?> + <?php endif; ?> </th> <td style="<?= /* @noEscape */ $_style ?>" class="amount" data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>"> <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($_value) ?> @@ -45,15 +45,15 @@ if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary() && $_va <?php foreach ($rates as $rate) : ?> <tr class="totals-tax-details"> - <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= (int)$block->getColspan() ?>" scope="row"> + <th class="mark" style="<?= /* @noEscape */ $_style ?>" colspan="<?= (int) $block->getColspan() ?>" scope="row"> <?= $block->escapeHtml($rate['title']) ?> <?php if ($rate['percent'] !== null) : ?> - (<?= (float)$rate['percent'] ?>%) + (<?= (float) $rate['percent'] ?>%) <?php endif; ?> </th> <?php if ($isFirst) : ?> <td style="<?= /* @noEscape */ $_style ?>" class="amount" rowspan="<?= count($rates) ?>" - data-th="<?= $block->escapeHtmlAttr($rate['title']) ?><?php if ($rate['percent'] !== null) : ?>(<?= (float)$rate['percent'] ?>%)<?php endif; ?>"> + data-th="<?= $block->escapeHtmlAttr($rate['title']) ?><?php if ($rate['percent'] !== null) : ?>(<?= (float) $rate['percent'] ?>%)<?php endif; ?>"> <?= /* @noEscape */ $this->helper(\Magento\Checkout\Helper\Data::class)->formatPrice($amount) ?> </td> <?php endif; ?> @@ -61,4 +61,4 @@ if ($this->helper(\Magento\Tax\Helper\Data::class)->displayFullSummary() && $_va <?php $isFirst = 0; ?> <?php endforeach; ?> <?php endforeach; ?> -<?php endif;?> +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml index d1346b499975c..5e6f4e5277a30 100644 --- a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml @@ -24,7 +24,7 @@ <td <?= /* @noEscape */ $block->getLabelProperties() ?>> <?= $block->escapeHtml($title) ?> <?php if ($percent !== null) : ?> - (<?= (float)$percent ?>%) + (<?= (float) $percent ?>%) <?php endif; ?> <br /> </td> @@ -33,7 +33,7 @@ </td> </tr> <?php endforeach; ?> -<?php endif;?> +<?php endif; ?> <?php if ($block->displayFullSummary() && $_fullInfo && !$block->getIsPlaneMode()) : ?> <tr class="totals-tax-summary"> @@ -47,7 +47,7 @@ <div class="detailed"><?= $block->escapeHtml(__('Tax')) ?></div> <?php else : ?> <?= $block->escapeHtml(__('Tax')) ?> - <?php endif;?> + <?php endif; ?> </th> <td <?= /* @noEscape */ $block->getValueProperties() ?> data-th="<?= $block->escapeHtmlAttr(__('Tax')) ?>"> <?= /* @noEscape */ $_order->formatPrice($_source->getTaxAmount()) ?> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml index e1f4207f3740c..15abae5c889fe 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_excl_tax.phtml @@ -11,7 +11,7 @@ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int) $_item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -19,7 +19,7 @@ $_item = $block->getItem(); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int) $_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount'], true, true) ?></span> @@ -28,7 +28,7 @@ $_item = $block->getItem(); </span> <?php if ($block->displayFinalPrice()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int) $_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml index 1189c1b9ba2fb..b848698b8b829 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/row_incl_tax.phtml @@ -14,7 +14,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); ?> <?php $_incl = $_item->getRowTotalInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int) $_item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -22,7 +22,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> - <span class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="subtotal-item-tax-details<?= (int) $_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span> @@ -31,7 +31,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); </span> <?php if ($block->displayFinalPrice()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int) $_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml index 809d8ac90e12e..a485de90c871d 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_excl_tax.phtml @@ -11,7 +11,7 @@ $_item = $block->getItem(); ?> <?php if ($block->displayPriceWithWeeeDetails()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int) $_item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -19,7 +19,7 @@ $_item = $block->getItem(); <?= /* @noEscape */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?> </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$_item->getId() ?>" style="display:none;"> + <span class="cart-tax-info" id="eunit-item-tax-details<?= (int) $_item->getId() ?>" style="display:none;"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount'], true, true) ?></span> @@ -28,7 +28,7 @@ $_item = $block->getItem(); </span> <?php if ($block->displayFinalPrice()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int) $_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml index 81ec8c1c6795b..0dada610e181e 100644 --- a/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/checkout/onepage/review/item/price/unit_incl_tax.phtml @@ -14,7 +14,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); ?> <?php $_incl = $_item->getPriceInclTax(); ?> <?php if ($block->displayPriceWithWeeeDetails()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int) $_item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -23,7 +23,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item)) : ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$_item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= (int) $_item->getId() ?>" style="display: none;"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($_item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"><?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?></span> @@ -32,7 +32,7 @@ $_weeeHelper = $this->helper(\Magento\Weee\Helper\Data::class); </span> <?php if ($block->displayFinalPrice()) : ?> - <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$_item->getId() ?>"}}'> + <span class="cart-tax-total" data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int) $_item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml index afecc8be030a4..37aa852871408 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/row.phtml @@ -14,7 +14,7 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int) $item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -22,7 +22,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> - <div class="cart-tax-info" id="subtotal-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> + <div class="cart-tax-info" id="subtotal-item-tax-details<?= (int) $item->getId() ?>" style="display: none;"> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['row_amount_incl_tax'], true, true) ?> @@ -32,7 +32,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#subtotal-item-tax-details<?= (int) $item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?> </span> @@ -46,7 +46,7 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int) $item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -54,7 +54,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> - <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int)$item->getId() ?>" + <span class="cart-tax-info" id="esubtotal-item-tax-details<?= (int) $item->getId() ?>" style="display: none;"> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> @@ -65,7 +65,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#esubtotal-item-tax-details<?= (int) $item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?> </span> diff --git a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml index 8c52144aeb7eb..4e62409ad00f4 100644 --- a/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/item/price/unit.phtml @@ -14,7 +14,7 @@ $item = $block->getItem(); <span class="price-including-tax" data-label="<?= $block->escapeHtmlAttr(__('Incl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int) $item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -22,7 +22,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> - <span class="cart-tax-info" id="unit-item-tax-details<?= (int)$item->getId() ?>" style="display: none;"> + <span class="cart-tax-info" id="unit-item-tax-details<?= (int) $item->getId() ?>" style="display: none;"> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> <?= /* @noEscape */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?> @@ -32,7 +32,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= (int) $item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total Incl. Tax')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?> </span> @@ -46,7 +46,7 @@ $item = $block->getItem(); <span class="price-excluding-tax" data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"> <?php if ($block->displayPriceWithWeeeDetails()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int) $item->getId() ?>"}}'> <?php else : ?> <span class="cart-price"> <?php endif; ?> @@ -54,7 +54,7 @@ $item = $block->getItem(); </span> <?php if ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item)) : ?> - <span class="cart-tax-info" id="eunit-item-tax-details<?= (int)$item->getId() ?>" + <span class="cart-tax-info" id="eunit-item-tax-details<?= (int) $item->getId() ?>" style="display: none;"> <?php foreach ($this->helper(\Magento\Weee\Helper\Data::class)->getApplied($item) as $tax) : ?> <span class="weee" data-label="<?= $block->escapeHtmlAttr($tax['title']) ?>"> @@ -65,7 +65,7 @@ $item = $block->getItem(); <?php if ($block->displayFinalPrice()) : ?> <span class="cart-tax-total" - data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int)$item->getId() ?>"}}'> + data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= (int) $item->getId() ?>"}}'> <span class="weee" data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"> <?= /* @noEscape */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?> </span> From ce2d35752a5973f651ea79f17e6e87153810be79 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Mon, 20 May 2019 16:08:55 -0500 Subject: [PATCH 154/464] MAGETWO-99479: Use Escaper methods - replace phpcs:disable --- app/code/Magento/Email/Model/Template/Filter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index aeaa972d9984c..aa018d6fd44d6 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -689,8 +689,7 @@ protected function applyModifiers($value, $modifiers) $callback = $modifier; } array_unshift($params, $value); - // phpcs:disable Magento2.Functions.DiscouragedFunction - $value = call_user_func_array($callback, $params); + $value = $callback(...$params); } } return $value; From d3581c4620c81769ca9bcdac8949c7ee44fba8f5 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 20 May 2019 17:10:42 -0500 Subject: [PATCH 155/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../view/adminhtml/templates/catalog/category/widget/tree.phtml | 2 +- .../view/frontend/templates/product/view/addtocart.phtml | 2 +- .../view/frontend/templates/product/view/attribute.phtml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml index 4113a52877ef1..e24d676974b01 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml @@ -42,7 +42,7 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { if (firstLoad) { <?php if ($block->getNodeClickListener()) :?> - this.addListener('click', <?= $block->escapeJs($block->getNodeClickListener()) ?>.createDelegate(this)); + this.addListener('click', <?= /* @noEscape */ $block->getNodeClickListener() ?>.createDelegate(this)); <?php endif; ?> } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml index 60fcc8c2c167a..f15824595f0ba 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml @@ -22,7 +22,7 @@ value="<?= $block->getProductDefaultQty() * 1 ?>" title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="input-text qty" - data-validate="<?= /* @noEscape */ json_encode($block->getQuantityValidators()) ?>" + data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" /> </div> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml index 6077fa8f8cabf..2e022a5df14ed 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml @@ -45,6 +45,6 @@ if ($_attributeType && $_attributeType == 'text') { <?php if ($renderLabel) :?> <strong class="type"><?= $block->escapeHtml($_attributeLabel) ?></strong> <?php endif; ?> - <div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>><?= $block->escapeHtmlAttr($_attributeValue) ?></div> + <div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>><?= /* @noEscape */ $_attributeValue ?></div> </div> <?php endif; ?> From ab39d6ca06705318330cf84aac50a7120a1e22ed Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Tue, 21 May 2019 15:53:16 +0530 Subject: [PATCH 156/464] #16445 - getRegionHtmlSelect does not have configuration - added typehints for method arguments and return typehint --- app/code/Magento/Directory/Block/Data.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 516ee2c3c6bf1..c569c0c52e475 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. @@ -176,7 +177,7 @@ public function getRegionCollection() * @deprecated * @see getRegionSelect() method for more configurations */ - public function getRegionHtmlSelect() + public function getRegionHtmlSelect(): string { return $this->getRegionSelect(); } @@ -190,7 +191,7 @@ public function getRegionHtmlSelect() * @param string $title * @return string */ - public function getRegionSelect($value = null, $name = 'region', $id = 'state', $title = 'State/Province') + public function getRegionSelect(string $value = null, string $name = 'region', string $id = 'state', string $title = 'State/Province'): string { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); if ($value === null) { From 1bfad970a870409e492ec16827271c4c2221c002 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Tue, 21 May 2019 16:05:38 +0530 Subject: [PATCH 157/464] #16445 - getRegionHtmlSelect does not have configuration - added typehints for method arguments and return typehint --- app/code/Magento/Directory/Block/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index c569c0c52e475..b27c1bc603a91 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -191,7 +191,7 @@ public function getRegionHtmlSelect(): string * @param string $title * @return string */ - public function getRegionSelect(string $value = null, string $name = 'region', string $id = 'state', string $title = 'State/Province'): string + public function getRegionSelect(int $value = null, string $name = 'region', string $id = 'state', string $title = 'State/Province'): string { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); if ($value === null) { From c9f30a6f2f2ef0264252270a5331c500b5e3ba62 Mon Sep 17 00:00:00 2001 From: Oleksandr Kravchuk <swnsma@gmail.com> Date: Tue, 21 May 2019 14:51:12 +0300 Subject: [PATCH 158/464] Update Data.php --- app/code/Magento/Directory/Block/Data.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index b27c1bc603a91..cb8a517ea0013 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -1,9 +1,10 @@ <?php -declare(strict_types=1); /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Directory\Block; /** @@ -185,14 +186,18 @@ public function getRegionHtmlSelect(): string /** * Returns region html select * - * @param null|string $value + * @param null|int $value * @param string $name * @param string $id * @param string $title * @return string */ - public function getRegionSelect(int $value = null, string $name = 'region', string $id = 'state', string $title = 'State/Province'): string - { + public function getRegionSelect( + ?int $value = null, + string $name = 'region', + string $id = 'state', + string $title = 'State/Province' + ): string { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); if ($value === null) { $value = (int)$this->getRegionId(); @@ -216,7 +221,7 @@ public function getRegionSelect(int $value = null, string $name = 'region', stri )->setClass( 'required-entry validate-state' )->setValue( - (int)$value + $value )->setOptions( $options )->getHtml(); From bbfadc74786bc701d9bc1a3916526da0fc1223d9 Mon Sep 17 00:00:00 2001 From: Oleksandr Kravchuk <swnsma@gmail.com> Date: Tue, 21 May 2019 14:52:21 +0300 Subject: [PATCH 159/464] Update Data.php --- app/code/Magento/Directory/Block/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index cb8a517ea0013..d4c46469e4771 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -178,7 +178,7 @@ public function getRegionCollection() * @deprecated * @see getRegionSelect() method for more configurations */ - public function getRegionHtmlSelect(): string + public function getRegionHtmlSelect() { return $this->getRegionSelect(); } From 70a3adf0e307f23a3e9bd787bad8dd094873b41f Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 17 May 2019 15:25:29 +0300 Subject: [PATCH 160/464] magento/magento2#22870: ProductRepository fails to update an existing product with a changed SKU. --- .../Catalog/Model/ProductRepository.php | 34 ++++++++---- .../Test/Unit/Model/ProductRepositoryTest.php | 16 +++--- .../Catalog/Model/ProductRepositoryTest.php | 52 ++++++++++++++++++- 3 files changed, 84 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index c87b6e9763205..91a2ac1c5e1e8 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -369,8 +369,11 @@ protected function initializeProductData(array $productData, $createNew) if ($createNew) { $product = $this->productFactory->create(); $this->assignProductToWebsites($product); + } elseif (!empty($productData['id'])) { + $this->removeProductFromLocalCacheById($productData['id']); + $product = $this->getById($productData['id']); } else { - $this->removeProductFromLocalCache($productData['sku']); + $this->removeProductFromLocalCacheBySku($productData['sku']); $product = $this->get($productData['sku']); } @@ -512,7 +515,7 @@ public function save(ProductInterface $product, $saveOptions = false) $tierPrices = $product->getData('tier_price'); try { - $existingProduct = $this->get($product->getSku()); + $existingProduct = $product->getId() ? $this->getById($product->getId()) : $this->get($product->getSku()); $product->setData( $this->resourceModel->getLinkField(), @@ -570,7 +573,7 @@ public function save(ProductInterface $product, $saveOptions = false) $product->getCategoryIds() ); } - $this->removeProductFromLocalCache($product->getSku()); + $this->removeProductFromLocalCacheBySku($product->getSku()); unset($this->instancesById[$product->getId()]); return $this->get($product->getSku(), false, $product->getStoreId()); @@ -584,7 +587,7 @@ public function delete(ProductInterface $product) $sku = $product->getSku(); $productId = $product->getId(); try { - $this->removeProductFromLocalCache($product->getSku()); + $this->removeProductFromLocalCacheBySku($product->getSku()); unset($this->instancesById[$product->getId()]); $this->resourceModel->delete($product); } catch (ValidatorException $e) { @@ -595,7 +598,7 @@ public function delete(ProductInterface $product) $e ); } - $this->removeProductFromLocalCache($sku); + $this->removeProductFromLocalCacheBySku($sku); unset($this->instancesById[$productId]); return true; @@ -753,25 +756,36 @@ private function getProductFromLocalCache(string $sku, string $cacheKey) } /** - * Removes product in the local cache. + * Removes product in the local cache by sku. * * @param string $sku * @return void */ - private function removeProductFromLocalCache(string $sku) :void + private function removeProductFromLocalCacheBySku(string $sku): void { $preparedSku = $this->prepareSku($sku); unset($this->instances[$preparedSku]); } /** - * Saves product in the local cache. + * Removes product in the local cache by id. + * + * @param string $id + * @return void + */ + private function removeProductFromLocalCacheById(string $id): void + { + unset($this->instancesById[$id]); + } + + /** + * Saves product in the local cache by sku. * * @param Product $product * @param string $cacheKey * @return void */ - private function saveProductInLocalCache(Product $product, string $cacheKey) : void + private function saveProductInLocalCache(Product $product, string $cacheKey): void { $preparedSku = $this->prepareSku($product->getSku()); $this->instances[$preparedSku][$cacheKey] = $product; @@ -800,7 +814,7 @@ private function prepareSku(string $sku): string private function saveProduct($product): void { try { - $this->removeProductFromLocalCache($product->getSku()); + $this->removeProductFromLocalCacheBySku($product->getSku()); unset($this->instancesById[$product->getId()]); $this->resourceModel->save($product); } catch (ConnectionException $exception) { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index cb92cc6c2d523..0dc294e139d3e 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -527,12 +527,14 @@ private function getProductMocksForReducedCache($productsCount) for ($i = 1; $i <= $productsCount; $i++) { $productMock = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getId', 'getSku', 'load', 'setData', - ]) + ] + ) ->getMock(); $productMock->expects($this->once())->method('load'); $productMock->expects($this->atLeastOnce())->method('getId')->willReturn($i); @@ -679,7 +681,7 @@ public function testSaveException() ->willReturn(true); $this->resourceModel->expects($this->once())->method('save')->with($this->product) ->willThrowException(new \Magento\Eav\Model\Entity\Attribute\Exception(__('123'))); - $this->product->expects($this->once())->method('getId')->willReturn(null); + $this->product->expects($this->exactly(2))->method('getId')->willReturn(null); $this->extensibleDataObjectConverter ->expects($this->once()) ->method('toNestedArray') @@ -703,7 +705,7 @@ public function testSaveInvalidProductException() $this->initializationHelper->expects($this->never())->method('initialize'); $this->resourceModel->expects($this->once())->method('validate')->with($this->product) ->willReturn(['error1', 'error2']); - $this->product->expects($this->never())->method('getId'); + $this->product->expects($this->once())->method('getId')->willReturn(null); $this->extensibleDataObjectConverter ->expects($this->once()) ->method('toNestedArray') @@ -1340,11 +1342,13 @@ public function testSaveWithDifferentWebsites() ->willReturn($storeMock); $this->storeManager->expects($this->once()) ->method('getWebsites') - ->willReturn([ + ->willReturn( + [ 1 => ['first'], 2 => ['second'], 3 => ['third'] - ]); + ] + ); $this->product->expects($this->once())->method('setWebsiteIds')->willReturn([2,3]); $this->product->method('getSku')->willReturn('simple'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php index d4016b2bfa8d4..cbde2fa1d2b20 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php @@ -8,6 +8,7 @@ namespace Magento\Catalog\Model; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\TestFramework\Helper\Bootstrap; /** @@ -15,6 +16,7 @@ * * @magentoDbIsolation enabled * @magentoAppIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ProductRepositoryTest extends \PHPUnit\Framework\TestCase { @@ -30,6 +32,16 @@ class ProductRepositoryTest extends \PHPUnit\Framework\TestCase */ private $searchCriteriaBuilder; + /** + * @var ProductFactory + */ + private $productFactory; + + /** + * @var ProductResource + */ + private $productResource; + /** * Sets up common objects */ @@ -42,6 +54,12 @@ protected function setUp() $this->searchCriteriaBuilder = \Magento\Framework\App\ObjectManager::getInstance()->create( \Magento\Framework\Api\SearchCriteriaBuilder::class ); + + $this->productFactory = Bootstrap::getObjectManager()->get(ProductFactory::class); + + $this->productResource = Bootstrap::getObjectManager()->get(ProductResource::class); + + $this->productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); } /** @@ -116,10 +134,15 @@ public function testSaveProductWithGalleryImage(): void $path = $mediaConfig->getBaseMediaPath() . '/magento_image.jpg'; $absolutePath = $mediaDirectory->getAbsolutePath() . $path; - $product->addImageToMediaGallery($absolutePath, [ + $product->addImageToMediaGallery( + $absolutePath, + [ 'image', 'small_image', - ], false, false); + ], + false, + false + ); /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ $productRepository = Bootstrap::getObjectManager() @@ -138,4 +161,29 @@ public function testSaveProductWithGalleryImage(): void $this->assertStringStartsWith('/m/a/magento_image', $product->getData('image')); $this->assertStringStartsWith('/m/a/magento_image', $product->getData('small_image')); } + + /** + * Test Product Repository can change(update) "sku" for given product. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDbIsolation enabled + * @magentoAppArea adminhtml + */ + public function testUpdateProductSku() + { + $newSku = 'simple-edited'; + $productId = $this->productResource->getIdBySku('simple'); + $initialProduct = $this->productFactory->create(); + $this->productResource->load($initialProduct, $productId); + + $initialProduct->setSku($newSku); + $this->productRepository->save($initialProduct); + + $updatedProduct = $this->productFactory->create(); + $this->productResource->load($updatedProduct, $productId); + self::assertSame($newSku, $updatedProduct->getSku()); + + //clean up. + $this->productRepository->delete($updatedProduct); + } } From 17ef505112ade5be47cd7d2fc384547a97766001 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Tue, 21 May 2019 16:47:05 +0300 Subject: [PATCH 161/464] magento/magento2#14384 static-test-fix --- .../Checkout/Model/ShippingInformationManagementTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php index f962ffe1a83a1..369919437526c 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Model/ShippingInformationManagementTest.php @@ -19,6 +19,9 @@ use Magento\Quote\Api\ShipmentEstimationInterface; use Magento\Sales\Api\InvoiceOrderInterface; +/** + * Shipping information managment test. + */ class ShippingInformationManagementTest extends \PHPUnit\Framework\TestCase { /** @var CartManagementInterface */ From 8befc1331ad9175aacb758bcc677d12499c070d4 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Tue, 21 May 2019 14:06:48 -0500 Subject: [PATCH 162/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../Widget/Grid/Column/Filter/TextTest.php | 8 ++++++- .../Adminhtml/Product/Edit/AttributeSet.php | 3 +++ .../Product/Edit/Tab/Attributes/Search.php | 7 ++++++ .../Magento/Catalog/Block/Product/Gallery.php | 22 +++++++++++++++++++ .../Magento/Catalog/Block/Product/View.php | 9 ++++---- .../Catalog/Block/Product/View/Gallery.php | 22 ++++++++++--------- .../product/composite/fieldset/qty.phtml | 6 +---- .../fieldset/options/view/checkable.phtml | 4 ++-- app/code/Magento/Wishlist/Helper/Data.php | 6 ++--- .../Framework/View/Element/AbstractBlock.php | 15 ++++++++----- .../Test/Unit/Element/AbstractBlockTest.php | 15 +++++++++++++ .../View/Test/Unit/Element/MessagesTest.php | 17 +++++++++++++- 12 files changed, 101 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php index 1bf23649e2ea8..90bb073d1f96a 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php @@ -31,7 +31,10 @@ protected function setUp() ->setMethods(['getEscaper']) ->disableOriginalConstructor() ->getMock(); - $this->escaper = $this->createPartialMock(\Magento\Framework\Escaper::class, ['escapeHtml']); + $this->escaper = $this->createPartialMock( + \Magento\Framework\Escaper::class, + ['escapeHtml', 'escapeHtmlAttr'] + ); $this->helper = $this->createMock(\Magento\Framework\DB\Helper::class); $this->context->expects($this->once())->method('getEscaper')->willReturn($this->escaper); @@ -60,6 +63,9 @@ public function testGetHtml() $this->block->setColumn($column); $this->escaper->expects($this->any())->method('escapeHtml')->willReturn('escapedHtml'); + $this->escaper->expects($this->once()) + ->method('escapeHtmlAttr') + ->willReturnCallback(function($string) {return $string;}); $column->expects($this->any())->method('getId')->willReturn('id'); $column->expects($this->once())->method('getHtmlId')->willReturn('htmlId'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php index c22e29008aa4e..d95ee7f8f2cf9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php @@ -11,6 +11,9 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit; +/** + * Admin AttributeSet block + */ class AttributeSet extends \Magento\Backend\Block\Widget\Form { /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index b3e6890adb368..42463354926dd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -11,6 +11,9 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes; +/** + * Admin product attribute search block + */ class Search extends \Magento\Backend\Block\Widget { /** @@ -62,6 +65,8 @@ protected function _construct() } /** + * Get selector options + * * @return array */ public function getSelectorOptions() @@ -110,6 +115,8 @@ public function getSuggestedAttributes($labelPart, $templateId = null) } /** + * Get add attribute url + * * @return string */ public function getAddAttributeUrl() diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index 577708c257d35..54f848a92e958 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -16,6 +16,8 @@ use Magento\Framework\Data\Collection; /** + * Product gallery block + * * @api * @since 100.0.2 */ @@ -43,6 +45,8 @@ public function __construct( } /** + * Prepare layout + * * @return $this */ protected function _prepareLayout() @@ -52,6 +56,8 @@ protected function _prepareLayout() } /** + * Get product + * * @return Product */ public function getProduct() @@ -60,6 +66,8 @@ public function getProduct() } /** + * Get gallery collection + * * @return Collection */ public function getGalleryCollection() @@ -68,6 +76,8 @@ public function getGalleryCollection() } /** + * Get current image + * * @return Image|null */ public function getCurrentImage() @@ -85,6 +95,8 @@ public function getCurrentImage() } /** + * Get image url + * * @return string */ public function getImageUrl() @@ -93,6 +105,8 @@ public function getImageUrl() } /** + * Get image file + * * @return mixed */ public function getImageFile() @@ -124,6 +138,8 @@ public function getImageWidth() } /** + * Get previous image + * * @return Image|false */ public function getPreviousImage() @@ -143,6 +159,8 @@ public function getPreviousImage() } /** + * Get next image + * * @return Image|false */ public function getNextImage() @@ -166,6 +184,8 @@ public function getNextImage() } /** + * Get previous image url + * * @return false|string */ public function getPreviousImageUrl() @@ -178,6 +198,8 @@ public function getPreviousImageUrl() } /** + * Get next image url + * * @return false|string */ public function getNextImageUrl() diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 8157279f4cb12..ed6278c2b585d 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -187,7 +187,8 @@ public function getJsonConfig() } $tierPrices = []; - $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); + $priceInfo = $product->getPriceInfo(); + $tierPricesList = $priceInfo->getPrice('tier_price')->getTierPriceList(); foreach ($tierPricesList as $tierPrice) { $tierPrices[] = $tierPrice['price']->getValue() * 1; } @@ -196,15 +197,15 @@ public function getJsonConfig() 'priceFormat' => $this->_localeFormat->getPriceFormat(), 'prices' => [ 'oldPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue() * 1, + 'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1, 'adjustments' => [] ], 'basePrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount() * 1, + 'amount' => $priceInfo->getPrice('final_price')->getAmount()->getBaseAmount() * 1, 'adjustments' => [] ], 'finalPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() * 1, + 'amount' => $priceInfo->getPrice('final_price')->getAmount()->getValue() * 1, 'adjustments' => [] ] ], diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 7d84b2dbc2cee..554674c7e38be 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -137,16 +137,18 @@ public function getGalleryImagesJson() $imagesItems = []; /** @var DataObject $image */ foreach ($this->getGalleryImages() as $image) { - $imageItem = new DataObject([ - 'thumb' => $image->getData('small_image_url'), - 'img' => $image->getData('medium_image_url'), - 'full' => $image->getData('large_image_url'), - 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()), - 'position' => $image->getData('position'), - 'isMain' => $this->isMainImage($image), - 'type' => str_replace('external-', '', $image->getMediaType()), - 'videoUrl' => $image->getVideoUrl(), - ]); + $imageItem = new DataObject( + [ + 'thumb' => $image->getData('small_image_url'), + 'img' => $image->getData('medium_image_url'), + 'full' => $image->getData('large_image_url'), + 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()), + 'position' => $image->getData('position'), + 'isMain' => $this->isMainImage($image), + 'type' => str_replace('external-', '', $image->getMediaType()), + 'videoUrl' => $image->getVideoUrl(), + ] + ); foreach ($this->getGalleryImagesConfig()->getItems() as $imageConfig) { $imageItem->setData( $imageConfig->getData('json_object_key'), diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml index d456a8ef61469..4726bdc0930fd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml @@ -12,11 +12,7 @@ <div class="field admin__field"> <label class="label admin__field-label"><span><?= $block->escapeHtml(__('Quantity')) ?></span></label> <div class="control admin__field-control"> - <input id="product_composite_configure_input_qty" - class="input-text admin__control-text qty" - type="text" - name="qty" - value="<?= $block->getQtyValue() * 1 ?>"> + <input id="product_composite_configure_input_qty" class="input-text admin__control-text qty" type="text" name="qty" value="<?= $block->getQtyValue() * 1 ?>"> </div> </div> </fieldset> diff --git a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml index fb48e369a528e..22c42b870c112 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml @@ -62,14 +62,14 @@ if ($option) : ?> product-custom-option <?= $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" name="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]<?= /* @noEscape */ $arraySign ?>" - id="options_<?= $block->escapeHtmlAttr($option->getId()) . '_' . $count ?>" + id="options_<?= $block->escapeHtmlAttr($option->getId() . '_' . $count) ?>" value="<?= $block->escapeHtmlAttr($value->getOptionTypeId()) ?>" <?= $block->escapeHtml($checked) ?> data-selector="<?= $block->escapeHtmlAttr($dataSelector) ?>" price="<?= $block->escapeHtmlAttr($block->getCurrencyByStore($value)) ?>" /> <label class="label admin__field-label" - for="options_<?= $block->escapeHtmlAttr($option->getId()) . '_' . $count ?>"> + for="options_<?= $block->escapeHtmlAttr($option->getId() . '_' . $count) ?>"> <span> <?= $block->escapeHtml($value->getTitle()) ?> </span> diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 28bf422ca93b2..fcaa0a890adcc 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -117,7 +117,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Customer\Helper\View $customerViewHelper * @param WishlistProviderInterface $wishlistProvider * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository - * @param Escaper $escaper */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -128,8 +127,7 @@ public function __construct( \Magento\Framework\Data\Helper\PostHelper $postDataHelper, \Magento\Customer\Helper\View $customerViewHelper, WishlistProviderInterface $wishlistProvider, - \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, - Escaper $escaper = null + \Magento\Catalog\Api\ProductRepositoryInterface $productRepository ) { $this->_coreRegistry = $coreRegistry; $this->_customerSession = $customerSession; @@ -139,7 +137,7 @@ public function __construct( $this->_customerViewHelper = $customerViewHelper; $this->wishlistProvider = $wishlistProvider; $this->productRepository = $productRepository; - $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class); + $this->escaper = ObjectManager::getInstance()->get(Escaper::class); parent::__construct($context); } diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index f5c8df8d6e3e8..43614e9cae83b 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -680,10 +680,13 @@ public function toHtml() 'html' => $html, ] ); - $this->_eventManager->dispatch('view_block_abstract_to_html_after', [ - 'block' => $this, - 'transport' => $transportObject - ]); + $this->_eventManager->dispatch( + 'view_block_abstract_to_html_after', + [ + 'block' => $this, + 'transport' => $transportObject + ] + ); $html = $transportObject->getHtml(); return $html; @@ -973,8 +976,8 @@ public function escapeXssInUrl($data) * * Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc) * - * @param string $data - * @param bool $addSlashes + * @param string $data + * @param bool $addSlashes * @return string * @deprecated 100.2.0 */ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php index dba775ea894f4..bea2b0cc780de 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php @@ -7,6 +7,7 @@ namespace Magento\Framework\View\Test\Unit\Element; use Magento\Framework\Cache\LockGuardedCacheLoader; +use Magento\Framework\Escaper; use Magento\Framework\View\Element\AbstractBlock; use Magento\Framework\View\Element\Context; use Magento\Framework\Config\View; @@ -52,6 +53,11 @@ class AbstractBlockTest extends \PHPUnit\Framework\TestCase */ private $sessionMock; + /** + * @var Escaper|\PHPUnit_Framework_MockObject_MockObject + */ + private $escaperMock; + /** * @var LockGuardedCacheLoader|\PHPUnit_Framework_MockObject_MockObject */ @@ -71,6 +77,9 @@ protected function setUp() ->getMockForAbstractClass(); $this->sidResolverMock = $this->getMockForAbstractClass(SidResolverInterface::class); $this->sessionMock = $this->getMockForAbstractClass(SessionManagerInterface::class); + $this->escaperMock = $this->getMockBuilder(Escaper::class) + ->disableOriginalConstructor() + ->getMock(); $contextMock = $this->createMock(Context::class); $contextMock->expects($this->once()) ->method('getEventManager') @@ -87,6 +96,9 @@ protected function setUp() $contextMock->expects($this->once()) ->method('getSession') ->willReturn($this->sessionMock); + $contextMock->expects($this->once()) + ->method('getEscaper') + ->willReturn($this->escaperMock); $this->block = $this->getMockForAbstractClass( AbstractBlock::class, [ @@ -105,6 +117,9 @@ protected function setUp() */ public function testGetUiId($expectedResult, $nameInLayout, $methodArguments) { + $this->escaperMock->expects($this->once()) + ->method('escapeHtmlAttr') + ->willReturnCallback(function($string) {return $string;}); $this->block->setNameInLayout($nameInLayout); $this->assertEquals($expectedResult, call_user_func_array([$this->block, 'getUiId'], $methodArguments)); } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php index 57fefe4660cb2..a6890a8812409 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php @@ -9,6 +9,7 @@ */ namespace Magento\Framework\View\Test\Unit\Element; +use Magento\Framework\Escaper; use Magento\Framework\Message\Manager; use Magento\Framework\View\Element\Message\InterpretationStrategyInterface; use \Magento\Framework\View\Element\Messages; @@ -38,6 +39,11 @@ class MessagesTest extends \PHPUnit\Framework\TestCase */ protected $messageInterpretationStrategy; + /** + * @var Escaper|\PHPUnit_Framework_MockObject_MockObject + */ + private $escaperMock; + protected function setUp() { $this->collectionFactory = $this->getMockBuilder(\Magento\Framework\Message\CollectionFactory::class) @@ -52,13 +58,18 @@ protected function setUp() \Magento\Framework\View\Element\Message\InterpretationStrategyInterface::class ); + $this->escaperMock = $this->getMockBuilder(Escaper::class) + ->disableOriginalConstructor() + ->getMock(); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->messages = $objectManager->getObject( \Magento\Framework\View\Element\Messages::class, [ 'collectionFactory' => $this->collectionFactory, 'messageFactory' => $this->messageFactory, - 'interpretationStrategy' => $this->messageInterpretationStrategy + 'interpretationStrategy' => $this->messageInterpretationStrategy, + 'escaper' => $this->escaperMock, ] ); } @@ -317,6 +328,10 @@ public function testGetGroupedHtml() ] ); + $this->escaperMock->expects($this->any()) + ->method('escapeHtmlAttr') + ->willReturnCallback(function($string) {return $string;}); + $this->assertEquals($resultHtml, $this->messages->getGroupedHtml()); } } From 578610e1d0c9afa2657a9e718f9851ed00bef3ef Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Tue, 21 May 2019 14:24:15 -0500 Subject: [PATCH 163/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules --- .../templates/toolbar/class/add.phtml | 13 ++++++++++ .../templates/toolbar/class/save.phtml | 23 ++++++++++++++++++ .../templates/toolbar/rule/add.phtml | 13 ++++++++++ .../templates/toolbar/rule/save.phtml | 24 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml create mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml create mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml create mode 100644 app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml new file mode 100644 index 0000000000000..a674424f723ca --- /dev/null +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/add.phtml @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +// @deprecated +// @codingStandardsIgnoreFile +?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> + <button type="button" onclick="window.location.href='<?= $block->escapeUrl($createUrl) ?>'"> + <?= $block->escapeHtml(__('Add New Class')) ?> + </button> +</div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml new file mode 100644 index 0000000000000..cfe5a7d14785a --- /dev/null +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +// @deprecated +// @codingStandardsIgnoreFile +?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> + <?= $block->getBackButtonHtml() ?> + <?= $block->getResetButtonHtml() ?> + <?= $block->getSaveButtonHtml() ?> +</div> +<?php if ($form) : ?> + <?= $form->toHtml() ?> + <script> + require(['jquery', "mage/mage"], function(jQuery){ + + jQuery('#<?= $block->escapeJs($form->getForm()->getId()) ?>').mage('form').mage('validation'); + + }); + </script> +<?php endif; ?> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml new file mode 100644 index 0000000000000..b0ad610272f80 --- /dev/null +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/add.phtml @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +// @deprecated +// @codingStandardsIgnoreFile +?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> + <button type="button" onclick="window.location.href='<?= $block->escapeUrl($createUrl) ?>'"> + <?= $block->escapeHtml(__('Add New Tax Rule')) ?> + </button> +</div> diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml new file mode 100644 index 0000000000000..7c5de950469ab --- /dev/null +++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml @@ -0,0 +1,24 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +// @deprecated +// @codingStandardsIgnoreFile +?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions"> + <?= $block->getBackButtonHtml() ?> + <?= $block->getResetButtonHtml() ?> + <?= $block->getSaveButtonHtml() ?> + <?= $block->getDeleteButtonHtml() ?> +</div> +<?php if ($form) : ?> + <?= $form->toHtml() ?> + <script> + require(['jquery', "mage/mage"], function(jQuery){ + + jQuery('#<?= $block->escapeJs($form->getForm()->getId()) ?>').mage('form').mage('validation'); + + }); + </script> +<?php endif; ?> From 4895d59b533a48e3c88a428b170e7fae11ce1f70 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Tue, 21 May 2019 14:58:29 -0500 Subject: [PATCH 164/464] MC-16611: Fix Unrelated Static Test Failures - mark unused code as deprecated - ignore use of $this in existing templates --- app/code/Magento/Reports/Block/Adminhtml/Wishlist.php | 1 + .../Magento/Reports/Block/Product/Widget/Viewed/Item.php | 1 + .../view/adminhtml/templates/report/wishlist.phtml | 4 ++++ .../view/adminhtml/templates/store/switcher.phtml | 4 ++++ .../adminhtml/templates/store/switcher/enhanced.phtml | 4 ++++ .../view/frontend/templates/product/widget/viewed.phtml | 4 ++++ .../frontend/templates/product/widget/viewed/item.phtml | 8 ++++++++ .../widget/compared/column/compared_default_list.phtml | 9 +++++++++ .../widget/compared/column/compared_images_list.phtml | 4 ++++ .../widget/compared/column/compared_names_list.phtml | 9 +++++++++ .../widget/compared/content/compared_grid.phtml | 8 ++++++++ .../widget/compared/content/compared_list.phtml | 8 ++++++++ .../widget/viewed/column/viewed_default_list.phtml | 8 ++++++++ .../widget/viewed/column/viewed_images_list.phtml | 4 ++++ .../widget/viewed/column/viewed_names_list.phtml | 8 ++++++++ .../templates/widget/viewed/content/viewed_grid.phtml | 8 ++++++++ .../templates/widget/viewed/content/viewed_list.phtml | 8 ++++++++ 17 files changed, 100 insertions(+) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php b/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php index 1ca76cb1cf95f..a95c9439af7d0 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php @@ -9,6 +9,7 @@ /** * Adminhtml wishlist report page content block * + * @deprecated * @author Magento Core Team <core@magentocommerce.com> */ class Wishlist extends \Magento\Backend\Block\Template diff --git a/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php b/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php index 04a402c9ac41e..12959f083d376 100644 --- a/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php +++ b/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php @@ -8,6 +8,7 @@ /** * Reports Recently Viewed Products Widget * + * @deprecated * @author Magento Core Team <core@magentocommerce.com> */ class Item extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Widget\Block\BlockInterface diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml index c7ed650019a8e..9183145a2cab1 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/report/wishlist.phtml @@ -3,6 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @deprecated + */ ?> <?= $block->getChildHtml('grid') ?> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml index ae329b9e098a7..df763d540ba9f 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml @@ -4,6 +4,10 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + /** * @see \Magento\Backend\Block\Store\Switcher */ diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml index 04c819407ceb1..c299e15a23fac 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml @@ -4,6 +4,10 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + /** * @see \Magento\Backend\Block\Store\Switcher */ diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml index 627df114586ba..6e161404da34d 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml @@ -4,6 +4,10 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + /* @var $block \Magento\Reports\Block\Product\Widget\Viewed */ ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index fbe9f191a592d..15230f71ad397 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /* @var $block \Magento\Reports\Block\Product\Widget\Viewed\Item */ $type = $block->getType() . '-' . $block->getViewMode(); diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index 5894891862633..47e1363030504 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -3,6 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + ?> <?php if ($exist = $block->getRecentlyComparedProducts()) { diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml index b1a86d9e3e9c4..38c154c108394 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml @@ -3,6 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @deprecated + */ ?> <?php if ($exist = $block->getRecentlyComparedProducts()) { diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml index 16971b8dc6b87..353e6298c1b7b 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml @@ -3,6 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + ?> <?php if ($_products = $block->getRecentlyComparedProducts()) : ?> <div class="block widget block-compared-products-names"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index 470d9a69eee14..bc366df7ae0dd 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** @var \Magento\Catalog\Block\Product\Compare\ListCompare $block */ if ($exist = $block->getRecentlyComparedProducts()) { $type = 'widget-compared'; diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index bca2b9fbb5c5f..d551b17eeac1b 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** @var \Magento\Catalog\Block\Product\Compare\ListCompare $block */ if ($exist = $block->getRecentlyComparedProducts()) { $type = 'widget-compared'; diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index c4a2879820d77..73a0159b58115 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** * @var $block \Magento\Reports\Block\Product\Viewed */ diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index 1c7c84af00d9f..e4662b22493aa 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -4,6 +4,10 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + /** * @var $block \Magento\Reports\Block\Product\Viewed */ diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml index 11e99f3d9e2ab..f06f4620b9164 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** * @var $block \Magento\Reports\Block\Product\Viewed */ diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index 766ea64d5c952..5cbde2ad44945 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** * @var $block \Magento\Reports\Block\Product\Viewed */ diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index f16620ad3aa8b..03257d32f48b6 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +/** + * @deprecated + */ + +/** + * @codingStandardsIgnoreFile + */ + /** * @var $block \Magento\Reports\Block\Product\Viewed */ From 2e85cdc0663f784c2ad660f0a72f551ad674a7db Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Tue, 21 May 2019 14:39:16 -0500 Subject: [PATCH 165/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../Block/Widget/Grid/Column/Filter/TextTest.php | 9 ++++++++- .../View/Test/Unit/Element/AbstractBlockTest.php | 16 +++++++++++----- .../View/Test/Unit/Element/MessagesTest.php | 11 ++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php index 90bb073d1f96a..5aa8cf7a0c579 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php @@ -8,6 +8,9 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Unit test for \Magento\Backend\Block\Widget\Grid\Column\Filter\Text + */ class TextTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\Backend\Block\Widget\Grid\Column\Filter\Text*/ @@ -65,7 +68,11 @@ public function testGetHtml() $this->escaper->expects($this->any())->method('escapeHtml')->willReturn('escapedHtml'); $this->escaper->expects($this->once()) ->method('escapeHtmlAttr') - ->willReturnCallback(function($string) {return $string;}); + ->willReturnCallback( + function ($string) { + return $string; + } + ); $column->expects($this->any())->method('getId')->willReturn('id'); $column->expects($this->once())->method('getHtmlId')->willReturn('htmlId'); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php index bea2b0cc780de..fbaa7ec670794 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php @@ -119,7 +119,11 @@ public function testGetUiId($expectedResult, $nameInLayout, $methodArguments) { $this->escaperMock->expects($this->once()) ->method('escapeHtmlAttr') - ->willReturnCallback(function($string) {return $string;}); + ->willReturnCallback( + function ($string) { + return $string; + } + ); $this->block->setNameInLayout($nameInLayout); $this->assertEquals($expectedResult, call_user_func_array([$this->block, 'getUiId'], $methodArguments)); } @@ -166,10 +170,12 @@ public function testGetVar() $config->expects($this->any()) ->method('getVarValue') - ->willReturnMap([ - ['Magento_Theme', 'v1', 'one'], - [$module, 'v2', 'two'] - ]); + ->willReturnMap( + [ + ['Magento_Theme', 'v1', 'one'], + [$module, 'v2', 'two'] + ] + ); $configManager = $this->createMock(ConfigInterface::class); $configManager->expects($this->exactly(2))->method('getViewConfig')->willReturn($config); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php index a6890a8812409..223b9a364b1fe 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/MessagesTest.php @@ -13,10 +13,11 @@ use Magento\Framework\Message\Manager; use Magento\Framework\View\Element\Message\InterpretationStrategyInterface; use \Magento\Framework\View\Element\Messages; - -use Magento\Framework\Message\ManagerInterface; use Magento\Framework\Message\MessageInterface; +/** + * Unit test for \Magento\Framework\View\Element\Messages + */ class MessagesTest extends \PHPUnit\Framework\TestCase { /** @@ -330,7 +331,11 @@ public function testGetGroupedHtml() $this->escaperMock->expects($this->any()) ->method('escapeHtmlAttr') - ->willReturnCallback(function($string) {return $string;}); + ->willReturnCallback( + function ($string) { + return $string; + } + ); $this->assertEquals($resultHtml, $this->messages->getGroupedHtml()); } From 9efe64919f38b1b78e4ee2d1e87898372517f454 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Tue, 21 May 2019 16:37:58 -0500 Subject: [PATCH 166/464] MC-16611: Fix Unrelated Static Test Failures - fix static test failure --- app/code/Magento/Reports/Block/Adminhtml/Wishlist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php b/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php index a95c9439af7d0..dd42874b55795 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Wishlist.php @@ -45,7 +45,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function _beforeToHtml() { From 5670c9701f116362bf60a6d91275419734bdf85b Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Tue, 21 May 2019 16:54:51 -0500 Subject: [PATCH 167/464] MAGETWO-99769: SKU search weight is ignored --- .../Magento/CatalogSearch/Model/Search/RequestGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php b/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php index 0adc2fcecbfa7..8f8ba39ebd329 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php +++ b/app/code/Magento/CatalogSearch/Model/Search/RequestGenerator.php @@ -103,7 +103,7 @@ private function generateRequest($attributeType, $container, $useFulltext) } } /** @var $attribute Attribute */ - if (!$attribute->getIsSearchable() || in_array($attribute->getAttributeCode(), ['price', 'sku'], true)) { + if (!$attribute->getIsSearchable() || in_array($attribute->getAttributeCode(), ['price'], true)) { // Some fields have their own specific handlers continue; } From 3a2ffa7dc7097a7ca8e4a86753ea2b57e53c1fd4 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Wed, 22 May 2019 10:40:37 +0300 Subject: [PATCH 168/464] MAGETWO-99302: Edit customer State and Province is duplicated in the drop down --- .../AdminCreateCustomerActionGroup.xml | 22 ++++++ ...tomerAddressStateContainValuesOnceTest.xml | 71 +++++++++++++++++++ .../ui_component/customer_address_form.xml | 1 - 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml new file mode 100644 index 0000000000000..d36ca8ed02008 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCustomerWithoutAddressActionGroup"> + <arguments> + <argument name="customerData" defaultValue="Simple_US_Customer"/> + </arguments> + <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="navigateToNewCustomerPage"/> + <fillField userInput="{{Simple_Customer_Without_Address.firstname}}" selector="{{AdminCustomerAccountInformationSection.firstName}}" stepKey="fillFirstName"/> + <fillField userInput="{{Simple_Customer_Without_Address.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/> + <fillField userInput="{{Simple_Customer_Without_Address.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> + <click selector="{{AdminCustomerMainActionsSection.saveButton}}" stepKey="saveCustomer"/> + <seeElement selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="assertSuccessMessage"/> + <reloadPage stepKey="reloadPage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml new file mode 100644 index 0000000000000..2e961cd437875 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminVerifyCustomerAddressStateContainValuesOnceTest"> + <annotations> + <stories value="Verify customer address state"/> + <title value="State/Province dropdown contain values once"/> + <description value="When editing a customer in the backend from the Magento Admin Panel the State/Province should only be listed once"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-99461"/> + <useCaseId value="MAGETWO-99302"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="customer" stepKey="deleteFirstCustomer"/> + <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteSecondCustomer"> + <argument name="customerEmail" value="Simple_Customer_Without_Address.email"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Go to Customers > All Customers.--> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + + <!--Select created customer, Click Edit mode--> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithAddresses"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + + <!--Select Addresses tab--> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTabOfFirstCustomer"/> + <waitForPageLoad stepKey="waitForAddressesOfFirstCustomer"/> + + <!--Click on Edit link for Default Billing Address--> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditDefaultBillingAddress"/> + <waitForPageLoad stepKey="waitForCustomerAddressAddUpdateFormLoad"/> + + <!--Check that State/Province drop down contain all values once--> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesSection.regionId(US_Address_NY.state)}}" stepKey="seeOnlyOneRegionInSelectStateForFirstCustomer"/> + + <!--Go to Customers > All customers, Click Add new Customers, fill all necessary fields, Save--> + <actionGroup ref="AdminCreateCustomerWithoutAddressActionGroup" stepKey="createSimpleUSCustomerWithoutAddress"/> + + <!--Select new created customer, Click Edit mode--> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithoutAddresses"> + <argument name="customer" value="Simple_Customer_Without_Address"/> + </actionGroup> + + <!--Select Addresses tab, Click on create new addresses btn--> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTabOfSecondCustomer"/> + <waitForPageLoad stepKey="waitForAddressesOfSecondCustomer"/> + <click selector="{{AdminCustomerAddressesSection.addNewAddress}}" stepKey="clickAddNewAddressButton"/> + <waitForPageLoad stepKey="waitForAddUpdateCustomerAddressForm"/> + + <!--Select Country = United States and check that State/Province drop down contain all values once--> + <click selector="{{AdminCustomerAddressesSection.country}}" stepKey="clickCountryToOpenListOfCountries"/> + <click selector="{{AdminCustomerAddressesSection.countryId(US_Address_NY.country_id)}}" stepKey="fillCountry"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesSection.regionId(US_Address_NY.state)}}" stepKey="seeOnlyOneRegionInSelectStateForSecondCustomer"/> + </test> +</tests> diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml index 35f0ed8f1dae2..692cb2ecb964d 100644 --- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml +++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml @@ -215,7 +215,6 @@ <target>${ $.provider }:${ $.parentScope }.country_id</target> </filterBy> <customEntry>region</customEntry> - <options class="Magento\Directory\Model\ResourceModel\Region\Collection"/> </settings> </select> </formElements> From a675e8d5e57e6b1144b0d422f875585bb089dc8a Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Wed, 22 May 2019 15:44:56 +0300 Subject: [PATCH 169/464] MAGETWO-99302: Edit customer State and Province is duplicated in the drop down --- .../ActionGroup/AdminCreateCustomerActionGroup.xml | 12 ++++++------ ...rifyCustomerAddressStateContainValuesOnceTest.xml | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml index d36ca8ed02008..b17c9e6c0a771 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml @@ -12,11 +12,11 @@ <argument name="customerData" defaultValue="Simple_US_Customer"/> </arguments> <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="navigateToNewCustomerPage"/> - <fillField userInput="{{Simple_Customer_Without_Address.firstname}}" selector="{{AdminCustomerAccountInformationSection.firstName}}" stepKey="fillFirstName"/> - <fillField userInput="{{Simple_Customer_Without_Address.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/> - <fillField userInput="{{Simple_Customer_Without_Address.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> - <click selector="{{AdminCustomerMainActionsSection.saveButton}}" stepKey="saveCustomer"/> - <seeElement selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="assertSuccessMessage"/> - <reloadPage stepKey="reloadPage"/> + <fillField userInput="{{customerData.firstname}}" selector="{{AdminCustomerAccountInformationSection.firstName}}" stepKey="fillFirstName"/> + <fillField userInput="{{customerData.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/> + <fillField userInput="{{customerData.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveCustomer"/> + <waitForPageLoad stepKey="waitForCustomerPageLoad"/> + <see userInput="You saved the customer." selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml index 2e961cd437875..a8efe6c18cba9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml @@ -10,7 +10,8 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminVerifyCustomerAddressStateContainValuesOnceTest"> <annotations> - <stories value="Verify customer address state"/> + <features value="Customer"/> + <stories value="Update Customer Address"/> <title value="State/Province dropdown contain values once"/> <description value="When editing a customer in the backend from the Magento Admin Panel the State/Province should only be listed once"/> <severity value="MAJOR"/> @@ -25,8 +26,9 @@ <after> <deleteData createDataKey="customer" stepKey="deleteFirstCustomer"/> <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteSecondCustomer"> - <argument name="customerEmail" value="Simple_Customer_Without_Address.email"/> + <argument name="customerEmail" value="Simple_US_Customer.email"/> </actionGroup> + <actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="clearFilters"/> <actionGroup ref="logout" stepKey="logout"/> </after> @@ -54,7 +56,7 @@ <!--Select new created customer, Click Edit mode--> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithoutAddresses"> - <argument name="customer" value="Simple_Customer_Without_Address"/> + <argument name="customer" value="Simple_US_Customer"/> </actionGroup> <!--Select Addresses tab, Click on create new addresses btn--> From 08b1e697c6aabf24162f3826b0decc221f4bce9a Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Wed, 22 May 2019 17:14:44 +0300 Subject: [PATCH 170/464] MAGETWO-99302: Edit customer State and Province is duplicated in the drop down --- .../Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml | 4 ++-- ...AdminVerifyCustomerAddressStateContainValuesOnceTest.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml index b17c9e6c0a771..99844461189e5 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml @@ -16,7 +16,7 @@ <fillField userInput="{{customerData.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/> <fillField userInput="{{customerData.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> <click selector="{{AdminMainActionsSection.save}}" stepKey="saveCustomer"/> - <waitForPageLoad stepKey="waitForCustomerPageLoad"/> - <see userInput="You saved the customer." selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageVisible"/> + <see userInput="You saved the customer." selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml index a8efe6c18cba9..e3e5744135b1a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml @@ -20,11 +20,11 @@ <group value="customer"/> </annotations> <before> - <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customer"/> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="firstCustomer"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> - <deleteData createDataKey="customer" stepKey="deleteFirstCustomer"/> + <deleteData createDataKey="firstCustomer" stepKey="deleteFirstCustomer"/> <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteSecondCustomer"> <argument name="customerEmail" value="Simple_US_Customer.email"/> </actionGroup> @@ -37,7 +37,7 @@ <!--Select created customer, Click Edit mode--> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithAddresses"> - <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + <argument name="customer" value="$$firstCustomer$$"/> </actionGroup> <!--Select Addresses tab--> From 9a766614e8bf9945a9dada86b8485b03889649d0 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Wed, 22 May 2019 10:34:34 -0500 Subject: [PATCH 171/464] MC-16611: Fix Unrelated Static Test Failures - clean up code --- app/code/Magento/Reports/view/adminhtml/templates/grid.phtml | 1 - .../testsuite/Magento/Test/Legacy/_files/obsolete_classes.php | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml index b5584d25f322b..81e2d7a96a9b3 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml @@ -6,7 +6,6 @@ ?> <?php /** @var $block \Magento\Reports\Block\Adminhtml\Grid */ -$numColumns = count($block->getColumns()); ?> <?php if ($block->getCollection()) : ?> <?php if ($block->canDisplayContainer()) : ?> diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 12c10990a3af5..a162b5083109b 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -1790,7 +1790,7 @@ ], ['Magento\Adminhtml\Block\Report\Shopcart\Product', 'Magento\Reports\Block\Adminhtml\Shopcart\Product'], ['Magento\Adminhtml\Block\Report\Wishlist\Grid', 'Magento\Reports\Block\Adminhtml\Wishlist\Grid'], - ['Magento\Adminhtml\Block\Report\Wishlist', 'Magento\Reports\Block\Adminhtml\Wishlist'], + ['Magento\Adminhtml\Block\Report\Wishlist'], ['Magento\Backend\Helper\Addresses'], ['Magento\Backend\Controller\Adminhtml\System\Variable', 'Magento\Variable\Controller\Adminhtml\System\Variable'], [ @@ -3198,6 +3198,8 @@ ['Magento\Tax\Model\ResourceModel\Sales\Order\Tax\Item', 'Magento\Sales\Model\ResourceModel\Order\Tax\Item'], ['Magento\Tax\Model\Sales\Order\Tax\Item', 'Magento\Sales\Model\Order\Tax\Item'], ['Magento\Reports\Block\Adminhtml\Product\Grid'], + ['Magento\Reports\Block\Adminhtml\Product\Widget\Viewed\Item'], + ['Magento\Reports\Block\Adminhtml\Wishlist'], ['Magento\Reports\Model\Totals'], ['Magento\Log\Model\Shell'], ['Magento\Log\App\Shell'], From 29c26f3be16368a562104dbdbe3ade91e04a27e8 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 22 May 2019 13:37:59 -0500 Subject: [PATCH 172/464] MC-12599: Checkout can properly process flow if list of shipping carriers are changed during place order --- .../OpenStoreFrontProductPageActionGroup.xml | 17 +++ ...sNotAffectedStartedCheckoutProcessTest.xml | 102 ++++++++++++++++++ ...latRateShippingMethodStatusActionGroup.xml | 21 ++++ ...enShippingMethodsConfigPageActionGroup.xml | 15 +++ .../AdminShippingMethodFlatRateSection.xml | 15 +++ 5 files changed, 170 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminOpenShippingMethodsConfigPageActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..4bfd5673e4a8b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenStoreFrontProductPageActionGroup"> + <arguments> + <argument name="productUrlKey" type="string"/> + </arguments> + <amOnPage url="{{StorefrontProductPage.url(productUrlKey)}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml new file mode 100644 index 0000000000000..ff9b3b1be9cbf --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckConfigsChangesAreNotAffectedStartedCheckoutProcessTest"> + <annotations> + <features value="Checkout"/> + <stories value="Changes in configs are not affecting checkout process"/> + <title value="Admin check configs changes are not affected started checkout process test"/> + <description value="Changes in admin for shipping rates are not affecting checkout process that has been started"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-12599"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + + <!-- Enable free shipping method --> + <createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/> + + <!-- Disable flat rate method --> + <createData entity="DisableFlatRateShippingMethodConfig" stepKey="disableFlatRate"/> + </before> + <after> + <!-- Roll back configuration --> + <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> + <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> + + <!-- Delete simple product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + + <!-- Log out --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Add product to cart --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Proceed to Checkout from mini shopping cart --> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/> + + <!-- Fill all required fields --> + <actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="fillNewShippingAddress"> + <argument name="customer" value="Simple_Customer_Without_Address" /> + <argument name="address" value="US_Address_TX"/> + </actionGroup> + + <!-- Assert Free Shipping checkbox --> + <seeCheckboxIsChecked selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShipping}}" stepKey="freeShippingMethodCheckboxIsChecked"/> + + <!-- Click Next button --> + <click selector="{{CheckoutShippingGuestInfoSection.next}}" stepKey="clickNext"/> + <waitForPageLoad stepKey="waitForShipmentPageLoad"/> + + <!-- Payment step is opened --> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/> + + <!-- Order Summary block contains information about shipping --> + <actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckShippingMethod"> + <argument name="shippingMethod" value="freeTitleDefault.value"/> + </actionGroup> + + <!-- Open new browser's window and login as Admin --> + <openNewTab stepKey="openNewTab"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Go to Store > Configuration > Sales > Shipping Methods --> + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> + + <!-- Enable "Flat Rate" --> + <actionGroup ref="AdminChangeFlatRateShippingMethodStatusActionGroup" stepKey="enableFlatRateShippingStatus"/> + + <!-- Flush cache --> + <magentoCLI command="cache:flush" stepKey="cacheFlush"/> + + <!-- Back to the Checkout and refresh the page --> + <switchToPreviousTab stepKey="switchToPreviousTab"/> + <reloadPage stepKey="refreshPage"/> + <waitForPageLoad stepKey="waitPageReload"/> + + <!-- Payment step is opened after refreshing --> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSection"/> + + <!-- Order Summary block contains information about free shipping --> + <actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckFreeShippingMethod"> + <argument name="shippingMethod" value="freeTitleDefault.value"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml new file mode 100644 index 0000000000000..ba77695a326f4 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminChangeFlatRateShippingMethodStatusActionGroup"> + <arguments> + <argument name="status" type="string" defaultValue="1"/> + </arguments> + <conditionalClick selector="{{AdminShippingMethodFlatRateSection.carriersFratRateTab}}" dependentSelector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" visible="false" stepKey="expandTab"/> + <selectOption selector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" userInput="{{status}}" stepKey="changeFlatRateMethodStatus"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfigs"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminOpenShippingMethodsConfigPageActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminOpenShippingMethodsConfigPageActionGroup.xml new file mode 100644 index 0000000000000..a1fefcf13afa4 --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminOpenShippingMethodsConfigPageActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenShippingMethodsConfigPageActionGroup"> + <amOnPage url="{{AdminShippingMethodsConfigPage.url}}" stepKey="navigateToAdminShippingMethodsPage"/> + <waitForPageLoad stepKey="waitForAdminShippingMethodsPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml b/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml new file mode 100644 index 0000000000000..b03e319b25bad --- /dev/null +++ b/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminShippingMethodFlatRateSection"> + <element name="carriersFratRateTab" type="button" selector="#carriers_flatrate-head"/> + <element name="carriersFlatRateActive" type="select" selector="#carriers_flatrate_active"/> + </section> +</sections> From 76f5b56d14c6f080f271d265bfc646bd4369256e Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 14:30:11 -0500 Subject: [PATCH 173/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../adminhtml/templates/admin/formkey.phtml | 2 +- .../adminhtml/templates/admin/login.phtml | 15 ++++++++------ .../templates/admin/login_buttons.phtml | 2 +- .../templates/admin/overlay_popup.phtml | 2 +- .../view/adminhtml/templates/admin/page.phtml | 4 ++-- .../adminhtml/templates/dashboard/graph.phtml | 4 ++-- .../templates/dashboard/graph/disabled.phtml | 2 +- .../adminhtml/templates/dashboard/index.phtml | 6 +++--- .../templates/dashboard/searches.phtml | 2 +- .../templates/dashboard/store/switcher.phtml | 4 ++-- .../adminhtml/templates/media/uploader.phtml | 2 +- .../view/adminhtml/templates/menu.phtml | 2 +- .../adminhtml/templates/page/copyright.phtml | 4 ++-- .../adminhtml/templates/page/footer.phtml | 4 ++-- .../adminhtml/templates/page/header.phtml | 6 +++--- .../templates/page/js/calendar.phtml | 18 ++++++++--------- .../adminhtml/templates/page/notices.phtml | 6 +++--- .../adminhtml/templates/page/report.phtml | 2 +- .../adminhtml/templates/pageactions.phtml | 2 +- .../adminhtml/templates/store/switcher.phtml | 6 +++--- .../templates/system/cache/edit.phtml | 8 ++++---- .../adminhtml/templates/system/search.phtml | 4 ++-- .../widget/form/element/gallery.phtml | 10 +++++----- .../adminhtml/templates/widget/grid.phtml | 18 ++++++++--------- .../templates/widget/grid/export.phtml | 2 +- .../templates/widget/grid/extended.phtml | 20 +++++++++---------- .../templates/widget/grid/massaction.phtml | 12 +++++------ .../widget/grid/massaction_extended.phtml | 12 +++++------ .../adminhtml/templates/widget/tabs.phtml | 4 ++-- .../templates/widget/tabshoriz.phtml | 6 +++--- 30 files changed, 97 insertions(+), 94 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml index 9629db9fa455b..edc14190e4edf 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml @@ -4,4 +4,4 @@ * See COPYING.txt for license details. */ ?> -<div><input name="form_key" type="hidden" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /></div> +<div><input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /></div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index 52d5dd6d114ee..4a44356e8e62a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -6,17 +6,20 @@ // @codingStandardsIgnoreFile +/** + * @var \Magento\Framework\View\Element\AbstractBlock $block + */ ?> <form method="post" action="" id="login-form" data-mage-init='{"form": {}, "validation": {}}' autocomplete="off"> <fieldset class="admin__fieldset"> <legend class="admin__legend"> - <span><?= /* @escapeNotVerified */ __('Welcome, please sign in') ?></span> + <span><?= $block->escapeHtml(__('Welcome, please sign in')) ?></span> </legend><br/> - <input name="form_key" type="hidden" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /> + <input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /> <div class="admin__field _required field-username"> <label for="username" class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Username') ?></span> + <span><?= $block->escapeHtml(__('Username')) ?></span> </label> <div class="admin__field-control"> <input id="username" @@ -26,14 +29,14 @@ autofocus value="" data-validate="{required:true}" - placeholder="<?= /* @escapeNotVerified */ __('user name') ?>" + placeholder="<?= $block->escapeHtmlAttr(__('user name')) ?>" autocomplete="off" /> </div> </div> <div class="admin__field _required field-password"> <label for="login" class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Password') ?></span> + <span><?= $block->escapeHtml(__('Password')) ?></span> </label> <div class="admin__field-control"> <input id="login" @@ -42,7 +45,7 @@ name="login[password]" data-validate="{required:true}" value="" - placeholder="<?= /* @escapeNotVerified */ __('password') ?>" + placeholder="<?= $block->escapeHtmlAttr(__('password')) ?>" autocomplete="off" /> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml index 2459bc54e0c34..18ee8a86517c1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml @@ -8,6 +8,6 @@ <button <?php $block->getUiId(); ?> class="action-login action-primary"> - <span><?= /* @escapeNotVerified */ __('Sign in') ?></span> + <span><?= $block->escapeHtml(__('Sign in')) ?></span> </button> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml index 93509cc62f7d5..59c6a558cccaa 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml @@ -11,7 +11,7 @@ <div class="middle" id="anchor-content"> <div id="page:main-container"> <?php if ($block->getChildHtml('left')): ?> - <div class="columns <?= /* @escapeNotVerified */ $block->getContainerCssClass() ?>" id="page:container"> + <div class="columns <?= $block->escapeHtmlAttr($block->getContainerCssClass()) ?>" id="page:container"> <div id="page:left" class="side-col"> <?= $block->getChildHtml('left') ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml index ebb8e26c93f9d..362f38549f180 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -9,7 +9,7 @@ ?> <?php /** @var $block \Magento\Backend\Block\Page */ ?> <!doctype html> -<html lang="<?= /* @escapeNotVerified */ $block->getLang() ?>" class="no-js"> +<html lang="<?= $block->escapeHtmlAttr($block->getLang()) ?>" class="no-js"> <head> <?= $block->getChildHtml('head') ?> @@ -32,7 +32,7 @@ </div> <?= $block->getChildHtml('page_main_actions') ?> <?php if ($block->getChildHtml('left')): ?> - <div id="page:main-container" class="<?= /* @escapeNotVerified */ $block->getContainerCssClass() ?> col-2-left-layout"> + <div id="page:main-container" class="<?= $block->escapeHtmlAttr($block->getContainerCssClass()) ?> col-2-left-layout"> <div class="main-col" id="content"> <?= $block->getChildHtml('content') ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index ae123511bd478..64703420ddaa7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -10,7 +10,7 @@ <div class="dashboard-diagram"> <div class="dashboard-diagram-switcher"> <label for="order_<?= $block->getHtmlId() ?>_period" - class="label"><?= /* @escapeNotVerified */ __('Select Range:') ?></label> + class="label"><?= $block->escapeHtml(__('Select Range:')) ?></label> <select name="period" id="order_<?= $block->getHtmlId() ?>_period" onchange="changeDiagramsPeriod(this);" class="admin__control-select"> <?php foreach ($this->helper('Magento\Backend\Helper\Dashboard\Data')->getDatePeriods() as $value => $label): ?> @@ -29,7 +29,7 @@ </div> <?php else: ?> <div class="dashboard-diagram-nodata"> - <span><?= /* @escapeNotVerified */ __('No Data Found') ?></span> + <span><?= $block->escapeHtml(__('No Data Found')) ?></span> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml index 7dddc15121831..87d103fe855f0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml @@ -7,5 +7,5 @@ // @codingStandardsIgnoreFile ?> <div class="dashboard-diagram-disabled"> - <?= /* @escapeNotVerified */ __('Chart is disabled. To enable the chart, click <a href="%1">here</a>.', $block->getConfigUrl()) ?> + <?= /* @noEscape */ __('Chart is disabled. To enable the chart, click <a href="%1">here</a>.', $block->getConfigUrl()) ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml index 865e0fac38314..052e3b54d5a04 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml @@ -93,15 +93,15 @@ window.changeDiagramsPeriod = function(periodObj) { <div class="dashboard-secondary col-m-4 col-m-pull-8"> <?= $block->getChildHtml('sales') ?> <div class="dashboard-item"> - <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Last Orders') ?></div> + <div class="dashboard-item-title"><?= $block->escapeHtml(__('Last Orders')) ?></div> <?= $block->getChildHtml('lastOrders') ?> </div> <div class="dashboard-item"> - <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Last Search Terms') ?></div> + <div class="dashboard-item-title"><?= $block->escapeHtml(__('Last Search Terms')) ?></div> <?= $block->getChildHtml('lastSearches') ?> </div> <div class="dashboard-item"> - <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Top Search Terms') ?></div> + <div class="dashboard-item-title"><?= $block->escapeHtml(__('Top Search Terms')) ?></div> <?= $block->getChildHtml('topSearches') ?> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml index f6e837fd54ede..6216cee30dbc5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml @@ -14,5 +14,5 @@ <?php endforeach; ?> </div> <?php else: ?> - <div class="empty-text"><?= /* @escapeNotVerified */ __('There are no search keywords.') ?></div> + <div class="empty-text"><?= $block->escapeHtml(__('There are no search keywords.')) ?></div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index bf9ae27f17b48..a1e88d2763f77 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -7,10 +7,10 @@ // @codingStandardsIgnoreFile ?> -<p class="switcher"><label for="store_switcher"><?= /* @escapeNotVerified */ __('View Statistics For:') ?></label> +<p class="switcher"><label for="store_switcher"><?= $block->escapeHtml(__('View Statistics For:')) ?></label> <?= $block->getHintHtml() ?> <select name="store_switcher" id="store_switcher" class="left-col-block" onchange="return switchStore(this);"> - <option value=""><?= /* @escapeNotVerified */ __('All Websites') ?></option> + <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> <?php foreach ($block->getWebsiteCollection() as $_website): ?> <?php $showWebsite = false; ?> <?php foreach ($block->getGroupCollection($_website) as $_group): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 4d9ba6a8c4bad..34b8745501eb4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -20,7 +20,7 @@ }' > <div class="fileinput-button form-buttons button"> - <span><?= /* @escapeNotVerified */ __('Browse Files...') ?></span> + <span><?= $block->escapeHtml(__('Browse Files...')) ?></span> <input id="fileupload" type="file" name="<?= /* @escapeNotVerified */ $block->getConfig()->getFileField() ?>" data-url="<?= /* @escapeNotVerified */ $block->getConfig()->getUrl() ?>" multiple="multiple" /> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml b/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml index c448bd61b0791..1dbee79166796 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml @@ -9,6 +9,6 @@ ?> <nav data-mage-init='{"globalNavigation": {}}' class="admin__menu"> - <?= /* @escapeNotVerified */ $block->renderNavigation($block->getMenuModel(), 0, 12) ?> + <?= /* @noEscape */ $block->renderNavigation($block->getMenuModel(), 0, 12) ?> </nav> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml index 55bdbb460ba07..89ad29f142941 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml @@ -7,5 +7,5 @@ // @codingStandardsIgnoreFile ?> -<a class="link-copyright" href="http://magento.com" target="_blank" title="<?= /* @escapeNotVerified */ __('Magento') ?>"></a> -<?= /* @escapeNotVerified */ __('Copyright © %1 Magento Commerce Inc. All rights reserved.', date('Y')) ?> +<a class="link-copyright" href="http://magento.com" target="_blank" title="<?= $block->escapeHtml(__('Magento')) ?>"></a> +<?= $block->escapeHtml(__('Copyright © %1 Magento Commerce Inc. All rights reserved.', date('Y'))) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml index 78e2e6db15e91..bbaf30a3ca327 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml @@ -8,6 +8,6 @@ ?> <p class="magento-version"> - <strong><?= /* @escapeNotVerified */ __('Magento') ?></strong> - <?= /* @escapeNotVerified */ __('ver. %1', $block->getMagentoVersion()) ?> + <strong><?= $block->escapeHtml(__('Magento')) ?></strong> + <?= $block->escapeHtml(__('ver. %1', $block->getMagentoVersion())) ?> </p> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index f952001f5e2ff..11c6508534a92 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -39,7 +39,7 @@ href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/system_account/index') ?>" <?= /* @escapeNotVerified */ $block->getUiId('user', 'account', 'settings') ?> title="<?= $block->escapeHtml(__('Account Setting')) ?>"> - <?= /* @escapeNotVerified */ __('Account Setting') ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>) + <?= $block->escapeHtml(__('Account Setting')) ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>) </a> </li> <?php endif; ?> @@ -48,7 +48,7 @@ href="<?= /* @escapeNotVerified */ $block->getBaseUrl() ?>" title="<?= $block->escapeHtml(__('Customer View')) ?>" target="_blank" class="store-front"> - <?= /* @escapeNotVerified */ __('Customer View') ?> + <?= $block->escapeHtml(__('Customer View')) ?> </a> </li> <li> @@ -56,7 +56,7 @@ href="<?= /* @escapeNotVerified */ $block->getLogoutLink() ?>" class="account-signout" title="<?= $block->escapeHtml(__('Sign Out')) ?>"> - <?= /* @escapeNotVerified */ __('Sign Out') ?> + <?= $block->escapeHtml(__('Sign Out')) ?> </a> </li> </ul> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml index e47bf5830f9ee..e0d9029bf022a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml @@ -26,16 +26,16 @@ require([ dayNamesMin: <?= /* @escapeNotVerified */ $days['abbreviated'] ?>, monthNames: <?= /* @escapeNotVerified */ $months['wide'] ?>, monthNamesShort: <?= /* @escapeNotVerified */ $months['abbreviated'] ?>, - infoTitle: "<?= /* @escapeNotVerified */ __('About the calendar') ?>", + infoTitle: "<?= $block->escapeHtml(__('About the calendar')) ?>", firstDay: <?= /* @escapeNotVerified */ $firstDay ?>, - closeText: "<?= /* @escapeNotVerified */ __('Close') ?>", - currentText: "<?= /* @escapeNotVerified */ __('Go Today') ?>", - prevText: "<?= /* @escapeNotVerified */ __('Previous') ?>", - nextText: "<?= /* @escapeNotVerified */ __('Next') ?>", - weekHeader: "<?= /* @escapeNotVerified */ __('WK') ?>", - timeText: "<?= /* @escapeNotVerified */ __('Time') ?>", - hourText: "<?= /* @escapeNotVerified */ __('Hour') ?>", - minuteText: "<?= /* @escapeNotVerified */ __('Minute') ?>", + closeText: "<?= $block->escapeHtml(__('Close')) ?>", + currentText: "<?= $block->escapeHtml(__('Go Today')) ?>", + prevText: "<?= $block->escapeHtml(__('Previous')) ?>", + nextText: "<?= $block->escapeHtml(__('Next')) ?>", + weekHeader: "<?= $block->escapeHtml(__('WK')) ?>", + timeText: "<?= $block->escapeHtml(__('Time')) ?>", + hourText: "<?= $block->escapeHtml(__('Hour')) ?>", + minuteText: "<?= $block->escapeHtml(__('Minute')) ?>", dateFormat: $.datepicker.RFC_2822, showOn: "button", showAnim: "", diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml index 5418ad58b9519..a92ba433321e6 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml @@ -16,8 +16,8 @@ <noscript> <div class="messages"> <div class="message message-warning message-noscript"> - <strong><?= /* @escapeNotVerified */ __('JavaScript may be disabled in your browser.') ?></strong> - <?= /* @escapeNotVerified */ __('To use this website you must first enable JavaScript in your browser.') ?> + <strong><?= $block->escapeHtml(__('JavaScript may be disabled in your browser.')) ?></strong> + <?= $block->escapeHtml(__('To use this website you must first enable JavaScript in your browser.')) ?> </div> </div> </noscript> @@ -25,7 +25,7 @@ <?php if ($block->displayDemoNotice()): ?> <div class="messages"> <div class="message message-warning message-demo-mode"> - <?= /* @escapeNotVerified */ __('This is only a demo store. You can browse and place orders, but nothing will be processed.') ?> + <?= $block->escapeHtml(__('This is only a demo store. You can browse and place orders, but nothing will be processed.')) ?> </div> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml index 4ef6d378cc4a4..a61ffc515c8f3 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml @@ -9,6 +9,6 @@ ?> <?php if ($block->getBugreportUrl()): ?> <a class="link-report" href="<?= /* @escapeNotVerified */ $block->getBugreportUrl() ?>" id="footer_bug_tracking" target="_blank"> - <?= /* @escapeNotVerified */ __('Report an Issue') ?> + <?= $block->escapeHtml(__('Report an Issue')) ?> </a> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml index 0a1dcb0b626e6..5bd796baaeed2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml @@ -8,7 +8,7 @@ ?> <?php if ($block->getChildHtml()):?> - <div data-mage-init='{"floatingHeader": {}}' class="page-actions floating-header" <?= /* @escapeNotVerified */ $block->getUiId('content-header') ?>> + <div data-mage-init='{"floatingHeader": {}}' class="page-actions floating-header" <?= /* @noEscape */ $block->getUiId('content-header') ?>> <?= $block->getChildHtml() ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index bb968c57610be..e6ef65443c6d3 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -11,7 +11,7 @@ <?php if ($websites = $block->getWebsites()): ?> <div class="store-switcher store-view"> - <span class="store-switcher-label"><?= /* @escapeNotVerified */ __('Store View:') ?></span> + <span class="store-switcher-label"><?= $block->escapeHtml(__('Store View:')) ?></span> <div class="actions dropdown closable"> <input type="hidden" name="store_switcher" id="store_switcher" data-role="store-view-id" data-param="<?= /* @escapeNotVerified */ $block->getStoreVarName() ?>" @@ -121,7 +121,7 @@ <?php endforeach; ?> <?php if ($block->getShowManageStoresLink() && $block->getAuthorization()->isAllowed('Magento_Backend::store')): ?> <li class="dropdown-toolbar"> - <a href="<?= /* @escapeNotVerified */ $block->getUrl('*/system_store') ?>"><?= /* @escapeNotVerified */ __('Stores Configuration') ?></a> + <a href="<?= /* @escapeNotVerified */ $block->getUrl('*/system_store') ?>"><?= $block->escapeHtml(__('Stores Configuration')) ?></a> </li> <?php endif; ?> </ul> @@ -176,7 +176,7 @@ require([ <?php if ($block->getUseConfirm()): ?> confirm({ - content: "<?= /* @escapeNotVerified */ __('Please confirm scope switching. All data that hasn\'t been saved will be lost.') ?>", + content: "<?= $block->escapeHtml(__('Please confirm scope switching. All data that hasn\'t been saved will be lost.')) ?>", actions: { confirm: function() { reload(); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml index 8e52f245f74d5..ac3f86011a5d0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml @@ -34,7 +34,7 @@ <?= $block->getChildHtml('form') ?> <div class="entry-edit"> <div class="entry-edit-head"> - <h4 class="icon-head head-edit-form fieldset-legend"><?= /* @escapeNotVerified */ __('Catalog') ?></h4> + <h4 class="icon-head head-edit-form fieldset-legend"><?= $block->escapeHtml(__('Catalog')) ?></h4> </div> <fieldset id="catalog"> <table class="form-list"> @@ -66,16 +66,16 @@ <div class="entry-edit"> <div class="entry-edit-head"> - <h4 class="icon-head head-edit-form fieldset-legend"><?= /* @escapeNotVerified */ __('JavaScript/CSS') ?></h4> + <h4 class="icon-head head-edit-form fieldset-legend"><?= $block->escapeHtml(__('JavaScript/CSS')) ?></h4> </div> <fieldset id="jscss"> <table class="form-list"> <tbody> <tr> - <td class="label"><label><?= /* @escapeNotVerified */ __('JavaScript/CSS Cache') ?></label></td> + <td class="label"><label><?= $block->escapeHtml(__('JavaScript/CSS Cache')) ?></label></td> <td class="value"> - <button onclick="setCacheAction('jscss_action', this)" id='jscss_action' type="button" class="scalable"><span><span><span><?= /* @escapeNotVerified */ __('Clear') ?></span></span></span></button> + <button onclick="setCacheAction('jscss_action', this)" id='jscss_action' type="button" class="scalable"><span><span><span><?= $block->escapeHtml(__('Clear')) ?></span></span></span></button> </td> </tr> </tbody> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index af369800287c1..e2455de2f6a5f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -21,7 +21,7 @@ <button type="submit" class="search-global-action" - title="<?= /* @escapeNotVerified */ __('Search') ?>" + title="<?= $block->escapeHtml(__('Search')) ?>" ></button> </div> </form> @@ -52,7 +52,7 @@ <% } else { %> <li> <span class="mage-suggest-no-records"> - <?= /* @escapeNotVerified */ __('No records found.') ?> + <?= $block->escapeHtml(__('No records found.')) ?> </span> </li> <% } %> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index e11c0efc123ff..0aa912852937d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -9,14 +9,14 @@ ?> <tr> <td colspan="2"> -<label for="gallery"><?= /* @escapeNotVerified */ __('Images') ?></label> +<label for="gallery"><?= $block->escapeHtml(__('Images')) ?></label> <table id="gallery" class="gallery" border="0" cellspacing="3" cellpadding="0"> <thead id="gallery_thead" class="gallery"> <tr class="gallery"> - <td class="gallery" valign="middle" align="center"><?= /* @escapeNotVerified */ __('Big Image') ?></td> - <td class="gallery" valign="middle" align="center"><?= /* @escapeNotVerified */ __('Thumbnail') ?></td> - <td class="gallery" valign="middle" align="center"><?= /* @escapeNotVerified */ __('Sort Order') ?></td> - <td class="gallery" valign="middle" align="center"><?= /* @escapeNotVerified */ __('Delete') ?></td> + <td class="gallery" valign="middle" align="center"><?= $block->escapeHtml(__('Big Image')) ?></td> + <td class="gallery" valign="middle" align="center"><?= $block->escapeHtml(__('Thumbnail')) ?></td> + <td class="gallery" valign="middle" align="center"><?= $block->escapeHtml(__('Sort Order')) ?></td> + <td class="gallery" valign="middle" align="center"><?= $block->escapeHtml(__('Delete')) ?></td> </tr> </thead> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index fad8f5968009f..af9b227dd13d2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -53,9 +53,9 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @escapeNotVerified */ $block->getUiId('total-count') ?>> <?= /* @escapeNotVerified */ $countRecords ?> </span> - <?= /* @escapeNotVerified */ __('records found') ?> + <?= $block->escapeHtml(__('records found')) ?> <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>_massaction-count" - class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= /* @escapeNotVerified */ __('selected') ?></span></span> + class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= $block->escapeHtml(__('selected')) ?></span></span> </div> <?php if ($block->getPagerVisibility()): ?> <div class="admin__data-grid-pager-wrap"> @@ -80,7 +80,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; </option> </select> <label for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" - class="admin__control-support-text"><?= /* @escapeNotVerified */ __('per page') ?></label> + class="admin__control-support-text"><?= $block->escapeHtml(__('per page')) ?></label> <div class="admin__data-grid-pager"> <?php $_curPage = $block->getCollection()->getCurPage() ?> <?php $_lastPage = $block->getCollection()->getLastPageNumber() ?> @@ -89,10 +89,10 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <button class="action-previous" type="button" onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> - <span><?= /* @escapeNotVerified */ __('Previous page') ?></span> + <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> - <button type="button" class="action-previous disabled"><span><?= /* @escapeNotVerified */ __('Previous page') ?></span></button> + <button type="button" class="action-previous disabled"><span><?= $block->escapeHtml(__('Previous page')) ?></span></button> <?php endif; ?> <input type="text" @@ -104,16 +104,16 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> - <?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> + <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> </label> <?php if ($_curPage < $_lastPage): ?> - <button type="button" title="<?= /* @escapeNotVerified */ __('Next page') ?>" + <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> - <span><?= /* @escapeNotVerified */ __('Next page') ?></span> + <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> - <button type="button" class="action-next disabled"><span><?= /* @escapeNotVerified */ __('Next page') ?></span></button> + <button type="button" class="action-next disabled"><span><?= $block->escapeHtml(__('Next page')) ?></span></button> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml index 35be61dad7f73..073d669416395 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml @@ -9,7 +9,7 @@ ?> <div class="admin__data-grid-export"> <label for="<?= /* @escapeNotVerified */ $block->getId() ?>_export" class="admin__control-support-text"> - <?= /* @escapeNotVerified */ __('Export to:') ?> + <?= $block->escapeHtml(__('Export to:')) ?> </label> <select name="<?= /* @escapeNotVerified */ $block->getId() ?>_export" id="<?= /* @escapeNotVerified */ $block->getId() ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index f97db4ad993b1..469715bac8e86 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -41,7 +41,7 @@ $numColumns = sizeof($block->getColumns()); <div class="admin__data-grid-export"> <label class="admin__control-support-text" - for="<?= $block->escapeHtml($block->getId()) ?>_export"><?= /* @escapeNotVerified */ __('Export to:') ?></label> + for="<?= $block->escapeHtml($block->getId()) ?>_export"><?= $block->escapeHtml(__('Export to:')) ?></label> <select name="<?= $block->escapeHtml($block->getId()) ?>_export" id="<?= $block->escapeHtml($block->getId()) ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> @@ -64,9 +64,9 @@ $numColumns = sizeof($block->getColumns()); <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @escapeNotVerified */ $block->getUiId('total-count') ?>> <?= /* @escapeNotVerified */ $countRecords ?> </span> - <?= /* @escapeNotVerified */ __('records found') ?> + <?= $block->escapeHtml(__('records found')) ?> <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>_massaction-count" - class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= /* @escapeNotVerified */ __('selected') ?></span></span> + class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= $block->escapeHtml(__('selected')) ?></span></span> </div> <?php if ($block->getPagerVisibility()): ?> @@ -92,7 +92,7 @@ $numColumns = sizeof($block->getColumns()); </option> </select> <label for="<?= $block->escapeHtml($block->getHtmlId()) ?><?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" - class="admin__control-support-text"><?= /* @escapeNotVerified */ __('per page') ?></label> + class="admin__control-support-text"><?= $block->escapeHtml(__('per page')) ?></label> <div class="admin__data-grid-pager"> <?php $_curPage = $block->getCollection()->getCurPage() ?> @@ -101,10 +101,10 @@ $numColumns = sizeof($block->getColumns()); <button class="action-previous" type="button" onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> - <span><?= /* @escapeNotVerified */ __('Previous page') ?></span> + <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> - <button type="button" class="action-previous disabled"><span><?= /* @escapeNotVerified */ __('Previous page') ?></span></button> + <button type="button" class="action-previous disabled"><span><?= $block->escapeHtml(__('Previous page')) ?></span></button> <?php endif; ?> <input type="text" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current" @@ -113,17 +113,17 @@ $numColumns = sizeof($block->getColumns()); class="admin__control-text" onkeypress="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> - <?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> + <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> </label> <?php if ($_curPage < $_lastPage): ?> <button type="button" - title="<?= /* @escapeNotVerified */ __('Next page') ?>" + title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> - <span><?= /* @escapeNotVerified */ __('Next page') ?></span> + <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> - <button type="button" class="action-next disabled"><span><?= /* @escapeNotVerified */ __('Next page') ?></span></button> + <button type="button" class="action-next disabled"><span><?= $block->escapeHtml(__('Next page')) ?></span></button> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml index ea995d9a80b28..68bb2a0490be6 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml @@ -19,7 +19,7 @@ id="<?= $block->getHtmlId() ?>-select" class="required-entry local-validation admin__control-select" <?= /* @escapeNotVerified */ $block->getUiId('select') ?>> - <option class="admin__control-select-placeholder" value="" selected><?= /* @escapeNotVerified */ __('Actions') ?></option> + <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item):?> <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> <?php endforeach; ?> @@ -47,21 +47,21 @@ class="action-select-multiselect _disabled" disabled="disabled" data-menu="grid-mass-select"> - <optgroup label="<?= /* @escapeNotVerified */ __('Mass Actions') ?>"> + <optgroup label="<?= $block->escapeHtml(__('Mass Actions')) ?>"> <option disabled selected></option> <?php if ($block->getUseSelectAll()):?> <option value="selectAll"> - <?= /* @escapeNotVerified */ __('Select All') ?> + <?= $block->escapeHtml(__('Select All')) ?> </option> <option value="unselectAll"> - <?= /* @escapeNotVerified */ __('Unselect All') ?> + <?= $block->escapeHtml(__('Unselect All')) ?> </option> <?php endif; ?> <option value="selectVisible"> - <?= /* @escapeNotVerified */ __('Select Visible') ?> + <?= $block->escapeHtml(__('Select Visible')) ?> </option> <option value="unselectVisible"> - <?= /* @escapeNotVerified */ __('Unselect Visible') ?> + <?= $block->escapeHtml(__('Unselect Visible')) ?> </option> </optgroup> </select> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml index f969fa61097ae..1e5369e8d624f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml @@ -17,7 +17,7 @@ <select id="<?= $block->getHtmlId() ?>-select" class="required-entry local-validation admin__control-select"> - <option class="admin__control-select-placeholder" value="" selected><?= /* @escapeNotVerified */ __('Actions') ?></option> + <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item): ?> <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> <?php endforeach; ?> @@ -41,21 +41,21 @@ id="<?= $block->getHtmlId() ?>-mass-select" class="action-select-multiselect" data-menu="grid-mass-select"> - <optgroup label="<?= /* @escapeNotVerified */ __('Mass Actions') ?>"> + <optgroup label="<?= $block->escapeHtml(__('Mass Actions')) ?>"> <option disabled selected></option> <?php if ($block->getUseSelectAll()):?> <option value="selectAll"> - <?= /* @escapeNotVerified */ __('Select All') ?> + <?= $block->escapeHtml(__('Select All')) ?> </option> <option value="unselectAll"> - <?= /* @escapeNotVerified */ __('Unselect All') ?> + <?= $block->escapeHtml(__('Unselect All')) ?> </option> <?php endif; ?> <option value="selectVisible"> - <?= /* @escapeNotVerified */ __('Select Visible') ?> + <?= $block->escapeHtml(__('Select Visible')) ?> </option> <option value="unselectVisible"> - <?= /* @escapeNotVerified */ __('Unselect Visible') ?> + <?= $block->escapeHtml(__('Unselect Visible')) ?> </option> </optgroup> </select> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml index 287028f9a1122..d66e0f99862b7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml @@ -37,13 +37,13 @@ <span class="admin__page-nav-item-message _changed"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('Changes have been made to this section that have not been saved.') ?> + <?= $block->escapeHtml(__('Changes have been made to this section that have not been saved.')) ?> </span> </span> <span class="admin__page-nav-item-message _error"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('This tab contains invalid data. Please resolve this before saving.') ?> + <?= $block->escapeHtml(__('This tab contains invalid data. Please resolve this before saving.')) ?> </span> </span> <span class="admin__page-nav-item-message-loader"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml index c76f10da0f927..8a240742a8822 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml @@ -20,9 +20,9 @@ <li> <a href="<?= $block->escapeHtmlAttr($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" class="<?= $block->escapeHtmlAttr($_tabClass) ?>" data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>"> <span> - <span class="changed" title="<?= /* @escapeNotVerified */ __('The information in this tab has been changed.') ?>"></span> - <span class="error" title="<?= /* @escapeNotVerified */ __('This tab contains invalid data. Please resolve this before saving.') ?>"></span> - <span class="loader" title="<?= /* @escapeNotVerified */ __('Loading...') ?>"></span> + <span class="changed" title="<?= $block->escapeHtml(__('The information in this tab has been changed.')) ?>"></span> + <span class="error" title="<?= $block->escapeHtml(__('This tab contains invalid data. Please resolve this before saving.')) ?>"></span> + <span class="loader" title="<?= $block->escapeHtml(__('Loading...')) ?>"></span> <?= /* @escapeNotVerified */ $block->getTabLabel($_tab) ?> </span> </a> From 7e7a84fd85f5f7fd4dd15adf7b747a7b43b39bc4 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 14:43:01 -0500 Subject: [PATCH 174/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../adminhtml/templates/dashboard/graph.phtml | 6 ++--- .../adminhtml/templates/dashboard/grid.phtml | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index 64703420ddaa7..4eba356a8486f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -17,15 +17,15 @@ <?php if (in_array($value, ['custom'])) { continue; } ?> - <option value="<?= /* @escapeNotVerified */ $value ?>" + <option value="<?= /* @noEscape */ $value ?>" <?php if ($block->getRequest()->getParam('period') == $value): ?> selected="selected"<?php endif; ?> - ><?= /* @escapeNotVerified */ $label ?></option> + ><?= $block->escapeHtml($label) ?></option> <?php endforeach; ?> </select> </div> <?php if ($block->getCount()): ?> <div class="dashboard-diagram-image"> - <img src="<?= /* @escapeNotVerified */ $block->getChartUrl(false) ?>" class="dashboard-diagram-chart" alt="Chart" title="Chart" /> + <img src="<?= $block->escapeUrl($block->getChartUrl(false)) ?>" class="dashboard-diagram-chart" alt="Chart" title="Chart" /> </div> <?php else: ?> <div class="dashboard-diagram-nodata"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index 1041aef59ceac..11db29ad25bd5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -14,7 +14,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->getCollection()): ?> <div class="dashboard-item-content"> <?php if ($block->getCollection()->getSize()>0): ?> - <table class="admin__table-primary dashboard-data" id="<?= /* @escapeNotVerified */ $block->getId() ?>_table"> + <table class="admin__table-primary dashboard-data" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_table"> <?php /* This part is commented to remove all <col> tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> @@ -34,9 +34,9 @@ $numColumns = sizeof($block->getColumns()); <?php if (!$block->getIsCollapsed()): ?> <tbody> <?php foreach ($block->getCollection() as $_index => $_item): ?> - <tr title="<?= /* @escapeNotVerified */ $block->getRowUrl($_item) ?>"> + <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"> <?php $i = 0; foreach ($block->getColumns() as $_column): ?> - <td class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> <?= ++$i == $numColumns ? 'last' : '' ?>"><?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> + <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= ++$i == $numColumns ? 'last' : '' ?>"><?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> @@ -44,7 +44,7 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> </table> <?php else: ?> - <div class="<?= /* @escapeNotVerified */ $block->getEmptyTextClass() ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></div> + <div class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></div> <?php endif; ?> </div> <?php if ($block->canDisplayContainer()): ?> @@ -65,23 +65,23 @@ require(deps, function(<?= ($block->getDependencyJsObject() ? 'registry' : '') ? <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> <?php if ($block->getDependencyJsObject()): ?> - registry.get('<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>', function (<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>) { + registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { <?php endif; ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?> = new varienGrid('<?= /* @escapeNotVerified */ $block->getId() ?>', '<?= /* @escapeNotVerified */ $block->getGridUrl() ?>', '<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameSort() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameDir() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameFilter() ?>'); - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.useAjax = '<?= /* @escapeNotVerified */ $block->getUseAjax() ?>'; + <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeJs($block->getId()) ?>', '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; <?php if ($block->getRowClickCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.rowClickCallback = <?= /* @escapeNotVerified */ $block->getRowClickCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; <?php endif; ?> <?php if ($block->getCheckboxCheckCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.checkboxCheckCallback = <?= /* @escapeNotVerified */ $block->getCheckboxCheckCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> <?php if ($block->getRowInitCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.initRowCallback = <?= /* @escapeNotVerified */ $block->getRowInitCallback() ?>; - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.rows.each(function(row){<?= /* @escapeNotVerified */ $block->getRowInitCallback() ?>(<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>, row)}); + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rows.each(function(row){<?= /* @noEscape */ $block->getRowInitCallback() ?>(<?= $block->escapeJs($block->getJsObjectName()) ?>, row)}); <?php endif; ?> <?php if ($block->getMassactionBlock()->isAvailable()): ?> - <?= /* @escapeNotVerified */ $block->getMassactionBlock()->getJavaScript() ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> <?php endif ?> <?php if ($block->getDependencyJsObject()): ?> From a8f8fe0a1844db0d4bca4b1e3af9317423d30724 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 15:27:58 -0500 Subject: [PATCH 175/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../adminhtml/templates/dashboard/index.phtml | 4 ++-- .../templates/dashboard/salebar.phtml | 6 ++--- .../templates/dashboard/searches.phtml | 2 +- .../templates/dashboard/store/switcher.phtml | 10 ++++----- .../templates/dashboard/totalbar.phtml | 6 ++--- .../adminhtml/templates/media/uploader.phtml | 10 ++++----- .../adminhtml/templates/page/header.phtml | 16 +++++++------- .../templates/page/js/calendar.phtml | 15 ++++++------- .../templates/page/js/require_js.phtml | 6 ++--- .../adminhtml/templates/page/report.phtml | 2 +- .../adminhtml/templates/store/switcher.phtml | 22 +++++++++---------- .../switcher/form/renderer/fieldset.phtml | 2 +- 12 files changed, 50 insertions(+), 51 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml index 052e3b54d5a04..3516c632f1a7e 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml @@ -18,12 +18,12 @@ require([ window.changeDiagramsPeriod = function(periodObj) { periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : ''; <?php foreach ($block->getChildBlock('diagrams')->getTabsIds() as $tabId): ?> - ajaxBlockParam = 'block/tab_<?= /* @escapeNotVerified */ $tabId ?>/'; + ajaxBlockParam = 'block/tab_<?= $block->escapeJs($tabId) ?>/'; ajaxBlockUrl = '<?= $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => '']) ?>' + ajaxBlockParam + periodParam; new Ajax.Request(ajaxBlockUrl, { parameters: {isAjax: 'true', form_key: FORM_KEY}, onSuccess: function(transport) { - tabContentElementId = '<?= /* @escapeNotVerified */ $block->getChildBlock('diagrams')->getId() ?>_<?= /* @escapeNotVerified */ $tabId ?>_content'; + tabContentElementId = '<?= $block->escapeJs($block->getChildBlock('diagrams')->getId()) ?>_<?= $block->escapeJs($tabId) ?>_content'; try { if (transport.responseText.isJSON()) { var response = transport.responseText.evalJSON() diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml index 450a2c89b50da..fc16f7ff586ac 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml @@ -10,11 +10,11 @@ <?php if (sizeof($block->getTotals()) > 0): ?> <?php foreach ($block->getTotals() as $_total): ?> <div class="dashboard-item dashboard-item-primary"> - <div class="dashboard-item-title"><?= /* @escapeNotVerified */ $_total['label'] ?></div> + <div class="dashboard-item-title"><?= $block->escapeHtml($_total['label']) ?></div> <div class="dashboard-item-content"> <strong class="dashboard-sales-value"> - <?= /* @escapeNotVerified */ $_total['value'] ?> - <span class="dashboard-sales-decimals"><?= /* @escapeNotVerified */ $_total['decimals'] ?></span> + <?= /* @noEscape */ $_total['value'] ?> + <span class="dashboard-sales-decimals"><?= /* @noEscape */ $_total['decimals'] ?></span> </strong> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml index 6216cee30dbc5..aaf6cf61ab678 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml @@ -10,7 +10,7 @@ <?php if (count($block->getCollection()->getItems()) > 0): ?> <div class="searches-results"> <?php foreach ($block->getCollection()->getItems() as $item): ?> - <span><?= /* @escapeNotVerified */ $item->getQueryText() ?></span><br /> + <span><?= $block->escapeHtml($item->getQueryText()) ?></span><br /> <?php endforeach; ?> </div> <?php else: ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index a1e88d2763f77..ecf3ac1621b80 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -18,14 +18,14 @@ <?php foreach ($block->getStoreCollection($_group) as $_store): ?> <?php if ($showWebsite == false): ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= /* @escapeNotVerified */ $_website->getId() ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ $_website->getName() ?></option> + <option website="true" value="<?= $block->escapeHtmlAttr($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> <?php endif; ?> <?php if ($showGroup == false): ?> <?php $showGroup = true; ?> - <!--optgroup label="   <?= /* @escapeNotVerified */ $_group->getName() ?>"--> - <option group="true" value="<?= /* @escapeNotVerified */ $_group->getId() ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected="selected"<?php endif; ?>>   <?= /* @escapeNotVerified */ $_group->getName() ?></option> + <!--optgroup label="   <?= /* @noEscape */ $_group->getName() ?>"--> + <option group="true" value="<?= $block->escapeHtmlAttr($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected="selected"<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= /* @escapeNotVerified */ $_store->getId() ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>>      <?= /* @escapeNotVerified */ $_store->getName() ?></option> + <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php if ($showGroup): ?> <!--</optgroup>--> @@ -57,7 +57,7 @@ var select = $('order_amounts_period'); } var periodParam = select.value ? 'period/' + select.value + '/' : ''; - setLocation('<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>' + storeParam + periodParam); + setLocation('<?= $block->escapeJs($block->getSwitchUrl()) ?>' + storeParam + periodParam); } }); </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml index 8605304b1f528..cce4e9d4e885c 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml @@ -12,10 +12,10 @@ <ul class="dashboard-totals-list"> <?php foreach ($block->getTotals() as $_total): ?> <li class="dashboard-totals-item"> - <span class="dashboard-totals-label"><?= /* @escapeNotVerified */ $_total['label'] ?></span> + <span class="dashboard-totals-label"><?= $block->escapeHtml($_total['label']) ?></span> <strong class="dashboard-totals-value"> - <?= /* @escapeNotVerified */ $_total['value'] ?> - <span class="dashboard-totals-decimals"><?= /* @escapeNotVerified */ $_total['decimals'] ?></span> + <?= /* @noEscape */ $_total['value'] ?> + <span class="dashboard-totals-decimals"><?= /* @noEscape */ $_total['decimals'] ?></span> </strong> </li> <?php endforeach; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 34b8745501eb4..aacd6aed149cf 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -12,17 +12,17 @@ <div id="<?= $block->getHtmlId() ?>" class="uploader" data-mage-init='{ "Magento_Backend/js/media-uploader" : { - "maxFileSize": <?= /* @escapeNotVerified */ $block->getFileSizeService()->getMaxFileSize() ?>, - "maxWidth": <?= /* @escapeNotVerified */ $block->getImageUploadMaxWidth() ?>, - "maxHeight": <?= /* @escapeNotVerified */ $block->getImageUploadMaxHeight() ?>, + "maxFileSize": <?= /* @noEscape */ $block->getFileSizeService()->getMaxFileSize() ?>, + "maxWidth": <?= /* @noEscape */ $block->getImageUploadMaxWidth() ?>, + "maxHeight": <?= /* @noEscape */ $block->getImageUploadMaxHeight() ?>, "isResizeEnabled": <?= /* @noEscape */ $block->getImageUploadConfigData()->getIsResizeEnabled() ?> } }' > <div class="fileinput-button form-buttons button"> <span><?= $block->escapeHtml(__('Browse Files...')) ?></span> - <input id="fileupload" type="file" name="<?= /* @escapeNotVerified */ $block->getConfig()->getFileField() ?>" - data-url="<?= /* @escapeNotVerified */ $block->getConfig()->getUrl() ?>" multiple="multiple" /> + <input id="fileupload" type="file" name="<?= $block->escapeHtmlAttr($block->getConfig()->getFileField()) ?>" + data-url="<?= $block->escapeHtmlAttr($block->getConfig()->getUrl()) ?>" multiple="multiple" /> </div> <div class="clear"></div> <script id="<?= $block->getHtmlId() ?>-template" type="text/x-magento-template" data-template="uploader"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index 11c6508534a92..b30f123dae749 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -13,17 +13,17 @@ <?php $edition = $block->hasEdition() ? 'data-edition="' . $block->escapeHtml($block->getEdition()) . '"' : ''; ?> <?php $logoSrc = ($block->hasLogoImageSrc()) ? $block->escapeHtml($block->getLogoImageSrc()) : 'images/magento-logo.svg' ?> <a - href="<?= /* @escapeNotVerified */ $block->getHomeLink() ?>" - <?= /* @escapeNotVerified */ $edition ?> + href="<?= $block->escapeUrl($block->getHomeLink()) ?>" + <?= /* @noEscape */ $edition ?> class="logo"> - <img class="logo-img" src="<?= /* @escapeNotVerified */ $block->getViewFileUrl($logoSrc) ?>" + <img class="logo-img" src="<?= /* @noEscape */ $block->getViewFileUrl($logoSrc) ?>" alt="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>" title="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>"/> </a> <?php break; ?> <?php case 'user': ?> <div class="admin-user admin__action-dropdown-wrap"> <a - href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/system_account/index') ?>" + href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>" class="admin__action-dropdown" title="<?= $block->escapeHtml(__('My Account')) ?>" data-mage-init='{"dropdown":{}}' @@ -36,8 +36,8 @@ <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::myaccount')): ?> <li> <a - href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/system_account/index') ?>" - <?= /* @escapeNotVerified */ $block->getUiId('user', 'account', 'settings') ?> + href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>" + <?= /* @noEscape */ $block->getUiId('user', 'account', 'settings') ?> title="<?= $block->escapeHtml(__('Account Setting')) ?>"> <?= $block->escapeHtml(__('Account Setting')) ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>) </a> @@ -45,7 +45,7 @@ <?php endif; ?> <li> <a - href="<?= /* @escapeNotVerified */ $block->getBaseUrl() ?>" + href="<?= /* @noEscape */ $block->getBaseUrl() ?>" title="<?= $block->escapeHtml(__('Customer View')) ?>" target="_blank" class="store-front"> <?= $block->escapeHtml(__('Customer View')) ?> @@ -53,7 +53,7 @@ </li> <li> <a - href="<?= /* @escapeNotVerified */ $block->getLogoutLink() ?>" + href="<?= /* @noEscape */ $block->getLogoutLink() ?>" class="account-signout" title="<?= $block->escapeHtml(__('Sign Out')) ?>"> <?= $block->escapeHtml(__('Sign Out')) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml index e0d9029bf022a..38707284a6971 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// no notice of license for now ?> <?php @@ -22,12 +21,12 @@ require([ $.extend(true, $, { calendarConfig: { - dayNames: <?= /* @escapeNotVerified */ $days['wide'] ?>, - dayNamesMin: <?= /* @escapeNotVerified */ $days['abbreviated'] ?>, - monthNames: <?= /* @escapeNotVerified */ $months['wide'] ?>, - monthNamesShort: <?= /* @escapeNotVerified */ $months['abbreviated'] ?>, + dayNames: <?= /* @noEscape */ $days['wide'] ?>, + dayNamesMin: <?= /* @noEscape */ $days['abbreviated'] ?>, + monthNames: <?= /* @noEscape */ $months['wide'] ?>, + monthNamesShort: <?= /* @noEscape */ $months['abbreviated'] ?>, infoTitle: "<?= $block->escapeHtml(__('About the calendar')) ?>", - firstDay: <?= /* @escapeNotVerified */ $firstDay ?>, + firstDay: <?= /* @noEscape */ $firstDay ?>, closeText: "<?= $block->escapeHtml(__('Close')) ?>", currentText: "<?= $block->escapeHtml(__('Go Today')) ?>", prevText: "<?= $block->escapeHtml(__('Previous')) ?>", @@ -52,11 +51,11 @@ require([ showMinute: false, serverTimezoneSeconds: <?= (int) $block->getStoreTimestamp() ?>, serverTimezoneOffset: <?= (int) $block->getTimezoneOffsetSeconds() ?>, - yearRange: '<?= /* @escapeNotVerified */ $block->getYearRange() ?>' + yearRange: '<?= /* @noEscape */ $block->getYearRange() ?>' } }); -enUS = <?= /* @escapeNotVerified */ $enUS ?>; // en_US locale reference +enUS = <?= /* @noEscape */ $enUS ?>; // en_US locale reference }); </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml index 9cb2cec091939..68453d9ff8ff2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml @@ -5,9 +5,9 @@ */ ?> <script> - var BASE_URL = '<?= /* @escapeNotVerified */ $block->getUrl('*') ?>'; - var FORM_KEY = '<?= /* @escapeNotVerified */ $block->getFormKey() ?>'; + var BASE_URL = '<?= /* @noEscape */ $block->getUrl('*') ?>'; + var FORM_KEY = '<?= /* @noEscape */ $block->getFormKey() ?>'; var require = { - "baseUrl": "<?= /* @escapeNotVerified */ $block->getViewFileUrl('/') ?>" + "baseUrl": "<?= /* @noEscape */ $block->getViewFileUrl('/') ?>" }; </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml index a61ffc515c8f3..2d6601f7233dc 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml @@ -8,7 +8,7 @@ ?> <?php if ($block->getBugreportUrl()): ?> - <a class="link-report" href="<?= /* @escapeNotVerified */ $block->getBugreportUrl() ?>" id="footer_bug_tracking" target="_blank"> + <a class="link-report" href="<?= $block->escapeUrl($block->getBugreportUrl()) ?>" id="footer_bug_tracking" target="_blank"> <?= $block->escapeHtml(__('Report an Issue')) ?> </a> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index e6ef65443c6d3..6987ca92d2113 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -14,17 +14,17 @@ <span class="store-switcher-label"><?= $block->escapeHtml(__('Store View:')) ?></span> <div class="actions dropdown closable"> <input type="hidden" name="store_switcher" id="store_switcher" - data-role="store-view-id" data-param="<?= /* @escapeNotVerified */ $block->getStoreVarName() ?>" + data-role="store-view-id" data-param="<?= $block->escapeHtmlAttr($block->getStoreVarName()) ?>" value="<?= $block->escapeHtml($block->getStoreId()) ?>" - onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?> /> + onchange="switchScope(this);"<?= /* @noEscape */ $block->getUiId() ?> /> <input type="hidden" name="store_group_switcher" id="store_group_switcher" - data-role="store-group-id" data-param="<?= /* @escapeNotVerified */ $block->getStoreGroupVarName() ?>" + data-role="store-group-id" data-param="<?= $block->escapeHtmlAttr($block->getStoreGroupVarName()) ?>" value="<?= $block->escapeHtml($block->getStoreGroupId()) ?>" - onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?> /> + onchange="switchScope(this);"<?= /* @noEscape */ $block->getUiId() ?> /> <input type="hidden" name="website_switcher" id="website_switcher" - data-role="website-id" data-param="<?= /* @escapeNotVerified */ $block->getWebsiteVarName() ?>" + data-role="website-id" data-param="<?= $block->escapeHtmlAttr($block->getWebsiteVarName()) ?>" value="<?= $block->escapeHtml($block->getWebsiteId()) ?>" - onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?> /> + onchange="switchScope(this);"<?= /* @noEscape */ $block->getUiId() ?> /> <button type="button" class="admin__action-dropdown" @@ -32,7 +32,7 @@ data-toggle="dropdown" aria-haspopup="true" id="store-change-button"> - <?= /* @escapeNotVerified */ $block->getCurrentSelectionName() ?> + <?= $block->escapeHtml($block->getCurrentSelectionName()) ?> </button> <ul class="dropdown-menu" data-role="stores-list"> <?php if ($block->hasDefaultOption()): ?> @@ -44,12 +44,12 @@ <?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) { ?> <a data-role="store-view-id" data-value="" href="#"> - <?= /* @escapeNotVerified */ $block->getDefaultSelectionName() ?> + <?= $block->escapeHtml($block->getDefaultSelectionName()) ?> </a> <?php } else { ?> - <span><?= /* @escapeNotVerified */ $block->getDefaultSelectionName() ?></span> + <span><?= $block->escapeHtml($block->getDefaultSelectionName()) ?></span> <?php } ?> </li> @@ -121,7 +121,7 @@ <?php endforeach; ?> <?php if ($block->getShowManageStoresLink() && $block->getAuthorization()->isAllowed('Magento_Backend::store')): ?> <li class="dropdown-toolbar"> - <a href="<?= /* @escapeNotVerified */ $block->getUrl('*/system_store') ?>"><?= $block->escapeHtml(__('Stores Configuration')) ?></a> + <a href="<?= /* @noEscape */ $block->getUrl('*/system_store') ?>"><?= $block->escapeHtml(__('Stores Configuration')) ?></a> </li> <?php endif; ?> </ul> @@ -194,7 +194,7 @@ require([ function reload() { <?php if (!$block->isUsingIframe()): ?> - var url = '<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>' + scopeParams; + var url = '<?= $block->escapeJs($block->getSwitchUrl()) ?>' + scopeParams; setLocation(url); <?php else: ?> jQuery('#preview_selected_store').val(scopeId); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml index 49a2c681285bf..e737193b538ea 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml @@ -9,7 +9,7 @@ ?> <?php $_element = $block->getElement() ?> <?php if ($_element->getFieldsetContainerId()): ?> - <div id="<?= /* @escapeNotVerified */ $_element->getFieldsetContainerId() ?>">789 + <div id="<?= $block->escapeHtmlAttr($_element->getFieldsetContainerId()) ?>">789 <?php endif; ?> <?php if (!$_element->getNoContainer()): ?> From 7ad7a7015d8013c571b1624bd2c16352272f623b Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 15:44:17 -0500 Subject: [PATCH 176/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../view/adminhtml/templates/system/autocomplete.phtml | 4 ++-- .../view/adminhtml/templates/system/cache/edit.phtml | 4 ++-- .../view/adminhtml/templates/system/design/edit.phtml | 2 +- .../view/adminhtml/templates/system/search.phtml | 8 ++++---- .../view/adminhtml/templates/widget/breadcrumbs.phtml | 2 +- .../view/adminhtml/templates/widget/form/element.phtml | 4 ++-- .../templates/widget/form/renderer/fieldset.phtml | 2 +- .../Backend/view/adminhtml/templates/widget/tabs.phtml | 10 +++++----- .../view/adminhtml/templates/widget/tabshoriz.phtml | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml index 22d93241f43f2..2e1f361bf8701 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml @@ -9,8 +9,8 @@ ?> <ul class="dropdown-menu"> <?php foreach ($items as $item): ?> - <li id="<?= /* @escapeNotVerified */ $item['id'] ?>" class="item"> - <a href="<?= /* @escapeNotVerified */ $item['url'] ?>" class="title"><?= $block->escapeHtml($item['name']) ?></a> + <li id="<?= $block->escapeHtmlAttr($item['id']) ?>" class="item"> + <a href="<?= $block->escapeUrl($item['url']) ?>" class="title"><?= $block->escapeHtml($item['name']) ?></a> <div class="type"><?= /* @escapeNotVerified */ $item['type'] ?></div> <?= $block->escapeHtml($item['description']) ?> </li> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml index ac3f86011a5d0..fcd6f098c069a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml @@ -17,7 +17,7 @@ */ ?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions"><?= $block->getSaveButtonHtml() ?></div> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" id="config-edit-form" enctype="multipart/form-data"> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" id="config-edit-form" enctype="multipart/form-data"> <?= $block->getBlockHtml('formkey') ?> <script> @@ -52,7 +52,7 @@ <?php if (isset($_button['warning']) && $_button['warning']): ?> <?php $clickAction = "if (confirm('" . addslashes($_button['warning']) . "')) {{$clickAction}}"; ?> <?php endif; ?> - <button <?php if (!isset($_button['disabled']) || !$_button['disabled']):?>onclick="<?= /* @escapeNotVerified */ $clickAction ?>"<?php endif; ?> id="<?= /* @escapeNotVerified */ $_button['name'] ?>" type="button" class="scalable <?php if (isset($_button['disabled']) && $_button['disabled']):?>disabled<?php endif; ?>" style=""><span><span><span><?= /* @escapeNotVerified */ $_button['action'] ?></span></span></span></button> + <button <?php if (!isset($_button['disabled']) || !$_button['disabled']):?>onclick="<?= /* @noEscape */ $clickAction ?>"<?php endif; ?> id="<?= $block->escapeHtmlAttr($_button['name']) ?>" type="button" class="scalable <?php if (isset($_button['disabled']) && $_button['disabled']):?>disabled<?php endif; ?>" style=""><span><span><span><?= $block->escapeHtml($_button['action']) ?></span></span></span></button> <?php if (isset($_button['comment'])): ?> <br /> <small><?= /* @escapeNotVerified */ $_button['comment'] ?></small> <?php endif; ?> <?php endforeach; ?> </td> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml index 6b2f932cac7bf..c9cd765de35be 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ ?> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" id="design-edit-form"> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" id="design-edit-form"> <?= $block->getBlockHtml('formkey') ?> </form> <script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index e2455de2f6a5f..5ddd14ebd145f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -28,16 +28,16 @@ <script data-template="search-suggest" type="text/x-magento-template"> <ul class="search-global-menu"> <li class="item"> - <a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getUrl('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a> + <a id="searchPreviewProducts" href="<?= $block->escapeUrl($block->getUrl('catalog/product/index/')) ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a> </li> <li class="item"> - <a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getUrl('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a> + <a id="searchPreviewOrders" href="<?= $block->escapeUrl($block->getUrl('sales/order/index/')) ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a> </li> <li class="item"> - <a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a> + <a id="searchPreviewCustomers" href="<?= $block->escapeUrl($block->getUrl('customer/index/index/')) ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a> </li> <li class="item"> - <a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getUrl('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a> + <a id="searchPreviewPages" href="<?= $block->escapeUrl($block->getUrl('cms/page/index/')) ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a> </li> <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml index 74cd4eb7f2c9d..13b4c83757a6c 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml @@ -19,7 +19,7 @@ <strong><?= $block->escapeHtml($_link['label']) ?></strong> <?php endif; ?> <?php else: ?> - <a href="<?= /* @escapeNotVerified */ $_link['url'] ?>" title="<?= $block->escapeHtml($_link['title']) ?>"><?= $block->escapeHtml($_link['label']) ?></a> + <a href="<?= $block->escapeUrl($_link['url']) ?>" title="<?= $block->escapeHtml($_link['title']) ?>"><?= $block->escapeHtml($_link['label']) ?></a> <?php endif; ?> <?php if ($_index != $_size-1): ?> » diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index 720bc1e58259d..dd6be50f45f14 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -20,12 +20,12 @@ case 'column': ?> <?php break; case 'hidden': ?> - <input type="<?= /* @escapeNotVerified */ $element->getType() ?>" name="<?= /* @escapeNotVerified */ $element->getName() ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>"> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>"> <?php break; case 'select': ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <select name="<?= /* @escapeNotVerified */ $element->getName() ?>" id="<?= $element->getHtmlId() ?>" class="select<?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>"> + <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>"> <?php foreach ($element->getValues() as $_value): ?> <option <?= /* @escapeNotVerified */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ $_value->getLabel() ?></option> <?php endforeach; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index aaf1cb5ff550e..a0b11ab43b921 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -39,7 +39,7 @@ if ($isField) { <?php if ($isWrapped): ?> <div class="fieldset-wrapper <?= ($isCollapsable) ? 'admin__collapsible-block-wrapper ' : '' ?>" - id="<?= /* @escapeNotVerified */ $containerId ? $containerId : $id . '-wrapper' ?>" + id="<?= $block->escapeHtmlAttr($containerId ? $containerId : $id . '-wrapper') ?>" data-role="<?= /* @escapeNotVerified */ $id ?>-wrapper"> <div class="fieldset-wrapper-title admin__fieldset-wrapper-title"> <strong <?php /* @escapeNotVerified */ echo($isCollapsable) ? diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml index d66e0f99862b7..7565b0751bbd0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml @@ -10,14 +10,14 @@ ?> <?php if (!empty($tabs)): ?> -<div class="admin__page-nav" data-role="container" id="<?= /* @escapeNotVerified */ $block->getId() ?>"> +<div class="admin__page-nav" data-role="container" id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> <?php if ($block->getTitle()): ?> <div class="admin__page-nav-title" data-role="title" <?= /* @escapeNotVerified */ $block->getUiId('title') ?>> <strong><?= /* @escapeNotVerified */ $block->getTitle() ?></strong> <span data-role="title-messages" class="admin__page-nav-title-messages"></span> </div> <?php endif ?> - <ul <?= /* @escapeNotVerified */ $block->getUiId('tab', $block->getId()) ?> class="<?= /* @escapeNotVerified */ $block->getIsHoriz() ? 'tabs-horiz' : 'tabs admin__page-nav-items' ?>"> + <ul <?= /* @escapeNotVerified */ $block->getUiId('tab', $block->getId()) ?> class="<?= /* @noEscape */ $block->getIsHoriz() ? 'tabs-horiz' : 'tabs admin__page-nav-items' ?>"> <?php foreach ($tabs as $_tab): ?> <?php if (!$block->canShowTab($_tab)): continue; endif; ?> @@ -26,9 +26,9 @@ <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> <li class="admin__page-nav-item" <?php if ($block->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?><?= /* @escapeNotVerified */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> - <a href="<?= /* @escapeNotVerified */ $_tabHref ?>" id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>" name="<?= /* @escapeNotVerified */ $block->getTabId($_tab, false) ?>" title="<?= /* @escapeNotVerified */ $block->getTabTitle($_tab) ?>" + <a href="<?= $block->escapeUrl($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" name="<?= $block->escapeHtmlAttr($block->getTabId($_tab, false)) ?>" title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" class="admin__page-nav-link <?= /* @escapeNotVerified */ $_tabClass ?>" - data-tab-type="<?= /* @escapeNotVerified */ $_tabType ?>" + data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>" <?= /* @escapeNotVerified */ $block->getUiId('tab', 'link', $_tab->getId()) ?>> <span><?= /* @escapeNotVerified */ $block->getTabLabel($_tab) ?></span> @@ -54,7 +54,7 @@ </span> </span> </a> - <div id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>_content" style="display:none;"<?= /* @escapeNotVerified */ $block->getUiId('tab', 'content', $_tab->getId()) ?>><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none;"<?= /* @escapeNotVerified */ $block->getUiId('tab', 'content', $_tab->getId()) ?>><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> </li> <?php endforeach; ?> </ul> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml index 8a240742a8822..8ed40cd06ebd9 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml @@ -11,7 +11,7 @@ <h3><?= /* @escapeNotVerified */ $block->getTitle() ?></h3> <?php endif ?> --> <?php if (!empty($tabs)): ?> -<div id="<?= /* @escapeNotVerified */ $block->getId() ?>"> +<div id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> <ul class="tabs-horiz"> <?php foreach ($tabs as $_tab): ?> <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> From 4179c9ffa87f03a18d023cdf54d61804e92cd5f0 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 15:48:16 -0500 Subject: [PATCH 177/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../adminhtml/templates/widget/form/element.phtml | 14 +++++++------- .../templates/widget/form/renderer/fieldset.phtml | 10 +++++----- .../adminhtml/templates/widget/tabshoriz.phtml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index dd6be50f45f14..1cecff73c950f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -20,12 +20,12 @@ case 'column': ?> <?php break; case 'hidden': ?> - <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>"> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>"> <?php break; case 'select': ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>"> + <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"> <?php foreach ($element->getValues() as $_value): ?> <option <?= /* @escapeNotVerified */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ $_value->getLabel() ?></option> <?php endforeach; ?> @@ -37,20 +37,20 @@ case 'password': ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>" <?= /* @escapeNotVerified */ $block->getUiId('label') ?>><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <input type="<?= /* @escapeNotVerified */ $element->getType() ?>" name="<?= /* @escapeNotVerified */ $element->getName() ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> </span> <?php break; case 'radio': ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <input type="<?= /* @escapeNotVerified */ $element->getType() ?>" name="<?= /* @escapeNotVerified */ $element->getName() ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>"/> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"/> </span> <?php break; case 'radios': ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label> <?php foreach ($element->getRadios() as $_radio): ?> - <input type="radio" name="<?= /* @escapeNotVerified */ $_radio->getName() ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $_radio->getValue() ?>" class="input-radio <?= /* @escapeNotVerified */ $_radio->getClass() ?>" title="<?= /* @escapeNotVerified */ $_radio->getTitle() ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= /* @escapeNotVerified */ $_radio->getLabel() ?> + <input type="radio" name="<?= $block->escapeHtmlAttr($_radio->getName()) ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($_radio->getValue()) ?>" class="input-radio <?= /* @escapeNotVerified */ $_radio->getClass() ?>" title="<?= $block->escapeHtmlAttr($_radio->getTitle()) ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= /* @escapeNotVerified */ $_radio->getLabel() ?> <?php endforeach; ?> </span> <?php break; @@ -84,13 +84,13 @@ }); }); </script> - <textarea name="<?= /* @escapeNotVerified */ $element->getName() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="80" rows="20"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="80" rows="20"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> </span> <?php break; case 'textarea': ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label> - <textarea name="<?= /* @escapeNotVerified */ $element->getName() ?>" title="<?= /* @escapeNotVerified */ $element->getTitle() ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="15" rows="2"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="15" rows="2"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> </span> <?php break; case 'editor': ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index a0b11ab43b921..128fab75e31bf 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -40,7 +40,7 @@ if ($isField) { <?php if ($isWrapped): ?> <div class="fieldset-wrapper <?= ($isCollapsable) ? 'admin__collapsible-block-wrapper ' : '' ?>" id="<?= $block->escapeHtmlAttr($containerId ? $containerId : $id . '-wrapper') ?>" - data-role="<?= /* @escapeNotVerified */ $id ?>-wrapper"> + data-role="<?= $block->escapeHtmlAttr($id) ?>-wrapper"> <div class="fieldset-wrapper-title admin__fieldset-wrapper-title"> <strong <?php /* @escapeNotVerified */ echo($isCollapsable) ? 'class="admin__collapsible-title" data-toggle="collapse" data-target="#' . $id . '-content"' : @@ -50,14 +50,14 @@ if ($isField) { <?= /* @escapeNotVerified */ $titleActions ?> </div> <div class="fieldset-wrapper-content admin__fieldset-wrapper-content<?= ($isCollapsable) ? ' collapse' : '' ?>" - id="<?= /* @escapeNotVerified */ $id ?>-content" - data-role="<?= /* @escapeNotVerified */ $id ?>-content"> + id="<?= $block->escapeHtmlAttr($id) ?>-content" + data-role="<?= $block->escapeHtmlAttr($id) ?>-content"> <?php endif; ?> <?php if (!$element->getNoContainer()): ?> - <fieldset class="<?= /* @escapeNotVerified */ $cssClass ?>" id="<?= /* @escapeNotVerified */ $id ?>"> + <fieldset class="<?= $block->escapeHtmlAttr($cssClass) ?>" id="<?= $block->escapeHtmlAttr($id) ?>"> <?php if ($element->getLegend() && !$isWrapped): ?> - <legend class="<?= /* @escapeNotVerified */ $isField ? 'label admin__field-label' : 'admin__legend legend' ?>"> + <legend class="<?= /* @noEscape */ $isField ? 'label admin__field-label' : 'admin__legend legend' ?>"> <span><?= /* @escapeNotVerified */ $element->getLegend() ?></span> </legend><br /> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml index 8ed40cd06ebd9..d5be5c32ff7e4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml @@ -26,7 +26,7 @@ <?= /* @escapeNotVerified */ $block->getTabLabel($_tab) ?> </span> </a> - <div id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>_content" style="display:none"><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none"><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> </li> <?php endforeach; ?> </ul> From 3c404b5e6c89512a9fd568d6dab9aacd6d304337 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Wed, 22 May 2019 16:05:26 -0500 Subject: [PATCH 178/464] MC-16607: Fix Unrelated Static Test Failures - fix static --- setup/src/Magento/Setup/Model/UninstallDependencyCheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php index ac00af3b8c1db..8894b2c399d63 100644 --- a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php +++ b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php @@ -106,7 +106,7 @@ public function runUninstallReadinessCheck(array $packages) } return ['success' => true]; - } catch (\RuntimeException $e) { + } catch (\Exception $e) { $message = str_replace(PHP_EOL, '<br/>', $this->escaper->escapeHtml($e->getMessage())); return ['success' => false, 'error' => $message]; } From 1679b3d0529373bdf08980764b9733728b77b6b7 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 22 May 2019 16:14:20 -0500 Subject: [PATCH 179/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../widget/form/element/gallery.phtml | 12 +++--- .../adminhtml/templates/widget/grid.phtml | 16 +++---- .../templates/widget/grid/column_set.phtml | 42 +++++++++---------- .../templates/widget/grid/export.phtml | 6 +-- .../templates/widget/grid/extended.phtml | 38 ++++++++--------- .../templates/widget/grid/massaction.phtml | 2 +- .../widget/grid/massaction_extended.phtml | 2 +- .../templates/widget/grid/serializer.phtml | 2 +- .../adminhtml/templates/widget/tabsleft.phtml | 2 +- 9 files changed, 61 insertions(+), 61 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index 0aa912852937d..99b2538b28c5a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -33,12 +33,12 @@ <tr id="<?= $block->getElement()->getHtmlId() ?>_tr_<?= /* @escapeNotVerified */ $image->getValueId() ?>" class="gallery"> <?php foreach ($block->getValues()->getAttributeBackend()->getImageTypes() as $type): ?> <td class="gallery" align="center" style="vertical-align:bottom;"> - <a href="<?= /* @escapeNotVerified */ $image->setType($type)->getSourceUrl() ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>');return false;"> - <img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>" src="<?= /* @escapeNotVerified */ $image->setType($type)->getSourceUrl() ?>?<?= /* @escapeNotVerified */ time() ?>" alt="<?= /* @escapeNotVerified */ $image->getValue() ?>" title="<?= /* @escapeNotVerified */ $image->getValue() ?>" height="25" class="small-image-preview v-middle"/></a><br/> - <input type="file" name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_<?= /* @escapeNotVerified */ $type ?>[<?= /* @escapeNotVerified */ $image->getValueId() ?>]" size="1"></td> + <a href="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>');return false;"> + <img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>" src="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>?<?= /* @escapeNotVerified */ time() ?>" alt="<?= $block->escapeHtmlAttr($image->getValue()) ?>" title="<?= $block->escapeHtmlAttr($image->getValue()) ?>" height="25" class="small-image-preview v-middle"/></a><br/> + <input type="file" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>_<?= /* @escapeNotVerified */ $type ?>[<?= /* @escapeNotVerified */ $image->getValueId() ?>]" size="1"></td> <?php endforeach; ?> - <td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="<?= /* @escapeNotVerified */ $block->getElement()->getParentName() ?>[position][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" value="<?= /* @escapeNotVerified */ $image->getPosition() ?>" id="<?= $block->getElement()->getHtmlId() ?>_position_<?= /* @escapeNotVerified */ $image->getValueId() ?>" size="3"/></td> - <td class="gallery" align="center" style="vertical-align:bottom;"><?= $block->getDeleteButtonHtml($image->getValueId()) ?><input type="hidden" name="<?= /* @escapeNotVerified */ $block->getElement()->getParentName() ?>[delete][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" id="<?= $block->getElement()->getHtmlId() ?>_delete_<?= /* @escapeNotVerified */ $image->getValueId() ?>"/></td> + <td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[position][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" value="<?= $block->escapeHtmlAttr($image->getPosition()) ?>" id="<?= $block->getElement()->getHtmlId() ?>_position_<?= /* @escapeNotVerified */ $image->getValueId() ?>" size="3"/></td> + <td class="gallery" align="center" style="vertical-align:bottom;"><?= $block->getDeleteButtonHtml($image->getValueId()) ?><input type="hidden" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[delete][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" id="<?= $block->getElement()->getHtmlId() ?>_delete_<?= /* @escapeNotVerified */ $image->getValueId() ?>"/></td> </tr> <?php endforeach; ?> <?php endif; ?> @@ -65,7 +65,7 @@ window.addNewImage = function() id--; num_of_images++; - new_file_input = '<input type="file" name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_%j%[%id%]" size="1">'; + new_file_input = '<input type="file" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>_%j%[%id%]" size="1">'; // Sort order input var new_row_input = document.createElement( 'input' ); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index af9b227dd13d2..ac5d4dd804091 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -59,9 +59,9 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; </div> <?php if ($block->getPagerVisibility()): ?> <div class="admin__data-grid-pager-wrap"> - <select name="<?= /* @escapeNotVerified */ $block->getVarNameLimit() ?>" + <select name="<?= $block->escapeHtmlAttr($block->getVarNameLimit()) ?>" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" - onchange="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.loadByElement(this)" <?= /* @escapeNotVerified */ $block->getUiId('per-page') ?> + onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" <?= /* @escapeNotVerified */ $block->getUiId('per-page') ?> class="admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> selected="selected"<?php endif; ?>>20 @@ -88,7 +88,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php if ($_curPage > 1): ?> <button class="action-previous" type="button" - onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> @@ -97,10 +97,10 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <input type="text" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current" - name="<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>" - value="<?= /* @escapeNotVerified */ $_curPage ?>" + name="<?= $block->escapeHtmlAttr($block->getVarNamePage()) ?>" + value="<?= $block->escapeHtmlAttr($_curPage) ?>" class="admin__control-text" - onkeypress="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> + onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> @@ -109,7 +109,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php if ($_curPage < $_lastPage): ?> <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" - onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> @@ -122,7 +122,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; </div> <div class="admin__data-grid-wrap admin__data-grid-wrap-static"> <?php if ($block->getGridCssClass()): ?> - <table class="<?= /* @escapeNotVerified */ $block->getGridCssClass() ?> data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> + <table class="<?= $block->escapeHtmlAttr($block->getGridCssClass()) ?> data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> <!-- Rendering column set --> <?= $block->getChildHtml('grid.columnSet') ?> </table> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml index 5ff9cfbd96f2c..afba76bcdb72d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml @@ -27,7 +27,7 @@ $numColumns = sizeof($block->getColumns()); <?php foreach ($block->getColumns() as $_column): ?> <?php /* @var $_column \Magento\Backend\Block\Widget\Grid\Column */ ?> <?php if ($_column->getHeaderHtml() == ' '):?> - <th class="data-grid-th" data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" + <th class="data-grid-th" data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> </th> <?php else: ?> <?= $_column->getHeaderHtml() ?> @@ -38,7 +38,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->isFilterVisible()): ?> <tr class="data-grid-filters" data-role="filter-form"> <?php $i = 0; foreach ($block->getColumns() as $_column): ?> - <td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" <?= $_column->getHeaderHtmlProperty() ?>> + <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> <?= $_column->getFilterHtml() ?> </td> <?php endforeach; ?> @@ -53,19 +53,19 @@ $numColumns = sizeof($block->getColumns()); <?php foreach ($block->getCollection() as $_index => $_item): ?> <?php if ($block->hasMultipleRows($_item)) :?> <?php $block->updateItemByFirstMultiRow($_item); ?> - <tr title="<?= /* @escapeNotVerified */ $block->getRowUrl($_item) ?>" data-role="row" - <?php if ($_class = $block->getRowClass($_item)):?> class="<?= /* @escapeNotVerified */ $_class ?>"<?php endif;?> + <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>" data-role="row" + <?php if ($_class = $block->getRowClass($_item)):?> class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif;?> ><?php $i = 0; foreach ($block->getColumns() as $_column): if ($block->shouldRenderCell($_item, $_column)): $_rowspan = $block->getRowspan($_item, $_column); - ?><td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" + ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php if ($block->shouldRenderEmptyCell($_item, $_column)):?> - <td colspan="<?= /* @escapeNotVerified */ $block->getEmptyCellColspan($_item) ?>" class="last"> + <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"> <?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?> </td><?php endif; @@ -79,8 +79,8 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> <tr data-role="row"> <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column): - ?><td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns-1 ? 'last' : '' ?>" + ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns-1 ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td><?php @@ -91,8 +91,8 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->shouldRenderSubTotal($_item)): ?> <tr class="subtotals"> <?php $i = 0; foreach ($block->getMultipleRowColumns() as $_column): ?> - <td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?php /* @escapeNotVerified */ echo $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotals($_item)); @@ -102,19 +102,19 @@ $numColumns = sizeof($block->getColumns()); </tr> <?php endif; ?> <?php else: ?> - <tr data-role="row" title="<?= /* @escapeNotVerified */ $block->getRowUrl($_item) ?>"<?php if ($_class = $block->getRowClass($_item)):?> - class="<?= /* @escapeNotVerified */ $_class ?>"<?php endif;?> + <tr data-role="row" title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)):?> + class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif;?> > <?php $i = 0; foreach ($block->getColumns() as $_column): ?> <?php if ($block->shouldRenderCell($_item, $_column)):?> - <td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td> <?php if ($block->shouldRenderEmptyCell($_item, $_column)):?> - <td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" - colspan="<?= /* @escapeNotVerified */ $block->getEmptyCellColspan($_item) ?>" + <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="col-no-records <?= /* @escapeNotVerified */ $block->getEmptyTextClass() ?> last" > <?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?> @@ -127,8 +127,8 @@ $numColumns = sizeof($block->getColumns()); <?php endforeach; ?> <?php elseif ($block->getEmptyText()): ?> <tr class="data-grid-tr-no-data" data-role="row"> - <td class="<?= /* @escapeNotVerified */ $block->getEmptyTextClass() ?>" - colspan="<?= /* @escapeNotVerified */ $numColumns ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> + <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" + colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> </tr> <?php endif; ?> </tbody> @@ -137,8 +137,8 @@ $numColumns = sizeof($block->getColumns()); <tfoot> <tr class="totals" data-role="row"> <?php foreach ($block->getColumns() as $_column): ?> - <th data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?>" + <th data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>" > <?php /* @escapeNotVerified */ echo($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($block->getTotals()) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml index 073d669416395..4aedef0821d70 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml @@ -8,12 +8,12 @@ ?> <div class="admin__data-grid-export"> - <label for="<?= /* @escapeNotVerified */ $block->getId() ?>_export" class="admin__control-support-text"> + <label for="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" class="admin__control-support-text"> <?= $block->escapeHtml(__('Export to:')) ?> </label> - <select name="<?= /* @escapeNotVerified */ $block->getId() ?>_export" id="<?= /* @escapeNotVerified */ $block->getId() ?>_export" class="admin__control-select"> + <select name="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> - <option value="<?= /* @escapeNotVerified */ $_type->getUrl() ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> <?php endforeach; ?> </select> <?= $block->getExportButtonHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index 469715bac8e86..c64508ed47b2b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -45,7 +45,7 @@ $numColumns = sizeof($block->getColumns()); <select name="<?= $block->escapeHtml($block->getId()) ?>_export" id="<?= $block->escapeHtml($block->getId()) ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> - <option value="<?= /* @escapeNotVerified */ $_type->getUrl() ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> <?php endforeach; ?> </select> <?= $block->getExportButtonHtml() ?> @@ -71,9 +71,9 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->getPagerVisibility()): ?> <div class="admin__data-grid-pager-wrap"> - <select name="<?= /* @escapeNotVerified */ $block->getVarNameLimit() ?>" + <select name="<?= $block->escapeHtmlAttr($block->getVarNameLimit()) ?>" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" - onchange="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.loadByElement(this)" + onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" class="admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> selected="selected"<?php endif; ?>>20 @@ -100,7 +100,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($_curPage > 1): ?> <button class="action-previous" type="button" - onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> @@ -108,10 +108,10 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> <input type="text" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current" - name="<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>" - value="<?= /* @escapeNotVerified */ $_curPage ?>" + name="<?= $block->escapeHtmlAttr($block->getVarNamePage()) ?>" + value="<?= $block->escapeHtmlAttr($_curPage) ?>" class="admin__control-text" - onkeypress="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> + onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> </label> @@ -119,7 +119,7 @@ $numColumns = sizeof($block->getColumns()); <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" - onclick="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> @@ -146,7 +146,7 @@ $numColumns = sizeof($block->getColumns()); <tr> <?php foreach ($block->getColumns() as $_column): ?> <?php if ($_column->getHeaderHtml() == ' '):?> - <th class="data-grid-th" data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" + <th class="data-grid-th" data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> </th> <?php else: ?> <?= $_column->getHeaderHtml() ?> @@ -158,7 +158,7 @@ $numColumns = sizeof($block->getColumns()); <tr class="data-grid-filters" data-role="filter-form"> <?php $i = 0; foreach ($block->getColumns() as $_column): ?> - <td data-column="<?= /* @escapeNotVerified */ $_column->getId() ?>" <?= $_column->getHeaderHtmlProperty() ?>> + <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> <?= $_column->getFilterHtml() ?> </td> <?php endforeach; ?> @@ -170,7 +170,7 @@ $numColumns = sizeof($block->getColumns()); <tfoot> <tr class="totals"> <?php foreach ($block->getColumns() as $_column): ?> - <th class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?>"> + <th class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>"> <?= /* @escapeNotVerified */ ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> </th> <?php endforeach; ?> @@ -181,21 +181,21 @@ $numColumns = sizeof($block->getColumns()); <tbody> <?php if (($block->getCollection()->getSize() > 0) && (!$block->getIsCollapsed())): ?> <?php foreach ($block->getCollection() as $_index => $_item): ?> - <tr title="<?= /* @escapeNotVerified */ $block->getRowUrl($_item) ?>"<?php if ($_class = $block->getRowClass($_item)): ?> - class="<?= /* @escapeNotVerified */ $_class ?>"<?php endif; ?> ><?php + <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)): ?> + class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif; ?> ><?php $i = 0; foreach ($block->getColumns() as $_column): if ($block->shouldRenderCell($_item, $_column)): $_rowspan = $block->getRowspan($_item, $_column); ?> <td <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> - class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php if ($block->shouldRenderEmptyCell($_item, $_column)): ?> - <td colspan="<?= /* @escapeNotVerified */ $block->getEmptyCellColspan($_item) ?>" + <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"><?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?></td><?php endif; endif; @@ -206,7 +206,7 @@ $numColumns = sizeof($block->getColumns()); <tr> <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column): ?> - <td class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> + <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td> @@ -219,7 +219,7 @@ $numColumns = sizeof($block->getColumns()); <tr class="subtotals"> <?php $i = 0; foreach ($block->getSubTotalColumns() as $_column): ?> - <td class="<?= /* @escapeNotVerified */ $_column->getCssProperty() ?> + <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> <?php /* @escapeNotVerified */ echo($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotalItem($_item)) @@ -232,8 +232,8 @@ $numColumns = sizeof($block->getColumns()); <?php endforeach; ?> <?php elseif ($block->getEmptyText()): ?> <tr class="data-grid-tr-no-data"> - <td class="<?= /* @escapeNotVerified */ $block->getEmptyTextClass() ?>" - colspan="<?= /* @escapeNotVerified */ $numColumns ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> + <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" + colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> </tr> <?php endif; ?> </tbody> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml index 68bb2a0490be6..ca5d769a65cce 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml @@ -21,7 +21,7 @@ <?= /* @escapeNotVerified */ $block->getUiId('select') ?>> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item):?> - <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml index 1e5369e8d624f..1bee18ff1103d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml @@ -19,7 +19,7 @@ class="required-entry local-validation admin__control-select"> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item): ?> - <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml index 70e2a87987924..87c3006583ecd 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml @@ -35,7 +35,7 @@ }); </script> <?php else :?> -<input type="hidden" name="<?= /* @escapeNotVerified */ $block->getInputElementName() ?>" value="" id="<?= /* @escapeNotVerified */ $_id ?>" /> +<input type="hidden" name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>" value="" id="<?= $block->escapeHtmlAttr($_id) ?>" /> <script> require([ 'mage/adminhtml/grid' diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml index 6af34ca502f4b..899926844ec9b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml @@ -16,7 +16,7 @@ <ul> <?php foreach ($section['children'] as $menuId => $menuItem): ?> <li id="li-<?= /* @escapeNotVerified */ $id ?>-<?= /* @escapeNotVerified */ $sectionId ?>-<?= /* @escapeNotVerified */ $menuId ?>"> - <a href="#" title="<?= /* @escapeNotVerified */ $menuItem['title'] ?>"> + <a href="#" title="<?= $block->escapeHtmlAttr($menuItem['title']) ?>"> <span><?= /* @escapeNotVerified */ $menuItem['label'] ?></span> </a> </li> From acef25f47364b035659c138fe620b7344cd3964e Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 23 May 2019 11:48:39 +0300 Subject: [PATCH 180/464] MAGETWO-99587: Custom options price from website scope rewrites prices on all scopes --- .../Model/ResourceModel/Product/Option.php | 59 ++++++++++--------- .../Catalog/Model/Product/OptionTest.php | 44 ++++++++++++++ .../_files/core_second_third_fixturestore.php | 4 +- 3 files changed, 76 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php index 179da06b59990..8f4c334038b8d 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Model\ResourceModel\Product; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Store\Model\Store; /** * Catalog product custom option resource model @@ -106,7 +107,7 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje */ if (in_array($object->getType(), $this->getPriceTypes())) { - //save for store_id = 0 + // save for store_id = 0 if (!$object->getData('scope', 'price')) { $statement = $connection->select()->from( $priceTable, @@ -116,11 +117,24 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje $object->getId() )->where( 'store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ); $optionId = $connection->fetchOne($statement); - if ($optionId) { + if (!$optionId) { + $data = $this->_prepareDataForTable( + new \Magento\Framework\DataObject( + [ + 'option_id' => $object->getId(), + 'store_id' => Store::DEFAULT_STORE_ID, + 'price' => $object->getPrice(), + 'price_type' => $object->getPriceType(), + ] + ), + $priceTable + ); + $connection->insert($priceTable, $data); + } elseif ((int)$object->getStoreId() === Store::DEFAULT_STORE_ID) { $data = $this->_prepareDataForTable( new \Magento\Framework\DataObject( ['price' => $object->getPrice(), 'price_type' => $object->getPriceType()] @@ -133,31 +147,18 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje $data, [ 'option_id = ?' => $object->getId(), - 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => Store::DEFAULT_STORE_ID ] ); - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - [ - 'option_id' => $object->getId(), - 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - 'price' => $object->getPrice(), - 'price_type' => $object->getPriceType(), - ] - ), - $priceTable - ); - $connection->insert($priceTable, $data); } } $scope = (int)$this->_config->getValue( - \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + Store::XML_PATH_PRICE_SCOPE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { + if ($object->getStoreId() != '0' && $scope == Store::PRICE_SCOPE_WEBSITE) { $baseCurrency = $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default' @@ -216,7 +217,7 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje } } } - } elseif ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price') + } elseif ($scope == Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price') ) { $connection->delete( $priceTable, @@ -239,20 +240,20 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje { $connection = $this->getConnection(); $titleTableName = $this->getTable('catalog_product_option_title'); - foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { + foreach ([Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { $existInCurrentStore = $this->getColFromOptionTable($titleTableName, (int)$object->getId(), (int)$storeId); - $existInDefaultStore = (int)$storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID ? + $existInDefaultStore = (int)$storeId == Store::DEFAULT_STORE_ID ? $existInCurrentStore : $this->getColFromOptionTable( $titleTableName, (int)$object->getId(), - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ); if ($object->getTitle()) { $isDeleteStoreTitle = (bool)$object->getData('is_delete_store_title'); if ($existInCurrentStore) { - if ($isDeleteStoreTitle && (int)$storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID) { + if ($isDeleteStoreTitle && (int)$storeId != Store::DEFAULT_STORE_ID) { $connection->delete($titleTableName, ['option_title_id = ?' => $existInCurrentStore]); } elseif ($object->getStoreId() == $storeId) { $data = $this->_prepareDataForTable( @@ -270,9 +271,9 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje } } else { // we should insert record into not default store only of if it does not exist in default store - if (($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore) || + if (($storeId == Store::DEFAULT_STORE_ID && !$existInDefaultStore) || ( - $storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && + $storeId != Store::DEFAULT_STORE_ID && !$existInCurrentStore && !$isDeleteStoreTitle ) @@ -291,7 +292,7 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje } } } else { - if ($object->getId() && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID + if ($object->getId() && $object->getStoreId() > Store::DEFAULT_STORE_ID && $storeId ) { $connection->delete( @@ -470,7 +471,7 @@ public function getSearchableData($productId, $storeId) 'option_title_default.option_id=product_option.option_id', $connection->quoteInto( 'option_title_default.store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ) ] ); @@ -517,7 +518,7 @@ public function getSearchableData($productId, $storeId) 'option_title_default.option_type_id=option_type.option_type_id', $connection->quoteInto( 'option_title_default.store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ) ] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php index c9d5ed732df2e..4fbb2e0dcbd56 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php @@ -8,6 +8,8 @@ use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; /** @@ -31,6 +33,12 @@ class OptionTest extends \PHPUnit\Framework\TestCase */ private $customOptionFactory; + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** * @inheritdoc */ @@ -38,6 +46,7 @@ protected function setUp() { $this->productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class); $this->customOptionFactory = Bootstrap::getObjectManager()->create(ProductCustomOptionInterfaceFactory::class); + $this->storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class); } /** @@ -103,4 +112,39 @@ private function createFileOption(string $rawExtensions) return $this->customOptionFactory->create(['data' => $data]); } + + /** + * Test to save option price by store + * + * @magentoDataFixture Magento/Catalog/_files/product_with_options.php + * @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php + * @magentoConfigFixture default_store catalog/price/scope 1 + * @magentoConfigFixture secondstore_store catalog/price/scope 1 + */ + public function testSaveOptionPriceByStore() + { + $secondWebsitePrice = 22.0; + $defaultStoreId = $this->storeManager->getStore()->getId(); + $secondStoreId = $this->storeManager->getStore('secondstore')->getId(); + + /** @var \Magento\Catalog\Model\Product $product */ + $product = $this->productRepository->get('simple'); + $option = $product->getOptions()[0]; + $defaultPrice = $option->getPrice(); + + $option->setPrice($secondWebsitePrice); + $product->setStoreId($secondStoreId); + // set Current store='secondstore' to correctly save product options for 'secondstore' + $this->storeManager->setCurrentStore($secondStoreId); + $this->productRepository->save($product); + $this->storeManager->setCurrentStore($defaultStoreId); + + $product = $this->productRepository->get('simple', false, Store::DEFAULT_STORE_ID, true); + $option = $product->getOptions()[0]; + $this->assertEquals($defaultPrice, $option->getPrice(), 'Price value by default store is wrong'); + + $product = $this->productRepository->get('simple', false, $secondStoreId, true); + $option = $product->getOptions()[0]; + $this->assertEquals($secondWebsitePrice, $option->getPrice(), 'Price value by store_id=1 is wrong'); + } } diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php b/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php index 3cb429822eb9a..912e8e895f9c1 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php @@ -13,7 +13,7 @@ /** @var \Magento\Store\Model\Store $store */ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); -$store->setCode('secondstore')->setName('Second Store')->setSortOrder(10)->setIsActive(1); +$store->setCode('secondstore')->setWebsiteId($websiteId)->setName('Second Store')->setSortOrder(10)->setIsActive(1); $store->save(); /** @var \Magento\Store\Model\Website $website */ @@ -25,5 +25,5 @@ /** @var \Magento\Store\Model\Store $store */ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); -$store->setCode('thirdstore')->setName('Third Store')->setSortOrder(10)->setIsActive(1); +$store->setCode('thirdstore')->setWebsiteId($websiteId)->setName('Third Store')->setSortOrder(10)->setIsActive(1); $store->save(); From 4ffd05d56f7a56da29f3ede94604848672a336be Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 23 May 2019 15:02:13 +0300 Subject: [PATCH 181/464] MAGETWO-99587: Custom options price from website scope rewrites prices on all scopes --- .../Model/ResourceModel/Product/Option.php | 162 ++++++++---------- 1 file changed, 69 insertions(+), 93 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php index 8f4c334038b8d..0de421f2109d6 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Model\ResourceModel\Product; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\DataObject; +use Magento\Framework\Model\AbstractModel; use Magento\Store\Model\Store; /** @@ -77,10 +79,10 @@ protected function _construct() /** * Save options store data * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function _afterSave(AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -91,66 +93,21 @@ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) /** * Save value prices * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return $this * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $object) + protected function _saveValuePrices(AbstractModel $object) { - $priceTable = $this->getTable('catalog_product_option_price'); - $connection = $this->getConnection(); - /* * Better to check param 'price' and 'price_type' for saving. * If there is not price skip saving price */ - if (in_array($object->getType(), $this->getPriceTypes())) { // save for store_id = 0 if (!$object->getData('scope', 'price')) { - $statement = $connection->select()->from( - $priceTable, - 'option_id' - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', - Store::DEFAULT_STORE_ID - ); - $optionId = $connection->fetchOne($statement); - - if (!$optionId) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - [ - 'option_id' => $object->getId(), - 'store_id' => Store::DEFAULT_STORE_ID, - 'price' => $object->getPrice(), - 'price_type' => $object->getPriceType(), - ] - ), - $priceTable - ); - $connection->insert($priceTable, $data); - } elseif ((int)$object->getStoreId() === Store::DEFAULT_STORE_ID) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - ['price' => $object->getPrice(), 'price_type' => $object->getPriceType()] - ), - $priceTable - ); - - $connection->update( - $priceTable, - $data, - [ - 'option_id = ?' => $object->getId(), - 'store_id = ?' => Store::DEFAULT_STORE_ID - ] - ); - } + $this->savePriceByStore($object, Store::DEFAULT_STORE_ID); } $scope = (int)$this->_config->getValue( @@ -178,49 +135,12 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje $newPrice = $object->getPrice(); } - $statement = $connection->select()->from( - $priceTable - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', - $storeId - ); - - if ($connection->fetchOne($statement)) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - ['price' => $newPrice, 'price_type' => $object->getPriceType()] - ), - $priceTable - ); - - $connection->update( - $priceTable, - $data, - ['option_id = ?' => $object->getId(), 'store_id = ?' => $storeId] - ); - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - [ - 'option_id' => $object->getId(), - 'store_id' => $storeId, - 'price' => $newPrice, - 'price_type' => $object->getPriceType(), - ] - ), - $priceTable - ); - $connection->insert($priceTable, $data); - } + $this->savePriceByStore($object, (int)$storeId, $newPrice); } } - } elseif ($scope == Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price') - ) { - $connection->delete( - $priceTable, + } elseif ($scope == Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { + $this->getConnection()->delete( + $this->getTable('catalog_product_option_price'), ['option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()] ); } @@ -229,14 +149,68 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje return $this; } + /** + * Save option price by store + * + * @param AbstractModel $object + * @param int $storeId + * @param float|null $newPrice + */ + private function savePriceByStore(AbstractModel $object, int $storeId, float $newPrice = null): void + { + $priceTable = $this->getTable('catalog_product_option_price'); + $connection = $this->getConnection(); + $price = $newPrice === null ? $object->getPrice() : $newPrice; + + $statement = $connection->select()->from($priceTable, 'option_id') + ->where('option_id = ?', $object->getId()) + ->where('store_id = ?', $storeId); + $optionId = $connection->fetchOne($statement); + + if (!$optionId) { + $data = $this->_prepareDataForTable( + new DataObject([ + 'option_id' => $object->getId(), + 'store_id' => $storeId, + 'price' => $price, + 'price_type' => $object->getPriceType(), + ]), + $priceTable + ); + $connection->insert($priceTable, $data); + } else { + // skip to update the default price when the store price is saving + if ($storeId === Store::DEFAULT_STORE_ID && (int)$object->getStoreId() !== $storeId) { + return; + } + + $data = $this->_prepareDataForTable( + new DataObject([ + 'price' => $price, + 'price_type' => $object->getPriceType() + ]), + $priceTable + ); + + $connection->update( + $priceTable, + $data, + [ + 'option_id = ?' => $object->getId(), + 'store_id = ?' => $storeId + ] + ); + } + } + /** * Save titles * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object) + protected function _saveValueTitles(AbstractModel $object) { $connection = $this->getConnection(); $titleTableName = $this->getTable('catalog_product_option_title'); @@ -583,6 +557,8 @@ public function getPriceTypes() } /** + * Get Metadata Pool + * * @return \Magento\Framework\EntityManager\MetadataPool */ private function getMetadataPool() From a800b26c2559749dbb4bb807d5d42ee7e96819ad Mon Sep 17 00:00:00 2001 From: Alexander Menk <a.menk@imi.de> Date: Thu, 23 May 2019 15:01:25 +0200 Subject: [PATCH 182/464] Properly transliterate German Umlauts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Germany, ö is transliterated oe and so on. --- .../Framework/Filter/Test/Unit/TranslitTest.php | 4 ++-- .../Framework/Filter/Test/Unit/TranslitUrlTest.php | 4 ++-- lib/internal/Magento/Framework/Filter/Translit.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php index dd78fb3559933..384a0d8d26bb7 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php @@ -45,8 +45,8 @@ public function filterDataProvider() ['привет мир', 'privet mir', 'privet mir', $isIconv], [ 'Weiß, Goldmann, Göbel, Weiss, Göthe, Goethe und Götz', - 'Weiss, Goldmann, Gobel, Weiss, Gothe, Goethe und Gotz', - 'Weiss, Goldmann, Gobel, Weiss, Gothe, Goethe und Gotz', + 'Weiss, Goldmann, Goebel, Weiss, Goethe, Goethe und Goetz', + 'Weiss, Goldmann, Goebel, Weiss, Goethe, Goethe und Goetz', $isIconv ], [ diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php index 166edd36df667..3feee07ad8541 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php @@ -45,8 +45,8 @@ public function filterDataProvider() ['привет мир', 'privet-mir', 'privet-mir', $isIconv], [ 'Weiß, Goldmann, Göbel, Weiss, Göthe, Goethe und Götz', - 'weiss-goldmann-gobel-weiss-gothe-goethe-und-gotz', - 'weiss-goldmann-gobel-weiss-gothe-goethe-und-gotz', + 'weiss-goldmann-goebel-weiss-goethe-goethe-und-goetz', + 'weiss-goldmann-goebel-weiss-goethe-goethe-und-goetz', $isIconv ], [ diff --git a/lib/internal/Magento/Framework/Filter/Translit.php b/lib/internal/Magento/Framework/Filter/Translit.php index a6162aa7a7fff..21df38f7bdf30 100644 --- a/lib/internal/Magento/Framework/Filter/Translit.php +++ b/lib/internal/Magento/Framework/Filter/Translit.php @@ -25,7 +25,7 @@ class Translit implements \Zend_Filter_Interface 'À' => 'a', 'Á' => 'a', 'Â' => 'a', - 'Ä' => 'a', + 'Ä' => 'ae', 'Å' => 'a', 'Æ' => 'ae', 'Ç' => 'c', @@ -40,18 +40,18 @@ class Translit implements \Zend_Filter_Interface 'Ó' => 'o', 'Ô' => 'o', 'Õ' => 'o', - 'Ö' => 'o', + 'Ö' => 'oe', 'Ø' => 'o', 'Ù' => 'u', 'Ú' => 'u', 'Û' => 'u', - 'Ü' => 'u', + 'Ü' => 'ue', 'Ý' => 'y', 'ß' => 'ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', - 'ä' => 'a', + 'ä' => 'ae', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c', @@ -67,12 +67,12 @@ class Translit implements \Zend_Filter_Interface 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', - 'ö' => 'o', + 'ö' => 'oe', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', - 'ü' => 'u', + 'ü' => 'ue', 'ý' => 'y', 'þ' => 'p', 'ÿ' => 'y', From 2d8f1ee47e30659f3c35ba4411d431eccbf2b8fb Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 23 May 2019 08:37:52 -0500 Subject: [PATCH 183/464] MC-16872: Add loadCss library for preload fallback --- .../view/frontend/layout/default_head_blocks.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 38cfe25c16f8e..2db109dbf94f4 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -13,6 +13,20 @@ <script src="mage/polyfill.js"/> </head> <body> + <referenceBlock name="head.additional"> + <!--CSS rel preload script https://github.com/filamentgroup/loadCSS/blob/v2.0.1/src/cssrelpreload.js--> + <block class="Magento\Framework\View\Element\Text" name="css_rel_preload_script"> + <action method="setText"> + <argument translate="true" name="text" xsi:type="string"> + <![CDATA[ + <script> + !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this); + </script> + ]]> + </argument> + </action> + </block> + </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> </referenceContainer> From 26b8f2980c44d8a59b804b69f88ee644cd4cd213 Mon Sep 17 00:00:00 2001 From: Aapo Kiiso <aapo@lamia.fi> Date: Thu, 23 May 2019 16:45:27 +0300 Subject: [PATCH 184/464] Mark synonyms support for Elasticsearch5, too --- app/code/Magento/Elasticsearch/etc/search_engine.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Elasticsearch/etc/search_engine.xml b/app/code/Magento/Elasticsearch/etc/search_engine.xml index 34b6432b15c03..51af3038b9c8d 100644 --- a/app/code/Magento/Elasticsearch/etc/search_engine.xml +++ b/app/code/Magento/Elasticsearch/etc/search_engine.xml @@ -9,4 +9,7 @@ <engine name="elasticsearch"> <feature name="synonyms" support="true" /> </engine> + <engine name="elasticsearch5"> + <feature name="synonyms" support="true" /> + </engine> </engines> From 0214b3d343d743a715824b58a188434e6702dc51 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 23 May 2019 17:07:29 +0300 Subject: [PATCH 185/464] MAGETWO-99587: Custom options price from website scope rewrites prices on all scopes --- .../Model/ResourceModel/Product/Option.php | 76 +++++++++++-------- .../Catalog/Model/Product/OptionTest.php | 1 - 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php index 0de421f2109d6..1858d5f4b0133 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php @@ -9,6 +9,7 @@ use Magento\Framework\DataObject; use Magento\Framework\Model\AbstractModel; use Magento\Store\Model\Store; +use Magento\Tests\NamingConvention\true\float; /** * Catalog product custom option resource model @@ -95,8 +96,6 @@ protected function _afterSave(AbstractModel $object) * * @param AbstractModel $object * @return $this - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _saveValuePrices(AbstractModel $object) { @@ -116,27 +115,13 @@ protected function _saveValuePrices(AbstractModel $object) ); if ($object->getStoreId() != '0' && $scope == Store::PRICE_SCOPE_WEBSITE) { - $baseCurrency = $this->_config->getValue( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, - 'default' - ); - $storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds(); - if (is_array($storeIds)) { - foreach ($storeIds as $storeId) { - if ($object->getPriceType() == 'fixed') { - $storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode(); - $rate = $this->_currencyFactory->create()->load($baseCurrency)->getRate($storeCurrency); - if (!$rate) { - $rate = 1; - } - $newPrice = $object->getPrice() * $rate; - } else { - $newPrice = $object->getPrice(); - } - - $this->savePriceByStore($object, (int)$storeId, $newPrice); - } + if (empty($storeIds)) { + return $this; + } + foreach ($storeIds as $storeId) { + $newPrice = $this->calculateStorePrice($object, $storeId); + $this->savePriceByStore($object, (int)$storeId, $newPrice); } } elseif ($scope == Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { $this->getConnection()->delete( @@ -169,12 +154,14 @@ private function savePriceByStore(AbstractModel $object, int $storeId, float $ne if (!$optionId) { $data = $this->_prepareDataForTable( - new DataObject([ - 'option_id' => $object->getId(), - 'store_id' => $storeId, - 'price' => $price, - 'price_type' => $object->getPriceType(), - ]), + new DataObject( + [ + 'option_id' => $object->getId(), + 'store_id' => $storeId, + 'price' => $price, + 'price_type' => $object->getPriceType(), + ] + ), $priceTable ); $connection->insert($priceTable, $data); @@ -185,10 +172,12 @@ private function savePriceByStore(AbstractModel $object, int $storeId, float $ne } $data = $this->_prepareDataForTable( - new DataObject([ - 'price' => $price, - 'price_type' => $object->getPriceType() - ]), + new DataObject( + [ + 'price' => $price, + 'price_type' => $object->getPriceType() + ] + ), $priceTable ); @@ -203,6 +192,29 @@ private function savePriceByStore(AbstractModel $object, int $storeId, float $ne } } + /** + * Calculate price by store + * + * @param AbstractModel $object + * @param int $storeId + * @return float + */ + private function calculateStorePrice(AbstractModel $object, int $storeId): float + { + $price = $object->getPrice(); + if ($object->getPriceType() == 'fixed') { + $baseCurrency = $this->_config->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); + $storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode(); + $rate = $this->_currencyFactory->create()->load($baseCurrency)->getRate($storeCurrency); + $price = $object->getPrice() * ($rate ?: 1); + } + + return (float)$price; + } + /** * Save titles * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php index 4fbb2e0dcbd56..bfb49686447c0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/OptionTest.php @@ -38,7 +38,6 @@ class OptionTest extends \PHPUnit\Framework\TestCase */ private $storeManager; - /** * @inheritdoc */ From 6342d7b577898315224dbcc9171e230a69b03925 Mon Sep 17 00:00:00 2001 From: Serhii Balko <serhii.balko@transoftgroup.com> Date: Thu, 23 May 2019 17:08:16 +0300 Subject: [PATCH 186/464] MAGETWO-99587: Custom options price from website scope rewrites prices on all scopes --- app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php index 1858d5f4b0133..f13f721c0c6cb 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php @@ -9,7 +9,6 @@ use Magento\Framework\DataObject; use Magento\Framework\Model\AbstractModel; use Magento\Store\Model\Store; -use Magento\Tests\NamingConvention\true\float; /** * Catalog product custom option resource model From 618021d8b9beb29b2973d7e90da2d5de98d50f4b Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 23 May 2019 10:14:19 -0500 Subject: [PATCH 187/464] MC-16607: Fix Unrelated Static Test Failures - fix static --- app/code/Magento/Email/Model/Template/Filter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index aa018d6fd44d6..e5e3a9a4f2a61 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -956,8 +956,7 @@ public function getCssFilesContent(array $files) } } catch (ContentProcessorException $exception) { $css = $exception->getMessage(); - // phpcs:disable Magento2.Exceptions.ThrowCatch - } catch (\Magento\Framework\View\Asset\File\NotFoundException $exception) { + } catch (\Exception $exception) { $css = ''; } From 7f8902d9140d819ea473531633ceaabd91a1a8f9 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 23 May 2019 10:42:28 -0500 Subject: [PATCH 188/464] MC-16869: Introduce critical CSS path option --- .../Magento/Theme/etc/adminhtml/system.xml | 20 +++++++++++++++++++ app/code/Magento/Theme/etc/config.xml | 11 +++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Theme/etc/adminhtml/system.xml diff --git a/app/code/Magento/Theme/etc/adminhtml/system.xml b/app/code/Magento/Theme/etc/adminhtml/system.xml new file mode 100644 index 0000000000000..c581e09fe1e25 --- /dev/null +++ b/app/code/Magento/Theme/etc/adminhtml/system.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> + <system> + <section id="dev"> + <group id="css"> + <field id="use_css_critical_path" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <label>Use CSS critical path</label> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <comment>CSS files are loading synchronously by default.</comment> + </field> + </group> + </section> + </system> +</config> diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 37841789c0e10..3e26204d7788c 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -66,11 +66,12 @@ Disallow: /*SID= <static> <sign>1</sign> </static> - <dev> - <js> - <move_inline_to_bottom>0</move_inline_to_bottom> - </js> - </dev> + <js> + <move_inline_to_bottom>0</move_inline_to_bottom> + </js> + <css> + <use_css_critical_path>0</use_css_critical_path> + </css> </dev> </default> </config> From c1acc6a335da83fdc2c6dd13b4d95e6802d3fb5f Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Wed, 22 May 2019 15:49:53 -0500 Subject: [PATCH 189/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- app/code/Magento/Catalog/Block/Product/View/Gallery.php | 2 +- .../templates/catalog/product/attribute/labels.phtml | 2 +- .../templates/catalog/product/attribute/set/main.phtml | 4 ++-- .../templates/catalog/product/edit/price/tier.phtml | 2 +- .../Catalog/view/frontend/templates/product/list.phtml | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 554674c7e38be..b6a58c07c428b 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -114,7 +114,7 @@ public function getGalleryImages() */ public function getMagnifier() { - return $this->jsonEncoder->encode($this->escapeJs($this->getVar('magnifier'))); + return $this->jsonEncoder->encode($this->getVar('magnifier')); } /** diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml index 6c614bf8a439a..1d5d251f00de9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml @@ -32,7 +32,7 @@ <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option<?php endif; ?>" type="text" name="frontend_label[<?= $block->escapeHtmlAttr($_store->getId()) ?>]" - value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>" + value="<?= $block->escapeHtmlAttr($_labels[$_store->getId()]) ?>" <?php if ($block->getReadOnly()) :?> disabled="disabled" <?php endif;?>/> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 630de719b9216..dd1009cc5e033 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -279,8 +279,8 @@ addGroup : function() { prompt({ - title: "<?= $block->escapeJs(__('Add New Group')) ?>", - content: "<?= $block->escapeJs(__('Please enter a new group name.')) ?>", + title: "<?= $block->escapeJs($block->escapeHtml(__('Add New Group'))) ?>", + content: "<?= $block->escapeJs($block->escapeHtml(__('Please enter a new group name.'))) ?>", value: "", validation: true, validationRules: ['required-entry'], diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml index 4e8d6b2200187..e66a18c677cc3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml @@ -70,7 +70,7 @@ var tierPriceRowTemplate = '<tr>' + '<input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' + '<span><?= $block->escapeHtml(__("and above")) ?></span>' + '</td>' - + '<td class="col-price"><input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry <?= /* @noEscape */ $_priceValueValidation ?>" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' + + '<td class="col-price"><input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry <?= $block->escapeHtmlAttr($_priceValueValidation) ?>" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' + '<td class="col-delete"><input type="hidden" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' + '<button title="<?= $block->escapeHtml(__('Delete Tier')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' + '<span><?= $block->escapeHtml(__("Delete")) ?></span></button></td>' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index 38d6f0d7bf057..ce44884a575b8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -75,8 +75,8 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); <?= $block->getProductDetailsHtml($_product) ?> <div class="product-item-inner"> - <div class="product actions product-item-actions"<?= /* @noEscape */ strpos($pos, $viewMode . '-actions') ? $position : '' ?>> - <div class="actions-primary"<?= /* @noEscape */ strpos($pos, $viewMode . '-primary') ? $position : '' ?>> + <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>> + <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $block->escapeHtmlAttr($position) : '' ?>> <?php if ($_product->isSaleable()) :?> <?php $postParams = $block->getAddToCartPostParams($_product); ?> <form data-role="tocart-form" @@ -103,7 +103,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); <?php endif; ?> <?php endif; ?> </div> - <div data-role="add-to-links" class="actions-secondary"<?= /* @noEscape */ strpos($pos, $viewMode . '-secondary') ? $position : '' ?>> + <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $block->escapeHtmlAttr($position) : '' ?>> <?php if ($addToBlock = $block->getChildBlock('addto')) :?> <?= $addToBlock->setProduct($_product)->getChildHtml() ?> <?php endif; ?> @@ -130,7 +130,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); { "[data-role=tocart-form], .form.map.checkout": { "catalogAddToCart": { - "product_sku": "<?= /* @noEscape */ $_product->getSku() ?>" + "product_sku": "<?= $block->escapeJs($_product->getSku()) ?>" } } } From b2cc33ba678251f15656f585aa59a5e7770168aa Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Thu, 23 May 2019 11:15:01 -0500 Subject: [PATCH 190/464] MC-16611: Fix Unrelated Static Test Failures - clean up code --- .../testsuite/Magento/Test/Legacy/_files/obsolete_classes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index a162b5083109b..8e1a99e655315 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -4,6 +4,8 @@ * * Format: array(<class_name>[, <replacement>]) * + * @codingStandardsIgnoreFile + * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ From 3dcfd5ec823f5a174375d723a487771e2056ad07 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Thu, 23 May 2019 11:51:07 -0500 Subject: [PATCH 191/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../switcher/form/renderer/fieldset.phtml | 4 +- .../form/renderer/fieldset/element.phtml | 8 ++-- .../templates/system/autocomplete.phtml | 5 +-- .../templates/system/cache/edit.phtml | 5 +-- .../templates/widget/accordion.phtml | 5 +-- .../adminhtml/templates/widget/button.phtml | 7 +--- .../adminhtml/templates/widget/grid.phtml | 37 +++++++++---------- 7 files changed, 28 insertions(+), 43 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml index e737193b538ea..c5413e06a18ad 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml @@ -13,7 +13,7 @@ <?php endif; ?> <?php if (!$_element->getNoContainer()): ?> - <fieldset class="admin__fieldset fieldset <?= /* @escapeNotVerified */ $_element->getClass() ?>" id="<?= $_element->getHtmlId() ?>"> + <fieldset class="admin__fieldset fieldset <?= $block->escapeHtmlAttr($_element->getClass()) ?>" id="<?= $_element->getHtmlId() ?>"> <?php endif; ?> <?php if ($_element->getLegend()): ?> @@ -21,7 +21,7 @@ <span><?= /* @escapeNotVerified */ $_element->getLegend() ?></span> <?= $block->getHintHtml() ?> </legend><br/> - <?= /* @escapeNotVerified */ $_element->getHeaderBar() ?> + <?= /* @noEscape */ $_element->getHeaderBar() ?> <?php else: ?> <?= $block->getHintHtml() ?> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml index e25c9d22ca40a..33dc3ca97f833 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml @@ -28,17 +28,17 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' <?php if ($element->getType() == 'hidden'): ?> <?= $element->getElementHtml() ?> <?php else: ?> - <div<?= /* @escapeNotVerified */ $fieldAttributes ?>> + <div<?= /* @noEscape */ $fieldAttributes ?>> <?php if ($elementBeforeLabel): ?> <?= $element->getElementHtml() ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> - <?= /* @escapeNotVerified */ $note ?> + <?= /* @noEscape */ $note ?> <?php else: ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <div class="admin__field-control control"> - <?= /* @escapeNotVerified */ ($addOn) ? '<div class="addon">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> + <?= /* @noEscape */ ($addOn) ? '<div class="addon">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> <?= $block->getHintHtml() ?> - <?= /* @escapeNotVerified */ $note ?> + <?= /* @noEscape */ $note ?> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml index 2e1f361bf8701..7778ba04878f9 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <ul class="dropdown-menu"> <?php foreach ($items as $item): ?> <li id="<?= $block->escapeHtmlAttr($item['id']) ?>" class="item"> <a href="<?= $block->escapeUrl($item['url']) ?>" class="title"><?= $block->escapeHtml($item['name']) ?></a> - <div class="type"><?= /* @escapeNotVerified */ $item['type'] ?></div> + <div class="type"><?= $block->escapeHtml($item['type']) ?></div> <?= $block->escapeHtml($item['description']) ?> </li> <?php endforeach ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml index fcd6f098c069a..b092dcc6d9cf6 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -45,7 +42,7 @@ continue; }?> <tr> - <td class="label"><label><?= /* @escapeNotVerified */ $_item['label'] ?></label></td> + <td class="label"><label><?= $block->escapeHtml($_item['label']) ?></label></td> <td class="value"> <?php foreach ($_item['buttons'] as $_button): ?> <?php $clickAction = "setCacheAction('catalog_action',this)"; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml index 60cd51b496aa7..bbd452fbaf0fd 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -23,7 +20,7 @@ $items = $block->getItems(); require([ 'mage/adminhtml/accordion' ], function(){ - tab_content_<?= $block->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?= $block->getHtmlId() ?>', '<?= /* @escapeNotVerified */ $block->getShowOnlyOne() ?>'); + tab_content_<?= $block->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?= $block->getHtmlId() ?>', '<?= $block->escapeJs($block->getShowOnlyOne()) ?>'); }); </script> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/button.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/button.phtml index d3376745afe39..b743b9bee10db 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/button.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/button.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,7 +10,7 @@ */ ?> <?= $block->getBeforeHtml() ?> -<button <?= /* @escapeNotVerified */ $block->getAttributesHtml(), $block->getUiId() ?>> - <span><?= /* @escapeNotVerified */ $block->getLabel() ?></span> +<button <?= /* @noEscape */ $block->getAttributesHtml(), $block->getUiId() ?>> + <span><?= $block->escapeHtml($block->getLabel()) ?></span> </button> <?= $block->getAfterHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index ac5d4dd804091..9a398f85ed9f8 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -50,8 +47,8 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php endif; ?> <?php $countRecords = $block->getCollection()->getSize(); ?> <div class="admin__control-support-text"> - <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @escapeNotVerified */ $block->getUiId('total-count') ?>> - <?= /* @escapeNotVerified */ $countRecords ?> + <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @noEscape */ $block->getUiId('total-count') ?>> + <?= /* @noEscape */ $countRecords ?> </span> <?= $block->escapeHtml(__('records found')) ?> <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>_massaction-count" @@ -61,7 +58,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <div class="admin__data-grid-pager-wrap"> <select name="<?= $block->escapeHtmlAttr($block->getVarNameLimit()) ?>" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" - onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" <?= /* @escapeNotVerified */ $block->getUiId('per-page') ?> + onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" <?= /* @noEscape */ $block->getUiId('per-page') ?> class="admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> selected="selected"<?php endif; ?>>20 @@ -88,7 +85,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php if ($_curPage > 1): ?> <button class="action-previous" type="button" - onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> @@ -100,7 +97,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; name="<?= $block->escapeHtmlAttr($block->getVarNamePage()) ?>" value="<?= $block->escapeHtmlAttr($_curPage) ?>" class="admin__control-text" - onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> + onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @noEscape */ $_lastPage ?>')" <?= /* @noEscape */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> @@ -109,7 +106,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php if ($_curPage < $_lastPage): ?> <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" - onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> @@ -159,29 +156,29 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> <?php if ($block->getDependencyJsObject()): ?> - registry.get('<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>', function (<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>) { + registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { <?php endif; ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= /* @escapeNotVerified */ $block->getGridUrl() ?>', '<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameSort() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameDir() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameFilter() ?>'); - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.useAjax = <?= /* @escapeNotVerified */ $block->getUseAjax() ? 'true' : 'false' ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = <?= /* @noEscape */ $block->getUseAjax() ? 'true' : 'false' ?>; <?php if ($block->getRowClickCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.rowClickCallback = <?= /* @escapeNotVerified */ $block->getRowClickCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; <?php endif; ?> <?php if ($block->getCheckboxCheckCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.checkboxCheckCallback = <?= /* @escapeNotVerified */ $block->getCheckboxCheckCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> <?php if ($block->getSortableUpdateCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.sortableUpdateCallback = <?= /* @escapeNotVerified */ $block->getSortableUpdateCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.sortableUpdateCallback = <?= /* @noEscape */ $block->getSortableUpdateCallback() ?>; <?php endif; ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.bindSortable(); + <?= $block->escapeJs($block->getJsObjectName()) ?>.bindSortable(); <?php if ($block->getRowInitCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.initRowCallback = <?= /* @escapeNotVerified */ $block->getRowInitCallback() ?>; - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.initGridRows(); + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); <?php endif; ?> <?php if ($block->getChildBlock('grid.massaction') && $block->getChildBlock('grid.massaction')->isAvailable()): ?> - <?= /* @escapeNotVerified */ $block->getChildBlock('grid.massaction')->getJavaScript() ?> + <?= /* @noEscape */ $block->getChildBlock('grid.massaction')->getJavaScript() ?> <?php endif ?> - <?= /* @escapeNotVerified */ $block->getAdditionalJavaScript() ?> + <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> <?php if ($block->getDependencyJsObject()): ?> }); From 803cbdc9b69548fa9dce8cba5c95f94a61213f8c Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 23 May 2019 12:37:09 -0500 Subject: [PATCH 192/464] MC-16872: Add loadCss library for preload fallback - Move loadCSS to plugin; --- .../Controller/Result/AsyncCssPlugin.php | 78 +++++++++++++++++++ app/code/Magento/Theme/etc/frontend/di.xml | 1 + .../frontend/layout/default_head_blocks.xml | 14 ---- 3 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php new file mode 100644 index 0000000000000..e9c26dc2c7f7a --- /dev/null +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Controller\Result; + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Framework\App\Response\Http; + +/** + * Plugin for asynchronous CSS loading. + */ +class AsyncCssPlugin +{ + private const XML_PATH_USE_CSS_CRITICAL_PATH = 'dev/css/use_css_critical_path'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @param ScopeConfigInterface $scopeConfig + */ + public function __construct(ScopeConfigInterface $scopeConfig) + { + $this->scopeConfig = $scopeConfig; + } + + /** + * Load CSS asynchronously if it is enabled in configuration. + * + * @param Http $subject + * @return void + */ + public function beforeSendResponse(Http $subject): void + { + $content = $subject->getContent(); + // loadCSS rel=preload polyfill script https://github.com/filamentgroup/loadCSS/blob/v2.0.1/src/cssrelpreload.js + $loadCssScript = '!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);'; + + if (strpos($content, '</body') !== false && $this->scopeConfig->isSetFlag( + self::XML_PATH_USE_CSS_CRITICAL_PATH, + ScopeInterface::SCOPE_STORE + )) { + // add link rel preload to style sheets + $content = preg_replace_callback( + '@<link\b.*?rel=("|\')stylesheet\1.*?/>@', + function ($matches) { + preg_match('@href=("|\')(.*?)\1@', $matches[0], $hrefAttribute); + $href = $hrefAttribute[2]; + if (preg_match('@media=("|\')(.*?)\1@', $matches[0], $mediaAttribute)) { + $media = $mediaAttribute[2]; + } + $media = $media ?? 'all'; + $loadCssAsync = sprintf( + '<link rel="preload" as="style" media="%s" onload="this.onload=null;this.rel=\'stylesheet\'"' . + 'href="%s"><noscript><link rel="stylesheet" href="%s"></noscript>', + $media, + $href, + $href + ); + + return $loadCssAsync; + }, + $content + ); + // add CSS rel preload polyfill script + $pattern = '@</head>@'; + $replacement = '<script>' . $loadCssScript . '</script></head>'; + $content = preg_replace($pattern, $replacement, $content); + + $subject->setContent($content); + } + } +} diff --git a/app/code/Magento/Theme/etc/frontend/di.xml b/app/code/Magento/Theme/etc/frontend/di.xml index 3837c6f717b54..35fde84f8001f 100644 --- a/app/code/Magento/Theme/etc/frontend/di.xml +++ b/app/code/Magento/Theme/etc/frontend/di.xml @@ -28,5 +28,6 @@ </type> <type name="Magento\Framework\App\Response\Http"> <plugin name="result-js-footer" type="Magento\Theme\Controller\Result\JsFooterPlugin"/> + <plugin name="asyncCssLoad" type="Magento\Theme\Controller\Result\AsyncCssPlugin"/> </type> </config> diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 2db109dbf94f4..38cfe25c16f8e 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -13,20 +13,6 @@ <script src="mage/polyfill.js"/> </head> <body> - <referenceBlock name="head.additional"> - <!--CSS rel preload script https://github.com/filamentgroup/loadCSS/blob/v2.0.1/src/cssrelpreload.js--> - <block class="Magento\Framework\View\Element\Text" name="css_rel_preload_script"> - <action method="setText"> - <argument translate="true" name="text" xsi:type="string"> - <![CDATA[ - <script> - !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this); - </script> - ]]> - </argument> - </action> - </block> - </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> </referenceContainer> From f2efb6965b7af89a57d5bfbb7c5fdec5692667c0 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Thu, 23 May 2019 13:59:06 -0500 Subject: [PATCH 193/464] MC-16611: Fix Unrelated Static Test Failures - clean up code --- .../Backup/view/adminhtml/templates/backup/dialogs.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml index fab16aefd3a6d..205465b8368ec 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml @@ -133,7 +133,7 @@ </span></legend><br /> <div class="admin__field field _required"> <label class="admin__field-label" for="ftp_host"><span> - ?= $block->escapeHtml(__('FTP Host')) ?> + <?= $block->escapeHtml(__('FTP Host')) ?> </span></label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_host" id="ftp_host"> From 831fb5f7c3f913a9d04859075ce40bfb1a32af07 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Thu, 23 May 2019 14:09:58 -0500 Subject: [PATCH 194/464] MC-16607: Fix Unrelated Static Test Failures - fix static --- .../Magento/Reports/Block/Adminhtml/Grid.php | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index a80e87f3c70d5..9f1b9313e1c66 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -15,6 +15,11 @@ */ class Grid extends \Magento\Backend\Block\Widget\Grid { + /** + * @var \Magento\Framework\Url\DecoderInterface + */ + private $urlDecoder; + /** * Should Store Switcher block be visible * @@ -71,6 +76,24 @@ class Grid extends \Magento\Backend\Block\Widget\Grid */ protected $_filterValues; + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Backend\Helper\Data $backendHelper + * @param array $data + * @param \Magento\Framework\Url\DecoderInterface|null $urlDecoder + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Backend\Helper\Data $backendHelper, + array $data = [], + \Magento\Framework\Url\DecoderInterface $urlDecoder = null + ) { + $this->urlDecoder = $urlDecoder ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Url\DecoderInterface::class + ); + parent::__construct($context, $backendHelper, $data); + } + /** * Apply sorting and filtering to collection * @@ -87,9 +110,7 @@ protected function _prepareCollection() if (is_string($filter)) { $data = []; - // phpcs:ignore Magento2.Functions.DiscouragedFunction - $filter = base64_decode($filter); - // phpcs:ignore Magento2.Functions.DiscouragedFunction + $filter = $this->urlDecoder->decode($filter); parse_str(urldecode($filter), $data); if (!isset($data['report_from'])) { From 633e0b2856fb303fbcc8c72d08bac1f5121c0793 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Thu, 23 May 2019 14:27:29 -0500 Subject: [PATCH 195/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../switcher/form/renderer/fieldset.phtml | 5 +- .../templates/system/cache/edit.phtml | 2 +- .../templates/widget/button/split.phtml | 7 +-- .../templates/widget/form/container.phtml | 10 ++-- .../templates/widget/form/element.phtml | 37 +++++++------- .../widget/form/element/gallery.phtml | 25 +++++----- .../widget/form/renderer/fieldset.phtml | 23 ++++----- .../form/renderer/fieldset/element.phtml | 11 ++--- .../templates/widget/grid/column_set.phtml | 23 ++++----- .../templates/widget/grid/export.phtml | 5 +- .../templates/widget/grid/extended.phtml | 49 +++++++++---------- .../templates/widget/grid/massaction.phtml | 21 ++++---- .../widget/grid/massaction_extended.phtml | 17 +++---- .../templates/widget/grid/serializer.phtml | 15 +++--- .../adminhtml/templates/widget/tabs.phtml | 28 +++++------ .../templates/widget/tabshoriz.phtml | 17 +++---- .../adminhtml/templates/widget/tabsleft.phtml | 15 +++--- 17 files changed, 132 insertions(+), 178 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml index c5413e06a18ad..03e3c27592295 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_element = $block->getElement() ?> <?php if ($_element->getFieldsetContainerId()): ?> @@ -18,7 +15,7 @@ <?php if ($_element->getLegend()): ?> <legend class="admin__legend legend"> - <span><?= /* @escapeNotVerified */ $_element->getLegend() ?></span> + <span><?= $block->escapeHtml($_element->getLegend()) ?></span> <?= $block->getHintHtml() ?> </legend><br/> <?= /* @noEscape */ $_element->getHeaderBar() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml index b092dcc6d9cf6..83716c41c6e6d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml @@ -50,7 +50,7 @@ <?php $clickAction = "if (confirm('" . addslashes($_button['warning']) . "')) {{$clickAction}}"; ?> <?php endif; ?> <button <?php if (!isset($_button['disabled']) || !$_button['disabled']):?>onclick="<?= /* @noEscape */ $clickAction ?>"<?php endif; ?> id="<?= $block->escapeHtmlAttr($_button['name']) ?>" type="button" class="scalable <?php if (isset($_button['disabled']) && $_button['disabled']):?>disabled<?php endif; ?>" style=""><span><span><span><?= $block->escapeHtml($_button['action']) ?></span></span></span></button> - <?php if (isset($_button['comment'])): ?> <br /> <small><?= /* @escapeNotVerified */ $_button['comment'] ?></small> <?php endif; ?> + <?php if (isset($_button['comment'])): ?> <br /> <small><?= $block->escapeHtml($_button['comment']) ?></small> <?php endif; ?> <?php endforeach; ?> </td> <td><small> </small></td> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml index a115777624e91..fee86868a782a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Backend\Block\Widget\Button\SplitButton */ @@ -21,14 +18,14 @@ </button> <?php if (!$block->getDisabled()): ?> - <ul class="dropdown-menu" <?= /* @escapeNotVerified */ $block->getUiId("dropdown-menu") ?>> + <ul class="dropdown-menu" <?= /* @noEscape */ $block->getUiId("dropdown-menu") ?>> <?php foreach ($block->getOptions() as $key => $option): ?> <li> <span <?= $block->getOptionAttributesHtml($key, $option) ?>> <?= $block->escapeHtml($option['label']) ?> </span> <?php if (isset($option['hint'])): ?> - <div class="tooltip" <?= /* @escapeNotVerified */ $block->getUiId('item', $key, 'tooltip') ?>> + <div class="tooltip" <?= /* @noEscape */ $block->getUiId('item', $key, 'tooltip') ?>> <a href="<?= $block->escapeHtml($option['hint']['href']) ?>" class="help"> <?= $block->escapeHtml($option['hint']['label']) ?> </a> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml index bcbda8fc761ac..79b7b563cd31b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml @@ -4,13 +4,11 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\Widget\Form\Container */ ?> -<?= /* @escapeNotVerified */ $block->getFormInitScripts() ?> +<?= /* @noEscape */ $block->getFormInitScripts() ?> <?php if ($block->getButtonsHtml('header')): ?> - <div class="page-form-actions" <?= /* @escapeNotVerified */ $block->getUiId('content-header') ?>><?= $block->getButtonsHtml('header') ?></div> + <div class="page-form-actions" <?= /* @noEscape */ $block->getUiId('content-header') ?>><?= $block->getButtonsHtml('header') ?></div> <?php endif; ?> <?php if ($block->getButtonsHtml('toolbar')): ?> <div class="page-main-actions"> @@ -36,7 +34,7 @@ require([ $('#edit_form').form() .validation({ - validationUrl: '<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>', + validationUrl: '<?= $block->escapeJs($block->getValidationUrl()) ?>', highlight: function(element) { var detailsElement = $(element).closest('details'); if (detailsElement.length && detailsElement.is('.details')) { @@ -51,4 +49,4 @@ require([ }); </script> -<?= /* @escapeNotVerified */ $block->getFormScripts() ?> +<?= /* @noEscape */ $block->getFormScripts() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index 1cecff73c950f..952e917d3df48 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -3,17 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php switch ($element->getType()) { case 'fieldset': ?> <fieldset> - <legend><?= /* @escapeNotVerified */ $element->getLegend() ?></legend><br /> + <legend><?= $block->escapeHtml($element->getLegend()) ?></legend><br /> <?php foreach ($element->getElements() as $_element): ?> - <?= /* @escapeNotVerified */ $formBlock->drawElement($_element) ?> + <?= /* @noEscape */ $formBlock->drawElement($_element) ?> <?php endforeach; ?> </fieldset> <?php break; @@ -24,10 +21,10 @@ <?php break; case 'select': ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"> + <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"> <?php foreach ($element->getValues() as $_value): ?> - <option <?= /* @escapeNotVerified */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ $_value->getLabel() ?></option> + <option <?= /* @noEscape */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()): ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_value->getLabel()) ?></option> <?php endforeach; ?> </select> </span> @@ -36,27 +33,27 @@ case 'button': case 'password': ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>" <?= /* @escapeNotVerified */ $block->getUiId('label') ?>><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> + <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>" <?= /* @noEscape */ $block->getUiId('label') ?>><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> </span> <?php break; case 'radio': ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?> - <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= /* @escapeNotVerified */ $element->getClass() ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"/> + <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"/> </span> <?php break; case 'radios': ?> <span class="form_row"> - <label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label> + <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> <?php foreach ($element->getRadios() as $_radio): ?> - <input type="radio" name="<?= $block->escapeHtmlAttr($_radio->getName()) ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($_radio->getValue()) ?>" class="input-radio <?= /* @escapeNotVerified */ $_radio->getClass() ?>" title="<?= $block->escapeHtmlAttr($_radio->getTitle()) ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= /* @escapeNotVerified */ $_radio->getLabel() ?> + <input type="radio" name="<?= $block->escapeHtmlAttr($_radio->getName()) ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($_radio->getValue()) ?>" class="input-radio <?= $block->escapeHtmlAttr($_radio->getClass()) ?>" title="<?= $block->escapeHtmlAttr($_radio->getTitle()) ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= $block->escapeHtml($_radio->getLabel()) ?> <?php endforeach; ?> </span> <?php break; case 'wysiwyg': ?> <span class="form_row"> - <label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label> + <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> <script> require([ "wysiwygAdapter" @@ -65,7 +62,7 @@ tinyMCE.init({ mode : "exact", theme : "advanced", - elements : "<?= /* @escapeNotVerified */ $element->getName() ?>", + elements : "<?= $block->escapeJs($element->getName()) ?>", plugins : "inlinepopups,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras", theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", @@ -84,13 +81,13 @@ }); }); </script> - <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="80" rows="20"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="80" rows="20"><?= /* @noEscape */ $element->getValue() ?></textarea> </span> <?php break; case 'textarea': ?> <span class="form_row"> - <label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label> - <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= /* @escapeNotVerified */ $element->getClass() ?>" cols="15" rows="2"><?= /* @escapeNotVerified */ $element->getValue() ?></textarea> + <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="15" rows="2"><?= /* @noEscape */$element->getValue() ?></textarea> </span> <?php break; case 'editor': ?> @@ -102,6 +99,6 @@ } ?> <?php if ($element->getScript()): ?> <script> - <?= /* @escapeNotVerified */ $element->getScript() ?> + <?= /* @noEscape */ $element->getScript() ?> </script> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index 99b2538b28c5a..7fe7c5c94e78c 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <tr> <td colspan="2"> @@ -30,15 +27,15 @@ <?php $i = 0; if (!is_null($block->getValues())): ?> <?php foreach ($block->getValues() as $image): $i++; ?> - <tr id="<?= $block->getElement()->getHtmlId() ?>_tr_<?= /* @escapeNotVerified */ $image->getValueId() ?>" class="gallery"> + <tr id="<?= $block->getElement()->getHtmlId() ?>_tr_<?= $block->escapeHtmlAttr($image->getValueId()) ?>" class="gallery"> <?php foreach ($block->getValues()->getAttributeBackend()->getImageTypes() as $type): ?> <td class="gallery" align="center" style="vertical-align:bottom;"> - <a href="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>');return false;"> - <img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>" src="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>?<?= /* @escapeNotVerified */ time() ?>" alt="<?= $block->escapeHtmlAttr($image->getValue()) ?>" title="<?= $block->escapeHtmlAttr($image->getValue()) ?>" height="25" class="small-image-preview v-middle"/></a><br/> - <input type="file" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>_<?= /* @escapeNotVerified */ $type ?>[<?= /* @escapeNotVerified */ $image->getValueId() ?>]" size="1"></td> + <a href="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= $block->escapeHtmlAttr($type) ?>_<?= $block->escapeHtmlAttr($image->getValueId()) ?>');return false;"> + <img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= $block->escapeHtmlAttr($type) ?>_<?= $block->escapeHtmlAttr($image->getValueId()) ?>" src="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>?<?= /* @noEscape */ time() ?>" alt="<?= $block->escapeHtmlAttr($image->getValue()) ?>" title="<?= $block->escapeHtmlAttr($image->getValue()) ?>" height="25" class="small-image-preview v-middle"/></a><br/> + <input type="file" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>_<?= $block->escapeHtmlAttr($type) ?>[<?= $block->escapeHtmlAttr($image->getValueId()) ?>]" size="1"></td> <?php endforeach; ?> - <td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[position][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" value="<?= $block->escapeHtmlAttr($image->getPosition()) ?>" id="<?= $block->getElement()->getHtmlId() ?>_position_<?= /* @escapeNotVerified */ $image->getValueId() ?>" size="3"/></td> - <td class="gallery" align="center" style="vertical-align:bottom;"><?= $block->getDeleteButtonHtml($image->getValueId()) ?><input type="hidden" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[delete][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" id="<?= $block->getElement()->getHtmlId() ?>_delete_<?= /* @escapeNotVerified */ $image->getValueId() ?>"/></td> + <td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[position][<?= $block->escapeHtmlAttr($image->getValueId()) ?>]" value="<?= $block->escapeHtmlAttr($image->getPosition()) ?>" id="<?= $block->getElement()->getHtmlId() ?>_position_<?= $block->escapeHtmlAttr($image->getValueId()) ?>" size="3"/></td> + <td class="gallery" align="center" style="vertical-align:bottom;"><?= $block->getDeleteButtonHtml($image->getValueId()) ?><input type="hidden" name="<?= $block->escapeHtmlAttr($block->getElement()->getParentName()) ?>[delete][<?= $block->escapeHtmlAttr($image->getValueId()) ?>]" id="<?= $block->getElement()->getHtmlId() ?>_delete_<?= $block->escapeHtmlAttr($image->getValueId()) ?>"/></td> </tr> <?php endforeach; ?> <?php endif; ?> @@ -56,7 +53,7 @@ require([ 'prototype' ], function () { id = 0; -num_of_images = <?= /* @escapeNotVerified */ $i ?>; +num_of_images = <?= /* @noEscape */ $i ?>; window.addNewImage = function() { @@ -70,12 +67,12 @@ window.addNewImage = function() // Sort order input var new_row_input = document.createElement( 'input' ); new_row_input.type = 'text'; - new_row_input.name = '<?= /* @escapeNotVerified */ $block->getElement()->getParentName() ?>[position]['+id+']'; + new_row_input.name = '<?= $block->escapeJs($block->getElement()->getParentName()) ?>[position]['+id+']'; new_row_input.size = '3'; new_row_input.value = '0'; // Delete button - new_row_button = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getDeleteButtonHtml("this")) ?>; + new_row_button = <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getDeleteButtonHtml("this")) ?>; table = document.getElementById( "gallery" ); @@ -114,8 +111,8 @@ window.deleteImage = function(image) document.getElementById("gallery_thead").style.visibility="hidden"; } if (image>0) { - document.getElementById('<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_delete_'+image).value=image; - document.getElementById('<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_tr_'+image).style.display='none'; + document.getElementById('<?= $block->escapeJs($block->getElement()->getName()) ?>_delete_'+image).value=image; + document.getElementById('<?= $block->escapeJs($block->getElement()->getName()) ?>_tr_'+image).style.display='none'; } else { image.parentNode.parentNode.parentNode.removeChild( image.parentNode.parentNode ); } diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index 128fab75e31bf..a0fa24a014a81 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $element \Magento\Framework\Data\Form\Element\Fieldset */ @@ -42,12 +39,12 @@ if ($isField) { id="<?= $block->escapeHtmlAttr($containerId ? $containerId : $id . '-wrapper') ?>" data-role="<?= $block->escapeHtmlAttr($id) ?>-wrapper"> <div class="fieldset-wrapper-title admin__fieldset-wrapper-title"> - <strong <?php /* @escapeNotVerified */ echo($isCollapsable) ? + <strong <?php /* @noEscape */ echo($isCollapsable) ? 'class="admin__collapsible-title" data-toggle="collapse" data-target="#' . $id . '-content"' : 'class="title"'; ?>> - <span><?= /* @escapeNotVerified */ $element->getLegend() ?></span> + <span><?= $block->escapeHtml($element->getLegend()) ?></span> </strong> - <?= /* @escapeNotVerified */ $titleActions ?> + <?= /* @noEscape */ $titleActions ?> </div> <div class="fieldset-wrapper-content admin__fieldset-wrapper-content<?= ($isCollapsable) ? ' collapse' : '' ?>" id="<?= $block->escapeHtmlAttr($id) ?>-content" @@ -58,7 +55,7 @@ if ($isField) { <fieldset class="<?= $block->escapeHtmlAttr($cssClass) ?>" id="<?= $block->escapeHtmlAttr($id) ?>"> <?php if ($element->getLegend() && !$isWrapped): ?> <legend class="<?= /* @noEscape */ $isField ? 'label admin__field-label' : 'admin__legend legend' ?>"> - <span><?= /* @escapeNotVerified */ $element->getLegend() ?></span> + <span><?= $block->escapeHtml($element->getLegend()) ?></span> </legend><br /> <?php endif; ?> <?php endif; ?> @@ -78,7 +75,7 @@ if ($isField) { <?php else: ?> <?php if ($isField && $count > 1):?> - <div class="fields-group-<?= /* @escapeNotVerified */ $count ?>"> + <div class="fields-group-<?= /* @noEscape */ $count ?>"> <?php endif; ?> <?= $element->getBasicChildrenHtml() ?> @@ -91,16 +88,16 @@ if ($isField) { <?php if ($element->hasAdvanced() && !$isField): ?> <?= (!$element->getNoContainer() && $advancedAfter) ? '</fieldset>' : '' ?> - <details data-mage-init='{"details": {}}' class="details admin__collapsible-block-wrapper" id="details<?= /* @escapeNotVerified */ $id ?>"> - <summary class="details-summary admin__collapsible-title" id="details-summary<?= /* @escapeNotVerified */ $id ?>"> - <span><?= /* @escapeNotVerified */ $advancedLabel ?></span> + <details data-mage-init='{"details": {}}' class="details admin__collapsible-block-wrapper" id="details<?= /* @noEscape */ $id ?>"> + <summary class="details-summary admin__collapsible-title" id="details-summary<?= /* @noEscape */ $id ?>"> + <span><?= $block->escapeHtml($advancedLabel) ?></span> </summary> - <div class="details-content admin__fieldset" id="details-content<?= /* @escapeNotVerified */ $id ?>"> + <div class="details-content admin__fieldset" id="details-content<?= /* @noEscape */ $id ?>"> <?= $element->getAdvancedChildrenHtml() ?> </div> </details> <?php elseif ($element->hasAdvanced() && $isField): ?> - <div class="nested" id="nested<?= /* @escapeNotVerified */ $id ?>"> + <div class="nested" id="nested<?= /* @noEscape */ $id ?>"> <?= $element->getAdvancedChildrenHtml() ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml index 3608ed7662e49..256ec8394d532 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */ @@ -30,16 +27,16 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' <?php if ($element->getType() == 'hidden'): ?> <?= $element->getElementHtml() ?> <?php else: ?> - <div<?= /* @escapeNotVerified */ $fieldAttributes ?>> + <div<?= /* @noEscape */ $fieldAttributes ?>> <?php if ($elementBeforeLabel): ?> <?= $element->getElementHtml() ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> - <?= /* @escapeNotVerified */ $note ?> + <?= /* @noEscape */ $note ?> <?php else: ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <div class="admin__field-control control"> - <?= /* @escapeNotVerified */ ($addOn) ? '<div class="admin__field">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> - <?= /* @escapeNotVerified */ $note ?> + <?= /* @noEscape */ ($addOn) ? '<div class="admin__field">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> + <?= /* @noEscape */ $note ?> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml index afba76bcdb72d..7aa82306d6dab 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -60,13 +57,13 @@ $numColumns = sizeof($block->getColumns()); $_rowspan = $block->getRowspan($_item, $_column); ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> - class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php if ($block->shouldRenderEmptyCell($_item, $_column)):?> <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"> - <?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?> + <?= $block->escapeHtml($block->getEmptyCellLabel()) ?> </td><?php endif; endif; @@ -80,7 +77,7 @@ $numColumns = sizeof($block->getColumns()); <tr data-role="row"> <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column): ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" - class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns-1 ? 'last' : '' ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns-1 ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td><?php @@ -92,9 +89,9 @@ $numColumns = sizeof($block->getColumns()); <tr class="subtotals"> <?php $i = 0; foreach ($block->getMultipleRowColumns() as $_column): ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" - class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > - <?php /* @escapeNotVerified */ echo $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() + <?php /* @noEscape */ echo $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotals($_item)); ?> </td> @@ -108,16 +105,16 @@ $numColumns = sizeof($block->getColumns()); <?php $i = 0; foreach ($block->getColumns() as $_column): ?> <?php if ($block->shouldRenderCell($_item, $_column)):?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" - class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" + class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td> <?php if ($block->shouldRenderEmptyCell($_item, $_column)):?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" - class="col-no-records <?= /* @escapeNotVerified */ $block->getEmptyTextClass() ?> last" + class="col-no-records <?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?> last" > - <?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?> + <?= $block->escapeHtml($block->getEmptyCellLabel()) ?> </td> <?php endif;?> <?php endif;?> @@ -128,7 +125,7 @@ $numColumns = sizeof($block->getColumns()); <?php elseif ($block->getEmptyText()): ?> <tr class="data-grid-tr-no-data" data-role="row"> <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" - colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> + colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></td> </tr> <?php endif; ?> </tbody> @@ -140,7 +137,7 @@ $numColumns = sizeof($block->getColumns()); <th data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>" > - <?php /* @escapeNotVerified */ echo($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() + <?php /* @noEscape */ echo($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($block->getTotals()) ?> </th> <?php endforeach; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml index 4aedef0821d70..d9815a2bbff01 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div class="admin__data-grid-export"> <label for="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" class="admin__control-support-text"> @@ -13,7 +10,7 @@ </label> <select name="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> - <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= $block->escapeHtml($_type->getLabel()) ?></option> <?php endforeach; ?> </select> <?= $block->getExportButtonHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index c64508ed47b2b..03cc882d77f71 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -45,7 +42,7 @@ $numColumns = sizeof($block->getColumns()); <select name="<?= $block->escapeHtml($block->getId()) ?>_export" id="<?= $block->escapeHtml($block->getId()) ?>_export" class="admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> - <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= /* @escapeNotVerified */ $_type->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= $block->escapeHtml($_type->getLabel()) ?></option> <?php endforeach; ?> </select> <?= $block->getExportButtonHtml() ?> @@ -61,8 +58,8 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> <?php $countRecords = $block->getCollection()->getSize(); ?> <div class="admin__control-support-text"> - <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @escapeNotVerified */ $block->getUiId('total-count') ?>> - <?= /* @escapeNotVerified */ $countRecords ?> + <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>-total-count" <?= /* @noEscape */ $block->getUiId('total-count') ?>> + <?= /* @noEscape */ $countRecords ?> </span> <?= $block->escapeHtml(__('records found')) ?> <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>_massaction-count" @@ -100,7 +97,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($_curPage > 1): ?> <button class="action-previous" type="button" - onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage - 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> <?php else: ?> @@ -111,7 +108,7 @@ $numColumns = sizeof($block->getColumns()); name="<?= $block->escapeHtmlAttr($block->getVarNamePage()) ?>" value="<?= $block->escapeHtmlAttr($_curPage) ?>" class="admin__control-text" - onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> + onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @noEscape */ $_lastPage ?>')" <?= /* @noEscape */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> </label> @@ -119,7 +116,7 @@ $numColumns = sizeof($block->getColumns()); <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" - onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @escapeNotVerified */ ($_curPage + 1) ?>');return false;"> + onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> <?php else: ?> @@ -171,7 +168,7 @@ $numColumns = sizeof($block->getColumns()); <tr class="totals"> <?php foreach ($block->getColumns() as $_column): ?> <th class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>"> - <?= /* @escapeNotVerified */ ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> + <?= /* @noEscape */ ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> </th> <?php endforeach; ?> </tr> @@ -190,13 +187,13 @@ $numColumns = sizeof($block->getColumns()); ?> <td <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> - <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> + <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php if ($block->shouldRenderEmptyCell($_item, $_column)): ?> <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" - class="last"><?= /* @escapeNotVerified */ $block->getEmptyCellLabel() ?></td><?php + class="last"><?= $block->escapeHtml($block->getEmptyCellLabel()) ?></td><?php endif; endif; endforeach; ?> @@ -207,7 +204,7 @@ $numColumns = sizeof($block->getColumns()); <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column): ?> <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> - <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> + <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td> <?php endforeach; ?> @@ -220,8 +217,8 @@ $numColumns = sizeof($block->getColumns()); <?php $i = 0; foreach ($block->getSubTotalColumns() as $_column): ?> <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> - <?= /* @escapeNotVerified */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> - <?php /* @escapeNotVerified */ echo($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : + <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> + <?php /* @noEscape */ echo($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotalItem($_item)) ); ?> @@ -233,7 +230,7 @@ $numColumns = sizeof($block->getColumns()); <?php elseif ($block->getEmptyText()): ?> <tr class="data-grid-tr-no-data"> <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" - colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= /* @escapeNotVerified */ $block->getEmptyText() ?></td> + colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></td> </tr> <?php endif; ?> </tbody> @@ -257,7 +254,7 @@ $numColumns = sizeof($block->getColumns()); <?php if (is_array($block->getRequireJsDependencies())): ?> <?php foreach ($block->getRequireJsDependencies() as $dependency): ?> - deps.push('<?= /* @escapeNotVerified */ $dependency ?>'); + deps.push('<?= $block->escapeJs($dependency) ?>'); <?php endforeach; ?> <?php endif; ?> @@ -266,25 +263,25 @@ $numColumns = sizeof($block->getColumns()); //<![CDATA[ <?php if ($block->getDependencyJsObject()): ?> - registry.get('<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>', function (<?= /* @escapeNotVerified */ $block->getDependencyJsObject() ?>) { + registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { <?php endif; ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?> = new varienGrid(<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getId()) ?>, '<?= /* @escapeNotVerified */ $block->getGridUrl() ?>', '<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameSort() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameDir() ?>', '<?= /* @escapeNotVerified */ $block->getVarNameFilter() ?>'); - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.useAjax = '<?= /* @escapeNotVerified */ $block->getUseAjax() ?>'; + <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid(<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getId()) ?>, '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; <?php if ($block->getRowClickCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.rowClickCallback = <?= /* @escapeNotVerified */ $block->getRowClickCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; <?php endif; ?> <?php if ($block->getCheckboxCheckCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.checkboxCheckCallback = <?= /* @escapeNotVerified */ $block->getCheckboxCheckCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> <?php if ($block->getRowInitCallback()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.initRowCallback = <?= /* @escapeNotVerified */ $block->getRowInitCallback() ?>; - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.initGridRows(); + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); <?php endif; ?> <?php if ($block->getMassactionBlock() && $block->getMassactionBlock()->isAvailable()): ?> - <?= /* @escapeNotVerified */ $block->getMassactionBlock()->getJavaScript() ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> <?php endif ?> - <?= /* @escapeNotVerified */ $block->getAdditionalJavaScript() ?> + <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> <?php if ($block->getDependencyJsObject()): ?> }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml index ca5d769a65cce..567c723a726cb 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml @@ -3,11 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?= /* @escapeNotVerified */ $block->getSomething() ?> +<?= /* @noEscape */ $block->getSomething() ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> <?php if ($block->getHideFormElement() !== true):?> @@ -18,10 +15,10 @@ <select id="<?= $block->getHtmlId() ?>-select" class="required-entry local-validation admin__control-select" - <?= /* @escapeNotVerified */ $block->getUiId('select') ?>> + <?= /* @noEscape */ $block->getUiId('select') ?>> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item):?> - <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> @@ -33,7 +30,7 @@ <?php endif ?> <div class="no-display"> <?php foreach ($block->getItems() as $_item): ?> - <div id="<?= $block->getHtmlId() ?>-item-<?= /* @escapeNotVerified */ $_item->getId() ?>-block"> + <div id="<?= $block->getHtmlId() ?>-item-<?= /* @noEscape */ $_item->getId() ?>-block"> <?php if ('' != $_item->getBlockName()):?> <?= $block->getChildHtml($_item->getBlockName()) ?> <?php endif;?> @@ -80,23 +77,23 @@ switch (massAction) { <?php if ($block->getUseSelectAll()):?> case 'selectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break; case 'unselectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectAll(); break; <?php endif; ?> case 'selectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectVisible(); break; case 'unselectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectVisible(); break; } }); }); <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setGridIds('<?= /* @escapeNotVerified */ $block->getGridIdsJson() ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml index 1bee18ff1103d..c10f62fbf25d9 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> @@ -19,7 +16,7 @@ class="required-entry local-validation admin__control-select"> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> <?php foreach ($block->getItems() as $_item): ?> - <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> @@ -31,7 +28,7 @@ <?php endif ?> <div class="no-display"> <?php foreach ($block->getItems() as $_item): ?> - <div id="<?= $block->getHtmlId() ?>-item-<?= /* @escapeNotVerified */ $_item->getId() ?>-block"> + <div id="<?= $block->getHtmlId() ?>-item-<?= /* @noEscape */ $_item->getId() ?>-block"> <?= $_item->getAdditionalActionBlockHtml() ?> </div> <?php endforeach; ?> @@ -69,17 +66,17 @@ switch (massAction) { <?php if ($block->getUseSelectAll()):?> case 'selectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break; case 'unselectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectAll(); break; <?php endif; ?> case 'selectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectVisible(); break; case 'unselectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectVisible(); break; } this.blur(); @@ -87,7 +84,7 @@ }); <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setGridIds('<?= /* @escapeNotVerified */ $block->getGridIdsJson() ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml index 87c3006583ecd..4bb92de5028ef 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -23,11 +20,11 @@ Event.observe(window, "load", function(){ var serializeInput = document.createElement('input'); serializeInput.type = 'hidden'; - serializeInput.name = '<?= /* @escapeNotVerified */ $block->getInputElementName() ?>'; - serializeInput.id = '<?= /* @escapeNotVerified */ $_id ?>'; + serializeInput.name = '<?= $block->escapeJs($block->getInputElementName()) ?>'; + serializeInput.id = '<?= /* @noEscape */ $_id ?>'; try { - document.getElementById('<?= /* @escapeNotVerified */ $formId ?>').appendChild(serializeInput); - new serializerController('<?= /* @escapeNotVerified */ $_id ?>', <?= /* @escapeNotVerified */ $block->getDataAsJSON() ?>, <?= /* @escapeNotVerified */ $block->getColumnInputNames(true) ?>, <?= /* @escapeNotVerified */ $block->getGridBlock()->getJsObjectName() ?>, '<?= /* @escapeNotVerified */ $block->getReloadParamName() ?>'); + document.getElementById('<?= $block->escapeJs($formId) ?>').appendChild(serializeInput); + new serializerController('<?= /* @noEscape */ $_id ?>', <?= /* @noEscape */ $block->getDataAsJSON() ?>, <?= /* @noEscape */ $block->getColumnInputNames(true) ?>, <?= $block->escapeJs($block->getGridBlock()->getJsObjectName()) ?>, '<?= $block->escapeJs($block->getReloadParamName()) ?>'); } catch(e) { //Error add serializer } @@ -35,12 +32,12 @@ }); </script> <?php else :?> -<input type="hidden" name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>" value="" id="<?= $block->escapeHtmlAttr($_id) ?>" /> +<input type="hidden" name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>" value="" id="<?= /* @noEscape */ $_id ?>" /> <script> require([ 'mage/adminhtml/grid' ], function(){ - new serializerController('<?= /* @escapeNotVerified */ $_id ?>', <?= /* @escapeNotVerified */ $block->getDataAsJSON() ?>, <?= /* @escapeNotVerified */ $block->getColumnInputNames(true) ?>, <?= /* @escapeNotVerified */ $block->getGridBlock()->getJsObjectName() ?>, '<?= /* @escapeNotVerified */ $block->getReloadParamName() ?>'); + new serializerController('<?= /* @noEscape */ $_id ?>', <?= /* @noEscape */ $block->getDataAsJSON() ?>, <?= /* @noEscape */ $block->getColumnInputNames(true) ?>, <?= $block->escapeJs($block->getGridBlock()->getJsObjectName()) ?>, '<?= $block->escapeJs($block->getReloadParamName()) ?>'); }); </script> <?php endif;?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml index 7565b0751bbd0..043dce6b641c1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml @@ -4,20 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\Widget\Tabs */ ?> <?php if (!empty($tabs)): ?> <div class="admin__page-nav" data-role="container" id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> <?php if ($block->getTitle()): ?> - <div class="admin__page-nav-title" data-role="title" <?= /* @escapeNotVerified */ $block->getUiId('title') ?>> - <strong><?= /* @escapeNotVerified */ $block->getTitle() ?></strong> + <div class="admin__page-nav-title" data-role="title" <?= /* @noEscape */ $block->getUiId('title') ?>> + <strong><?= $block->escapeHtml($block->getTitle()) ?></strong> <span data-role="title-messages" class="admin__page-nav-title-messages"></span> </div> <?php endif ?> - <ul <?= /* @escapeNotVerified */ $block->getUiId('tab', $block->getId()) ?> class="<?= /* @noEscape */ $block->getIsHoriz() ? 'tabs-horiz' : 'tabs admin__page-nav-items' ?>"> + <ul <?= /* @noEscape */ $block->getUiId('tab', $block->getId()) ?> class="<?= /* @noEscape */ $block->getIsHoriz() ? 'tabs-horiz' : 'tabs admin__page-nav-items' ?>"> <?php foreach ($tabs as $_tab): ?> <?php if (!$block->canShowTab($_tab)): continue; endif; ?> @@ -25,13 +23,13 @@ <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> - <li class="admin__page-nav-item" <?php if ($block->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?><?= /* @escapeNotVerified */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> + <li class="admin__page-nav-item" <?php if ($block->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?><?= /* @noEscape */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> <a href="<?= $block->escapeUrl($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" name="<?= $block->escapeHtmlAttr($block->getTabId($_tab, false)) ?>" title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" - class="admin__page-nav-link <?= /* @escapeNotVerified */ $_tabClass ?>" + class="admin__page-nav-link <?= $block->escapeHtmlAttr($_tabClass) ?>" data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>" - <?= /* @escapeNotVerified */ $block->getUiId('tab', 'link', $_tab->getId()) ?>> + <?= /* @noEscape */ $block->getUiId('tab', 'link', $_tab->getId()) ?>> - <span><?= /* @escapeNotVerified */ $block->getTabLabel($_tab) ?></span> + <span><?= $block->escapeHtml($block->getTabLabel($_tab)) ?></span> <span class="admin__page-nav-item-messages" data-role="item-messages"> <span class="admin__page-nav-item-message _changed"> @@ -54,7 +52,7 @@ </span> </span> </a> - <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none;"<?= /* @escapeNotVerified */ $block->getUiId('tab', 'content', $_tab->getId()) ?>><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none;"<?= /* @noEscape */ $block->getUiId('tab', 'content', $_tab->getId()) ?>><?= /* @noEscape */ $block->getTabContent($_tab) ?></div> </li> <?php endforeach; ?> </ul> @@ -63,11 +61,11 @@ <script> require(['jquery',"mage/backend/tabs"], function($){ $(function() { - $('#<?= /* @escapeNotVerified */ $block->getId() ?>').tabs({ - active: '<?= /* @escapeNotVerified */ $block->getActiveTabId() ?>', - destination: '#<?= /* @escapeNotVerified */ $block->getDestElementId() ?>', - shadowTabs: <?= /* @escapeNotVerified */ $block->getAllShadowTabs() ?>, - tabsBlockPrefix: '<?= /* @escapeNotVerified */ $block->getId() ?>_', + $('#<?= /* @noEscape */ $block->getId() ?>').tabs({ + active: '<?= /* @noEscape */ $block->getActiveTabId() ?>', + destination: '#<?= /* @noEscape */ $block->getDestElementId() ?>', + shadowTabs: <?= /* @noEscape */ $block->getAllShadowTabs() ?>, + tabsBlockPrefix: '<?= /* @noEscape */ $block->getId() ?>_', tabIdArgument: 'active_tab' }); }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml index d5be5c32ff7e4..7b221833e55b2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml @@ -3,12 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <!-- <?php if ($block->getTitle()): ?> - <h3><?= /* @escapeNotVerified */ $block->getTitle() ?></h3> + <h3><?= $block->escapeHtml($block->getTitle()) ?></h3> <?php endif ?> --> <?php if (!empty($tabs)): ?> <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> @@ -23,10 +20,10 @@ <span class="changed" title="<?= $block->escapeHtml(__('The information in this tab has been changed.')) ?>"></span> <span class="error" title="<?= $block->escapeHtml(__('This tab contains invalid data. Please resolve this before saving.')) ?>"></span> <span class="loader" title="<?= $block->escapeHtml(__('Loading...')) ?>"></span> - <?= /* @escapeNotVerified */ $block->getTabLabel($_tab) ?> + <?= $block->escapeHtml($block->getTabLabel($_tab)) ?> </span> </a> - <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none"><?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?></div> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none"><?= /* @noEscape */ $block->getTabContent($_tab) ?></div> </li> <?php endforeach; ?> </ul> @@ -34,10 +31,10 @@ <script> require(["jquery","mage/backend/tabs"], function($){ $(function() { - $('#<?= /* @escapeNotVerified */ $block->getId() ?>').tabs({ - active: '<?= /* @escapeNotVerified */ $block->getActiveTabId() ?>', - destination: '#<?= /* @escapeNotVerified */ $block->getDestElementId() ?>', - shadowTabs: <?= /* @escapeNotVerified */ $block->getAllShadowTabs() ?> + $('#<?= /* @noEscape */ $block->getId() ?>').tabs({ + active: '<?= /* @noEscape */ $block->getActiveTabId() ?>', + destination: '#<?= /* @noEscape */ $block->getDestElementId() ?>', + shadowTabs: <?= /* @noEscape */ $block->getAllShadowTabs() ?> }); }); }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml index 899926844ec9b..e06b93f563167 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml @@ -3,21 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<dl id="dl-<?= /* @escapeNotVerified */ $id ?>" class="accordion"> +<dl id="dl-<?= /* @noEscape */ $id ?>" class="accordion"> <?php foreach ($sections as $sectionId => $section): ?> - <dt id="dt-<?= /* @escapeNotVerified */ $id ?>-<?= /* @escapeNotVerified */ $sectionId ?>"> - <strong><?= /* @escapeNotVerified */ $section['title'] ?></strong> + <dt id="dt-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $sectionId ?>"> + <strong><?= $block->escapeHtml($section['title']) ?></strong> </dt> - <dd id="dd-<?= /* @escapeNotVerified */ $id ?>-<?= /* @escapeNotVerified */ $section['id'] ?>" class="section-menu <?= !empty($section['active']) ? 'open' : '' ?>"> + <dd id="dd-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $section['id'] ?>" class="section-menu <?= !empty($section['active']) ? 'open' : '' ?>"> <ul> <?php foreach ($section['children'] as $menuId => $menuItem): ?> - <li id="li-<?= /* @escapeNotVerified */ $id ?>-<?= /* @escapeNotVerified */ $sectionId ?>-<?= /* @escapeNotVerified */ $menuId ?>"> + <li id="li-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $sectionId ?>-<?= /* @noEscape */ $menuId ?>"> <a href="#" title="<?= $block->escapeHtmlAttr($menuItem['title']) ?>"> - <span><?= /* @escapeNotVerified */ $menuItem['label'] ?></span> + <span><?= $block->escapeHtml($menuItem['label']) ?></span> </a> </li> <?php endforeach ?> From baf04e5b2a0197706f4fee97bf3c047c0f9f6bf4 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 22 May 2019 07:35:30 -0500 Subject: [PATCH 196/464] MAGETWO-99769: SKU search weight is ignored --- app/code/Magento/CatalogSearch/etc/search_request.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/etc/search_request.xml b/app/code/Magento/CatalogSearch/etc/search_request.xml index d7bfb2e6b4a5c..6f9eb6e20666e 100644 --- a/app/code/Magento/CatalogSearch/etc/search_request.xml +++ b/app/code/Magento/CatalogSearch/etc/search_request.xml @@ -19,7 +19,6 @@ <queryReference clause="must" ref="visibility"/> </query> <query xsi:type="matchQuery" value="$search_term$" name="search"> - <match field="sku"/> <match field="*"/> </query> <query xsi:type="filteredQuery" name="category"> From 01310e06fe262ad0037127c5f7443bce5accec5b Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 22 May 2019 16:47:15 -0500 Subject: [PATCH 197/464] MAGETWO-99769: SKU search weight is ignored --- .../Test/Unit/Model/Search/RequestGeneratorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php index b52c9cfd67494..6492b645357a4 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php @@ -61,7 +61,7 @@ public function attributesProvider() return [ [ [ - 'quick_search_container' => ['queries' => 0, 'filters' => 0, 'aggregations' => 0], + 'quick_search_container' => ['queries' => 1, 'filters' => 0, 'aggregations' => 0], 'advanced_search_container' => ['queries' => 0, 'filters' => 0, 'aggregations' => 0], 'catalog_view_container' => ['queries' => 0, 'filters' => 0, 'aggregations' => 0] ], From 22803243b729848c235fa42f8032f4d5a1cf623d Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Thu, 23 May 2019 11:20:51 -0500 Subject: [PATCH 198/464] MAGETWO-99769: SKU search weight is ignored --- .../Search/AttributeSearchWeightTest.php | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php new file mode 100644 index 0000000000000..8f22e11178efe --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -0,0 +1,168 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Model\Search; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Elasticsearch\SearchAdapter\ConnectionManager; +use Magento\Elasticsearch6\Model\Client\Elasticsearch as ElasticsearchClient; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Search\Request\Builder; +use Magento\Framework\Search\Request\Config as RequestConfig; +use Magento\Framework\Search\Response\QueryResponse; +use Magento\Framework\Search\SearchEngineInterface; +use Magento\Indexer\Model\Indexer; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\CacheCleaner; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\TestCase; + +/** + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + */ +class AttributeSearchWeightTest extends TestCase +{ + + /** @var $objectManager ObjectManager */ + private $objectManager; + + /** + * @var ConnectionManager + */ + private $connectionManager; + + /** + * @var ElasticsearchClient + */ + private $client; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->connectionManager = $this->objectManager->create(ConnectionManager::class); + $this->client = $this->connectionManager->getConnection(); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + } + + private function setAttributeSearchWeight(string $attributeName, int $searchWeight) + { + /** @var AttributeRepositoryInterface $attributeRepository */ + $attributeRepository = $this->objectManager->create(AttributeRepositoryInterface::class); + + /** @var Attribute $attribute */ + $attribute = $attributeRepository->get('catalog_product', $attributeName); + + if ($attribute) { + $attribute->setSearchWeight($searchWeight); + $attributeRepository->save($attribute); + } + } + + /** + * @throws \Throwable + */ + private function reindex() + { + CacheCleaner::cleanAll(); + + /** @var Indexer $indexer */ + $indexer = $this->objectManager->create(Indexer::class); + $indexer->load('catalogsearch_fulltext'); + $indexer->reindexAll(); + } + + /** + * @param string $query + * @return array + * @throws NoSuchEntityException + */ + private function findProducts(string $query): array + { + $config = $this->objectManager->create(RequestConfig::class); + + /** @var Builder $requestBuilder */ + $requestBuilder = $this->objectManager->create( + Builder::class, + ['config' => $config] + ); + $requestBuilder->bind('search_term', $query); + $requestBuilder->setRequestName('quick_search_container'); + + /** @var QueryResponse $searchResult */ + $searchResults = $this->objectManager->create(SearchEngineInterface::class) + ->search($requestBuilder->create()); + + $products = []; + foreach ($searchResults as $searchResult) { + $products [] = $this->productRepository->getById($searchResult->getId()); + } + + return $products; + } + + /** + * @dataProvider skuOverNameAttributeSearchWeightDataProvider + * @magentoConfigFixture default/catalog/search/engine elasticsearch6 + * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search + * @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php + * @param $searchQuery + * @param $skuSearchWeight + * @param $nameSearchWeight + * @param $firstMatchProductName + * @param $secondMatchProductName + * @throws NoSuchEntityException + * @throws \Throwable + */ + public function testSkuOverNameAttributeSearchWeight( + $searchQuery, + $skuSearchWeight, + $nameSearchWeight, + $firstMatchProductName, + $secondMatchProductName + ) { + $this->setAttributeSearchWeight('sku', $skuSearchWeight); + $this->setAttributeSearchWeight('name', $nameSearchWeight); + $this->reindex(); + + /** @var Product $products [] */ + $products = $this->findProducts($searchQuery); + + $this->assertCount( + 2, + $products, + 'Expected to find 2 products, found ' . count($products) . '.' + ); + + $this->assertEquals( + $firstMatchProductName, + $products[0]->getData('name'), + 'Products order is not as expected.' + ); + $this->assertEquals( + $secondMatchProductName, + $products[1]->getData('name'), + 'Products order is not as expected.' + ); + + } + + public function skuOverNameAttributeSearchWeightDataProvider() + { + return [ + ['1-2-3-4', 10, 5, 'test', '1-2-3-4'], + ['1-2-3-4', 5, 10, '1-2-3-4', 'test'], + ]; + } +} From 7eb7b530cd1fb834767499effec61a13273d6737 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Thu, 23 May 2019 11:22:27 -0500 Subject: [PATCH 199/464] MAGETWO-99769: SKU search weight is ignored --- .../products_for_sku_search_weight_score.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php new file mode 100644 index 0000000000000..96d5c256dc727 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class); +$product = Bootstrap::getObjectManager()->create(Product::class); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('1-2-3-4') + ->setSku('testsku') + ->setPrice(10) + ->setTaxClassId(0) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); + +$product = Bootstrap::getObjectManager()->create(Product::class); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('test') + ->setSku('1-2-3-4') + ->setPrice(10) + ->setTaxClassId(0) + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); +$productRepository->save($product); From a84ecbbb5ec24e56d9ea5d6026681c4f09010dc3 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Thu, 23 May 2019 12:25:10 -0500 Subject: [PATCH 200/464] MAGETWO-99769: SKU search weight is ignored --- .../Test/Unit/Model/Search/RequestGeneratorTest.php | 3 +++ .../CatalogSearch/Model/Search/AttributeSearchWeightTest.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php index 6492b645357a4..a8c654652a32f 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/RequestGeneratorTest.php @@ -9,6 +9,9 @@ use Magento\CatalogSearch\Model\Search\RequestGenerator\GeneratorResolver; use Magento\CatalogSearch\Model\Search\RequestGenerator\GeneratorInterface; +/** + * Test for \Magento\CatalogSearch\Model\Search\RequestGenerator + */ class RequestGeneratorTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index 8f22e11178efe..1880fd3e7d414 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -24,6 +24,8 @@ use PHPUnit\Framework\TestCase; /** + * Test for name over sku search weight of product attributes + * * @magentoAppIsolation enabled * @magentoDbIsolation enabled */ @@ -155,7 +157,6 @@ public function testSkuOverNameAttributeSearchWeight( $products[1]->getData('name'), 'Products order is not as expected.' ); - } public function skuOverNameAttributeSearchWeightDataProvider() From b375a777475676f42d44f964f9ffdf5c78e6c5c7 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Thu, 23 May 2019 15:23:37 -0500 Subject: [PATCH 201/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Backend/view/adminhtml/templates/admin/access_denied.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/admin/login.phtml | 2 -- .../Backend/view/adminhtml/templates/admin/overlay_popup.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/admin/page.phtml | 3 --- .../Backend/view/adminhtml/templates/dashboard/graph.phtml | 3 --- .../view/adminhtml/templates/dashboard/graph/disabled.phtml | 2 -- .../Backend/view/adminhtml/templates/dashboard/grid.phtml | 3 --- .../Backend/view/adminhtml/templates/dashboard/index.phtml | 3 --- .../Backend/view/adminhtml/templates/dashboard/salebar.phtml | 3 --- .../Backend/view/adminhtml/templates/dashboard/searches.phtml | 3 --- .../view/adminhtml/templates/dashboard/store/switcher.phtml | 3 --- .../Backend/view/adminhtml/templates/dashboard/totalbar.phtml | 3 --- .../Backend/view/adminhtml/templates/media/uploader.phtml | 2 -- app/code/Magento/Backend/view/adminhtml/templates/menu.phtml | 3 --- .../Backend/view/adminhtml/templates/page/copyright.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/page/footer.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/page/header.phtml | 2 -- .../Backend/view/adminhtml/templates/page/js/components.phtml | 3 --- .../Backend/view/adminhtml/templates/page/notices.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/page/report.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/pageactions.phtml | 3 --- .../Backend/view/adminhtml/templates/store/switcher.phtml | 2 -- .../store/switcher/form/renderer/fieldset/element.phtml | 3 --- .../view/adminhtml/templates/system/cache/additional.phtml | 2 -- .../Backend/view/adminhtml/templates/system/design/index.phtml | 3 --- .../Backend/view/adminhtml/templates/system/search.phtml | 2 -- .../Backend/view/adminhtml/templates/widget/breadcrumbs.phtml | 3 --- .../Magento/Backend/view/adminhtml/templates/widget/form.phtml | 2 -- .../adminhtml/templates/widget/form/renderer/element.phtml | 3 --- .../view/adminhtml/templates/widget/grid/container.phtml | 3 --- .../view/adminhtml/templates/widget/grid/container/empty.phtml | 3 --- .../view/adminhtml/templates/widget/view/container.phtml | 3 --- 32 files changed, 88 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml index 843328fbf17d7..b4b34650baefd 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index 4a44356e8e62a..1d05450f44c99 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var \Magento\Framework\View\Element\AbstractBlock $block */ diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml index 59c6a558cccaa..7493bb96be652 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div class="wrapper-popup"> <div class="middle" id="anchor-content"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml index 362f38549f180..12af342e0cc59 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Backend\Block\Page */ ?> <!doctype html> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index 4eba356a8486f..a357a491338f5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div class="dashboard-diagram"> <div class="dashboard-diagram-switcher"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml index 87d103fe855f0..86152d661a4a7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml @@ -3,8 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <div class="dashboard-diagram-disabled"> <?= /* @noEscape */ __('Chart is disabled. To enable the chart, click <a href="%1">here</a>.', $block->getConfigUrl()) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index 11db29ad25bd5..d089071840551 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml index 3516c632f1a7e..c2c7b229361bb 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml index fc16f7ff586ac..6f14928b767a2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if (sizeof($block->getTotals()) > 0): ?> <?php foreach ($block->getTotals() as $_total): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml index aaf6cf61ab678..88d88cd9406ea 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if (count($block->getCollection()->getItems()) > 0): ?> <div class="searches-results"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index ecf3ac1621b80..c6aa4cadb29a6 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <p class="switcher"><label for="store_switcher"><?= $block->escapeHtml(__('View Statistics For:')) ?></label> <?= $block->getHintHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml index cce4e9d4e885c..6bb47607f6396 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if (sizeof($block->getTotals()) > 0): ?> <div class="dashboard-totals" id="dashboard_diagram_totals"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index aacd6aed149cf..83482b1720cf5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\Media\Uploader */ ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml b/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml index 1dbee79166796..815cf9c8e4cd4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/menu.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <nav data-mage-init='{"globalNavigation": {}}' class="admin__menu"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml index 89ad29f142941..edd3a0d9e5ebc 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <a class="link-copyright" href="http://magento.com" target="_blank" title="<?= $block->escapeHtml(__('Magento')) ?>"></a> <?= $block->escapeHtml(__('Copyright © %1 Magento Commerce Inc. All rights reserved.', date('Y'))) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml index bbaf30a3ca327..3f21dcda9a544 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/footer.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <p class="magento-version"> <strong><?= $block->escapeHtml(__('Magento')) ?></strong> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index b30f123dae749..8f33f8e357109 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\Page\Header */ ?> <?php switch ($block->getShowPart()): diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml index c6c7bcc901e7e..5277a1df2f31e 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml index a92ba433321e6..4d5ba9f8a07d5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml index 2d6601f7233dc..fd5407cffc2d0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($block->getBugreportUrl()): ?> <a class="link-report" href="<?= $block->escapeUrl($block->getBugreportUrl()) ?>" id="footer_bug_tracking" target="_blank"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml index 5bd796baaeed2..45204a7750540 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($block->getChildHtml()):?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions floating-header" <?= /* @noEscape */ $block->getUiId('content-header') ?>> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index 6987ca92d2113..d914386907920 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Backend\Block\Store\Switcher */ ?> <?php if ($websites = $block->getWebsites()): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml index 33dc3ca97f833..37db4d68d60ed 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */ diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml index b4bc42b95d0aa..d4371fa9972f4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Backend\Block\Cache\Permissions|null $permissions */ $permissions = $block->getData('permissions'); ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/design/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/design/index.phtml index 902c6932f0ae1..c0928f4723b50 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/design/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/design/index.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml('grid') ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index 5ddd14ebd145f..dbebd68cd0e60 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\GlobalSearch */ ?> <div class="search-global" data-mage-init='{"globalSearch": {}}'> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml index 13b4c83757a6c..3bcfadbadf832 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if (!empty($links)): ?> <ul class="breadcrumbs"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml index dc7d02795a054..62f8d25ce1be2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Backend\Block\Widget\Form */ ?> <?php /* @todo replace .form-inline with better class name */?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml index ae0bcb826a1a3..8e776d3ff5f9e 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_element = $block->getElement() ?> <?php if ($_element->getNoSpan() !== true): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml index 8a40853a405b0..c5fad3929101a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php if ($block->getButtonsHtml()): ?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions"><?= $block->getButtonsHtml() ?></div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container/empty.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container/empty.phtml index 700e9749f734b..e62c6ca3b4255 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container/empty.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container/empty.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getGridHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/view/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/view/container.phtml index f29e8fd8624c0..a0d56911ae274 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/view/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/view/container.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions"><?= $block->getButtonsHtml() ?></div> <?= $block->getViewHtml() ?> From 53f41cce762e5e344b6605e8879df1d79316c31e Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 23 May 2019 15:51:40 -0500 Subject: [PATCH 202/464] MC-16872: Add loadCss library for preload fallback - Move loadCSS polyfill script to layout; --- .../Magento/Theme/Controller/Result/AsyncCssPlugin.php | 6 ------ .../Theme/view/frontend/layout/default_head_blocks.xml | 4 ++++ .../view/frontend/templates/js/css_rel_preload.phtml | 10 ++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php index e9c26dc2c7f7a..577141d4fb9cc 100644 --- a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -38,8 +38,6 @@ public function __construct(ScopeConfigInterface $scopeConfig) public function beforeSendResponse(Http $subject): void { $content = $subject->getContent(); - // loadCSS rel=preload polyfill script https://github.com/filamentgroup/loadCSS/blob/v2.0.1/src/cssrelpreload.js - $loadCssScript = '!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);'; if (strpos($content, '</body') !== false && $this->scopeConfig->isSetFlag( self::XML_PATH_USE_CSS_CRITICAL_PATH, @@ -67,10 +65,6 @@ function ($matches) { }, $content ); - // add CSS rel preload polyfill script - $pattern = '@</head>@'; - $replacement = '<script>' . $loadCssScript . '</script></head>'; - $content = preg_replace($pattern, $replacement, $content); $subject->setContent($content); } diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 38cfe25c16f8e..5507fb74ef479 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -13,6 +13,10 @@ <script src="mage/polyfill.js"/> </head> <body> + <referenceBlock name="head.additional"> + <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" + template="Magento_Theme::js/css_rel_preload.phtml"/> + </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> </referenceContainer> diff --git a/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml b/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml new file mode 100644 index 0000000000000..d90d528ffc6f8 --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml @@ -0,0 +1,10 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +?> +<script> + /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */ + !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this); +</script> From 247fe19818c6eef0c4563f87d85c87a3b903bf6f Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 23 May 2019 16:02:38 -0500 Subject: [PATCH 203/464] MC-16872: Add loadCss library for preload fallback --- .../Magento/Theme/view/frontend/layout/default_head_blocks.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 5507fb74ef479..82e7c80d9be0c 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -14,8 +14,7 @@ </head> <body> <referenceBlock name="head.additional"> - <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" - template="Magento_Theme::js/css_rel_preload.phtml"/> + <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> From 7a578d82a1f8813905c6e2abb6f9a468b7289791 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Thu, 23 May 2019 17:01:52 -0500 Subject: [PATCH 204/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Magento/Backend/view/adminhtml/templates/widget/grid.phtml | 2 +- .../Backend/view/adminhtml/templates/widget/grid/extended.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index 9a398f85ed9f8..1ff4c02f3b1a7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -101,7 +101,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> - <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> + <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> </label> <?php if ($_curPage < $_lastPage): ?> <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index 03cc882d77f71..bde05df363ab4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -110,7 +110,7 @@ $numColumns = sizeof($block->getColumns()); class="admin__control-text" onkeypress="<?= /* @noEscape */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @noEscape */ $_lastPage ?>')" <?= /* @noEscape */ $block->getUiId('current-page') ?> /> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> - <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection())->getLastPageNumber() . '</span>' ?> + <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> </label> <?php if ($_curPage < $_lastPage): ?> <button type="button" From 0ed5b4dbb5a0e66321695298957f2c48f8a74225 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Thu, 23 May 2019 17:42:21 -0500 Subject: [PATCH 205/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- .../AdminAnchorCategoryActionGroup.xml | 29 +++ .../Mftf/Section/AdminProductFormSection.xml | 1 + .../AdminMoveProductBetweenCategoriesTest.xml | 216 ++++++++++++++++++ .../AdminCatalogSearchConfigurationPage.xml | 1 + ...atalogSearchEngineConfigurationSection.xml | 15 ++ ...inSwitchIndexerToActionModeActionGroup.xml | 22 ++ 6 files changed, 284 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml create mode 100644 app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml new file mode 100644 index 0000000000000..62e9a4b6615b2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAnchorCategoryActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!--Open Category page--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <waitForPageLoad stepKey="waitForCategoryToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryName)}}" stepKey="selectCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + + <!--Enable Anchor for category --> + <scrollTo selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" x="0" y="-80" stepKey="scrollToDisplaySetting"/> + <click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="selectDisplaySetting"/> + <checkOption selector="{{CategoryDisplaySettingsSection.anchor}}" stepKey="enableAnchor"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index f515171e835db..dfc6d07f37c4d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -32,6 +32,7 @@ <element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/> <element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/> <element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/> + <element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb span[data-bind='text: label']"/> <element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/> <element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/> <element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml new file mode 100644 index 0000000000000..f270ec705ff37 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminMoveProductBetweenCategoriesTest"> + <annotations> + <stories value="Move Product"/> + <title value="Move Product between Categories (Cron is ON, 'Update by Schedule' Mode)"/> + <description value="Verifies correctness of showing data (products, categories) on Storefront after moving an anchored category in terms of products/categories association"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11296"/> + <group value="catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> + <waitForPageLoad stepKey="waitForManagementPage"/> + + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> + <argument name="indexerValue" value="catalog_category_product"/> + </actionGroup> + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> + <argument name="indexerValue" value="catalog_product_category"/> + </actionGroup> + + <!-- Create the anchored category <Cat1_anchored> --> + <createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/> + <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> + <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> + </actionGroup> + <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> + + <!-- Create subcategory <Sub1> of the anchored category --> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> + + <!-- Assign <product1> to the <Sub1> --> + <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> + <click selector="{{AdminCategoryProductsSection.addProducts}}" stepKey="clickButtonAddProducts"/> + <waitForPageLoad stepKey="waitForPanelAddProducts"/> + <conditionalClick selector="{{AdminCategoryAddProductsModalSection.clearAll}}" dependentSelector="{{AdminCategoryAddProductsModalSection.clearAll}}" visible="true" stepKey="clearFilters"/> + <fillField selector="{{AdminCategoryAddProductsModalSection.searchKeyword}}" userInput="$$simpleProduct.name$$" stepKey="fillSearch"/> + <click selector="{{AdminCategoryAddProductsModalSection.searchFullText}}" stepKey="clickSearch"/> + <click selector="{{AdminCategoryAddProductsModalSection.gridActionToggle}}" stepKey="clickActionToggle"/> + <click selector="{{AdminCategoryAddProductsModalSection.gridSelectAll}}" stepKey="clickSelectAll"/> + <click selector="{{AdminCategoryAddProductsModalSection.saveClose}}" stepKey="saveAndClose"/> + <waitForLoadingMaskToDisappear stepKey="waitForSavingSearch"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + + <!-- Create another non-anchored category <Cat2> --> + <createData entity="_defaultCategory" stepKey="createSecondCategory"/> + + <!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization --> + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/> + <waitForPageLoad stepKey="waitForLoading"/> + <conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/> + <uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/> + <selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSaving"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> + </before> + <after> + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> + <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Navigate to the Catalog > Products --> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onCatalogProductPage"/> + <waitForPageLoad stepKey="waitForProductPage"/> + + <!-- Click on <product1>: Product page opens--> + <actionGroup ref="filterProductGridByName" stepKey="filterProduct"> + <argument name="product" value="$$simpleProduct$$"/> + </actionGroup> + <click selector="{{AdminProductGridSection.productGridNameProduct($$simpleProduct.name$$)}}" stepKey="clickProduct1"/> + <waitForPageLoad stepKey="waitForProductLoad"/> + + <!-- Clear "Categories" field and assign the product to <Cat2> and save the product --> + <grabTextFrom selector="{{AdminProductFormSection.currentCategory}}" stepKey="grabNameSubCategory"/> + <click selector="{{AdminProductFormSection.unselectCategories(SimpleSubCategory.name)}}" stepKey="removeCategory"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> + <checkOption selector="{{AdminProductFormSection.selectCategory($$createSecondCategory.name$$)}}" stepKey="selectCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForApplyCategory"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + + <!--Product is saved --> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + + <!-- Run cron --> + <magentoCLI command="cron:run" stepKey="runCron"/> + + <!-- Clear invalidated cache on System>Tools>Cache Management page --> + <amOnPage url="{{AdminCacheManagementPage.url}}" stepKey="onCachePage"/> + <waitForPageLoad stepKey="waitForCacheManagementPage"/> + + <checkOption selector="{{AdminCacheManagementSection.configurationCheckbox}}" stepKey="checkConfigCache"/> + <checkOption selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="checkPageCache"/> + + <selectOption userInput="Refresh" selector="{{AdminCacheManagementSection.massActionSelect}}" stepKey="selectRefresh"/> + <waitForElementVisible selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="waitSubmitButton"/> + <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForRefresh"/> + + <see userInput="2 cache type(s) refreshed." stepKey="seeCacheRefreshedMessage"/> + <actionGroup ref="logout" stepKey="logout"/> + + <!-- Open frontend --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + + <!-- Open <Cat2> from navigation menu --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openCat2"/> + <waitForPageLoad stepKey="waitForCategory2Page"/> + + <!-- # <Cat 2> should open # <product1> should be present on the page --> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryName"/> + <see userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProduct"/> + + <!-- Open <product1> --> + <click selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.urlKey$$)}}" stepKey="openProduct"/> + <waitForPageLoad stepKey="waitForProductPageLoading"/> + + <!-- # Product page should open successfully # Breadcrumb for product should be like <Cat 2> --> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductName"/> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCategoryInBreadcrumbs"/> + + <!-- Open <Cat1_anchored> category --> + <click selector="{{StorefrontNavigationSection.topCategory($$createAnchoredCategory1.name$$)}}" stepKey="clickCat1"/> + <waitForPageLoad stepKey="waitForCategory1PageLoad"/> + + <!-- # Category should open successfully # <product1> should be absent on the page --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategory1Name"/> + <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProduct"/> + + <!-- Log in to the backend: Admin user is logged in--> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAdmin"/> + + <!-- Navigate to the Catalog > Products: Navigate to the Catalog>Products --> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductsPage"/> + + <!-- Click on <product1> --> + <actionGroup ref="filterAndSelectProduct" stepKey="openSimpleProduct"> + <argument name="productSku" value="$$simpleProduct.sku$$"/> + </actionGroup> + + <!-- Clear "Categories" field and assign the product to <Sub1> and save the product --> + <click selector="{{AdminProductFormSection.unselectCategories($$createSecondCategory.name$$)}}" stepKey="clearCategory"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/> + <fillField userInput="{$grabNameSubCategory}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/> + <waitForPageLoad stepKey="waitForSearchSubCategory"/> + <click selector="{{AdminProductFormSection.selectCategory({$grabNameSubCategory})}}" stepKey="selectSubCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> + <waitForPageLoad stepKey="waitForCategoryApply"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> + <waitForPageLoad stepKey="waitForSaving"/> + + <!-- Product is saved successfully --> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSaveMessage"/> + + <!-- Run cron --> + <magentoCLI command="cron:run" stepKey="runCron2"/> + + <!-- Open frontend --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontendPage"/> + <waitForPageLoad stepKey="waitForFrontPageLoad"/> + + <!-- Open <Cat2> from navigation menu --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openSecondCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryPage"/> + + <!-- # <Cat 2> should open # <product1> should be absent on the page --> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSecondCategory1Name"/> + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeSimpleProduct"/> + + <!-- Click on <Cat1_anchored> category --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="clickAnchoredCategory"/> + <waitForPageLoad stepKey="waitForAnchoredCategoryPage"/> + + <!-- # Category should open successfully # <product1> should be present on the page --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="see1CategoryName"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnCategory1Page"/> + + <!-- Breadcrumb for product should be like <Cat1_anchored>/<product> (if you clicks from anchor category) --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1inBreadcrumbs"/> + <dontSee userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="dontSeeSubCategoryInBreadCrumbs"/> + + <!-- <Cat1_anchored>/<Sub1>/<product> (if you clicks from Sub1 category) --> + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="hoverCategory1"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName({$grabNameSubCategory})}}" stepKey="clickSubCat"/> + <waitForPageLoad stepKey="waitForSubCategoryPageLoad"/> + + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSubCategoryName"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnSubCategoryPage"/> + + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeSubCategoryInBreadcrumbs"/> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1InBreadcrumbs"/> + </test> +</tests> diff --git a/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml b/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml index c3fa13f59697e..d38035cd5e02e 100644 --- a/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml +++ b/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml @@ -8,5 +8,6 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="AdminCatalogSearchConfigurationPage" url="admin/system_config/edit/section/catalog/" area="admin" module="Magento_Config"> <section name="AdminCatalogSearchConfigurationSection"/> + <section name="AdminCatalogSearchEngineConfigurationSection"/> </page> </pages> diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml new file mode 100644 index 0000000000000..570d831ce5807 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCatalogSearchEngineConfigurationSection"> + <element name="searchEngineOptimization" type="button" selector="#catalog_seo-head"/> + <element name="openedEngineOptimization" type="button" selector="#catalog_seo-head.open"/> + <element name="systemValueUseCategoriesPath" type="checkbox" selector="#catalog_seo_product_use_categories_inherit"/> + <element name="selectUseCategoriesPatForProductUrls" type="select" selector="#catalog_seo_product_use_categories"/> + </section> +</sections> \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml new file mode 100644 index 0000000000000..4866d337b54ef --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSwitchIndexerToActionModeActionGroup"> + <arguments> + <argument name="indexerValue" type="string"/> + <argument name="action" type="string" defaultValue="Update by Schedule"/> + </arguments> + <checkOption selector="{{AdminIndexManagementSection.indexerCheckbox(indexerValue)}}" stepKey="checkIndexer"/> + <selectOption userInput="{{action}}" selector="{{AdminIndexManagementSection.massActionSelect}}" stepKey="selectAction"/> + <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForSubmit"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="1 indexer(s) are in "Update by Schedule" mode." stepKey="seeMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file From db71c65a247ccc78bce17e0f4bc44f1300e67c02 Mon Sep 17 00:00:00 2001 From: mahesh <mahesh721@webkul.com> Date: Sat, 27 Apr 2019 16:38:58 +0530 Subject: [PATCH 206/464] Fixed issue #22511 Updated with the latest code condition updated revert rebase --- app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php b/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php index ed9f89efc6891..a898075befd16 100644 --- a/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php +++ b/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php @@ -38,10 +38,9 @@ public function execute(\Magento\Framework\Event\Observer $observer) { /** @var $product \Magento\Catalog\Model\Product */ $product = $observer->getEvent()->getProduct(); - if ($product->getSpecialPrice() && ! $product->getSpecialFromDate()) { + if ($product->getSpecialPrice() && $product->getSpecialFromDate() === null) { $product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0)); } - return $this; } } From e1a1094b28ac051c44091844c1ae06eceff5d4d6 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Fri, 24 May 2019 11:39:43 +0300 Subject: [PATCH 207/464] magento/magento#22989 static-test-fix --- .../Magento/Framework/Filter/Test/Unit/TranslitTest.php | 3 +++ .../Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php index 384a0d8d26bb7..cb8e34ca28f5c 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Filter\Test\Unit; +/** + * Translit test. + */ class TranslitTest extends \PHPUnit\Framework\TestCase { /** diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php index 3feee07ad8541..0bd568d920399 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TranslitUrlTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Filter\Test\Unit; +/** + * Translit url test. + */ class TranslitUrlTest extends \PHPUnit\Framework\TestCase { /** From 048a2ee6b6f7215ea3168773730bff2f0ec2f01f Mon Sep 17 00:00:00 2001 From: Timon de Groot <timon@marissen.net> Date: Fri, 24 May 2019 11:03:09 +0200 Subject: [PATCH 208/464] Improve command catalog:images:resize - Only resize images that are actually in use. - Improve code on several places --- .../Model/ResourceModel/Product/Image.php | 63 ++++++++- .../Model/ResourceModel/Product/ImageTest.php | 125 +++++++++++++++++- .../Console/Command/ImagesResizeCommand.php | 19 +-- .../MediaStorage/Service/ImageResize.php | 4 +- 4 files changed, 193 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php index 77f67480619e0..febffde3b75a7 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php @@ -54,7 +54,7 @@ public function __construct( } /** - * Returns product images + * Get all product images. * * @return \Generator */ @@ -75,7 +75,28 @@ public function getAllProductImages(): \Generator } /** - * Get the number of unique pictures of products + * Get used product images. + * + * @return \Generator + */ + public function getUsedProductImages(): \Generator + { + $batchSelectIterator = $this->batchQueryGenerator->generate( + 'value_id', + $this->getUsedImagesSelect(), + $this->batchSize, + \Magento\Framework\DB\Query\BatchIteratorInterface::NON_UNIQUE_FIELD_ITERATOR + ); + + foreach ($batchSelectIterator as $select) { + foreach ($this->connection->fetchAll($select) as $key => $value) { + yield $key => $value; + } + } + } + + /** + * Get the number of unique images of products. * * @return int */ @@ -92,7 +113,24 @@ public function getCountAllProductImages(): int } /** - * Return Select to fetch all products images + * Get the number of unique and used images of products. + * + * @return int + */ + public function getCountUsedProductImages(): int + { + $select = $this->getUsedImagesSelect() + ->reset('columns') + ->reset('distinct') + ->columns( + new \Zend_Db_Expr('count(distinct value)') + ); + + return (int) $this->connection->fetchOne($select); + } + + /** + * Return select to fetch all products images. * * @return Select */ @@ -106,4 +144,23 @@ private function getVisibleImagesSelect(): Select 'disabled = 0' ); } + + /** + * Return select to fetch all used product images. + * + * @return Select + */ + private function getUsedImagesSelect(): Select + { + return $this->connection->select()->distinct() + ->from( + ['images' => $this->resourceConnection->getTableName(Gallery::GALLERY_TABLE)], + 'value as filepath' + )->joinInner( + ['image_value' => $this->resourceConnection->getTableName(Gallery::GALLERY_VALUE_TABLE)], + 'images.value_id = image_value.value_id' + )->where( + 'images.disabled = 0 AND image_value.disabled = 0' + ); + } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php index 4fce12dc2de89..a5bc118d7acb6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php @@ -76,6 +76,37 @@ protected function getVisibleImagesSelectMock(): MockObject return $selectMock; } + /** + * @return MockObject + */ + protected function getUsedImagesSelectMock(): MockObject + { + $selectMock = $this->getMockBuilder(Select::class) + ->disableOriginalConstructor() + ->getMock(); + $selectMock->expects($this->once()) + ->method('distinct') + ->willReturnSelf(); + $selectMock->expects($this->once()) + ->method('from') + ->with( + ['images' => Gallery::GALLERY_TABLE], + 'value as filepath' + )->willReturnSelf(); + $selectMock->expects($this->once()) + ->method('joinInner') + ->with( + ['image_value' => Gallery::GALLERY_VALUE_TABLE], + 'images.value_id = image_value.value_id' + )->willReturnSelf(); + $selectMock->expects($this->once()) + ->method('where') + ->with('images.disabled = 0 AND image_value.disabled = 0') + ->willReturnSelf(); + + return $selectMock; + } + /** * @param int $imagesCount * @dataProvider dataProvider @@ -116,15 +147,53 @@ public function testGetCountAllProductImages(int $imagesCount): void ); } + /** + * @param int $imagesCount + * @dataProvider dataProvider + */ + public function testGetCountUsedProductImages(int $imagesCount): void + { + $selectMock = $this->getUsedImagesSelectMock(); + $selectMock->expects($this->exactly(2)) + ->method('reset') + ->withConsecutive( + ['columns'], + ['distinct'] + )->willReturnSelf(); + $selectMock->expects($this->once()) + ->method('columns') + ->with(new \Zend_Db_Expr('count(distinct value)')) + ->willReturnSelf(); + + $this->connectionMock->expects($this->once()) + ->method('select') + ->willReturn($selectMock); + $this->connectionMock->expects($this->once()) + ->method('fetchOne') + ->with($selectMock) + ->willReturn($imagesCount); + + $imageModel = $this->objectManager->getObject( + Image::class, + [ + 'generator' => $this->generatorMock, + 'resourceConnection' => $this->resourceMock + ] + ); + + $this->assertSame( + $imagesCount, + $imageModel->getCountUsedProductImages() + ); + } + /** * @param int $imagesCount * @param int $batchSize * @dataProvider dataProvider */ - public function testGetAllProductImages( - int $imagesCount, - int $batchSize - ): void { + public function testGetAllProductImages(int $imagesCount, int $batchSize): void + { $this->connectionMock->expects($this->once()) ->method('select') ->willReturn($this->getVisibleImagesSelectMock()); @@ -165,6 +234,54 @@ public function testGetAllProductImages( $this->assertCount($imagesCount, $imageModel->getAllProductImages()); } + /** + * @param int $imagesCount + * @param int $batchSize + * @dataProvider dataProvider + */ + public function testGetUsedProductImages(int $imagesCount, int $batchSize): void + { + $this->connectionMock->expects($this->once()) + ->method('select') + ->willReturn($this->getUsedImagesSelectMock()); + + $batchCount = (int)ceil($imagesCount / $batchSize); + $fetchResultsCallback = $this->getFetchResultCallbackForBatches($imagesCount, $batchSize); + $this->connectionMock->expects($this->exactly($batchCount)) + ->method('fetchAll') + ->will($this->returnCallback($fetchResultsCallback)); + + /** @var Select | MockObject $selectMock */ + $selectMock = $this->getMockBuilder(Select::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->generatorMock->expects($this->once()) + ->method('generate') + ->with( + 'value_id', + $selectMock, + $batchSize, + BatchIteratorInterface::NON_UNIQUE_FIELD_ITERATOR + )->will( + $this->returnCallback( + $this->getBatchIteratorCallback($selectMock, $batchCount) + ) + ); + + /** @var Image $imageModel */ + $imageModel = $this->objectManager->getObject( + Image::class, + [ + 'generator' => $this->generatorMock, + 'resourceConnection' => $this->resourceMock, + 'batchSize' => $batchSize + ] + ); + + $this->assertCount($imagesCount, $imageModel->getUsedProductImages()); + } + /** * @param int $imagesCount * @param int $batchSize diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index a4b78287df012..86b8109e74013 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -10,10 +10,10 @@ use Magento\Framework\App\Area; use Magento\Framework\App\State; use Magento\MediaStorage\Service\ImageResize; +use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Helper\ProgressBarFactory; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Helper\ProgressBar; -use Magento\Framework\ObjectManagerInterface; class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command { @@ -28,24 +28,24 @@ class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command private $appState; /** - * @var ObjectManagerInterface + * @var ProgressBarFactory */ - private $objectManager; + private $progressBarFactory; /** * @param State $appState * @param ImageResize $resize - * @param ObjectManagerInterface $objectManager + * @param ProgressBarFactory $progressBarFactory */ public function __construct( State $appState, ImageResize $resize, - ObjectManagerInterface $objectManager + ProgressBarFactory $progressBarFactory ) { parent::__construct(); $this->resize = $resize; $this->appState = $appState; - $this->objectManager = $objectManager; + $this->progressBarFactory = $progressBarFactory; } /** @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $generator = $this->resize->resizeFromThemes(); /** @var ProgressBar $progress */ - $progress = $this->objectManager->create(ProgressBar::class, [ + $progress = $this->progressBarFactory->create([ 'output' => $output, 'max' => $generator->current() ]); @@ -79,9 +79,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $progress->setOverwrite(false); } - for (; $generator->valid(); $generator->next()) { + while ($generator->valid()) { $progress->setMessage($generator->key()); $progress->advance(); + $generator->next(); } } catch (\Exception $e) { $output->writeln("<error>{$e->getMessage()}</error>"); diff --git a/app/code/Magento/MediaStorage/Service/ImageResize.php b/app/code/Magento/MediaStorage/Service/ImageResize.php index aae90512b3d95..916295cd64fc4 100644 --- a/app/code/Magento/MediaStorage/Service/ImageResize.php +++ b/app/code/Magento/MediaStorage/Service/ImageResize.php @@ -152,12 +152,12 @@ public function resizeFromImageName(string $originalImageName) */ public function resizeFromThemes(array $themes = null): \Generator { - $count = $this->productImage->getCountAllProductImages(); + $count = $this->productImage->getCountUsedProductImages(); if (!$count) { throw new NotFoundException(__('Cannot resize images - product images not found')); } - $productImages = $this->productImage->getAllProductImages(); + $productImages = $this->productImage->getUsedProductImages(); $viewImages = $this->getViewImages($themes ?? $this->getThemesInUse()); foreach ($productImages as $image) { From c9f98fcebb40bbb9ee8fd7ca6f27e63c86ecc2ab Mon Sep 17 00:00:00 2001 From: niravkrish <nirav.patel@krishtechnolabs.com> Date: Fri, 24 May 2019 15:04:27 +0530 Subject: [PATCH 209/464] Fixed - Reset feature does not clear the date --- app/code/Magento/Ui/view/base/web/js/form/form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Ui/view/base/web/js/form/form.js b/app/code/Magento/Ui/view/base/web/js/form/form.js index ea6c57f63bdf1..bf27cbbb7660f 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/form.js +++ b/app/code/Magento/Ui/view/base/web/js/form/form.js @@ -339,6 +339,7 @@ define([ */ reset: function () { this.source.trigger('data.reset'); + $('._has-datepicker').val(''); }, /** From df49b94674819eb6460d89d7b46715f567635324 Mon Sep 17 00:00:00 2001 From: Dave Macaulay <macaulay@adobe.com> Date: Fri, 24 May 2019 12:27:01 +0200 Subject: [PATCH 210/464] MC-16601: Correct fix of MAGETWO-45688 --- .../Magento/Framework/Data/Form/FormKey.php | 13 +++++++++++-- .../Framework/Data/Test/Unit/Form/FormKeyTest.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/FormKey.php b/lib/internal/Magento/Framework/Data/Form/FormKey.php index 75b3311b4ffe9..484cea1f795cc 100644 --- a/lib/internal/Magento/Framework/Data/Form/FormKey.php +++ b/lib/internal/Magento/Framework/Data/Form/FormKey.php @@ -3,9 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\Data\Form; /** + * Class FormKey + * * @api */ class FormKey @@ -50,24 +54,29 @@ public function __construct( * Retrieve Session Form Key * * @return string A 16 bit unique key for forms + * @throws \Magento\Framework\Exception\LocalizedException */ public function getFormKey() { if (!$this->isPresent()) { $this->set($this->mathRandom->getRandomString(16)); } - return $this->escaper->escapeHtmlAttr($this->session->getData(self::FORM_KEY)); + return $this->escaper->escapeJs($this->session->getData(self::FORM_KEY)); } /** + * Determine if the form key is present in the session + * * @return bool */ public function isPresent() { - return (bool)$this->session->getData(self::FORM_KEY); + return (bool) $this->session->getData(self::FORM_KEY); } /** + * Set the value of the form key + * * @param string $value * @return void */ diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php index 5d765955f3673..5f9d2eaf8ef5e 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php @@ -38,7 +38,7 @@ protected function setUp() $methods = ['setData', 'getData']; $this->sessionMock = $this->createPartialMock(\Magento\Framework\Session\SessionManager::class, $methods); $this->escaperMock = $this->createMock(\Magento\Framework\Escaper::class); - $this->escaperMock->expects($this->any())->method('escapeHtmlAttr')->willReturnArgument(0); + $this->escaperMock->expects($this->any())->method('escapeJs')->willReturnArgument(0); $this->formKey = new FormKey( $this->mathRandomMock, $this->sessionMock, From 881e92728c3b96b9afdcbc4347bc2d75a7b31778 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <svizev.igor@gmail.com> Date: Tue, 14 May 2019 12:58:12 +0300 Subject: [PATCH 211/464] magento/magento2#22882 Show exception message during SCD failure --- app/code/Magento/Deploy/Service/DeployPackage.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Deploy/Service/DeployPackage.php b/app/code/Magento/Deploy/Service/DeployPackage.php index 3b7b5b77a0793..52cb6c6075749 100644 --- a/app/code/Magento/Deploy/Service/DeployPackage.php +++ b/app/code/Magento/Deploy/Service/DeployPackage.php @@ -107,6 +107,8 @@ function () use ($package, $options, $skipLogging) { } /** + * Execute package deploy procedure when area already emulated + * * @param Package $package * @param array $options * @param bool $skipLogging @@ -136,7 +138,9 @@ public function deployEmulated(Package $package, array $options, $skipLogging = $this->errorsCount++; $this->logger->critical($errorMessage); } catch (\Exception $exception) { - $this->logger->critical($exception->getTraceAsString()); + $this->logger->critical( + 'Compilation from source ' . $file->getSourcePath() . ' failed' . PHP_EOL . (string)$exception + ); $this->errorsCount++; } } @@ -219,7 +223,9 @@ private function checkIfCanCopy(PackageFile $file, Package $package, Package $pa private function checkFileSkip($filePath, array $options) { if ($filePath !== '.') { + // phpcs:ignore Magento2.Functions.DiscouragedFunction $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $basename = pathinfo($filePath, PATHINFO_BASENAME); if ($ext === 'less' && strpos($basename, '_') === 0) { return true; From cc671eb82568e293bf801f2bc07c4413a3e5ceaa Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 24 May 2019 10:00:23 -0500 Subject: [PATCH 212/464] MAGETWO-99769: SKU search weight is ignored --- .../Search/AttributeSearchWeightTest.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index 1880fd3e7d414..0f30ae592afd4 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -13,6 +13,7 @@ use Magento\Elasticsearch\SearchAdapter\ConnectionManager; use Magento\Elasticsearch6\Model\Client\Elasticsearch as ElasticsearchClient; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Exception\StateException; use Magento\Framework\Search\Request\Builder; use Magento\Framework\Search\Request\Config as RequestConfig; use Magento\Framework\Search\Response\QueryResponse; @@ -58,6 +59,12 @@ protected function setUp() $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); } + /** + * @param string $attributeName + * @param int $searchWeight + * @throws NoSuchEntityException + * @throws StateException + */ private function setAttributeSearchWeight(string $attributeName, int $searchWeight) { /** @var AttributeRepositoryInterface $attributeRepository */ @@ -119,20 +126,20 @@ private function findProducts(string $query): array * @magentoConfigFixture default/catalog/search/engine elasticsearch6 * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search * @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php - * @param $searchQuery - * @param $skuSearchWeight - * @param $nameSearchWeight - * @param $firstMatchProductName - * @param $secondMatchProductName + * @param string $searchQuery + * @param int $skuSearchWeight + * @param int $nameSearchWeight + * @param string $firstMatchProductName + * @param string $secondMatchProductName * @throws NoSuchEntityException * @throws \Throwable */ public function testSkuOverNameAttributeSearchWeight( - $searchQuery, - $skuSearchWeight, - $nameSearchWeight, - $firstMatchProductName, - $secondMatchProductName + string $searchQuery, + int $skuSearchWeight, + int $nameSearchWeight, + string $firstMatchProductName, + string $secondMatchProductName ) { $this->setAttributeSearchWeight('sku', $skuSearchWeight); $this->setAttributeSearchWeight('name', $nameSearchWeight); @@ -159,7 +166,7 @@ public function testSkuOverNameAttributeSearchWeight( ); } - public function skuOverNameAttributeSearchWeightDataProvider() + public function skuOverNameAttributeSearchWeightDataProvider(): array { return [ ['1-2-3-4', 10, 5, 'test', '1-2-3-4'], From 9e6b10f97b39896c03c06eb30387f92e2630b0f2 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 24 May 2019 10:08:20 -0500 Subject: [PATCH 213/464] MAGETWO-99769: SKU search weight is ignored --- .../CatalogSearch/Model/Search/AttributeSearchWeightTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index 0f30ae592afd4..d2d5c70642533 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\CatalogSearch\Model\Search; use Magento\Catalog\Api\ProductRepositoryInterface; From db5c732fc153dc2be0af93cdef43b712a002a21f Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 24 May 2019 10:48:06 -0500 Subject: [PATCH 214/464] MAGETWO-99769: SKU search weight is ignored --- .../CatalogSearch/Model/Search/AttributeSearchWeightTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php index d2d5c70642533..775210669abd8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php @@ -29,6 +29,7 @@ /** * Test for name over sku search weight of product attributes * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @magentoAppIsolation enabled * @magentoDbIsolation enabled */ From f3909aa15bcd6d4a44d3bc338268683e3ca574d7 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Fri, 24 May 2019 12:30:03 -0500 Subject: [PATCH 215/464] MC-16611: Fix Unrelated Static Test Failures - fix bugs --- .../adminhtml/templates/backup/dialogs.phtml | 81 +++++-------------- .../system/config/form/field/array.phtml | 20 ++--- 2 files changed, 32 insertions(+), 69 deletions(-) diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml index 205465b8368ec..31051b6353133 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml @@ -22,48 +22,33 @@ <form action="" method="post" id="backup-form" class="form-inline"> <fieldset class="admin__fieldset form-list question"> <div class="admin__field field _required"> - <label for="backup_name" class="admin__field-label"><span> - <?= $block->escapeHtml(__('Backup Name')) ?> - </span></label> + <label for="backup_name" class="admin__field-label"><span><?= $block->escapeHtml(__('Backup Name')) ?></span></label> <div class="admin__field-control"> <input type="text" name="backup_name" id="backup_name" - class="admin__control-text required-entry validate-alphanum-with-spaces - validate-length maximum-length-50" + class="admin__control-text required-entry validate-alphanum-with-spaces validate-length maximum-length-50" maxlength="50" /> <div class="admin__field-note"> - <?= $block->escapeHtml(__('Please use only letters (a-z or A-Z), numbers (0-9) or spaces ' - . 'in this field.')) ?> + <?= $block->escapeHtml(__('Please use only letters (a-z or A-Z), numbers (0-9) or spaces in this field.')) ?> </div> </div> </div> <div class="admin__field field maintenance-checkbox-container"> - <label for="backup_maintenance_mode" class="admin__field-label"><span> - <?= $block->escapeHtml(__('Maintenance mode')) ?> - </span></label> + <label for="backup_maintenance_mode" class="admin__field-label"><span><?= $block->escapeHtml(__('Maintenance mode')) ?></span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" - value="1" id="backup_maintenance_mode"/> - <label class="admin__field-label" for="backup_maintenance_mode"> - <?= $block->escapeHtml(__('Please put your store into maintenance mode during backup.')) ?> - </label> + <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" id="backup_maintenance_mode"/> + <label class="admin__field-label" for="backup_maintenance_mode"><?= $block->escapeHtml(__('Please put your store into maintenance mode during backup.')) ?></label> </div> </div> </div> - <div class="admin__field field maintenance-checkbox-container" id="exclude-media-checkbox-container" - style="display: none;"> - <label for="exclude_media" class="admin__field-label"><span> - <?= $block->escapeHtml(__('Exclude')) ?> - </span></label> + <div class="admin__field field maintenance-checkbox-container" id="exclude-media-checkbox-container" style="display: none;"> + <label for="exclude_media" class="admin__field-label"><span><?= $block->escapeHtml(__('Exclude')) ?></span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="exclude_media" value="1" - id="exclude_media"/> - <label class="admin__field-label" for="exclude_media"> - <?= $block->escapeHtml(__('Exclude media folder from backup')) ?> - </label> + <input class="admin__control-checkbox" type="checkbox" name="exclude_media" value="1" id="exclude_media"/> + <label class="admin__field-label" for="exclude_media"><?= $block->escapeHtml(__('Exclude media folder from backup')) ?></label> </div> </div> </div> @@ -85,65 +70,44 @@ <form action="" method="post" id="rollback-form" class="form-inline"> <fieldset class="admin__fieldset password-box-container"> <div class="admin__field field _required"> - <label for="password" class="admin__field-label"><span> - <?= $block->escapeHtml(__('User Password')) ?> - </span></label> - <div class="admin__field-control"> - <input type="password" name="password" id="password" class="admin__control-text required-entry" - autocomplete="new-password"> - </div> + <label for="password" class="admin__field-label"><span><?= $block->escapeHtml(__('User Password')) ?></span></label> + <div class="admin__field-control"><input type="password" name="password" id="password" class="admin__control-text required-entry" autocomplete="new-password"></div> </div> <div class="admin__field field maintenance-checkbox-container"> - <label for="rollback_maintenance_mode" class="admin__field-label"><span> - <?= $block->escapeHtml(__('Maintenance mode')) ?> - </span></label> + <label for="rollback_maintenance_mode" class="admin__field-label"><span><?= $block->escapeHtml(__('Maintenance mode')) ?></span></label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" - id="rollback_maintenance_mode"/> - <label class="admin__field-label" for="rollback_maintenance_mode"> - <?= $block->escapeHtml(__('Please put your store into maintenance mode during rollback ' - . 'processing.')) ?> - </label> + <input class="admin__control-checkbox" type="checkbox" name="maintenance_mode" value="1" id="rollback_maintenance_mode"/> + <label class="admin__field-label" for="rollback_maintenance_mode"><?= $block->escapeHtml(__('Please put your store into maintenance mode during rollback processing.')) ?></label> </div> </div> </div> - <div class="admin__field field maintenance-checkbox-container" id="use-ftp-checkbox-row" - style="display: none;"> + <div class="admin__field field maintenance-checkbox-container" id="use-ftp-checkbox-row" style="display: none;"> <label for="use_ftp" class="admin__field-label"> <span><?= $block->escapeHtml(__('FTP')) ?></span> </label> <div class="admin__field-control"> <div class="admin__field-option"> - <input class="admin__control-checkbox" type="checkbox" name="use_ftp" value="1" id="use_ftp" - onclick="backup.toggleFtpCredentialsForm(event)"/> - <label class="admin__field-label" for="use_ftp"> - <?= $block->escapeHtml(__('Use FTP Connection')) ?> - </label> + <input class="admin__control-checkbox" type="checkbox" name="use_ftp" value="1" id="use_ftp" onclick="backup.toggleFtpCredentialsForm(event)"/> + <label class="admin__field-label" for="use_ftp"><?= $block->escapeHtml(__('Use FTP Connection')) ?></label> </div> </div> </div> </fieldset> <div class="entry-edit" id="ftp-credentials-container" style="display: none;"> <fieldset class="admin__fieldset"> - <legend class="admin__legend legend"><span> - <?= $block->escapeHtml(__('FTP credentials')) ?> - </span></legend><br /> + <legend class="admin__legend legend"><span><?= $block->escapeHtml(__('FTP credentials')) ?></span></legend><br /> <div class="admin__field field _required"> - <label class="admin__field-label" for="ftp_host"><span> - <?= $block->escapeHtml(__('FTP Host')) ?> - </span></label> + <label class="admin__field-label" for="ftp_host"><span><?= $block->escapeHtml(__('FTP Host')) ?></span></label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_host" id="ftp_host"> </div> </div> <div class="admin__field field _required"> - <label class="admin__field-label" for="ftp_user"><span> - <?= $block->escapeHtml(__('FTP Login')) ?> - </span></label> + <label class="admin__field-label" for="ftp_user"><span><?= $block->escapeHtml(__('FTP Login')) ?></span></label> <div class="admin__field-control"> <input type="text" class="admin__control-text" name="ftp_user" id="ftp_user"> </div> @@ -153,8 +117,7 @@ <span><?= $block->escapeHtml(__('FTP Password')) ?></span> </label> <div class="admin__field-control"> - <input type="password" class="admin__control-text" name="ftp_pass" id="ftp_pass" - autocomplete="new-password"> + <input type="password" class="admin__control-text" name="ftp_pass" id="ftp_pass" autocomplete="new-password"> </div> </div> <div class="admin__field field"> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index b0e983e7c8003..83d9605264751 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -42,14 +42,14 @@ $_colspan = $block->isAddAfter() ? 2 : 1; 'prototype' ], function (mageTemplate) { // create row creator - window.arrayRow<?= $block->escapeHtml($_htmlId) ?> = { + window.arrayRow<?= $block->escapeJs($_htmlId) ?> = { // define row prototypeJS template template: mageTemplate( '<tr id="<%- _id %>">' <?php foreach ($block->getColumns() as $columnName => $column) : ?> + '<td>' - + '<?= $block->escapeHtml($block->renderCellTemplate($columnName)) ?>' + + '<?= $block->escapeJs($block->renderCellTemplate($columnName)) ?>' + '<\/td>' <?php endforeach; ?> @@ -60,7 +60,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; <?php endif; ?> + '<td class="col-actions"><button ' - + 'onclick="arrayRow<?= $block->escapeHtml($_htmlId) ?>.del(\'<%- _id %>\')" ' + + 'onclick="arrayRow<?= $block->escapeJs($_htmlId) ?>.del(\'<%- _id %>\')" ' + 'class="action-delete" type="button">' + '<span><?= $block->escapeHtml(__('Delete')) ?><\/span><\/button><\/td>' + '<\/tr>' @@ -77,7 +77,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; var d = new Date(); templateValues = { <?php foreach ($block->getColumns() as $columnName => $column) : ?> - <?= $block->escapeHtml($columnName) ?>: '', + <?= $block->escapeJs($columnName) ?>: '', 'option_extra_attrs': {}, <?php endforeach; ?> _id: '_' + d.getTime() + '_' + d.getMilliseconds() @@ -88,7 +88,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; if (insertAfterId) { Element.insert($(insertAfterId), {after: this.template(templateValues)}); } else { - Element.insert($('addRow<?= $block->escapeHtml($_htmlId) ?>'), {bottom: this.template(templateValues)}); + Element.insert($('addRow<?= $block->escapeJs($_htmlId) ?>'), {bottom: this.template(templateValues)}); } // Fill controls with data @@ -113,23 +113,23 @@ $_colspan = $block->isAddAfter() ? 2 : 1; } // bind add action to "Add" button in last row - Event.observe('addToEndBtn<?= $block->escapeHtml($_htmlId) ?>', + Event.observe('addToEndBtn<?= $block->escapeJs($_htmlId) ?>', 'click', - arrayRow<?= $block->escapeHtml($_htmlId) ?>.add.bind( - arrayRow<?= $block->escapeHtml($_htmlId) ?>, false, false + arrayRow<?= $block->escapeJs($_htmlId) ?>.add.bind( + arrayRow<?= $block->escapeJs($_htmlId) ?>, false, false ) ); // add existing rows <?php foreach ($block->getArrayRows() as $_rowId => $_row) { - echo $block->escapeHtml("arrayRow{$_htmlId}.add(" . $_row->toJson() . ");\n"); + echo "arrayRow{$block->escapeJs($_htmlId)}.add(" . $_row->toJson() . ");\n"; } ?> // Toggle the grid availability, if element is disabled (depending on scope) <?php if ($block->getElement()->getDisabled()) : ?> - toggleValueElements({checked: true}, $('grid<?= $block->escapeHtml($_htmlId) ?>').parentNode); + toggleValueElements({checked: true}, $('grid<?= $block->escapeJs($_htmlId) ?>').parentNode); <?php endif; ?> }); </script> From 23f4c34eedaabbbca57a3b1c9136de58e6506a0c Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 24 May 2019 14:24:45 -0500 Subject: [PATCH 216/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Block/Adminhtml/Edit/Tab/OrdersTest.php | 12 +++++++++++- .../Block/Adminhtml/Edit/Tab/View/CartTest.php | 14 ++++++++++++-- .../User/Controller/Adminhtml/Locks/GridTest.php | 11 ++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php index 2e997a153d3af..ba4b6b6d80de0 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/OrdersTest.php @@ -6,6 +6,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab; use Magento\Customer\Controller\RegistryConstants; +use Magento\Framework\Escaper; use Magento\TestFramework\Helper\Bootstrap; /** @@ -29,6 +30,11 @@ class OrdersTest extends \PHPUnit\Framework\TestCase */ private $coreRegistry; + /** + * @var Escaper + */ + private $escaper; + /** * Execute per test initialization. */ @@ -48,6 +54,7 @@ public function setUp() ['coreRegistry' => $this->coreRegistry] ); $this->block->getPreparedCollection(); + $this->escaper = $objectManager->get(Escaper::class); } /** @@ -81,6 +88,9 @@ public function testGetGridUrl() */ public function testToHtml() { - $this->assertContains("We couldn't find any records.", $this->block->toHtml()); + $this->assertContains( + $this->escaper->escapeHtml("We couldn't find any records."), + $this->block->toHtml() + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php index 3ade17d90fe99..41391d7900456 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/CartTest.php @@ -7,6 +7,7 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; use Magento\Customer\Controller\RegistryConstants; +use Magento\Framework\Escaper; use Magento\TestFramework\Helper\Bootstrap; /** @@ -30,6 +31,11 @@ class CartTest extends \PHPUnit\Framework\TestCase */ private $coreRegistry; + /** + * @var Escaper + */ + private $escaper; + /** * Execute per test initialization. */ @@ -49,6 +55,7 @@ public function setUp() ['coreRegistry' => $this->coreRegistry, 'data' => ['website_id' => 1]] ); $this->block->getPreparedCollection(); + $this->escaper = $objectManager->get(Escaper::class); } /** @@ -84,7 +91,10 @@ public function testGetHeadersVisibility() public function testToHtmlEmptyCart() { $this->assertEquals(0, $this->block->getCollection()->getSize()); - $this->assertContains('There are no items in customer\'s shopping cart.', $this->block->toHtml()); + $this->assertContains( + $this->escaper->escapeHtml('There are no items in customer\'s shopping cart.'), + $this->block->toHtml() + ); } /** @@ -99,6 +109,6 @@ public function testToHtmlCartItem() $this->assertContains('Simple Product', $html); $this->assertContains('simple', $html); $this->assertContains('$10.00', $html); - $this->assertContains('catalog/product/edit/id/1', $html); + $this->assertContains($this->escaper->escapeHtmlAttr('catalog/product/edit/id/1'), $html); } } diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/GridTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/GridTest.php index 4a1c8c722b18d..69265f33b305a 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/GridTest.php @@ -5,7 +5,12 @@ */ namespace Magento\User\Controller\Adminhtml\Locks; -class GridTest extends \Magento\TestFramework\TestCase\AbstractBackendController +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Testing the list of locked users. + */ +class GridTest extends AbstractBackendController { /** * Test index action @@ -24,11 +29,11 @@ public function testGridAction() $this->assertContains('data-column="failures_num"', $body); $this->assertContains('data-column="lock_expires"', $body); $this->assertRegExp( - '/<td data-column\="username"\s*class\="\s*col-name\s*col-username\s*"\s*>\s*adminUser1\s*<\/td>/', + '/<td data-column\="username"\s*class\="[^"]*col-name[^"]*col-username[^"]*"\s*>\s*adminUser1\s*<\/td>/', $body ); $this->assertRegExp( - '/<td data-column\="username"\s*class\="\s*col-name\s*col-username\s*"\s*>\s*adminUser2\s*<\/td>/', + '/<td data-column\="username"\s*class\="[^"]*col-name[^"]*col-username[^"]*"\s*>\s*adminUser2\s*<\/td>/', $body ); } From 593088a2bf63357e8e5dfdf41e1b5acb58559d8d Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Fri, 24 May 2019 14:26:09 -0500 Subject: [PATCH 217/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Magento/User/Controller/Adminhtml/Locks/IndexTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php index c43bd1ef3f7f8..f2f8d2d124b07 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php @@ -20,11 +20,11 @@ public function testIndexAction() $body = $this->getResponse()->getBody(); $this->assertContains('<h1 class="page-title">Locked Users</h1>', $body); $this->assertRegExp( - '/<td data-column\="username"\s*class\="\s*col-name\s*col-username\s*"\s*>\s*adminUser1\s*<\/td>/', + '/<td data-column\="username"\s*class\="[^"]*col-name[^"]*col-username[^"]*"\s*>\s*adminUser1\s*<\/td>/', $body ); $this->assertRegExp( - '/<td data-column\="username"\s*class\="\s*col-name\s*col-username\s*"\s*>\s*adminUser2\s*<\/td>/', + '/<td data-column\="username"\s*class\="[^"]*col-name[^"]*col-username\s*"[^"]*>\s*adminUser2\s*<\/td>/', $body ); } From 1a37d283962902bc31f508f36bf20435c8a65d9f Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Fri, 24 May 2019 16:46:30 -0500 Subject: [PATCH 218/464] MC-11146: Product Categories Indexer in Update on Schedule mode --- ...ignCategoryToProductAndSaveActionGroup.xml | 24 ++ ...ignCategoryOnProductAndSaveActionGroup.xml | 22 ++ .../StorefrontGoToCategoryPageActionGroup.xml | 27 ++ ...egoryIndexerInUpdateOnScheduleModeTest.xml | 314 ++++++++++++++++++ ...witchAllIndexerToActionModeActionGroup.xml | 23 ++ ...inSwitchIndexerToActionModeActionGroup.xml | 22 ++ .../Section/AdminIndexManagementSection.xml | 1 + 7 files changed, 433 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml new file mode 100644 index 0000000000000..0cb7c4885ac77 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssignCategoryToProductAndSaveActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!-- on edit Product page catalog/product/edit/id/{{product_id}}/ --> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> + <checkOption selector="{{AdminProductFormSection.selectCategory(categoryName)}}" stepKey="selectCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForApplyCategory"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml new file mode 100644 index 0000000000000..35816f3cd6750 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUnassignCategoryOnProductAndSaveActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!-- on edit Product page catalog/product/edit/id/{{product_id}}/ --> + <click selector="{{AdminProductFormSection.unselectCategories(categoryName)}}" stepKey="clearCategory"/> + <waitForPageLoad stepKey="waitForDelete"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..e8be0db38fe2c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoToCategoryPageActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> + <waitForPageLoad stepKey="waitForCategoryPage"/> + </actionGroup> + <actionGroup name="StorefrontGoToSubCategoryPageActionGroup" extends="StorefrontGoToCategoryPageActionGroup"> + <arguments> + <argument name="subCategoryName" type="string"/> + </arguments> + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategoryName)}}" stepKey="openSubCategory" after="toCategory"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml new file mode 100644 index 0000000000000..98ae29ae79d40 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml @@ -0,0 +1,314 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminProductCategoryIndexerInUpdateOnScheduleModeTest"> + <annotations> + <stories value="Product Categories Indexer"/> + <title value="Product Categories Indexer in Update on Schedule mode"/> + <description value="The test verifies that in Update on Schedule mode if displaying of category products on Storefront changes due to product properties change, + the changes are NOT applied immediately, but applied only after cron runs (twice)."/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11146"/> + <group value="catalog"/> + <group value="indexer"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <!-- Create category A without products --> + <createData entity="_defaultCategory" stepKey="createCategoryA"/> + + <!-- Create product A1 not assigned to any category --> + <createData entity="simpleProductWithoutCategory" stepKey="createProductA1"/> + + <!-- Create anchor category B with subcategory C--> + <createData entity="_defaultCategory" stepKey="createCategoryB"/> + <createData entity="SubCategoryWithParent" stepKey="createCategoryC"> + <requiredEntity createDataKey="createCategoryB"/> + </createData> + + <!-- Assign product B1 to category B --> + <createData entity="ApiSimpleProduct" stepKey="createProductB1"> + <requiredEntity createDataKey="createCategoryB"/> + </createData> + + <!-- Assign product C1 to category C --> + <createData entity="ApiSimpleProduct" stepKey="createProductC1"> + <requiredEntity createDataKey="createCategoryC"/> + </createData> + + <!-- Assign product C2 to category C --> + <createData entity="ApiSimpleProduct" stepKey="createProductC2"> + <requiredEntity createDataKey="createCategoryC"/> + </createData> + + <!-- Switch indexers to "Update by Schedule" mode --> + <actionGroup ref="AdminSwitchAllIndexerToActionModeActionGroup" stepKey="onUpdateBySchedule"> + <argument name="action" value="Update by Schedule"/> + </actionGroup> + </before> + <after> + <!-- Switch indexers to "Update on Save" mode --> + <actionGroup ref="AdminSwitchAllIndexerToActionModeActionGroup" stepKey="onUpdateOnSave"> + <argument name="action" value="Update on Save"/> + </actionGroup> + <!-- Delete data --> + <deleteData createDataKey="createProductA1" stepKey="deleteProductA1"/> + <deleteData createDataKey="createProductB1" stepKey="deleteProductB1"/> + <deleteData createDataKey="createProductC1" stepKey="deleteProductC1"/> + <deleteData createDataKey="createProductC2" stepKey="deleteProductC2"/> + <deleteData createDataKey="createCategoryA" stepKey="deleteCategoryA"/> + <deleteData createDataKey="createCategoryC" stepKey="deleteCategoryC"/> + <deleteData createDataKey="createCategoryB" stepKey="deleteCategoryB"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Case: change product category from product page --> + <!-- 1. Open Admin > Catalog > Products > Product A1 --> + <amOnPage url="{{AdminProductEditPage.url($$createProductA1.id$$)}}" stepKey="goToProductA1"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- 2. Assign category A to product A1. Save product --> + <actionGroup ref="AdminAssignCategoryToProductAndSaveActionGroup" stepKey="assignProduct"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- 3. Open category A on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goToCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- The category is still empty --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryA1Name"/> + <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> + <dontSee userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProductA1"/> + + <!-- 4. Run cron to reindex --> + <wait time="30" stepKey="waitForChanges"/> + <magentoCLI command="cron:run" stepKey="runCron"/> + + <!-- 5. Open category A on Storefront again --> + <reloadPage stepKey="reloadCategoryA"/> + + <!-- Category A displays product A1 now --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryA1"/> + <see userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductA1"/> + + <!--6. Open Admin > Catalog > Products > Product A1. Unassign category A from product A1 --> + <amOnPage url="{{AdminProductEditPage.url($$createProductA1.id$$)}}" stepKey="OnPageProductA1"/> + <waitForPageLoad stepKey="waitForProductA1PageLoad"/> + <actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unassignCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- 7. Open category A on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- Category A still contains product A1 --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryAOnPage"/> + <see userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductA1"/> + + <!-- 8. Run cron reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="30" stepKey="waitOneMinute"/> + <magentoCLI command="cron:run" stepKey="runCron1"/> + + <!-- 9. Open category A on Storefront again --> + <reloadPage stepKey="refreshCategoryAPage"/> + + <!-- Category A is empty now --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeOnPageCategoryAName"/> + <see userInput="We can't find products matching the selection." stepKey="seeOnPageEmptyNotice"/> + <dontSee userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProductA1OnPage"/> + + <!-- Case: change product status --> + <!-- 10. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1, C1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductC2"/> + + <!-- 11. Open product C1 in Admin. Make it disabled (Enable Product = No)--> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="goToProductC1"/> + <waitForPageLoad stepKey="waitForProductC1PageLoad"/> + <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOffEnableToggleAgain"/> + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="saveProductC1"/> + + <!-- 12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryBStorefront"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1, C1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="categoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC2"/> + + <!-- 13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="goToCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C still displays products C1 and C2 --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="categoryCOnPage"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC1inCategoryC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC2InCategoryC2"/> + + <!-- 14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="30" stepKey="waitMinute"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + + <!-- 15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="onPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 only--> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryBPageProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryBPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryBPageProductC2"/> + + <!-- 16. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays only product C2 now --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleOnCategoryCPage"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryCPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCPageProductC2"/> + + <!-- 17. Repeat steps 10-16, but enable products instead. --> + <!-- 17.11 Open product C1 in Admin. Make it enabled --> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="goToEditProductC1"/> + <waitForPageLoad stepKey="waitForProductC1Page"/> + <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOnEnableToggleAgain"/> + + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="saveChangedProductC1"/> + + <!-- 17.12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="titleCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBPageProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeCategoryBPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBPageProductC2"/> + + <!-- 17.13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openToCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays product C2 --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="titleOnCategoryCPage"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeCategoryCPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryCPageProductC2"/> + + <!-- 17.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="30" stepKey="waitForOneMinute"/> + <magentoCLI command="cron:run" stepKey="runCron3"/> + + <!-- 17.15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays products B1, C1, C2 again, but only after reindex. --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="onPageSeeCategoryBTitle"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductC2"/> + + <!-- 17.16. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openOnStorefrontCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays products C1, C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="onPageSeeCategoryCTitle"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryCProductC2"/> + + <!-- Case: change product visibility --> + <!-- 18. Repeat steps 10-17 but change product Visibility instead of product status --> + <!-- 18.11 Open product C1 in Admin. Make it enabled --> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="editProductC1"/> + <waitForPageLoad stepKey="waitProductC1Page"/> + <selectOption selector="{{AdminProductFormBundleSection.visibilityDropDown}}" userInput="Search" + stepKey="changeVisibility"/> + + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="productC1Saved"/> + + <!-- 18.12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays products B1, C1, C2 again, but only after reindex. --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryBTitle"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductC2"/> + + <!-- 18.13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="goPageCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays products C1, C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryCTitle"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCProductC2"/> + + <!-- 18.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="30" stepKey="waitExtraMinute"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> + + <!-- 18.15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="navigateToPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 only--> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryB"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeTitleProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeTitleProductC2"/> + + <!-- 18.18. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="navigateToPageCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays product C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryC"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnPageTitleProductC2"/> + </test> +</tests> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml new file mode 100644 index 0000000000000..a8aa089a389e6 --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSwitchAllIndexerToActionModeActionGroup"> + <arguments> + <argument name="action" type="string" defaultValue="Update by Schedule"/> + </arguments> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> + <waitForPageLoad stepKey="waitForManagementPage"/> + <selectOption userInput="selectAll" selector="{{AdminIndexManagementSection.selectMassAction}}" stepKey="checkIndexer"/> + <selectOption userInput="{{action}}" selector="{{AdminIndexManagementSection.massActionSelect}}" stepKey="selectAction"/> + <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForSubmit"/> + <see userInput="indexer(s) are in "{{action}}" mode." stepKey="seeMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml new file mode 100644 index 0000000000000..7b77af08614cf --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSwitchIndexerToActionModeActionGroup"> + <arguments> + <argument name="indexerValue" type="string"/> + <argument name="action" type="string" defaultValue="Update by Schedule"/> + </arguments> + <checkOption selector="{{AdminIndexManagementSection.indexerCheckbox(indexerValue)}}" stepKey="checkIndexer"/> + <selectOption userInput="{{action}}" selector="{{AdminIndexManagementSection.massActionSelect}}" stepKey="selectAction"/> + <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForSubmit"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="1 indexer(s) are in "{{action}}" mode." stepKey="seeMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index 860b600de2b53..8e7df86d01329 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -16,5 +16,6 @@ <element name="indexerSelect" type="select" selector="//select[contains(@class,'action-select-multiselect')]"/> <element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/> <element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/> + <element name="selectMassAction" type="select" selector="#gridIndexer_massaction-mass-select"/> </section> </sections> From 201c8e0c9b1c88a9092f78133fe48603f7f1e23e Mon Sep 17 00:00:00 2001 From: Timon de Groot <timon@marissen.net> Date: Mon, 27 May 2019 09:09:14 +0200 Subject: [PATCH 219/464] Fix backward incompatible changes --- .../Console/Command/ImagesResizeCommand.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index 86b8109e74013..21404080fc380 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -8,6 +8,7 @@ namespace Magento\MediaStorage\Console\Command; use Magento\Framework\App\Area; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\State; use Magento\MediaStorage\Service\ImageResize; use Symfony\Component\Console\Helper\ProgressBar; @@ -36,16 +37,19 @@ class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command * @param State $appState * @param ImageResize $resize * @param ProgressBarFactory $progressBarFactory + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( State $appState, ImageResize $resize, - ProgressBarFactory $progressBarFactory + $objectManager = null, + ProgressBarFactory $progressBarFactory = null ) { parent::__construct(); $this->resize = $resize; $this->appState = $appState; - $this->progressBarFactory = $progressBarFactory; + $this->progressBarFactory = $progressBarFactory + ?: ObjectManager::getInstance()->get(ProgressBarFactory::class); } /** @@ -92,5 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->write(PHP_EOL); $output->writeln("<info>Product images resized successfully</info>"); + + return \Magento\Framework\Console\Cli::RETURN_SUCCESS; } } From ee092596d422d45bc5967e2e0274c99ce5a2b808 Mon Sep 17 00:00:00 2001 From: Timon de Groot <timon@marissen.net> Date: Mon, 27 May 2019 09:29:14 +0200 Subject: [PATCH 220/464] Fix coding style errors --- .../Model/ResourceModel/Product/ImageTest.php | 4 ++++ .../Console/Command/ImagesResizeCommand.php | 21 +++++++++++++------ .../MediaStorage/Service/ImageResize.php | 10 +++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php index a5bc118d7acb6..af2cb6f06ed5a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/ImageTest.php @@ -16,6 +16,10 @@ use PHPUnit_Framework_MockObject_MockObject as MockObject; use Magento\Framework\DB\Query\BatchIteratorInterface; +/** + * Class ImageTest + * @package Magento\Catalog\Test\Unit\Model\ResourceModel\Product + */ class ImageTest extends \PHPUnit\Framework\TestCase { /** diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index 21404080fc380..fb3b4d48e285c 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -16,6 +16,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * Resizes product images according to theme view definitions. + * + * @package Magento\MediaStorage\Console\Command + */ class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command { /** @@ -53,7 +58,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function configure() { @@ -62,7 +67,9 @@ protected function configure() } /** - * {@inheritdoc} + * @inheritdoc + * @param InputInterface $input + * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -71,10 +78,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $generator = $this->resize->resizeFromThemes(); /** @var ProgressBar $progress */ - $progress = $this->progressBarFactory->create([ - 'output' => $output, - 'max' => $generator->current() - ]); + $progress = $this->progressBarFactory->create( + [ + 'output' => $output, + 'max' => $generator->current() + ] + ); $progress->setFormat( "%current%/%max% [%bar%] %percent:3s%% %elapsed% %memory:6s% \t| <info>%message%</info>" ); diff --git a/app/code/Magento/MediaStorage/Service/ImageResize.php b/app/code/Magento/MediaStorage/Service/ImageResize.php index 916295cd64fc4..49501c3b91bb5 100644 --- a/app/code/Magento/MediaStorage/Service/ImageResize.php +++ b/app/code/Magento/MediaStorage/Service/ImageResize.php @@ -202,10 +202,12 @@ private function getViewImages(array $themes): array $viewImages = []; /** @var \Magento\Theme\Model\Theme $theme */ foreach ($themes as $theme) { - $config = $this->viewConfig->getViewConfig([ - 'area' => Area::AREA_FRONTEND, - 'themeModel' => $theme, - ]); + $config = $this->viewConfig->getViewConfig( + [ + 'area' => Area::AREA_FRONTEND, + 'themeModel' => $theme, + ] + ); $images = $config->getMediaEntities('Magento_Catalog', ImageHelper::MEDIA_TYPE_CONFIG_NODE); foreach ($images as $imageId => $imageData) { $uniqIndex = $this->getUniqueImageIndex($imageData); From 31ffdad26891122fa0f16c98d1bf1bb313a7930c Mon Sep 17 00:00:00 2001 From: Vinai Kopp <vinai@netzarbeiter.com> Date: Mon, 20 May 2019 19:09:11 +0200 Subject: [PATCH 221/464] Fix typo: resolve() -> resolver() --- app/code/Magento/CatalogGraphQl/etc/schema.graphqls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index 27df5eccf323c..f4d0990b17049 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -118,7 +118,7 @@ type CustomizableAreaValue @doc(description: "CustomizableAreaValue defines the } type CategoryTree implements CategoryInterface @doc(description: "Category Tree implementation.") { - children: [CategoryTree] @doc(description: "Child categories tree.") @resolve(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\CategoryTree") + children: [CategoryTree] @doc(description: "Child categories tree.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\CategoryTree") } type CustomizableDateOption implements CustomizableOptionInterface @doc(description: "CustomizableDateOption contains information about a date picker that is defined as part of a customizable option.") { From e6242c13c6ec86b4215b59788e9b77d1496db3ec Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <veronika_kurochkina@epam.com> Date: Mon, 27 May 2019 14:29:46 +0300 Subject: [PATCH 222/464] MAGETWO-80120: Magento\Framework\App\Test\Unit\BootstrapTest reset error handler to \Exception - Fix static --- .../Framework/Unserialize/Test/Unit/UnserializeTest.php | 3 +++ .../Framework/View/Test/Unit/TemplateEngine/PhpTest.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php index 11254c58f1fa4..34b41bff4fcab 100644 --- a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php +++ b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php @@ -8,6 +8,9 @@ use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\Unserialize\Unserialize; +/** + * Test class for Magento/Framework/Unserialize/Unserialize. + */ class UnserializeTest extends \PHPUnit\Framework\TestCase { /** diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php index 5a29dae100d9e..e9da71d9118f7 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\View\Test\Unit\TemplateEngine; +/** + * Class PhpTest. + */ class PhpTest extends \PHPUnit\Framework\TestCase { const TEST_PROP_VALUE = 'TEST_PROP_VALUE'; From ec3c34036331479561a7bfec419a6c35eb802158 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <d.cheshun@atwix.com> Date: Mon, 27 May 2019 16:17:57 +0300 Subject: [PATCH 223/464] Fix static test --- .../MediaStorage/Console/Command/ImagesResizeCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index fb3b4d48e285c..51eba1facb90c 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Area; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\State; +use Magento\Framework\ObjectManagerInterface; use Magento\MediaStorage\Service\ImageResize; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Helper\ProgressBarFactory; @@ -41,13 +42,14 @@ class ImagesResizeCommand extends \Symfony\Component\Console\Command\Command /** * @param State $appState * @param ImageResize $resize + * @param ObjectManagerInterface $objectManager * @param ProgressBarFactory $progressBarFactory * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( State $appState, ImageResize $resize, - $objectManager = null, + ObjectManagerInterface $objectManager, ProgressBarFactory $progressBarFactory = null ) { parent::__construct(); From a50d6292f90b1a4e27ef9fae2a769bee010ee6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Schr=C3=B6er?= <code@schroeer.me> Date: Mon, 27 May 2019 16:42:49 +0200 Subject: [PATCH 224/464] Re-enable XML as request and response types within the SwaggerUI --- .../Webapi/Model/Rest/Swagger/Generator.php | 40 +++++++++++++++++++ .../Unit/Model/Rest/Swagger/GeneratorTest.php | 4 +- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index 855f455120d89..14b65bb640242 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -41,6 +41,11 @@ class Generator extends AbstractSchemaGenerator /** Array signifier */ const ARRAY_SIGNIFIER = '[0]'; + /** + * Wrapper node for XML requests + */ + const XML_SCHEMA_PARAMWRAPPER = 'request'; + /** * Swagger factory instance. * @@ -193,6 +198,28 @@ protected function getGeneralInfo() ]; } + /** + * @return string[] + */ + protected function getConsumableDatatypes() + { + return [ + 'application/json', + 'application/xml', + ]; + } + + /** + * @return string[] + */ + protected function getProducibleDatatypes() + { + return [ + 'application/json', + 'application/xml', + ]; + } + /** * Generate path info based on method data * @@ -212,6 +239,8 @@ protected function generatePathInfo($methodName, $httpMethodData, $tagName) 'tags' => [$tagName], 'description' => $methodData['documentation'], 'operationId' => $operationId, + 'consumes' => $this->getConsumableDatatypes(), + 'produces' => $this->getProducibleDatatypes(), ]; $parameters = $this->generateMethodParameters($httpMethodData, $operationId); @@ -842,6 +871,17 @@ private function generateBodySchema($parameterName, $parameterInfo, $description $description ); $bodySchema['type'] = 'object'; + + /* + * Make shure we have a proper XML wrapper for request parameters for the XML fromat. + */ + if (!isset($bodySchema['xml']) || !is_array($bodySchema['xml'])) { + $bodySchema['xml'] = []; + } + if (!isset($bodySchema['xml']['name']) || empty($bodySchema['xml']['name'])) { + $bodySchema['xml']['name'] = self::XML_SCHEMA_PARAMWRAPPER; + } + return $bodySchema; } diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php b/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php index 66b59babb7189..172db875c6c49 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php @@ -223,7 +223,7 @@ public function generateDataProvider() ] ], // @codingStandardsIgnoreStart - '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"post":{"tags":["testModule5AllSoapAndRestV2"],"description":"Add new item.","operationId":"' . self::OPERATION_NAME . 'Post","parameters":[{"name":"operationNamePostBody","in":"body","schema":{"required":["item"],"properties":{"item":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"type":"object"}}],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' + '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"post":{"tags":["testModule5AllSoapAndRestV2"],"description":"Add new item.","operationId":"operationNamePost","consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"parameters":[{"name":"operationNamePostBody","in":"body","schema":{"required":["item"],"properties":{"item":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"type":"object","xml":{"name":"request"}}}],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' // @codingStandardsIgnoreEnd ], [ @@ -271,7 +271,7 @@ public function generateDataProvider() ] ], // @codingStandardsIgnoreStart - '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"get":{"tags":["testModule5AllSoapAndRestV2"],"description":"Retrieve existing item.","operationId":"' . self::OPERATION_NAME . 'Get","responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' + '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"get":{"tags":["testModule5AllSoapAndRestV2"],"description":"Retrieve existing item.","operationId":"operationNameGet","consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' // @codingStandardsIgnoreEnd ], ]; From dd11aec63fed86711524d454acf15b10f364cc5e Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Mon, 27 May 2019 18:26:08 +0300 Subject: [PATCH 225/464] MAGETWO-97317: Price missing when adding product via API to previously emptied cart - Fix static tests. --- .../Quote/Test/Unit/Model/QuoteManagementTest.php | 5 +++++ .../product_without_options_with_stock_data.php | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php index 6743b83fa12d2..5d8799874aef9 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php @@ -1052,6 +1052,11 @@ protected function setPropertyValue(&$object, $property, $value) return $object; } + /** + * Test submit for customer + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testSubmitForCustomer() { $orderData = []; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php index 6821062ccf320..268d5bf792de4 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php @@ -20,9 +20,11 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setQty(100) - ->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ])->save(); + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + )->save(); From 02d326753f23e82777e05f0c835d14f91d05b40f Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 28 May 2019 10:17:03 +0300 Subject: [PATCH 226/464] MAGETWO-99636: Newsletter subscribe and unsubscribe emails sent when User creates account from Invitation account --- .../Customer/Controller/Account/CreatePost.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index 79a575add7347..72ba62250c37d 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Controller\Account; +use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Customer\Model\Account\Redirect as AccountRedirect; use Magento\Customer\Api\Data\AddressInterface; @@ -133,6 +134,11 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht */ private $formKeyValidator; + /** + * @var CustomerRepository + */ + private $customerRepository; + /** * @param Context $context * @param Session $customerSession @@ -153,6 +159,7 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht * @param DataObjectHelper $dataObjectHelper * @param AccountRedirect $accountRedirect * @param Validator $formKeyValidator + * @param CustomerRepository $customerRepository * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -175,6 +182,7 @@ public function __construct( CustomerExtractor $customerExtractor, DataObjectHelper $dataObjectHelper, AccountRedirect $accountRedirect, + CustomerRepository $customerRepository, Validator $formKeyValidator = null ) { $this->session = $customerSession; @@ -195,6 +203,7 @@ public function __construct( $this->dataObjectHelper = $dataObjectHelper; $this->accountRedirect = $accountRedirect; $this->formKeyValidator = $formKeyValidator ?: ObjectManager::getInstance()->get(Validator::class); + $this->customerRepository = $customerRepository; parent::__construct($context); } @@ -348,7 +357,11 @@ public function execute() ->createAccount($customer, $password, $redirectUrl); if ($this->getRequest()->getParam('is_subscribed', false)) { - $this->subscriberFactory->create()->subscribeCustomerById($customer->getId()); + $subscriber = $this->subscriberFactory->create()->subscribeCustomerById($customer->getId()); + $extensionAttributes = $customer->getExtensionAttributes(); + $extensionAttributes->setIsSubscribed($subscriber->isSubscribed($customer)); + $customer->setExtensionAttributes($extensionAttributes); + $this->customerRepository->save($customer); } $this->_eventManager->dispatch( From 0aed6d3e687719585f5897632e761f4842c0d29c Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 28 May 2019 10:38:37 +0300 Subject: [PATCH 227/464] MAGETWO-99691: Reorder doesn't show discount price in Order Totals block --- .../CatalogPriceRuleActionGroup.xml | 21 ++++++ .../Page/AdminCatalogPriceRuleGridPage.xml | 14 ++++ .../AdminCatalogPriceRuleGridSection.xml | 15 ++++ .../Adminhtml/Order/Create/Index.php | 2 +- .../Magento/Sales/Model/AdminOrder/Create.php | 9 ++- .../Sales/Test/Mftf/Data/OrderData.xml | 5 ++ .../Test/AdminReorderWithCatalogPriceTest.xml | 68 +++++++++++++++++++ 7 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index 90f4f22bcf631..b979cc5995931 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -115,4 +115,25 @@ <actionGroup name="selectNotLoggedInCustomerGroupActionGroup"> <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> </actionGroup> + + <!-- Open rule for Edit --> + <actionGroup name="OpenCatalogPriceRule"> + <arguments> + <argument name="ruleName" type="string" defaultValue="CustomCatalogRule.name"/> + </arguments> + <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <fillField selector="{{AdminCatalogPriceRuleGridSection.filterByRuleName}}" userInput="{{ruleName}}" stepKey="filterByRuleName"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> + <click selector="{{AdminGridTableSection.row('1')}}" stepKey="clickEdit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> + + <actionGroup name="RemoveCatalogPriceRule" extends="OpenCatalogPriceRule"> + <click selector="{{AdminMainActionsSection.delete}}" after="waitForPageLoad" stepKey="clickToDelete"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" after="clickToDelete" stepKey="waitForElementVisible"/> + <click selector="{{AdminConfirmationModalSection.ok}}" after="waitForElementVisible" stepKey="clickToConfirm"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="clickToConfirm" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the rule." after="waitForSuccessMessage" stepKey="verifyRuleIsDeleted"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml new file mode 100644 index 0000000000000..24e4b27604f0d --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminCatalogPriceRuleGridPage" url="catalog_rule/promo_catalog/" module="Magento_CatalogRule" area="admin"> + <section name="AdminCatalogPriceRuleGridSection"/> + </page> +</pages> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml new file mode 100644 index 0000000000000..7852afd5b85e2 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCatalogPriceRuleGridSection"> + <element name="filterByRuleName" type="input" selector="#promo_catalog_grid_filter_name"/> + <element name="attribute" type="text" selector="//*[@id='promo_catalog_grid_table']//td[contains(text(), '{{arg}}')]" parameterized="true"/> + <element name="applyRulesButton" type="button" selector="#apply_rules" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Index.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Index.php index 603aa2586b051..634ecd50c6f9a 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Index.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Index.php @@ -20,7 +20,7 @@ class Index extends \Magento\Sales\Controller\Adminhtml\Order\Create implements public function execute() { $this->_initSession(); - + $this->_getOrderCreateModel()->initRuleData(); /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Magento_Sales::sales_order'); diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 063433140566a..44fd72c33dbc6 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -398,6 +398,7 @@ protected function _getQuoteItem($item) */ public function initRuleData() { + $this->_coreRegistry->unregister('rule_data'); $this->_coreRegistry->register( 'rule_data', new \Magento\Framework\DataObject( @@ -415,7 +416,8 @@ public function initRuleData() /** * Set collect totals flag for quote * - * @param bool $flag + * @param bool $flag + * * @return $this */ public function setRecollect($flag) @@ -1129,6 +1131,7 @@ public function updateQuoteItems($items) } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->recollectCart(); throw $e; + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { $this->_logger->critical($e); } @@ -1790,7 +1793,7 @@ public function _prepareCustomer() ->setWebsiteId($store->getWebsiteId()) ->setCreatedAt(null); $customer = $this->_validateCustomerData($customer); - } else if (!$customer->getId()) { + } elseif (!$customer->getId()) { /** Create new customer */ $customerBillingAddressDataObject = $this->getBillingAddress()->exportCustomerAddress(); $customer->setSuffix($customerBillingAddressDataObject->getSuffix()) @@ -1862,6 +1865,7 @@ protected function _prepareCustomerAddress($customer, $quoteCustomerAddress) } elseif ($addressType == \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_SHIPPING) { try { $billingAddressDataObject = $this->accountManagement->getDefaultBillingAddress($customer->getId()); + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock } catch (\Exception $e) { /** Billing address does not exist. */ } @@ -2003,6 +2007,7 @@ protected function _validate() } else { try { $method->validate(); + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->_errors[] = $e->getMessage(); } diff --git a/app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml b/app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml index eb5600f112ea1..28baea5782156 100644 --- a/app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml +++ b/app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml @@ -23,6 +23,11 @@ <data key="from">200</data> <data key="to">400</data> </entity> + <entity name="AdminOrderSimpleProductWithCatalogRule" type="order"> + <data key="subtotal">110.70</data> + <data key="shipping">5.00</data> + <data key="grandTotal">115.70</data> + </entity> <entity name="OrderStatus" type="status"> <data key="canceled">Canceled</data> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml new file mode 100644 index 0000000000000..2cc15bcc2e3ad --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminReorderWithCatalogPriceTest"> + <annotations> + <features value="Sales"/> + <stories value="Admin create order"/> + <title value="Reorder doesn't show discount price in Order Totals block"/> + <description value="Reorder doesn't show discount price in Order Totals block"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-16695"/> + <useCaseId value="MAGETWO-99691"/> + <group value="sales"/> + <group value="catalogRule"/> + </annotations> + <before> + <!--Create the catalog price rule --> + <createData entity="CatalogRuleToPercent" stepKey="createCatalogRule"/> + <!--Create product--> + <createData entity="SimpleProduct2" stepKey="createSimpleProductApi"/> + <!--Create order via API--> + <createData entity="GuestCart" stepKey="createGuestCart"/> + <createData entity="SimpleCartItem" stepKey="addCartItem"> + <requiredEntity createDataKey="createGuestCart"/> + <requiredEntity createDataKey="createSimpleProductApi"/> + </createData> + <createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress"> + <requiredEntity createDataKey="createGuestCart"/> + </createData> + <updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation"> + <requiredEntity createDataKey="createGuestCart"/> + </updateData> + <!--END Create order via API--> + </before> + <after> + <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> + <!-- Delete the rule --> + <actionGroup ref="RemoveCatalogPriceRule" stepKey="deletePriceRule"> + <argument name="ruleName" value="{{CatalogRuleToPercent.name}}" /> + </actionGroup> + <!--Clear all filters in grid--> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + </after> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Open order by Id--> + <actionGroup ref="OpenOrderById" stepKey="openOrderById"> + <argument name="orderId" value="$createGuestCart.return$"/> + </actionGroup> + <!--Reorder--> + <click selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="clickReorder"/> + <!--Verify totals on Order page--> + <scrollTo selector="{{AdminOrderFormTotalSection.grandTotal}}" stepKey="scrollToOrderGrandTotal"/> + <waitForElementVisible selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" stepKey="waitOrderSubtotalToBeVisible"/> + <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProductWithCatalogRule.subtotal}}" stepKey="seeOrderSubTotal"/> + <waitForElementVisible selector="{{AdminOrderFormTotalSection.total('Shipping')}}" stepKey="waitOrderShippingToBeVisible"/> + <see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProductWithCatalogRule.shipping}}" stepKey="seeOrderShipping"/> + <waitForElementVisible selector="{{AdminOrderFormTotalSection.grandTotal}}" stepKey="waitOrderGrandTotalToBeVisible"/> + <see selector="{{AdminOrderFormTotalSection.grandTotal}}" userInput="${{AdminOrderSimpleProductWithCatalogRule.grandTotal}}" stepKey="seeCorrectGrandTotal"/> + </test> +</tests> From 8080f7e6f80551ce8fe5ee252eefd1d1462780c6 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 28 May 2019 10:44:55 +0300 Subject: [PATCH 228/464] MAGETWO-99636: Newsletter subscribe and unsubscribe emails sent when User creates account from Invitation account --- app/code/Magento/Customer/Controller/Account/CreatePost.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index 72ba62250c37d..53122e3672651 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -357,9 +357,8 @@ public function execute() ->createAccount($customer, $password, $redirectUrl); if ($this->getRequest()->getParam('is_subscribed', false)) { - $subscriber = $this->subscriberFactory->create()->subscribeCustomerById($customer->getId()); $extensionAttributes = $customer->getExtensionAttributes(); - $extensionAttributes->setIsSubscribed($subscriber->isSubscribed($customer)); + $extensionAttributes->setIsSubscribed(true); $customer->setExtensionAttributes($extensionAttributes); $this->customerRepository->save($customer); } From bfa47bb0b5c97264d02eb0bfe49005819bf8d359 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Tue, 28 May 2019 12:43:19 +0300 Subject: [PATCH 229/464] MAGETWO-99636: Newsletter subscribe and unsubscribe emails sent when User creates account from Invitation account --- .../Customer/Controller/Account/CreatePost.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index 53122e3672651..4c9c25b5f33d9 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -39,6 +39,8 @@ use Magento\Customer\Controller\AbstractAccount; /** + * Post create customer action + * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -158,8 +160,8 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht * @param CustomerExtractor $customerExtractor * @param DataObjectHelper $dataObjectHelper * @param AccountRedirect $accountRedirect - * @param Validator $formKeyValidator * @param CustomerRepository $customerRepository + * @param Validator $formKeyValidator * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -337,22 +339,16 @@ public function execute() return $this->resultRedirectFactory->create() ->setUrl($this->_redirect->error($url)); } - $this->session->regenerateId(); - try { $address = $this->extractAddress(); $addresses = $address === null ? [] : [$address]; - $customer = $this->customerExtractor->extract('customer_account_create', $this->_request); $customer->setAddresses($addresses); - $password = $this->getRequest()->getParam('password'); $confirmation = $this->getRequest()->getParam('password_confirmation'); $redirectUrl = $this->session->getBeforeAuthUrl(); - $this->checkPasswordConfirmation($password, $confirmation); - $customer = $this->accountManagement ->createAccount($customer, $password, $redirectUrl); @@ -362,12 +358,10 @@ public function execute() $customer->setExtensionAttributes($extensionAttributes); $this->customerRepository->save($customer); } - $this->_eventManager->dispatch( 'customer_register_success', ['account_controller' => $this, 'customer' => $customer] ); - $confirmationStatus = $this->accountManagement->getConfirmationStatus($customer->getId()); if ($confirmationStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED) { $email = $this->customerUrl->getEmailConfirmationUrl($customer->getEmail()); From 06e67f542590201f70100dc3ac10e067735a5222 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 28 May 2019 13:50:52 +0300 Subject: [PATCH 230/464] MAGETWO-99691: Reorder doesn't show discount price in Order Totals block --- .../Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml | 2 +- .../Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml index 7852afd5b85e2..21f1401b624c9 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCatalogPriceRuleGridSection"> <element name="filterByRuleName" type="input" selector="#promo_catalog_grid_filter_name"/> - <element name="attribute" type="text" selector="//*[@id='promo_catalog_grid_table']//td[contains(text(), '{{arg}}')]" parameterized="true"/> + <element name="attribute" type="text" selector="//*[@id='promo_catalog_grid_table']//td[contains(text(), '{{attributeValue}}')]" parameterized="true"/> <element name="applyRulesButton" type="button" selector="#apply_rules" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index 2cc15bcc2e3ad..2eb65d12fb34b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -47,6 +47,7 @@ <!--Clear all filters in grid--> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> + <actionGroup ref="logout" stepKey="logout"/> </after> <!-- Login as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From c011b1c42d2fb803684af1d55bae55a11e600512 Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Tue, 28 May 2019 14:49:06 +0300 Subject: [PATCH 231/464] MAGETWO-99691: Reorder doesn't show discount price in Order Totals block --- .../Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index 2eb65d12fb34b..f4b133167819c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -45,6 +45,7 @@ <argument name="ruleName" value="{{CatalogRuleToPercent.name}}" /> </actionGroup> <!--Clear all filters in grid--> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetCatalogRuleGridFilters"/> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/> <actionGroup ref="logout" stepKey="logout"/> From 7d1e34ec74433a5dc8d11aaac36613642071a0dc Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Tue, 28 May 2019 16:24:22 +0300 Subject: [PATCH 232/464] magento/magento#23005 static-test-fix --- app/code/Magento/MediaStorage/Service/ImageResize.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/MediaStorage/Service/ImageResize.php b/app/code/Magento/MediaStorage/Service/ImageResize.php index 49501c3b91bb5..d3f4fc01e387b 100644 --- a/app/code/Magento/MediaStorage/Service/ImageResize.php +++ b/app/code/Magento/MediaStorage/Service/ImageResize.php @@ -228,6 +228,7 @@ private function getUniqueImageIndex(array $imageData): string { ksort($imageData); unset($imageData['type']); + // phpcs:disable Magento2.Security.InsecureFunction return md5(json_encode($imageData)); } From 4814b4c8f933f635b5d1c0eefd55daca32718103 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Tue, 28 May 2019 16:52:34 +0300 Subject: [PATCH 233/464] MAGETWO-99460: Custom status overrides standard state in dropdowns after being assigned --- app/code/Magento/Sales/Model/Order/Config.php | 2 +- .../Magento/Sales/Model/Order/ConfigTest.php | 51 +++++++++++++++++++ .../order_status_assign_state_complete.php | 18 +++++++ ..._status_assign_state_complete_rollback.php | 14 +++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete_rollback.php diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 1b31caa573f99..268864a5647d9 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -213,7 +213,7 @@ public function getStates() { $states = []; foreach ($this->_getCollection() as $item) { - if ($item->getState()) { + if ($item->getState() && $item->getIsDefault()) { $states[$item->getState()] = __($item->getData('label')); } } diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php new file mode 100644 index 0000000000000..4b36d7a574140 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Order; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\ObjectManager; + +/** + * Test class for \Magento\Sales\Model\Order\Config + */ +class ConfigTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Config + */ + protected $orderConfig; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->orderConfig = $this->objectManager->create(Config::class); + } + + /** + * Correct display of the list of "Order States" after assigning + * the state "complete" to a custom order status. + * + * @magentoDataFixture Magento/Sales/_files/order_status_assign_state_complete.php + */ + public function testCorrectCompleteStatusInStatesList() + { + $allStates = $this->orderConfig->getStates(); + /** @var Status $completeStatus */ + $completeStatus = $this->objectManager->create(Status::class) + ->load(\Magento\Sales\Model\Order::STATE_COMPLETE); + $completeState = $allStates[$completeStatus->getStatus()]; + + $this->assertEquals($completeStatus->getLabel(), $completeState->getText()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete.php new file mode 100644 index 0000000000000..4f2176036787d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete.php @@ -0,0 +1,18 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Sales\Model\Order\Status; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var Status $orderStatus */ +$orderStatus = Bootstrap::getObjectManager()->create(Status::class); +$data = [ + 'status' => 'custom_complete', + 'label' => 'Custom Complete Status', +]; +$orderStatus->setData($data)->save(); +$orderStatus->assignState(\Magento\Sales\Model\Order::STATE_COMPLETE, false, true); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete_rollback.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete_rollback.php new file mode 100644 index 0000000000000..99187116db9d9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status_assign_state_complete_rollback.php @@ -0,0 +1,14 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Sales\Model\Order\Status; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var Status $orderStatus */ +$orderStatus = Bootstrap::getObjectManager()->create(Status::class); +$orderStatus->load('custom_complete', 'status'); +$orderStatus->delete(); From 36216c4f2d4dab3a3c33b98cbb8173b68807fd89 Mon Sep 17 00:00:00 2001 From: Denis Kopylov <dkopylov@magenius.team> Date: Tue, 28 May 2019 19:17:34 +0300 Subject: [PATCH 234/464] [Framework] Reassign fields variable after converting to array --- .../Magento/Framework/Model/ResourceModel/Db/AbstractDb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php index 0cadb10aaafe2..8d859b4c7b2c1 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php @@ -604,7 +604,7 @@ protected function _checkUnique(\Magento\Framework\Model\AbstractModel $object) $fields = $this->getUniqueFields(); if (!empty($fields)) { if (!is_array($fields)) { - $this->_uniqueFields = [['field' => $fields, 'title' => $fields]]; + $fields = $this->_uniqueFields = [['field' => $fields, 'title' => $fields]]; } $data = new \Magento\Framework\DataObject($this->_prepareDataForSave($object)); From fd6cf5ef58981028680db6b5c3f9466b29b36155 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Tue, 28 May 2019 19:25:06 +0300 Subject: [PATCH 235/464] fix AsynchronousOperations multistore issue by passing store_id from in amqp application_headers property --- .../MessageQueue/EnvelopeFactoryPlugin.php | 74 +++++++++++++++++++ app/code/Magento/Amqp/etc/di.xml | 3 + .../Model/MassConsumer.php | 28 ++++++- .../Model/MassPublisher.php | 3 +- 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php diff --git a/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php b/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php new file mode 100644 index 0000000000000..560abd633bb6d --- /dev/null +++ b/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Amqp\Plugin\Framework\MessageQueue; + +use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\MessageQueue\EnvelopeFactory; +use PhpAmqpLib\Wire\AMQPTable; + +/** + * Plugin to set 'store_id' to the new custom header 'store_id' in amqp + * 'application_headers'. + */ +class EnvelopeFactoryPlugin +{ + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + */ + public function __construct( + StoreManagerInterface $storeManager + ) { + $this->storeManager = $storeManager; + } + + /** + * Pass current 'store_id' to the new custom header 'store_id' in amqp + * 'application_headers' Magento\AsynchronousOperations\Model\MassConsumer + * will use store_id to setCurrentStore and will execute messages for + * correct store instead of default. + * + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeCreate(EnvelopeFactory $subject, array $data = []) + { + if (!isset($data['publisher_flag'])) { + return null; + } else { + unset($data['publisher_flag']); + } + try { + $storeId = $this->storeManager->getStore()->getId(); + + if (isset($storeId)) { + if (isset($data['properties'])) { + $properties = $data['properties']; + if (isset($properties['application_headers'])) { + $headers = $properties['application_headers']; + if ($headers instanceof AMQPTable) { + $headers->set('store_id', $storeId); + $data['properties']['application_headers'] = $headers; + } + } else { + $data['properties']['application_headers'] = new AMQPTable(['store_id' => $storeId]); + } + } + } + } catch (\Exception $e) { + return null; + } + + return [$data]; + } +} diff --git a/app/code/Magento/Amqp/etc/di.xml b/app/code/Magento/Amqp/etc/di.xml index 920bb72261ef9..ff6074206582e 100644 --- a/app/code/Magento/Amqp/etc/di.xml +++ b/app/code/Magento/Amqp/etc/di.xml @@ -72,4 +72,7 @@ <argument name="instanceName" xsi:type="string">\Magento\Framework\Amqp\Bulk\Exchange</argument> </arguments> </virtualType> + <type name="Magento\Framework\MessageQueue\EnvelopeFactory"> + <plugin name="amqpStoreIdFieldForMessageQueueEnvelopeFactory" type="Magento\Amqp\Plugin\Framework\MessageQueue\EnvelopeFactoryPlugin" /> + </type> </config> diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index af1ef4400e442..333e9ddc1b36e 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -10,6 +10,8 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\Registry; +use Magento\Store\Model\StoreManagerInterface; +use PhpAmqpLib\Wire\AMQPTable; use Psr\Log\LoggerInterface; use Magento\Framework\MessageQueue\MessageLockException; use Magento\Framework\MessageQueue\ConnectionLostException; @@ -63,6 +65,10 @@ class MassConsumer implements ConsumerInterface * @var Registry */ private $registry; + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; /** * Initialize dependencies. @@ -74,6 +80,7 @@ class MassConsumer implements ConsumerInterface * @param OperationProcessorFactory $operationProcessorFactory * @param LoggerInterface $logger * @param Registry $registry + * @param StoreManagerInterface $storeManager */ public function __construct( CallbackInvokerInterface $invoker, @@ -82,7 +89,8 @@ public function __construct( ConsumerConfigurationInterface $configuration, OperationProcessorFactory $operationProcessorFactory, LoggerInterface $logger, - Registry $registry = null + Registry $registry = null, + StoreManagerInterface $storeManager = null ) { $this->invoker = $invoker; $this->resource = $resource; @@ -94,6 +102,8 @@ public function __construct( $this->logger = $logger; $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() ->get(Registry::class); + $this->storeManager = $storeManager ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(StoreManagerInterface::class); } /** @@ -126,6 +136,22 @@ private function getTransactionCallback(QueueInterface $queue) /** @var LockInterface $lock */ $lock = null; try { + $amqpProperties = $message->getProperties(); + if (isset($amqpProperties['application_headers'])) { + $headers = $amqpProperties['application_headers']; + if ($headers instanceof AMQPTable) { + $headers = $headers->getNativeData(); + } + if (isset($headers['store_id'])) { + $storeId = $headers['store_id']; + $currentStoreId = $this->storeManager->getStore()->getId(); + + if (isset($storeId) && $storeId !== $currentStoreId) { + $this->storeManager->setCurrentStore($storeId); + } + } + } + $topicName = $message->getProperties()['topic_name']; $lock = $this->messageController->lock($message, $this->configuration->getConsumerName()); diff --git a/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php b/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php index 5f0f8e28f9fe6..c8992a8f6d15a 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php @@ -93,7 +93,8 @@ public function publish($topicName, $data) 'properties' => [ 'delivery_mode' => 2, 'message_id' => $this->messageIdGenerator->generate($topicName), - ] + ], + 'publisher_flag'=>true ] ); } From 41bc618434f09fa6fbff245cee2e12afda675e71 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Tue, 28 May 2019 14:05:05 -0500 Subject: [PATCH 236/464] MC-16864: Load critical css to head --- .../Theme/Block/Html/Header/CriticalCss.php | 53 +++++++++++++++++++ .../frontend/layout/default_head_blocks.xml | 3 ++ .../templates/html/header/criticalCss.phtml | 15 ++++++ .../Magento/luma/web/css/critical.css | 0 4 files changed, 71 insertions(+) create mode 100644 app/code/Magento/Theme/Block/Html/Header/CriticalCss.php create mode 100644 app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml create mode 100644 app/design/frontend/Magento/luma/web/css/critical.css diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php new file mode 100644 index 0000000000000..745451d1100ae --- /dev/null +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Theme\Block\Html\Header; + +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Asset\Repository; + +/** + * Block will add inline critical css + * in case dev/css/use_css_critical_path is enabled + * + * @package Magento\Theme\Block\Html\Header + */ +class CriticalCss extends Template +{ + /** + * @var Repository + */ + private $assetRepo; + + /** + * @param Template\Context $context + * @param Repository $assetRepo + * @param array $data + */ + public function __construct( + Template\Context $context, + Repository $assetRepo, + array $data = [] + ) { + $this->assetRepo = $assetRepo; + parent::__construct($context, $data); + } + + /** + * Returns critical css data as string. + * + * @return string + */ + public function getCriticalCssData() + { + $asset = $this->assetRepo->createAsset('css/critical.css', ['_secure' => 'false']); + $content = $asset->getContent(); + + return $content; + } +} diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 82e7c80d9be0c..333c5fd2a85e1 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -13,6 +13,9 @@ <script src="mage/polyfill.js"/> </head> <body> + <referenceBlock name="head.additional"> + <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="criticalCssContent" as="criticalCss" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> + </referenceBlock> <referenceBlock name="head.additional"> <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> diff --git a/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml b/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml new file mode 100644 index 0000000000000..6421f0d5496a9 --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * @var \Magento\Theme\Block\Html\Header\CriticalCss $block + */ +?> +<?php $criticalCssData = $block->getCriticalCssData(); ?> + +<style type="text/css" data-type="criticalCss"> + <?= $criticalCssData; ?> +</style> \ No newline at end of file diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css new file mode 100644 index 0000000000000..e69de29bb2d1d From 3dae5c6ac8430fd681c05330c4437537d2031955 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Tue, 28 May 2019 22:17:16 +0300 Subject: [PATCH 237/464] MAGETWO-99460: Custom status overrides standard state in dropdowns after being assigned --- app/code/Magento/Sales/Model/Order/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 268864a5647d9..92681f3ecf181 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -181,7 +181,7 @@ protected function maskStatusForArea($area, $code) /** * State label getter * - * @param string $state + * @param string $state * @return \Magento\Framework\Phrase|string */ public function getStateLabel($state) From 9c72b691310de0cd06011cbdeeda6c8df55c30f2 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Tue, 28 May 2019 14:51:02 -0500 Subject: [PATCH 238/464] MC-16611: Fix Unrelated Static Test Failures - fix bugs --- .../adminhtml/templates/system/config/form/field/array.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index 83d9605264751..e2432ff35c174 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -123,7 +123,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; // add existing rows <?php foreach ($block->getArrayRows() as $_rowId => $_row) { - echo "arrayRow{$block->escapeJs($_htmlId)}.add(" . $_row->toJson() . ");\n"; + echo /** noEscape */ "arrayRow{$block->escapeJs($_htmlId)}.add(" . /** noEscape */$_row->toJson() . ");\n"; } ?> From 80732c860cf1f99d219a74d58c9807cb79065284 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Tue, 28 May 2019 23:12:55 +0300 Subject: [PATCH 239/464] fix code related to reviewer comments, move AsynchronousOperations multistore issue fix to separate plugin, move callable function to separate class --- .../MessageQueue/EnvelopeFactoryPlugin.php | 74 ---------- app/code/Magento/Amqp/etc/di.xml | 3 - .../MassConsumerEnvelopeCallbackPlugin.php | 85 +++++++++++ .../Framework/Amqp/Bulk/ExchangePlugin.php | 105 ++++++++++++++ app/code/Magento/AmqpStore/composer.json | 26 ++++ app/code/Magento/AmqpStore/etc/di.xml | 15 ++ app/code/Magento/AmqpStore/etc/module.xml | 15 ++ app/code/Magento/AmqpStore/registration.php | 9 ++ .../Model/MassConsumer.php | 72 +++------- .../Model/MassConsumerEnvelopeCallback.php | 134 ++++++++++++++++++ .../Model/MassPublisher.php | 3 +- 11 files changed, 408 insertions(+), 133 deletions(-) delete mode 100644 app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php create mode 100644 app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php create mode 100644 app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php create mode 100644 app/code/Magento/AmqpStore/composer.json create mode 100644 app/code/Magento/AmqpStore/etc/di.xml create mode 100644 app/code/Magento/AmqpStore/etc/module.xml create mode 100644 app/code/Magento/AmqpStore/registration.php create mode 100644 app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php diff --git a/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php b/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php deleted file mode 100644 index 560abd633bb6d..0000000000000 --- a/app/code/Magento/Amqp/Plugin/Framework/MessageQueue/EnvelopeFactoryPlugin.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -declare(strict_types=1); - -namespace Magento\Amqp\Plugin\Framework\MessageQueue; - -use Magento\Store\Model\StoreManagerInterface; -use Magento\Framework\MessageQueue\EnvelopeFactory; -use PhpAmqpLib\Wire\AMQPTable; - -/** - * Plugin to set 'store_id' to the new custom header 'store_id' in amqp - * 'application_headers'. - */ -class EnvelopeFactoryPlugin -{ - /** - * @var \Magento\Store\Model\StoreManagerInterface - */ - private $storeManager; - - /** - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - */ - public function __construct( - StoreManagerInterface $storeManager - ) { - $this->storeManager = $storeManager; - } - - /** - * Pass current 'store_id' to the new custom header 'store_id' in amqp - * 'application_headers' Magento\AsynchronousOperations\Model\MassConsumer - * will use store_id to setCurrentStore and will execute messages for - * correct store instead of default. - * - * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function beforeCreate(EnvelopeFactory $subject, array $data = []) - { - if (!isset($data['publisher_flag'])) { - return null; - } else { - unset($data['publisher_flag']); - } - try { - $storeId = $this->storeManager->getStore()->getId(); - - if (isset($storeId)) { - if (isset($data['properties'])) { - $properties = $data['properties']; - if (isset($properties['application_headers'])) { - $headers = $properties['application_headers']; - if ($headers instanceof AMQPTable) { - $headers->set('store_id', $storeId); - $data['properties']['application_headers'] = $headers; - } - } else { - $data['properties']['application_headers'] = new AMQPTable(['store_id' => $storeId]); - } - } - } - } catch (\Exception $e) { - return null; - } - - return [$data]; - } -} diff --git a/app/code/Magento/Amqp/etc/di.xml b/app/code/Magento/Amqp/etc/di.xml index ff6074206582e..920bb72261ef9 100644 --- a/app/code/Magento/Amqp/etc/di.xml +++ b/app/code/Magento/Amqp/etc/di.xml @@ -72,7 +72,4 @@ <argument name="instanceName" xsi:type="string">\Magento\Framework\Amqp\Bulk\Exchange</argument> </arguments> </virtualType> - <type name="Magento\Framework\MessageQueue\EnvelopeFactory"> - <plugin name="amqpStoreIdFieldForMessageQueueEnvelopeFactory" type="Magento\Amqp\Plugin\Framework\MessageQueue\EnvelopeFactoryPlugin" /> - </type> </config> diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php new file mode 100644 index 0000000000000..8cc4700666b15 --- /dev/null +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\AmqpStore\Plugin\AsynchronousOperations; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\MessageQueue\EnvelopeFactory; +use PhpAmqpLib\Wire\AMQPTable; +use Magento\Framework\Amqp\Queue; +use Magento\Framework\MessageQueue\EnvelopeInterface; +use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback; +use Psr\Log\LoggerInterface; + +/** + * Plugin to get 'store_id' from the new custom header 'store_id' in amqp + * 'application_headers' properties and setCurrentStore by value 'store_id'. + */ +class MassConsumerEnvelopeCallbackPlugin +{ + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + private $storeManager; + /** + * @var \Magento\Framework\MessageQueue\EnvelopeFactory + */ + private $envelopeFactory; + /** + * @var \Psr\Log\LoggerInterface + */ + private $logger; + + /** + * @param \Magento\Framework\MessageQueue\EnvelopeFactory $envelopeFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Psr\Log\LoggerInterface $logger + */ + public function __construct( + EnvelopeFactory $envelopeFactory, + StoreManagerInterface $storeManager, + LoggerInterface $logger + ) { + $this->storeManager = $storeManager; + $this->envelopeFactory = $envelopeFactory; + $this->logger = $logger; + } + + /** + * @param MassConsumerEnvelopeCallback $subject + * @param EnvelopeInterface $message + * @return array|null + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeExecute(MassConsumerEnvelopeCallback $subject, EnvelopeInterface $message) + { + $amqpProperties = $message->getProperties(); + if (isset($amqpProperties['application_headers'])) { + $headers = $amqpProperties['application_headers']; + if ($headers instanceof AMQPTable) { + $headers = $headers->getNativeData(); + } + if (isset($headers['store_id'])) { + $storeId = $headers['store_id']; + try { + $currentStoreId = $this->storeManager->getStore()->getId(); + } catch (NoSuchEntityException $e) { + $this->logger->error( + sprintf("Can't set currentStoreId during processing queue. Error %s.", $e->getMessage()) + ); + return null; + } + if (isset($storeId) && $storeId !== $currentStoreId) { + $this->storeManager->setCurrentStore($storeId); + } + } + } + return [$message]; + } +} diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php new file mode 100644 index 0000000000000..165b73c308266 --- /dev/null +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\AmqpStore\Plugin\Framework\Amqp\Bulk; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\MessageQueue\EnvelopeFactory; +use PhpAmqpLib\Exception\AMQPInvalidArgumentException; +use PhpAmqpLib\Wire\AMQPTable; +use Magento\Framework\Amqp\Bulk\Exchange; +use Magento\Framework\MessageQueue\EnvelopeInterface; +use Psr\Log\LoggerInterface; + +/** + * Plugin to set 'store_id' to the new custom header 'store_id' in amqp + * 'application_headers'. + */ +class ExchangePlugin +{ + /** + * @var StoreManagerInterface + */ + private $storeManager; + /** + * @var EnvelopeFactory + */ + private $envelopeFactory; + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @param EnvelopeFactory $envelopeFactory + * @param StoreManagerInterface $storeManager + */ + public function __construct( + EnvelopeFactory $envelopeFactory, + StoreManagerInterface $storeManager, + LoggerInterface $logger + ) { + $this->storeManager = $storeManager; + $this->envelopeFactory = $envelopeFactory; + $this->logger = $logger; + } + + /** + * @param Exchange $subject + * @param $topic + * @param EnvelopeInterface[] $envelopes + * @return array|null + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeEnqueue(Exchange $subject, $topic, array $envelopes) + { + try { + $storeId = $this->storeManager->getStore()->getId(); + } catch (NoSuchEntityException $e) { + $this->logger->error( + sprintf("Can't get current storeId and inject to amqp message. Error %s.", $e->getMessage()) + ); + return null; + } + + $updatedEnvelopes = []; + foreach ($envelopes as $envelope) { + $properties = $envelope->getProperties(); + if (!isset($properties)) { + $properties = []; + } + if (isset($properties['application_headers'])) { + $headers = $properties['application_headers']; + if ($headers instanceof AMQPTable) { + try { + $headers->set('store_id', $storeId); + } catch (AMQPInvalidArgumentException $ea) { + $this->logger->error( + sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage()) + ); + return null; + } + $properties['application_headers'] = $headers; + } + } else { + $properties['application_headers'] = new AMQPTable(['store_id' => $storeId]); + } + $updatedEnvelopes[] = $this->envelopeFactory->create( + [ + 'body' => $envelope->getBody(), + 'properties' => $properties + ] + ); + } + if (!empty($updatedEnvelopes)) { + $envelopes = $updatedEnvelopes; + } + return [$topic, $envelopes]; + } +} diff --git a/app/code/Magento/AmqpStore/composer.json b/app/code/Magento/AmqpStore/composer.json new file mode 100644 index 0000000000000..e40a95a1fd401 --- /dev/null +++ b/app/code/Magento/AmqpStore/composer.json @@ -0,0 +1,26 @@ +{ + "name": "magento/module-amqp-store", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "magento/framework": "*", + "magento/framework-amqp": "*", + "magento/framework-message-queue": "*", + "php": "~7.1.3||~7.2.0" + }, + "type": "magento2-module", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\AmqpStore\\": "" + } + } +} diff --git a/app/code/Magento/AmqpStore/etc/di.xml b/app/code/Magento/AmqpStore/etc/di.xml new file mode 100644 index 0000000000000..08cbcc64a7f47 --- /dev/null +++ b/app/code/Magento/AmqpStore/etc/di.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\Framework\Amqp\Bulk\Exchange"> + <plugin name="amqpStoreIdFieldForAmqpBulkExchange" type="Magento\AmqpStore\Plugin\Framework\Amqp\Bulk\ExchangePlugin"/> + </type> + <type name="Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback"> + <plugin name="amqpStoreIdFieldForAsynchronousOperationsMassConsumerEnvelopeCallback" type="Magento\AmqpStore\Plugin\AsynchronousOperations\MassConsumerEnvelopeCallbackPlugin"/> + </type> +</config> diff --git a/app/code/Magento/AmqpStore/etc/module.xml b/app/code/Magento/AmqpStore/etc/module.xml new file mode 100644 index 0000000000000..3e2cd542338a2 --- /dev/null +++ b/app/code/Magento/AmqpStore/etc/module.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> + <module name="Magento_AmqpStore"> + <sequence> + <module name="Magento_Amqp"/> + <module name="Magento_Store"/> + </sequence> + </module> +</config> diff --git a/app/code/Magento/AmqpStore/registration.php b/app/code/Magento/AmqpStore/registration.php new file mode 100644 index 0000000000000..4922879bfbf16 --- /dev/null +++ b/app/code/Magento/AmqpStore/registration.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AmqpStore', __DIR__); diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 333e9ddc1b36e..81454f0d7978b 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -23,6 +23,7 @@ use Magento\Framework\MessageQueue\LockInterface; use Magento\Framework\MessageQueue\MessageController; use Magento\Framework\MessageQueue\ConsumerInterface; +use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallbackFactory; /** * Class Consumer used to process OperationInterface messages. @@ -66,9 +67,9 @@ class MassConsumer implements ConsumerInterface */ private $registry; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var MassConsumerEnvelopeCallbackFactory */ - private $storeManager; + private $massConsumerEnvelopeCallback; /** * Initialize dependencies. @@ -80,7 +81,7 @@ class MassConsumer implements ConsumerInterface * @param OperationProcessorFactory $operationProcessorFactory * @param LoggerInterface $logger * @param Registry $registry - * @param StoreManagerInterface $storeManager + * @param MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback */ public function __construct( CallbackInvokerInterface $invoker, @@ -90,7 +91,7 @@ public function __construct( OperationProcessorFactory $operationProcessorFactory, LoggerInterface $logger, Registry $registry = null, - StoreManagerInterface $storeManager = null + MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback = null ) { $this->invoker = $invoker; $this->resource = $resource; @@ -102,8 +103,8 @@ public function __construct( $this->logger = $logger; $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() ->get(Registry::class); - $this->storeManager = $storeManager ?? \Magento\Framework\App\ObjectManager::getInstance() - ->get(StoreManagerInterface::class); + $this->massConsumerEnvelopeCallback = $massConsumerEnvelopeCallback ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(MassConsumerEnvelopeCallbackFactory::class); } /** @@ -132,54 +133,17 @@ public function process($maxNumberOfMessages = null) */ private function getTransactionCallback(QueueInterface $queue) { - return function (EnvelopeInterface $message) use ($queue) { - /** @var LockInterface $lock */ - $lock = null; - try { - $amqpProperties = $message->getProperties(); - if (isset($amqpProperties['application_headers'])) { - $headers = $amqpProperties['application_headers']; - if ($headers instanceof AMQPTable) { - $headers = $headers->getNativeData(); - } - if (isset($headers['store_id'])) { - $storeId = $headers['store_id']; - $currentStoreId = $this->storeManager->getStore()->getId(); - - if (isset($storeId) && $storeId !== $currentStoreId) { - $this->storeManager->setCurrentStore($storeId); - } - } - } - - $topicName = $message->getProperties()['topic_name']; - $lock = $this->messageController->lock($message, $this->configuration->getConsumerName()); - - $allowedTopics = $this->configuration->getTopicNames(); - if (in_array($topicName, $allowedTopics)) { - $this->operationProcessor->process($message->getBody()); - } else { - $queue->reject($message); - return; - } - $queue->acknowledge($message); - } catch (MessageLockException $exception) { - $queue->acknowledge($message); - } catch (ConnectionLostException $e) { - if ($lock) { - $this->resource->getConnection() - ->delete($this->resource->getTableName('queue_lock'), ['id = ?' => $lock->getId()]); - } - } catch (NotFoundException $e) { - $queue->acknowledge($message); - $this->logger->warning($e->getMessage()); - } catch (\Exception $e) { - $queue->reject($message, false, $e->getMessage()); - if ($lock) { - $this->resource->getConnection() - ->delete($this->resource->getTableName('queue_lock'), ['id = ?' => $lock->getId()]); - } - } + $callbackInstance = $this->massConsumerEnvelopeCallback->create([ + 'resource' => $this->resource, + 'messageController'=>$this->messageController, + 'configuration'=>$this->configuration, + 'operationProcessor'=>$this->operationProcessor, + 'logger'=>$this->logger, + 'registry'=>$this->registry, + 'queue'=>$queue, + ]); + return function (EnvelopeInterface $message) use ($callbackInstance) { + $callbackInstance->execute($message); }; } } diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php new file mode 100644 index 0000000000000..0c273a48dd688 --- /dev/null +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php @@ -0,0 +1,134 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\AsynchronousOperations\Model; + +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\Registry; +use Psr\Log\LoggerInterface; +use Magento\Framework\MessageQueue\MessageLockException; +use Magento\Framework\MessageQueue\ConnectionLostException; +use Magento\Framework\Exception\NotFoundException; +use Magento\Framework\MessageQueue\ConsumerConfigurationInterface; +use Magento\Framework\MessageQueue\EnvelopeInterface; +use Magento\Framework\MessageQueue\QueueInterface; +use Magento\Framework\MessageQueue\LockInterface; +use Magento\Framework\MessageQueue\MessageController; + +/** + * Class used by \Magento\AsynchronousOperations\Model\MassConsumer as public callback function. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class MassConsumerEnvelopeCallback +{ + /** + * @var QueueInterface + */ + private $queue; + + /** + * @var ResourceConnection + */ + private $resource; + + /** + * @var ConsumerConfigurationInterface + */ + private $configuration; + + /** + * @var MessageController + */ + private $messageController; + + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @var OperationProcessor + */ + private $operationProcessor; + + /** + * @var Registry + */ + private $registry; + + /** + * @param ResourceConnection $resource + * @param MessageController $messageController + * @param ConsumerConfigurationInterface $configuration + * @param OperationProcessorFactory $operationProcessorFactory + * @param LoggerInterface $logger + * @param QueueInterface $queue + * @param Registry|null $registry + */ + public function __construct( + ResourceConnection $resource, + MessageController $messageController, + ConsumerConfigurationInterface $configuration, + OperationProcessorFactory $operationProcessorFactory, + LoggerInterface $logger, + QueueInterface $queue, + Registry $registry = null + ) { + $this->resource = $resource; + $this->messageController = $messageController; + $this->configuration = $configuration; + $this->operationProcessor = $operationProcessorFactory->create([ + 'configuration' => $configuration + ]); + $this->logger = $logger; + $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(Registry::class); + $this->queue = $queue; + } + + /** + * Get transaction callback. This handles the case of async. + * + * @param EnvelopeInterface $message + */ + public function execute(EnvelopeInterface $message) + { + $queue = $this->queue; + /** @var LockInterface $lock */ + $lock = null; + try { + $topicName = $message->getProperties()['topic_name']; + $lock = $this->messageController->lock($message, $this->configuration->getConsumerName()); + + $allowedTopics = $this->configuration->getTopicNames(); + if (in_array($topicName, $allowedTopics)) { + $this->operationProcessor->process($message->getBody()); + } else { + $queue->reject($message); + return; + } + $queue->acknowledge($message); + } catch (MessageLockException $exception) { + $queue->acknowledge($message); + } catch (ConnectionLostException $e) { + if ($lock) { + $this->resource->getConnection() + ->delete($this->resource->getTableName('queue_lock'), ['id = ?' => $lock->getId()]); + } + } catch (NotFoundException $e) { + $queue->acknowledge($message); + $this->logger->warning($e->getMessage()); + } catch (\Exception $e) { + $queue->reject($message, false, $e->getMessage()); + if ($lock) { + $this->resource->getConnection() + ->delete($this->resource->getTableName('queue_lock'), ['id = ?' => $lock->getId()]); + } + } + } +} diff --git a/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php b/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php index c8992a8f6d15a..5f0f8e28f9fe6 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassPublisher.php @@ -93,8 +93,7 @@ public function publish($topicName, $data) 'properties' => [ 'delivery_mode' => 2, 'message_id' => $this->messageIdGenerator->generate($topicName), - ], - 'publisher_flag'=>true + ] ] ); } From 73a25b2888d7e0f99c5e7b7502261b7adb82fa53 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Tue, 28 May 2019 15:52:30 -0500 Subject: [PATCH 240/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- setup/performance-toolkit/benchmark.jmx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index a8a7e419373b8..9e6803bd8e45d 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -13671,7 +13671,7 @@ vars.putObject("product_attributes", attributes); <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true"> <stringProp name="RegexExtractor.useHeaders">false</stringProp> <stringProp name="RegexExtractor.refname">attribute_set_id</stringProp> - <stringProp name="RegexExtractor.regex">catalog\/product_set\/edit\/id\/([\d]+)\/"[\D\d]*Attribute Set 1</stringProp> + <stringProp name="RegexExtractor.regex">catalog&#x2F;product_set&#x2F;edit&#x2F;id&#x2F;([\d]+)&#x2F;"[\D\d]*Attribute Set 1</stringProp> <stringProp name="RegexExtractor.template">$1$</stringProp> <stringProp name="RegexExtractor.default"/> <stringProp name="RegexExtractor.match_number">1</stringProp> @@ -34058,7 +34058,7 @@ vars.putObject("product_attributes", attributes); <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true"> <stringProp name="RegexExtractor.useHeaders">false</stringProp> <stringProp name="RegexExtractor.refname">attribute_set_id</stringProp> - <stringProp name="RegexExtractor.regex">catalog\/product_set\/edit\/id\/([\d]+)\/"[\D\d]*Attribute Set 1</stringProp> + <stringProp name="RegexExtractor.regex">catalog&#x2F;product_set&#x2F;edit&#x2F;id&#x2F;([\d]+)&#x2F;"[\D\d]*Attribute Set 1</stringProp> <stringProp name="RegexExtractor.template">$1$</stringProp> <stringProp name="RegexExtractor.default"/> <stringProp name="RegexExtractor.match_number">1</stringProp> From 51ac4d8831a658dd93ed39ecb8c55a0d8957914a Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Tue, 28 May 2019 23:55:20 +0300 Subject: [PATCH 241/464] fix code related to reviewer comments and possible static-code test issues --- ...n.php => MassConsumerEnvelopeCallback.php} | 10 ++++----- .../Bulk/{ExchangePlugin.php => Exchange.php} | 8 +++---- app/code/Magento/AmqpStore/composer.json | 1 + app/code/Magento/AmqpStore/etc/di.xml | 4 ++-- .../Model/MassConsumer.php | 21 +++++++++---------- .../Model/MassConsumerEnvelopeCallback.php | 11 +--------- composer.json | 1 + 7 files changed, 24 insertions(+), 32 deletions(-) rename app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/{MassConsumerEnvelopeCallbackPlugin.php => MassConsumerEnvelopeCallback.php} (89%) rename app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/{ExchangePlugin.php => Exchange.php} (93%) diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php similarity index 89% rename from app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php rename to app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php index 8cc4700666b15..3569b15dd8a13 100644 --- a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallbackPlugin.php +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php @@ -14,14 +14,14 @@ use PhpAmqpLib\Wire\AMQPTable; use Magento\Framework\Amqp\Queue; use Magento\Framework\MessageQueue\EnvelopeInterface; -use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback; +use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback as SubjectMassConsumerEnvelopeCallback; use Psr\Log\LoggerInterface; /** * Plugin to get 'store_id' from the new custom header 'store_id' in amqp * 'application_headers' properties and setCurrentStore by value 'store_id'. */ -class MassConsumerEnvelopeCallbackPlugin +class MassConsumerEnvelopeCallback { /** * @var \Magento\Store\Model\StoreManagerInterface @@ -52,12 +52,12 @@ public function __construct( } /** - * @param MassConsumerEnvelopeCallback $subject + * @param SubjectMassConsumerEnvelopeCallback $subject * @param EnvelopeInterface $message * @return array|null * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeExecute(MassConsumerEnvelopeCallback $subject, EnvelopeInterface $message) + public function beforeExecute(SubjectMassConsumerEnvelopeCallback $subject, EnvelopeInterface $message) { $amqpProperties = $message->getProperties(); if (isset($amqpProperties['application_headers'])) { @@ -76,7 +76,7 @@ public function beforeExecute(MassConsumerEnvelopeCallback $subject, EnvelopeInt return null; } if (isset($storeId) && $storeId !== $currentStoreId) { - $this->storeManager->setCurrentStore($storeId); + $this->storeManager->setCurrentStore($storeId); } } } diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php similarity index 93% rename from app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php rename to app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index 165b73c308266..c412144e2fa53 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/ExchangePlugin.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -13,7 +13,7 @@ use Magento\Framework\MessageQueue\EnvelopeFactory; use PhpAmqpLib\Exception\AMQPInvalidArgumentException; use PhpAmqpLib\Wire\AMQPTable; -use Magento\Framework\Amqp\Bulk\Exchange; +use Magento\Framework\Amqp\Bulk\Exchange as SubjectExchange; use Magento\Framework\MessageQueue\EnvelopeInterface; use Psr\Log\LoggerInterface; @@ -21,7 +21,7 @@ * Plugin to set 'store_id' to the new custom header 'store_id' in amqp * 'application_headers'. */ -class ExchangePlugin +class Exchange { /** * @var StoreManagerInterface @@ -51,13 +51,13 @@ public function __construct( } /** - * @param Exchange $subject + * @param SubjectExchange $subject * @param $topic * @param EnvelopeInterface[] $envelopes * @return array|null * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeEnqueue(Exchange $subject, $topic, array $envelopes) + public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes) { try { $storeId = $this->storeManager->getStore()->getId(); diff --git a/app/code/Magento/AmqpStore/composer.json b/app/code/Magento/AmqpStore/composer.json index e40a95a1fd401..3b64b11bb8db5 100644 --- a/app/code/Magento/AmqpStore/composer.json +++ b/app/code/Magento/AmqpStore/composer.json @@ -8,6 +8,7 @@ "magento/framework": "*", "magento/framework-amqp": "*", "magento/framework-message-queue": "*", + "magento/module-store": "*", "php": "~7.1.3||~7.2.0" }, "type": "magento2-module", diff --git a/app/code/Magento/AmqpStore/etc/di.xml b/app/code/Magento/AmqpStore/etc/di.xml index 08cbcc64a7f47..3bbbebd249535 100644 --- a/app/code/Magento/AmqpStore/etc/di.xml +++ b/app/code/Magento/AmqpStore/etc/di.xml @@ -7,9 +7,9 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\Amqp\Bulk\Exchange"> - <plugin name="amqpStoreIdFieldForAmqpBulkExchange" type="Magento\AmqpStore\Plugin\Framework\Amqp\Bulk\ExchangePlugin"/> + <plugin name="amqpStoreIdFieldForAmqpBulkExchange" type="Magento\AmqpStore\Plugin\Framework\Amqp\Bulk\Exchange"/> </type> <type name="Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback"> - <plugin name="amqpStoreIdFieldForAsynchronousOperationsMassConsumerEnvelopeCallback" type="Magento\AmqpStore\Plugin\AsynchronousOperations\MassConsumerEnvelopeCallbackPlugin"/> + <plugin name="amqpStoreIdFieldForAsynchronousOperationsMassConsumerEnvelopeCallback" type="Magento\AmqpStore\Plugin\AsynchronousOperations\MassConsumerEnvelopeCallback"/> </type> </config> diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 81454f0d7978b..9214e3ce4e586 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -80,8 +80,8 @@ class MassConsumer implements ConsumerInterface * @param ConsumerConfigurationInterface $configuration * @param OperationProcessorFactory $operationProcessorFactory * @param LoggerInterface $logger - * @param Registry $registry * @param MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback + * @param Registry $registry */ public function __construct( CallbackInvokerInterface $invoker, @@ -90,8 +90,8 @@ public function __construct( ConsumerConfigurationInterface $configuration, OperationProcessorFactory $operationProcessorFactory, LoggerInterface $logger, - Registry $registry = null, - MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback = null + MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback, + Registry $registry = null ) { $this->invoker = $invoker; $this->resource = $resource; @@ -101,10 +101,9 @@ public function __construct( 'configuration' => $configuration ]); $this->logger = $logger; + $this->massConsumerEnvelopeCallback = $massConsumerEnvelopeCallback; $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() ->get(Registry::class); - $this->massConsumerEnvelopeCallback = $massConsumerEnvelopeCallback ?? \Magento\Framework\App\ObjectManager::getInstance() - ->get(MassConsumerEnvelopeCallbackFactory::class); } /** @@ -135,12 +134,12 @@ private function getTransactionCallback(QueueInterface $queue) { $callbackInstance = $this->massConsumerEnvelopeCallback->create([ 'resource' => $this->resource, - 'messageController'=>$this->messageController, - 'configuration'=>$this->configuration, - 'operationProcessor'=>$this->operationProcessor, - 'logger'=>$this->logger, - 'registry'=>$this->registry, - 'queue'=>$queue, + 'messageController' => $this->messageController, + 'configuration' => $this->configuration, + 'operationProcessor' => $this->operationProcessor, + 'logger' => $this->logger, + 'registry' => $this->registry, + 'queue' => $queue, ]); return function (EnvelopeInterface $message) use ($callbackInstance) { $callbackInstance->execute($message); diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php index 0c273a48dd688..e1f82b1723c83 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php @@ -56,11 +56,6 @@ class MassConsumerEnvelopeCallback */ private $operationProcessor; - /** - * @var Registry - */ - private $registry; - /** * @param ResourceConnection $resource * @param MessageController $messageController @@ -68,7 +63,6 @@ class MassConsumerEnvelopeCallback * @param OperationProcessorFactory $operationProcessorFactory * @param LoggerInterface $logger * @param QueueInterface $queue - * @param Registry|null $registry */ public function __construct( ResourceConnection $resource, @@ -76,8 +70,7 @@ public function __construct( ConsumerConfigurationInterface $configuration, OperationProcessorFactory $operationProcessorFactory, LoggerInterface $logger, - QueueInterface $queue, - Registry $registry = null + QueueInterface $queue ) { $this->resource = $resource; $this->messageController = $messageController; @@ -86,8 +79,6 @@ public function __construct( 'configuration' => $configuration ]); $this->logger = $logger; - $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() - ->get(Registry::class); $this->queue = $queue; } diff --git a/composer.json b/composer.json index 1d3e4cef5c7e6..4f93fb1eb5900 100644 --- a/composer.json +++ b/composer.json @@ -101,6 +101,7 @@ "magento/module-admin-notification": "*", "magento/module-advanced-pricing-import-export": "*", "magento/module-amqp": "*", + "magento/module-amqp-store": "*", "magento/module-analytics": "*", "magento/module-asynchronous-operations": "*", "magento/module-authorization": "*", From 331e311639e931a01214546ed239ce067384f511 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Wed, 29 May 2019 00:02:40 +0300 Subject: [PATCH 242/464] fix FQDN from docblock annotations --- .../MassConsumerEnvelopeCallback.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php index 3569b15dd8a13..f8560b5f11597 100644 --- a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php @@ -12,7 +12,6 @@ use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\MessageQueue\EnvelopeFactory; use PhpAmqpLib\Wire\AMQPTable; -use Magento\Framework\Amqp\Queue; use Magento\Framework\MessageQueue\EnvelopeInterface; use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallback as SubjectMassConsumerEnvelopeCallback; use Psr\Log\LoggerInterface; @@ -24,22 +23,22 @@ class MassConsumerEnvelopeCallback { /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ private $storeManager; /** - * @var \Magento\Framework\MessageQueue\EnvelopeFactory + * @var EnvelopeFactory */ private $envelopeFactory; /** - * @var \Psr\Log\LoggerInterface + * @var LoggerInterface */ private $logger; /** - * @param \Magento\Framework\MessageQueue\EnvelopeFactory $envelopeFactory - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Psr\Log\LoggerInterface $logger + * @param EnvelopeFactory $envelopeFactory + * @param StoreManagerInterface $storeManager + * @param LoggerInterface $logger */ public function __construct( EnvelopeFactory $envelopeFactory, From dad12c6d9a9e329822eabc613e3ee5ef45d704bb Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Wed, 29 May 2019 00:22:55 +0300 Subject: [PATCH 243/464] remove not needed dependencies from _constructor and params for creation massConsumerEnvelopeCallback --- .../Model/MassConsumer.php | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 9214e3ce4e586..d5b62e1708d35 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -37,31 +37,11 @@ class MassConsumer implements ConsumerInterface */ private $invoker; - /** - * @var \Magento\Framework\App\ResourceConnection - */ - private $resource; - /** * @var \Magento\Framework\MessageQueue\ConsumerConfigurationInterface */ private $configuration; - /** - * @var \Magento\Framework\MessageQueue\MessageController - */ - private $messageController; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var OperationProcessor - */ - private $operationProcessor; - /** * @var Registry */ @@ -75,32 +55,18 @@ class MassConsumer implements ConsumerInterface * Initialize dependencies. * * @param CallbackInvokerInterface $invoker - * @param ResourceConnection $resource - * @param MessageController $messageController * @param ConsumerConfigurationInterface $configuration - * @param OperationProcessorFactory $operationProcessorFactory - * @param LoggerInterface $logger * @param MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback * @param Registry $registry */ public function __construct( CallbackInvokerInterface $invoker, - ResourceConnection $resource, - MessageController $messageController, ConsumerConfigurationInterface $configuration, - OperationProcessorFactory $operationProcessorFactory, - LoggerInterface $logger, MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback, Registry $registry = null ) { $this->invoker = $invoker; - $this->resource = $resource; - $this->messageController = $messageController; $this->configuration = $configuration; - $this->operationProcessor = $operationProcessorFactory->create([ - 'configuration' => $configuration - ]); - $this->logger = $logger; $this->massConsumerEnvelopeCallback = $massConsumerEnvelopeCallback; $this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance() ->get(Registry::class); @@ -133,12 +99,7 @@ public function process($maxNumberOfMessages = null) private function getTransactionCallback(QueueInterface $queue) { $callbackInstance = $this->massConsumerEnvelopeCallback->create([ - 'resource' => $this->resource, - 'messageController' => $this->messageController, 'configuration' => $this->configuration, - 'operationProcessor' => $this->operationProcessor, - 'logger' => $this->logger, - 'registry' => $this->registry, 'queue' => $queue, ]); return function (EnvelopeInterface $message) use ($callbackInstance) { From 81ecd90c95b5bf87969abc6184e2dc705795f042 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Wed, 29 May 2019 00:29:09 +0300 Subject: [PATCH 244/464] remove not used classes --- .../AsynchronousOperations/Model/MassConsumer.php | 10 ---------- .../Model/MassConsumerEnvelopeCallback.php | 1 - 2 files changed, 11 deletions(-) diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index d5b62e1708d35..2a0c56a10f2a2 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -8,22 +8,12 @@ namespace Magento\AsynchronousOperations\Model; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Registry; -use Magento\Store\Model\StoreManagerInterface; -use PhpAmqpLib\Wire\AMQPTable; -use Psr\Log\LoggerInterface; -use Magento\Framework\MessageQueue\MessageLockException; -use Magento\Framework\MessageQueue\ConnectionLostException; -use Magento\Framework\Exception\NotFoundException; use Magento\Framework\MessageQueue\CallbackInvokerInterface; use Magento\Framework\MessageQueue\ConsumerConfigurationInterface; use Magento\Framework\MessageQueue\EnvelopeInterface; use Magento\Framework\MessageQueue\QueueInterface; -use Magento\Framework\MessageQueue\LockInterface; -use Magento\Framework\MessageQueue\MessageController; use Magento\Framework\MessageQueue\ConsumerInterface; -use Magento\AsynchronousOperations\Model\MassConsumerEnvelopeCallbackFactory; /** * Class Consumer used to process OperationInterface messages. diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php index e1f82b1723c83..f284b621b6df9 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php @@ -9,7 +9,6 @@ namespace Magento\AsynchronousOperations\Model; use Magento\Framework\App\ResourceConnection; -use Magento\Framework\Registry; use Psr\Log\LoggerInterface; use Magento\Framework\MessageQueue\MessageLockException; use Magento\Framework\MessageQueue\ConnectionLostException; From c844e34e0cc6eebcf598613682841fde04e5777d Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Tue, 28 May 2019 17:15:42 -0500 Subject: [PATCH 245/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../templates/admin/access_denied.phtml | 6 +- .../templates/admin/overlay_popup.phtml | 6 +- .../view/adminhtml/templates/admin/page.phtml | 6 +- .../adminhtml/templates/dashboard/graph.phtml | 11 ++- .../adminhtml/templates/dashboard/grid.phtml | 72 +++++++-------- .../adminhtml/templates/dashboard/index.phtml | 8 +- .../templates/dashboard/salebar.phtml | 4 +- .../templates/dashboard/searches.phtml | 6 +- .../templates/dashboard/store/switcher.phtml | 18 ++-- .../templates/dashboard/totalbar.phtml | 4 +- .../adminhtml/templates/page/header.phtml | 18 ++-- .../adminhtml/templates/page/notices.phtml | 4 +- .../adminhtml/templates/page/report.phtml | 2 +- .../adminhtml/templates/pageactions.phtml | 2 +- .../adminhtml/templates/store/switcher.phtml | 87 ++++++------------- .../switcher/form/renderer/fieldset.phtml | 20 ++--- .../form/renderer/fieldset/element.phtml | 10 +-- .../templates/system/autocomplete.phtml | 2 +- .../templates/system/cache/additional.phtml | 8 +- .../templates/system/cache/edit.phtml | 22 +++-- .../adminhtml/templates/system/search.phtml | 4 +- .../templates/widget/accordion.phtml | 8 +- .../templates/widget/breadcrumbs.phtml | 14 +-- .../templates/widget/button/split.phtml | 8 +- .../templates/widget/form/container.phtml | 8 +- 25 files changed, 168 insertions(+), 190 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml index b4b34650baefd..be309423c48d2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml @@ -8,6 +8,8 @@ /** * @see \Magento\Backend\Block\Denied */ + +// phpcs:disable Magento2.Security.Superglobal ?> <hr class="access-denied-hr"/> <div class="access-denied-page"> @@ -18,10 +20,10 @@ <li><span><?= $block->escapeHtml(__('Contact a system administrator or store owner to gain permissions.')) ?></span></li> <li> <span><?= $block->escapeHtml(__('Return to ')) ?> - <?php if(isset($_SERVER['HTTP_REFERER'])): ?> + <?php if (isset($_SERVER['HTTP_REFERER'])) : ?> <a href="<?= $block->escapeUrl(__($_SERVER['HTTP_REFERER'])) ?>"> <?= $block->escapeHtml(__('previous page')) ?></a><?= $block->escapeHtml(__('.')) ?> - <?php else: ?> + <?php else : ?> <a href="<?= $block->escapeHtmlAttr(__('javascript:history.back()')) ?>"> <?= $block->escapeHtml(__('previous page')) ?></a><?= $block->escapeHtml(__('.')) ?> <?php endif ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml index 7493bb96be652..a6ef70d0471a9 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml @@ -7,7 +7,7 @@ <div class="wrapper-popup"> <div class="middle" id="anchor-content"> <div id="page:main-container"> - <?php if ($block->getChildHtml('left')): ?> + <?php if ($block->getChildHtml('left')) : ?> <div class="columns <?= $block->escapeHtmlAttr($block->getContainerCssClass()) ?>" id="page:container"> <div id="page:left" class="side-col"> <?= $block->getChildHtml('left') ?> @@ -21,13 +21,13 @@ </div> </div> </div> - <?php else: ?> + <?php else : ?> <div id="messages" data-container-for="messages"><?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?></div> <?= $block->getChildHtml('content') ?> <?php endif; ?> </div> </div> - <?php if ($block->getChildHtml('footer')): ?> + <?php if ($block->getChildHtml('footer')) : ?> <div class="footer"> <?= $block->getChildHtml('footer') ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml index 12af342e0cc59..d8cab67ecb79b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -12,7 +12,7 @@ <?= $block->getChildHtml('head') ?> </head> -<body id="html-body"<?= $block->getBodyClass() ? ' class="' . $block->getBodyClass() . '"' : '' ?> data-container="body" data-mage-init='{"loaderAjax":{},"loader":{}}'> +<body id="html-body" class="<?= $block->escapeHtmlAttr($block->getBodyClass()) ?>" data-container="body" data-mage-init='{"loaderAjax":{},"loader":{}}'> <div class="page-wrapper"> <?= $block->getChildHtml('notification_window') ?> <?= $block->getChildHtml('global_notices') ?> @@ -28,7 +28,7 @@ <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> </div> <?= $block->getChildHtml('page_main_actions') ?> - <?php if ($block->getChildHtml('left')): ?> + <?php if ($block->getChildHtml('left')) : ?> <div id="page:main-container" class="<?= $block->escapeHtmlAttr($block->getContainerCssClass()) ?> col-2-left-layout"> <div class="main-col" id="content"> <?= $block->getChildHtml('content') ?> @@ -38,7 +38,7 @@ <?= $block->getChildHtml('left') ?> </div> </div> - <?php else: ?> + <?php else : ?> <div id="page:main-container" class="col-1-layout"> <?= $block->getChildHtml('content') ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index a357a491338f5..4db08de6b69a3 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -10,8 +10,11 @@ class="label"><?= $block->escapeHtml(__('Select Range:')) ?></label> <select name="period" id="order_<?= $block->getHtmlId() ?>_period" onchange="changeDiagramsPeriod(this);" class="admin__control-select"> - <?php foreach ($this->helper('Magento\Backend\Helper\Dashboard\Data')->getDatePeriods() as $value => $label): ?> - <?php if (in_array($value, ['custom'])) { + <?php //phpcs:disable ?> + <?php foreach ($this->helper(\Magento\Backend\Helper\Dashboard\Data::class)->getDatePeriods() as $value => $label) : ?> + <?php + //phpcs:enable + if (in_array($value, ['custom'])) { continue; } ?> <option value="<?= /* @noEscape */ $value ?>" @@ -20,11 +23,11 @@ <?php endforeach; ?> </select> </div> - <?php if ($block->getCount()): ?> + <?php if ($block->getCount()) : ?> <div class="dashboard-diagram-image"> <img src="<?= $block->escapeUrl($block->getChartUrl(false)) ?>" class="dashboard-diagram-chart" alt="Chart" title="Chart" /> </div> - <?php else: ?> + <?php else : ?> <div class="dashboard-diagram-nodata"> <span><?= $block->escapeHtml(__('No Data Found')) ?></span> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index d089071840551..c77d2707f31ef 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -6,84 +6,84 @@ ?> <?php -$numColumns = sizeof($block->getColumns()); +$numColumns = count($block->getColumns()); ?> -<?php if ($block->getCollection()): ?> +<?php if ($block->getCollection()) : ?> <div class="dashboard-item-content"> - <?php if ($block->getCollection()->getSize()>0): ?> + <?php if ($block->getCollection()->getSize() > 0) : ?> <table class="admin__table-primary dashboard-data" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_table"> <?php /* This part is commented to remove all <col> tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> <col <?= $_column->getHtmlProperty() ?> /> <?php endforeach; */ ?> - <?php if ($block->getHeadersVisibility() || $block->getFilterVisibility()): ?> + <?php if ($block->getHeadersVisibility() || $block->getFilterVisibility()) : ?> <thead> - <?php if ($block->getHeadersVisibility()): ?> + <?php if ($block->getHeadersVisibility()) : ?> <tr> - <?php foreach ($block->getColumns() as $_column): ?> + <?php foreach ($block->getColumns() as $_column) : ?> <?= $_column->getHeaderHtml() ?> <?php endforeach; ?> </tr> <?php endif; ?> </thead> <?php endif; ?> - <?php if (!$block->getIsCollapsed()): ?> + <?php if (!$block->getIsCollapsed()) : ?> <tbody> - <?php foreach ($block->getCollection() as $_index => $_item): ?> + <?php foreach ($block->getCollection() as $_index => $_item) : ?> <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"> - <?php $i = 0; foreach ($block->getColumns() as $_column): ?> - <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= ++$i == $numColumns ? 'last' : '' ?>"><?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> + <?php $i = 0; foreach ($block->getColumns() as $_column) : ?> + <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ ++$i == $numColumns ? 'last' : '' ?>"><?= /* @noEscape */ (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> <?php endif; ?> </table> - <?php else: ?> + <?php else : ?> <div class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></div> <?php endif; ?> </div> -<?php if ($block->canDisplayContainer()): ?> + <?php if ($block->canDisplayContainer()) : ?> <script> var deps = []; -<?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> deps.push('uiRegistry'); -<?php endif; ?> + <?php endif; ?> -<?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?> + <?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?> deps.push('Magento_Sales/order/create/form'); -<?php endif; ?> + <?php endif; ?> deps.push('mage/adminhtml/grid'); require(deps, function(<?= ($block->getDependencyJsObject() ? 'registry' : '') ?>){ - <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> + <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { - <?php endif; ?> + <?php endif; ?> - <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeJs($block->getId()) ?>', '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); - <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; - <?php if ($block->getRowClickCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; - <?php endif; ?> - <?php if ($block->getCheckboxCheckCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; - <?php endif; ?> - <?php if ($block->getRowInitCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; - <?= $block->escapeJs($block->getJsObjectName()) ?>.rows.each(function(row){<?= /* @noEscape */ $block->getRowInitCallback() ?>(<?= $block->escapeJs($block->getJsObjectName()) ?>, row)}); - <?php endif; ?> - <?php if ($block->getMassactionBlock()->isAvailable()): ?> - <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> - <?php endif ?> + <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeJs($block->getId()) ?>', '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); + <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; + <?php if ($block->getRowClickCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; + <?php endif; ?> + <?php if ($block->getCheckboxCheckCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; + <?php endif; ?> + <?php if ($block->getRowInitCallback()): ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rows.each(function(row){<?= /* @noEscape */ $block->getRowInitCallback() ?>(<?= $block->escapeJs($block->getJsObjectName()) ?>, row)}); + <?php endif; ?> + <?php if ($block->getMassactionBlock()->isAvailable()): ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> + <?php endif ?> - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> }); - <?php endif; ?> + <?php endif; ?> }); </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml index c2c7b229361bb..6152c8fe1cff1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml @@ -14,9 +14,9 @@ require([ window.changeDiagramsPeriod = function(periodObj) { periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : ''; -<?php foreach ($block->getChildBlock('diagrams')->getTabsIds() as $tabId): ?> + <?php foreach ($block->getChildBlock('diagrams')->getTabsIds() as $tabId) : ?> ajaxBlockParam = 'block/tab_<?= $block->escapeJs($tabId) ?>/'; - ajaxBlockUrl = '<?= $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => '']) ?>' + ajaxBlockParam + periodParam; + ajaxBlockUrl = '<?= $block->escapeJs($block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => ''])) ?>' + ajaxBlockParam + periodParam; new Ajax.Request(ajaxBlockUrl, { parameters: {isAjax: 'true', form_key: FORM_KEY}, onSuccess: function(transport) { @@ -41,8 +41,8 @@ window.changeDiagramsPeriod = function(periodObj) { } } }); -<?php endforeach; ?> - ajaxBlockUrl = '<?= $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => '']) ?>' + periodParam; + <?php endforeach; ?> + ajaxBlockUrl = '<?= $block->escapeJs($block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => ''])) ?>' + periodParam; new Ajax.Request(ajaxBlockUrl, { parameters: {isAjax: 'true', form_key: FORM_KEY}, onSuccess: function(transport) { diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml index 6f14928b767a2..139a7cad4185f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ ?> -<?php if (sizeof($block->getTotals()) > 0): ?> - <?php foreach ($block->getTotals() as $_total): ?> +<?php if (count($block->getTotals()) > 0) : ?> + <?php foreach ($block->getTotals() as $_total) : ?> <div class="dashboard-item dashboard-item-primary"> <div class="dashboard-item-title"><?= $block->escapeHtml($_total['label']) ?></div> <div class="dashboard-item-content"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml index 88d88cd9406ea..7a7a71f07fa55 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml @@ -4,12 +4,12 @@ * See COPYING.txt for license details. */ ?> -<?php if (count($block->getCollection()->getItems()) > 0): ?> +<?php if (count($block->getCollection()->getItems()) > 0) : ?> <div class="searches-results"> - <?php foreach ($block->getCollection()->getItems() as $item): ?> + <?php foreach ($block->getCollection()->getItems() as $item) : ?> <span><?= $block->escapeHtml($item->getQueryText()) ?></span><br /> <?php endforeach; ?> </div> -<?php else: ?> +<?php else : ?> <div class="empty-text"><?= $block->escapeHtml(__('There are no search keywords.')) ?></div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index c6aa4cadb29a6..37b76aaffbcc9 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -8,23 +8,23 @@ <?= $block->getHintHtml() ?> <select name="store_switcher" id="store_switcher" class="left-col-block" onchange="return switchStore(this);"> <option value=""><?= $block->escapeHtml(__('All Websites')) ?></option> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) : ?> <?php $showWebsite = false; ?> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <?php foreach ($block->getGroupCollection($_website) as $_group) : ?> <?php $showGroup = false; ?> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> - <?php if ($showWebsite == false): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) : ?> + <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= $block->escapeHtmlAttr($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> + <option website="true" value="<?= $block->escapeHtmlAttr($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()) : ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> <?php endif; ?> - <?php if ($showGroup == false): ?> + <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> <!--optgroup label="   <?= /* @noEscape */ $_group->getName() ?>"--> - <option group="true" value="<?= $block->escapeHtmlAttr($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected="selected"<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= $block->escapeHtmlAttr($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()) : ?> selected="selected"<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected="selected"<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> - <?php if ($showGroup): ?> + <?php if ($showGroup) : ?> <!--</optgroup>--> <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml index 6bb47607f6396..918eea75fab99 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/totalbar.phtml @@ -4,10 +4,10 @@ * See COPYING.txt for license details. */ ?> -<?php if (sizeof($block->getTotals()) > 0): ?> +<?php if (count($block->getTotals()) > 0) : ?> <div class="dashboard-totals" id="dashboard_diagram_totals"> <ul class="dashboard-totals-list"> - <?php foreach ($block->getTotals() as $_total): ?> + <?php foreach ($block->getTotals() as $_total) : ?> <li class="dashboard-totals-item"> <span class="dashboard-totals-label"><?= $block->escapeHtml($_total['label']) ?></span> <strong class="dashboard-totals-value"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index 8f33f8e357109..89f144664003d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -5,9 +5,9 @@ */ /** @var $block \Magento\Backend\Block\Page\Header */ +$part = $block->getShowPart(); ?> -<?php switch ($block->getShowPart()): - case 'logo': ?> +<?php if ($part === 'logo') : ?> <?php $edition = $block->hasEdition() ? 'data-edition="' . $block->escapeHtml($block->getEdition()) . '"' : ''; ?> <?php $logoSrc = ($block->hasLogoImageSrc()) ? $block->escapeHtml($block->getLogoImageSrc()) : 'images/magento-logo.svg' ?> <a @@ -17,8 +17,7 @@ <img class="logo-img" src="<?= /* @noEscape */ $block->getViewFileUrl($logoSrc) ?>" alt="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>" title="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>"/> </a> - <?php break; ?> - <?php case 'user': ?> +<?php elseif ($part === 'user') : ?> <div class="admin-user admin__action-dropdown-wrap"> <a href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>" @@ -31,7 +30,7 @@ </span> </a> <ul class="admin__action-dropdown-menu"> - <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::myaccount')): ?> + <?php if ($block->getAuthorization()->isAllowed('Magento_Backend::myaccount')) : ?> <li> <a href="<?= /* @noEscape */ $block->getUrl('adminhtml/system_account/index') ?>" @@ -59,8 +58,7 @@ </li> </ul> </div> - <?php break; ?> - <?php case 'other': ?> - <?= $block->getChildHtml() ?> - <?php break; ?> -<?php endswitch; ?> + +<?php elseif ($part === 'other') : ?> + <?= $block->getChildHtml() ?> +<?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml index 4d5ba9f8a07d5..93df0aec94ef1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml @@ -9,7 +9,7 @@ * @see \Magento\Backend\Block\Page\Notices */ ?> -<?php if ($block->displayNoscriptNotice()): ?> +<?php if ($block->displayNoscriptNotice()) : ?> <noscript> <div class="messages"> <div class="message message-warning message-noscript"> @@ -19,7 +19,7 @@ </div> </noscript> <?php endif; ?> -<?php if ($block->displayDemoNotice()): ?> +<?php if ($block->displayDemoNotice()) : ?> <div class="messages"> <div class="message message-warning message-demo-mode"> <?= $block->escapeHtml(__('This is only a demo store. You can browse and place orders, but nothing will be processed.')) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml index fd5407cffc2d0..2965983e12150 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ ?> -<?php if ($block->getBugreportUrl()): ?> +<?php if ($block->getBugreportUrl()) : ?> <a class="link-report" href="<?= $block->escapeUrl($block->getBugreportUrl()) ?>" id="footer_bug_tracking" target="_blank"> <?= $block->escapeHtml(__('Report an Issue')) ?> </a> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml index 45204a7750540..56a8161b57e0b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ ?> -<?php if ($block->getChildHtml()):?> +<?php if ($block->getChildHtml()) :?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions floating-header" <?= /* @noEscape */ $block->getUiId('content-header') ?>> <?= $block->getChildHtml() ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index d914386907920..d45333d24a0ef 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -6,7 +6,7 @@ /* @var $block \Magento\Backend\Block\Store\Switcher */ ?> -<?php if ($websites = $block->getWebsites()): ?> +<?php if ($websites = $block->getWebsites()) : ?> <div class="store-switcher store-view"> <span class="store-switcher-label"><?= $block->escapeHtml(__('Store View:')) ?></span> @@ -33,91 +33,60 @@ <?= $block->escapeHtml($block->getCurrentSelectionName()) ?> </button> <ul class="dropdown-menu" data-role="stores-list"> - <?php if ($block->hasDefaultOption()): ?> - <li class="store-switcher-all <?php if ( ! ($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) { - echo "disabled"; - } ?> <?php if ( ! $block->hasScopeSelected()) { - ?> current<?php - } ?>"> - <?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) { + <?php if ($block->hasDefaultOption()) : ?> + <li class="store-switcher-all <?php if (!($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) : ?>disabled<?php endif; ?> <?php if ( ! $block->hasScopeSelected()) : ?>current<?php endif; ?>"> + <?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) : ?> ?> <a data-role="store-view-id" data-value="" href="#"> <?= $block->escapeHtml($block->getDefaultSelectionName()) ?> </a> - <?php - } else { - ?> + <?php else : ?> <span><?= $block->escapeHtml($block->getDefaultSelectionName()) ?></span> - <?php - } ?> + <?php endif; ?> </li> <?php endif; ?> - <?php foreach ($websites as $website): ?> + <?php foreach ($websites as $website) : ?> <?php $showWebsite = false; ?> - <?php foreach ($website->getGroups() as $group): ?> + <?php foreach ($website->getGroups() as $group) : ?> <?php $showGroup = false; ?> - <?php foreach ($block->getStores($group) as $store): ?> - <?php if ($showWebsite == false): ?> + <?php foreach ($block->getStores($group) as $store) : ?> + <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <li class="store-switcher-website <?php if ( ! ($block->isWebsiteSwitchEnabled() && ! $block->isWebsiteSelected($website))) { - echo "disabled"; - } ?> <?php if ($block->isWebsiteSelected($website)) { - ?> current<?php - } ?>"> - <?php if ($block->isWebsiteSwitchEnabled() && ! $block->isWebsiteSelected($website)) { - ?> + <li class="store-switcher-website <?php if (!($block->isWebsiteSwitchEnabled() && ! $block->isWebsiteSelected($website))) : ?>disabled<?php endif; ?> <?php if ($block->isWebsiteSelected($website)) : ?>current<?php endif; ?>"> + <?php if ($block->isWebsiteSwitchEnabled() && ! $block->isWebsiteSelected($website)) : ?> <a data-role="website-id" data-value="<?= $block->escapeHtml($website->getId()) ?>" href="#"> <?= $block->escapeHtml($website->getName()) ?> </a> - <?php - } else { - ?> + <?php else : ?> <span><?= $block->escapeHtml($website->getName()) ?></span> - <?php - } ?> + <?php endif; ?> </li> <?php endif; ?> - <?php if ($showGroup == false): ?> + <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <li class="store-switcher-store <?php if ( ! ($block->isStoreGroupSwitchEnabled() && ! $block->isStoreGroupSelected($group))) { - echo "disabled"; - } ?> <?php if ($block->isStoreGroupSelected($group)) { - ?> current<?php - } ?>"> - <?php if ($block->isStoreGroupSwitchEnabled() && ! $block->isStoreGroupSelected($group)) { - ?> + <li class="store-switcher-store <?php if (!($block->isStoreGroupSwitchEnabled() && ! $block->isStoreGroupSelected($group))) : ?>disabled<?php endif; ?> <?php if ($block->isStoreGroupSelected($group)) : ?>current<?php endif; ?>"> + <?php if ($block->isStoreGroupSwitchEnabled() && ! $block->isStoreGroupSelected($group)) : ?> <a data-role="store-group-id" data-value="<?= $block->escapeHtml($group->getId()) ?>" href="#"> <?= $block->escapeHtml($group->getName()) ?> </a> - <?php - } else { - ?> + <?php else : ?> <span><?= $block->escapeHtml($group->getName()) ?></span> - <?php - } ?> + <?php endif; ?> </li> <?php endif; ?> - <li class="store-switcher-store-view <?php if ( ! ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store))) { - echo "disabled"; - } ?> <?php if ($block->isStoreSelected($store)) { - ?> current<?php - } ?>"> - <?php if ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store)) { - ?> + <li class="store-switcher-store-view <?php if ( ! ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store))) : ?>disabled<?php endif; ?> <?php if ($block->isStoreSelected($store)) :?>current<?php endif; ?>"> + <?php if ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store)) : ?> <a data-role="store-view-id" data-value="<?= $block->escapeHtml($store->getId()) ?>" href="#"> <?= $block->escapeHtml($store->getName()) ?> </a> - <?php - } else { - ?> + <?php else : ?> <span><?= $block->escapeHtml($store->getName()) ?></span> - <?php - } ?> + <?php endif; ?> </li> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> - <?php if ($block->getShowManageStoresLink() && $block->getAuthorization()->isAllowed('Magento_Backend::store')): ?> + <?php if ($block->getShowManageStoresLink() && $block->getAuthorization()->isAllowed('Magento_Backend::store')) : ?> <li class="dropdown-toolbar"> <a href="<?= /* @noEscape */ $block->getUrl('*/system_store') ?>"><?= $block->escapeHtml(__('Stores Configuration')) ?></a> </li> @@ -171,7 +140,7 @@ require([ scopeSwitcherHandler(switcherParams); } else { - <?php if ($block->getUseConfirm()): ?> + <?php if ($block->getUseConfirm()) : ?> confirm({ content: "<?= $block->escapeHtml(__('Please confirm scope switching. All data that hasn\'t been saved will be lost.')) ?>", @@ -185,16 +154,16 @@ require([ } }); - <?php else: ?> + <?php else : ?> reload(); <?php endif; ?> } function reload() { - <?php if (!$block->isUsingIframe()): ?> + <?php if (!$block->isUsingIframe()) : ?> var url = '<?= $block->escapeJs($block->getSwitchUrl()) ?>' + scopeParams; setLocation(url); - <?php else: ?> + <?php else : ?> jQuery('#preview_selected_store').val(scopeId); jQuery('#preview_form').submit(); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml index 03e3c27592295..382fb6e81c519 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml @@ -5,38 +5,38 @@ */ ?> <?php $_element = $block->getElement() ?> -<?php if ($_element->getFieldsetContainerId()): ?> +<?php if ($_element->getFieldsetContainerId()) : ?> <div id="<?= $block->escapeHtmlAttr($_element->getFieldsetContainerId()) ?>">789 <?php endif; ?> -<?php if (!$_element->getNoContainer()): ?> +<?php if (!$_element->getNoContainer()) : ?> <fieldset class="admin__fieldset fieldset <?= $block->escapeHtmlAttr($_element->getClass()) ?>" id="<?= $_element->getHtmlId() ?>"> <?php endif; ?> - <?php if ($_element->getLegend()): ?> + <?php if ($_element->getLegend()) : ?> <legend class="admin__legend legend"> <span><?= $block->escapeHtml($_element->getLegend()) ?></span> <?= $block->getHintHtml() ?> </legend><br/> <?= /* @noEscape */ $_element->getHeaderBar() ?> - <?php else: ?> + <?php else : ?> <?= $block->getHintHtml() ?> <?php endif; ?> <div class="admin__fieldset tree-store-scope"> - <?php if ($_element->getComment()): ?> + <?php if ($_element->getComment()) : ?> <p class="comment"><?= $block->escapeHtml($_element->getComment()) ?></p> <?php endif; ?> - <?php if ($_element->hasHtmlContent()): ?> - <?= $_element->getHtmlContent() ?> - <?php else: ?> + <?php if ($_element->hasHtmlContent()) : ?> + <?= $_element->getHtmlContent() ?> + <?php else : ?> <?= $_element->getChildrenHtml() ?> <?php endif; ?> </div> <?= $_element->getSubFieldsetHtml() ?> -<?php if (!$_element->getNoContainer()): ?> +<?php if (!$_element->getNoContainer()) : ?> </fieldset> <?php endif; ?> -<?php if ($_element->getFieldsetContainerId()): ?> +<?php if ($_element->getFieldsetContainerId()) : ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml index 37db4d68d60ed..959a27279e5c2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml @@ -21,16 +21,16 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' . $block->getUiId('form-field', $element->getId()); ?> -<?php if (!$element->getNoDisplay()): ?> - <?php if ($element->getType() == 'hidden'): ?> +<?php if (!$element->getNoDisplay()) : ?> + <?php if ($element->getType() == 'hidden') : ?> <?= $element->getElementHtml() ?> - <?php else: ?> + <?php else : ?> <div<?= /* @noEscape */ $fieldAttributes ?>> - <?php if ($elementBeforeLabel): ?> + <?php if ($elementBeforeLabel) : ?> <?= $element->getElementHtml() ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <?= /* @noEscape */ $note ?> - <?php else: ?> + <?php else : ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <div class="admin__field-control control"> <?= /* @noEscape */ ($addOn) ? '<div class="addon">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml index 7778ba04878f9..7ac867970e820 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml @@ -5,7 +5,7 @@ */ ?> <ul class="dropdown-menu"> - <?php foreach ($items as $item): ?> + <?php foreach ($items as $item) : ?> <li id="<?= $block->escapeHtmlAttr($item['id']) ?>" class="item"> <a href="<?= $block->escapeUrl($item['url']) ?>" class="title"><?= $block->escapeHtml($item['name']) ?></a> <div class="type"><?= $block->escapeHtml($item['type']) ?></div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml index d4371fa9972f4..c392ebf3883d2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml @@ -7,12 +7,12 @@ /** @var \Magento\Backend\Block\Cache\Permissions|null $permissions */ $permissions = $block->getData('permissions'); ?> -<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?> +<?php if ($permissions && $permissions->hasAccessToAdditionalActions()) : ?> <div class="additional-cache-management"> <h2> <span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span> </h2> - <?php if ($permissions->hasAccessToFlushCatalogImages()): ?> + <?php if ($permissions->hasAccessToFlushCatalogImages()) : ?> <p> <button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button"> <?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?> @@ -20,7 +20,7 @@ $permissions = $block->getData('permissions'); <span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span> </p> <?php endif; ?> - <?php if ($permissions->hasAccessToFlushJsCss()): ?> + <?php if ($permissions->hasAccessToFlushJsCss()) : ?> <p> <button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button"> <?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?> @@ -28,7 +28,7 @@ $permissions = $block->getData('permissions'); <span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span> </p> <?php endif; ?> - <?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?> + <?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()) : ?> <p> <button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button"> <?= $block->escapeHtml(__('Flush Static Files Cache')); ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml index 83716c41c6e6d..d1c51f0755a72 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml @@ -36,21 +36,25 @@ <fieldset id="catalog"> <table class="form-list"> <tbody> - <?php foreach ($block->getCatalogData() as $_item): ?> - <?php /* disable reindex buttons. functionality moved to index management*/?> - <?php if ($_item['buttons'][0]['name'] != 'clear_images_cache') { - continue; -}?> + <?php foreach ($block->getCatalogData() as $_item) : ?> + <?php /* disable reindex buttons. functionality moved to index management*/?> + <?php + if ($_item['buttons'][0]['name'] != 'clear_images_cache') { + continue; + } + ?> <tr> <td class="label"><label><?= $block->escapeHtml($_item['label']) ?></label></td> <td class="value"> - <?php foreach ($_item['buttons'] as $_button): ?> + <?php foreach ($_item['buttons'] as $_button) : ?> <?php $clickAction = "setCacheAction('catalog_action',this)"; ?> - <?php if (isset($_button['warning']) && $_button['warning']): ?> + <?php if (isset($_button['warning']) && $_button['warning']) : ?> + <?php //phpcs:disable ?> <?php $clickAction = "if (confirm('" . addslashes($_button['warning']) . "')) {{$clickAction}}"; ?> + <?php //phpcs:enable ?> <?php endif; ?> - <button <?php if (!isset($_button['disabled']) || !$_button['disabled']):?>onclick="<?= /* @noEscape */ $clickAction ?>"<?php endif; ?> id="<?= $block->escapeHtmlAttr($_button['name']) ?>" type="button" class="scalable <?php if (isset($_button['disabled']) && $_button['disabled']):?>disabled<?php endif; ?>" style=""><span><span><span><?= $block->escapeHtml($_button['action']) ?></span></span></span></button> - <?php if (isset($_button['comment'])): ?> <br /> <small><?= $block->escapeHtml($_button['comment']) ?></small> <?php endif; ?> + <button <?php if (!isset($_button['disabled']) || !$_button['disabled']) :?>onclick="<?= /* @noEscape */ $clickAction ?>"<?php endif; ?> id="<?= $block->escapeHtmlAttr($_button['name']) ?>" type="button" class="scalable <?php if (isset($_button['disabled']) && $_button['disabled']) :?>disabled<?php endif; ?>" style=""><span><span><span><?= $block->escapeHtml($_button['action']) ?></span></span></span></button> + <?php if (isset($_button['comment'])) : ?> <br /> <small><?= $block->escapeHtml($_button['comment']) ?></small> <?php endif; ?> <?php endforeach; ?> </td> <td><small> </small></td> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index dbebd68cd0e60..9fbfab135feea 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -15,7 +15,9 @@ class="search-global-input" id="search-global" name="query" - data-mage-init='<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getWidgetInitOptions()) ?>'> + <?php //phpcs:disable ?> + data-mage-init='<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getWidgetInitOptions()) ?>'> + <?php //phpcs:enable ?> <button type="submit" class="search-global-action" diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml index bbd452fbaf0fd..fecf5365544e0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml @@ -10,9 +10,9 @@ */ $items = $block->getItems(); ?> -<?php if (!empty($items)): ?> +<?php if (!empty($items)) : ?> <dl id="tab_content_<?= $block->getHtmlId() ?>" name="tab_content_<?= $block->getHtmlId() ?>" class="accordion"> - <?php foreach ($items as $_item): ?> + <?php foreach ($items as $_item) : ?> <?= $block->getChildHtml($_item->getId()) ?> <?php endforeach ?> </dl> @@ -20,7 +20,7 @@ $items = $block->getItems(); require([ 'mage/adminhtml/accordion' ], function(){ - tab_content_<?= $block->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?= $block->getHtmlId() ?>', '<?= $block->escapeJs($block->getShowOnlyOne()) ?>'); - }); + tab_content_<?= $block->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?= $block->getHtmlId() ?>', '<?= $block->escapeJs($block->getShowOnlyOne()) ?>'); + }); </script> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml index 3bcfadbadf832..fb7cc63ebc10b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/breadcrumbs.phtml @@ -4,21 +4,21 @@ * See COPYING.txt for license details. */ ?> -<?php if (!empty($links)): ?> +<?php if (!empty($links)) : ?> <ul class="breadcrumbs"> <?php $_size = count($links); ?> - <?php foreach ($links as $_index => $_link): ?> + <?php foreach ($links as $_index => $_link) : ?> <li> - <?php if (empty($_link['url'])): ?> - <?php if ($_index != $_size-1): ?> + <?php if (empty($_link['url'])) : ?> + <?php if ($_index != $_size-1) : ?> <span><?= $block->escapeHtml($_link['label']) ?></span> - <?php else: ?> + <?php else : ?> <strong><?= $block->escapeHtml($_link['label']) ?></strong> <?php endif; ?> - <?php else: ?> + <?php else : ?> <a href="<?= $block->escapeUrl($_link['url']) ?>" title="<?= $block->escapeHtml($_link['title']) ?>"><?= $block->escapeHtml($_link['label']) ?></a> <?php endif; ?> - <?php if ($_index != $_size-1): ?> + <?php if ($_index != $_size-1) : ?> » <?php endif; ?> </li> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml index fee86868a782a..0123de098a9e0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml @@ -12,19 +12,19 @@ <button <?= $block->getButtonAttributesHtml() ?>> <span><?= $block->escapeHtml($block->getLabel()) ?></span> </button> - <?php if ($block->hasSplit()): ?> + <?php if ($block->hasSplit()) : ?> <button <?= $block->getToggleAttributesHtml() ?>> <span>Select</span> </button> - <?php if (!$block->getDisabled()): ?> + <?php if (!$block->getDisabled()) : ?> <ul class="dropdown-menu" <?= /* @noEscape */ $block->getUiId("dropdown-menu") ?>> - <?php foreach ($block->getOptions() as $key => $option): ?> + <?php foreach ($block->getOptions() as $key => $option) : ?> <li> <span <?= $block->getOptionAttributesHtml($key, $option) ?>> <?= $block->escapeHtml($option['label']) ?> </span> - <?php if (isset($option['hint'])): ?> + <?php if (isset($option['hint'])) : ?> <div class="tooltip" <?= /* @noEscape */ $block->getUiId('item', $key, 'tooltip') ?>> <a href="<?= $block->escapeHtml($option['hint']['href']) ?>" class="help"> <?= $block->escapeHtml($option['hint']['label']) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml index 79b7b563cd31b..aa289dbf1eb0f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml @@ -5,12 +5,12 @@ */ /** @var $block \Magento\Backend\Block\Widget\Form\Container */ - ?> +?> <?= /* @noEscape */ $block->getFormInitScripts() ?> -<?php if ($block->getButtonsHtml('header')): ?> +<?php if ($block->getButtonsHtml('header')) : ?> <div class="page-form-actions" <?= /* @noEscape */ $block->getUiId('content-header') ?>><?= $block->getButtonsHtml('header') ?></div> <?php endif; ?> -<?php if ($block->getButtonsHtml('toolbar')): ?> +<?php if ($block->getButtonsHtml('toolbar')) : ?> <div class="page-main-actions"> <div class="page-actions"> <div class="page-actions-buttons"> @@ -20,7 +20,7 @@ </div> <?php endif; ?> <?= $block->getFormHtml() ?> -<?php if ($block->hasFooterButtons()): ?> +<?php if ($block->hasFooterButtons()) : ?> <div class="content-footer"> <p class="form-buttons"><?= $block->getButtonsHtml('footer') ?></p> </div> From e97a9881b2628a9771c45eea4a75125613c50ae4 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Tue, 28 May 2019 17:53:51 -0500 Subject: [PATCH 246/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../templates/widget/form/element.phtml | 44 +++------ .../widget/form/element/gallery.phtml | 10 +-- .../widget/form/renderer/element.phtml | 4 +- .../widget/form/renderer/fieldset.phtml | 34 +++---- .../form/renderer/fieldset/element.phtml | 10 +-- .../adminhtml/templates/widget/grid.phtml | 90 +++++++++---------- .../templates/widget/grid/column_set.phtml | 88 +++++++++--------- .../templates/widget/grid/container.phtml | 2 +- .../templates/widget/grid/export.phtml | 2 +- 9 files changed, 133 insertions(+), 151 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index 952e917d3df48..0a9c6211010ba 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -3,23 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -?> -<?php switch ($element->getType()) { - case 'fieldset': ?> +$type = $element->getType(); +?> +<?php if ($type === 'fieldset') : ?> <fieldset> <legend><?= $block->escapeHtml($element->getLegend()) ?></legend><br /> <?php foreach ($element->getElements() as $_element): ?> <?= /* @noEscape */ $formBlock->drawElement($_element) ?> <?php endforeach; ?> </fieldset> - <?php break; - case 'column': ?> - <?php break; - case 'hidden': ?> +<?php elseif ($type === 'column' || $type === 'hidden') : ?> <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>"> - <?php break; - case 'select': ?> + <?php elseif ($type === 'select'): ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"> @@ -28,30 +24,24 @@ <?php endforeach; ?> </select> </span> - <?php break; - case 'text': - case 'button': - case 'password': ?> +<?php elseif ($type === 'text' || $type === 'button' || $type === 'password') : ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>" <?= /* @noEscape */ $block->getUiId('label') ?>><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> </span> - <?php break; - case 'radio': ?> +<?php elseif($type === 'radio') : ?> <span class="form_row"> <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"/> </span> - <?php break; - case 'radios': ?> +<?php elseif ($type === 'radios') : ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> <?php foreach ($element->getRadios() as $_radio): ?> <input type="radio" name="<?= $block->escapeHtmlAttr($_radio->getName()) ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($_radio->getValue()) ?>" class="input-radio <?= $block->escapeHtmlAttr($_radio->getClass()) ?>" title="<?= $block->escapeHtmlAttr($_radio->getTitle()) ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= $block->escapeHtml($_radio->getLabel()) ?> <?php endforeach; ?> </span> - <?php break; - case 'wysiwyg': ?> +<?php elseif ($type === 'wysiwyg') : ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> <script> @@ -81,22 +71,14 @@ }); }); </script> - <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="80" rows="20"><?= /* @noEscape */ $element->getValue() ?></textarea> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="80" rows="20"><?= /* @noEscape */ $element->getValue() ?></textarea> </span> - <?php break; - case 'textarea': ?> +<?php elseif ($type === 'textarea') : ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> - <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="15" rows="2"><?= /* @noEscape */$element->getValue() ?></textarea> + <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="15" rows="2"><?= /* @noEscape */$element->getValue() ?></textarea> </span> - <?php break; - case 'editor': ?> - <?php break; - case 'file': ?> - <?php break; - case 'checkbox': ?> - <?php break; -} ?> +<?php endif; ?> <?php if ($element->getScript()): ?> <script> <?= /* @noEscape */ $element->getScript() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index 7fe7c5c94e78c..9963251cab749 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -25,10 +25,10 @@ <tbody class="gallery"> -<?php $i = 0; if (!is_null($block->getValues())): ?> - <?php foreach ($block->getValues() as $image): $i++; ?> +<?php $i = 0; if ($block->getValues() !== null) : ?> + <?php foreach ($block->getValues() as $image) : $i++; ?> <tr id="<?= $block->getElement()->getHtmlId() ?>_tr_<?= $block->escapeHtmlAttr($image->getValueId()) ?>" class="gallery"> - <?php foreach ($block->getValues()->getAttributeBackend()->getImageTypes() as $type): ?> + <?php foreach ($block->getValues()->getAttributeBackend()->getImageTypes() as $type) : ?> <td class="gallery" align="center" style="vertical-align:bottom;"> <a href="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= $block->escapeHtmlAttr($type) ?>_<?= $block->escapeHtmlAttr($image->getValueId()) ?>');return false;"> <img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= $block->escapeHtmlAttr($type) ?>_<?= $block->escapeHtmlAttr($image->getValueId()) ?>" src="<?= $block->escapeUrl($image->setType($type)->getSourceUrl()) ?>?<?= /* @noEscape */ time() ?>" alt="<?= $block->escapeHtmlAttr($image->getValue()) ?>" title="<?= $block->escapeHtmlAttr($image->getValue()) ?>" height="25" class="small-image-preview v-middle"/></a><br/> @@ -40,7 +40,7 @@ <?php endforeach; ?> <?php endif; ?> -<?php if ($i == 0): ?> +<?php if ($i == 0) : ?> <script> document.getElementById("gallery_thead").style.visibility="hidden"; </script> @@ -72,7 +72,7 @@ window.addNewImage = function() new_row_input.value = '0'; // Delete button - new_row_button = <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getDeleteButtonHtml("this")) ?>; + new_row_button = <?= /* phpcs:disable*/ /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getDeleteButtonHtml("this")) /* phpcs:enable */ ?>; table = document.getElementById( "gallery" ); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml index 8e776d3ff5f9e..e74e5b1e0fe94 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/element.phtml @@ -5,11 +5,11 @@ */ ?> <?php $_element = $block->getElement() ?> -<?php if ($_element->getNoSpan() !== true): ?> +<?php if ($_element->getNoSpan() !== true) : ?> <span class="field-row"> <?php endif; ?> <?= $_element->getLabelHtml() ?> <?= $_element->getElementHtml() ?> -<?php if ($_element->getNoSpan() !== true): ?> +<?php if ($_element->getNoSpan() !== true) : ?> </span> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index a0fa24a014a81..a708871c7ed00 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -29,17 +29,17 @@ if ($isField) { <?php /** -* @todo investigate situations, when the following is needed: -* echo $element->getHeaderBar(); -* echo $element->getSubFieldsetHtml(); -*/ ?> + * @todo investigate situations, when the following is needed: + * echo $element->getHeaderBar(); + * echo $element->getSubFieldsetHtml(); + */ ?> -<?php if ($isWrapped): ?> +<?php if ($isWrapped) : ?> <div class="fieldset-wrapper <?= ($isCollapsable) ? 'admin__collapsible-block-wrapper ' : '' ?>" id="<?= $block->escapeHtmlAttr($containerId ? $containerId : $id . '-wrapper') ?>" data-role="<?= $block->escapeHtmlAttr($id) ?>-wrapper"> <div class="fieldset-wrapper-title admin__fieldset-wrapper-title"> - <strong <?php /* @noEscape */ echo($isCollapsable) ? + <strong <?= /* @noEscape */ $isCollapsable ? 'class="admin__collapsible-title" data-toggle="collapse" data-target="#' . $id . '-content"' : 'class="title"'; ?>> <span><?= $block->escapeHtml($element->getLegend()) ?></span> @@ -51,9 +51,9 @@ if ($isField) { data-role="<?= $block->escapeHtmlAttr($id) ?>-content"> <?php endif; ?> - <?php if (!$element->getNoContainer()): ?> + <?php if (!$element->getNoContainer()) : ?> <fieldset class="<?= $block->escapeHtmlAttr($cssClass) ?>" id="<?= $block->escapeHtmlAttr($id) ?>"> - <?php if ($element->getLegend() && !$isWrapped): ?> + <?php if ($element->getLegend() && !$isWrapped) : ?> <legend class="<?= /* @noEscape */ $isField ? 'label admin__field-label' : 'admin__legend legend' ?>"> <span><?= $block->escapeHtml($element->getLegend()) ?></span> </legend><br /> @@ -62,7 +62,7 @@ if ($isField) { <div class="messages"> - <?php if ($element->getComment() && !$isField): ?> + <?php if ($element->getComment() && !$isField) : ?> <div class="message message-notice"><?= $block->escapeHtml($element->getComment()) ?></div> <?php endif; ?> </div> @@ -70,11 +70,11 @@ if ($isField) { <?= ($isField) ? '<div class="control admin__field-control">' : '' ?> - <?php if ($element->hasHtmlContent() && !$isField): ?> + <?php if ($element->hasHtmlContent() && !$isField) : ?> <?= $element->getHtmlContent() ?> - <?php else: ?> + <?php else : ?> - <?php if ($isField && $count > 1):?> + <?php if ($isField && $count > 1) : ?> <div class="fields-group-<?= /* @noEscape */ $count ?>"> <?php endif; ?> @@ -82,11 +82,11 @@ if ($isField) { <?= ($isField && $count > 1) ? '</div>' : '' ?> - <?php if ($element->getComment() && $isField): ?> + <?php if ($element->getComment() && $isField) : ?> <div class="note"><?= $block->escapeHtml($element->getComment()) ?></div> <?php endif; ?> - <?php if ($element->hasAdvanced() && !$isField): ?> + <?php if ($element->hasAdvanced() && !$isField) : ?> <?= (!$element->getNoContainer() && $advancedAfter) ? '</fieldset>' : '' ?> <details data-mage-init='{"details": {}}' class="details admin__collapsible-block-wrapper" id="details<?= /* @noEscape */ $id ?>"> <summary class="details-summary admin__collapsible-title" id="details-summary<?= /* @noEscape */ $id ?>"> @@ -96,7 +96,7 @@ if ($isField) { <?= $element->getAdvancedChildrenHtml() ?> </div> </details> - <?php elseif ($element->hasAdvanced() && $isField): ?> + <?php elseif ($element->hasAdvanced() && $isField) : ?> <div class="nested" id="nested<?= /* @noEscape */ $id ?>"> <?= $element->getAdvancedChildrenHtml() ?> </div> @@ -107,11 +107,11 @@ if ($isField) { <?php endif; ?> - <?php if (!$element->getNoContainer() && !$advancedAfter): ?> + <?php if (!$element->getNoContainer() && !$advancedAfter) : ?> </fieldset> <?php endif; ?> -<?php if ($isWrapped): ?> +<?php if ($isWrapped) : ?> </div> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml index 256ec8394d532..bec6fe84fb2b1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml @@ -23,16 +23,16 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' . ($element->getFieldExtraAttributes() ? ' ' . $element->getFieldExtraAttributes() : ''); ?> -<?php if (!$element->getNoDisplay()): ?> - <?php if ($element->getType() == 'hidden'): ?> +<?php if (!$element->getNoDisplay()) : ?> + <?php if ($element->getType() == 'hidden') : ?> <?= $element->getElementHtml() ?> - <?php else: ?> + <?php else : ?> <div<?= /* @noEscape */ $fieldAttributes ?>> - <?php if ($elementBeforeLabel): ?> + <?php if ($elementBeforeLabel) : ?> <?= $element->getElementHtml() ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <?= /* @noEscape */ $note ?> - <?php else: ?> + <?php else : ?> <?= $element->getLabelHtml('', $element->getScopeLabel()) ?> <div class="admin__field-control control"> <?= /* @noEscape */ ($addOn) ? '<div class="admin__field">' . $element->getElementHtml() . '</div>' : $element->getElementHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index 1ff4c02f3b1a7..699025067c60f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -16,33 +16,33 @@ * */ /* @var $block \Magento\Backend\Block\Widget\Grid */ -$numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; +$numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0; ?> -<?php if ($block->getCollection()): ?> +<?php if ($block->getCollection()) : ?> -<?php if ($block->canDisplayContainer()): ?> + <?php if ($block->canDisplayContainer()) : ?> <div id="<?= $block->escapeHtml($block->getId()) ?>" data-grid-id="<?= $block->escapeHtml($block->getId()) ?>"> -<?php else: ?> + <?php else : ?> <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> -<?php endif; ?> + <?php endif; ?> <div class="admin__data-grid-header admin__data-grid-toolbar"> <?php $massActionAvailable = $block->getChildBlock('grid.massaction') && $block->getChildBlock('grid.massaction')->isAvailable() ?> - <?php if ($block->getPagerVisibility() || $block->getExportTypes() || $block->getChildBlock('grid.columnSet')->getFilterVisibility() || $massActionAvailable): ?> + <?php if ($block->getPagerVisibility() || $block->getExportTypes() || $block->getChildBlock('grid.columnSet')->getFilterVisibility() || $massActionAvailable) : ?> <div class="admin__data-grid-header-row"> - <?php if ($massActionAvailable): ?> + <?php if ($massActionAvailable) : ?> <?= $block->getMainButtonsHtml() ? '<div class="admin__filter-actions">' . $block->getMainButtonsHtml() . '</div>' : '' ?> <?php endif; ?> - <?php if ($block->getChildBlock('grid.export')): ?> + <?php if ($block->getChildBlock('grid.export')) : ?> <?= $block->getChildHtml('grid.export') ?> <?php endif; ?> </div> <?php endif; ?> - <div class="<?php if($massActionAvailable) { echo '_massaction ';} ?>admin__data-grid-header-row"> - <?php if ($massActionAvailable): ?> + <div class="<?php if ($massActionAvailable) { echo '_massaction ';} ?>admin__data-grid-header-row"> + <?php if ($massActionAvailable) : ?> <?= $block->getChildHtml('grid.massaction') ?> - <?php else: ?> + <?php else : ?> <?= $block->getMainButtonsHtml() ? '<div class="admin__filter-actions">' . $block->getMainButtonsHtml() . '</div>' : '' ?> <?php endif; ?> <?php $countRecords = $block->getCollection()->getSize(); ?> @@ -54,25 +54,25 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <span id="<?= $block->escapeHtml($block->getHtmlId()) ?>_massaction-count" class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= $block->escapeHtml(__('selected')) ?></span></span> </div> - <?php if ($block->getPagerVisibility()): ?> + <?php if ($block->getPagerVisibility()) : ?> <div class="admin__data-grid-pager-wrap"> <select name="<?= $block->escapeHtmlAttr($block->getVarNameLimit()) ?>" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" <?= /* @noEscape */ $block->getUiId('per-page') ?> class="admin__control-select"> - <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> + <option value="20"<?php if ($block->getCollection()->getPageSize() == 20) : ?> selected="selected"<?php endif; ?>>20 </option> - <option value="30"<?php if ($block->getCollection()->getPageSize() == 30): ?> + <option value="30"<?php if ($block->getCollection()->getPageSize() == 30) : ?> selected="selected"<?php endif; ?>>30 </option> - <option value="50"<?php if ($block->getCollection()->getPageSize() == 50): ?> + <option value="50"<?php if ($block->getCollection()->getPageSize() == 50) : ?> selected="selected"<?php endif; ?>>50 </option> - <option value="100"<?php if ($block->getCollection()->getPageSize() == 100): ?> + <option value="100"<?php if ($block->getCollection()->getPageSize() == 100) : ?> selected="selected"<?php endif; ?>>100 </option> - <option value="200"<?php if ($block->getCollection()->getPageSize() == 200): ?> + <option value="200"<?php if ($block->getCollection()->getPageSize() == 200) : ?> selected="selected"<?php endif; ?>>200 </option> </select> @@ -82,13 +82,13 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; <?php $_curPage = $block->getCollection()->getCurPage() ?> <?php $_lastPage = $block->getCollection()->getLastPageNumber() ?> - <?php if ($_curPage > 1): ?> + <?php if ($_curPage > 1) : ?> <button class="action-previous" type="button" onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> - <?php else: ?> + <?php else : ?> <button type="button" class="action-previous disabled"><span><?= $block->escapeHtml(__('Previous page')) ?></span></button> <?php endif; ?> @@ -103,13 +103,13 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; ?>_page-current"> <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> </label> - <?php if ($_curPage < $_lastPage): ?> + <?php if ($_curPage < $_lastPage) : ?> <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> - <?php else: ?> + <?php else : ?> <button type="button" class="action-next disabled"><span><?= $block->escapeHtml(__('Next page')) ?></span></button> <?php endif; ?> </div> @@ -118,77 +118,77 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; </div> </div> <div class="admin__data-grid-wrap admin__data-grid-wrap-static"> - <?php if ($block->getGridCssClass()): ?> + <?php if ($block->getGridCssClass()) : ?> <table class="<?= $block->escapeHtmlAttr($block->getGridCssClass()) ?> data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> <!-- Rendering column set --> <?= $block->getChildHtml('grid.columnSet') ?> </table> - <?php else: ?> + <?php else : ?> <table class="data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> <!-- Rendering column set --> <?= $block->getChildHtml('grid.columnSet') ?> </table> - <?php if ($block->getChildBlock('grid.bottom.links')): ?> + <?php if ($block->getChildBlock('grid.bottom.links')) : ?> <?= $block->getChildHtml('grid.bottom.links') ?> <?php endif; ?> <?php endif ?> </div> -<?php if ($block->canDisplayContainer()): ?> + <?php if ($block->canDisplayContainer()) : ?> </div> <script> var deps = []; - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> deps.push('uiRegistry'); - <?php endif; ?> + <?php endif; ?> - <?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?> + <?php if (strpos($block->getRowClickCallback(), 'order.') !== false) : ?> deps.push('Magento_Sales/order/create/form'); deps.push('jquery'); - <?php endif; ?> + <?php endif; ?> deps.push('mage/adminhtml/grid'); require(deps, function(<?= ($block->getDependencyJsObject() ? 'registry' : '') ?>){ <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { <?php endif; ?> <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = <?= /* @noEscape */ $block->getUseAjax() ? 'true' : 'false' ?>; - <?php if ($block->getRowClickCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; + <?php if ($block->getRowClickCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; <?php endif; ?> - <?php if ($block->getCheckboxCheckCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; + <?php if ($block->getCheckboxCheckCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> - <?php if ($block->getSortableUpdateCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.sortableUpdateCallback = <?= /* @noEscape */ $block->getSortableUpdateCallback() ?>; + <?php if ($block->getSortableUpdateCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.sortableUpdateCallback = <?= /* @noEscape */ $block->getSortableUpdateCallback() ?>; <?php endif; ?> <?= $block->escapeJs($block->getJsObjectName()) ?>.bindSortable(); - <?php if ($block->getRowInitCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; - <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); + <?php if ($block->getRowInitCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); <?php endif; ?> - <?php if ($block->getChildBlock('grid.massaction') && $block->getChildBlock('grid.massaction')->isAvailable()): ?> - <?= /* @noEscape */ $block->getChildBlock('grid.massaction')->getJavaScript() ?> + <?php if ($block->getChildBlock('grid.massaction') && $block->getChildBlock('grid.massaction')->isAvailable()) : ?> + <?= /* @noEscape */ $block->getChildBlock('grid.massaction')->getJavaScript() ?> <?php endif ?> <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> }); <?php endif; ?> }); </script> <?php endif; ?> -<?php if ($block->getChildBlock('grid.js')): ?> - <?= $block->getChildHtml('grid.js') ?> -<?php endif; ?> + <?php if ($block->getChildBlock('grid.js')): ?> + <?= $block->getChildHtml('grid.js') ?> + <?php endif; ?> <?php endif ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml index 7aa82306d6dab..36dad697347ba 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml @@ -9,32 +9,32 @@ * Template for \Magento\Backend\Block\Widget\Grid\ColumnSet * @var $block \Magento\Backend\Block\Widget\Grid\ColumnSet */ -$numColumns = sizeof($block->getColumns()); +$numColumns = count($block->getColumns()); ?> -<?php if ($block->getCollection()): ?> +<?php if ($block->getCollection()) : ?> <?php /* This part is commented to remove all <col> tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> <col <?= $_column->getHtmlProperty() ?> /> <?php endforeach; */ ?> - <?php if ($block->isHeaderVisible()): ?> + <?php if ($block->isHeaderVisible()) : ?> <thead> - <?php if ($block->isHeaderVisible() || $block->getFilterVisibility()): ?> + <?php if ($block->isHeaderVisible() || $block->getFilterVisibility()) : ?> <tr> - <?php foreach ($block->getColumns() as $_column): ?> - <?php /* @var $_column \Magento\Backend\Block\Widget\Grid\Column */ ?> - <?php if ($_column->getHeaderHtml() == ' '):?> + <?php foreach ($block->getColumns() as $_column) : ?> + <?php /* @var $_column \Magento\Backend\Block\Widget\Grid\Column */ ?> + <?php if ($_column->getHeaderHtml() == ' ') :?> <th class="data-grid-th" data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> </th> - <?php else: ?> + <?php else : ?> <?= $_column->getHeaderHtml() ?> <?php endif; ?> <?php endforeach; ?> </tr> <?php endif; ?> - <?php if ($block->isFilterVisible()): ?> + <?php if ($block->isFilterVisible()) : ?> <tr class="data-grid-filters" data-role="filter-form"> - <?php $i = 0; foreach ($block->getColumns() as $_column): ?> + <?php $i = 0; foreach ($block->getColumns() as $_column) : ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> <?= $_column->getFilterHtml() ?> </td> @@ -46,70 +46,71 @@ $numColumns = sizeof($block->getColumns()); <tbody> - <?php if ($block->getCollection()->getSize() > 0 && !$block->getIsCollapsed()): ?> - <?php foreach ($block->getCollection() as $_index => $_item): ?> - <?php if ($block->hasMultipleRows($_item)) :?> - <?php $block->updateItemByFirstMultiRow($_item); ?> + <?php if ($block->getCollection()->getSize() > 0 && !$block->getIsCollapsed()) : ?> + <?php foreach ($block->getCollection() as $_index => $_item) : ?> + <?php if ($block->hasMultipleRows($_item)) :?> + <?php $block->updateItemByFirstMultiRow($_item); ?> <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>" data-role="row" - <?php if ($_class = $block->getRowClass($_item)):?> class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif;?> - ><?php $i = 0; foreach ($block->getColumns() as $_column): - if ($block->shouldRenderCell($_item, $_column)): + <?php if ($_class = $block->getRowClass($_item)) :?> class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif;?> + ><?php $i = 0; foreach ($block->getColumns() as $_column) : + if ($block->shouldRenderCell($_item, $_column)) : $_rowspan = $block->getRowspan($_item, $_column); - ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" - <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> + ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" + <?= /* @noEscape */ ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php - if ($block->shouldRenderEmptyCell($_item, $_column)):?> + if ($block->shouldRenderEmptyCell($_item, $_column)) :?> <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"> <?= $block->escapeHtml($block->getEmptyCellLabel()) ?> </td><?php endif; endif; endforeach; - ?></tr> - <?php $_isFirstRow = true; ?> - <?php foreach ($block->getMultipleRows($_item) as $_i):?> - <?php if ($_isFirstRow) : ?> - <?php $_isFirstRow = false; continue; ?> - <?php endif; ?> +?></tr> + <?php $_isFirstRow = true; ?> + <?php foreach ($block->getMultipleRows($_item) as $_i) : ?> + <?php if ($_isFirstRow) : ?> + <?php + $_isFirstRow = false; + continue; + ?> + <?php endif; ?> <tr data-role="row"> - <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column): + <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column) : ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns-1 ? 'last' : '' ?>" > - <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> + <?= /* @noEscape */ (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td><?php endforeach; ?> </tr> <?php endforeach;?> - <?php if ($block->shouldRenderSubTotal($_item)): ?> + <?php if ($block->shouldRenderSubTotal($_item)) : ?> <tr class="subtotals"> - <?php $i = 0; foreach ($block->getMultipleRowColumns() as $_column): ?> + <?php $i = 0; foreach ($block->getMultipleRowColumns() as $_column) : ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > - <?php /* @noEscape */ echo $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() - : $_column->getRowField($block->getSubTotals($_item)); - ?> + <?= /* @noEscape */ $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotals($_item)) ?> </td> <?php endforeach; ?> </tr> <?php endif; ?> - <?php else: ?> - <tr data-role="row" title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)):?> + <?php else : ?> + <tr data-role="row" title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)) : ?> class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif;?> > - <?php $i = 0; foreach ($block->getColumns() as $_column): ?> - <?php if ($block->shouldRenderCell($_item, $_column)):?> + <?php $i = 0; foreach ($block->getColumns() as $_column) : ?> + <?php if ($block->shouldRenderCell($_item, $_column)) : ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > - <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> + <?= /* @noEscape */ (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td> - <?php if ($block->shouldRenderEmptyCell($_item, $_column)):?> + <?php if ($block->shouldRenderEmptyCell($_item, $_column)) : ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="col-no-records <?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?> last" @@ -122,7 +123,7 @@ $numColumns = sizeof($block->getColumns()); </tr> <?php endif; ?> <?php endforeach; ?> - <?php elseif ($block->getEmptyText()): ?> + <?php elseif ($block->getEmptyText()) : ?> <tr class="data-grid-tr-no-data" data-role="row"> <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></td> @@ -130,15 +131,14 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> </tbody> - <?php if ($block->shouldRenderTotal()): ?> + <?php if ($block->shouldRenderTotal()) : ?> <tfoot> <tr class="totals" data-role="row"> - <?php foreach ($block->getColumns() as $_column): ?> + <?php foreach ($block->getColumns() as $_column) : ?> <th data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>" > - <?php /* @noEscape */ echo($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() - : $_column->getRowField($block->getTotals()) ?> + <?= /* @noEscape */ ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($block->getTotals()) ?> </th> <?php endforeach; ?> </tr> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml index c5fad3929101a..6a8ec2a934ca4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/container.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ ?> -<?php if ($block->getButtonsHtml()): ?> +<?php if ($block->getButtonsHtml()) : ?> <div data-mage-init='{"floatingHeader": {}}' class="page-actions"><?= $block->getButtonsHtml() ?></div> <?php endif; ?> <?= $block->getGridHtml() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml index d9815a2bbff01..e70b93d0afc10 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/export.phtml @@ -9,7 +9,7 @@ <?= $block->escapeHtml(__('Export to:')) ?> </label> <select name="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_export" class="admin__control-select"> - <?php foreach ($block->getExportTypes() as $_type): ?> + <?php foreach ($block->getExportTypes() as $_type) : ?> <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= $block->escapeHtml($_type->getLabel()) ?></option> <?php endforeach; ?> </select> From ba70aa92769fbbf66edb3f126e7432ca86dff0b9 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Wed, 29 May 2019 10:01:50 +0300 Subject: [PATCH 247/464] MAGETWO-99460: Custom status overrides standard state in dropdowns after being assigned --- .../testsuite/Magento/Sales/Model/Order/ConfigTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php index 4b36d7a574140..b1c9b22772cf8 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Sales\Model\Order; use Magento\TestFramework\Helper\Bootstrap; @@ -21,7 +23,7 @@ class ConfigTest extends \PHPUnit\Framework\TestCase /** * @var Config */ - protected $orderConfig; + private $orderConfig; /** * @inheritdoc From c3ed281a4d1ec5ee6fe61c8c581e183d575dad8f Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk <vova.yatsyuk@gmail.com> Date: Wed, 29 May 2019 10:46:25 +0300 Subject: [PATCH 248/464] Don't create a new account-nav block - use existing instead. Account navigation block is already created by Magento_Customer module in Magento/Customer/view/frontend/layout/customer_account.xml layout update file. --- .../layout/customer_account.xml | 52 +++---------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml b/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml index 5ef5dcac1131d..21f22459e1a98 100644 --- a/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml +++ b/app/design/frontend/Magento/luma/Magento_Customer/layout/customer_account.xml @@ -7,52 +7,12 @@ --> <page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> - <referenceContainer name="sidebar.main"> - <block class="Magento\Framework\View\Element\Template" name="customer_account_navigation_block" template="Magento_Theme::html/collapsible.phtml" before="-"> - <arguments> - <argument name="block_title" translate="true" xsi:type="string">My Account</argument> - <argument name="block_css" xsi:type="string">block-collapsible-nav</argument> - </arguments> - <block class="Magento\Customer\Block\Account\Navigation" name="customer_account_navigation" before="-"> - <arguments> - <argument name="css_class" xsi:type="string">nav items</argument> - </arguments> - <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-link"> - <arguments> - <argument name="label" xsi:type="string" translate="true">My Account</argument> - <argument name="path" xsi:type="string">customer/account</argument> - <argument name="sortOrder" xsi:type="number">250</argument> - </arguments> - </block> - <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-1" - template="Magento_Customer::account/navigation-delimiter.phtml"> - <arguments> - <argument name="sortOrder" xsi:type="number">200</argument> - </arguments> - </block> - <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-address-link"> - <arguments> - <argument name="label" xsi:type="string" translate="true">Address Book</argument> - <argument name="path" xsi:type="string">customer/address</argument> - <argument name="sortOrder" xsi:type="number">190</argument> - </arguments> - </block> - <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-edit-link"> - <arguments> - <argument name="label" xsi:type="string" translate="true">Account Information</argument> - <argument name="path" xsi:type="string">customer/account/edit</argument> - <argument name="sortOrder" xsi:type="number">180</argument> - </arguments> - </block> - <block class="Magento\Customer\Block\Account\Delimiter" name="customer-account-navigation-delimiter-2" - template="Magento_Customer::account/navigation-delimiter.phtml"> - <arguments> - <argument name="sortOrder" xsi:type="number">130</argument> - </arguments> - </block> - </block> - </block> - </referenceContainer> + <referenceBlock name="sidebar.main.account_nav"> + <arguments> + <argument name="block_title" translate="true" xsi:type="string">My Account</argument> + <argument name="block_css" xsi:type="string">block-collapsible-nav</argument> + </arguments> + </referenceBlock> <move element="page.main.title" destination="content.top" before="-"/> </body> </page> From 199887d9d4fcc8540c84c9342aeef4915b057491 Mon Sep 17 00:00:00 2001 From: Ash Smith <ash.smith@playsportsnetwork.com> Date: Wed, 29 May 2019 11:41:05 +0100 Subject: [PATCH 249/464] Add more descriptive exception when data patch fails to apply. Resolves #23045 --- .../Magento/Framework/Setup/Patch/PatchApplier.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php index d81d36d383f67..0f62a9081a3f2 100644 --- a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php +++ b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php @@ -164,7 +164,17 @@ public function applyDataPatch($moduleName = null) $this->moduleDataSetup->getConnection()->commit(); } catch (\Exception $e) { $this->moduleDataSetup->getConnection()->rollBack(); - throw new Exception(new Phrase($e->getMessage())); + throw new Exception( + new Phrase( + 'Unable to apply data patch %1 for module %2. Original exception message: %3', + [ + get_class($dataPatch), + $moduleName, + $e->getMessage() + ] + ), + $e + ); } finally { unset($dataPatch); } From d9282d8b71410cfa43b3b4d54f4d104568cb2562 Mon Sep 17 00:00:00 2001 From: p-bystritsky <p-bystritsky@users.noreply.github.com> Date: Mon, 27 May 2019 17:08:17 +0300 Subject: [PATCH 250/464] magento/magento2#22933: Apply suggestions from code review Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com> --- app/code/Magento/Catalog/Model/ProductRepository.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 91a2ac1c5e1e8..e961db42d99fe 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -574,7 +574,7 @@ public function save(ProductInterface $product, $saveOptions = false) ); } $this->removeProductFromLocalCacheBySku($product->getSku()); - unset($this->instancesById[$product->getId()]); + $this->removeProductFromLocalCacheById($product->getId()); return $this->get($product->getSku(), false, $product->getStoreId()); } @@ -588,7 +588,7 @@ public function delete(ProductInterface $product) $productId = $product->getId(); try { $this->removeProductFromLocalCacheBySku($product->getSku()); - unset($this->instancesById[$product->getId()]); + $this->removeProductFromLocalCacheById($product->getId()); $this->resourceModel->delete($product); } catch (ValidatorException $e) { throw new CouldNotSaveException(__($e->getMessage()), $e); @@ -599,7 +599,7 @@ public function delete(ProductInterface $product) ); } $this->removeProductFromLocalCacheBySku($sku); - unset($this->instancesById[$productId]); + $this->removeProductFromLocalCacheById($productId); return true; } @@ -770,10 +770,10 @@ private function removeProductFromLocalCacheBySku(string $sku): void /** * Removes product in the local cache by id. * - * @param string $id + * @param string|null $id * @return void */ - private function removeProductFromLocalCacheById(string $id): void + private function removeProductFromLocalCacheById(?string $id): void { unset($this->instancesById[$id]); } @@ -815,7 +815,7 @@ private function saveProduct($product): void { try { $this->removeProductFromLocalCacheBySku($product->getSku()); - unset($this->instancesById[$product->getId()]); + $this->removeProductFromLocalCacheById($product->getId()); $this->resourceModel->save($product); } catch (ConnectionException $exception) { throw new TemporaryCouldNotSaveException( From d45affe16bec7685eb29c2a29103079d2e7e24a8 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Wed, 29 May 2019 09:35:36 -0500 Subject: [PATCH 251/464] MC-16864: Load critical css to head --- .../Theme/Block/Html/Header/CriticalCss.php | 14 ++++++++++---- app/code/Magento/Theme/etc/frontend/di.xml | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 745451d1100ae..458b80be0458f 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -12,10 +12,8 @@ use Magento\Framework\View\Asset\Repository; /** - * Block will add inline critical css + * This block will add inline critical css * in case dev/css/use_css_critical_path is enabled - * - * @package Magento\Theme\Block\Html\Header */ class CriticalCss extends Template { @@ -24,17 +22,25 @@ class CriticalCss extends Template */ private $assetRepo; + /** + * @var $filePath + */ + private $filePath; + /** * @param Template\Context $context * @param Repository $assetRepo + * @param string $filePath * @param array $data */ public function __construct( Template\Context $context, Repository $assetRepo, + string $filePath = '', array $data = [] ) { $this->assetRepo = $assetRepo; + $this->filePath = $filePath; parent::__construct($context, $data); } @@ -45,7 +51,7 @@ public function __construct( */ public function getCriticalCssData() { - $asset = $this->assetRepo->createAsset('css/critical.css', ['_secure' => 'false']); + $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); return $content; diff --git a/app/code/Magento/Theme/etc/frontend/di.xml b/app/code/Magento/Theme/etc/frontend/di.xml index 35fde84f8001f..75f0b5af9272c 100644 --- a/app/code/Magento/Theme/etc/frontend/di.xml +++ b/app/code/Magento/Theme/etc/frontend/di.xml @@ -30,4 +30,9 @@ <plugin name="result-js-footer" type="Magento\Theme\Controller\Result\JsFooterPlugin"/> <plugin name="asyncCssLoad" type="Magento\Theme\Controller\Result\AsyncCssPlugin"/> </type> + <type name="Magento\Theme\Block\Html\Header\CriticalCss"> + <arguments> + <item name="filePath" xsi:type="string">css/critical.css</item> + </arguments> + </type> </config> From 76e02303c33b039361b39b8251cd8b4dd58f0383 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 29 May 2019 10:18:11 -0500 Subject: [PATCH 252/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../templates/widget/grid/extended.phtml | 147 +++++++++--------- .../templates/widget/grid/massaction.phtml | 12 +- .../widget/grid/massaction_extended.phtml | 12 +- .../templates/widget/grid/serializer.phtml | 7 +- .../adminhtml/templates/widget/tabs.phtml | 15 +- .../templates/widget/tabshoriz.phtml | 14 +- .../adminhtml/templates/widget/tabsleft.phtml | 4 +- .../Controller/Adminhtml/Locks/IndexTest.php | 3 + 8 files changed, 110 insertions(+), 104 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index bde05df363ab4..f650a2909e693 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -14,34 +14,34 @@ * getPagerVisibility() * getVarNamePage() */ -$numColumns = sizeof($block->getColumns()); +$numColumns = count($block->getColumns()); /** * @var \Magento\Backend\Block\Widget\Grid\Extended $block */ ?> -<?php if ($block->getCollection()): ?> - <?php if ($block->canDisplayContainer()): ?> +<?php if ($block->getCollection()) : ?> + <?php if ($block->canDisplayContainer()) : ?> <div id="<?= $block->escapeHtml($block->getId()) ?>" data-grid-id="<?= $block->escapeHtml($block->getId()) ?>"> - <?php else: ?> + <?php else : ?> <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> <?php $massActionAvailable = $block->getMassactionBlock() && $block->getMassactionBlock()->isAvailable() ?> - <?php if ($block->getPagerVisibility() || $block->getExportTypes() || $block->getFilterVisibility() || $massActionAvailable): ?> + <?php if ($block->getPagerVisibility() || $block->getExportTypes() || $block->getFilterVisibility() || $massActionAvailable) : ?> <div class="admin__data-grid-header admin__data-grid-toolbar"> <div class="admin__data-grid-header-row"> - <?php if ($massActionAvailable): ?> + <?php if ($massActionAvailable) : ?> <?= $block->getMainButtonsHtml() ? '<div class="admin__filter-actions">' . $block->getMainButtonsHtml() . '</div>' : '' ?> <?php endif; ?> - <?php if ($block->getExportTypes()): ?> + <?php if ($block->getExportTypes()) : ?> <div class="admin__data-grid-export"> <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getId()) ?>_export"><?= $block->escapeHtml(__('Export to:')) ?></label> <select name="<?= $block->escapeHtml($block->getId()) ?>_export" id="<?= $block->escapeHtml($block->getId()) ?>_export" class="admin__control-select"> - <?php foreach ($block->getExportTypes() as $_type): ?> + <?php foreach ($block->getExportTypes() as $_type) : ?> <option value="<?= $block->escapeHtmlAttr($_type->getUrl()) ?>"><?= $block->escapeHtml($_type->getLabel()) ?></option> <?php endforeach; ?> </select> @@ -51,9 +51,9 @@ $numColumns = sizeof($block->getColumns()); </div> <div class="admin__data-grid-header-row <?= $massActionAvailable ? '_massaction' : '' ?>"> - <?php if ($massActionAvailable): ?> + <?php if ($massActionAvailable) : ?> <?= $block->getMassactionBlockHtml() ?> - <?php else: ?> + <?php else : ?> <?= $block->getMainButtonsHtml() ? '<div class="admin__filter-actions">' . $block->getMainButtonsHtml() . '</div>' : '' ?> <?php endif; ?> <?php $countRecords = $block->getCollection()->getSize(); ?> @@ -66,25 +66,25 @@ $numColumns = sizeof($block->getColumns()); class="mass-select-info _empty"><strong data-role="counter">0</strong> <span><?= $block->escapeHtml(__('selected')) ?></span></span> </div> - <?php if ($block->getPagerVisibility()): ?> + <?php if ($block->getPagerVisibility()) : ?> <div class="admin__data-grid-pager-wrap"> <select name="<?= $block->escapeHtmlAttr($block->getVarNameLimit()) ?>" id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" onchange="<?= /* @noEscape */ $block->getJsObjectName() ?>.loadByElement(this)" class="admin__control-select"> - <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> + <option value="20"<?php if ($block->getCollection()->getPageSize() == 20) : ?> selected="selected"<?php endif; ?>>20 </option> - <option value="30"<?php if ($block->getCollection()->getPageSize() == 30): ?> + <option value="30"<?php if ($block->getCollection()->getPageSize() == 30) : ?> selected="selected"<?php endif; ?>>30 </option> - <option value="50"<?php if ($block->getCollection()->getPageSize() == 50): ?> + <option value="50"<?php if ($block->getCollection()->getPageSize() == 50) : ?> selected="selected"<?php endif; ?>>50 </option> - <option value="100"<?php if ($block->getCollection()->getPageSize() == 100): ?> + <option value="100"<?php if ($block->getCollection()->getPageSize() == 100) : ?> selected="selected"<?php endif; ?>>100 </option> - <option value="200"<?php if ($block->getCollection()->getPageSize() == 200): ?> + <option value="200"<?php if ($block->getCollection()->getPageSize() == 200) : ?> selected="selected"<?php endif; ?>>200 </option> </select> @@ -94,13 +94,13 @@ $numColumns = sizeof($block->getColumns()); <div class="admin__data-grid-pager"> <?php $_curPage = $block->getCollection()->getCurPage() ?> <?php $_lastPage = $block->getCollection()->getLastPageNumber() ?> - <?php if ($_curPage > 1): ?> + <?php if ($_curPage > 1) : ?> <button class="action-previous" type="button" onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage - 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Previous page')) ?></span> </button> - <?php else: ?> + <?php else : ?> <button type="button" class="action-previous disabled"><span><?= $block->escapeHtml(__('Previous page')) ?></span></button> <?php endif; ?> <input type="text" @@ -112,14 +112,14 @@ $numColumns = sizeof($block->getColumns()); <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> <?= /* @noEscape */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> </label> - <?php if ($_curPage < $_lastPage): ?> + <?php if ($_curPage < $_lastPage) : ?> <button type="button" title="<?= $block->escapeHtml(__('Next page')) ?>" class="action-next" onclick="<?= /* @noEscape */ $block->getJsObjectName() ?>.setPage('<?= /* @noEscape */ ($_curPage + 1) ?>');return false;"> <span><?= $block->escapeHtml(__('Next page')) ?></span> </button> - <?php else: ?> + <?php else : ?> <button type="button" class="action-next disabled"><span><?= $block->escapeHtml(__('Next page')) ?></span></button> <?php endif; ?> </div> @@ -137,24 +137,24 @@ $numColumns = sizeof($block->getColumns()); <col <?= $_column->getHtmlProperty() ?> /> <?php endforeach; */ ?> - <?php if ($block->getHeadersVisibility() || $block->getFilterVisibility()): ?> + <?php if ($block->getHeadersVisibility() || $block->getFilterVisibility()) : ?> <thead> - <?php if ($block->getHeadersVisibility()): ?> + <?php if ($block->getHeadersVisibility()) : ?> <tr> - <?php foreach ($block->getColumns() as $_column): ?> - <?php if ($_column->getHeaderHtml() == ' '):?> + <?php foreach ($block->getColumns() as $_column) : ?> + <?php if ($_column->getHeaderHtml() == ' ') : ?> <th class="data-grid-th" data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> </th> - <?php else: ?> + <?php else : ?> <?= $_column->getHeaderHtml() ?> <?php endif; ?> <?php endforeach; ?> </tr> <?php endif; ?> - <?php if ($block->getFilterVisibility()): ?> + <?php if ($block->getFilterVisibility()) : ?> <tr class="data-grid-filters" data-role="filter-form"> <?php $i = 0; - foreach ($block->getColumns() as $_column): ?> + foreach ($block->getColumns() as $_column) : ?> <td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" <?= $_column->getHeaderHtmlProperty() ?>> <?= $_column->getFilterHtml() ?> </td> @@ -163,10 +163,10 @@ $numColumns = sizeof($block->getColumns()); <?php endif ?> </thead> <?php endif; ?> - <?php if ($block->getCountTotals()): ?> + <?php if ($block->getCountTotals()) : ?> <tfoot> <tr class="totals"> - <?php foreach ($block->getColumns() as $_column): ?> + <?php foreach ($block->getColumns() as $_column) : ?> <th class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?>"> <?= /* @noEscape */ ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> </th> @@ -176,21 +176,21 @@ $numColumns = sizeof($block->getColumns()); <?php endif; ?> <tbody> - <?php if (($block->getCollection()->getSize() > 0) && (!$block->getIsCollapsed())): ?> - <?php foreach ($block->getCollection() as $_index => $_item): ?> - <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)): ?> + <?php if (($block->getCollection()->getSize() > 0) && (!$block->getIsCollapsed())) : ?> + <?php foreach ($block->getCollection() as $_index => $_item) : ?> + <tr title="<?= $block->escapeHtmlAttr($block->getRowUrl($_item)) ?>"<?php if ($_class = $block->getRowClass($_item)) : ?> class="<?= $block->escapeHtmlAttr($_class) ?>"<?php endif; ?> ><?php $i = 0; - foreach ($block->getColumns() as $_column): - if ($block->shouldRenderCell($_item, $_column)): + foreach ($block->getColumns() as $_column) : + if ($block->shouldRenderCell($_item, $_column)) : $_rowspan = $block->getRowspan($_item, $_column); ?> - <td <?= ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> + <td <?= /* @noEscape */ ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> - <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> + <?= /* @noEscape */ (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php - if ($block->shouldRenderEmptyCell($_item, $_column)): + if ($block->shouldRenderEmptyCell($_item, $_column)) : ?> <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"><?= $block->escapeHtml($block->getEmptyCellLabel()) ?></td><?php @@ -198,36 +198,33 @@ $numColumns = sizeof($block->getColumns()); endif; endforeach; ?> </tr> - <?php if ($_multipleRows = $block->getMultipleRows($_item)): ?> - <?php foreach ($_multipleRows as $_i): ?> + <?php if ($_multipleRows = $block->getMultipleRows($_item)) : ?> + <?php foreach ($_multipleRows as $_i) : ?> <tr> <?php $i = 0; - foreach ($block->getMultipleRowColumns($_i) as $_column): ?> + foreach ($block->getMultipleRowColumns($_i) as $_column) : ?> <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> - <?= (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> + <?= /* @noEscape */ (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?> </td> <?php endforeach; ?> </tr> <?php endforeach; ?> <?php endif; ?> - <?php if ($block->shouldRenderSubTotal($_item)): ?> + <?php if ($block->shouldRenderSubTotal($_item)) : ?> <tr class="subtotals"> <?php $i = 0; - foreach ($block->getSubTotalColumns() as $_column): ?> + foreach ($block->getSubTotalColumns() as $_column) : ?> <td class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?>"> - <?php /* @noEscape */ echo($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : - $_column->getRowField($block->getSubTotalItem($_item)) - ); - ?> + <?= /* @noEscape */ $_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() : $_column->getRowField($block->getSubTotalItem($_item)) ?> </td> <?php endforeach; ?> </tr> <?php endif; ?> <?php endforeach; ?> - <?php elseif ($block->getEmptyText()): ?> + <?php elseif ($block->getEmptyText()) : ?> <tr class="data-grid-tr-no-data"> <td class="<?= $block->escapeHtmlAttr($block->getEmptyTextClass()) ?>" colspan="<?= $block->escapeHtmlAttr($numColumns) ?>"><?= $block->escapeHtml($block->getEmptyText()) ?></td> @@ -237,55 +234,55 @@ $numColumns = sizeof($block->getColumns()); </table> </div> - <?php if ($block->canDisplayContainer()): ?> + <?php if ($block->canDisplayContainer()) : ?> </div> <script> var deps = []; - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()): ?> deps.push('uiRegistry'); - <?php endif; ?> + <?php endif; ?> - <?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?> + <?php if (strpos($block->getRowClickCallback(), 'order.') !== false) : ?> deps.push('Magento_Sales/order/create/form') - <?php endif; ?> + <?php endif; ?> deps.push('mage/adminhtml/grid'); - <?php if (is_array($block->getRequireJsDependencies())): ?> - <?php foreach ($block->getRequireJsDependencies() as $dependency): ?> + <?php if (is_array($block->getRequireJsDependencies())) : ?> + <?php foreach ($block->getRequireJsDependencies() as $dependency) : ?> deps.push('<?= $block->escapeJs($dependency) ?>'); - <?php endforeach; ?> - <?php endif; ?> + <?php endforeach; ?> + <?php endif; ?> require(deps, function(<?= ($block->getDependencyJsObject() ? 'registry' : '') ?>){ <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> //<![CDATA[ - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { - <?php endif; ?> + <?php endif; ?> <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid(<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getId()) ?>, '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; - <?php if ($block->getRowClickCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; - <?php endif; ?> - <?php if ($block->getCheckboxCheckCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; - <?php endif; ?> - <?php if ($block->getRowInitCallback()): ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; - <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); - <?php endif; ?> - <?php if ($block->getMassactionBlock() && $block->getMassactionBlock()->isAvailable()): ?> - <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> - <?php endif ?> - <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> + <?php if ($block->getRowClickCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; + <?php endif; ?> + <?php if ($block->getCheckboxCheckCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; + <?php endif; ?> + <?php if ($block->getRowInitCallback()) : ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); + <?php endif; ?> + <?php if ($block->getMassactionBlock() && $block->getMassactionBlock()->isAvailable()) : ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> + <?php endif ?> + <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> }); - <?php endif; ?> + <?php endif; ?> //]]> }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml index 567c723a726cb..969d6cafda23a 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml @@ -25,13 +25,13 @@ <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-additional"></span> <?= $block->getApplyButtonHtml() ?> </div> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) :?> </form> <?php endif ?> <div class="no-display"> - <?php foreach ($block->getItems() as $_item): ?> + <?php foreach ($block->getItems() as $_item) : ?> <div id="<?= $block->getHtmlId() ?>-item-<?= /* @noEscape */ $_item->getId() ?>-block"> - <?php if ('' != $_item->getBlockName()):?> + <?php if ('' != $_item->getBlockName()) :?> <?= $block->getChildHtml($_item->getBlockName()) ?> <?php endif;?> </div> @@ -46,7 +46,7 @@ data-menu="grid-mass-select"> <optgroup label="<?= $block->escapeHtml(__('Mass Actions')) ?>"> <option disabled selected></option> - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) :?> <option value="selectAll"> <?= $block->escapeHtml(__('Select All')) ?> </option> @@ -75,7 +75,7 @@ var massAction = $('option:selected', this).val(); this.blur(); switch (massAction) { - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) : ?> case 'selectAll': return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break; @@ -92,7 +92,7 @@ } }); }); - <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> + <?php if (!$block->getParentBlock()->canDisplayContainer()) : ?> <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml index c10f62fbf25d9..cd2bbbffa7852 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml @@ -15,7 +15,7 @@ id="<?= $block->getHtmlId() ?>-select" class="required-entry local-validation admin__control-select"> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> - <?php foreach ($block->getItems() as $_item): ?> + <?php foreach ($block->getItems() as $_item) : ?> <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> @@ -23,11 +23,11 @@ <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-additional"></span> <?= $block->getApplyButtonHtml() ?> </div> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) : ?> </form> <?php endif ?> <div class="no-display"> - <?php foreach ($block->getItems() as $_item): ?> + <?php foreach ($block->getItems() as $_item) : ?> <div id="<?= $block->getHtmlId() ?>-item-<?= /* @noEscape */ $_item->getId() ?>-block"> <?= $_item->getAdditionalActionBlockHtml() ?> </div> @@ -40,7 +40,7 @@ data-menu="grid-mass-select"> <optgroup label="<?= $block->escapeHtml(__('Mass Actions')) ?>"> <option disabled selected></option> - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) : ?> <option value="selectAll"> <?= $block->escapeHtml(__('Select All')) ?> </option> @@ -64,7 +64,7 @@ $('#<?= $block->getHtmlId() ?>-mass-select').change(function () { var massAction = $('option:selected', this).val(); switch (massAction) { - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) : ?> case 'selectAll': return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break; @@ -83,7 +83,7 @@ }); }); - <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> + <?php if (!$block->getParentBlock()->canDisplayContainer()) : ?> <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml index 4bb92de5028ef..2208a00929592 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml @@ -9,9 +9,12 @@ * @var $block \Magento\Backend\Block\Widget\Grid\Serializer */ ?> -<?php $_id = 'id_' . md5(microtime()) ?> +<?php +// phpcs:ignore +$_id = 'id_' . md5(microtime()); +?> <?php $formId = $block->getFormId()?> -<?php if (!empty($formId)) :?> +<?php if (!empty($formId)) : ?> <script> require([ 'prototype', diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml index 043dce6b641c1..5246aac088a5b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml @@ -6,24 +6,27 @@ /** @var $block \Magento\Backend\Block\Widget\Tabs */ ?> -<?php if (!empty($tabs)): ?> +<?php if (!empty($tabs)) : ?> <div class="admin__page-nav" data-role="container" id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> - <?php if ($block->getTitle()): ?> + <?php if ($block->getTitle()) : ?> <div class="admin__page-nav-title" data-role="title" <?= /* @noEscape */ $block->getUiId('title') ?>> <strong><?= $block->escapeHtml($block->getTitle()) ?></strong> <span data-role="title-messages" class="admin__page-nav-title-messages"></span> </div> <?php endif ?> <ul <?= /* @noEscape */ $block->getUiId('tab', $block->getId()) ?> class="<?= /* @noEscape */ $block->getIsHoriz() ? 'tabs-horiz' : 'tabs admin__page-nav-items' ?>"> - <?php foreach ($tabs as $_tab): ?> - - <?php if (!$block->canShowTab($_tab)): continue; endif; ?> + <?php foreach ($tabs as $_tab) : ?> + <?php + if (!$block->canShowTab($_tab)) : + continue; + endif; + ?> <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> - <li class="admin__page-nav-item" <?php if ($block->getTabIsHidden($_tab)): ?> style="display:none"<?php endif; ?><?= /* @noEscape */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> + <li class="admin__page-nav-item" <?php if ($block->getTabIsHidden($_tab)) : ?> style="display:none"<?php endif; ?><?= /* @noEscape */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> <a href="<?= $block->escapeUrl($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" name="<?= $block->escapeHtmlAttr($block->getTabId($_tab, false)) ?>" title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" class="admin__page-nav-link <?= $block->escapeHtmlAttr($_tabClass) ?>" data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>" diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml index 7b221833e55b2..164f18ad8f45d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ ?> -<!-- <?php if ($block->getTitle()): ?> +<!-- <?php if ($block->getTitle()) : ?> <h3><?= $block->escapeHtml($block->getTitle()) ?></h3> <?php endif ?> --> -<?php if (!empty($tabs)): ?> +<?php if (!empty($tabs)) : ?> <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> <ul class="tabs-horiz"> -<?php foreach ($tabs as $_tab): ?> - <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> - <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> - <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> + <?php foreach ($tabs as $_tab) : ?> + <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> + <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> + <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> <li> <a href="<?= $block->escapeHtmlAttr($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" class="<?= $block->escapeHtmlAttr($_tabClass) ?>" data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>"> <span> @@ -25,7 +25,7 @@ </a> <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" style="display:none"><?= /* @noEscape */ $block->getTabContent($_tab) ?></div> </li> -<?php endforeach; ?> + <?php endforeach; ?> </ul> </div> <script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml index e06b93f563167..4f69191e79763 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabsleft.phtml @@ -5,13 +5,13 @@ */ ?> <dl id="dl-<?= /* @noEscape */ $id ?>" class="accordion"> -<?php foreach ($sections as $sectionId => $section): ?> +<?php foreach ($sections as $sectionId => $section) : ?> <dt id="dt-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $sectionId ?>"> <strong><?= $block->escapeHtml($section['title']) ?></strong> </dt> <dd id="dd-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $section['id'] ?>" class="section-menu <?= !empty($section['active']) ? 'open' : '' ?>"> <ul> - <?php foreach ($section['children'] as $menuId => $menuItem): ?> + <?php foreach ($section['children'] as $menuId => $menuItem) : ?> <li id="li-<?= /* @noEscape */ $id ?>-<?= /* @noEscape */ $sectionId ?>-<?= /* @noEscape */ $menuId ?>"> <a href="#" title="<?= $block->escapeHtmlAttr($menuItem['title']) ?>"> <span><?= $block->escapeHtml($menuItem['label']) ?></span> diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php index f2f8d2d124b07..59cb49c7831eb 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/Locks/IndexTest.php @@ -5,6 +5,9 @@ */ namespace Magento\User\Controller\Adminhtml\Locks; +/** + * Testing locked users list. + */ class IndexTest extends \Magento\TestFramework\TestCase\AbstractBackendController { /** From f8c05f105a5da4262a6e627e58a030fb2a483106 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Wed, 29 May 2019 10:21:12 -0500 Subject: [PATCH 253/464] MC-16864: Load critical css to head --- .../Magento/Theme/Block/Html/Header/CriticalCss.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 458b80be0458f..191593cb8916c 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -8,8 +8,10 @@ namespace Magento\Theme\Block\Html\Header; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Asset\Repository; +use Magento\Framework\View\Asset\File\NotFoundException; /** * This block will add inline critical css @@ -47,12 +49,17 @@ public function __construct( /** * Returns critical css data as string. * - * @return string + * @return bool|string + * @throws LocalizedException */ public function getCriticalCssData() { - $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); - $content = $asset->getContent(); + try { + $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); + $content = $asset->getContent(); + } catch (LocalizedException | NotFoundException $e) { + throw new LocalizedException(__("Cannot get critical css file data ", $e->getMessage())); + }; return $content; } From c0d920d12a7f172ad930b3ba17267398c4660f1e Mon Sep 17 00:00:00 2001 From: Ash Smith <ash.smith@playsportsnetwork.com> Date: Wed, 29 May 2019 13:39:56 +0100 Subject: [PATCH 254/464] Fix up code linting --- .../Framework/Setup/Patch/PatchApplier.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php index 0f62a9081a3f2..bdaca77e5b4eb 100644 --- a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php +++ b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php @@ -10,7 +10,7 @@ use Magento\Framework\Module\ModuleList; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Phrase; -use Magento\Framework\Setup\Exception; +use Magento\Framework\Setup\Exception as SetupException; use Magento\Framework\Setup\ModuleDataSetupInterface; /** @@ -129,8 +129,8 @@ public function __construct( /** * Apply all patches for one module * - * @param null | string $moduleName - * @throws Exception + * @param null|string $moduleName + * @throws SetupException */ public function applyDataPatch($moduleName = null) { @@ -149,7 +149,7 @@ public function applyDataPatch($moduleName = null) ['moduleDataSetup' => $this->moduleDataSetup] ); if (!$dataPatch instanceof DataPatchInterface) { - throw new Exception( + throw new SetupException( new Phrase("Patch %1 should implement DataPatchInterface", [get_class($dataPatch)]) ); } @@ -164,7 +164,7 @@ public function applyDataPatch($moduleName = null) $this->moduleDataSetup->getConnection()->commit(); } catch (\Exception $e) { $this->moduleDataSetup->getConnection()->rollBack(); - throw new Exception( + throw new SetupException( new Phrase( 'Unable to apply data patch %1 for module %2. Original exception message: %3', [ @@ -183,8 +183,7 @@ public function applyDataPatch($moduleName = null) } /** - * Register all patches in registry in order to manipulate chains and dependencies of patches - * of patches + * Register all patches in registry in order to manipulate chains and dependencies of patches of patches * * @param string $moduleName * @param string $patchType @@ -217,8 +216,8 @@ private function prepareRegistry($moduleName, $patchType) * * Please note: that schema patches are not revertable * - * @param null | string $moduleName - * @throws Exception + * @param null|string $moduleName + * @throws SetupException */ public function applySchemaPatch($moduleName = null) { @@ -239,7 +238,7 @@ public function applySchemaPatch($moduleName = null) $schemaPatch->apply(); $this->patchHistory->fixPatch(get_class($schemaPatch)); } catch (\Exception $e) { - throw new Exception( + throw new SetupException( new Phrase( 'Unable to apply patch %1 for module %2. Original exception message: %3', [ @@ -258,8 +257,8 @@ public function applySchemaPatch($moduleName = null) /** * Revert data patches for specific module * - * @param null | string $moduleName - * @throws Exception + * @param null|string $moduleName + * @throws SetupException */ public function revertDataPatches($moduleName = null) { @@ -280,7 +279,7 @@ public function revertDataPatches($moduleName = null) $adapter->commit(); } catch (\Exception $e) { $adapter->rollBack(); - throw new Exception(new Phrase($e->getMessage())); + throw new SetupException(new Phrase($e->getMessage())); } finally { unset($dataPatch); } From f5393e6f03b025ef6d04eed7350b3cef44a97b15 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Wed, 29 May 2019 10:50:51 -0500 Subject: [PATCH 255/464] MC-16864: Load critical css to head --- app/code/Magento/Theme/Block/Html/Header/CriticalCss.php | 6 +++++- .../Theme/view/frontend/layout/default_head_blocks.xml | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 191593cb8916c..587101d7fed59 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -55,10 +55,14 @@ public function __construct( public function getCriticalCssData() { try { + if ($this->filePath === '') { + throw new LocalizedException(__("Empty path for critical css")); + } + $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); } catch (LocalizedException | NotFoundException $e) { - throw new LocalizedException(__("Cannot get critical css file data ", $e->getMessage())); + throw new LocalizedException(__("Cannot get critical css file data: ", $e->getMessage())); }; return $content; diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 333c5fd2a85e1..6ff31de3303cd 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -14,9 +14,7 @@ </head> <body> <referenceBlock name="head.additional"> - <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="criticalCssContent" as="criticalCss" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> - </referenceBlock> - <referenceBlock name="head.additional"> + <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="critical_css_block" as="critical_css" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> <referenceContainer name="after.body.start"> From 24a7e4d417af5fa209382c86e623687d5672e230 Mon Sep 17 00:00:00 2001 From: Nikunj Shekhada <nikunjskd20@gmail.com> Date: Fri, 10 May 2019 06:57:09 +0000 Subject: [PATCH 256/464] 16445 - getRegionHtmlSelect does not have configuration - resolved --- app/code/Magento/Directory/Block/Data.php | 33 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 333e9e03706b9..d4c46469e4771 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Directory\Block; /** @@ -173,10 +175,33 @@ public function getRegionCollection() * Returns region html select * * @return string + * @deprecated + * @see getRegionSelect() method for more configurations */ public function getRegionHtmlSelect() { + return $this->getRegionSelect(); + } + + /** + * Returns region html select + * + * @param null|int $value + * @param string $name + * @param string $id + * @param string $title + * @return string + */ + public function getRegionSelect( + ?int $value = null, + string $name = 'region', + string $id = 'state', + string $title = 'State/Province' + ): string { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); + if ($value === null) { + $value = (int)$this->getRegionId(); + } $cacheKey = 'DIRECTORY_REGION_SELECT_STORE' . $this->_storeManager->getStore()->getId(); $cache = $this->_configCacheType->load($cacheKey); if ($cache) { @@ -188,15 +213,15 @@ public function getRegionHtmlSelect() $html = $this->getLayout()->createBlock( \Magento\Framework\View\Element\Html\Select::class )->setName( - 'region' + $name )->setTitle( - __('State/Province') + __($title) )->setId( - 'state' + $id )->setClass( 'required-entry validate-state' )->setValue( - (int)$this->getRegionId() + $value )->setOptions( $options )->getHtml(); From 6dd254b080998b1ca36931359409ebbfa39dbeeb Mon Sep 17 00:00:00 2001 From: Navarr Barnier <navarr@mediotype.com> Date: Wed, 29 May 2019 12:25:30 -0400 Subject: [PATCH 257/464] Remove API annotation from ModuleManagerInterface API Annotation should be added to the interface in Magento 2.4 --- .../Magento/Framework/Module/ModuleManagerInterface.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php index 464291a019c21..decc91200354d 100644 --- a/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php +++ b/lib/internal/Magento/Framework/Module/ModuleManagerInterface.php @@ -13,8 +13,6 @@ * ```php * $manager->isEnabled('Vendor_Module'); * ``` - * - * @api */ interface ModuleManagerInterface { From d36b769584231801341465b552a833856bbd98c9 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 29 May 2019 13:28:45 -0500 Subject: [PATCH 258/464] MC-170: Admin should be able to create new group in an Attribute Set --- .../Mftf/Data/CatalogAttributeGroupData.xml | 20 +++++++++++ .../Mftf/Section/AdminProductFormSection.xml | 1 + ...AdminCreateNewGroupForAttributeSetTest.xml | 35 ++++++++++--------- 3 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml new file mode 100644 index 0000000000000..d8fa18da20b5a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="customGroup"> + <data key="name">Custom Group</data> + </entity> + <entity name="emptyGroup"> + <data key="name">Empty Group</data> + </entity> + <entity name="newGroup"> + <data key="name">New Group</data> + </entity> +</entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 35773fcfc87cd..1b4085714b691 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -70,6 +70,7 @@ <element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/> <element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/> <element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/> + <element name="footerBlock" type="block" selector="//footer"/> </section> <section name="ProductInWebsitesSection"> <element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml index fcef85352169b..3219bca233bee 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml @@ -18,16 +18,17 @@ <group value="Catalog"/> </annotations> <before> - <!-- Create a custom attribute set and custom product attribute --> - <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> - <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <!-- Create a custom attribute set and custom product attribute --> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + + <!-- Login to Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <!-- Login to Admin --> - <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> <!-- Navigate to Stores > Attributes > Attribute Set --> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/> @@ -50,17 +51,17 @@ <see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/> <!-- Fill 'name' for new group and click 'Ok': Name = Custom group --> - <fillField userInput="Custom group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/> + <fillField userInput="{{customGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/> <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/> <!-- Group is created and displayed in 'Groups' block --> - <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Custom group')}}" stepKey="assertCustomGroup"/> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(customGroup.name)}}" stepKey="assertCustomGroup"/> <!-- Move custom Product Attribute to new 'Custom group' Group --> <waitForAjaxLoad stepKey="waitForAjaxLoad"/> - <click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="click"/> + <click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="click"/> <waitForPageLoad stepKey="waitForPageLoadAfterClick"/> - <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender('Custom group')}}" stepKey="moveAttribute"/> + <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="moveAttribute"/> <waitForPageLoad stepKey="waitForDragAndDrop"/> <!-- Attribute is displayed in the new group --> @@ -77,13 +78,13 @@ <click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddEmptyGroup"/> <waitForAjaxLoad stepKey="waitForLoad"/> - <fillField userInput="Empty group" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/> + <fillField userInput="{{emptyGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/> <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOnOk"/> <waitForPageLoad stepKey="waitForNewGroup"/> <!-- Empty group is created. No attributes are assigned to it. --> - <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup('Empty group')}}" stepKey="assertEmptyGroup"/> - <dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup('Empty group')}}" stepKey="seeNoAttributes"/> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(emptyGroup.name)}}" stepKey="assertEmptyGroup"/> + <dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup(emptyGroup.name)}}" stepKey="seeNoAttributes"/> <!-- Navigate to Catalog > Products --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/> @@ -98,13 +99,13 @@ </actionGroup> <!-- New Section 'Custom group' is present in form. The section contains the attribute from preconditions --> - <seeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="seeSectionCustomGroup"/> - <click selector="{{AdminProductAttributeSection.attributeGroupByName('Custom group')}}" stepKey="openCustomGroupSection"/> + <seeElement selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="seeSectionCustomGroup"/> + <click selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="openCustomGroupSection"/> <waitForAjaxLoad stepKey="waitForOpenSection"/> - <scrollTo selector="//footer" stepKey="scrollToFooter"/> - <seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName('Custom group')}}" stepKey="seeAttributePresent"/> + <scrollTo selector="{{AdminProductFormSection.footerBlock}}" stepKey="scrollToFooter"/> + <seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName(customGroup.name)}}" stepKey="seeAttributePresent"/> <!-- Empty section is absent in Product Form --> - <dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName('Empty group')}}" stepKey="dontSeeEmptyGroup"/> + <dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName(emptyGroup.name)}}" stepKey="dontSeeEmptyGroup"/> </test> </tests> From 290e4cfa6adc9f4a7f41254b8b3ed2ea5c82dfd2 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 29 May 2019 13:29:34 -0500 Subject: [PATCH 259/464] MC-170: Admin should be able to create new group in an Attribute Set --- .../Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml index d8fa18da20b5a..4413cbcf86a96 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml @@ -14,7 +14,4 @@ <entity name="emptyGroup"> <data key="name">Empty Group</data> </entity> - <entity name="newGroup"> - <data key="name">New Group</data> - </entity> </entities> From 9894cd4c3a0bbf8520561d0ab01f486ea9c69749 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Wed, 29 May 2019 14:37:27 -0500 Subject: [PATCH 260/464] MC-16318: Flaky MFTF Test: MAGETWO-93965: creating scheduled update for staging dashboard with max year value - Fixing MAGETWO-93965 MFTF test - Skipping additional tests that are flaky due to application shipping bug --- .../Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml | 5 +++++ .../Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 5 +++++ ...uleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml | 3 +++ ...teCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml | 3 +++ ...orMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml | 3 +++ ...thMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml | 3 +++ ...atchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml | 3 +++ .../SalesRule/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml | 5 +++++ .../SalesRule/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 5 +++++ 9 files changed, 35 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index 5335ec2ad775d..a4864d612a45f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -9,6 +9,11 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CGuestUserTest"> + <annotations> + <skip> + <issueId value="MC-16684"/> + </skip> + </annotations> <!-- Step 3: User adds products to cart --> <comment userInput="Start of adding products to cart" stepKey="startOfAddingProductsToCart" after="endOfBrowsingCatalog"/> <!-- Add Simple Product 1 to cart --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 65627787e2a05..a4784a5cdc227 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -9,6 +9,11 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CLoggedInUserTest"> + <annotations> + <skip> + <issueId value="MC-16684"/> + </skip> + </annotations> <!-- Step 3: User adds products to cart --> <comment userInput="Start of adding products to cart" stepKey="startOfAddingProductsToCart" after="endOfBrowsingCatalog"/> <!-- Add Simple Product 1 to cart --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml index 33184f79f6f0c..f87b02d6ff04a 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml index 22628e599823d..6941e95a60c74 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml index ab62e51414e85..2b2834726f6bf 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index e1a4ca40fd710..02ff63f0efb9f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index c62b0dd869281..11088badb05e7 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml index 0d365dc089e43..d9c578e9be334 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml @@ -9,6 +9,11 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CGuestUserTest"> + <annotations> + <skip> + <issueId value="MC-16684"/> + </skip> + </annotations> <before> <createData entity="ApiSalesRule" stepKey="createSalesRule"/> <createData entity="ApiSalesRuleCoupon" stepKey="createSalesRuleCoupon"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 7a995b1feeeda..f816e93d4bc42 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -9,6 +9,11 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="EndToEndB2CLoggedInUserTest"> + <annotations> + <skip> + <issueId value="MC-16684"/> + </skip> + </annotations> <before> <createData entity="ApiSalesRule" stepKey="createSalesRule"/> <createData entity="ApiSalesRuleCoupon" stepKey="createSalesRuleCoupon"> From 99f0d9685ca9be7f1420a5dc23c415bbe0dcde4f Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 29 May 2019 15:26:43 -0500 Subject: [PATCH 261/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../templates/admin/overlay_popup.phtml | 2 +- .../adminhtml/templates/dashboard/graph.phtml | 2 +- .../adminhtml/templates/dashboard/grid.phtml | 8 +++---- .../adminhtml/templates/store/switcher.phtml | 4 ++-- .../templates/widget/form/element.phtml | 22 +++++++++---------- .../widget/form/element/gallery.phtml | 4 +++- .../adminhtml/templates/widget/grid.phtml | 4 ++-- .../templates/widget/grid/column_set.phtml | 10 ++++----- .../templates/widget/grid/extended.phtml | 19 ++++++++-------- .../templates/widget/grid/massaction.phtml | 4 ++-- .../widget/grid/massaction_extended.phtml | 2 +- 11 files changed, 42 insertions(+), 39 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml index a6ef70d0471a9..ac81861c9930d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml @@ -24,7 +24,7 @@ <?php else : ?> <div id="messages" data-container-for="messages"><?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?></div> <?= $block->getChildHtml('content') ?> - <?php endif; ?> + <?php endif; ?> </div> </div> <?php if ($block->getChildHtml('footer')) : ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index 4db08de6b69a3..12b388c210774 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -18,7 +18,7 @@ continue; } ?> <option value="<?= /* @noEscape */ $value ?>" - <?php if ($block->getRequest()->getParam('period') == $value): ?> selected="selected"<?php endif; ?> + <?php if ($block->getRequest()->getParam('period') == $value) : ?> selected="selected"<?php endif; ?> ><?= $block->escapeHtml($label) ?></option> <?php endforeach; ?> </select> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index c77d2707f31ef..7c05335642ba7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -52,7 +52,7 @@ var deps = []; deps.push('uiRegistry'); <?php endif; ?> - <?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?> + <?php if (strpos($block->getRowClickCallback(), 'order.') !== false) : ?> deps.push('Magento_Sales/order/create/form'); <?php endif; ?> @@ -73,12 +73,12 @@ require(deps, function(<?= ($block->getDependencyJsObject() ? 'registry' : '') ? <?php if ($block->getCheckboxCheckCallback()) : ?> <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> - <?php if ($block->getRowInitCallback()): ?> + <?php if ($block->getRowInitCallback()) : ?> <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; <?= $block->escapeJs($block->getJsObjectName()) ?>.rows.each(function(row){<?= /* @noEscape */ $block->getRowInitCallback() ?>(<?= $block->escapeJs($block->getJsObjectName()) ?>, row)}); <?php endif; ?> - <?php if ($block->getMassactionBlock()->isAvailable()): ?> - <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> + <?php if ($block->getMassactionBlock()->isAvailable()) : ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> <?php endif ?> <?php if ($block->getDependencyJsObject()) : ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index d45333d24a0ef..8f3e214615c19 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -34,7 +34,7 @@ </button> <ul class="dropdown-menu" data-role="stores-list"> <?php if ($block->hasDefaultOption()) : ?> - <li class="store-switcher-all <?php if (!($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) : ?>disabled<?php endif; ?> <?php if ( ! $block->hasScopeSelected()) : ?>current<?php endif; ?>"> + <li class="store-switcher-all <?php if (!($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) : ?>disabled<?php endif; ?> <?php if (!$block->hasScopeSelected()) : ?>current<?php endif; ?>"> <?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) : ?> ?> <a data-role="store-view-id" data-value="" href="#"> @@ -74,7 +74,7 @@ <?php endif; ?> </li> <?php endif; ?> - <li class="store-switcher-store-view <?php if ( ! ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store))) : ?>disabled<?php endif; ?> <?php if ($block->isStoreSelected($store)) :?>current<?php endif; ?>"> + <li class="store-switcher-store-view <?php if (!($block->isStoreSwitchEnabled() && !$block->isStoreSelected($store))) : ?>disabled<?php endif; ?> <?php if ($block->isStoreSelected($store)) :?>current<?php endif; ?>"> <?php if ($block->isStoreSwitchEnabled() && ! $block->isStoreSelected($store)) : ?> <a data-role="store-view-id" data-value="<?= $block->escapeHtml($store->getId()) ?>" href="#"> <?= $block->escapeHtml($store->getName()) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index 0a9c6211010ba..8e17ff9949389 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -9,35 +9,35 @@ $type = $element->getType(); <?php if ($type === 'fieldset') : ?> <fieldset> <legend><?= $block->escapeHtml($element->getLegend()) ?></legend><br /> - <?php foreach ($element->getElements() as $_element): ?> + <?php foreach ($element->getElements() as $_element) : ?> <?= /* @noEscape */ $formBlock->drawElement($_element) ?> <?php endforeach; ?> </fieldset> <?php elseif ($type === 'column' || $type === 'hidden') : ?> - <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>"> - <?php elseif ($type === 'select'): ?> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>"> + <?php elseif ($type === 'select') : ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <?php if ($element->getLabel()) : ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <select name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" class="select<?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"> - <?php foreach ($element->getValues() as $_value): ?> - <option <?= /* @noEscape */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()): ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_value->getLabel()) ?></option> + <?php foreach ($element->getValues() as $_value) : ?> + <option <?= /* @noEscape */ $_value->serialize() ?><?php if ($_value->getValue() == $element->getValue()) : ?> selected="selected"<?php endif; ?>><?= $block->escapeHtml($_value->getLabel()) ?></option> <?php endforeach; ?> </select> </span> <?php elseif ($type === 'text' || $type === 'button' || $type === 'password') : ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>" <?= /* @noEscape */ $block->getUiId('label') ?>><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <?php if ($element->getLabel()) : ?><label for="<?= $element->getHtmlId() ?>" <?= /* @noEscape */ $block->getUiId('label') ?>><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> </span> -<?php elseif($type === 'radio') : ?> +<?php elseif ($type === 'radio') : ?> <span class="form_row"> - <?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> + <?php if ($element->getLabel()) : ?><label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>"/> </span> <?php elseif ($type === 'radios') : ?> <span class="form_row"> <label for="<?= $element->getHtmlId() ?>"><?= $block->escapeHtml($element->getLabel()) ?>:</label> - <?php foreach ($element->getRadios() as $_radio): ?> + <?php foreach ($element->getRadios() as $_radio) : ?> <input type="radio" name="<?= $block->escapeHtmlAttr($_radio->getName()) ?>" id="<?= $_radio->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($_radio->getValue()) ?>" class="input-radio <?= $block->escapeHtmlAttr($_radio->getClass()) ?>" title="<?= $block->escapeHtmlAttr($_radio->getTitle()) ?>" <?= ($_radio->getValue() == $element->getChecked()) ? 'checked="true"' : '' ?> > <?= $block->escapeHtml($_radio->getLabel()) ?> <?php endforeach; ?> </span> @@ -79,7 +79,7 @@ $type = $element->getType(); <textarea name="<?= $block->escapeHtmlAttr($element->getName()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" id="<?= $element->getHtmlId() ?>" class="textarea <?= $block->escapeHtmlAttr($element->getClass()) ?>" cols="15" rows="2"><?= /* @noEscape */$element->getValue() ?></textarea> </span> <?php endif; ?> -<?php if ($element->getScript()): ?> +<?php if ($element->getScript()) : ?> <script> <?= /* @noEscape */ $element->getScript() ?> </script> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index 9963251cab749..d308bf55f7575 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -72,7 +72,9 @@ window.addNewImage = function() new_row_input.value = '0'; // Delete button - new_row_button = <?= /* phpcs:disable*/ /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getDeleteButtonHtml("this")) /* phpcs:enable */ ?>; + <?php //phpcs:disable ?> + new_row_button = <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getDeleteButtonHtml("this")) ?>; + <?php // phpcs:enable ?> table = document.getElementById( "gallery" ); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index 699025067c60f..86b58859320da 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -23,7 +23,7 @@ $numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0; <?php if ($block->canDisplayContainer()) : ?> <div id="<?= $block->escapeHtml($block->getId()) ?>" data-grid-id="<?= $block->escapeHtml($block->getId()) ?>"> <?php else : ?> -<?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> + <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> <div class="admin__data-grid-header admin__data-grid-toolbar"> @@ -187,7 +187,7 @@ $numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0; </script> <?php endif; ?> - <?php if ($block->getChildBlock('grid.js')): ?> + <?php if ($block->getChildBlock('grid.js')) : ?> <?= $block->getChildHtml('grid.js') ?> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml index 36dad697347ba..e23a138084627 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/column_set.phtml @@ -59,7 +59,7 @@ $numColumns = count($block->getColumns()); <?= /* @noEscape */ ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?> class="<?= $block->escapeHtmlAttr($_column->getCssProperty()) ?> <?= /* @noEscape */ $_column->getId() == 'massaction' ? 'data-grid-checkbox-cell': '' ?> <?= ++$i == $numColumns ? 'last' : '' ?>" > - <?= (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> + <?= /* @noEscape */ (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?> </td><?php if ($block->shouldRenderEmptyCell($_item, $_column)) :?> <td colspan="<?= $block->escapeHtmlAttr($block->getEmptyCellColspan($_item)) ?>" class="last"> @@ -71,12 +71,12 @@ $numColumns = count($block->getColumns()); ?></tr> <?php $_isFirstRow = true; ?> <?php foreach ($block->getMultipleRows($_item) as $_i) : ?> - <?php if ($_isFirstRow) : ?> - <?php + <?php + if ($_isFirstRow) { $_isFirstRow = false; continue; - ?> - <?php endif; ?> + } + ?> <tr data-role="row"> <?php $i = 0; foreach ($block->getMultipleRowColumns($_i) as $_column) : ?><td data-column="<?= $block->escapeHtmlAttr($_column->getId()) ?>" diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index f650a2909e693..b9cd69ebe4503 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -239,7 +239,7 @@ $numColumns = count($block->getColumns()); <script> var deps = []; - <?php if ($block->getDependencyJsObject()): ?> + <?php if ($block->getDependencyJsObject()) : ?> deps.push('uiRegistry'); <?php endif; ?> @@ -262,21 +262,22 @@ $numColumns = count($block->getColumns()); <?php if ($block->getDependencyJsObject()) : ?> registry.get('<?= $block->escapeJs($block->getDependencyJsObject()) ?>', function (<?= $block->escapeJs($block->getDependencyJsObject()) ?>) { <?php endif; ?> - - <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid(<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getId()) ?>, '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); - <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; + <?php // phpcs:disable ?> + <?= $block->escapeJs($block->getJsObjectName()) ?> = new varienGrid(<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getId()) ?>, '<?= $block->escapeJs($block->getGridUrl()) ?>', '<?= $block->escapeJs($block->getVarNamePage()) ?>', '<?= $block->escapeJs($block->getVarNameSort()) ?>', '<?= $block->escapeJs($block->getVarNameDir()) ?>', '<?= $block->escapeJs($block->getVarNameFilter()) ?>'); + <?php //phpcs:enable ?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.useAjax = '<?= $block->escapeJs($block->getUseAjax()) ?>'; <?php if ($block->getRowClickCallback()) : ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.rowClickCallback = <?= /* @noEscape */ $block->getRowClickCallback() ?>; <?php endif; ?> <?php if ($block->getCheckboxCheckCallback()) : ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>; <?php endif; ?> <?php if ($block->getRowInitCallback()) : ?> - <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; - <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); + <?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>; + <?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows(); <?php endif; ?> <?php if ($block->getMassactionBlock() && $block->getMassactionBlock()->isAvailable()) : ?> - <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> + <?= /* @noEscape */ $block->getMassactionBlock()->getJavaScript() ?> <?php endif ?> <?= /* @noEscape */ $block->getAdditionalJavaScript() ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml index 969d6cafda23a..c90d8f1964ec1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml @@ -7,7 +7,7 @@ <?= /* @noEscape */ $block->getSomething() ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) : ?> <form action="" id="<?= $block->getHtmlId() ?>-form" method="post"> <?php endif ?> <div class="admin__grid-massaction-form"> @@ -17,7 +17,7 @@ class="required-entry local-validation admin__control-select" <?= /* @noEscape */ $block->getUiId('select') ?>> <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> - <?php foreach ($block->getItems() as $_item):?> + <?php foreach ($block->getItems() as $_item) : ?> <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml index cd2bbbffa7852..c0f30fc282f38 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml @@ -6,7 +6,7 @@ ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) : ?> <form action="" id="<?= $block->getHtmlId() ?>-form" method="post"> <?php endif ?> <div class="admin__grid-massaction-form"> From 8fb48e422f2f6ad2921959c7e058db2785e89f7e Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 29 May 2019 16:20:04 -0500 Subject: [PATCH 262/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Backend/view/adminhtml/templates/widget/form/element.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml index 8e17ff9949389..83da4b5091457 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml @@ -27,7 +27,7 @@ $type = $element->getType(); <?php elseif ($type === 'text' || $type === 'button' || $type === 'password') : ?> <span class="form_row"> <?php if ($element->getLabel()) : ?><label for="<?= $element->getHtmlId() ?>" <?= /* @noEscape */ $block->getUiId('label') ?>><?= $block->escapeHtml($element->getLabel()) ?>:</label><?php endif; ?> - <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> + <input type="<?= $block->escapeHtmlAttr($element->getType()) ?>" name="<?= $block->escapeHtmlAttr($element->getName()) ?>" id="<?= /* @noEscape */ $element->getHtmlId() ?>" value="<?= $block->escapeHtmlAttr($element->getValue()) ?>" class="input-text <?= $block->escapeHtmlAttr($element->getClass()) ?>" title="<?= $block->escapeHtmlAttr($element->getTitle()) ?>" <?= /* @noEscape */ ($element->getOnClick() ? 'onClick="' . $element->getOnClick() . '"' : '') ?>/> </span> <?php elseif ($type === 'radio') : ?> <span class="form_row"> From 3b9aee57df7afdb15fd916cf0d802d7c3639b16f Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Tue, 28 May 2019 10:33:16 -0500 Subject: [PATCH 263/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - integration test for end to end place order with authorizenet MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - integration test for end to end place order for customer with authorizenet MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - squash commits MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - review comments --- .../PlaceOrderWithAuthorizeNetTest.php | 201 ++++++++++++++++++ ...etAuthorizeNetPaymentMethodOnCartTest.php} | 21 +- .../Guest/PlaceOrderWithAuthorizeNetTest.php | 193 +++++++++++++++++ ...etAuthorizeNetPaymentMethodOnCartTest.php} | 17 +- .../add_simple_products_authorizenet.php | 30 +++ .../place_order_customer_authorizenet.php | 123 +++++++++++ .../_files/place_order_guest_authorizenet.php | 126 +++++++++++ .../_files/request_authorize.php | 68 ++++++ .../_files/request_authorize_customer.php | 68 ++++++ .../_files/response_authorize.php | 47 ++++ .../set_new_billing_address_authorizenet.php | 44 ++++ .../set_new_shipping_address_authorizenet.php | 43 ++++ .../_files/not_logged_in_customer.php | 32 +++ .../not_logged_in_customer_rollback.php | 25 +++ .../_files/simple_product_authorizenet.php | 45 ++++ .../simple_product_authorizenet_rollback.php | 7 + 16 files changed, 1086 insertions(+), 4 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php rename dev/tests/integration/testsuite/Magento/{GraphQl/Quote/Customer/SetAuthorizenetPaymentMethodOnCustomerCartTest.php => AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php} (88%) create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php rename dev/tests/integration/testsuite/Magento/{GraphQl/Quote/Guest/SetAuthorizeNetPaymentMethodOnGuestCartTest.php => AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php} (88%) create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/response_authorize.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php new file mode 100644 index 0000000000000..ed7eee3163340 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -0,0 +1,201 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\AuthorizenetGraphQl\Model\Resolver\Customer; + +use Magento\Framework\App\Request\Http; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\GraphQl\Controller\GraphQl; +use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; +use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\Payment\Gateway\Command\CommandPoolInterface; +use Magento\Sales\Model\Order; +use Magento\Framework\Webapi\Request; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\HTTP\ZendClient; +use Magento\Framework\HTTP\ZendClientFactory; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\MockObject\Builder\InvocationMocker; +use Magento\Payment\Gateway\Data\PaymentDataObjectFactory; +use PHPUnit\Framework\MockObject\MockObject; +use Magento\Quote\Model\Quote\PaymentFactory; +use PHPUnit\Framework\TestCase; +use Zend_Http_Response; + +/** + * Tests end to end Place Order process for customer via authorizeNet + * + * @magentoAppArea graphql + * @magentoDbIsolation disabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class PlaceOrderWithAuthorizeNetTest extends TestCase +{ + const CONTENT_TYPE = 'application/json'; + + /** @var ObjectManager */ + private $objectManager; + + /** @var GetMaskedQuoteIdByReservedOrderId */ + private $getMaskedQuoteIdByReservedOrderId; + + /** @var GraphQl */ + private $graphql; + + /** @var SerializerInterface */ + private $jsonSerializer; + + /** @var Http */ + private $request; + + /** + * @var ZendClient|MockObject|InvocationMocker */ + private $clientMock; + + /** @var CustomerTokenServiceInterface */ + private $customerTokenService; + + /** + * @var Zend_Http_Response + */ + protected $responseMock; + + /** @var PaymentFactory */ + private $paymentFactory; + + protected function setUp() : void + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); + $this->jsonSerializer = $this->objectManager->get(SerializerInterface::class); + $this->request = $this->objectManager->get(Http::class); + $this->getMaskedQuoteIdByReservedOrderId = $this->objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); + $this->customerTokenService = $this->objectManager->get(CustomerTokenServiceInterface::class); + $this->clientMock = $this->createMock(ZendClient::class); + $this->responseMock = $this->createMock(Zend_Http_Response::class); + $this->clientMock->method('request') + ->willReturn($this->responseMock); + $this->clientMock->method('setUri') + ->with('https://apitest.authorize.net/xml/v1/request.api'); + $clientFactoryMock = $this->createMock(ZendClientFactory::class); + $clientFactoryMock->method('create') + ->willReturn($this->clientMock); + /** @var PaymentDataObjectFactory $paymentFactory */ + $this->paymentFactory = $this->objectManager->get(PaymentDataObjectFactory::class); + $this->objectManager->addSharedInstance($clientFactoryMock, ZendClientFactory::class); + } + + /** + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/active 1 + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/environment sandbox + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/login someusername + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_key somepassword + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php + * @magentoDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php + * @magentoDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php + */ + public function testDispatchToPlaceOrderWithRegisteredCustomer(): void + { + $paymentMethod = 'authorizenet_acceptjs'; + $cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $query + = <<<QUERY + mutation { + setPaymentMethodOnCart(input: { + cart_id: "$cartId" + payment_method: { + code: "$paymentMethod" + additional_data: + {authorizenet_acceptjs: + {opaque_data_descriptor: "mydescriptor", + opaque_data_value: "myvalue", + cc_last_4: 1111}} + } + }) { + cart { + selected_payment_method { + code + } + } + } + placeOrder(input: {cart_id: "$cartId"}) { + order { + order_id + } + } +} +QUERY; + $postData = [ + 'query' => $query, + 'variables' => null, + 'operationName' => null + ]; + $this->request->setPathInfo('/graphql'); + $this->request->setMethod('POST'); + $this->request->setContent($this->jsonSerializer->serialize($postData)); + $customerToken = $this->customerTokenService->createCustomerAccessToken('customer@example.com', 'password'); + $bearerCustomerToken = 'Bearer ' . $customerToken; + $contentType ='application/json'; + $webApiRequest = $this->objectManager->get(Request::class); + $webApiRequest->getHeaders()->addHeaderLine('Content-Type', $contentType) + ->addHeaderLine('Accept', $contentType) + ->addHeaderLine('Authorization', $bearerCustomerToken); + $this->request->setHeaders($webApiRequest->getHeaders()); + + $graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); + + /** @var CommandPoolInterface $commandPool */ + $commandPool = $this->objectManager->get('AuthorizenetAcceptjsCommandPool'); + $commandPool->get('authorize'); + /** @var Order $order */ + $fullOrder = include __DIR__ . '/../../../_files/place_order_customer_authorizenet.php'; + + $payment = $fullOrder->getPayment(); + $paymentDO = $this->paymentFactory->create($payment); + + $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; + $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; + + $this->clientMock->method('setRawData') + ->with(json_encode($expectedRequest), 'application/json'); + + $this->responseMock->method('getBody')->willReturn(json_encode($authorizeResponse)); + + $response = $graphql->dispatch($this->request); + $responseData = $this->jsonSerializer->unserialize($response->getContent()); + + $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); + $this->assertTrue( + isset($responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']) + ); + $this->assertEquals( + $paymentMethod, + $responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code'] + ); + + $this->assertTrue( + isset($responseData['data']['placeOrder']['order']['order_id']) + ); + + $this->assertEquals( + 'test_quote', + $responseData['data']['placeOrder']['order']['order_id'] + ); + } + + protected function tearDown() + { + $this->objectManager->removeSharedInstance(ZendClientFactory::class); + include __DIR__ . '/../../../../../Magento/Customer/_files/customer_rollback.php'; + parent::tearDown(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/Customer/SetAuthorizenetPaymentMethodOnCustomerCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/GraphQl/Quote/Customer/SetAuthorizenetPaymentMethodOnCustomerCartTest.php rename to dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php index 6236758908e1f..2861eb490e34d 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/Customer/SetAuthorizenetPaymentMethodOnCustomerCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -5,7 +5,7 @@ */ declare(strict_types=1); -namespace Magento\GraphQl\Quote\Customer; +namespace Magento\AuthorizenetGraphQl\Model\Resolver\Customer; use Magento\Framework\App\Request\Http; use Magento\Framework\Serialize\SerializerInterface; @@ -21,7 +21,7 @@ * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SetAuthorizenetPaymentMethodOnCustomerCartTest extends \PHPUnit\Framework\TestCase +class SetAuthorizenetPaymentMethodOnCustomerCartTest extends \Magento\TestFramework\Indexer\TestCase { const CONTENT_TYPE = 'application/json'; @@ -37,9 +37,26 @@ class SetAuthorizenetPaymentMethodOnCustomerCartTest extends \PHPUnit\Framework\ /** @var CustomerTokenServiceInterface */ private $customerTokenService; + /** + * @var \Magento\Framework\App\Cache */ + private $appCache; + /** @var Http */ private $request; + public static function setUpBeforeClass() + { + $db = Bootstrap::getInstance()->getBootstrap() + ->getApplication() + ->getDbInstance(); + if (!$db->isDbDumpExists()) { + throw new \LogicException('DB dump does not exist.'); + } + $db->restoreFromDbDump(); + + parent::setUpBeforeClass(); + } + protected function setUp() : void { $this->objectManager = Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php new file mode 100644 index 0000000000000..1c1b4835b3b98 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php @@ -0,0 +1,193 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\AuthorizenetGraphQl\Model\Resolver\Guest; + +use Magento\Framework\App\Request\Http; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\GraphQl\Controller\GraphQl; +use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; +use Magento\Payment\Gateway\Command\CommandPoolInterface; +use Magento\Sales\Model\Order; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\HTTP\ZendClient; +use Magento\Framework\HTTP\ZendClientFactory; +use Magento\TestFramework\ObjectManager; +use PHPUnit\Framework\MockObject\Builder\InvocationMocker; +use Magento\Payment\Gateway\Data\PaymentDataObjectFactory; +use PHPUnit\Framework\MockObject\MockObject; +use Magento\Quote\Model\Quote\PaymentFactory; +use PHPUnit\Framework\TestCase; +use Zend_Http_Response; + +/** + * Tests end to end Place Order process for non logged in customer using authorizeNet payment + * + * @magentoAppArea graphql + * @magentoDbIsolation disabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class PlaceOrderWithAuthorizeNetTest extends TestCase +{ + const CONTENT_TYPE = 'application/json'; + + /** @var ObjectManager */ + private $objectManager; + + /** @var GetMaskedQuoteIdByReservedOrderId */ + private $getMaskedQuoteIdByReservedOrderId; + + /** @var GraphQl */ + private $graphql; + + /** @var SerializerInterface */ + private $jsonSerializer; + + /** @var Http */ + private $request; + + /** + * @var ZendClient|MockObject|InvocationMocker */ + private $clientMock; + + /** + * @var Zend_Http_Response + */ + protected $responseMock; + + /** @var PaymentFactory */ + private $paymentFactory; + + protected function setUp() : void + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); + $this->jsonSerializer = $this->objectManager->get(SerializerInterface::class); + $this->request = $this->objectManager->get(Http::class); + $this->getMaskedQuoteIdByReservedOrderId = $this->objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); + $this->clientMock = $this->createMock(ZendClient::class); + $this->responseMock = $this->createMock(Zend_Http_Response::class); + $this->clientMock->method('request') + ->willReturn($this->responseMock); + $this->clientMock->method('setUri') + ->with('https://apitest.authorize.net/xml/v1/request.api'); + $clientFactoryMock = $this->createMock(ZendClientFactory::class); + $clientFactoryMock->method('create') + ->willReturn($this->clientMock); + /** @var PaymentDataObjectFactory $paymentFactory */ + $this->paymentFactory = $this->objectManager->get(PaymentDataObjectFactory::class); + $this->objectManager->addSharedInstance($clientFactoryMock, ZendClientFactory::class); + } + + /** + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/active 1 + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/environment sandbox + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/login someusername + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_key somepassword + * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc + * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php + * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php + * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php + * @magentoDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php + */ + public function testDispatchToPlaceAnOrderWithAuthorizenet(): void + { + $paymentMethod = 'authorizenet_acceptjs'; + $cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $query + = <<<QUERY + mutation { + setPaymentMethodOnCart(input: { + cart_id: "$cartId" + payment_method: { + code: "$paymentMethod" + additional_data: + {authorizenet_acceptjs: + {opaque_data_descriptor: "mydescriptor", + opaque_data_value: "myvalue", + cc_last_4: 1111}} + } + }) { + cart { + selected_payment_method { + code + } + } + } + placeOrder(input: {cart_id: "$cartId"}) { + order { + order_id + } + } +} +QUERY; + $postData = [ + 'query' => $query, + 'variables' => null, + 'operationName' => null + ]; + $this->request->setPathInfo('/graphql'); + $this->request->setMethod('POST'); + $this->request->setContent(json_encode($postData)); + $headers = $this->objectManager->create(\Zend\Http\Headers::class) + ->addHeaders(['Content-Type' => 'application/json']); + $this->request->setHeaders($headers); + + /** @var CommandPoolInterface $commandPool */ + $commandPool = $this->objectManager->get('AuthorizenetAcceptjsCommandPool'); + $command = $commandPool->get('authorize'); + /** @var Order $order */ + $fullOrder = include __DIR__ . '/../../../_files/place_order_guest_authorizenet.php'; + + $payment = $fullOrder->getPayment(); + $paymentDO = $this->paymentFactory->create($payment); + + $expectedRequest = include __DIR__ . '/../../../_files/request_authorize.php'; + $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; + + $this->clientMock->method('setRawData') + ->with(json_encode($expectedRequest), 'application/json'); + + $this->responseMock->method('getBody')->willReturn(json_encode($authorizeResponse)); + + $command->execute([ + 'payment' => $paymentDO, + 'amount' => 100.00 + ]); + + $response = $this->graphql->dispatch($this->request); + $responseData = $this->jsonSerializer->unserialize($response->getContent()); + + $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); + $this->assertTrue( + isset($responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']) + ); + $this->assertEquals( + $paymentMethod, + $responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code'] + ); + + $this->assertTrue( + isset($responseData['data']['placeOrder']['order']['order_id']) + ); + + $this->assertEquals( + 'test_quote', + $responseData['data']['placeOrder']['order']['order_id'] + ); + } + + protected function tearDown() + { + $this->objectManager->removeSharedInstance(ZendClientFactory::class); + include __DIR__ . '/../../../../../Magento/Customer/_files/not_logged_in_customer_rollback.php'; + parent::tearDown(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/Guest/SetAuthorizeNetPaymentMethodOnGuestCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/GraphQl/Quote/Guest/SetAuthorizeNetPaymentMethodOnGuestCartTest.php rename to dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php index 64b73c2f73ece..0141be6f97cab 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/Guest/SetAuthorizeNetPaymentMethodOnGuestCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -5,7 +5,7 @@ */ declare(strict_types=1); -namespace Magento\GraphQl\Quote\Guest; +namespace Magento\AuthorizenetGraphQl\Model\Resolver\Guest; use Magento\Framework\App\Request\Http; use Magento\Framework\Serialize\SerializerInterface; @@ -20,7 +20,7 @@ * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SetAuthorizeNetPaymentMethodOnGuestCartTest extends \PHPUnit\Framework\TestCase +class SetAuthorizeNetPaymentMethodOnGuestCartTest extends \Magento\TestFramework\Indexer\TestCase { const CONTENT_TYPE = 'application/json'; @@ -39,6 +39,19 @@ class SetAuthorizeNetPaymentMethodOnGuestCartTest extends \PHPUnit\Framework\Tes /** @var Http */ private $request; + public static function setUpBeforeClass() + { + $db = Bootstrap::getInstance()->getBootstrap() + ->getApplication() + ->getDbInstance(); + if (!$db->isDbDumpExists()) { + throw new \LogicException('DB dump does not exist.'); + } + $db->restoreFromDbDump(); + + parent::setUpBeforeClass(); + } + protected function setUp() : void { $this->objectManager = Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php new file mode 100644 index 0000000000000..f297559489f53 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Quote\Model\QuoteFactory; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); +/** @var QuoteFactory $quoteFactory */ +$quoteFactory = Bootstrap::getObjectManager()->get(QuoteFactory::class); +/** @var QuoteResource $quoteResource */ +$quoteResource = Bootstrap::getObjectManager()->get(QuoteResource::class); +/** @var CartRepositoryInterface $cartRepository */ +$cartRepository = Bootstrap::getObjectManager()->get(CartRepositoryInterface::class); + +$product = $productRepository->get('simple_product'); + +$quote = $quoteFactory->create(); +$quoteResource->load($quote, 'test_quote', 'reserved_order_id'); +//$quoteResource->load($quote, '100000001', 'reserved_order_id'); +//$quote->addProduct($product, 2); +$quote->addProduct($product, 4); +$cartRepository->save($quote); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php new file mode 100644 index 0000000000000..68ecc0a228e7c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php @@ -0,0 +1,123 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Payment; +use Magento\Sales\Model\Order\Address; +use Magento\Sales\Model\Order\Item; +use Magento\TestFramework\Helper\Bootstrap; +require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php'; +require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple_product') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription('Short description') + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ])->setCanSaveCustomOptions(true) + ->setHasOptions(false); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); + +$addressData = [ + 'region' => 'CA', + 'region_id' => '12', + 'postcode' => '11111', + 'lastname' => 'lastname', + 'firstname' => 'firstname', + 'street' => 'street', + 'city' => 'Los Angeles', + 'email' => 'customer@example.com', + 'telephone' => '11111111', + 'country_id' => 'US' +]; +$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]); +$billingAddress->setAddressType('billing'); + +$shippingAddress = clone $billingAddress; +$shippingAddress->setId(null) + ->setAddressType('shipping') + ->setStreet(['6161 West Centinela Avenue']) + ->setFirstname('John') + ->setLastname('Doe') + ->setShippingMethod('flatrate_flatrate'); + +$payment = $objectManager->create(Payment::class); +$payment->setAdditionalInformation('ccLast4', '1111'); +$payment->setAdditionalInformation('opaqueDataDescriptor', 'mydescriptor'); +$payment->setAdditionalInformation('opaqueDataValue', 'myvalue'); +$payment->setAuthorizationTransaction(true); + +/** @var Item $orderItem */ +$orderItem1 = $objectManager->create(Item::class); +$orderItem1->setProductId($product->getId()) + ->setSku($product->getSku()) + ->setName($product->getName()) + ->setQtyOrdered(2) + ->setBasePrice($product->getPrice()) + ->setPrice($product->getPrice()) + ->setRowTotal($product->getPrice()) + ->setProductType($product->getTypeId()); + +$orderAmount = 100; +$customerEmail = $billingAddress->getEmail(); + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setState(Order::STATE_PROCESSING) + ->setIncrementId('test_quote') + ->setStatus(Order::STATE_PROCESSING) + ->setCustomerId((int)$customer->getId()) + ->setCustomerIsGuest(false) + //->setRemoteIp('127.0.0.1') + ->setCreatedAt(date('Y-m-d 00:00:55')) + ->setOrderCurrencyCode('USD') + ->setBaseCurrencyCode('USD') + ->setSubtotal($orderAmount) + ->setGrandTotal($orderAmount) + ->setBaseSubtotal($orderAmount) + ->setBaseGrandTotal($orderAmount) + ->setCustomerEmail($customerEmail) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setShippingDescription('Flat Rate - Fixed') + ->setShippingAmount(10) + ->setStoreId(1) + ->addItem($orderItem1) + ->setQuoteId(1) + ->setPayment($payment); + +return $order; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php new file mode 100644 index 0000000000000..1856b2dd5330e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php @@ -0,0 +1,126 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Payment; +use Magento\Sales\Model\Order\Address; +use Magento\Sales\Model\Order\Item; +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php'; +require __DIR__ . '/../../../Magento/Customer/_files/not_logged_in_customer.php'; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple_product') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription('Short description') + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData([ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ])->setCanSaveCustomOptions(true) + ->setHasOptions(false); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); + +$addressData = [ + 'region' => 'CA', + 'region_id' => '12', + 'postcode' => '11111', + 'lastname' => 'lastname', + 'firstname' => 'firstname', + 'street' => 'street', + 'city' => 'Los Angeles', + 'email' => 'guest@example.com', + 'telephone' => '11111111', + 'country_id' => 'US' +]; +$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]); +$billingAddress->setAddressType('billing'); + +$shippingAddress = clone $billingAddress; +$shippingAddress->setId(null) + ->setAddressType('shipping') + ->setStreet(['6161 West Centinela Avenue']) + ->setFirstname('John') + ->setLastname('Doe') + ->setShippingMethod('flatrate_flatrate'); + +$payment = $objectManager->create(Payment::class); +$payment->setAdditionalInformation('ccLast4', '1111'); +$payment->setAdditionalInformation('opaqueDataDescriptor', 'mydescriptor'); +$payment->setAdditionalInformation('opaqueDataValue', 'myvalue'); +$payment->setAuthorizationTransaction(true); + +/** @var Item $orderItem */ +$orderItem1 = $objectManager->create(Item::class); +$orderItem1->setProductId($product->getId()) + ->setSku($product->getSku()) + ->setName($product->getName()) + ->setQtyOrdered(2) + ->setBasePrice($product->getPrice()) + ->setPrice($product->getPrice()) + ->setRowTotal($product->getPrice()) + ->setProductType($product->getTypeId()); + +$orderAmount = 100; +//$orderAmount = 30; +$customerEmail = $billingAddress->getEmail(); + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setState(Order::STATE_PROCESSING) + ->setIncrementId('test_quote') + ->setStatus(Order::STATE_PROCESSING) + // ->setCustomerId($customer->getId()) + ->setCustomerId(null) + ->setCustomerIsGuest(true) + //->setRemoteIp('127.0.0.1') + ->setCreatedAt(date('Y-m-d 00:00:55')) + ->setOrderCurrencyCode('USD') + ->setBaseCurrencyCode('USD') + ->setSubtotal($orderAmount) + ->setGrandTotal($orderAmount) + ->setBaseSubtotal($orderAmount) + ->setBaseGrandTotal($orderAmount) + ->setCustomerEmail($customerEmail) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setShippingDescription('Flat Rate - Fixed') + ->setShippingAmount(10) + ->setStoreId(1) + ->addItem($orderItem1) + ->setQuoteId(1) + ->setPayment($payment); + +return $order; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php new file mode 100644 index 0000000000000..a63a86a993c6f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); +use Magento\TestFramework\ObjectManager; +/** @var \Magento\Sales\Model\Order $order */ +$order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); + +return [ + 'createTransactionRequest' => [ + 'merchantAuthentication' =>[ + 'name' => 'someusername', + 'transactionKey' => 'somepassword', + ], + 'transactionRequest' => [ + 'transactionType' => 'authOnlyTransaction', + 'amount' => '100.00', + 'payment' => [ + 'opaqueData' => [ + 'dataDescriptor' => 'mydescriptor', + 'dataValue' => 'myvalue', + ], + ], + 'solution' => [ + 'id' => 'AAA102993', + ], + 'order' => [ + 'invoiceNumber' => 'test_quote', + ], + 'poNumber' => null, + 'customer' => [ + 'id' => null, + 'email' => 'guest@example.com', + ], + 'billTo' => [ + 'firstName' => 'firstname', + 'lastName' => 'lastname', + 'company' => '', + 'address' => 'street', + 'city' => 'Los Angeles', + 'state' => 'CA', + 'zip' => '11111', + 'country' => 'US', + ], + 'shipTo' => [ + 'firstName' => 'John', + 'lastName' => 'Doe', + 'company' => '', + 'address' => '6161 West Centinela Avenue', + 'city' => 'Los Angeles', + 'state' => 'CA', + 'zip' => '11111', + 'country' => 'US', + ], + 'userFields' => [ + 'userField' => [ + [ + 'name' => 'transactionType', + 'value' => 'authOnlyTransaction', + ], + ], + ], + ], + ] +]; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php new file mode 100644 index 0000000000000..45fb16e899f0b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); +use Magento\TestFramework\ObjectManager; +/** @var \Magento\Sales\Model\Order $order */ +$order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); + +return [ + 'createTransactionRequest' => [ + 'merchantAuthentication' =>[ + 'name' => 'someusername', + 'transactionKey' => 'somepassword', + ], + 'transactionRequest' => [ + 'transactionType' => 'authOnlyTransaction', + 'amount' => '100.00', + 'payment' => [ + 'opaqueData' => [ + 'dataDescriptor' => 'mydescriptor', + 'dataValue' => 'myvalue', + ], + ], + 'solution' => [ + 'id' => 'AAA102993', + ], + 'order' => [ + 'invoiceNumber' => 'test_quote', + ], + 'poNumber' => null, + 'customer' => [ + 'id' => '1', + 'email' => 'customer@example.com', + ], + 'billTo' => [ + 'firstName' => 'firstname', + 'lastName' => 'lastname', + 'company' => '', + 'address' => 'street', + 'city' => 'Los Angeles', + 'state' => 'CA', + 'zip' => '11111', + 'country' => 'US', + ], + 'shipTo' => [ + 'firstName' => 'John', + 'lastName' => 'Doe', + 'company' => '', + 'address' => '6161 West Centinela Avenue', + 'city' => 'Los Angeles', + 'state' => 'CA', + 'zip' => '11111', + 'country' => 'US', + ], + 'userFields' => [ + 'userField' => [ + [ + 'name' => 'transactionType', + 'value' => 'authOnlyTransaction', + ], + ], + ], + ], + ] +]; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/response_authorize.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/response_authorize.php new file mode 100644 index 0000000000000..f80495137ca29 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/response_authorize.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +return [ + 'transactionResponse' => [ + 'responseCode' => '1', + 'authCode' => 'abc123', + 'avsResultCode' => 'Y', + 'cvvResultCode' => 'P', + 'cavvResultCode' => '2', + 'transId' => '123456', + 'refTransID' => '', + 'transHash' => 'foobar', + 'testRequest' => '0', + 'accountNumber' => 'XXXX1111', + 'accountType' => 'Visa', + 'messages' => [ + [ + 'code' => '1', + 'description' => 'This transaction has been approved.' + ] + ], + 'userFields' => [ + [ + 'name' => 'transactionType', + 'value' => 'authOnlyTransaction' + ] + ], + 'transHashSha2' => 'CD1E57FB1B5C876FDBD536CB16F8BBBA687580EDD78DD881C7F14DC4467C32BF6C' + . '808620FBD59E5977DF19460B98CCFC0DA0D90755992C0D611CABB8E2BA52B0', + 'SupplementalDataQualificationIndicator' => 0 + ], + 'messages' => [ + 'resultCode' => 'Ok', + 'message' => [ + [ + 'code' => 'I00001', + 'text' => 'Successful.' + ] + ] + ] +]; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php new file mode 100644 index 0000000000000..4f045c550cd37 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Api\DataObjectHelper; +use Magento\Quote\Api\Data\AddressInterface; +use Magento\Quote\Api\Data\AddressInterfaceFactory; +use Magento\Quote\Api\BillingAddressManagementInterface; +use Magento\Quote\Model\QuoteFactory; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; + +use Magento\TestFramework\Helper\Bootstrap; + +/** @var QuoteFactory $quoteFactory */ +$quoteFactory = Bootstrap::getObjectManager()->get(QuoteFactory::class); +/** @var QuoteResource $quoteResource */ +$quoteResource = Bootstrap::getObjectManager()->get(QuoteResource::class); +/** @var AddressInterfaceFactory $quoteAddressFactory */ +$quoteAddressFactory = Bootstrap::getObjectManager()->get(AddressInterfaceFactory::class); +/** @var DataObjectHelper $dataObjectHelper */ +$dataObjectHelper = Bootstrap::getObjectManager()->get(DataObjectHelper::class); +/** @var BillingAddressManagementInterface $billingAddressManagement */ +$billingAddressManagement = Bootstrap::getObjectManager()->get(BillingAddressManagementInterface::class); + +$quoteAddressData = [ + AddressInterface::KEY_TELEPHONE => 11111111, + AddressInterface::KEY_POSTCODE => 11111, + AddressInterface::KEY_COUNTRY_ID => 'US', + AddressInterface::KEY_CITY => 'Los Angeles', + AddressInterface::KEY_COMPANY => '', + AddressInterface::KEY_STREET => 'street', + AddressInterface::KEY_LASTNAME => 'lastname', + AddressInterface::KEY_FIRSTNAME => 'firstname', + AddressInterface::KEY_REGION_ID => 12, +]; +$quoteAddress = $quoteAddressFactory->create(); +$dataObjectHelper->populateWithArray($quoteAddress, $quoteAddressData, AddressInterfaceFactory::class); + +$quote = $quoteFactory->create(); +$quoteResource->load($quote, 'test_quote', 'reserved_order_id'); +$billingAddressManagement->assign($quote->getId(), $quoteAddress); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php new file mode 100644 index 0000000000000..8837a3cb2397c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Api\DataObjectHelper; +use Magento\Quote\Api\Data\AddressInterface; +use Magento\Quote\Api\Data\AddressInterfaceFactory; +use Magento\Quote\Model\QuoteFactory; +use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; +use Magento\Quote\Model\ShippingAddressManagementInterface; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var QuoteFactory $quoteFactory */ +$quoteFactory = Bootstrap::getObjectManager()->get(QuoteFactory::class); +/** @var QuoteResource $quoteResource */ +$quoteResource = Bootstrap::getObjectManager()->get(QuoteResource::class); +/** @var AddressInterfaceFactory $quoteAddressFactory */ +$quoteAddressFactory = Bootstrap::getObjectManager()->get(AddressInterfaceFactory::class); +/** @var DataObjectHelper $dataObjectHelper */ +$dataObjectHelper = Bootstrap::getObjectManager()->get(DataObjectHelper::class); +/** @var ShippingAddressManagementInterface $shippingAddressManagement */ +$shippingAddressManagement = Bootstrap::getObjectManager()->get(ShippingAddressManagementInterface::class); + +$quoteAddressData = [ + AddressInterface::KEY_TELEPHONE => 3468676, + AddressInterface::KEY_POSTCODE => '11111', + AddressInterface::KEY_COUNTRY_ID => 'US', + AddressInterface::KEY_CITY => 'Los Angeles', + AddressInterface::KEY_COMPANY => '', + AddressInterface::KEY_STREET => '6161 West Centinela Avenue', + AddressInterface::KEY_LASTNAME => 'Doe', + AddressInterface::KEY_FIRSTNAME => 'John', + AddressInterface::KEY_REGION_ID => 12, +]; +$quoteAddress = $quoteAddressFactory->create(); +$dataObjectHelper->populateWithArray($quoteAddress, $quoteAddressData, AddressInterfaceFactory::class); + +$quote = $quoteFactory->create(); +$quoteResource->load($quote, 'test_quote', 'reserved_order_id'); +$shippingAddressManagement->assign($quote->getId(), $quoteAddress); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php new file mode 100644 index 0000000000000..a2aa403a33c5a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +use Magento\Customer\Model\CustomerRegistry; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/** @var $repository \Magento\Customer\Api\CustomerRepositoryInterface */ +$repository = $objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class); +$customer = $objectManager->create(\Magento\Customer\Model\Customer::class); +/** @var CustomerRegistry $customerRegistry */ +$customerRegistry = $objectManager->get(CustomerRegistry::class); +/** @var Magento\Customer\Model\Customer $customer */ +$customer->setWebsiteId(1) + ->setEmail('customer@example.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setPrefix('Mr.') + ->setFirstname('John') + ->setMiddlename('A') + ->setLastname('Smith') + ->setSuffix('Esq.') + ->setDefaultBilling(1) + ->setDefaultShipping(1) + ->setTaxvat('12') + ->setGender(0); + +$customer->isObjectNew(true); +$customer->save(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php new file mode 100644 index 0000000000000..26ec0d3862a8f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + + +/** @var \Magento\Framework\Registry $registry */ + $registry = $this->objectManager->get(\Magento\Framework\Registry::class); + $registry->unregister('isSecureArea'); + $registry->register('isSecureArea', true); + +/** @var \Magento\Store\Model\StoreManager $store */ + $store = $this->objectManager->get(\Magento\Store\Model\StoreManager::class); + +/** @var $customer \Magento\Customer\Model\Customer*/ + $customer = $this->objectManager->create(\Magento\Customer\Model\Customer::class); + $customer->setWebsiteId($store->getDefaultStoreView()->getWebsiteId()); + $customer->loadByEmail('customer@example.com'); + if ($customer->getId()) { + $customer->delete(); + } + + $registry->unregister('isSecureArea'); + $registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php new file mode 100644 index 0000000000000..47070c9af9095 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Framework\Api\DataObjectHelper; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +/** @var DataObjectHelper $dataObjectHelper */ +$dataObjectHelper = Bootstrap::getObjectManager()->get(DataObjectHelper::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); + +$product = $productFactory->create(); +$productData = [ + ProductInterface::TYPE_ID => Type::TYPE_SIMPLE, + ProductInterface::ATTRIBUTE_SET_ID => 4, + ProductInterface::SKU => 'simple_product', + ProductInterface::NAME => 'Simple Product', + ProductInterface::PRICE => 20, + ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH, + ProductInterface::STATUS => Status::STATUS_ENABLED, +]; +$dataObjectHelper->populateWithArray($product, $productData, ProductInterface::class); +/** Out of interface */ +$product + ->setWebsiteIds([1]) + ->setStockData([ + 'qty' => 85.5, + 'is_in_stock' => true, + 'manage_stock' => true, + 'is_qty_decimal' => true + ]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php new file mode 100644 index 0000000000000..52e7012a5106d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php @@ -0,0 +1,7 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/simple_product_rollback.php'; From 64e32d77c32502ec4a02db1cb43d5f832789a1c7 Mon Sep 17 00:00:00 2001 From: Vishal Gelani <vishalgelani99@gmail.com> Date: Thu, 30 May 2019 11:40:58 +0530 Subject: [PATCH 264/464] Update Generator.php --- app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index 14b65bb640242..027a85cd08ce4 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -139,7 +139,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function generateSchema($requestedServiceMetadata, $requestScheme, $requestHost, $endpointUrl) { @@ -199,7 +199,7 @@ protected function getGeneralInfo() } /** - * @return string[] + * @return array */ protected function getConsumableDatatypes() { @@ -210,7 +210,7 @@ protected function getConsumableDatatypes() } /** - * @return string[] + * @return array */ protected function getProducibleDatatypes() { @@ -631,7 +631,7 @@ protected function getDefinitionReference($typeName) /** * Get the CamelCased type name in 'hyphen-separated-lowercase-words' format * - * e.g. test-module5-v1-entity-all-soap-and-rest + * E.g. test-module5-v1-entity-all-soap-and-rest * * @param string $typeName * @return string From b6867e13c63481a7b7b8fb0a04b03e43d4213508 Mon Sep 17 00:00:00 2001 From: Vishal Gelani <vishalgelani99@gmail.com> Date: Thu, 30 May 2019 12:26:09 +0530 Subject: [PATCH 265/464] Update Generator.php --- app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index 027a85cd08ce4..095484f0edd73 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -199,6 +199,8 @@ protected function getGeneralInfo() } /** + * List out consumes data type + * * @return array */ protected function getConsumableDatatypes() @@ -210,6 +212,8 @@ protected function getConsumableDatatypes() } /** + * List out produces data type + * * @return array */ protected function getProducibleDatatypes() From e9a64758e2124e07347dfc6f1f06209eea11f48d Mon Sep 17 00:00:00 2001 From: Vishal Gelani <vishalgelani99@gmail.com> Date: Thu, 30 May 2019 13:12:09 +0530 Subject: [PATCH 266/464] Update Generator.php --- app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index 095484f0edd73..e17e2b72efa50 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -200,7 +200,7 @@ protected function getGeneralInfo() /** * List out consumes data type - * + * * @return array */ protected function getConsumableDatatypes() @@ -213,7 +213,7 @@ protected function getConsumableDatatypes() /** * List out produces data type - * + * * @return array */ protected function getProducibleDatatypes() From 1f99b199a4c52852746f46c09ee12b48f4c707b8 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 30 May 2019 10:42:24 +0300 Subject: [PATCH 267/464] MAGETWO-99228: Wish List shows it has an item but is really empty --- .../ActionGroup/AdminProductActionGroup.xml | 4 ++ .../Mftf/Section/AdminProductFormSection.xml | 1 + .../Magento/Checkout/Block/Cart/Totals.php | 5 +- .../Sales/Block/Adminhtml/Order/View.php | 10 ++- app/code/Magento/Sales/etc/di.xml | 1 + .../Magento/Tax/Block/Checkout/Discount.php | 8 ++- .../Magento/Tax/Block/Checkout/Grandtotal.php | 6 +- .../Magento/Tax/Block/Checkout/Shipping.php | 6 +- .../Magento/Tax/Block/Checkout/Subtotal.php | 8 ++- .../Model/ResourceModel/Item/Collection.php | 69 ++++++++++++++++++- .../StorefrontCustomerWishlistActionGroup.xml | 6 ++ ...orefrontCustomerWishlistProductSection.xml | 2 + .../Test/WishListWithDisabledProductTest.xml | 50 ++++++++++++++ 13 files changed, 163 insertions(+), 13 deletions(-) create mode 100644 app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index 3c44a8f1898ad..23a5a709aced1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -483,4 +483,8 @@ <click selector="{{AdminAddUpSellProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/> <waitForPageLoad stepKey="waitForPageToLoad1"/> </actionGroup> + <actionGroup name="AdminSetProductDisabled"> + <conditionalClick selector="{{AdminProductFormSection.enableProductLabel}}" dependentSelector="{{AdminProductFormSection.productStatusValue('1')}}" visible="true" stepKey="disableProduct"/> + <seeElement selector="{{AdminProductFormSection.productStatusValue('2')}}" stepKey="assertThatProductSetToDisabled"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index f515171e835db..a90dc496050fb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -21,6 +21,7 @@ <element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/> <element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/> <element name="productStatus" type="checkbox" selector="input[name='product[status]']"/> + <element name="productStatusValue" type="checkbox" selector="input[name='product[status]'][value='{{value}}']" timeout="30" parameterized="true"/> <element name="productStatusDisabled" type="checkbox" selector="input[name='product[status]'][disabled]"/> <element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/> <element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/> diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php index 7ac5c1c149cc6..131e5b157c77a 100644 --- a/app/code/Magento/Checkout/Block/Cart/Totals.php +++ b/app/code/Magento/Checkout/Block/Cart/Totals.php @@ -8,6 +8,7 @@ use Magento\Framework\View\Element\BlockInterface; use Magento\Checkout\Block\Checkout\LayoutProcessorInterface; +use Magento\Sales\Model\ConfigInterface; /** * Totals cart block. @@ -45,7 +46,7 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param array $layoutProcessors * @param array $data * @codeCoverageIgnore @@ -54,7 +55,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, array $layoutProcessors = [], array $data = [] ) { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index 36c49ff5cbfea..c4701962b77e0 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -7,6 +7,8 @@ */ namespace Magento\Sales\Block\Adminhtml\Order; +use Magento\Sales\Model\ConfigInterface; + /** * Adminhtml sales order view * @api @@ -46,14 +48,14 @@ class View extends \Magento\Backend\Block\Widget\Form\Container /** * @param \Magento\Backend\Block\Widget\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param \Magento\Sales\Helper\Reorder $reorderHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, \Magento\Sales\Helper\Reorder $reorderHelper, array $data = [] ) { @@ -466,6 +468,8 @@ public function getReviewPaymentUrl($action) } /** + * Get edit message + * * @param \Magento\Sales\Model\Order $order * @return \Magento\Framework\Phrase */ @@ -486,6 +490,8 @@ protected function getEditMessage($order) } /** + * Get non editable types + * * @param \Magento\Sales\Model\Order $order * @return array */ diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 68fcd17122bd2..f6618c9884d60 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -116,6 +116,7 @@ <preference for="Magento\Sales\Api\RefundOrderInterface" type="Magento\Sales\Model\RefundOrder"/> <preference for="Magento\Sales\Api\RefundInvoiceInterface" type="Magento\Sales\Model\RefundInvoice"/> <preference for="Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProviderInterface" type="Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProvider" /> + <preference for="Magento\Sales\Model\ConfigInterface" type="Magento\Sales\Model\Config" /> <type name="Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProvider"> <arguments> <argument name="providers" xsi:type="array"> diff --git a/app/code/Magento/Tax/Block/Checkout/Discount.php b/app/code/Magento/Tax/Block/Checkout/Discount.php index c474c7a6580b5..70dac7c96c5ef 100644 --- a/app/code/Magento/Tax/Block/Checkout/Discount.php +++ b/app/code/Magento/Tax/Block/Checkout/Discount.php @@ -5,6 +5,8 @@ */ namespace Magento\Tax\Block\Checkout; +use Magento\Sales\Model\ConfigInterface; + /** * Subtotal Total Row Renderer */ @@ -19,7 +21,7 @@ class Discount extends \Magento\Checkout\Block\Total\DefaultTotal * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param \Magento\Tax\Model\Config $taxConfig * @param array $layoutProcessors * @param array $data @@ -28,7 +30,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, \Magento\Tax\Model\Config $taxConfig, array $layoutProcessors = [], array $data = [] @@ -39,6 +41,8 @@ public function __construct( } /** + * Get display including and excluding tax config + * * @return bool */ public function displayBoth() diff --git a/app/code/Magento/Tax/Block/Checkout/Grandtotal.php b/app/code/Magento/Tax/Block/Checkout/Grandtotal.php index 77af1ad99ea2c..607eef2f3bcdf 100644 --- a/app/code/Magento/Tax/Block/Checkout/Grandtotal.php +++ b/app/code/Magento/Tax/Block/Checkout/Grandtotal.php @@ -5,6 +5,8 @@ */ namespace Magento\Tax\Block\Checkout; +use Magento\Sales\Model\ConfigInterface; + /** * Subtotal Total Row Renderer */ @@ -26,7 +28,7 @@ class Grandtotal extends \Magento\Checkout\Block\Total\DefaultTotal * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param \Magento\Tax\Model\Config $taxConfig * @param array $layoutProcessors * @param array $data @@ -35,7 +37,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, \Magento\Tax\Model\Config $taxConfig, array $layoutProcessors = [], array $data = [] diff --git a/app/code/Magento/Tax/Block/Checkout/Shipping.php b/app/code/Magento/Tax/Block/Checkout/Shipping.php index 299c586fd224c..45c6e42574770 100644 --- a/app/code/Magento/Tax/Block/Checkout/Shipping.php +++ b/app/code/Magento/Tax/Block/Checkout/Shipping.php @@ -5,6 +5,8 @@ */ namespace Magento\Tax\Block\Checkout; +use Magento\Sales\Model\ConfigInterface; + /** * Subtotal Total Row Renderer */ @@ -26,7 +28,7 @@ class Shipping extends \Magento\Checkout\Block\Total\DefaultTotal * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param \Magento\Tax\Model\Config $taxConfig * @param array $layoutProcessors * @param array $data @@ -35,7 +37,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, \Magento\Tax\Model\Config $taxConfig, array $layoutProcessors = [], array $data = [] diff --git a/app/code/Magento/Tax/Block/Checkout/Subtotal.php b/app/code/Magento/Tax/Block/Checkout/Subtotal.php index 22da07954159d..23f9223ba51f3 100644 --- a/app/code/Magento/Tax/Block/Checkout/Subtotal.php +++ b/app/code/Magento/Tax/Block/Checkout/Subtotal.php @@ -5,6 +5,8 @@ */ namespace Magento\Tax\Block\Checkout; +use Magento\Sales\Model\ConfigInterface; + /** * Subtotal Total Row Renderer */ @@ -26,7 +28,7 @@ class Subtotal extends \Magento\Checkout\Block\Total\DefaultTotal * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Sales\Model\Config $salesConfig + * @param ConfigInterface $salesConfig * @param \Magento\Tax\Model\Config $taxConfig * @param array $layoutProcessors * @param array $data @@ -35,7 +37,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Sales\Model\Config $salesConfig, + ConfigInterface $salesConfig, \Magento\Tax\Model\Config $taxConfig, array $layoutProcessors = [], array $data = [] @@ -46,6 +48,8 @@ public function __construct( } /** + * Get display including and excluding tax config + * * @return bool */ public function displayBoth() diff --git a/app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection.php b/app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection.php index 5c131d27fb8d4..61d444f786ca8 100644 --- a/app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/ResourceModel/Item/Collection.php @@ -6,7 +6,11 @@ namespace Magento\Wishlist\Model\ResourceModel\Item; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer; +use Magento\CatalogInventory\Model\Stock; +use Magento\Framework\App\ObjectManager; use Magento\Framework\EntityManager\MetadataPool; +use Magento\Sales\Model\ConfigInterface; /** * Wishlist item collection @@ -144,6 +148,16 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab */ protected $metadataPool; + /** + * @var TableMaintainer + */ + private $tableMaintainer; + + /** + * @var ConfigInterface + */ + private $salesConfig; + /** * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory * @param \Psr\Log\LoggerInterface $logger @@ -163,6 +177,8 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab * @param \Magento\Wishlist\Model\ResourceModel\Item $resource * @param \Magento\Framework\App\State $appState * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection + * @param TableMaintainer|null $tableMaintainer + * @param ConfigInterface|null $salesConfig * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -184,7 +200,9 @@ public function __construct( \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory, \Magento\Wishlist\Model\ResourceModel\Item $resource, \Magento\Framework\App\State $appState, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null + \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, + TableMaintainer $tableMaintainer = null, + ConfigInterface $salesConfig = null ) { $this->stockConfiguration = $stockConfiguration; $this->_adminhtmlSales = $adminhtmlSales; @@ -199,6 +217,8 @@ public function __construct( $this->_catalogAttrFactory = $catalogAttrFactory; $this->_appState = $appState; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + $this->tableMaintainer = $tableMaintainer ?: ObjectManager::getInstance()->get(TableMaintainer::class); + $this->salesConfig = $salesConfig ?: ObjectManager::getInstance()->get(ConfigInterface::class); } /** @@ -330,6 +350,53 @@ protected function _assignProducts() return $this; } + /** + * @inheritdoc + */ + protected function _renderFiltersBefore() + { + parent::_renderFiltersBefore(); + + $mainTableName = 'main_table'; + $connection = $this->getConnection(); + + if ($this->_productInStock && !$this->stockConfiguration->isShowOutOfStock()) { + $inStockConditions = [ + "stockItem.product_id = {$mainTableName}.product_id", + $connection->quoteInto('stockItem.stock_status = ?', Stock::STOCK_IN_STOCK), + ]; + $this->getSelect()->join( + ['stockItem' => $this->getTable('cataloginventory_stock_status')], + join(' AND ', $inStockConditions), + [] + ); + } + + if ($this->_productVisible) { + $rootCategoryId = $this->_storeManager->getStore()->getRootCategoryId(); + $visibleInSiteIds = $this->_productVisibility->getVisibleInSiteIds(); + $visibilityConditions = [ + "cat_index.product_id = {$mainTableName}.product_id", + $connection->quoteInto('cat_index.category_id = ?', $rootCategoryId), + $connection->quoteInto('cat_index.visibility IN (?)', $visibleInSiteIds) + ]; + $this->getSelect()->join( + ['cat_index' => $this->tableMaintainer->getMainTable($this->_storeManager->getStore()->getId())], + join(' AND ', $visibilityConditions), + [] + ); + } + + if ($this->_productSalable) { + $availableProductTypes = $this->salesConfig->getAvailableProductTypes(); + $this->getSelect()->join( + ['cat_prod' => $this->getTable('catalog_product_entity')], + $this->getConnection()->quoteInto('cat_prod.type_id IN (?)', $availableProductTypes), + [] + ); + } + } + /** * Add filter by wishlist object * diff --git a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml index a1c5b9eae5c49..55e146b09eedd 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml @@ -97,4 +97,10 @@ <click selector="{{StorefrontCustomerWishlistShareSection.ProductShareWishlistButton}}" stepKey="sendWishlist"/> <see selector="{{StorefrontCustomerWishlistProductSection.productSuccessShareMessage}}" userInput="Your wish list has been shared." stepKey="successMessage"/> </actionGroup> + + <!-- Check that wishlist is empty --> + <actionGroup name="StorefrontAssertCustomerWishlistIsEmpty"> + <dontSeeElement selector="{{StorefrontCustomerWishlistProductSection.pager}}" stepKey="checkThatPagerIsAbsent"/> + <see selector="{{StorefrontCustomerWishlistProductSection.wishlistEmpty}}" userInput="You have no items in your wish list." stepKey="checkNoItemsMessage"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml index ef619726b76ab..0b6c2f1191c40 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml @@ -22,5 +22,7 @@ <element name="productShareWishList" type="button" selector="button.action.share" timeout="30" /> <element name="ProductSuccessUpdateMessage" type="text" selector="//div[1]/div[2]/div/div/div"/> <element name="productSuccessShareMessage" type="text" selector="div.message-success"/> + <element name="pager" type="block" selector=".toolbar .pager"/> + <element name="wishlistEmpty" type="block" selector=".form-wishlist-items .message.info.empty"/> </section> </sections> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml new file mode 100644 index 0000000000000..af216c139e7fe --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="WishListWithDisabledProductTest"> + <annotations> + <title value="Wish List should not include disabled products"/> + <stories value="Customer wishlist"/> + <description value="Wish List should not include disabled products and pager should be absent"/> + <severity value="MAJOR"/> + <useCaseId value="MAGETWO-99228"/> + <testCaseId value="MC-16050"/> + <group value="wishlist"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + </before> + <after> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProductPage"/> + <actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist"> + <argument name="productVar" value="$$createProduct$$"/> + </actionGroup> + <actionGroup ref="StorefrontCustomerCheckProductInWishlist" stepKey="checkProductInWishlist"> + <argument name="productVar" value="$$createProduct$$"/> + </actionGroup> + <openNewTab stepKey="openNewTab"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> + <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/> + <actionGroup ref="AdminSetProductDisabled" stepKey="disableProduct"/> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + <closeTab stepKey="closeSecondTab"/> + <reloadPage stepKey="refreshPage"/> + <actionGroup ref="StorefrontAssertCustomerWishlistIsEmpty" stepKey="checkProductIsAbsentInWishlistIsEmpty"/> + </test> +</tests> From b1bcd3706f51ae784adc1ac7c797acd1a439d847 Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <veronika_kurochkina@epam.com> Date: Thu, 30 May 2019 11:55:45 +0300 Subject: [PATCH 268/464] MAGETWO-80120: Magento\Framework\App\Test\Unit\BootstrapTest reset error handler to \Exception - Fix static --- .../Framework/Unserialize/Test/Unit/UnserializeTest.php | 4 +++- .../Framework/View/Test/Unit/TemplateEngine/PhpTest.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php index 34b41bff4fcab..0cf803be079d1 100644 --- a/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php +++ b/lib/internal/Magento/Framework/Unserialize/Test/Unit/UnserializeTest.php @@ -3,13 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\Unserialize\Test\Unit; use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\Unserialize\Unserialize; /** - * Test class for Magento/Framework/Unserialize/Unserialize. + * Test unserializer that does not unserialize objects. */ class UnserializeTest extends \PHPUnit\Framework\TestCase { diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php index e9da71d9118f7..b7f60f498565b 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php @@ -3,10 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\View\Test\Unit\TemplateEngine; /** - * Class PhpTest. + * Test template engine that enables PHP templates to be used for rendering. */ class PhpTest extends \PHPUnit\Framework\TestCase { From 1ff6e0f74d827c8e4d614fb307854d3ee307af9e Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 30 May 2019 16:53:52 +0300 Subject: [PATCH 269/464] magento/magento2#21394: Static test fix. --- .../Customer/Model/AccountManagement.php | 39 ++++-- .../Customer/Controller/AccountTest.php | 129 +++++++++++------- 2 files changed, 104 insertions(+), 64 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 393a342420246..15d98af86b72e 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -652,15 +652,17 @@ public function initiatePasswordReset($email, $template, $websiteId = null) */ private function handleUnknownTemplate($template) { - throw new InputException(__( - 'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.', - [ - 'value' => $template, - 'fieldName' => 'template', - 'template1' => AccountManagement::EMAIL_REMINDER, - 'template2' => AccountManagement::EMAIL_RESET - ] - )); + throw new InputException( + __( + 'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.', + [ + 'value' => $template, + 'fieldName' => 'template', + 'template1' => AccountManagement::EMAIL_REMINDER, + 'template2' => AccountManagement::EMAIL_RESET + ] + ) + ); } /** @@ -1314,13 +1316,20 @@ protected function sendEmailTemplate( } $transport = $this->transportBuilder->setTemplateIdentifier($templateId) - ->setTemplateOptions(['area' => Area::AREA_FRONTEND, 'store' => $storeId]) + ->setTemplateOptions( + [ + 'area' => Area::AREA_FRONTEND, + 'store' => $storeId + ] + ) ->setTemplateVars($templateParams) - ->setFrom($this->scopeConfig->getValue( - $sender, - ScopeInterface::SCOPE_STORE, - $storeId - )) + ->setFrom( + $this->scopeConfig->getValue( + $sender, + ScopeInterface::SCOPE_STORE, + $storeId + ) + ) ->addTo($email, $this->customerViewHelper->getCustomerName($customer)) ->getTransport(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php index 9377c872517ce..898d3ff400b38 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php @@ -315,11 +315,13 @@ public function testWithConfirmCreatePostAction() $this->dispatch('customer/account/createPost'); $this->assertRedirect($this->stringContains('customer/account/index/')); $this->assertSessionMessages( - $this->equalTo([ - 'You must confirm your account. Please check your email for the confirmation link or ' + $this->equalTo( + [ + 'You must confirm your account. Please check your email for the confirmation link or ' . '<a href="http://localhost/index.php/customer/account/confirmation/' . '?email=test2%40email.com">click here</a> for a new link.' - ]), + ] + ), MessageInterface::TYPE_SUCCESS ); } @@ -333,10 +335,14 @@ public function testExistingEmailCreatePostAction() $this->dispatch('customer/account/createPost'); $this->assertRedirect($this->stringContains('customer/account/create/')); $this->assertSessionMessages( - $this->equalTo(['There is already an account with this email address. ' . - 'If you are sure that it is your email address, ' . - '<a href="http://localhost/index.php/customer/account/forgotpassword/">click here</a>' . - ' to get your password and access your account.', ]), + $this->equalTo( + [ + 'There is already an account with this email address. ' . + 'If you are sure that it is your email address, ' . + '<a href="http://localhost/index.php/customer/account/forgotpassword/">click here</a>' . + ' to get your password and access your account.', + ] + ), MessageInterface::TYPE_ERROR ); } @@ -348,7 +354,11 @@ public function testInactiveUserConfirmationAction() { $this->getRequest() ->setMethod('POST') - ->setPostValue(['email' => 'customer@needAconfirmation.com']); + ->setPostValue( + [ + 'email' => 'customer@needAconfirmation.com', + ] + ); $this->dispatch('customer/account/confirmation'); $this->assertRedirect($this->stringContains('customer/account/index')); @@ -365,14 +375,20 @@ public function testActiveUserConfirmationAction() { $this->getRequest() ->setMethod('POST') - ->setPostValue([ - 'email' => 'customer@example.com', - ]); + ->setPostValue( + [ + 'email' => 'customer@example.com', + ] + ); $this->dispatch('customer/account/confirmation'); $this->assertRedirect($this->stringContains('customer/account/index')); $this->assertSessionMessages( - $this->equalTo(['This email does not require confirmation.']), + $this->equalTo( + [ + 'This email does not require confirmation.', + ] + ), MessageInterface::TYPE_SUCCESS ); } @@ -413,9 +429,11 @@ public function testForgotPasswordPostWithBadEmailAction() { $this->getRequest()->setMethod(HttpRequest::METHOD_POST); $this->getRequest() - ->setPostValue([ - 'email' => 'bad@email', - ]); + ->setPostValue( + [ + 'email' => 'bad@email', + ] + ); $this->dispatch('customer/account/forgotPasswordPost'); $this->assertRedirect($this->stringContains('customer/account/forgotpassword')); @@ -434,10 +452,12 @@ public function testResetPasswordPostNoTokenAction() ->setParam('id', 1) ->setParam('token', '8ed8677e6c79e68b94e61658bd756ea5') ->setMethod('POST') - ->setPostValue([ - 'password' => 'new-password', - 'password_confirmation' => 'new-password', - ]); + ->setPostValue( + [ + 'password' => 'new-password', + 'password_confirmation' => 'new-password', + ] + ); $this->dispatch('customer/account/resetPasswordPost'); $this->assertRedirect($this->stringContains('customer/account/')); @@ -457,10 +477,12 @@ public function testResetPasswordPostAction() ->setQueryValue('id', 1) ->setQueryValue('token', '8ed8677e6c79e68b94e61658bd756ea5') ->setMethod('POST') - ->setPostValue([ - 'password' => 'new-Password1', - 'password_confirmation' => 'new-Password1', - ]); + ->setPostValue( + [ + 'password' => 'new-Password1', + 'password_confirmation' => 'new-Password1', + ] + ); $this->dispatch('customer/account/resetPasswordPost'); $this->assertRedirect($this->stringContains('customer/account/login')); @@ -483,8 +505,11 @@ public function testEditAction() $this->assertEquals(200, $this->getResponse()->getHttpResponseCode(), $body); $this->assertContains('<div class="field field-name-firstname required">', $body); // Verify the password check box is not checked - $this->assertContains('<input type="checkbox" name="change_password" id="change-password" ' - . 'data-role="change-password" value="1" title="Change Password" class="checkbox" />', $body); + $this->assertContains( + '<input type="checkbox" name="change_password" id="change-password" ' + . 'data-role="change-password" value="1" title="Change Password" class="checkbox" />', + $body + ); } /** @@ -528,14 +553,16 @@ public function testEditPostAction() $this->login(1); $this->getRequest() ->setMethod('POST') - ->setPostValue([ - 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), - 'firstname' => 'John', - 'lastname' => 'Doe', - 'email' => 'johndoe@email.com', - 'change_email' => 1, - 'current_password' => 'password' - ]); + ->setPostValue( + [ + 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'johndoe@email.com', + 'change_email' => 1, + 'current_password' => 'password' + ] + ); $this->dispatch('customer/account/editPost'); @@ -666,16 +693,18 @@ public function testWrongConfirmationEditPostAction() $this->login(1); $this->getRequest() ->setMethod('POST') - ->setPostValue([ - 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), - 'firstname' => 'John', - 'lastname' => 'Doe', - 'email' => 'johndoe@email.com', - 'change_password' => 1, - 'current_password' => 'password', - 'password' => 'new-password', - 'password_confirmation' => 'new-password-no-match', - ]); + ->setPostValue( + [ + 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'johndoe@email.com', + 'change_password' => 1, + 'current_password' => 'password', + 'password' => 'new-password', + 'password_confirmation' => 'new-password-no-match', + ] + ); $this->dispatch('customer/account/editPost'); @@ -859,13 +888,15 @@ private function getCustomerByEmail($email) */ private function prepareRequest() { - $post = new Parameters([ - 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), - 'login' => [ - 'username' => 'customer@example.com', - 'password' => 'password' + $post = new Parameters( + [ + 'form_key' => $this->_objectManager->get(FormKey::class)->getFormKey(), + 'login' => [ + 'username' => 'customer@example.com', + 'password' => 'password' + ] ] - ]); + ); $request = $this->getRequest(); $formKey = $this->_objectManager->get(FormKey::class); $request->setParam('form_key', $formKey->getFormKey()); From fa71e4060aae193fa935ee525c1444f80db20f6e Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Thu, 30 May 2019 08:33:04 -0500 Subject: [PATCH 270/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../catalog/product/edit/options/type/select.phtml | 2 +- .../view/frontend/templates/product/compare/sidebar.phtml | 2 +- .../frontend/templates/product/widget/compared/grid.phtml | 6 ++---- .../frontend/templates/product/widget/compared/list.phtml | 4 +--- .../templates/product/widget/compared/sidebar.phtml | 4 +--- .../frontend/templates/product/widget/viewed/sidebar.phtml | 4 +--- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml index e906b753b99cd..c7ff03a08d954 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml @@ -56,7 +56,7 @@ <?php endif; ?>> </td> <td class="col-price-type select-opt-price-type"> - <?= /* @escapeNotVerified */ $block->getPriceTypeSelectHtml('data-attr="price-type" <% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%- data.checkboxScopePrice %> + <?= /* @noEscape */ $block->getPriceTypeSelectHtml('data-attr="price-type" <% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%- data.checkboxScopePrice %> </td> <?php else : ?> <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_price" name="product[options][<%- data.id %>][values][<%- data.select_id %>][price]" type="hidden"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml index 856ab4d86dde7..809ddc5c61701 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml @@ -48,5 +48,5 @@ <!-- /ko --> </div> <script type="text/x-magento-init"> -{"[data-role=compare-products-sidebar]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}} +{"[data-role=compare-products-sidebar]": {"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>}} </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml index e0550cc7d4414..210aa248a50f6 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml @@ -1,10 +1,8 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php /** @@ -12,7 +10,7 @@ */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?= /* @noEscape */ $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml index 3a4f81d946bfd..12ea7d2796e7f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml @@ -3,8 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php /** @@ -12,7 +10,7 @@ */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?= /* @noEscape */ $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'list' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml index 2d2c91aadd473..187b65a9620e2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml @@ -3,8 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php /** @@ -12,7 +10,7 @@ */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?= /* @noEscape */ $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml index 1c4ad3105a2b5..a1748785fda0d 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml @@ -3,8 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php /** @@ -12,7 +10,7 @@ */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?= /* @noEscape */ $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' From 44cbc35b1d265731f9d335bcc033f1dec03b61a4 Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 09:58:40 -0500 Subject: [PATCH 271/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - updated merge conflicts --- .../SetAuthorizeNetPaymentMethodOnCartTest.php | 16 ++-------------- .../SetAuthorizeNetPaymentMethodOnCartTest.php | 16 ++-------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php index 2861eb490e34d..e1c92889cbacf 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -13,6 +13,7 @@ use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** * Tests SetPaymentMethod mutation for customer via authorizeNet payment @@ -21,7 +22,7 @@ * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SetAuthorizenetPaymentMethodOnCustomerCartTest extends \Magento\TestFramework\Indexer\TestCase +class SetAuthorizenetPaymentMethodOnCartTest extends TestCase { const CONTENT_TYPE = 'application/json'; @@ -44,19 +45,6 @@ class SetAuthorizenetPaymentMethodOnCustomerCartTest extends \Magento\TestFramew /** @var Http */ private $request; - public static function setUpBeforeClass() - { - $db = Bootstrap::getInstance()->getBootstrap() - ->getApplication() - ->getDbInstance(); - if (!$db->isDbDumpExists()) { - throw new \LogicException('DB dump does not exist.'); - } - $db->restoreFromDbDump(); - - parent::setUpBeforeClass(); - } - protected function setUp() : void { $this->objectManager = Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php index 0141be6f97cab..ba63861086b1d 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -12,6 +12,7 @@ use Magento\GraphQl\Controller\GraphQl; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** * Tests SetPaymentMethod mutation for guest via authorizeNet payment @@ -20,7 +21,7 @@ * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SetAuthorizeNetPaymentMethodOnGuestCartTest extends \Magento\TestFramework\Indexer\TestCase +class SetAuthorizeNetPaymentMethodOnCartTest extends TestCase { const CONTENT_TYPE = 'application/json'; @@ -39,19 +40,6 @@ class SetAuthorizeNetPaymentMethodOnGuestCartTest extends \Magento\TestFramework /** @var Http */ private $request; - public static function setUpBeforeClass() - { - $db = Bootstrap::getInstance()->getBootstrap() - ->getApplication() - ->getDbInstance(); - if (!$db->isDbDumpExists()) { - throw new \LogicException('DB dump does not exist.'); - } - $db->restoreFromDbDump(); - - parent::setUpBeforeClass(); - } - protected function setUp() : void { $this->objectManager = Bootstrap::getObjectManager(); From 80a222047af92f2c1d7dda88ecad69e0fd71197b Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Thu, 30 May 2019 10:36:29 -0500 Subject: [PATCH 272/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - Addressed static errors from builds --- .../Customer/PlaceOrderWithAuthorizeNetTest.php | 10 ++-------- .../Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php | 7 ++----- .../_files/add_simple_products_authorizenet.php | 2 -- .../_files/place_order_customer_authorizenet.php | 1 - .../_files/place_order_guest_authorizenet.php | 3 --- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php index ed7eee3163340..82c3d02b191f7 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -52,16 +52,13 @@ class PlaceOrderWithAuthorizeNetTest extends TestCase /** @var Http */ private $request; - /** - * @var ZendClient|MockObject|InvocationMocker */ + /** @var ZendClient|MockObject|InvocationMocker */ private $clientMock; /** @var CustomerTokenServiceInterface */ private $customerTokenService; - /** - * @var Zend_Http_Response - */ + /** @var Zend_Http_Response */ protected $responseMock; /** @var PaymentFactory */ @@ -159,9 +156,6 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void /** @var Order $order */ $fullOrder = include __DIR__ . '/../../../_files/place_order_customer_authorizenet.php'; - $payment = $fullOrder->getPayment(); - $paymentDO = $this->paymentFactory->create($payment); - $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php index 1c1b4835b3b98..2decfb0b474e9 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php @@ -50,13 +50,10 @@ class PlaceOrderWithAuthorizeNetTest extends TestCase /** @var Http */ private $request; - /** - * @var ZendClient|MockObject|InvocationMocker */ + /** @var ZendClient|MockObject|InvocationMocker */ private $clientMock; - /** - * @var Zend_Http_Response - */ + /** @var Zend_Http_Response */ protected $responseMock; /** @var PaymentFactory */ diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php index f297559489f53..3646e864ab49e 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php @@ -24,7 +24,5 @@ $quote = $quoteFactory->create(); $quoteResource->load($quote, 'test_quote', 'reserved_order_id'); -//$quoteResource->load($quote, '100000001', 'reserved_order_id'); -//$quote->addProduct($product, 2); $quote->addProduct($product, 4); $cartRepository->save($quote); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php index 68ecc0a228e7c..e6909c486845f 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php @@ -102,7 +102,6 @@ ->setStatus(Order::STATE_PROCESSING) ->setCustomerId((int)$customer->getId()) ->setCustomerIsGuest(false) - //->setRemoteIp('127.0.0.1') ->setCreatedAt(date('Y-m-d 00:00:55')) ->setOrderCurrencyCode('USD') ->setBaseCurrencyCode('USD') diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php index 1856b2dd5330e..8821fddb2047f 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php @@ -94,7 +94,6 @@ ->setProductType($product->getTypeId()); $orderAmount = 100; -//$orderAmount = 30; $customerEmail = $billingAddress->getEmail(); /** @var Order $order */ @@ -102,10 +101,8 @@ $order->setState(Order::STATE_PROCESSING) ->setIncrementId('test_quote') ->setStatus(Order::STATE_PROCESSING) - // ->setCustomerId($customer->getId()) ->setCustomerId(null) ->setCustomerIsGuest(true) - //->setRemoteIp('127.0.0.1') ->setCreatedAt(date('Y-m-d 00:00:55')) ->setOrderCurrencyCode('USD') ->setBaseCurrencyCode('USD') From 0784da7181bbfb2e6e32f90849cc9cefaa62ef5b Mon Sep 17 00:00:00 2001 From: Anusha Vattam <avattam@adobe.com> Date: Thu, 30 May 2019 10:55:14 -0500 Subject: [PATCH 273/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - Addressed few errors --- .../Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php | 3 +++ .../_files/place_order_customer_authorizenet.php | 1 + .../Magento/AuthorizenetGraphQl/_files/request_authorize.php | 1 + .../AuthorizenetGraphQl/_files/request_authorize_customer.php | 1 + 4 files changed, 6 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php index 82c3d02b191f7..f783ccae5fce7 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -156,6 +156,9 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void /** @var Order $order */ $fullOrder = include __DIR__ . '/../../../_files/place_order_customer_authorizenet.php'; + $payment = $fullOrder->getPayment(); + $this->paymentFactory->create($payment); + $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php index e6909c486845f..5f8b23448ecfb 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php @@ -16,6 +16,7 @@ use Magento\Sales\Model\Order\Address; use Magento\Sales\Model\Order\Item; use Magento\TestFramework\Helper\Bootstrap; + require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php'; require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php index a63a86a993c6f..65ca4a09dca45 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php @@ -6,6 +6,7 @@ declare(strict_types=1); use Magento\TestFramework\ObjectManager; + /** @var \Magento\Sales\Model\Order $order */ $order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php index 45fb16e899f0b..05f1b5db5c8c6 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php @@ -6,6 +6,7 @@ declare(strict_types=1); use Magento\TestFramework\ObjectManager; + /** @var \Magento\Sales\Model\Order $order */ $order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); From a28b80a0cedf8681ebb2da82fa11be32b37ecd38 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Thu, 30 May 2019 10:55:48 -0500 Subject: [PATCH 274/464] MAGETWO-99282: Eliminate @escapeNotVerified in Magento_Catalog module --- .../frontend/templates/product/widget/compared/grid.phtml | 8 ++++---- .../frontend/templates/product/widget/compared/list.phtml | 8 ++++---- .../templates/product/widget/compared/sidebar.phtml | 8 ++++---- .../templates/product/widget/viewed/sidebar.phtml | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml index 210aa248a50f6..a2187b685ca0e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml @@ -5,12 +5,12 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @noEscape */ $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml index 12ea7d2796e7f..5c5f6493c3163 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml @@ -5,12 +5,12 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @noEscape */ $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'list' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml index 187b65a9620e2..8db3cc80368e2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml @@ -5,12 +5,12 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @noEscape */ $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml index a1748785fda0d..a42b46a5238f9 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml @@ -5,12 +5,12 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @noEscape */ $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' From a9075778401401d7dc7e062e2574ac78b4958cd5 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 30 May 2019 11:29:31 -0500 Subject: [PATCH 275/464] MC-16873: Generate critical css file for LUMA - Loader: Base example --- .../Controller/Result/AsyncCssPlugin.php | 10 ++++-- .../Controller/Result/JsFooterPlugin.php | 2 ++ .../Theme/view/frontend/layout/default.xml | 4 ++- .../Theme/view/frontend/requirejs-config.js | 3 +- .../templates/html/main_css_preloader.phtml | 7 ++++ .../web/js/view/critical-css-loader.js | 32 +++++++++++++++++++ .../Magento/luma/web/css/critical.css | 1 + 7 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml create mode 100644 app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php index 577141d4fb9cc..c2deefe4502e0 100644 --- a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Theme\Controller\Result; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -42,7 +44,7 @@ public function beforeSendResponse(Http $subject): void if (strpos($content, '</body') !== false && $this->scopeConfig->isSetFlag( self::XML_PATH_USE_CSS_CRITICAL_PATH, ScopeInterface::SCOPE_STORE - )) { + )) { // add link rel preload to style sheets $content = preg_replace_callback( '@<link\b.*?rel=("|\')stylesheet\1.*?/>@', @@ -54,7 +56,11 @@ function ($matches) { } $media = $media ?? 'all'; $loadCssAsync = sprintf( - '<link rel="preload" as="style" media="%s" onload="this.onload=null;this.rel=\'stylesheet\'"' . + '<link rel="preload" as="style" media="%s" + onload=" + this.onload=null; + this.rel=\'stylesheet\'; + document.dispatchEvent(new Event(\'criticalCssLoaded\'));"' . 'href="%s"><noscript><link rel="stylesheet" href="%s"></noscript>', $media, $href, diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php index a234cd589904c..ff5f02a0de5c5 100644 --- a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Theme\Controller\Result; use Magento\Framework\App\Config\ScopeConfigInterface; diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml index f19f20861dcfc..07d344cb3658f 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default.xml @@ -107,7 +107,9 @@ </container> </referenceContainer> <referenceContainer name="main"> - <container name="content.top" label="Main Content Top"/> + <container name="content.top" label="Main Content Top"> + <block name="main_css_preloader" as="main_css_preloader" template="Magento_Theme::html/main_css_preloader.phtml" ifconfig="dev/css/use_css_critical_path"/> + </container> <container name="content" label="Main Content Area"/> <container name="content.aside" label="Main Content Aside"/> <container name="content.bottom" label="Main Content Bottom"/> diff --git a/app/code/Magento/Theme/view/frontend/requirejs-config.js b/app/code/Magento/Theme/view/frontend/requirejs-config.js index ef46f4bfed825..a9f874ace6628 100644 --- a/app/code/Magento/Theme/view/frontend/requirejs-config.js +++ b/app/code/Magento/Theme/view/frontend/requirejs-config.js @@ -28,7 +28,8 @@ var config = { 'popupWindow': 'mage/popup-window', 'validation': 'mage/validation/validation', 'welcome': 'Magento_Theme/js/view/welcome', - 'breadcrumbs': 'Magento_Theme/js/view/breadcrumbs' + 'breadcrumbs': 'Magento_Theme/js/view/breadcrumbs', + 'criticalCssLoader': 'Magento_Theme/js/view/critical-css-loader', } }, paths: { diff --git a/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml new file mode 100644 index 0000000000000..8ca60464d484a --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml @@ -0,0 +1,7 @@ +<div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"criticalCssLoader": {}}'> + <div class="loader"> + <img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')); ?>" + alt="<?= $block->escapeHtml(__('Loading...')); ?>" + style="position: absolute;"> + </div> +</div> diff --git a/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js b/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js new file mode 100644 index 0000000000000..012f2106504c0 --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js @@ -0,0 +1,32 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +define([ + 'rjsResolver' +], function (resolver) { + 'use strict'; + + /** + * Removes provided loader element from DOM. + * + * @param {HTMLElement} $loader - Loader DOM element. + */ + function hideLoader($loader) { + document.addEventListener('criticalCssLoaded', function (e) { + $loader.parentNode.removeChild($loader); + }, false); + } + + /** + * Initializes assets loading process listener. + * + * @param {Object} config - Optional configuration + * @param {HTMLElement} $loader - Loader DOM element. + */ + function init(config, $loader) { + resolver(hideLoader.bind(null, $loader)); + } + + return init; +}); diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css index e69de29bb2d1d..656bf46357243 100644 --- a/app/design/frontend/Magento/luma/web/css/critical.css +++ b/app/design/frontend/Magento/luma/web/css/critical.css @@ -0,0 +1 @@ +.load.indicator{background-color:rgba(255,255,255,0.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url('../images/loader-2.gif') no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,0.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative} \ No newline at end of file From 6bac9b9b88ea1f93df3a9b1c335ea52308bdb758 Mon Sep 17 00:00:00 2001 From: Piotr Kaminski <piotrekkaminski@users.noreply.github.com> Date: Thu, 30 May 2019 12:42:33 -0500 Subject: [PATCH 276/464] Create Security.md file to show on GitHub Security/Policy page Create Security.md file to show on GitHub Security/Policy page as default policy --- SECURITY.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000000..2b06199e5f95a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,10 @@ +# Reporting Security Issues + +Magento values the contributions of the security research community, and we look forward to working with you to minimize risk to Magento merchants. + +## Where should I report security issues? + +We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/magento). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps. + +## Learning More About Security +To learn more about securing a Magento store, please visit the [Security Center](https://magento.com/security). From c5c78c24c945706ac5aa189d2f089f9b9fda47fd Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Thu, 30 May 2019 12:50:34 -0500 Subject: [PATCH 277/464] MC-16976: Flaky MFTF Test: Flaky MFTF Test: MC-14748: Validate product special price after update - Improving waits for MC-14748 MFTF test --- .../Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml | 2 ++ ...refrontAssertProductSpecialPriceOnProductPageActionGroup.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index 3c44a8f1898ad..95e24f1f6fcfc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -304,9 +304,11 @@ </arguments> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickAdvancedPricingLink"/> + <waitForPageLoad stepKey="waitForAdvancedPricingModal"/> <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitSpecialPrice"/> <fillField userInput="{{price}}" selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="fillSpecialPrice"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForAdvancedPricingModalGone"/> <waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductSpecialPriceOnProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductSpecialPriceOnProductPageActionGroup.xml index ee71a3ace4449..9fefa71f10209 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductSpecialPriceOnProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAssertProductSpecialPriceOnProductPageActionGroup.xml @@ -13,6 +13,7 @@ </arguments> <amOnPage url="{{StorefrontProductPage.url(product.name)}}" stepKey="onFirstProductPage"/> <waitForPageLoad stepKey="waitForFirstProductPage"/> + <waitForElementVisible selector="{{StorefrontProductInfoMainSection.specialPriceValue}}" stepKey="waitForProductSpecialPrice"/> <grabTextFrom selector="{{StorefrontProductInfoMainSection.specialPriceValue}}" stepKey="grabProductSpecialPrice"/> <assertEquals actual="$grabProductSpecialPrice" expectedType="string" expected="{{specialPrice}}" stepKey="assertProductPriceValuesAreEqual"/> </actionGroup> From 936830f4fce50d180669dc587c2c96dfb22fd535 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Thu, 30 May 2019 12:55:25 -0500 Subject: [PATCH 278/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method --- .../PlaceOrderWithAuthorizeNetTest.php | 12 +- .../Guest/PlaceOrderWithAuthorizeNetTest.php | 17 +-- .../place_order_customer_authorizenet.php | 123 ------------------ .../_files/place_order_guest_authorizenet.php | 123 ------------------ 4 files changed, 2 insertions(+), 273 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php delete mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php index f783ccae5fce7..6a94183128e80 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -12,8 +12,6 @@ use Magento\GraphQl\Controller\GraphQl; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; use Magento\Integration\Api\CustomerTokenServiceInterface; -use Magento\Payment\Gateway\Command\CommandPoolInterface; -use Magento\Sales\Model\Order; use Magento\Framework\Webapi\Request; use Magento\TestFramework\Helper\Bootstrap; use Magento\Framework\HTTP\ZendClient; @@ -92,6 +90,7 @@ protected function setUp() : void * @magentoConfigFixture default_store payment/authorizenet_acceptjs/login someusername * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_key somepassword * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc + * @magentoDataFixture Magento/Sales/_files/default_rollback.php * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php * @magentoDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php @@ -150,15 +149,6 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void $graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); - /** @var CommandPoolInterface $commandPool */ - $commandPool = $this->objectManager->get('AuthorizenetAcceptjsCommandPool'); - $commandPool->get('authorize'); - /** @var Order $order */ - $fullOrder = include __DIR__ . '/../../../_files/place_order_customer_authorizenet.php'; - - $payment = $fullOrder->getPayment(); - $this->paymentFactory->create($payment); - $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php index 2decfb0b474e9..018fad56477c1 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php @@ -11,8 +11,6 @@ use Magento\Framework\Serialize\SerializerInterface; use Magento\GraphQl\Controller\GraphQl; use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; -use Magento\Payment\Gateway\Command\CommandPoolInterface; -use Magento\Sales\Model\Order; use Magento\TestFramework\Helper\Bootstrap; use Magento\Framework\HTTP\ZendClient; use Magento\Framework\HTTP\ZendClientFactory; @@ -86,6 +84,7 @@ protected function setUp() : void * @magentoConfigFixture default_store payment/authorizenet_acceptjs/login someusername * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_key somepassword * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc + * @magentoDataFixture Magento/Sales/_files/default_rollback.php * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php @@ -137,15 +136,6 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void ->addHeaders(['Content-Type' => 'application/json']); $this->request->setHeaders($headers); - /** @var CommandPoolInterface $commandPool */ - $commandPool = $this->objectManager->get('AuthorizenetAcceptjsCommandPool'); - $command = $commandPool->get('authorize'); - /** @var Order $order */ - $fullOrder = include __DIR__ . '/../../../_files/place_order_guest_authorizenet.php'; - - $payment = $fullOrder->getPayment(); - $paymentDO = $this->paymentFactory->create($payment); - $expectedRequest = include __DIR__ . '/../../../_files/request_authorize.php'; $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; @@ -154,11 +144,6 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void $this->responseMock->method('getBody')->willReturn(json_encode($authorizeResponse)); - $command->execute([ - 'payment' => $paymentDO, - 'amount' => 100.00 - ]); - $response = $this->graphql->dispatch($this->request); $responseData = $this->jsonSerializer->unserialize($response->getContent()); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php deleted file mode 100644 index 5f8b23448ecfb..0000000000000 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_customer_authorizenet.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -declare(strict_types=1); - -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\Catalog\Model\Product\Type; -use Magento\Catalog\Model\Product\Visibility; -use Magento\Sales\Model\Order; -use Magento\Sales\Model\Order\Payment; -use Magento\Sales\Model\Order\Address; -use Magento\Sales\Model\Order\Item; -use Magento\TestFramework\Helper\Bootstrap; - -require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php'; -require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; - -$objectManager = Bootstrap::getObjectManager(); - -/** @var $product Product */ -$product = $objectManager->create(Product::class); -$product->isObjectNew(true); -$product->setTypeId(Type::TYPE_SIMPLE) - ->setId(1) - ->setAttributeSetId(4) - ->setWebsiteIds([1]) - ->setName('Simple Product') - ->setSku('simple_product') - ->setPrice(10) - ->setWeight(1) - ->setShortDescription('Short description') - ->setTaxClassId(0) - ->setDescription('Description with <b>html tag</b>') - ->setMetaTitle('meta title') - ->setMetaKeyword('meta keyword') - ->setMetaDescription('meta description') - ->setVisibility(Visibility::VISIBILITY_BOTH) - ->setStatus(Status::STATUS_ENABLED) - ->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ])->setCanSaveCustomOptions(true) - ->setHasOptions(false); - -/** @var ProductRepositoryInterface $productRepository */ -$productRepository = $objectManager->create(ProductRepositoryInterface::class); -$productRepository->save($product); - -$addressData = [ - 'region' => 'CA', - 'region_id' => '12', - 'postcode' => '11111', - 'lastname' => 'lastname', - 'firstname' => 'firstname', - 'street' => 'street', - 'city' => 'Los Angeles', - 'email' => 'customer@example.com', - 'telephone' => '11111111', - 'country_id' => 'US' -]; -$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]); -$billingAddress->setAddressType('billing'); - -$shippingAddress = clone $billingAddress; -$shippingAddress->setId(null) - ->setAddressType('shipping') - ->setStreet(['6161 West Centinela Avenue']) - ->setFirstname('John') - ->setLastname('Doe') - ->setShippingMethod('flatrate_flatrate'); - -$payment = $objectManager->create(Payment::class); -$payment->setAdditionalInformation('ccLast4', '1111'); -$payment->setAdditionalInformation('opaqueDataDescriptor', 'mydescriptor'); -$payment->setAdditionalInformation('opaqueDataValue', 'myvalue'); -$payment->setAuthorizationTransaction(true); - -/** @var Item $orderItem */ -$orderItem1 = $objectManager->create(Item::class); -$orderItem1->setProductId($product->getId()) - ->setSku($product->getSku()) - ->setName($product->getName()) - ->setQtyOrdered(2) - ->setBasePrice($product->getPrice()) - ->setPrice($product->getPrice()) - ->setRowTotal($product->getPrice()) - ->setProductType($product->getTypeId()); - -$orderAmount = 100; -$customerEmail = $billingAddress->getEmail(); - -/** @var Order $order */ -$order = $objectManager->create(Order::class); -$order->setState(Order::STATE_PROCESSING) - ->setIncrementId('test_quote') - ->setStatus(Order::STATE_PROCESSING) - ->setCustomerId((int)$customer->getId()) - ->setCustomerIsGuest(false) - ->setCreatedAt(date('Y-m-d 00:00:55')) - ->setOrderCurrencyCode('USD') - ->setBaseCurrencyCode('USD') - ->setSubtotal($orderAmount) - ->setGrandTotal($orderAmount) - ->setBaseSubtotal($orderAmount) - ->setBaseGrandTotal($orderAmount) - ->setCustomerEmail($customerEmail) - ->setBillingAddress($billingAddress) - ->setShippingAddress($shippingAddress) - ->setShippingDescription('Flat Rate - Fixed') - ->setShippingAmount(10) - ->setStoreId(1) - ->addItem($orderItem1) - ->setQuoteId(1) - ->setPayment($payment); - -return $order; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php deleted file mode 100644 index 8821fddb2047f..0000000000000 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/place_order_guest_authorizenet.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -declare(strict_types=1); - -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\Catalog\Model\Product\Type; -use Magento\Catalog\Model\Product\Visibility; -use Magento\Sales\Model\Order; -use Magento\Sales\Model\Order\Payment; -use Magento\Sales\Model\Order\Address; -use Magento\Sales\Model\Order\Item; -use Magento\TestFramework\Helper\Bootstrap; - -require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php'; -require __DIR__ . '/../../../Magento/Customer/_files/not_logged_in_customer.php'; - -$objectManager = Bootstrap::getObjectManager(); - -/** @var $product Product */ -$product = $objectManager->create(Product::class); -$product->isObjectNew(true); -$product->setTypeId(Type::TYPE_SIMPLE) - ->setId(1) - ->setAttributeSetId(4) - ->setWebsiteIds([1]) - ->setName('Simple Product') - ->setSku('simple_product') - ->setPrice(10) - ->setWeight(1) - ->setShortDescription('Short description') - ->setTaxClassId(0) - ->setDescription('Description with <b>html tag</b>') - ->setMetaTitle('meta title') - ->setMetaKeyword('meta keyword') - ->setMetaDescription('meta description') - ->setVisibility(Visibility::VISIBILITY_BOTH) - ->setStatus(Status::STATUS_ENABLED) - ->setStockData([ - 'use_config_manage_stock' => 1, - 'qty' => 100, - 'is_qty_decimal' => 0, - 'is_in_stock' => 1, - ])->setCanSaveCustomOptions(true) - ->setHasOptions(false); - -/** @var ProductRepositoryInterface $productRepository */ -$productRepository = $objectManager->create(ProductRepositoryInterface::class); -$productRepository->save($product); - -$addressData = [ - 'region' => 'CA', - 'region_id' => '12', - 'postcode' => '11111', - 'lastname' => 'lastname', - 'firstname' => 'firstname', - 'street' => 'street', - 'city' => 'Los Angeles', - 'email' => 'guest@example.com', - 'telephone' => '11111111', - 'country_id' => 'US' -]; -$billingAddress = $objectManager->create(Address::class, ['data' => $addressData]); -$billingAddress->setAddressType('billing'); - -$shippingAddress = clone $billingAddress; -$shippingAddress->setId(null) - ->setAddressType('shipping') - ->setStreet(['6161 West Centinela Avenue']) - ->setFirstname('John') - ->setLastname('Doe') - ->setShippingMethod('flatrate_flatrate'); - -$payment = $objectManager->create(Payment::class); -$payment->setAdditionalInformation('ccLast4', '1111'); -$payment->setAdditionalInformation('opaqueDataDescriptor', 'mydescriptor'); -$payment->setAdditionalInformation('opaqueDataValue', 'myvalue'); -$payment->setAuthorizationTransaction(true); - -/** @var Item $orderItem */ -$orderItem1 = $objectManager->create(Item::class); -$orderItem1->setProductId($product->getId()) - ->setSku($product->getSku()) - ->setName($product->getName()) - ->setQtyOrdered(2) - ->setBasePrice($product->getPrice()) - ->setPrice($product->getPrice()) - ->setRowTotal($product->getPrice()) - ->setProductType($product->getTypeId()); - -$orderAmount = 100; -$customerEmail = $billingAddress->getEmail(); - -/** @var Order $order */ -$order = $objectManager->create(Order::class); -$order->setState(Order::STATE_PROCESSING) - ->setIncrementId('test_quote') - ->setStatus(Order::STATE_PROCESSING) - ->setCustomerId(null) - ->setCustomerIsGuest(true) - ->setCreatedAt(date('Y-m-d 00:00:55')) - ->setOrderCurrencyCode('USD') - ->setBaseCurrencyCode('USD') - ->setSubtotal($orderAmount) - ->setGrandTotal($orderAmount) - ->setBaseSubtotal($orderAmount) - ->setBaseGrandTotal($orderAmount) - ->setCustomerEmail($customerEmail) - ->setBillingAddress($billingAddress) - ->setShippingAddress($shippingAddress) - ->setShippingDescription('Flat Rate - Fixed') - ->setShippingAmount(10) - ->setStoreId(1) - ->addItem($orderItem1) - ->setQuoteId(1) - ->setPayment($payment); - -return $order; From 2d8f5c6eaa25455d3ad7f835a8096c8c6ac30153 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 30 May 2019 13:40:12 -0500 Subject: [PATCH 279/464] MC-11438: There is no XSS vulnerability if Create Order with sample email --- .../OpenStoreFrontProductPageActionGroup.xml | 17 +++++ ...ValidationMessageOnCheckoutActionGroup.xml | 18 ++++++ .../Customer/Test/Mftf/Data/CustomerData.xml | 13 ++++ .../Section/AdminOrderFormAccountSection.xml | 1 + ...SSVulnerabilityDuringOrderCreationTest.xml | 62 +++++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertAdminEmailValidationMessageOnCheckoutActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml new file mode 100644 index 0000000000000..4bfd5673e4a8b --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenStoreFrontProductPageActionGroup.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenStoreFrontProductPageActionGroup"> + <arguments> + <argument name="productUrlKey" type="string"/> + </arguments> + <amOnPage url="{{StorefrontProductPage.url(productUrlKey)}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertAdminEmailValidationMessageOnCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertAdminEmailValidationMessageOnCheckoutActionGroup.xml new file mode 100644 index 0000000000000..858dbfc5e76f3 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertAdminEmailValidationMessageOnCheckoutActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminEmailValidationMessageOnCheckoutActionGroup"> + <arguments> + <argument name="message" type="string" defaultValue="Please enter a valid email address (Ex: johndoe@domain.com)."/> + </arguments> + <waitForElementVisible selector="{{AdminOrderFormAccountSection.emailErrorMessage}}" stepKey="waitForFormValidation"/> + <see selector="{{AdminOrderFormAccountSection.emailErrorMessage}}" userInput="{{message}}" stepKey="seeTheErrorMessageIsDisplayed"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 5904067aea639..6b3ef96196263 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -271,4 +271,17 @@ <requiredEntity type="address">US_Address_TX</requiredEntity> <requiredEntity type="address">US_Address_NY_Not_Default_Address</requiredEntity> </entity> + <entity name="Simple_US_Customer_Incorrect_Email" type="customer"> + <data key="group_id">0</data> + <data key="default_billing">true</data> + <data key="default_shipping">true</data> + <data key="email">><script>alert(1);</script>@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + <requiredEntity type="address">US_Address_CA</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml index 11d973d1e19de..e03b646d3d060 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormAccountSection.xml @@ -14,5 +14,6 @@ <element name="requiredGroup" type="text" selector=".admin__field.required[data-ui-id='billing-address-fieldset-element-form-field-group-id']"/> <element name="requiredEmail" type="text" selector=".admin__field.required[data-ui-id='billing-address-fieldset-element-form-field-email']"/> <element name="defaultGeneral" type="text" selector="//*[contains(text(),'General')]" time="15"/> + <element name="emailErrorMessage" type="text" selector="#email-error"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml new file mode 100644 index 0000000000000..a728b57a743af --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="CheckXSSVulnerabilityDuringOrderCreationTest"> + <annotations> + <features value="Sales"/> + <stories value="Create order"/> + <title value="Check XSS vulnerability during order creation test"/> + <description value="Order should not be created with XSS vulnerability in email address"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11438"/> + <group value="sales"/> + </annotations> + <before> + <!-- Create product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + </before> + <after> + <!-- Delete product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + + <!-- Log out --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Add product to the shopping cart --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Try to create order on Storefront with provided email --> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> + <actionGroup ref="StorefrontFillEmailFieldOnCheckoutActionGroup" stepKey="fillIncorrectEmailStorefront"> + <argument name="email" value="{{Simple_US_Customer_Incorrect_Email.email}}"/> + </actionGroup> + + <!-- Order can not be created --> + <actionGroup ref="AssertStorefrontEmailValidationMessageOnCheckoutActionGroup" stepKey="assertErrorMessageStorefront"/> + + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Try to create order in admin with provided email --> + <actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="navigateToNewOrderPage"/> + <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer_Incorrect_Email.email}}" stepKey="fillEmailAddressAdminPanel"/> + <click selector="{{AdminOrderFormActionSection.submitOrder}}" stepKey="clickSubmitOrder"/> + + <!-- Order can not be created --> + <actionGroup ref="AssertAdminEmailValidationMessageOnCheckoutActionGroup" stepKey="assertErrorMessageAdminPanel"/> + </test> +</tests> From d5d5dad6e44083fb90096b2f7bb530d938cfab30 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 30 May 2019 13:42:55 -0500 Subject: [PATCH 280/464] MC-16873: Generate critical css file for LUMA - Loader: Final version --- .../Controller/Result/AsyncCssPlugin.php | 18 +++++------ .../frontend/layout/default_head_blocks.xml | 1 - .../templates/html/main_css_preloader.phtml | 2 +- .../templates/js/css_rel_preload.phtml | 10 ------ .../web/js/view/critical-css-loader.js | 32 ------------------- .../blank/web/css/source/_loaders.less | 4 +++ 6 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml delete mode 100644 app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php index c2deefe4502e0..428b96cfe6d60 100644 --- a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -45,10 +45,12 @@ public function beforeSendResponse(Http $subject): void self::XML_PATH_USE_CSS_CRITICAL_PATH, ScopeInterface::SCOPE_STORE )) { + $cssMatches = []; // add link rel preload to style sheets $content = preg_replace_callback( '@<link\b.*?rel=("|\')stylesheet\1.*?/>@', - function ($matches) { + function ($matches) use (&$cssMatches) { + $cssMatches[] = $matches[0]; preg_match('@href=("|\')(.*?)\1@', $matches[0], $hrefAttribute); $href = $hrefAttribute[2]; if (preg_match('@media=("|\')(.*?)\1@', $matches[0], $mediaAttribute)) { @@ -56,14 +58,9 @@ function ($matches) { } $media = $media ?? 'all'; $loadCssAsync = sprintf( - '<link rel="preload" as="style" media="%s" - onload=" - this.onload=null; - this.rel=\'stylesheet\'; - document.dispatchEvent(new Event(\'criticalCssLoaded\'));"' . - 'href="%s"><noscript><link rel="stylesheet" href="%s"></noscript>', + '<link rel="preload" as="style" media="%s" ' . + 'href="%s">', $media, - $href, $href ); @@ -72,7 +69,10 @@ function ($matches) { $content ); - $subject->setContent($content); + if (!empty($cssMatches)) { + $content = str_replace('</body', implode("\n", $cssMatches) . "\n</body", $content); + $subject->setContent($content); + } } } } diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 6ff31de3303cd..f2a5d68b1ba99 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -15,7 +15,6 @@ <body> <referenceBlock name="head.additional"> <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="critical_css_block" as="critical_css" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> - <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> diff --git a/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml index 8ca60464d484a..e0e7f8a1440e4 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml @@ -1,4 +1,4 @@ -<div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"criticalCssLoader": {}}'> +<div data-role="main-css-loader" class="loading-mask"> <div class="loader"> <img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')); ?>" alt="<?= $block->escapeHtml(__('Loading...')); ?>" diff --git a/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml b/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml deleted file mode 100644 index d90d528ffc6f8..0000000000000 --- a/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -?> -<script> - /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */ - !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this); -</script> diff --git a/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js b/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js deleted file mode 100644 index 012f2106504c0..0000000000000 --- a/app/code/Magento/Theme/view/frontend/web/js/view/critical-css-loader.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -define([ - 'rjsResolver' -], function (resolver) { - 'use strict'; - - /** - * Removes provided loader element from DOM. - * - * @param {HTMLElement} $loader - Loader DOM element. - */ - function hideLoader($loader) { - document.addEventListener('criticalCssLoaded', function (e) { - $loader.parentNode.removeChild($loader); - }, false); - } - - /** - * Initializes assets loading process listener. - * - * @param {Object} config - Optional configuration - * @param {HTMLElement} $loader - Loader DOM element. - */ - function init(config, $loader) { - resolver(hideLoader.bind(null, $loader)); - } - - return init; -}); diff --git a/app/design/frontend/Magento/blank/web/css/source/_loaders.less b/app/design/frontend/Magento/blank/web/css/source/_loaders.less index 5fcba9653ef01..12ed4d9633075 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_loaders.less +++ b/app/design/frontend/Magento/blank/web/css/source/_loaders.less @@ -42,4 +42,8 @@ ._block-content-loading { position: relative; } + + [data-role="main-css-loader"] { + display: none; + } } From cc73f58f43d7733220d5c7b7f3f8df41270bef8f Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Thu, 30 May 2019 13:44:30 -0500 Subject: [PATCH 281/464] MC-16709: Create new benchmark scenario for cloud measurements --- setup/performance-toolkit/benchmark.jmx | 25979 +++++++++++++++++++++- 1 file changed, 25911 insertions(+), 68 deletions(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index a8a7e419373b8..1f12183f3a4ef 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -54,6 +54,11 @@ <stringProp name="Argument.value">${__P(admin_user,admin)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> + <elementProp name="cache_hits_percentage" elementType="Argument"> + <stringProp name="Argument.name">cache_hits_percentage</stringProp> + <stringProp name="Argument.value">${__P(cache_hits_percentage,100)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> <elementProp name="seedForRandom" elementType="Argument"> <stringProp name="Argument.name">seedForRandom</stringProp> <stringProp name="Argument.value">${__P(seedForRandom,1)}</stringProp> @@ -64,6 +69,41 @@ <stringProp name="Argument.value">${__P(loops,1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> + <elementProp name="frontendPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">frontendPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(frontendPoolUsers,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="adminPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">adminPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(adminPoolUsers,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="csrPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">csrPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(csrPoolUsers,0)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="apiPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">apiPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(apiPoolUsers,0)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="deadLocksPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">deadLocksPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(deadLocksPoolUsers,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="graphQLPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">graphQLPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(graphQLPoolUsers,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudBenchmarkPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">cloudBenchmarkPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(cloudBenchmarkPoolUsers,0)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> <elementProp name="accountManagementPercentage" elementType="Argument"> <stringProp name="Argument.name">accountManagementPercentage</stringProp> <stringProp name="Argument.value">${__P(accountManagementPercentage,0)}</stringProp> @@ -76,12 +116,12 @@ </elementProp> <elementProp name="addToCartByGuestPercentage" elementType="Argument"> <stringProp name="Argument.name">addToCartByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(addToCartByGuestPercentage,28)}</stringProp> + <stringProp name="Argument.value">${__P(addToCartByGuestPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="addToWishlistPercentage" elementType="Argument"> <stringProp name="Argument.name">addToWishlistPercentage</stringProp> - <stringProp name="Argument.value">${__P(addToWishlistPercentage,2)}</stringProp> + <stringProp name="Argument.value">${__P(addToWishlistPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminCMSManagementDelay" elementType="Argument"> @@ -106,12 +146,12 @@ </elementProp> <elementProp name="adminCategoryManagementPercentage" elementType="Argument"> <stringProp name="Argument.name">adminCategoryManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminCategoryManagementPercentage,10)}</stringProp> + <stringProp name="Argument.value">${__P(adminCategoryManagementPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminCreateOrderPercentage" elementType="Argument"> <stringProp name="Argument.name">adminCreateOrderPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminCreateOrderPercentage,70)}</stringProp> + <stringProp name="Argument.value">${__P(adminCreateOrderPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminCreateProcessReturns" elementType="Argument"> @@ -134,19 +174,9 @@ <stringProp name="Argument.value">${__P(adminCustomerManagementPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="adminEditOrder" elementType="Argument"> - <stringProp name="Argument.name">adminEditOrder</stringProp> - <stringProp name="Argument.value">${__P(adminEditOrder,0)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="adminEditOrderPercentage" elementType="Argument"> <stringProp name="Argument.name">adminEditOrderPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminEditOrderPercentage,15)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - <elementProp name="adminEditProduct" elementType="Argument"> - <stringProp name="Argument.name">adminEditProduct</stringProp> - <stringProp name="Argument.value">${__P(adminEditProduct,0)}</stringProp> + <stringProp name="Argument.value">${__P(adminEditOrderPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminImportCustomerBehavior" elementType="Argument"> @@ -169,24 +199,19 @@ <stringProp name="Argument.value">${__P(adminImportProductFilePath,import_products/product_import_append_1.csv)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="adminPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">adminPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(adminPoolUsers,1)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="adminProductCreationPercentage" elementType="Argument"> <stringProp name="Argument.name">adminProductCreationPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminProductCreationPercentage,25)}</stringProp> + <stringProp name="Argument.value">${__P(adminProductCreationPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminProductEditingPercentage" elementType="Argument"> <stringProp name="Argument.name">adminProductEditingPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminProductEditingPercentage,35)}</stringProp> + <stringProp name="Argument.value">${__P(adminProductEditingPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminPromotionRulesPercentage" elementType="Argument"> <stringProp name="Argument.name">adminPromotionRulesPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminPromotionRulesPercentage,15)}</stringProp> + <stringProp name="Argument.value">${__P(adminPromotionRulesPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminPromotionsManagement" elementType="Argument"> @@ -201,7 +226,7 @@ </elementProp> <elementProp name="adminReturnsManagementPercentage" elementType="Argument"> <stringProp name="Argument.name">adminReturnsManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(adminReturnsManagementPercentage,20)}</stringProp> + <stringProp name="Argument.value">${__P(adminReturnsManagementPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="admin_browse_customer_filter_text" elementType="Argument"> @@ -234,16 +259,16 @@ <stringProp name="Argument.value">${__P(apiOrderInvoiceShipmentSync,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="apiPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">apiPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(apiPoolUsers,0)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="apiProcessOrders" elementType="Argument"> <stringProp name="Argument.name">apiProcessOrders</stringProp> <stringProp name="Argument.value">${__P(apiProcessOrders,1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> + <elementProp name="apiSinglePercentage" elementType="Argument"> + <stringProp name="Argument.name">apiSinglePercentage</stringProp> + <stringProp name="Argument.value">${__P(apiSinglePercentage,0)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> <elementProp name="bamboo_build_number" elementType="Argument"> <stringProp name="Argument.name">bamboo_build_number</stringProp> <stringProp name="Argument.value">${__P(bamboo_build_number,)}</stringProp> @@ -256,12 +281,12 @@ </elementProp> <elementProp name="browseCatalogByGuestPercentage" elementType="Argument"> <stringProp name="Argument.name">browseCatalogByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(browseCatalogByGuestPercentage,30)}</stringProp> + <stringProp name="Argument.value">${__P(browseCatalogByGuestPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="browseCustomerGridPercentage" elementType="Argument"> <stringProp name="Argument.name">browseCustomerGridPercentage</stringProp> - <stringProp name="Argument.value">${__P(browseCustomerGridPercentage,10)}</stringProp> + <stringProp name="Argument.value">${__P(browseCustomerGridPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="browseOrderGridPercentage" elementType="Argument"> @@ -274,11 +299,6 @@ <stringProp name="Argument.value">${__P(browseProductGridPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cache_hits_percentage" elementType="Argument"> - <stringProp name="Argument.name">cache_hits_percentage</stringProp> - <stringProp name="Argument.value">${__P(cache_hits_percentage,100)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="catalogGraphQLPercentage" elementType="Argument"> <stringProp name="Argument.name">catalogGraphQLPercentage</stringProp> <stringProp name="Argument.value">${__P(catalogGraphQLPercentage,0)}</stringProp> @@ -291,17 +311,117 @@ </elementProp> <elementProp name="checkoutByCustomerPercentage" elementType="Argument"> <stringProp name="Argument.name">checkoutByCustomerPercentage</stringProp> - <stringProp name="Argument.value">${__P(checkoutByCustomerPercentage,4)}</stringProp> + <stringProp name="Argument.value">${__P(checkoutByCustomerPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="checkoutByGuestPercentage" elementType="Argument"> <stringProp name="Argument.name">checkoutByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(checkoutByGuestPercentage,4)}</stringProp> + <stringProp name="Argument.value">${__P(checkoutByGuestPercentage,0)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAccountManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAccountManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAccountManagementPercentage,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAddToCartByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAddToCartByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAddToCartByGuestPercentage,26)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAddToWishlistPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAddToWishlistPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAddToWishlistPercentage,1.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminBrowseCustomerGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminBrowseCustomerGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminBrowseCustomerGridPercentage,0.1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminBrowseOrderGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminBrowseOrderGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminBrowseOrderGridPercentage,0.2)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminBrowseProductGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminBrowseProductGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminBrowseProductGridPercentage,0.2)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminCMSManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminCMSManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminCMSManagementPercentage,0.35)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminCategoryManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminCategoryManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminCategoryManagementPercentage,0.15)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminCreateOrderPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminCreateOrderPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminCreateOrderPercentage,0.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminCustomerManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminCustomerManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminCustomerManagementPercentage,0.4)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminEditOrderPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminEditOrderPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminEditOrderPercentage,1)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminProductCreationPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminProductCreationPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminProductCreationPercentage,0.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminProductEditingPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminProductEditingPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminProductEditingPercentage,0.65)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminPromotionRulesPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminPromotionRulesPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminPromotionRulesPercentage,0.2)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudAdminReturnsManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudAdminReturnsManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudAdminReturnsManagementPercentage,0.75)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudBrowseCatalogByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudBrowseCatalogByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudBrowseCatalogByGuestPercentage,29)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudCheckoutByCustomerPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudCheckoutByCustomerPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudCheckoutByCustomerPercentage,3.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudCheckoutByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudCheckoutByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudCheckoutByGuestPercentage,3.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudCompareProductsPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudCompareProductsPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudCompareProductsPercentage,1.5)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="cloudSiteSearchPercentage" elementType="Argument"> + <stringProp name="Argument.name">cloudSiteSearchPercentage</stringProp> + <stringProp name="Argument.value">${__P(cloudSiteSearchPercentage,29)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="compareProductsPercentage" elementType="Argument"> <stringProp name="Argument.name">compareProductsPercentage</stringProp> - <stringProp name="Argument.value">${__P(compareProductsPercentage,2)}</stringProp> + <stringProp name="Argument.value">${__P(compareProductsPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="configurable_products_count" elementType="Argument"> @@ -309,11 +429,6 @@ <stringProp name="Argument.value">${__P(configurable_products_count,15)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="csrPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">csrPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(csrPoolUsers,0)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="customer_checkout_percent" elementType="Argument"> <stringProp name="Argument.name">customer_checkout_percent</stringProp> <stringProp name="Argument.value">${__P(customer_checkout_percent,100)}</stringProp> @@ -334,11 +449,6 @@ <stringProp name="Argument.value">${__P(dashboard_enabled,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="deadLocksPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">deadLocksPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(deadLocksPoolUsers,1)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="exportCustomersPercentage" elementType="Argument"> <stringProp name="Argument.name">exportCustomersPercentage</stringProp> <stringProp name="Argument.value">${__P(exportCustomersPercentage,0)}</stringProp> @@ -354,16 +464,6 @@ <stringProp name="Argument.value">${__P(form_key,uVEW54r8kKday8Wk)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="frontendPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">frontendPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(frontendPoolUsers,1)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - <elementProp name="graphQLPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">graphQLPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(graphQLPoolUsers,1)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="graphqlAddConfigurableProductToCartPercentage" elementType="Argument"> <stringProp name="Argument.name">graphqlAddConfigurableProductToCartPercentage</stringProp> <stringProp name="Argument.value">${__P(graphqlAddConfigurableProductToCartPercentage,0)}</stringProp> @@ -399,11 +499,6 @@ <stringProp name="Argument.value">${__P(graphqlGetCategoryListByCategoryIdPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="graphqlGetCmsBlockByIdentifierPercentage" elementType="Argument"> - <stringProp name="Argument.name">graphqlGetCmsBlockByIdentifierPercentage</stringProp> - <stringProp name="Argument.value">${__P(graphqlGetCmsBlockByIdentifierPercentage,0)}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> <elementProp name="graphqlGetCmsPageByIdPercentage" elementType="Argument"> <stringProp name="Argument.name">graphqlGetCmsPageByIdPercentage</stringProp> <stringProp name="Argument.value">${__P(graphqlGetCmsPageByIdPercentage,0)}</stringProp> @@ -586,7 +681,7 @@ </elementProp> <elementProp name="siteSearchPercentage" elementType="Argument"> <stringProp name="Argument.name">siteSearchPercentage</stringProp> - <stringProp name="Argument.value">${__P(siteSearchPercentage,30)}</stringProp> + <stringProp name="Argument.value">${__P(siteSearchPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="sprint_identifier" elementType="Argument"> @@ -25634,7 +25729,7 @@ catch (java.lang.Exception e) { </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="API" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="API Pool" enabled="true"> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> <boolProp name="LoopController.continue_forever">false</boolProp> @@ -27110,7 +27205,7 @@ if (testLabel </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="One Thread Scenarios (Vulnerable to deadlocks)" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="One Thread Scenarios (Vulnerable to deadlocks) Pool" enabled="true"> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> <boolProp name="LoopController.continue_forever">false</boolProp> @@ -28161,7 +28256,7 @@ vars.put("adminImportFilePath", filepath); </stringProp> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${apiBasePercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${apiSinglePercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -44333,6 +44428,25754 @@ vars.put("coupon_code", coupons[number].code); </hashTree> </hashTree> + </hashTree> + + + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Cloud Benchmark Pool" enabled="true"> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <boolProp name="LoopController.continue_forever">false</boolProp> + <stringProp name="LoopController.loops">${loops}</stringProp> + </elementProp> + <stringProp name="ThreadGroup.num_threads">${cloudBenchmarkPoolUsers}</stringProp> + <stringProp name="ThreadGroup.ramp_time">${ramp_period}</stringProp> + <longProp name="ThreadGroup.start_time">1505803944000</longProp> + <longProp name="ThreadGroup.end_time">1505803944000</longProp> + <boolProp name="ThreadGroup.scheduler">false</boolProp> + <stringProp name="ThreadGroup.duration"/> + <stringProp name="ThreadGroup.delay"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/thread_group.jmx</stringProp></ThreadGroup> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Cache hit miss" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">var cacheHitPercent = vars.get("cache_hits_percentage"); + +if ( + cacheHitPercent < 100 && + sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + doCache(); +} + +function doCache(){ + var random = Math.random() * 100; + if (cacheHitPercent < random) { + sampler.setPath(sampler.getPath() + "?cacheModifier=" + Math.random().toString(36).substring(2, 13)); + } +} +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/cache_hit_miss.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Catalog Browsing By Guest" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudBrowseCatalogByGuestPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Catalog Browsing By Guest"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = vars.getObject("randomIntGenerator"); + +var categories = props.get("categories"); +number = random.nextInt(categories.length); + +vars.put("category_url_key", categories[number].url_key); +vars.put("category_name", categories[number].name); +vars.put("category_id", categories[number].id); +vars.putObject("category", categories[number]); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_category_setup.jmx</stringProp></JSR223Sampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${category_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_category.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1210004667"><span class="base" data-ui-id="page-title">${category_name}</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract category id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">category_id</stringProp> + <stringProp name="RegexExtractor.regex"><li class="item category([^'"]+)">\s*<strong>${category_name}</strong>\s*</li></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_product_1_url_key</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert category id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1191417111">^[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">category_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="View Simple Products" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">2</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="View Configurable Products" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Configurable Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("configurable_products_list").size()); +product = props.get("configurable_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Site Search" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudSiteSearchPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Site Search"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="Search Terms" enabled="true"> + <stringProp name="filename">${files_folder}search_terms.csv</stringProp> + <stringProp name="fileEncoding">UTF-8</stringProp> + <stringProp name="variableNames"/> + <stringProp name="delimiter">,</stringProp> + <boolProp name="quotedData">false</boolProp> + <boolProp name="recycle">true</boolProp> + <boolProp name="stopThread">false</boolProp> + <stringProp name="shareMode">shareMode.thread</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_terms.jmx</stringProp></CSVDataSet> + <hashTree/> + + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Cache hit miss" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">var cacheHitPercent = vars.get("cache_hits_percentage"); + +if ( + cacheHitPercent < 100 && + sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + doCache(); +} + +function doCache(){ + var random = Math.random() * 100; + if (cacheHitPercent < random) { + sampler.setPath(sampler.getPath() + "?cacheModifier=" + Math.random().toString(36).substring(2, 13)); + } +} +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/cache_hit_miss.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Quick Search" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${searchQuickPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Quick Search"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="q" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">q</stringProp> + <stringProp name="Argument.value">${searchTerm}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/result/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_quick.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="56511661">Search results for: </stringProp> + <stringProp name="1533671447"><span class="toolbar-number">\d<\/span> Items|Items <span class="toolbar-number">1</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract product url keys" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">product_url_keys</stringProp> + <stringProp name="RegexExtractor.regex"><a class="product-item-link"(?s).+?href="(?:http|https)://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">(?s).</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: isPageCacheable" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">isPageCacheable</stringProp> + <stringProp name="RegexExtractor.regex">catalogsearch/searchTermsLog/save</stringProp> + <stringProp name="RegexExtractor.template">$0$</stringProp> + <stringProp name="RegexExtractor.default">0</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true"> + <stringProp name="IfController.condition">"${isPageCacheable}" != "0"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/if_page_cacheable_controller.jmx</stringProp></IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search Terms Log" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="q" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">q</stringProp> + <stringProp name="Argument.value">${searchTerm}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/searchTermsLog/save/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_terms_log_save.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-547797305">"success":true</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="BeanShellSampler.query"> +foundProducts = Integer.parseInt(vars.get("product_url_keys_matchNr")); + +if (foundProducts > 3) { + foundProducts = 3; +} + +vars.put("foundProducts", String.valueOf(foundProducts)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/set_found_items.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="View Searched Products" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">${foundProducts}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Product Data" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/searched_products_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +number = vars.get("_counter"); +product = vars.get("product_url_keys_"+number); + +vars.put("product_url_key", product); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Quick Search With Filtration" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${searchQuickFilterPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Quick Search With Filtration"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="q" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">q</stringProp> + <stringProp name="Argument.value">${searchTerm}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol"/> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/result/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_quick_filter.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="56511661">Search results for: </stringProp> + <stringProp name="1533671447">Items <span class="toolbar-number">1</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract number of attribute 1 options" enabled="true"> + <stringProp name="XPathExtractor.default">0</stringProp> + <stringProp name="XPathExtractor.refname">attribute_1_options_count</stringProp> + <stringProp name="XPathExtractor.xpathQuery">count((//div[@class="filter-options-content"])[1]//li[@class="item"])</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract number of attribute 2 options" enabled="true"> + <stringProp name="XPathExtractor.default">0</stringProp> + <stringProp name="XPathExtractor.refname">attribute_2_options_count</stringProp> + <stringProp name="XPathExtractor.xpathQuery">count((//div[@class="filter-options-content"])[2]//li[@class="item"])</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract filter link from layered navigation" enabled="true"> + <stringProp name="XPathExtractor.default"/> + <stringProp name="XPathExtractor.refname">attribute_1_filter_url</stringProp> + <stringProp name="XPathExtractor.xpathQuery">((//div[@class="filter-options-content"])[1]//li[@class="item"]//a)[1]/@href</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract product url keys" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">product_url_keys</stringProp> + <stringProp name="RegexExtractor.regex"><a class="product-item-link"(?s).+?href="http://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">(?s).</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: isPageCacheable" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">isPageCacheable</stringProp> + <stringProp name="RegexExtractor.regex">catalogsearch/searchTermsLog/save</stringProp> + <stringProp name="RegexExtractor.template">$0$</stringProp> + <stringProp name="RegexExtractor.default">0</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true"> + <stringProp name="IfController.condition">"${isPageCacheable}" != "0"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/if_page_cacheable_controller.jmx</stringProp></IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search Terms Log" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="q" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">q</stringProp> + <stringProp name="Argument.value">${searchTerm}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/searchTermsLog/save/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_terms_log_save.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-547797305">"success":true</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Attribute 1 present in layered navigation" enabled="true"> + <stringProp name="IfController.condition">${attribute_1_options_count} > 0</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_quick_filter-first-attribute.jmx</stringProp></IfController> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Search Url 2" enabled="true"> + <stringProp name="BeanShellSampler.query">vars.put("search_url", vars.get("attribute_1_filter_url"));</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Filter by Attribute 1" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol"/> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${attribute_1_filter_url}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="56511661">Search results for: </stringProp> + <stringProp name="1420634794"><span class="toolbar-number">[1-9]+</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract number of attribute 2 options" enabled="true"> + <stringProp name="XPathExtractor.default">0</stringProp> + <stringProp name="XPathExtractor.refname">attribute_2_options_count</stringProp> + <stringProp name="XPathExtractor.xpathQuery">count((//div[@class="filter-options-content"])[2]//li[@class="item"])</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract filter link from layered navigation" enabled="true"> + <stringProp name="XPathExtractor.default"/> + <stringProp name="XPathExtractor.refname">attribute_2_filter_url</stringProp> + <stringProp name="XPathExtractor.xpathQuery">((//div[@class="filter-options-content"])[2]//li[@class="item"]//a)[1]/@href</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract product url keys" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">product_url_keys</stringProp> + <stringProp name="RegexExtractor.regex"><a class="product-item-link"(?s).+?href="http://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">(?s).</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Attribute 2 present in layered navigation" enabled="true"> + <stringProp name="IfController.condition">${attribute_2_options_count} > 0</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_quick_filter-second-attribute.jmx</stringProp></IfController> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Search Ul 3" enabled="true"> + <stringProp name="BeanShellSampler.query">vars.put("search_url", vars.get("attribute_2_filter_url"));</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Filter by Attribute 2" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol"/> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${attribute_2_filter_url}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="56511661">Search results for: </stringProp> + <stringProp name="1420634794"><span class="toolbar-number">[1-9]+</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract product url keys" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">product_url_keys</stringProp> + <stringProp name="RegexExtractor.regex"><a class="product-item-link"(?s).+?href="http://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">(?s).</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="BeanShellSampler.query"> +foundProducts = Integer.parseInt(vars.get("product_url_keys_matchNr")); + +if (foundProducts > 3) { + foundProducts = 3; +} + +vars.put("foundProducts", String.valueOf(foundProducts)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/set_found_items.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="View Searched Products" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">${foundProducts}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Product Data" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/searched_products_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +number = vars.get("_counter"); +product = vars.get("product_url_keys_"+number); + +vars.put("product_url_key", product); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Advanced Search" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${searchAdvancedPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Advanced Search"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Advanced Search" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol"/> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/advanced/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/open_advanced_search_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="921122077"><title>Advanced Search</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract attribute name" enabled="true"> + <stringProp name="XPathExtractor.default"/> + <stringProp name="XPathExtractor.refname">attribute_name</stringProp> + <stringProp name="XPathExtractor.xpathQuery">(//select[@class="multiselect"])[last()]/@name</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract attribute options count" enabled="true"> + <stringProp name="XPathExtractor.default">0</stringProp> + <stringProp name="XPathExtractor.refname">attribute_options_count</stringProp> + <stringProp name="XPathExtractor.xpathQuery">count((//select[@class="multiselect"])[last()]/option)</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="Extract attribute value" enabled="true"> + <stringProp name="XPathExtractor.default"/> + <stringProp name="XPathExtractor.refname">attribute_value</stringProp> + <stringProp name="XPathExtractor.xpathQuery">((//select[@class="multiselect"])[last()]/option)[1]/@value</stringProp> + <boolProp name="XPathExtractor.validate">false</boolProp> + <boolProp name="XPathExtractor.tolerant">true</boolProp> + <boolProp name="XPathExtractor.namespace">false</boolProp> + </XPathExtractor> + <hashTree/> + </hashTree> + + + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">name</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="sku" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">sku</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">description</stringProp> + <stringProp name="Argument.value">${searchTerm}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="short_description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">short_description</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="price%5Bfrom%5D" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">price%5Bfrom%5D</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="price%5Bto%5D" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">price%5Bto%5D</stringProp> + <stringProp name="Argument.value">${priceTo}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <!-- Should be fixed in MAGETWO-80420 --> + <!--<elementProp name="${attribute_name}" elementType="HTTPArgument">--> + <!--<boolProp name="HTTPArgument.always_encode">true</boolProp>--> + <!--<stringProp name="Argument.value">${attribute_value}</stringProp>--> + <!--<stringProp name="Argument.metadata">=</stringProp>--> + <!--<boolProp name="HTTPArgument.use_equals">true</boolProp>--> + <!--<stringProp name="Argument.name">${attribute_name}</stringProp>--> + <!--</elementProp>--> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalogsearch/advanced/result/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/search_advanced.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert search result" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1851531284">items</strong> were found using the following search criteria</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract product url keys" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">product_url_keys</stringProp> + <stringProp name="RegexExtractor.regex"><a class="product-item-link"(?s).+?href="(?:http|https)://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">(?s).</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="BeanShellSampler.query"> +foundProducts = Integer.parseInt(vars.get("product_url_keys_matchNr")); + +if (foundProducts > 3) { + foundProducts = 3; +} + +vars.put("foundProducts", String.valueOf(foundProducts)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/set_found_items.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="View Searched Products" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">${foundProducts}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Product Data" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/search/searched_products_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +number = vars.get("_counter"); +product = vars.get("product_url_keys_"+number); + +vars.put("product_url_key", product); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Add To Cart By Guest" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAddToCartByGuestPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Add To Cart By Guest"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Total Products In Cart" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_total_products_in_cart_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +vars.put("totalProductsAdded", "0"); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = vars.getObject("randomIntGenerator"); + +var categories = props.get("categories"); +number = random.nextInt(categories.length); + +vars.put("category_url_key", categories[number].url_key); +vars.put("category_name", categories[number].name); +vars.put("category_id", categories[number].id); +vars.putObject("category", categories[number]); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_category_setup.jmx</stringProp></JSR223Sampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${category_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_category.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1210004667"><span class="base" data-ui-id="page-title">${category_name}</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract category id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">category_id</stringProp> + <stringProp name="RegexExtractor.regex"><li class="item category([^'"]+)">\s*<strong>${category_name}</strong>\s*</li></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_product_1_url_key</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert category id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1191417111">^[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">category_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Simple Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">2</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Configurable Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Configurable Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("configurable_products_list").size()); +product = props.get("configurable_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="SetUp - Get Configurable Product Options" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_configurable_product_options.jmx</stringProp></LoopController> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">*/*</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Admin Token Retrieval" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"username":"${admin_user}","password":"${admin_password}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/integration/admin/token</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="jp@gc - JSON Path Extractor" enabled="true"> + <stringProp name="VAR">admin_token</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert token not null" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="484395188">^[a-z0-9-]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_token</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Bearer ${admin_token}</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get Configurable Product Options" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/configurable-products/${product_sku}/options/all</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract attribute_ids" enabled="true"> + <stringProp name="VAR">attribute_ids</stringProp> + <stringProp name="JSONPATH">$.[*].attribute_id</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract option_values" enabled="true"> + <stringProp name="VAR">option_values</stringProp> + <stringProp name="JSONPATH">$.[*].values[0].value_index</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + try { + attribute_ids = vars.get("attribute_ids"); + option_values = vars.get("option_values"); + attribute_ids = attribute_ids.replace("[","").replace("]","").replace("\"", ""); + option_values = option_values.replace("[","").replace("]","").replace("\"", ""); + attribute_ids_array = attribute_ids.split(","); + option_values_array = option_values.split(","); + args = ctx.getCurrentSampler().getArguments(); + it = args.iterator(); + while (it.hasNext()) { + argument = it.next(); + if (argument.getStringValue().contains("${")) { + args.removeArgument(argument.getName()); + } + } + for (int i = 0; i < attribute_ids_array.length; i++) { + ctx.getCurrentSampler().addArgument("super_attribute[" + attribute_ids_array[i] + "]", option_values_array[i]); + } + } catch (Exception e) { + log.error("eror…", e); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/configurable_product_add_to_cart_preprocessor.jmx</stringProp></BeanShellPreProcessor> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Add to Wishlist" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAddToWishlistPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Add to Wishlist"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Get Customer Email" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Customer Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_customer_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +customerUserList = props.get("customer_emails_list"); +customerUser = customerUserList.poll(); +if (customerUser == null) { + SampleResult.setResponseMessage("customernUser list is empty"); + SampleResult.setResponseData("customerUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("customer_email", customerUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Login Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/login/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_login_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="637394530"><title>Customer Login</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="send" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">send</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/loginPost/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1312950388"><title>My Account</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Address" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">addressId</stringProp> + <stringProp name="RegexExtractor.regex">customer/address/edit/id/([^'"]+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert addressId extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">addressId</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Customer Private Data" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Produts to Wishlist" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">5</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} Add To Wishlist" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="uenc" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_uenc}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">uenc</stringProp> + </elementProp> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}wishlist/index/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/wishlist/add_to_wishlist.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1907714722"><title>My Wish List</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">wishListItems</stringProp> + <stringProp name="RegexExtractor.regex">data-post-remove='\{"action":"(.+)\/wishlist\\/index\\/remove\\/","data":\{"item":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Wishlist Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">wishlist,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/wishlist/load_wishlist_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1865430343">{"wishlist":{"counter":"</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"> + <stringProp name="ConstantTimer.delay">${wishlistDelay}*1000</stringProp> + </ConstantTimer> + <hashTree/> + </hashTree> + </hashTree> + + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Controller: Clear Wishlist" enabled="true"> + <stringProp name="ForeachController.inputVal">wishListItems</stringProp> + <stringProp name="ForeachController.returnVal">wishListItem</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/wishlist/clear_wishlist.jmx</stringProp></ForeachController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">5</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clear Wishlist ${counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="item" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${wishListItem}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">item</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}wishlist/index/remove/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1723813687">You are signed out.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Customer to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> +customerUserList = props.get("customer_emails_list"); +customerUserList.add(vars.get("customer_email")); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Compare Products" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudCompareProductsPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Compare Products"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Total Products In Cart" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_total_products_in_cart_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +vars.put("totalProductsAdded", "0"); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = vars.getObject("randomIntGenerator"); + +var categories = props.get("categories"); +number = random.nextInt(categories.length); + +vars.put("category_url_key", categories[number].url_key); +vars.put("category_name", categories[number].name); +vars.put("category_id", categories[number].id); +vars.putObject("category", categories[number]); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_category_setup.jmx</stringProp></JSR223Sampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${category_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/open_category.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1210004667"><span class="base" data-ui-id="page-title">${category_name}</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Random Product Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">random_product_compare_id</stringProp> + <stringProp name="RegexExtractor.regex">catalog\\/product_compare\\/add\\/\",\"data\":\{\"product\":\"([0-9]+)\"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Random Product Id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1191417111">^[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">random_product_compare_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Simple Products to Compare" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">2</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} Comparison Add" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="uenc" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_uenc}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">uenc</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalog/product_compare/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/product_compare_add.jmx</stringProp></HTTPSamplerProxy> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Compare Product Section" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">compare-products,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/customer_section_load_product_compare_add.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"compare-products\":{\"count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Configurable Products to Compare" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Configurable Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("configurable_products_list").size()); +product = props.get("configurable_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} Comparison Add" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="uenc" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_uenc}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">uenc</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalog/product_compare/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/product_compare_add.jmx</stringProp></HTTPSamplerProxy> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Compare Product Section" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">compare-products,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/customer_section_load_product_compare_add.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"compare-products\":{\"count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Compare Products" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalog/product_compare/index/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/compare_products.jmx</stringProp></HTTPSamplerProxy> + <hashTree/> + + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Product Compare - Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${productCompareDelay}*1000))}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/compare_products_pause.jmx</stringProp></TestAction> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Compare Products Clear" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}catalog/product_compare/clear</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_compare/compare_products_clear.jmx</stringProp></HTTPSamplerProxy> + <hashTree/> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Checkout By Guest" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudCheckoutByGuestPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Checkout By Guest"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Total Products In Cart" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_total_products_in_cart_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +vars.put("totalProductsAdded", "0"); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = vars.getObject("randomIntGenerator"); + +var categories = props.get("categories"); +number = random.nextInt(categories.length); + +vars.put("category_url_key", categories[number].url_key); +vars.put("category_name", categories[number].name); +vars.put("category_id", categories[number].id); +vars.putObject("category", categories[number]); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_category_setup.jmx</stringProp></JSR223Sampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${category_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_category.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1210004667"><span class="base" data-ui-id="page-title">${category_name}</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract category id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">category_id</stringProp> + <stringProp name="RegexExtractor.regex"><li class="item category([^'"]+)">\s*<strong>${category_name}</strong>\s*</li></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_product_1_url_key</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert category id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1191417111">^[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">category_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Simple Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">2</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Configurable Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Configurable Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("configurable_products_list").size()); +product = props.get("configurable_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="SetUp - Get Configurable Product Options" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_configurable_product_options.jmx</stringProp></LoopController> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">*/*</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Admin Token Retrieval" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"username":"${admin_user}","password":"${admin_password}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/integration/admin/token</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="jp@gc - JSON Path Extractor" enabled="true"> + <stringProp name="VAR">admin_token</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert token not null" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="484395188">^[a-z0-9-]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_token</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Bearer ${admin_token}</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get Configurable Product Options" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/configurable-products/${product_sku}/options/all</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract attribute_ids" enabled="true"> + <stringProp name="VAR">attribute_ids</stringProp> + <stringProp name="JSONPATH">$.[*].attribute_id</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract option_values" enabled="true"> + <stringProp name="VAR">option_values</stringProp> + <stringProp name="JSONPATH">$.[*].values[0].value_index</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + try { + attribute_ids = vars.get("attribute_ids"); + option_values = vars.get("option_values"); + attribute_ids = attribute_ids.replace("[","").replace("]","").replace("\"", ""); + option_values = option_values.replace("[","").replace("]","").replace("\"", ""); + attribute_ids_array = attribute_ids.split(","); + option_values_array = option_values.split(","); + args = ctx.getCurrentSampler().getArguments(); + it = args.iterator(); + while (it.hasNext()) { + argument = it.next(); + if (argument.getStringValue().contains("${")) { + args.removeArgument(argument.getName()); + } + } + for (int i = 0; i < attribute_ids_array.length; i++) { + ctx.getCurrentSampler().addArgument("super_attribute[" + attribute_ids_array[i] + "]", option_values_array[i]); + } + } catch (Exception e) { + log.error("eror…", e); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/configurable_product_add_to_cart_preprocessor.jmx</stringProp></BeanShellPreProcessor> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Checkout" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Get region data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> + vars.put("alabama_region_id", props.get("alabama_region_id")); + vars.put("california_region_id", props.get("california_region_id")); +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_region_data.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1403911775"><title>Checkout</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-179817969"><title>Shopping Cart</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Cart Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">cart_id</stringProp> + <stringProp name="RegexExtractor.regex">"quoteData":{"entity_id":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Cart Id extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">cart_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Email Available" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"customerEmail":"test@example.com"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/customers/isEmailAvailable</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_email_available.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${base_path}checkout/onepage/</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="3569038">true</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">8</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Estimate Shipping Methods" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"address":{"country_id":"US","postcode":"95630"}}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/guest-carts/${cart_id}/estimate-shipping-methods</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_estimate_shipping_methods_with_postal_code.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${base_path}checkout/onepage/</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1224567411">"available":true</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Billing/Shipping Information" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"addressInformation":{"shipping_address":{"countryId":"US","regionId":"${california_region_id}","regionCode":"CA","region":"California","street":["10441 Jefferson Blvd ste 200"],"company":"","telephone":"3109450345","fax":"","postcode":"90232","city":"Culver City","firstname":"Name","lastname":"Lastname"},"shipping_method_code":"flatrate","shipping_carrier_code":"flatrate"}}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/guest-carts/${cart_id}/shipping-information</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_billing_shipping_information.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${base_path}checkout/onepage/</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1494218646">{"payment_methods":</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Payment Info/Place Order" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"cartId":"${cart_id}","email":"test@example.com","paymentMethod":{"method":"checkmo","po_number":null,"additional_data":null},"billingAddress":{"countryId":"US","regionId":"${california_region_id}","regionCode":"CA","region":"California","street":["10441 Jefferson Blvd ste 200"],"company":"","telephone":"3109450345","fax":"","postcode":"90232","city":"Culver City","firstname":"Name","lastname":"Lastname"}}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/guest-carts/${cart_id}/payment-information</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_payment_info_place_order.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${base_path}checkout/onepage/</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-297987887">"[0-9]+"</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract cart id" enabled="true"> + <stringProp name="VAR">order_id</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">order_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout success" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/success/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/guest_checkout/checkout_success.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="494863233">Thank you for your purchase!</stringProp> + <stringProp name="1635682758">Your order # is</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Checkout By Customer" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudCheckoutByCustomerPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Checkout By Customer"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Random Generator" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_random_generator_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); +} + +vars.putObject("randomIntGenerator", random); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Init Total Products In Cart" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/init_total_products_in_cart_setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +vars.put("totalProductsAdded", "0"); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Prepare Category Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = vars.getObject("randomIntGenerator"); + +var categories = props.get("categories"); +number = random.nextInt(categories.length); + +vars.put("category_url_key", categories[number].url_key); +vars.put("category_name", categories[number].name); +vars.put("category_id", categories[number].id); +vars.putObject("category", categories[number]); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/extract_category_setup.jmx</stringProp></JSR223Sampler> + <hashTree/> + + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Get Customer Email" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Customer Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_customer_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +customerUserList = props.get("customer_emails_list"); +customerUser = customerUserList.poll(); +if (customerUser == null) { + SampleResult.setResponseMessage("customernUser list is empty"); + SampleResult.setResponseData("customerUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("customer_email", customerUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Login Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/login/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_login_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="637394530"><title>Customer Login</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="send" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">send</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/loginPost/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1312950388"><title>My Account</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Address" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">addressId</stringProp> + <stringProp name="RegexExtractor.regex">customer/address/edit/id/([^'"]+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert addressId extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">addressId</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Customer Private Data" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${category_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_category.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1210004667"><span class="base" data-ui-id="page-title">${category_name}</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor: Extract category id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">category_id</stringProp> + <stringProp name="RegexExtractor.regex"><li class="item category([^'"]+)">\s*<strong>${category_name}</strong>\s*</li></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_product_1_url_key</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion: Assert category id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1191417111">^[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">category_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Simple Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">2</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Simple Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("simple_products_list").size()); +product = props.get("simple_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Simple Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Add Configurable Products to Cart" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loop_controller.jmx</stringProp></LoopController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"/> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Prepare Configurable Product Data" enabled="true"> + <stringProp name="BeanShellSampler.query"> +import java.util.Random; + +Random random = vars.getObject("randomIntGenerator"); +number = random.nextInt(props.get("configurable_products_list").size()); +product = props.get("configurable_products_list").get(number); + +vars.put("product_url_key", product.get("url_key")); +vars.put("product_id", product.get("id")); +vars.put("product_name", product.get("title")); +vars.put("product_uenc", product.get("uenc")); +vars.put("product_sku", product.get("sku")); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Update Products Added Counter" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/loops/update_products_added_counter.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +productsAdded = Integer.parseInt(vars.get("totalProductsAdded")); +productsAdded = productsAdded + 1; + +vars.put("totalProductsAdded", String.valueOf(productsAdded)); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} View" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${product_url_key}${url_suffix}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/product_view.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1787050162"><span>In stock</span></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="SetUp - Get Configurable Product Options" enabled="true"> + <boolProp name="LoopController.continue_forever">true</boolProp> + <stringProp name="LoopController.loops">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_configurable_product_options.jmx</stringProp></LoopController> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">*/*</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Admin Token Retrieval" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"username":"${admin_user}","password":"${admin_password}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/integration/admin/token</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="jp@gc - JSON Path Extractor" enabled="true"> + <stringProp name="VAR">admin_token</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert token not null" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="484395188">^[a-z0-9-]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_token</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Bearer ${admin_token}</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get Configurable Product Options" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/configurable-products/${product_sku}/options/all</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract attribute_ids" enabled="true"> + <stringProp name="VAR">attribute_ids</stringProp> + <stringProp name="JSONPATH">$.[*].attribute_id</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract option_values" enabled="true"> + <stringProp name="VAR">option_values</stringProp> + <stringProp name="JSONPATH">$.[*].values[0].value_index</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Configurable Product ${_counter} Add To Cart" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product</stringProp> + </elementProp> + <elementProp name="related_product" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_product</stringProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/cart/add/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_product_add_to_cart.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + try { + attribute_ids = vars.get("attribute_ids"); + option_values = vars.get("option_values"); + attribute_ids = attribute_ids.replace("[","").replace("]","").replace("\"", ""); + option_values = option_values.replace("[","").replace("]","").replace("\"", ""); + attribute_ids_array = attribute_ids.split(","); + option_values_array = option_values.split(","); + args = ctx.getCurrentSampler().getArguments(); + it = args.iterator(); + while (it.hasNext()) { + argument = it.next(); + if (argument.getStringValue().contains("${")) { + args.removeArgument(argument.getName()); + } + } + for (int i = 0; i < attribute_ids_array.length; i++) { + ctx.getCurrentSampler().addArgument("super_attribute[" + attribute_ids_array[i] + "]", option_values_array[i]); + } + } catch (Exception e) { + log.error("eror…", e); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/configurable_product_add_to_cart_preprocessor.jmx</stringProp></BeanShellPreProcessor> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Cart Section ${_counter}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart,messages</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/load_cart_section.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="210217247">You added ${product_name} to your <a href="${base_path}checkout/cart/">shopping cart</a>.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2057973164">This product is out of stock.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-350323027">\"summary_count\":${totalProductsAdded}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/http_header_manager_ajax.jmx</stringProp></HeaderManager> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Checkout" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Get region data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> + vars.put("alabama_region_id", props.get("alabama_region_id")); + vars.put("california_region_id", props.get("california_region_id")); +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_region_data.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1403911775"><title>Checkout</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-179817969"><title>Shopping Cart</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Cart Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">cart_id</stringProp> + <stringProp name="RegexExtractor.regex">"quoteData":{"entity_id":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Address Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">address_id</stringProp> + <stringProp name="RegexExtractor.regex">"default_billing":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Customer Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">customer_id</stringProp> + <stringProp name="RegexExtractor.regex">"customer_id":([^'",]+),</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Cart Id extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">cart_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Address Id extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="576002869">[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">address_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Customer Id extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="576002869">[0-9]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">customer_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Estimate Shipping Methods" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"addressId":"${addressId}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_estimate_shipping_methods.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${base_path}checkout/onepage/</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1224567411">"available":true</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Billing/Shipping Information" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"addressInformation":{"shipping_address":{"customerAddressId":"${address_id}","countryId":"US","regionId":"${alabama_region_id}","regionCode":"AL","region":"Alabama","customerId":"${customer_id}","street":["123 Freedom Blvd. #123"],"telephone":"022-333-4455","postcode":"123123","city":"Fayetteville","firstname":"Anthony","lastname":"Nealy"},"shipping_method_code":"flatrate","shipping_carrier_code":"flatrate"}}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/carts/mine/shipping-information</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_billing_shipping_information.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${host}${base_path}checkout/onepage</stringProp> + </elementProp> + <elementProp name="Content-Type" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8</stringProp> + </elementProp> + <elementProp name="X-Requested-With" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-740937264">{"payment_methods"</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout Payment Info/Place Order" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"cartId":"${cart_id}","paymentMethod":{"method":"checkmo","po_number":null,"additional_data":null},"billingAddress":{"customerAddressId":"${address_id}","countryId":"US","regionId":"${alabama_region_id}","regionCode":"AL","region":"Alabama","customerId":"${customer_id}","street":["123 Freedom Blvd. #123"],"telephone":"022-333-4455","postcode":"123123","city":"Fayetteville","firstname":"Anthony","lastname":"Nealy"}}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/carts/mine/payment-information</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_payment_info_place_order.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Referer</stringProp> + <stringProp name="Header.value">${host}${base_path}checkout/onepage</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json; charset=UTF-8 </stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert order number" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-297987887">"[0-9]+"</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout success" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/success/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_success.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="494863233">Thank you for your purchase!</stringProp> + <stringProp name="-1590086334">Your order number is</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1723813687">You are signed out.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Clear Cookie" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script">curSampler = ctx.getCurrentSampler(); +if(curSampler.getName().contains("Checkout success")) { + manager = curSampler.getCookieManager(); + manager.clear(); +} +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/customer_checkout/checkout_clear_cookie.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Customer to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> +customerUserList = props.get("customer_emails_list"); +customerUserList.add(vars.get("customer_email")); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Account management" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAccountManagementPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Account management"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"> + <elementProp name="product_list_limit" elementType="Cookie" testname="product_list_limit"> + <stringProp name="Cookie.value">30</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">/</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + <elementProp name="product_list_limit" elementType="Cookie" testname="form_key"> + <stringProp name="Cookie.value">${form_key}</stringProp> + <stringProp name="Cookie.domain">${host}</stringProp> + <stringProp name="Cookie.path">${base_path}</stringProp> + <boolProp name="Cookie.secure">false</boolProp> + <longProp name="Cookie.expires">0</longProp> + <boolProp name="Cookie.path_specified">true</boolProp> + <boolProp name="Cookie.domain_specified">true</boolProp> + </elementProp> + </collectionProp> + <boolProp name="CookieManager.clearEachIteration">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager.jmx</stringProp></CookieManager> + <hashTree/> + + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Get Customer Email" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Customer Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_customer_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +customerUserList = props.get("customer_emails_list"); +customerUser = customerUserList.poll(); +if (customerUser == null) { + SampleResult.setResponseMessage("customernUser list is empty"); + SampleResult.setResponseData("customerUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("customer_email", customerUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Home Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_home_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="571386695"><title>Home page</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Login Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/login/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/open_login_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="637394530"><title>Customer Login</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="send" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">send</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/loginPost/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1312950388"><title>My Account</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Address" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">addressId</stringProp> + <stringProp name="RegexExtractor.regex">customer/address/edit/id/([^'"]+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert addressId extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">addressId</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Load Customer Private Data" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="sections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sections</stringProp> + </elementProp> + <elementProp name="force_new_section_timestamp" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">force_new_section_timestamp</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/section/load/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="My Orders" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}sales/order/history/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/my_orders.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="220295440"><title>My Orders</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract orderId" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">orderId</stringProp> + <stringProp name="RegexExtractor.regex">sales/order/view/order_id/(\d+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default">NOT_FOUND</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Orders Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/if_orders.jmx</stringProp> + <stringProp name="IfController.condition">"${orderId}" != "NOT_FOUND"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + </IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View Order" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}sales/order/view/order_id/${orderId}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1956770127"><title>Order #</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract shipment tab" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">shipment_tab</stringProp> + <stringProp name="RegexExtractor.regex">sales/order/shipment/order_id/(\d+)..Order Shipments</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default">NOT_FOUND</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Shipments Controller" enabled="true"> + <stringProp name="TestPlan.comments">May not have shipped</stringProp> + <stringProp name="IfController.condition">"${shipment_tab}" != "NOT_FOUND"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + </IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View Order Shipments" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}sales/order/shipment/order_id/${orderId}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="120578727">Track this shipment</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract popup link" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">popupLink</stringProp> + <stringProp name="RegexExtractor.regex">popupWindow": {"windowURL":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Track Shipment" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${popupLink}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-760430210"><title>Tracking Information</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="My Downloadable Products" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}downloadable/customer/products</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/my_downloadable_products.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="358050505"><title>My Downloadable Products</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract orderId" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">orderId</stringProp> + <stringProp name="RegexExtractor.regex">sales/order/view/order_id/(\d+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default">NOT_FOUND</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract linkId" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">linkId</stringProp> + <stringProp name="RegexExtractor.regex">downloadable/download/link/id/(\d+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Downloadables Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/if_downloadables.jmx</stringProp> + <stringProp name="IfController.condition">"${orderId}" != "NOT_FOUND"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + </IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View Downloadable Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}sales/order/view/order_id/${orderId}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/view_downloadable_products.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1956770127"><title>Order #</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Download Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}downloadable/download/link/id/${linkId}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/download_product.jmx</stringProp></HTTPSamplerProxy> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="My Wish List" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}wishlist</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1907714722"><title>My Wish List</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract wishlistId" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">wishlistId</stringProp> + <stringProp name="RegexExtractor.regex">wishlist/index/update/wishlist_id/([^'"]+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/my_wish_list.jmx</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Verify that there are items in the wishlist" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">buttonTitle</stringProp> + <stringProp name="RegexExtractor.regex">Update Wish List</stringProp> + <stringProp name="RegexExtractor.template">FOUND</stringProp> + <stringProp name="RegexExtractor.default">NOT_FOUND</stringProp> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Wish List Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/if_wishlist.jmx</stringProp> + <stringProp name="IfController.condition">"${buttonTitle}" === "FOUND"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + </IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Share Wish List" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}wishlist/index/share/wishlist_id/${wishlistId}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/share_wish_list.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1257102154"><title>Wish List Sharing</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Wish List" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="emails" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">emails</stringProp> + </elementProp> + <elementProp name="message" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">[TEST] See my wishlist!!!</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">message</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}wishlist/index/send/wishlist_id/${wishlistId}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/account_management/send_wish_list.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1907714722"><title>My Wish List</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}customer/account/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1723813687">You are signed out.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Customer to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> +customerUserList = props.get("customer_emails_list"); +customerUserList.add(vars.get("customer_email")); + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin CMS Management" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminCMSManagementPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin CMS Management"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin CMS Management" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_cms_management/admin_cms_management.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Landing Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/cms/page/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create New" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/cms/page/new</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="content" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>CMS Content ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">content</stringProp> + </elementProp> + <elementProp name="content_heading" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">content_heading</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="identifier" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">identifier</stringProp> + </elementProp> + <elementProp name="is_active" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_active</stringProp> + </elementProp> + <elementProp name="layout_update_xml" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">layout_update_xml</stringProp> + </elementProp> + <elementProp name="meta_description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_description</stringProp> + </elementProp> + <elementProp name="meta_keywords" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_keywords</stringProp> + </elementProp> + <elementProp name="meta_title" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_title</stringProp> + </elementProp> + <elementProp name="nodes_data" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">nodes_data</stringProp> + </elementProp> + <elementProp name="node_ids" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">node_ids</stringProp> + </elementProp> + <elementProp name="page_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">page_id</stringProp> + </elementProp> + <elementProp name="page_layout" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1column</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">page_layout</stringProp> + </elementProp> + <elementProp name="store_id[0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">store_id[0]</stringProp> + </elementProp> + <elementProp name="title" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">CMS Title ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">title</stringProp> + </elementProp> + <elementProp name="website_root" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">website_root</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/cms/page/save/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-398886250">You saved the page.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${adminCMSManagementDelay}*1000))}</stringProp> + </TestAction> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Product Grid" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseProductGridPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Browse Product Grid"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="script"> + vars.put("gridEntityType" , "Product"); + + pagesCount = parseInt(vars.get("products_page_size")) || 20; + vars.put("grid_entity_page_size" , pagesCount); + vars.put("grid_namespace" , "product_listing"); + vars.put("grid_admin_browse_filter_text" , vars.get("admin_browse_product_filter_text")); + vars.put("grid_filter_field", "name"); + + // set sort fields and sort directions + vars.put("grid_sort_field_1", "name"); + vars.put("grid_sort_field_2", "price"); + vars.put("grid_sort_field_3", "attribute_set_id"); + vars.put("grid_sort_order_1", "asc"); + vars.put("grid_sort_order_2", "desc"); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_browse_products_grid/setup.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} pages count" enabled="true"> + <stringProp name="cacheKey"/> + <stringProp name="filename"/> + <stringProp name="parameters"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; + var totalsRecord = parseInt(vars.get("entity_total_records")); + var pageCount = Math.round(totalsRecord/pageSize); + + vars.put("grid_pages_count", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Filtered Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_filtered_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + <boolProp name="ISREGEX">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} filtered pages count" enabled="true"> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; +var totalsRecord = parseInt(vars.get("entity_total_records")); +var pageCount = Math.round(totalsRecord/pageSize); + +vars.put("grid_pages_count_filtered", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select Filtered ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count_filtered}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_filtered_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="View ${gridEntityType} page - Filtering + Sorting" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid_sort_and_filter.jmx</stringProp> +</TestFragmentController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Field Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_field</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_field</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">3</stringProp> + </ForeachController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Order Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_order</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_order</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">2</stringProp> + </ForeachController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page - Filtering + Sort By ${grid_sort_field} ${grid_sort_order}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[${grid_filter_field}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[${grid_filter_field}]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_field}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_order}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Order Grid" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseOrderGridPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Browse Order Grid"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="script"> + vars.put("gridEntityType" , "Order"); + + pagesCount = parseInt(vars.get("orders_page_size")) || 20; + vars.put("grid_entity_page_size" , pagesCount); + vars.put("grid_namespace" , "sales_order_grid"); + vars.put("grid_admin_browse_filter_text" , vars.get("admin_browse_orders_filter_text")); + vars.put("grid_filter_field", "status"); + + // set sort fields and sort directions + vars.put("grid_sort_field_1", "increment_id"); + vars.put("grid_sort_field_2", "created_at"); + vars.put("grid_sort_field_3", "billing_name"); + vars.put("grid_sort_order_1", "asc"); + vars.put("grid_sort_order_2", "desc"); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_browse_orders_grid/setup.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} pages count" enabled="true"> + <stringProp name="cacheKey"/> + <stringProp name="filename"/> + <stringProp name="parameters"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; + var totalsRecord = parseInt(vars.get("entity_total_records")); + var pageCount = Math.round(totalsRecord/pageSize); + + vars.put("grid_pages_count", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Filtered Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_filtered_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + <boolProp name="ISREGEX">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} filtered pages count" enabled="true"> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; +var totalsRecord = parseInt(vars.get("entity_total_records")); +var pageCount = Math.round(totalsRecord/pageSize); + +vars.put("grid_pages_count_filtered", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select Filtered ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count_filtered}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_filtered_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="View ${gridEntityType} page - Filtering + Sorting" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid_sort_and_filter.jmx</stringProp> +</TestFragmentController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Field Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_field</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_field</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">3</stringProp> + </ForeachController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Order Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_order</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_order</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">2</stringProp> + </ForeachController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page - Filtering + Sort By ${grid_sort_field} ${grid_sort_order}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[${grid_filter_field}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[${grid_filter_field}]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_field}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_order}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Create Product" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminProductCreationPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Create Product"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Once Only Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/once_only_controller.jmx</stringProp> +</OnceOnlyController> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Related Product Id" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/get_related_product_id.jmx</stringProp> + <stringProp name="BeanShellSampler.query">import org.apache.jmeter.samplers.SampleResult; +import java.util.Random; +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom}); +} +relatedIndex = random.nextInt(props.get("simple_products_list").size()); +vars.put("related_product_id", props.get("simple_products_list").get(relatedIndex).get("id"));</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="SetUp - Get Product Attributes" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">*/*</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/api/header_manager_before_token.jmx</stringProp></HeaderManager> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Admin Token Retrieval" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"username":"${admin_user}","password":"${admin_password}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/integration/admin/token</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/api/admin_token_retrieval.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="jp@gc - JSON Path Extractor" enabled="true"> + <stringProp name="VAR">admin_token</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert token not null" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="484395188">^[a-z0-9-]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_token</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Bearer ${admin_token}</stringProp> + </elementProp> + </collectionProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/api/header_manager.jmx</stringProp></HeaderManager> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - API Get product attributes" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="searchCriteria[filterGroups][0][filters][0][value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">mycolor</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">searchCriteria[filterGroups][0][filters][0][value]</stringProp> + </elementProp> + <elementProp name="searchCriteria[filterGroups][0][filters][0][field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">attribute_code</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">searchCriteria[filterGroups][0][filters][0][field]</stringProp> + </elementProp> + <elementProp name="searchCriteria[filterGroups][0][filters][1][value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">mysize</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">searchCriteria[filterGroups][0][filters][1][value]</stringProp> + </elementProp> + <elementProp name="searchCriteria[filterGroups][0][filters][1][field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">attribute_code</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">searchCriteria[filterGroups][0][filters][1][field]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/default/V1/products/attributes</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/get_product_attributes.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract product attributes" enabled="true"> + <stringProp name="VAR">product_attributes</stringProp> + <stringProp name="JSONPATH">$.items</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="SetUp - Prepare product attributes" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> +var attributesData = JSON.parse(vars.get("product_attributes")), +maxOptions = 2; + +attributes = []; +for (i in attributesData) { + if (i >= 2) { + break; + } + var data = attributesData[i], + attribute = { + "id": data.attribute_id, + "code": data.attribute_code, + "label": data.default_frontend_label, + "options": [] + }; + + var processedOptions = 0; + for (optionN in data.options) { + var option = data.options[optionN]; + if (parseInt(option.value) > 0 && processedOptions < maxOptions) { + processedOptions++; + attribute.options.push(option); + } + } + attributes.push(attribute); +} + +vars.putObject("product_attributes", attributes); +</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Get Attribute Set Id" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product_set/index/filter/${attribute_set_filter}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/configurable_setup_attribute_set.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">attribute_set_id</stringProp> + <stringProp name="RegexExtractor.regex">catalog\/product_set\/edit\/id\/([\d]+)\/"[\D\d]*Attribute Set 1</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="SetUp - Set Attribute Set Filter" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script">import org.apache.commons.codec.binary.Base64; + +byte[] encodedBytes = Base64.encodeBase64("set_name=Attribute Set 1".getBytes()); +vars.put("attribute_set_filter", new String(encodedBytes)); +</stringProp> + </BeanShellPreProcessor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="BeanShellSampler.query">import org.apache.jmeter.samplers.SampleResult; +import java.util.Random; +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom}); +} +number = random.nextInt(props.get("simple_products_list_for_edit").size()); +simpleList = props.get("simple_products_list_for_edit").get(number); +vars.put("simple_product_1_id", simpleList.get("id")); +vars.put("simple_product_1_name", simpleList.get("title")); + +do { + number1 = random.nextInt(props.get("simple_products_list_for_edit").size()); +} while(number == number1); +simpleList = props.get("simple_products_list_for_edit").get(number1); +vars.put("simple_product_2_id", simpleList.get("id")); +vars.put("simple_product_2_name", simpleList.get("title")); + +number2 = random.nextInt(props.get("configurable_products_list").size()); +configurableList = props.get("configurable_products_list").get(number2); +vars.put("configurable_product_1_id", configurableList.get("id")); +vars.put("configurable_product_1_url_key", configurableList.get("url_key")); +vars.put("configurable_product_1_name", configurableList.get("title")); + +//Additional category to be added +//int categoryId = Integer.parseInt(vars.get("simple_product_category_id")); +//vars.put("category_additional", (categoryId+1).toString()); +//New price +vars.put("price_new", "9999"); +//New special price +vars.put("special_price_new", "8888"); +//New quantity +vars.put("quantity_new", "100600"); +vars.put("configurable_sku", "Configurable Product - ${__time(YMD)}-${__threadNum}-${__Random(1,1000000)}"); + + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/setup.jmx</stringProp></BeanShellSampler> + <hashTree/> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Create Bundle Product" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/create_bundle_product.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Catalog Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1509986340">records found</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Bundle Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/new/set/4/type/bundle/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-144461265">New Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Bundle Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">42</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full bundle product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short bundle product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[configurable_variations]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variations]</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">bundle-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + </elementProp> + <elementProp name="product[shipment_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[shipment_type]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">option title one</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][title]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][option_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][delete]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][type]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][required]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][required]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][position]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][option_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_1_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][product_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][delete]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">25</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_price_value]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_price_type]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_qty]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_can_change_qty]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][position]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][option_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_2_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][product_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][delete]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10.99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_price_value]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_price_type]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_qty]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_can_change_qty]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][position]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">option title two</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][title]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][option_id]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][delete]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][type]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][required]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][required]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][position]</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][option_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_1_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][product_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][delete]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">5.00</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_price_value]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_price_type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][position]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][option_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_2_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][product_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][delete]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">7.00</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_price_value]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_price_type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][position]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="affect_bundle_product_selections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_bundle_product_selections</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/set/4/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Bundle Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">42</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full bundle product Description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short bundle product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[configurable_variations]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variations]</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">bundle-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Bundle Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + </elementProp> + <elementProp name="product[shipment_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[shipment_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">option title one</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][required]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][required]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_1_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][product_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">25</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_price_value]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][0][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_2_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][product_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10.99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_price_value]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][0][bundle_selections][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][0][bundle_selections][1][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">option title two</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][required]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][required]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_1_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][product_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">5.00</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_price_value]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][0][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][option_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][option_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][product_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_2_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][product_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_price_value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">7.00</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_price_value]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][selection_can_change_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][selection_can_change_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="bundle_options[bundle_options][1][bundle_selections][1][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">bundle_options[bundle_options][1][bundle_selections][1][position]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_bundle_product_selections" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_bundle_product_selections</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/set/4/type/bundle/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + <stringProp name="-1534079309">option title one</stringProp> + <stringProp name="-1534074215">option title two</stringProp> + <stringProp name="1304788671">${simple_product_2_name}</stringProp> + <stringProp name="417284990">${simple_product_1_name}</stringProp> + </collectionProp> + + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Create Configurable Product" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Catalog Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/open_catalog_grid.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1509986340">records found</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Configurable Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/new/set/${attribute_set_id}/type/configurable/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/new_configurable.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-144461265">New Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Configurable Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${attribute_set_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[affect_product_custom_options]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[affect_product_custom_options]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[attribute_set_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${attribute_set_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[attribute_set_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][0]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_message_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_wrapping_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_wrapping_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_wrapping_price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[is_returnable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[is_returnable]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][deferred_stock_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][deferred_stock_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][manage_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_deferred_stock_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_deferred_stock_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_message_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_wrapping_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_is_returnable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_is_returnable]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[visibility]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[visibility]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[website_ids][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][1]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/set/${attribute_set_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/configurable_validate.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Prepare Configurable Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> +attributes = vars.getObject("product_attributes"); + +for (i in attributes) { + var attribute = attributes[i]; + sampler.addArgument("attribute_codes[" + i + "]", attribute.code); + sampler.addArgument("attributes[" + i + "]", attribute.id); + sampler.addArgument("product[" + attribute.code + "]", attribute.options[0].value); + addConfigurableAttributeData(attribute); +} + +addConfigurableMatrix(attributes); + +function addConfigurableAttributeData(attribute) { + var attributeId = attribute.id; + + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][attribute_id]", attributeId); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][code]", attribute.code); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][label]", attribute.label); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][position]", 0); + attribute.options.forEach(function (option, index) { + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][values][" + option.value + "][include]", index); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][values][" + option.value + "][value_index]", option.value); + }); +} + +/** + * Build 4 simple products for Configurable + */ +function addConfigurableMatrix(attributes) { + + var attribute1 = attributes[0], + attribute2 = attributes[1], + productIndex = 1, + products = []; + var variationNames = []; + attribute1.options.forEach(function (option1) { + attribute2.options.forEach(function (option2) { + var productAttributes = {}, + namePart = option1.label + "+" + option2.label, + variationKey = option1.value + "-" + option2.value; + productAttributes[attribute1.code] = option1.value; + productAttributes[attribute2.code] = option2.value; + + variationNames.push(namePart + " - " + vars.get("configurable_sku")); + var product = { + "id": null, + "name": namePart + " - " + vars.get("configurable_sku"), + "sku": namePart + " - " + vars.get("configurable_sku"), + "status": 1, + "price": "100", + "price_currency": "$", + "price_string": "$100", + "weight": "6", + "qty": "50", + "variationKey": variationKey, + "configurable_attribute": JSON.stringify(productAttributes), + "thumbnail_image": "", + "media_gallery": {"images": {}}, + "image": [], + "was_changed": true, + "canEdit": 1, + "newProduct": 1, + "record_id": productIndex + }; + productIndex++; + products.push(product); + }); + }); + + sampler.addArgument("configurable-matrix-serialized", JSON.stringify(products)); + vars.putObject("configurable_variations_assertion", variationNames); +} + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/configurable_prepare_data.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Configurable Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${attribute_set_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[affect_product_custom_options]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[affect_product_custom_options]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[attribute_set_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${attribute_set_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[attribute_set_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][0]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_message_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_wrapping_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[gift_wrapping_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[gift_wrapping_price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[is_returnable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[is_returnable]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku} - Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][deferred_stock_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][deferred_stock_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][manage_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_deferred_stock_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_deferred_stock_update]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_message_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_wrapping_available]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[use_config_is_returnable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_is_returnable]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[visibility]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[visibility]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[website_ids][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][1]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/set/${attribute_set_id}/type/configurable/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/configurable_save.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="Assert Variation" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> +var configurableVariations = vars.getObject("configurable_variations_assertion"), +response = SampleResult.getResponseDataAsString(); + +configurableVariations.forEach(function (variation) { + if (response.indexOf(variation) == -1) { + AssertionResult.setFailureMessage("Cannot find variation \"" + variation + "\""); + AssertionResult.setFailure(true); + } +}); +</stringProp> + </JSR223Assertion> + <hashTree/> + + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Prepare Configurable Data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> +attributes = vars.getObject("product_attributes"); + +for (i in attributes) { + var attribute = attributes[i]; + sampler.addArgument("attribute_codes[" + i + "]", attribute.code); + sampler.addArgument("attributes[" + i + "]", attribute.id); + sampler.addArgument("product[" + attribute.code + "]", attribute.options[0].value); + addConfigurableAttributeData(attribute); +} + +addConfigurableMatrix(attributes); + +function addConfigurableAttributeData(attribute) { + var attributeId = attribute.id; + + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][attribute_id]", attributeId); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][code]", attribute.code); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][label]", attribute.label); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][position]", 0); + attribute.options.forEach(function (option, index) { + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][values][" + option.value + "][include]", index); + sampler.addArgument("product[configurable_attributes_data][" + attributeId + "][values][" + option.value + "][value_index]", option.value); + }); +} + +/** + * Build 4 simple products for Configurable + */ +function addConfigurableMatrix(attributes) { + + var attribute1 = attributes[0], + attribute2 = attributes[1], + productIndex = 1, + products = []; + var variationNames = []; + attribute1.options.forEach(function (option1) { + attribute2.options.forEach(function (option2) { + var productAttributes = {}, + namePart = option1.label + "+" + option2.label, + variationKey = option1.value + "-" + option2.value; + productAttributes[attribute1.code] = option1.value; + productAttributes[attribute2.code] = option2.value; + + variationNames.push(namePart + " - " + vars.get("configurable_sku")); + var product = { + "id": null, + "name": namePart + " - " + vars.get("configurable_sku"), + "sku": namePart + " - " + vars.get("configurable_sku"), + "status": 1, + "price": "100", + "price_currency": "$", + "price_string": "$100", + "weight": "6", + "qty": "50", + "variationKey": variationKey, + "configurable_attribute": JSON.stringify(productAttributes), + "thumbnail_image": "", + "media_gallery": {"images": {}}, + "image": [], + "was_changed": true, + "canEdit": 1, + "newProduct": 1, + "record_id": productIndex + }; + productIndex++; + products.push(product); + }); + }); + + sampler.addArgument("configurable-matrix-serialized", JSON.stringify(products)); + vars.putObject("configurable_variations_assertion", variationNames); +} + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/configurable_prepare_data.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + </hashTree> + </hashTree> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Create Downloadable Product" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/create_downloadable_product.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Catalog Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1509986340">records found</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Downloadable Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/new/set/4/type/downloadable/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-144461265">New Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Downloadable Upload Original File" enabled="true"> + <elementProp name="HTTPsampler.Files" elementType="HTTPFileArgs"> + <collectionProp name="HTTPFileArgs.files"> + <elementProp name="${files_folder}downloadable_original.txt" elementType="HTTPFileArg"> + <stringProp name="File.path">${files_folder}downloadable_original.txt</stringProp> + <stringProp name="File.paramname">links</stringProp> + <stringProp name="File.mimetype">text/plain</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/downloadable_file/upload/type/links/?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">false</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract original file" enabled="true"> + <stringProp name="VAR">original_file</stringProp> + <stringProp name="JSONPATH">$.file</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Downloadable Upload Sample File" enabled="true"> + <elementProp name="HTTPsampler.Files" elementType="HTTPFileArgs"> + <collectionProp name="HTTPFileArgs.files"> + <elementProp name="${files_folder}downloadable_sample.txt" elementType="HTTPFileArg"> + <stringProp name="File.path">${files_folder}downloadable_sample.txt</stringProp> + <stringProp name="File.paramname">samples</stringProp> + <stringProp name="File.mimetype">text/plain</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/downloadable_file/upload/type/samples/?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">false</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract sample file" enabled="true"> + <stringProp name="VAR">sample_file</stringProp> + <stringProp name="JSONPATH">$.file</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Downloadable Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">SKU ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full downloadable product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short downloadable product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="is_downloadable" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">on</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_downloadable</stringProp> + </elementProp> + <elementProp name="product[links_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Links</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[links_title]</stringProp> + </elementProp> + <elementProp name="product[links_purchased_separately]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[links_purchased_separately]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][file]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${original_file}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][file]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable_original.txt</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][size]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">13</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][size]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">new</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][is_shareable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][is_shareable]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][is_unlimited]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][is_unlimited]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][link_url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][link_url]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][number_of_downloads]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][number_of_downloads]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">120</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][price]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][record_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][record_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sample][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sample][type]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sample][url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sample][url]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sort_order]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Original Link</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][title]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][type]</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][file]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${sample_file}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][file]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable_sample.txt</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][name]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][size]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">14</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][size]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">new</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][record_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][record_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][sample_url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][sample_url]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][sort_order]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Sample Link</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][title]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/set/4/type/downloadable/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Downloadable Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">SKU ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full downloadable product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short downloadable product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Downloadable Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][file]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${original_file}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][file]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable_original.txt</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][size]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">13</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][size]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][file][0][status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">new</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][file][0][status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][is_shareable]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][is_shareable]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][is_unlimited]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][is_unlimited]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][link_url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][link_url]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][number_of_downloads]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][number_of_downloads]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">120</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][record_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][record_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sample][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sample][type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sample][url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sample][url]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][sort_order]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Original Link</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][title]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[link][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[link][0][type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][file]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${sample_file}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][file]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">downloadable_sample.txt</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][name]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][size]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">14</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][size]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][file][0][status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">new</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][file][0][status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][record_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][record_id]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][sample_url]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][sample_url]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][sort_order]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Sample Link</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][title]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="downloadable[sample][0][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">file</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">downloadable[sample][0][type]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/set/4/type/downloadable/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1600986843">violation</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Create Simple Product" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_product/create_simple_product.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Catalog Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1509986340">records found</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Simple Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/new/set/4/type/simple/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-144461265">New Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Simple Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">SKU ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full simple product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short simple product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">simple-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="product[options][1][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][is_delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][is_require]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][is_require]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][previous_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][previous_group]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][previous_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">drop_down</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][previous_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][sort_order]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Product Option Title One</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">drop_down</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][is_delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">fixed</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sku-one</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][sort_order]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Row Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][is_delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][is_require]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][is_require]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][max_characters]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">250</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][max_characters]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][previous_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">text</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][previous_group]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][previous_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">field</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][previous_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">fixed</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][price_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sku-two</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][sort_order]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Field Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">field</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/set/4/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="New Simple Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">SKU ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">111</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full simple product Description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + </elementProp> + <elementProp name="product[short_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Short simple product description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[short_description]</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">simple-product-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Keyword</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Simple Product ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)} Meta Description</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">32000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">90</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][0][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][0][delete]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][website_id]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][cust_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][cust_group]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">101</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price_qty]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">99</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][price]</stringProp> + </elementProp> + <elementProp name="product[tier_price][1][delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tier_price][1][delete]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + </elementProp> + <elementProp name="product[options][1][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][is_delete]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[options][1][is_require]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][is_require]</stringProp> + </elementProp> + <elementProp name="product[options][1][previous_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">select</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][previous_group]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][previous_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">drop_down</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][previous_type]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][sort_order]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Product Option Title One</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][title]</stringProp> + </elementProp> + <elementProp name="product[options][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">drop_down</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][type]</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][is_delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][price]</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">fixed</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][price_type]</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sku-one</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][sku]</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][sort_order]</stringProp> + </elementProp> + <elementProp name="product[options][1][values][1][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Row Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][1][values][1][title]</stringProp> + </elementProp> + <elementProp name="product[options][2][is_delete]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][is_delete]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options][2][is_require]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][is_require]</stringProp> + </elementProp> + <elementProp name="product[options][2][max_characters]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">250</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][max_characters]</stringProp> + </elementProp> + <elementProp name="product[options][2][previous_group]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">text</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][previous_group]</stringProp> + </elementProp> + <elementProp name="product[options][2][previous_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">field</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][previous_type]</stringProp> + </elementProp> + <elementProp name="product[options][2][price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">500</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][price]</stringProp> + </elementProp> + <elementProp name="product[options][2][price_type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">fixed</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][price_type]</stringProp> + </elementProp> + <elementProp name="product[options][2][sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sku-two</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][sku]</stringProp> + </elementProp> + <elementProp name="product[options][2][sort_order]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][sort_order]</stringProp> + </elementProp> + <elementProp name="product[options][2][title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Field Title</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][title]</stringProp> + </elementProp> + <elementProp name="product[options][2][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">field</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options][2][type]</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="links[related][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][id]</stringProp> + </elementProp> + <elementProp name="links[related][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[related][0][position]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][id]</stringProp> + </elementProp> + <elementProp name="links[upsell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[upsell][0][position]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${related_product_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][id]</stringProp> + </elementProp> + <elementProp name="links[crosssell][0][position]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">links[crosssell][0][position]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/set/4/type/simple/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1600986843">violation</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">6</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Edit Product" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminProductEditingPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Edit Product"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Edit Product" enabled="true"/> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Generate Unique Ids for each Thread" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_product/admin_edit_product_updated.jmx</stringProp> + <stringProp name="BeanShellSampler.query">import java.util.ArrayList; + import java.util.HashMap; + import java.util.Random; + + try { + Random random = new Random(); + if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); + } + simpleCount = props.get("simple_products_list_for_edit").size(); + configCount = props.get("configurable_products_list_for_edit").size(); + productCount = 0; + if (simpleCount > configCount) { + productCount = configCount; + } else { + productCount = simpleCount; + } + int threadsNumber = ctx.getThreadGroup().getNumThreads(); + if (threadsNumber == 0) { + threadsNumber = 1; + } + //Current thread number starts from 0 + currentThreadNum = ctx.getThreadNum(); + + String siterator = vars.get("threadIterator_" + currentThreadNum.toString()); + iterator = 0; + if(siterator == null){ + vars.put("threadIterator_" + currentThreadNum.toString() , "0"); + } else { + iterator = Integer.parseInt(siterator); + iterator ++; + vars.put("threadIterator_" + currentThreadNum.toString() , iterator.toString()); + } + + //Number of products for one thread + productClusterLength = productCount / threadsNumber; + + if (iterator >= productClusterLength) { + vars.put("threadIterator_" + currentThreadNum.toString(), "0"); + iterator = 0; + } + + //Index of the current product from the cluster + i = productClusterLength * currentThreadNum + iterator; + + //ids of simple and configurable products to edit + vars.put("simple_product_id", props.get("simple_products_list_for_edit").get(i).get("id")); + vars.put("configurable_product_id", props.get("configurable_products_list_for_edit").get(i).get("id")); + + //id of related product + do { + relatedIndex = random.nextInt(props.get("simple_products_list_for_edit").size()); + } while(i == relatedIndex); + vars.put("related_product_id", props.get("simple_products_list_for_edit").get(relatedIndex).get("id")); + } catch (Exception ex) { + log.info("Script execution failed", ex); +}</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Simple Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/edit/id/${simple_product_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1355179215">Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract name" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">simple_product_name</stringProp> + <stringProp name="RegexExtractor.regex">,"name":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract sku" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">simple_product_sku</stringProp> + <stringProp name="RegexExtractor.regex">,"sku":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">simple_product_category_id</stringProp> + <stringProp name="RegexExtractor.regex">,"category_ids":."(\d+)".</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set updated values" enabled="true"> + <stringProp name="TestPlan.comments">Passing arguments between threads</stringProp> + <stringProp name="BeanShellSampler.query">//Additional category to be added + import java.util.Random; + + Random randomGenerator = new Random(); + if (${seedForRandom} > 0) { + randomGenerator.setSeed(${seedForRandom} + ${__threadNum}); + } + + int categoryId = Integer.parseInt(vars.get("simple_product_category_id")); + categoryList = props.get("admin_category_ids_list"); + + if (categoryList.size() > 1) { + do { + int index = randomGenerator.nextInt(categoryList.size()); + newCategoryId = categoryList.get(index); + } while (categoryId == newCategoryId); + + vars.put("category_additional", newCategoryId.toString()); + } + + //New price + vars.put("price_new", "9999"); + //New special price + vars.put("special_price_new", "8888"); + //New quantity + vars.put("quantity_new", "100600"); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Simple Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full simple product Description ${simple_product_id} Edited</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variations]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variations]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Title Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Keyword Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Description Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/id/${simple_product_id}/?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Simple Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1.0000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${category_additional}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Full simple product Description ${simple_product_id} Edited</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variations]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variations]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="affect_configurable_product_attributes" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">affect_configurable_product_attributes</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[image]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[small_image]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[small_image]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[thumbnail]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[thumbnail]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Title Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Keyword Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${simple_product_name} Meta Description Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][original_inventory_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][original_inventory_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${quantity_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10000</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="new-variations-attribute-set-id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">new-variations-attribute-set-id</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/id/${simple_product_id}/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Configurable Product" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/edit/id/${configurable_product_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1355179215">Product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract name" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_product_name</stringProp> + <stringProp name="RegexExtractor.regex">,"name":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract sku" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_product_sku</stringProp> + <stringProp name="RegexExtractor.regex">,"sku":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_product_category_id</stringProp> + <stringProp name="RegexExtractor.regex">,"category_ids":."(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract configurable attribute id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_attribute_id</stringProp> + <stringProp name="RegexExtractor.regex">,"configurable_variation":"([^'"]+)",</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <boolProp name="RegexExtractor.default_empty_value">true</boolProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract configurable matrix" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_matrix</stringProp> + <stringProp name="RegexExtractor.regex">"configurable-matrix":(\[.*?\])</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <boolProp name="RegexExtractor.default_empty_value">true</boolProp> + </RegexExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract associated products ids" enabled="true"> + <stringProp name="VAR">associated_products_ids</stringProp> + <stringProp name="JSONPATH">$.[*].id</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE">configurable_matrix</stringProp> + <stringProp name="SUBJECT">VAR</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract configurable product json" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_product_data</stringProp> + <stringProp name="RegexExtractor.regex">(\{"product":.*?configurable_attributes_data.*?\})\s*<</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract configurable attributes data" enabled="true"> + <stringProp name="VAR">configurable_attributes_data</stringProp> + <stringProp name="JSONPATH">$.product.configurable_attributes_data</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE">configurable_product_data</stringProp> + <stringProp name="SUBJECT">VAR</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract attribute ids" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_attribute_ids</stringProp> + <stringProp name="RegexExtractor.regex">"attribute_id":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Sample.scope">variable</stringProp> + <stringProp name="Scope.variable">configurable_attributes_data</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract attribute codes" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_attribute_codes</stringProp> + <stringProp name="RegexExtractor.regex">"code":"(\w+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Sample.scope">variable</stringProp> + <stringProp name="Scope.variable">configurable_attributes_data</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract attribute labels" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_attribute_labels</stringProp> + <stringProp name="RegexExtractor.regex">"label":"(.*?)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Sample.scope">variable</stringProp> + <stringProp name="Scope.variable">configurable_attributes_data</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract attribute values" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">configurable_attribute_values</stringProp> + <stringProp name="RegexExtractor.regex">"values":(\{(?:\}|.*?\}\}))</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Sample.scope">variable</stringProp> + <stringProp name="Scope.variable">configurable_attributes_data</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach configurable attribute id" enabled="true"> + <stringProp name="ForeachController.inputVal">configurable_attribute_ids</stringProp> + <stringProp name="ForeachController.returnVal">configurable_attribute_id</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + </ForeachController> + <hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${configurable_attribute_ids_matchNr}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">attribute_counter</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="Process configurable attribute values" enabled="true"> + <stringProp name="BeanShellSampler.query">return vars.get("configurable_attribute_values_" + vars.get("attribute_counter"));</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Exctract attribute values" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">attribute_${configurable_attribute_id}_values</stringProp> + <stringProp name="RegexExtractor.regex">"value_index":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">configurable_attribute_values_${attribute_counter}</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Configurable Product Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">3</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${category_additional}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Configurable product description ${configurable_product_id} Edited</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Title Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Keyword Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Description Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_attribute_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_message_available]</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_wrapping_available]</stringProp> + </elementProp> + <elementProp name="product[visibility]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[visibility]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">50</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][type_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">configurable</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][type_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/validate/id/${configurable_product_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="Configure product options" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script">try { + int attributesCount = Integer.parseInt(vars.get("configurable_attribute_ids_matchNr")); + for (int i = 1; i <= attributesCount; i++) { + attributeId = vars.get("configurable_attribute_ids_" + i.toString()); + attributeCode = vars.get("configurable_attribute_codes_" + i.toString()); + attributeLabel = vars.get("configurable_attribute_labels_" + i.toString()); + ctx.getCurrentSampler().addArgument("attributes[" + (i - 1).toString() + "]", attributeId); + ctx.getCurrentSampler().addArgument("attribute_codes[" + (i - 1).toString() + "]", attributeCode); + ctx.getCurrentSampler().addArgument("product[" + attributeCode + "]", attributeId); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][attribute_id]", attributeId); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][position]", (i - 1).toString()); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][code]", attributeCode); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][label]", attributeLabel); + + int valuesCount = Integer.parseInt(vars.get("attribute_" + attributeId + "_values_matchNr")); + for (int j = 1; j <= valuesCount; j++) { + attributeValue = vars.get("attribute_" + attributeId + "_values_" + j.toString()); + ctx.getCurrentSampler().addArgument( + "product[configurable_attributes_data][" + attributeId + "][values][" + attributeValue + "][include]", + "1" + ); + ctx.getCurrentSampler().addArgument( + "product[configurable_attributes_data][" + attributeId + "][values][" + attributeValue + "][value_index]", + attributeValue + ); + } + } + ctx.getCurrentSampler().addArgument("associated_product_ids_serialized", vars.get("associated_products_ids").toString()); + } catch (Exception e) { + log.error("error???", e); + }</stringProp> + </BeanShellPreProcessor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1853918323">{"error":false}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Configurable Product Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="ajax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">ajax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[name]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[name]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[sku]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_sku}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[sku]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[tax_class_id]admin" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[tax_class_id]admin</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[quantity_and_stock_status][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[quantity_and_stock_status][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">3</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[weight]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[category_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${category_additional}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[category_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"><p>Configurable product description ${configurable_product_id} Edited</p></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_title]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Title Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_title]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_keyword]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Keyword Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_keyword]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[meta_description]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name} Meta Description Edited</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[meta_description]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[website_ids][]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[website_ids][]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_price]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${special_price_new}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_price]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_from_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_from_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[special_to_date]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[special_to_date]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[cost]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[cost]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_manage_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_manage_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_min_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_min_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_max_sale_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_max_sale_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_qty_decimal]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_qty_decimal]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_decimal_divided]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_decimal_divided]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_backorders]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_backorders]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_notify_stock_qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_notify_stock_qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][enable_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][enable_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][use_config_qty_increments]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][use_config_qty_increments]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][is_in_stock]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][is_in_stock]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_from]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_design_to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_design_to]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[custom_layout_update]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[custom_layout_update]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[page_layout]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[page_layout]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[options_container]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">container2</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[options_container]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[configurable_variation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_attribute_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[configurable_variation]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${configurable_product_name}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[url_key]</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_message_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_message_available]</stringProp> + </elementProp> + <elementProp name="product[use_config_gift_wrapping_available]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[use_config_gift_wrapping_available]</stringProp> + </elementProp> + <elementProp name="product[visibility]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">4</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[visibility]</stringProp> + </elementProp> + <elementProp name="product[product_has_weight]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[product_has_weight]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="product[stock_data][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">50</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][qty]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="product[stock_data][type_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">configurable</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">product[stock_data][type_id]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/product/save/id/${configurable_product_id}/back/edit/active_tab/product-details/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="Configure product options" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script">try { + int attributesCount = Integer.parseInt(vars.get("configurable_attribute_ids_matchNr")); + for (int i = 1; i <= attributesCount; i++) { + attributeId = vars.get("configurable_attribute_ids_" + i.toString()); + attributeCode = vars.get("configurable_attribute_codes_" + i.toString()); + attributeLabel = vars.get("configurable_attribute_labels_" + i.toString()); + ctx.getCurrentSampler().addArgument("attributes[" + (i - 1).toString() + "]", attributeId); + ctx.getCurrentSampler().addArgument("attribute_codes[" + (i - 1).toString() + "]", attributeCode); + ctx.getCurrentSampler().addArgument("product[" + attributeCode + "]", attributeId); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][attribute_id]", attributeId); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][position]", (i - 1).toString()); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][code]", attributeCode); + ctx.getCurrentSampler().addArgument("product[configurable_attributes_data][" + attributeId + "][label]", attributeLabel); + + int valuesCount = Integer.parseInt(vars.get("attribute_" + attributeId + "_values_matchNr")); + for (int j = 1; j <= valuesCount; j++) { + attributeValue = vars.get("attribute_" + attributeId + "_values_" + j.toString()); + ctx.getCurrentSampler().addArgument( + "product[configurable_attributes_data][" + attributeId + "][values][" + attributeValue + "][include]", + "1" + ); + ctx.getCurrentSampler().addArgument( + "product[configurable_attributes_data][" + attributeId + "][values][" + attributeValue + "][value_index]", + attributeValue + ); + } + } + ctx.getCurrentSampler().addArgument("associated_product_ids_serialized", vars.get("associated_products_ids").toString()); + } catch (Exception e) { + log.error("error???", e); + }</stringProp> + </BeanShellPreProcessor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-583471546">You saved the product</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + <stringProp name="TestPlan.comments"> if have trouble see messages-message-error </stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Returns Management" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminReturnsManagementPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Returns Management"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Orders page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/orders_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1204796042">Create New Order</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Orders" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sales_order_grid</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">increment_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">desc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">pending</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/open_orders.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">totalRecords</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search Pending Orders" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sales_order_grid</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">increment_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">pending</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[status]</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/search_orders.jmx</stringProp></HTTPSamplerProxy> +<hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">totalRecords</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order numbers" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_numbers</stringProp> + <stringProp name="RegexExtractor.regex">\"increment_id\":\"(\d+)\"\,</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order ids" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_ids</stringProp> + <stringProp name="RegexExtractor.regex">\"entity_id\":\"(\d+)\"\,</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Generate Unique Ids for each Thread" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> + import java.util.ArrayList; + import java.util.HashMap; + import org.apache.jmeter.protocol.http.util.Base64Encoder; + import java.util.Random; + + // get count of "order_numbers" variable defined in "Search Pending Orders Limit" + int ordersCount = Integer.parseInt(vars.get("order_numbers_matchNr")); + + + int clusterLength; + int threadsNumber = ctx.getThreadGroup().getNumThreads(); + if (threadsNumber == 0) { + //Number of orders for one thread + clusterLength = ordersCount; + } else { + clusterLength = Math.round(ordersCount / threadsNumber); + if (clusterLength == 0) { + clusterLength = 1; + } + } + + //Current thread number starts from 0 + int currentThreadNum = ctx.getThreadNum(); + + //Index of the current product from the cluster + Random random = new Random(); + if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); + } + int iterator = random.nextInt(clusterLength); + if (iterator == 0) { + iterator = 1; + } + + int i = clusterLength * currentThreadNum + iterator; + + orderNumber = vars.get("order_numbers_" + i.toString()); + orderId = vars.get("order_ids_" + i.toString()); + vars.put("order_number", orderNumber); + vars.put("order_id", orderId); + + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Order" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order/view/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/open_order.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2103620713">#${order_number}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order status" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_status</stringProp> + <stringProp name="RegexExtractor.regex"><span id="order_status">([^<]+)</span></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true"> + <stringProp name="IfController.condition">"${order_status}" == "Pending"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_order/if_controller.jmx</stringProp></IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Invoice Start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_invoice/start/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/invoice_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1233850814">Invoice Totals</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract ordered items ids" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">item_ids</stringProp> + <stringProp name="RegexExtractor.regex"><div id="order_item_(\d+)_title"\s*class="product-title"></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Invoice Submit" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="invoice[items][${item_ids_1}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[items][${item_ids_1}]</stringProp> + </elementProp> + <elementProp name="invoice[items][${item_ids_2}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[items][${item_ids_2}]</stringProp> + </elementProp> + <elementProp name="invoice[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Invoiced</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[comment_text]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_invoice/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/invoice_submit.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1740524604">The invoice has been created</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Credit Memo Start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_creditmemo/start/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/credit_memo_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1382627322">New Memo</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Credit Memo Submit - Full Refund" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="creditmemo[items][${item_ids_1}][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[items][${item_ids_1}][qty]</stringProp> + </elementProp> + <elementProp name="creditmemo[items][${item_ids_2}][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[items][${item_ids_2}][qty]</stringProp> + </elementProp> + <elementProp name="creditmemo[do_offline]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[do_offline]</stringProp> + </elementProp> + <elementProp name="creditmemo[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Credit Memo added</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[comment_text]</stringProp> + </elementProp> + <elementProp name="creditmemo[shipping_amount]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">10</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[shipping_amount]</stringProp> + </elementProp> + <elementProp name="creditmemo[adjustment_positive]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[adjustment_positive]</stringProp> + </elementProp> + <elementProp name="creditmemo[adjustment_negative]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">creditmemo[adjustment_negative]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_creditmemo/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/credit_memo_full_refund.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-515117447">You created the credit memo</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Create/Process Returns - Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${adminCreateProcessReturnsDelay}*1000))}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/pause.jmx</stringProp></TestAction> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Customer Grid" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseCustomerGridPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Browse Customer Grid"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="script"> + vars.put("gridEntityType" , "Customer"); + + pagesCount = parseInt(vars.get("customers_page_size")) || 20; + vars.put("grid_entity_page_size" , pagesCount); + vars.put("grid_namespace" , "customer_listing"); + vars.put("grid_admin_browse_filter_text" , vars.get("admin_browse_customer_filter_text")); + vars.put("grid_filter_field", "name"); + + // set sort fields and sort directions + vars.put("grid_sort_field_1", "name"); + vars.put("grid_sort_field_2", "group_id"); + vars.put("grid_sort_field_3", "billing_country_id"); + vars.put("grid_sort_order_1", "asc"); + vars.put("grid_sort_order_2", "desc"); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_browse_customers_grid/setup.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} pages count" enabled="true"> + <stringProp name="cacheKey"/> + <stringProp name="filename"/> + <stringProp name="parameters"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; + var totalsRecord = parseInt(vars.get("entity_total_records")); + var pageCount = Math.round(totalsRecord/pageSize); + + vars.put("grid_pages_count", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Set ${gridEntityType} Filtered Pages Count" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/set_filtered_pages_count.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.gui.JSONPathAssertionGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion" testname="Assert total records is not 0" enabled="true"> + <stringProp name="JSON_PATH">$.totalRecords</stringProp> + <stringProp name="EXPECTED_VALUE">0</stringProp> + <boolProp name="JSONVALIDATION">true</boolProp> + <boolProp name="EXPECT_NULL">false</boolProp> + <boolProp name="INVERT">true</boolProp> + <boolProp name="ISREGEX">true</boolProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="Extract total records" enabled="true"> + <stringProp name="VAR">entity_total_records</stringProp> + <stringProp name="JSONPATH">$.totalRecords</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="SetUp - Calculate ${gridEntityType} filtered pages count" enabled="true"> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + var pageSize = parseInt(vars.get("grid_entity_page_size")) || 20; +var totalsRecord = parseInt(vars.get("entity_total_records")); +var pageCount = Math.round(totalsRecord/pageSize); + +vars.put("grid_pages_count_filtered", pageCount); + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="SetUp - Select Filtered ${gridEntityType} Page Number" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end">${grid_pages_count_filtered}</stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">page_number</stringProp> + <stringProp name="CounterConfig.format"/> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/select_filtered_page_number.jmx</stringProp></CounterConfig> + <hashTree/> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="View ${gridEntityType} page - Filtering + Sorting" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_grid_browsing/admin_browse_grid_sort_and_filter.jmx</stringProp> +</TestFragmentController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Field Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_field</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_field</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">3</stringProp> + </ForeachController> + <hashTree> + <ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Sort Order Defined" enabled="true"> + <stringProp name="ForeachController.inputVal">grid_sort_order</stringProp> + <stringProp name="ForeachController.returnVal">grid_sort_order</stringProp> + <boolProp name="ForeachController.useSeparator">true</boolProp> + <stringProp name="ForeachController.startIndex">0</stringProp> + <stringProp name="ForeachController.endIndex">2</stringProp> + </ForeachController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="View ${gridEntityType} page - Filtering + Sort By ${grid_sort_field} ${grid_sort_order}" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_namespace}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[${grid_filter_field}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_admin_browse_filter_text}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[${grid_filter_field}]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_entity_page_size}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${page_number}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_field}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${grid_sort_order}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">\"totalRecords\":[^0]\d*</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Create Order" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminCreateOrderPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Create Order"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Get region data" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script"> + vars.put("alabama_region_id", props.get("alabama_region_id")); + vars.put("california_region_id", props.get("california_region_id")); +</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/get_region_data.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Create Order" enabled="true"/> + <hashTree> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_order/admin_create_order.jmx</stringProp> + <stringProp name="BeanShellSampler.query">import org.apache.jmeter.samplers.SampleResult; +import java.util.Random; +Random random = new Random(); +if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom}); +} +number = random.nextInt(props.get("simple_products_list").size()); +simpleList = props.get("simple_products_list").get(number); +vars.put("simple_product_1_url_key", simpleList.get("url_key")); +vars.put("simple_product_1_name", simpleList.get("title")); +vars.put("simple_product_1_id", simpleList.get("id")); + +do { + number1 = random.nextInt(props.get("simple_products_list").size()); +} while(number == number1); +simpleList = props.get("simple_products_list").get(number1); +vars.put("simple_product_2_url_key", simpleList.get("url_key")); +vars.put("simple_product_2_name", simpleList.get("title")); +vars.put("simple_product_2_id", simpleList.get("id")); + +number = random.nextInt(props.get("configurable_products_list").size()); +configurableList = props.get("configurable_products_list").get(number); +vars.put("configurable_product_1_url_key", configurableList.get("url_key")); +vars.put("configurable_product_1_name", configurableList.get("title")); +vars.put("configurable_product_1_id", configurableList.get("id")); +vars.put("configurable_product_1_sku", configurableList.get("sku")); +vars.put("configurable_attribute_id", configurableList.get("attribute_id")); +vars.put("configurable_option_id", configurableList.get("attribute_option_id")); + + +customers_index = 0; +if (!props.containsKey("customer_ids_index")) { + props.put("customer_ids_index", customers_index); +} + +try { + customers_index = props.get("customer_ids_index"); + customers_list = props.get("customer_ids_list"); + + if (customers_index == customers_list.size()) { + customers_index=0; + } + vars.put("customer_id", customers_list.get(customers_index)); + props.put("customer_ids_index", ++customers_index); +} +catch (java.lang.Exception e) { + log.error("Caught Exception in 'Admin Create Order' thread."); + SampleResult.setStopThread(true); +}</stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Start Order" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/start/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="SetUp - Get Configurable Product Options" enabled="true"/> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">*/*</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Admin Token Retrieval" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"username":"${admin_user}","password":"${admin_password}"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/integration/admin/token</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="jp@gc - JSON Path Extractor" enabled="true"> + <stringProp name="VAR">admin_token</stringProp> + <stringProp name="JSONPATH">$</stringProp> + <stringProp name="DEFAULT"/> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert token not null" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="484395188">^[a-z0-9-]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_token</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Bearer ${admin_token}</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Get Configurable Product Options" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}rest/V1/configurable-products/${configurable_product_1_sku}/options/all</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract attribute_ids" enabled="true"> + <stringProp name="VAR">attribute_ids</stringProp> + <stringProp name="JSONPATH">$.[*].attribute_id</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor: Extract option_values" enabled="true"> + <stringProp name="VAR">option_values</stringProp> + <stringProp name="JSONPATH">$.[*].values[0].value_index</stringProp> + <stringProp name="DEFAULT">NO_VALUE</stringProp> + <stringProp name="VARIABLE"/> + <stringProp name="SUBJECT">BODY</stringProp> + </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> + <hashTree/> + </hashTree> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Add Products" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="item[${simple_product_1_id}][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">item[${simple_product_1_id}][qty]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="item[${simple_product_2_id}][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">item[${simple_product_2_id}][qty]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="item[${configurable_product_1_id}][qty]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">item[${configurable_product_1_id}][qty]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="customer_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">customer_id</stringProp> + <stringProp name="Argument.value">${customer_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="store_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">store_id</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="currency_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">currency_id</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="payment[method]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">payment[method]</stringProp> + <stringProp name="Argument.value">checkmo</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="reset_shipping" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">reset_shipping</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="json" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">json</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="as_js_varname" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">as_js_varname</stringProp> + <stringProp name="Argument.value">iFrameResponse</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/loadBlock/block/search,items,shipping_method,totals,giftmessage,billing_method?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="Configure product options" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script">try { + attribute_ids = vars.get("attribute_ids"); + option_values = vars.get("option_values"); + attribute_ids = attribute_ids.replace("[","").replace("]","").replace("\"", ""); + option_values = option_values.replace("[","").replace("]","").replace("\"", ""); + attribute_ids_array = attribute_ids.split(","); + option_values_array = option_values.split(","); + args = ctx.getCurrentSampler().getArguments(); + it = args.iterator(); + while (it.hasNext()) { + argument = it.next(); + if (argument.getStringValue().contains("${")) { + args.removeArgument(argument.getName()); + } + } + for (int i = 0; i < attribute_ids_array.length; i++) { + + ctx.getCurrentSampler().addArgument("item[" + vars.get("configurable_product_1_id") + "][super_attribute][" + attribute_ids_array[i] + "]", option_values_array[i]); + } +} catch (Exception e) { + log.error("error???", e); +}</stringProp> + </BeanShellPreProcessor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Collect Shipping Rates" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="collect_shipping_rates" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">collect_shipping_rates</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="customer_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">customer_id</stringProp> + <stringProp name="Argument.value">${customer_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="store_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">store_id</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="currency_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">currency_id</stringProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="payment[method]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">payment[method]</stringProp> + <stringProp name="Argument.value">checkmo</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="json" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">json</stringProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/loadBlock/block/shipping_method,totals?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Shipping Method" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1987784558">shipping_method</stringProp> + <stringProp name="818779431">Flat Rate</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Filled Order Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/index/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Filled Order Page" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-37823069">Select from existing customer addresses</stringProp> + <stringProp name="-13185722">Submit Order</stringProp> + <stringProp name="-209419315">Items Ordered</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save Order" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="limit" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">limit</stringProp> + <stringProp name="Argument.value">20</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="entity_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">entity_id</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">name</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="email" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">email</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="Telephone" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">Telephone</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="billing_postcode" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">billing_postcode</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="billing_country_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">billing_country_id</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="billing_regione" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">billing_regione</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="store_name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">store_name</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="page" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">page</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[currency]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[currency]</stringProp> + <stringProp name="Argument.value">USD</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="sku" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">sku</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">qty</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="limit" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">limit</stringProp> + <stringProp name="Argument.value">20</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="entity_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">entity_id</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">name</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="sku" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">sku</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="price[from]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">price[from]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="price[to]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">price[to]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="in_products" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">in_products</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="page" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">page</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="coupon_code" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">coupon_code</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[account][group_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[account][group_id]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[account][email]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[account][email]</stringProp> + <stringProp name="Argument.value">user_${customer_id}@example.com</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][customer_address_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][customer_address_id]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][prefix]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][firstname]</stringProp> + <stringProp name="Argument.value">Anthony</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][middlename]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][lastname]</stringProp> + <stringProp name="Argument.value">Nealy</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][suffix]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][company]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][company]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][street][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][street][0]</stringProp> + <stringProp name="Argument.value">123 Freedom Blvd. #123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][street][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][street][1]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][city]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][city]</stringProp> + <stringProp name="Argument.value">Fayetteville</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][country_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][country_id]</stringProp> + <stringProp name="Argument.value">US</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][region]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][region]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][region_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][region_id]</stringProp> + <stringProp name="Argument.value">${alabama_region_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][postcode]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][postcode]</stringProp> + <stringProp name="Argument.value">123123</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][telephone]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][telephone]</stringProp> + <stringProp name="Argument.value">022-333-4455</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][fax]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][fax]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[billing_address][vat_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[billing_address][vat_id]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="shipping_same_as_billing" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">shipping_same_as_billing</stringProp> + <stringProp name="Argument.value">on</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="payment[method]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">payment[method]</stringProp> + <stringProp name="Argument.value">checkmo</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[shipping_method]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[shipping_method]</stringProp> + <stringProp name="Argument.value">flatrate_flatrate</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[comment][customer_note]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[comment][customer_note]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[comment][customer_note_notify]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[comment][customer_note_notify]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="order[send_confirmation]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">order[send_confirmation]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/save/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Order Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_id</stringProp> + <stringProp name="RegexExtractor.regex">${host}${base_path}${admin_path}/sales/order/index/order_id/(\d+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Order Item 1" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_item_1</stringProp> + <stringProp name="RegexExtractor.regex">order_item_(\d+)_title</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Order Item 2" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_item_2</stringProp> + <stringProp name="RegexExtractor.regex">order_item_(\d+)_title</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">2</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract Order Item 3" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_item_3</stringProp> + <stringProp name="RegexExtractor.regex">order_item_(\d+)_title</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">3</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Order Id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">order_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Order Item 1" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">order_item_1</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Order Item 2" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">order_item_2</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Order Item 3" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">order_item_3</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Order Created" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="563107624">You created the order.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save Invoice" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="invoice[items][${order_item_1}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">invoice[items][${order_item_1}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="invoice[items][${order_item_2}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">invoice[items][${order_item_2}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="invoice[items][${order_item_3}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">invoice[items][${order_item_3}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="invoice[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">invoice[comment_text]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_invoice/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Invoice Created" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1878312078">The invoice has been created.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save Shipment" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="shipment[items][${order_item_1}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">shipment[items][${order_item_1}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="shipment[items][${order_item_2}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">shipment[items][${order_item_2}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="shipment[items][${order_item_3}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">shipment[items][${order_item_3}]</stringProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + <elementProp name="shipment[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.name">shipment[comment_text]</stringProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/order_shipment/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Shipment Created" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-348539683">The shipment has been created.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Category Management" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminCategoryManagementPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Category Management"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Category Management" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_category_management/admin_category_management.jmx</stringProp> +</TestFragmentController> + <hashTree> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SetUp - Set Arguments" enabled="true"> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="cacheKey"/> + <stringProp name="script">random = new java.util.Random(); +if (${seedForRandom} > 0) { +random.setSeed(${seedForRandom} + ${__threadNum}); +} + +/** + * Get unique ids for fix concurrent category saving + */ +function getNextProductNumber(i) { + number = productsVariationsSize * ${__threadNum} - i; + if (number >= productsSize) { + log.info("${testLabel}: capacity of product list is not enough for support all ${adminPoolUsers} threads"); + return random.nextInt(productsSize); + } + return productsVariationsSize * ${__threadNum} - i; +} + +var productsVariationsSize = 5, + productsSize = props.get("simple_products_list_for_edit").size(); + + +for (i = 1; i<= productsVariationsSize; i++) { + var productVariablePrefix = "simple_product_" + i + "_"; + number = getNextProductNumber(i); + simpleList = props.get("simple_products_list_for_edit").get(number); + + vars.put(productVariablePrefix + "url_key", simpleList.get("url_key")); + vars.put(productVariablePrefix + "id", simpleList.get("id")); + vars.put(productVariablePrefix + "name", simpleList.get("title")); +} + +categoryIndex = random.nextInt(props.get("admin_category_ids_list").size()); +vars.put("parent_category_id", props.get("admin_category_ids_list").get(categoryIndex)); +do { +categoryIndexNew = random.nextInt(props.get("admin_category_ids_list").size()); +} while(categoryIndex == categoryIndexNew); +vars.put("new_parent_category_id", props.get("admin_category_ids_list").get(categoryIndexNew));</stringProp> + </JSR223Sampler> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Landing Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="Accept-Language" elementType="Header"> + <stringProp name="Header.name">Accept-Language</stringProp> + <stringProp name="Header.value">en-US,en;q=0.5</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp> + </elementProp> + <elementProp name="User-Agent" elementType="Header"> + <stringProp name="Header.name">User-Agent</stringProp> + <stringProp name="Header.value">Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0</stringProp> + </elementProp> + <elementProp name="Accept-Encoding" elementType="Header"> + <stringProp name="Header.name">Accept-Encoding</stringProp> + <stringProp name="Header.value">gzip, deflate</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Select parent category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/edit/id/${parent_category_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="Accept-Language" elementType="Header"> + <stringProp name="Header.name">Accept-Language</stringProp> + <stringProp name="Header.value">en-US,en;q=0.5</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp> + </elementProp> + <elementProp name="User-Agent" elementType="Header"> + <stringProp name="Header.name">User-Agent</stringProp> + <stringProp name="Header.value">Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0</stringProp> + </elementProp> + <elementProp name="Accept-Encoding" elementType="Header"> + <stringProp name="Header.name">Accept-Encoding</stringProp> + <stringProp name="Header.value">gzip, deflate</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open new category page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/add/store/0/parent/${parent_category_id}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1903925024"><title>New Category</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">id</stringProp> + </elementProp> + <elementProp name="parent" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${parent_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">parent</stringProp> + </elementProp> + <elementProp name="path" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">path</stringProp> + </elementProp> + <elementProp name="store_id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">store_id</stringProp> + </elementProp> + <elementProp name="is_active" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_active</stringProp> + </elementProp> + <elementProp name="include_in_menu" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">include_in_menu</stringProp> + </elementProp> + <elementProp name="is_anchor" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_anchor</stringProp> + </elementProp> + <elementProp name="use_config[available_sort_by]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">use_config[available_sort_by]</stringProp> + </elementProp> + <elementProp name="use_config[default_sort_by]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">use_config[default_sort_by]</stringProp> + </elementProp> + <elementProp name="use_config[filter_price_range]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">use_config[filter_price_range]</stringProp> + </elementProp> + <elementProp name="use_default[url_key]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">use_default[url_key]</stringProp> + </elementProp> + <elementProp name="url_key_create_redirect" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">url_key_create_redirect</stringProp> + </elementProp> + <elementProp name="custom_use_parent_settings" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">custom_use_parent_settings</stringProp> + </elementProp> + <elementProp name="custom_apply_to_products" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">custom_apply_to_products</stringProp> + </elementProp> + <elementProp name="name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Admin Category Management ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">name</stringProp> + </elementProp> + <elementProp name="url_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">admin-category-management-${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">url_key</stringProp> + </elementProp> + <elementProp name="meta_title" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_title</stringProp> + </elementProp> + <elementProp name="description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">description</stringProp> + </elementProp> + <elementProp name="display_mode" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">PRODUCTS</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">display_mode</stringProp> + </elementProp> + <elementProp name="default_sort_by" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">position</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">default_sort_by</stringProp> + </elementProp> + <elementProp name="meta_keywords" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_keywords</stringProp> + </elementProp> + <elementProp name="meta_description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">meta_description</stringProp> + </elementProp> + <elementProp name="custom_layout_update" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">custom_layout_update</stringProp> + </elementProp> + <elementProp name="category_products" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"${simple_product_1_id}":"","${simple_product_2_id}":"","${simple_product_3_id}":"","${simple_product_4_id}":"","${simple_product_5_id}":""}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">category_products</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/save/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">URL</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_id</stringProp> + <stringProp name="RegexExtractor.regex">/catalog/category/edit/id/(\d+)/</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_id</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Select created category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/edit/id/${admin_category_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="Accept-Language" elementType="Header"> + <stringProp name="Header.name">Accept-Language</stringProp> + <stringProp name="Header.value">en-US,en;q=0.5</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp> + </elementProp> + <elementProp name="User-Agent" elementType="Header"> + <stringProp name="Header.name">User-Agent</stringProp> + <stringProp name="Header.value">Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0</stringProp> + </elementProp> + <elementProp name="Accept-Encoding" elementType="Header"> + <stringProp name="Header.name">Accept-Encoding</stringProp> + <stringProp name="Header.value">gzip, deflate</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category row id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_entity_id</stringProp> + <stringProp name="RegexExtractor.regex">"entity_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category attribute set id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_attribute_set_id</stringProp> + <stringProp name="RegexExtractor.regex">"attribute_set_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category parent Id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_parent_id</stringProp> + <stringProp name="RegexExtractor.regex">"parent_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category created at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_created_at</stringProp> + <stringProp name="RegexExtractor.regex">"created_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category updated at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_updated_at</stringProp> + <stringProp name="RegexExtractor.regex">"updated_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category path" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_path</stringProp> + <stringProp name="RegexExtractor.regex">"entity_id":(.+)"path":"([^\"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category level" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_level</stringProp> + <stringProp name="RegexExtractor.regex">"level":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category name" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_name</stringProp> + <stringProp name="RegexExtractor.regex">"entity_id":(.+)"name":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$2$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category url key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_url_key</stringProp> + <stringProp name="RegexExtractor.regex">"url_key":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract category url path" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_category_url_path</stringProp> + <stringProp name="RegexExtractor.regex">"url_path":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category row id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_entity_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category attribute set id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_attribute_set_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category parent id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_parent_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category created at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_created_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category updated at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_updated_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category path" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="59022110">^[\d\\\/]+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_path</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category level" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_level</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category name" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_name</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category url key" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_url_key</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category url path" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_category_url_path</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert products added" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="417284990">${simple_product_1_name}</stringProp> + <stringProp name="1304788671">${simple_product_2_name}</stringProp> + <stringProp name="-2102674944">${simple_product_3_name}</stringProp> + <stringProp name="-1215171263">${simple_product_4_name}</stringProp> + <stringProp name="-327667582">${simple_product_5_name}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Move category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">id</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="point" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">append</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">point</stringProp> + </elementProp> + <elementProp name="pid" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${new_parent_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">pid</stringProp> + </elementProp> + <elementProp name="paid" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${parent_category_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paid</stringProp> + </elementProp> + <elementProp name="aid" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">aid</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/move/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete category" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/catalog/category/delete/id/${admin_category_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert category deleted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1277069529">You deleted the category.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${adminCategoryManagementDelay}*1000))}</stringProp> + </TestAction> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Promotion Rules" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminPromotionRulesPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Promotion Rules"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Promotions Management" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_promotions_management/admin_promotions_management.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Landing Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales_rule/promo_quote/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create New" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales_rule/promo_quote/new</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create New Conditional" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="id" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1--1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">id</stringProp> + </elementProp> + <elementProp name="type" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Magento\SalesRule\Model\Rule\Condition\Address|base_subtotal</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">type</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales_rule/promo_quote/newConditionHtml/form/sales_rule_formrule_conditions_fieldset_/form_namespace/sales_rule_form</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="name" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Rule Name ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">name</stringProp> + </elementProp> + <elementProp name="is_active" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_active</stringProp> + </elementProp> + <elementProp name="use_auto_generation" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">use_auto_generation</stringProp> + </elementProp> + <elementProp name="is_rss" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">is_rss</stringProp> + </elementProp> + <elementProp name="apply_to_shipping" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">apply_to_shipping</stringProp> + </elementProp> + <elementProp name="stop_rules_processing" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">stop_rules_processing</stringProp> + </elementProp> + <elementProp name="coupon_code" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">coupon_code</stringProp> + </elementProp> + <elementProp name="uses_per_coupon" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">uses_per_coupon</stringProp> + </elementProp> + <elementProp name="uses_per_customer" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">uses_per_customer</stringProp> + </elementProp> + <elementProp name="sort_order" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sort_order</stringProp> + </elementProp> + <elementProp name="discount_amount" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">5</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">discount_amount</stringProp> + </elementProp> + <elementProp name="discount_qty" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">discount_qty</stringProp> + </elementProp> + <elementProp name="discount_step" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">discount_step</stringProp> + </elementProp> + <elementProp name="reward_points_delta" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">reward_points_delta</stringProp> + </elementProp> + <elementProp name="store_labels[0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">store_labels[0]</stringProp> + </elementProp> + <elementProp name="description" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Rule Description ${__time(YMDHMS)}-${__threadNum}-${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">description</stringProp> + </elementProp> + <elementProp name="coupon_type" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">coupon_type</stringProp> + </elementProp> + <elementProp name="simple_action" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">cart_fixed</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">simple_action</stringProp> + </elementProp> + <elementProp name="website_ids[0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">website_ids[0]</stringProp> + </elementProp> + <elementProp name="customer_group_ids[0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer_group_ids[0]</stringProp> + </elementProp> + <elementProp name="from_date" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">from_date</stringProp> + </elementProp> + <elementProp name="to_date" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">to_date</stringProp> + </elementProp> + <elementProp name="rule[conditions][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Magento\SalesRule\Model\Rule\Condition\Combine</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1][type]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1][aggregator]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">all</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1][aggregator]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1][value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1][value]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1--1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Magento\SalesRule\Model\Rule\Condition\Address</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1--1][type]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1--1][attribute]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">base_subtotal</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1--1][attribute]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1--1][operator]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">>=</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1--1][operator]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1--1][value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">100</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1--1][value]</stringProp> + </elementProp> + <elementProp name="rule[conditions][1][new_chlid]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[conditions][1][new_chlid]</stringProp> + </elementProp> + <elementProp name="rule[actions][1][type]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Magento\SalesRule\Model\Rule\Condition\Product\Combine</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[actions][1][type]</stringProp> + </elementProp> + <elementProp name="rule[actions][1][aggregator]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">all</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[actions][1][aggregator]</stringProp> + </elementProp> + <elementProp name="rule[actions][1][value]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[actions][1][value]</stringProp> + </elementProp> + <elementProp name="rule[actions][1][new_child]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">rule[actions][1][new_child]</stringProp> + </elementProp> + <elementProp name="store_labels[1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">store_labels[1]</stringProp> + </elementProp> + <elementProp name="store_labels[2]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">store_labels[2]</stringProp> + </elementProp> + <elementProp name="related_banners" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">related_banners</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales_rule/promo_quote/save/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-396438583">You saved the rule.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${adminPromotionsManagementDelay}*1000))}</stringProp> + </TestAction> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Customer Management" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminCustomerManagementPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Customer Management"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <TestFragmentController guiclass="TestFragmentControllerGui" testclass="TestFragmentController" testname="Admin Customer Management" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_customer_management/admin_customer_management.jmx</stringProp> +</TestFragmentController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Landing Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/customer/index</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="Accept-Language" elementType="Header"> + <stringProp name="Header.name">Accept-Language</stringProp> + <stringProp name="Header.value">en-US,en;q=0.5</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp> + </elementProp> + <elementProp name="User-Agent" elementType="Header"> + <stringProp name="Header.name">User-Agent</stringProp> + <stringProp name="Header.value">Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0</stringProp> + </elementProp> + <elementProp name="Accept-Encoding" elementType="Header"> + <stringProp name="Header.name">Accept-Encoding</stringProp> + <stringProp name="Header.value">gzip, deflate</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Render" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">customer_listing</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">20</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search Render" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">customer_listing</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Lastname</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">20</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">entity_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">X-Requested-With</stringProp> + <stringProp name="Header.value">XMLHttpRequest</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract customer edit url" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">customer_edit_url_path</stringProp> + <stringProp name="RegexExtractor.regex">actions":\{"edit":\{"href":"(?:http|https):\\/\\/(.*?)\\/customer\\/index\\/edit\\/id\\/(\d+)\\/",</stringProp> + <stringProp name="RegexExtractor.template">/customer/index/edit/id/$2$/</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer edit url" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">customer_edit_url_path</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Edit Customer" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}${customer_edit_url_path}</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert edit customer page" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1422614550">Customer Information</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract customer entity_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_entity_id</stringProp> + <stringProp name="RegexExtractor.regex">"entity_id":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract website_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_website_id</stringProp> + <stringProp name="RegexExtractor.regex">"website_id":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract customer firstname" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_firstname</stringProp> + <stringProp name="RegexExtractor.regex">"firstname":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract customer lastname" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_lastname</stringProp> + <stringProp name="RegexExtractor.regex">"lastname":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract customer email" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_email</stringProp> + <stringProp name="RegexExtractor.regex">"email":"([^\@]+@[^.]+.[^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract group_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_group_id</stringProp> + <stringProp name="RegexExtractor.regex">"group_id":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract store_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_store_id</stringProp> + <stringProp name="RegexExtractor.regex">"store_id":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extact created_at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_created_at</stringProp> + <stringProp name="RegexExtractor.regex">"created_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract updated_at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_updated_at</stringProp> + <stringProp name="RegexExtractor.regex">"updated_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract is_active" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_is_active</stringProp> + <stringProp name="RegexExtractor.regex">"is_active":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract disable_auto_group_change" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_disable_auto_group_change</stringProp> + <stringProp name="RegexExtractor.regex">"disable_auto_group_change":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract created_in" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_created_in</stringProp> + <stringProp name="RegexExtractor.regex">"created_in":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract dob" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_dob</stringProp> + <stringProp name="RegexExtractor.regex">"dob":"(\d+)-(\d+)-(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$2$/$3$/$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract default_billing" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_default_billing</stringProp> + <stringProp name="RegexExtractor.regex">"default_billing":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract default_shipping" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_default_shipping</stringProp> + <stringProp name="RegexExtractor.regex">"default_shipping":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract gender" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_gender</stringProp> + <stringProp name="RegexExtractor.regex">"gender":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract failures_num" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_failures_num</stringProp> + <stringProp name="RegexExtractor.regex">"failures_num":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_entity_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_entity_id</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{"entity_id":"(\d+)".+?"parent_id":"${admin_customer_entity_id}"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_created_at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_created_at</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"created_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_updated_at" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_updated_at</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"updated_at":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_is_active" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_is_active</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"is_active":"(\d+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_city" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_city</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"city":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_country_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_country_id</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"country_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_firstname" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_firstname</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"firstname":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_lastname" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_lastname</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"lastname":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_postcode" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_postcode</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"postcode":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_region" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_region</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"region":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_region_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_region_id</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"region_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address street" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_street</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"street":\["([^"]+)"\]</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_telephone" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_telephone</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"telephone":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract address_customer_id" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_customer_address_customer_id</stringProp> + <stringProp name="RegexExtractor.regex">_address":\{.+?"parent_id":"${admin_customer_entity_id}".+?"customer_id":"([^"]+)"</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer entity_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_entity_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert website_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_website_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer firstname" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_firstname</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer lastname" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_lastname</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer email" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_email</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer group_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_group_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer store_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_store_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer created_at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_created_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer updated_at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_updated_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer is_active" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_is_active</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer disable_auto_group_change" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_disable_auto_group_change</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer created_in" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_created_in</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer dob" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="221072919">^\d+/\d+/\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_dob</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer default_billing" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_default_billing</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer default_shipping" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_default_shipping</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer gender" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_gender</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer failures_num" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_failures_num</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_entity_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_entity_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_created_at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_created_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_updated_at" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_updated_at</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_is_active" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_is_active</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_city" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_city</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_country_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_country_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_firstname" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_firstname</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_lastname" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_lastname</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_postcode" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_postcode</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_region" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_region</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_region_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_region_id</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_street" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_street</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_telephone" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_telephone</stringProp> + </ResponseAssertion> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert address_customer_id" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="89649215">^\d+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_customer_address_customer_id</stringProp> + </ResponseAssertion> + <hashTree/> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="Accept-Language" elementType="Header"> + <stringProp name="Header.name">Accept-Language</stringProp> + <stringProp name="Header.value">en-US,en;q=0.5</stringProp> + </elementProp> + <elementProp name="Accept" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</stringProp> + </elementProp> + <elementProp name="User-Agent" elementType="Header"> + <stringProp name="Header.name">User-Agent</stringProp> + <stringProp name="Header.value">Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0</stringProp> + </elementProp> + <elementProp name="Accept-Encoding" elementType="Header"> + <stringProp name="Header.name">Accept-Encoding</stringProp> + <stringProp name="Header.value">gzip, deflate</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Customer Validate" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="isAjax " elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax </stringProp> + </elementProp> + <elementProp name="customer[entity_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_entity_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[entity_id]</stringProp> + </elementProp> + <elementProp name="customer[website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_website_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[website_id]</stringProp> + </elementProp> + <elementProp name="customer[email]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[email]</stringProp> + </elementProp> + <elementProp name="customer[group_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_group_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[group_id]</stringProp> + </elementProp> + <elementProp name="customer[store_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_store_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[store_id]</stringProp> + </elementProp> + <elementProp name="customer[created_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_created_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[created_at]</stringProp> + </elementProp> + <elementProp name="customer[updated_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_updated_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[updated_at]</stringProp> + </elementProp> + <elementProp name="customer[is_active]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_is_active}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[is_active]</stringProp> + </elementProp> + <elementProp name="customer[disable_auto_group_change]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_disable_auto_group_change}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[disable_auto_group_change]</stringProp> + </elementProp> + <elementProp name="customer[created_in]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_created_in}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[created_in]</stringProp> + </elementProp> + <elementProp name="customer[prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[prefix]</stringProp> + </elementProp> + <elementProp name="customer[firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_firstname} 1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[firstname]</stringProp> + </elementProp> + <elementProp name="customer[middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[middlename]</stringProp> + </elementProp> + <elementProp name="customer[lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_lastname} 1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[lastname]</stringProp> + </elementProp> + <elementProp name="customer[suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[suffix]</stringProp> + </elementProp> + <elementProp name="customer[dob]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_dob}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[dob]</stringProp> + </elementProp> + <elementProp name="customer[default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_default_billing}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[default_billing]</stringProp> + </elementProp> + <elementProp name="customer[default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_default_shipping}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[default_shipping]</stringProp> + </elementProp> + <elementProp name="customer[taxvat]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[taxvat]</stringProp> + </elementProp> + <elementProp name="customer[gender]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_gender}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[gender]</stringProp> + </elementProp> + <elementProp name="customer[failures_num]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_failures_num}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[failures_num]</stringProp> + </elementProp> + <elementProp name="customer[sendemail_store_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_store_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[sendemail_store_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][entity_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_entity_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][entity_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][created_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_created_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][created_at]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][updated_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_updated_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][updated_at]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][is_active]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_is_active}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][is_active]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][city]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_city}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][city]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][company]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][company]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][country_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_country_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][country_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_firstname}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][firstname]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_lastname}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][lastname]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][middlename]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][postcode]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_postcode}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][postcode]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][prefix]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][region]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_region}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][region]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][region_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_region_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][region_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][street][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_street}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][street][0]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][street][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][street][1]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][suffix]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][telephone]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_telephone}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][telephone]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][vat_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][vat_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][customer_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_customer_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][customer_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][default_billing]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][default_shipping]</stringProp> + </elementProp> + <elementProp name="address[new_0][prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][prefix]</stringProp> + </elementProp> + <elementProp name="address[new_0][firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">John</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][firstname]</stringProp> + </elementProp> + <elementProp name="address[new_0][middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][middlename]</stringProp> + </elementProp> + <elementProp name="address[new_0][lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Doe</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][lastname]</stringProp> + </elementProp> + <elementProp name="address[new_0][suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][suffix]</stringProp> + </elementProp> + <elementProp name="address[new_0][company]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Test Company</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][company]</stringProp> + </elementProp> + <elementProp name="address[new_0][city]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Folsom</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][city]</stringProp> + </elementProp> + <elementProp name="address[new_0][postcode]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">95630</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][postcode]</stringProp> + </elementProp> + <elementProp name="address[new_0][telephone]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1234567890</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][telephone]</stringProp> + </elementProp> + <elementProp name="address[new_0][vat_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][vat_id]</stringProp> + </elementProp> + <elementProp name="address[new_0][default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][default_billing]</stringProp> + </elementProp> + <elementProp name="address[new_0][default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][default_shipping]</stringProp> + </elementProp> + <elementProp name="address[new_0][street][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123 Main</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][street][0]</stringProp> + </elementProp> + <elementProp name="address[new_0][street][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][street][1]</stringProp> + </elementProp> + <elementProp name="address[new_0][region]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][region]</stringProp> + </elementProp> + <elementProp name="address[new_0][country_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">US</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][country_id]</stringProp> + </elementProp> + <elementProp name="address[new_0][region_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_region_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][region_id]</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/customer/index/validate/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="49586">200</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">16</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Customer Save" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="isAjax " elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax </stringProp> + </elementProp> + <elementProp name="customer[entity_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_entity_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[entity_id]</stringProp> + </elementProp> + <elementProp name="customer[website_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_website_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[website_id]</stringProp> + </elementProp> + <elementProp name="customer[email]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_email}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[email]</stringProp> + </elementProp> + <elementProp name="customer[group_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_group_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[group_id]</stringProp> + </elementProp> + <elementProp name="customer[store_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_store_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[store_id]</stringProp> + </elementProp> + <elementProp name="customer[created_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_created_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[created_at]</stringProp> + </elementProp> + <elementProp name="customer[updated_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_updated_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[updated_at]</stringProp> + </elementProp> + <elementProp name="customer[is_active]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_is_active}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[is_active]</stringProp> + </elementProp> + <elementProp name="customer[disable_auto_group_change]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_disable_auto_group_change}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[disable_auto_group_change]</stringProp> + </elementProp> + <elementProp name="customer[created_in]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_created_in}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[created_in]</stringProp> + </elementProp> + <elementProp name="customer[prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[prefix]</stringProp> + </elementProp> + <elementProp name="customer[firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_firstname} 1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[firstname]</stringProp> + </elementProp> + <elementProp name="customer[middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[middlename]</stringProp> + </elementProp> + <elementProp name="customer[lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_lastname} 1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[lastname]</stringProp> + </elementProp> + <elementProp name="customer[suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[suffix]</stringProp> + </elementProp> + <elementProp name="customer[dob]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_dob}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[dob]</stringProp> + </elementProp> + <elementProp name="customer[default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_default_billing}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[default_billing]</stringProp> + </elementProp> + <elementProp name="customer[default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_default_shipping}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[default_shipping]</stringProp> + </elementProp> + <elementProp name="customer[taxvat]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[taxvat]</stringProp> + </elementProp> + <elementProp name="customer[gender]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_gender}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[gender]</stringProp> + </elementProp> + <elementProp name="customer[failures_num]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_failures_num}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[failures_num]</stringProp> + </elementProp> + <elementProp name="customer[sendemail_store_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_store_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">customer[sendemail_store_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][entity_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_entity_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][entity_id]</stringProp> + </elementProp> + + <elementProp name="address[${admin_customer_address_entity_id}][created_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_created_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][created_at]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][updated_at]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_updated_at}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][updated_at]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][is_active]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_is_active}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][is_active]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][city]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_city}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][city]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][company]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][company]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][country_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_country_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][country_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_firstname}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][firstname]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_lastname}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][lastname]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][middlename]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][postcode]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_postcode}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][postcode]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][prefix]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][region]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_region}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][region]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][region_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_region_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][region_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][street][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_street}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][street][0]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][street][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][street][1]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][suffix]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][telephone]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_telephone}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][telephone]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][vat_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][vat_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][customer_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_customer_address_customer_id}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][customer_id]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][default_billing]</stringProp> + </elementProp> + <elementProp name="address[${admin_customer_address_entity_id}][default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[${admin_customer_address_entity_id}][default_shipping]</stringProp> + </elementProp> + <elementProp name="address[new_0][prefix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][prefix]</stringProp> + </elementProp> + <elementProp name="address[new_0][firstname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">John</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][firstname]</stringProp> + </elementProp> + <elementProp name="address[new_0][middlename]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][middlename]</stringProp> + </elementProp> + <elementProp name="address[new_0][lastname]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Doe</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][lastname]</stringProp> + </elementProp> + <elementProp name="address[new_0][suffix]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][suffix]</stringProp> + </elementProp> + <elementProp name="address[new_0][company]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Test Company</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][company]</stringProp> + </elementProp> + <elementProp name="address[new_0][city]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Folsom</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][city]</stringProp> + </elementProp> + <elementProp name="address[new_0][postcode]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">95630</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][postcode]</stringProp> + </elementProp> + <elementProp name="address[new_0][telephone]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1234567890</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][telephone]</stringProp> + </elementProp> + <elementProp name="address[new_0][vat_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][vat_id]</stringProp> + </elementProp> + <elementProp name="address[new_0][default_billing]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][default_billing]</stringProp> + </elementProp> + <elementProp name="address[new_0][default_shipping]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">false</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][default_shipping]</stringProp> + </elementProp> + <elementProp name="address[new_0][street][0]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">123 Main</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][street][0]</stringProp> + </elementProp> + <elementProp name="address[new_0][street][1]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][street][1]</stringProp> + </elementProp> + <elementProp name="address[new_0][region]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][region]</stringProp> + </elementProp> + <elementProp name="address[new_0][country_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">US</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][country_id]</stringProp> + </elementProp> + <elementProp name="address[new_0][region_id]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">12</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">address[new_0][region_id]</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/customer/index/save/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert customer saved" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="292987815">You saved the customer.</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Pause" enabled="true"> + <intProp name="ActionProcessor.action">1</intProp> + <intProp name="ActionProcessor.target">0</intProp> + <stringProp name="ActionProcessor.duration">${__javaScript(Math.round(${adminCustomerManagementDelay}*1000))}</stringProp> + </TestAction> + <hashTree/> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + + + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Edit Order" enabled="true"> + <intProp name="ThroughputController.style">1</intProp> + <boolProp name="ThroughputController.perThread">false</boolProp> + <intProp name="ThroughputController.maxThroughput">1</intProp> + <stringProp name="ThroughputController.percentThroughput">${cloudAdminEditOrderPercentage}</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> + <hashTree> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> + <stringProp name="script"> +var testLabel = "${testLabel}" ? " (${testLabel})" : ""; +if (testLabel + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' +) { + if (sampler.getName().indexOf(testLabel) == -1) { + sampler.setName(sampler.getName() + testLabel); + } +} else if (sampler.getName().indexOf("SetUp - ") == -1) { + sampler.setName("SetUp - " + sampler.getName()); +} + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/setup_label.jmx</stringProp></JSR223PreProcessor> + <hashTree/> + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> + <stringProp name="BeanShellSampler.query"> + vars.put("testLabel", "Cloud Admin Edit Order"); + </stringProp> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Get admin form key PostProcessor" enabled="true"> + <stringProp name="script"> + function getFormKeyFromResponse() + { + var url = prev.getUrlAsString(), + responseCode = prev.getResponseCode(), + formKey = null; + searchPattern = /var FORM_KEY = '(.+)'/; + if (responseCode == "200" && url) { + response = prev.getResponseDataAsString(); + formKey = response && response.match(searchPattern) ? response.match(searchPattern)[1] : null; + } + return formKey; + } + + formKey = vars.get("form_key_storage"); + + currentFormKey = getFormKeyFromResponse(); + + if (currentFormKey != null && currentFormKey != formKey) { + vars.put("form_key_storage", currentFormKey); + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin/handle_admin_form_key.jmx</stringProp></JSR223PostProcessor> + <hashTree/> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set admin form key PreProcessor" enabled="true"> + <stringProp name="script"> + formKey = vars.get("form_key_storage"); + if (formKey + && sampler.getClass().getName() == 'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy' + && sampler.getMethod() == "POST") + { + arguments = sampler.getArguments(); + for (i=0; i<arguments.getArgumentCount(); i++) + { + argument = arguments.getArgument(i); + if (argument.getName() == 'form_key' && argument.getValue() != formKey) { + log.info("admin form key updated: " + argument.getValue() + " => " + formKey); + argument.setValue(formKey); + } + } + } + </stringProp> + <stringProp name="scriptLanguage">javascript</stringProp> + </JSR223PreProcessor> + <hashTree/> + + <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true"> + <collectionProp name="CookieManager.cookies"/> + <boolProp name="CookieManager.clearEachIteration">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/http_cookie_manager_without_clear_each_iteration.jmx</stringProp></CookieManager> + <hashTree/> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Admin Login" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <CriticalSectionController guiclass="CriticalSectionControllerGui" testclass="CriticalSectionController" testname="Admin Login Lock" enabled="true"> + <stringProp name="CriticalSectionController.lockName">get-admin-email</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/lock_controller.jmx</stringProp></CriticalSectionController> + <hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Get Admin Email" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/get_admin_email.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> +adminUserList = props.get("adminUserList"); +adminUserListIterator = props.get("adminUserListIterator"); +adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + +if (adminUsersDistribution == 1) { + adminUser = adminUserList.poll(); +} else { + if (!adminUserListIterator.hasNext()) { + adminUserListIterator = adminUserList.descendingIterator(); + } + + adminUser = adminUserListIterator.next(); +} + +if (adminUser == null) { + SampleResult.setResponseMessage("adminUser list is empty"); + SampleResult.setResponseData("adminUser list is empty","UTF-8"); + IsSuccess=false; + SampleResult.setSuccessful(false); + SampleResult.setStopThread(true); +} +vars.put("admin_user", adminUser); + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> + </BeanShellSampler> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert login form shown" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1397214398">Welcome</stringProp> + <stringProp name="-515240035"><title>Magento Admin</title></stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + </RegexExtractor> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert form_key extracted" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2845929">^.+$</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">1</intProp> + <stringProp name="Assertion.scope">variable</stringProp> + <stringProp name="Scope.variable">admin_form_key</stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SetUp - Login Submit Form" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="dummy" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">dummy</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="login[password]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_password}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[password]</stringProp> + </elementProp> + <elementProp name="login[username]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_user}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">login[username]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/dashboard/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_login_submit_form.jmx</stringProp> + </HTTPSamplerProxy> + <hashTree> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract form key" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">admin_form_key</stringProp> + <stringProp name="RegexExtractor.regex"><input name="form_key" type="hidden" value="([^'"]+)" /></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_login/admin_retrieve_form_key.jmx</stringProp></RegexExtractor> + <hashTree/> + </hashTree> + </hashTree> + + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/simple_controller.jmx</stringProp> +</GenericController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Orders page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/orders_page.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1204796042">Create New Order</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Orders" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sales_order_grid</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">increment_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">desc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="filters[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">pending</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[status]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/open_orders.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">totalRecords</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search Pending Orders" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + </elementProp> + <elementProp name="namespace" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">sales_order_grid</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">namespace</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="search" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value"/> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">search</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[placeholder]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[placeholder]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[pageSize]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">200</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[pageSize]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="paging[current]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">paging[current]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[field]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">increment_id</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[field]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="sorting[direction]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">asc</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">sorting[direction]</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="isAjax" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">true</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">isAjax</stringProp> + <stringProp name="Argument.desc">true</stringProp> + </elementProp> + <elementProp name="filters[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">pending</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">filters[status]</stringProp> + </elementProp> + <elementProp name="_" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${__time()}${__Random(1,1000000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">_</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/mui/index/render/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/search_orders.jmx</stringProp></HTTPSamplerProxy> +<hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1637639774">totalRecords</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order numbers" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_numbers</stringProp> + <stringProp name="RegexExtractor.regex">\"increment_id\":\"(\d+)\"\,</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order ids" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_ids</stringProp> + <stringProp name="RegexExtractor.regex">\"entity_id\":\"(\d+)\"\,</stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Generate Unique Ids for each Thread" enabled="true"> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/setup.jmx</stringProp> + <stringProp name="BeanShellSampler.query"> + import java.util.ArrayList; + import java.util.HashMap; + import org.apache.jmeter.protocol.http.util.Base64Encoder; + import java.util.Random; + + // get count of "order_numbers" variable defined in "Search Pending Orders Limit" + int ordersCount = Integer.parseInt(vars.get("order_numbers_matchNr")); + + + int clusterLength; + int threadsNumber = ctx.getThreadGroup().getNumThreads(); + if (threadsNumber == 0) { + //Number of orders for one thread + clusterLength = ordersCount; + } else { + clusterLength = Math.round(ordersCount / threadsNumber); + if (clusterLength == 0) { + clusterLength = 1; + } + } + + //Current thread number starts from 0 + int currentThreadNum = ctx.getThreadNum(); + + //Index of the current product from the cluster + Random random = new Random(); + if (${seedForRandom} > 0) { + random.setSeed(${seedForRandom} + ${__threadNum}); + } + int iterator = random.nextInt(clusterLength); + if (iterator == 0) { + iterator = 1; + } + + int i = clusterLength * currentThreadNum + iterator; + + orderNumber = vars.get("order_numbers_" + i.toString()); + orderId = vars.get("order_ids_" + i.toString()); + vars.put("order_number", orderNumber); + vars.put("order_id", orderId); + + </stringProp> + <stringProp name="BeanShellSampler.filename"/> + <stringProp name="BeanShellSampler.parameters"/> + <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> + </BeanShellSampler> + <hashTree/> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Open Order" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order/view/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/open_order.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="2103620713">#${order_number}</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract order status" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">order_status</stringProp> + <stringProp name="RegexExtractor.regex"><span id="order_status">([^<]+)</span></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true"> + <stringProp name="IfController.condition">"${order_status}" == "Pending"</stringProp> + <boolProp name="IfController.evaluateAll">false</boolProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_order/if_controller.jmx</stringProp></IfController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Add Comment" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="history[status]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">pending</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">history[status]</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="history[comment]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Some text</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">history[comment]</stringProp> + </elementProp> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order/addComment/order_id/${order_id}/?isAjax=true</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_order/add_comment.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-2089278331">Not Notified</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Invoice Start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_invoice/start/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/invoice_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-1233850814">Invoice Totals</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Extract ordered items ids" enabled="true"> + <stringProp name="RegexExtractor.useHeaders">false</stringProp> + <stringProp name="RegexExtractor.refname">item_ids</stringProp> + <stringProp name="RegexExtractor.regex"><div id="order_item_(\d+)_title"\s*class="product-title"></stringProp> + <stringProp name="RegexExtractor.template">$1$</stringProp> + <stringProp name="RegexExtractor.default"/> + <stringProp name="RegexExtractor.match_number">-1</stringProp> + <stringProp name="Scope.variable">simple_products</stringProp> + </RegexExtractor> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Invoice Submit" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="invoice[items][${item_ids_1}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[items][${item_ids_1}]</stringProp> + </elementProp> + <elementProp name="invoice[items][${item_ids_2}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[items][${item_ids_2}]</stringProp> + </elementProp> + <elementProp name="invoice[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Invoiced</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">invoice[comment_text]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_invoice/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_create_process_returns/invoice_submit.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="1740524604">The invoice has been created</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Shipment Start" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/order_shipment/start/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_order/shipment_start.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="304100442">New Shipment</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Shipment Submit" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="form_key" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">${admin_form_key}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">form_key</stringProp> + <stringProp name="Argument.desc">false</stringProp> + </elementProp> + <elementProp name="shipment[items][${item_ids_1}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">shipment[items][${item_ids_1}]</stringProp> + </elementProp> + <elementProp name="shipment[items][${item_ids_2}]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">shipment[items][${item_ids_2}]</stringProp> + </elementProp> + <elementProp name="shipment[comment_text]" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">true</boolProp> + <stringProp name="Argument.value">Shipped</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + <boolProp name="HTTPArgument.use_equals">true</boolProp> + <stringProp name="Argument.name">shipment[comment_text]</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/order_shipment/save/order_id/${order_id}/</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/admin_edit_order/shipment_submit.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-2089453199">The shipment has been created</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Logout" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/admin/auth/logout/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/setup/admin_logout.jmx</stringProp></HTTPSamplerProxy> + <hashTree> + + <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="Return Admin to Pool" enabled="true"> + <boolProp name="resetInterpreter">false</boolProp> + <stringProp name="parameters"/> + <stringProp name="filename"/> + <stringProp name="script"> + adminUsersDistribution = Integer.parseInt(vars.get("admin_users_distribution_per_admin_pool")); + if (adminUsersDistribution == 1) { + adminUserList = props.get("adminUserList"); + adminUserList.add(vars.get("admin_user")); + } + </stringProp> + <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/return_admin_email_to_pool.jmx</stringProp></BeanShellPostProcessor> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> From 13e63d3256ed3143180a98e606ea5f8ae4f97852 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 30 May 2019 13:47:32 -0500 Subject: [PATCH 282/464] MC-16873: Generate critical css file for LUMA - Loader: Final version --- app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php index 428b96cfe6d60..1a62fceb21358 100644 --- a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -58,8 +58,7 @@ function ($matches) use (&$cssMatches) { } $media = $media ?? 'all'; $loadCssAsync = sprintf( - '<link rel="preload" as="style" media="%s" ' . - 'href="%s">', + '<link rel="preload" as="style" media="%s" href="%s">', $media, $href ); From c0c40820a27dde620169abd163b54c4ac8b6fadf Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 30 May 2019 14:01:53 -0500 Subject: [PATCH 283/464] MC-6421: Admin search displays settings and content items --- .../Search/Test/Mftf/Section/AdminGlobalSearchSection.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml b/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml index 7036bc346b24d..92b67bff9737f 100644 --- a/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml +++ b/app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml @@ -9,7 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminGlobalSearchSection"> - <element name="globalSearch" type="button" selector="//label[contains(concat(' ',normalize-space(@class),' '),' search-global-label ')]"/> - <element name="globalSearchActive" type="block" selector="//div[contains(concat(' ',normalize-space(@class),' '),' search-global-field _active ')]"/> + <element name="globalSearch" type="button" selector="//label[contains(@class, 'search-global-label')]"/> + <element name="globalSearchActive" type="block" selector="//div[contains(@class, 'search-global-field')][contains(@class, '_active')]"/> </section> </sections> From 1789642bb0cd0ccf24d2d62ab73be1a4bd0d061e Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 30 May 2019 14:29:23 -0500 Subject: [PATCH 284/464] MC-13414: Checkout flow if shipping rates are not available --- ...orefrontGuestCheckoutForSpecificCountriesTest.xml | 12 +++--------- ...tStoreFrontShippingMethodAvailableActionGroup.xml | 2 +- ...toreFrontShippingMethodUnavailableActionGroup.xml | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml index d778620d8716b..f6a332a529dc9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml @@ -58,9 +58,7 @@ <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMethod"> <argument name="shippingMethodName" value="Flat Rate"/> </actionGroup> - <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"> - <argument name="shippingMethodName" value="Free Shipping"/> - </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"/> <!-- Assert no quotes message --> <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMessage"/> @@ -77,9 +75,7 @@ <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMtd"> <argument name="shippingMethodName" value="Flat Rate"/> </actionGroup> - <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"> - <argument name="shippingMethodName" value="Free Shipping"/> - </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"/> <!-- Assert no quotes message for US > California --> <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMsg"/> @@ -91,9 +87,7 @@ <selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="selectSpecificCountry"/> <!-- Assert shipping methods are available --> - <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"> - <argument name="shippingMethodName" value="Flat Rate"/> - </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"/> <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFreeShippingMethod"> <argument name="shippingMethodName" value="Free Shipping"/> </actionGroup> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml index 9ebeb39668590..9892bc7cbc9ea 100644 --- a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertStoreFrontShippingMethodAvailableActionGroup"> <arguments> - <argument name="shippingMethodName" type="string"/> + <argument name="shippingMethodName" type="string" defaultValue="Flat Rate"/> </arguments> <waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodLoad"/> <seeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="seeShippingMethod"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml index 44da1b24c0ad5..d425a6d93a1df 100644 --- a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertStoreFrontShippingMethodUnavailableActionGroup"> <arguments> - <argument name="shippingMethodName" type="string"/> + <argument name="shippingMethodName" type="string" defaultValue="Free Shipping"/> </arguments> <waitForElementNotVisible selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="waitForShippingMethodNotVisible"/> <dontSeeElement selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName(shippingMethodName)}}" stepKey="dontSeeShippingMethod"/> From 81a290ef648168aceb8ed0a1032018c519913280 Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 14:47:41 -0500 Subject: [PATCH 285/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - review comments --- .../PlaceOrderWithAuthorizeNetTest.php | 15 ++----- ...SetAuthorizeNetPaymentMethodOnCartTest.php | 4 -- .../Guest/PlaceOrderWithAuthorizeNetTest.php | 3 +- .../_files/simple_product_authorizenet.php | 45 +++++++++++++++++++ .../simple_product_authorizenet_rollback.php | 7 +++ 5 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php index 6a94183128e80..5c9eb3ad97274 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -41,9 +41,6 @@ class PlaceOrderWithAuthorizeNetTest extends TestCase /** @var GetMaskedQuoteIdByReservedOrderId */ private $getMaskedQuoteIdByReservedOrderId; - /** @var GraphQl */ - private $graphql; - /** @var SerializerInterface */ private $jsonSerializer; @@ -65,7 +62,6 @@ class PlaceOrderWithAuthorizeNetTest extends TestCase protected function setUp() : void { $this->objectManager = Bootstrap::getObjectManager(); - $this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); $this->jsonSerializer = $this->objectManager->get(SerializerInterface::class); $this->request = $this->objectManager->get(Http::class); $this->getMaskedQuoteIdByReservedOrderId = $this->objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); @@ -92,7 +88,7 @@ protected function setUp() : void * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc * @magentoDataFixture Magento/Sales/_files/default_rollback.php * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php * @magentoDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php @@ -140,13 +136,11 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void $this->request->setContent($this->jsonSerializer->serialize($postData)); $customerToken = $this->customerTokenService->createCustomerAccessToken('customer@example.com', 'password'); $bearerCustomerToken = 'Bearer ' . $customerToken; - $contentType ='application/json'; $webApiRequest = $this->objectManager->get(Request::class); - $webApiRequest->getHeaders()->addHeaderLine('Content-Type', $contentType) - ->addHeaderLine('Accept', $contentType) + $webApiRequest->getHeaders()->addHeaderLine('Content-Type', 'application/json') + ->addHeaderLine('Accept', 'application/json') ->addHeaderLine('Authorization', $bearerCustomerToken); $this->request->setHeaders($webApiRequest->getHeaders()); - $graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; @@ -160,7 +154,7 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void $response = $graphql->dispatch($this->request); $responseData = $this->jsonSerializer->unserialize($response->getContent()); - $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); + $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); $this->assertTrue( isset($responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']) ); @@ -182,7 +176,6 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void protected function tearDown() { $this->objectManager->removeSharedInstance(ZendClientFactory::class); - include __DIR__ . '/../../../../../Magento/Customer/_files/customer_rollback.php'; parent::tearDown(); } } diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php index e1c92889cbacf..68dc97e502bc0 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -38,10 +38,6 @@ class SetAuthorizenetPaymentMethodOnCartTest extends TestCase /** @var CustomerTokenServiceInterface */ private $customerTokenService; - /** - * @var \Magento\Framework\App\Cache */ - private $appCache; - /** @var Http */ private $request; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php index 018fad56477c1..45d4f59a3f7a6 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php @@ -85,7 +85,7 @@ protected function setUp() : void * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_key somepassword * @magentoConfigFixture default_store payment/authorizenet_acceptjs/trans_signature_key abc * @magentoDataFixture Magento/Sales/_files/default_rollback.php - * @magentoDataFixture Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php + * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php * @magentoDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php * @magentoDataFixture Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php @@ -169,7 +169,6 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void protected function tearDown() { $this->objectManager->removeSharedInstance(ZendClientFactory::class); - include __DIR__ . '/../../../../../Magento/Customer/_files/not_logged_in_customer_rollback.php'; parent::tearDown(); } } diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php new file mode 100644 index 0000000000000..47070c9af9095 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Framework\Api\DataObjectHelper; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +/** @var DataObjectHelper $dataObjectHelper */ +$dataObjectHelper = Bootstrap::getObjectManager()->get(DataObjectHelper::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); + +$product = $productFactory->create(); +$productData = [ + ProductInterface::TYPE_ID => Type::TYPE_SIMPLE, + ProductInterface::ATTRIBUTE_SET_ID => 4, + ProductInterface::SKU => 'simple_product', + ProductInterface::NAME => 'Simple Product', + ProductInterface::PRICE => 20, + ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH, + ProductInterface::STATUS => Status::STATUS_ENABLED, +]; +$dataObjectHelper->populateWithArray($product, $productData, ProductInterface::class); +/** Out of interface */ +$product + ->setWebsiteIds([1]) + ->setStockData([ + 'qty' => 85.5, + 'is_in_stock' => true, + 'manage_stock' => true, + 'is_qty_decimal' => true + ]); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php new file mode 100644 index 0000000000000..955f613e213bb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php @@ -0,0 +1,7 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/../../GraphQl/Catalog/_files/simple_product_rollback.php'; From ab2f000ed499cb178273492883ec8024a7b543b6 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Thu, 30 May 2019 23:00:14 +0300 Subject: [PATCH 286/464] fix catching exceptions --- .../MassConsumerEnvelopeCallback.php | 15 ++++++++++++--- .../Plugin/Framework/Amqp/Bulk/Exchange.php | 9 +++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php index f8560b5f11597..bcfdbea4fd3e3 100644 --- a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php @@ -51,12 +51,17 @@ public function __construct( } /** + * Check if amqpProperties['application_headers'] have 'store_id' and use it to setCurrentStore + * Restore currentStore of consumer process after execution. + * * @param SubjectMassConsumerEnvelopeCallback $subject + * @param callable $proceed * @param EnvelopeInterface $message * @return array|null + * @throws NoSuchEntityException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeExecute(SubjectMassConsumerEnvelopeCallback $subject, EnvelopeInterface $message) + public function aroundExecute(SubjectMassConsumerEnvelopeCallback $subject, callable $proceed, EnvelopeInterface $message) { $amqpProperties = $message->getProperties(); if (isset($amqpProperties['application_headers'])) { @@ -72,13 +77,17 @@ public function beforeExecute(SubjectMassConsumerEnvelopeCallback $subject, Enve $this->logger->error( sprintf("Can't set currentStoreId during processing queue. Error %s.", $e->getMessage()) ); - return null; + throw new NoSuchEntityException(__($e->getMessage())); } if (isset($storeId) && $storeId !== $currentStoreId) { $this->storeManager->setCurrentStore($storeId); } } } - return [$message]; + $result = $proceed($message); + if (isset($storeId, $currentStoreId) && $storeId !== $currentStoreId) { + $this->storeManager->setCurrentStore($currentStoreId);//restore previous current store + } + return $result; } } diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index c412144e2fa53..373b8c24eb7cf 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -55,17 +55,22 @@ public function __construct( * @param $topic * @param EnvelopeInterface[] $envelopes * @return array|null + * @throws NoSuchEntityException + * @throws AMQPInvalidArgumentException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes) { try { $storeId = $this->storeManager->getStore()->getId(); + $code = $this->storeManager->getStore()->getCode(); + $t=1; } catch (NoSuchEntityException $e) { + $r=1; $this->logger->error( sprintf("Can't get current storeId and inject to amqp message. Error %s.", $e->getMessage()) ); - return null; + throw new NoSuchEntityException(__($e->getMessage())); } $updatedEnvelopes = []; @@ -83,7 +88,7 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes $this->logger->error( sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage()) ); - return null; + throw new AMQPInvalidArgumentException($ea->getMessage()); } $properties['application_headers'] = $headers; } From 48104dc95f8c3c9de6e3c72813a175b920de28d8 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Thu, 30 May 2019 23:01:19 +0300 Subject: [PATCH 287/464] remove testing code --- .../Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index 373b8c24eb7cf..97a6151220e12 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -63,10 +63,7 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes { try { $storeId = $this->storeManager->getStore()->getId(); - $code = $this->storeManager->getStore()->getCode(); - $t=1; } catch (NoSuchEntityException $e) { - $r=1; $this->logger->error( sprintf("Can't get current storeId and inject to amqp message. Error %s.", $e->getMessage()) ); From 2071482515e9d7987dd9e905478f44ad43fd1522 Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 15:18:24 -0500 Subject: [PATCH 288/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - removed unused fixtures --- .../_files/not_logged_in_customer.php | 32 ------------------- .../not_logged_in_customer_rollback.php | 25 --------------- 2 files changed, 57 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php delete mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php deleted file mode 100644 index a2aa403a33c5a..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -use Magento\Customer\Model\CustomerRegistry; - -$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -/** @var $repository \Magento\Customer\Api\CustomerRepositoryInterface */ -$repository = $objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class); -$customer = $objectManager->create(\Magento\Customer\Model\Customer::class); -/** @var CustomerRegistry $customerRegistry */ -$customerRegistry = $objectManager->get(CustomerRegistry::class); -/** @var Magento\Customer\Model\Customer $customer */ -$customer->setWebsiteId(1) - ->setEmail('customer@example.com') - ->setPassword('password') - ->setGroupId(1) - ->setStoreId(1) - ->setIsActive(1) - ->setPrefix('Mr.') - ->setFirstname('John') - ->setMiddlename('A') - ->setLastname('Smith') - ->setSuffix('Esq.') - ->setDefaultBilling(1) - ->setDefaultShipping(1) - ->setTaxvat('12') - ->setGender(0); - -$customer->isObjectNew(true); -$customer->save(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php deleted file mode 100644 index 26ec0d3862a8f..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/not_logged_in_customer_rollback.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - - -/** @var \Magento\Framework\Registry $registry */ - $registry = $this->objectManager->get(\Magento\Framework\Registry::class); - $registry->unregister('isSecureArea'); - $registry->register('isSecureArea', true); - -/** @var \Magento\Store\Model\StoreManager $store */ - $store = $this->objectManager->get(\Magento\Store\Model\StoreManager::class); - -/** @var $customer \Magento\Customer\Model\Customer*/ - $customer = $this->objectManager->create(\Magento\Customer\Model\Customer::class); - $customer->setWebsiteId($store->getDefaultStoreView()->getWebsiteId()); - $customer->loadByEmail('customer@example.com'); - if ($customer->getId()) { - $customer->delete(); - } - - $registry->unregister('isSecureArea'); - $registry->register('isSecureArea', false); From ca3f32d61bb1d4afb53c63ddf841fc94e9ee533d Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 15:24:04 -0500 Subject: [PATCH 289/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - removed unused fixtures --- .../_files/simple_product_authorizenet.php | 45 ------------------- .../simple_product_authorizenet_rollback.php | 7 --- 2 files changed, 52 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php delete mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php deleted file mode 100644 index 47070c9af9095..0000000000000 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Catalog\Api\Data\ProductInterfaceFactory; -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\Catalog\Model\Product\Type; -use Magento\Catalog\Model\Product\Visibility; -use Magento\Framework\Api\DataObjectHelper; -use Magento\TestFramework\Helper\Bootstrap; - -$objectManager = Bootstrap::getObjectManager(); -/** @var ProductInterfaceFactory $productFactory */ -$productFactory = $objectManager->get(ProductInterfaceFactory::class); -/** @var DataObjectHelper $dataObjectHelper */ -$dataObjectHelper = Bootstrap::getObjectManager()->get(DataObjectHelper::class); -/** @var ProductRepositoryInterface $productRepository */ -$productRepository = $objectManager->get(ProductRepositoryInterface::class); - -$product = $productFactory->create(); -$productData = [ - ProductInterface::TYPE_ID => Type::TYPE_SIMPLE, - ProductInterface::ATTRIBUTE_SET_ID => 4, - ProductInterface::SKU => 'simple_product', - ProductInterface::NAME => 'Simple Product', - ProductInterface::PRICE => 20, - ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH, - ProductInterface::STATUS => Status::STATUS_ENABLED, -]; -$dataObjectHelper->populateWithArray($product, $productData, ProductInterface::class); -/** Out of interface */ -$product - ->setWebsiteIds([1]) - ->setStockData([ - 'qty' => 85.5, - 'is_in_stock' => true, - 'manage_stock' => true, - 'is_qty_decimal' => true - ]); -$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php b/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php deleted file mode 100644 index 52e7012a5106d..0000000000000 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Catalog/_files/simple_product_authorizenet_rollback.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -require __DIR__ . '/simple_product_rollback.php'; From 46ea36f37d0ebbe8b5ff744d537abf3b9e41ce9f Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Thu, 30 May 2019 15:37:16 -0500 Subject: [PATCH 290/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable tests --- .../Test/Mftf/Test/AdminExportBundleProductTest.xml | 3 +++ .../Test/AdminExportGroupedProductWithSpecialPriceTest.xml | 3 +++ .../Test/AdminExportSimpleProductWithCustomAttributeTest.xml | 3 +++ .../ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml | 3 +++ .../ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml | 3 +++ ...ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml | 3 +++ .../ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml | 3 +++ ...uleForConfigurableProductWithAssignedSimpleProductsTest.xml | 3 +++ ...inApplyCatalogRuleForConfigurableProductWithOptionsTest.xml | 3 +++ .../Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml | 3 +++ ...WithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml | 3 +++ 11 files changed, 33 insertions(+) diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml index f720cf30b8cc5..68f47ba2a8568 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-14008"/> <group value="catalog_import_export"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!--Create bundle product with dynamic price with two simple products --> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml index b350ea2cbdaca..6c6b181f48063 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-14009"/> <group value="catalog_import_export"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create first simple product and add special price --> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml index 5d6554d89aef6..b91f0953bff29 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-14007"/> <group value="catalog_import_export"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create simple product with custom attribute set --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index be2e31d0766bd..b9e7bfb4d41e4 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14770"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml index 7b7953c1d9b06..3405d0c4e776d 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14771"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml index e4af21cac6723..c3bcde92bd1f2 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14772"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml index 5b7e722c92a02..5d2654ed5e75b 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14769"/> <group value="CatalogRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Login as Admin --> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml index 5bb45f58bcd27..3e700b5bcfb1b 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14063"/> <group value="catalogRuleConfigurable"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create category for first configurable product --> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index 408e181aa1c87..e53e51c626aa9 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml +++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-14062"/> <group value="catalogRuleConfigurable"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create category --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml index bdf672a8d4857..15410921f1bb1 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml @@ -78,6 +78,9 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-97001"/> <group value="checkout"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <magentoCLI stepKey="disableSidebar" command="config:set checkout/sidebar/display 0" /> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index e1a4ca40fd710..92d381c766eb4 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> From 976f83616534c5b002aa44064fb9c03460ec2594 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Thu, 30 May 2019 15:42:01 -0500 Subject: [PATCH 291/464] MC-16709: Create new benchmark scenario for cloud measurements --- setup/performance-toolkit/README.md | 210 ++++++++++++++++-------- setup/performance-toolkit/benchmark.jmx | 8 +- 2 files changed, 147 insertions(+), 71 deletions(-) diff --git a/setup/performance-toolkit/README.md b/setup/performance-toolkit/README.md index 7bf7a1fbd4721..ed87855eef211 100644 --- a/setup/performance-toolkit/README.md +++ b/setup/performance-toolkit/README.md @@ -54,49 +54,139 @@ There are two JMeter scenarios located in `setup/performance-toolkit` folder: `b The following parameters can be passed to the `benchmark.jmx` scenario: +Main parameters: + | Parameter Name | Default Value | Description | | --------------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------- | | host | localhost | URL component 'host' of application being tested (URL or IP). | | base_path | / | Base path for tested site. | +| files_folder | ./files/ | Path to various files that are used in scenario (`setup/performance-toolkit/files`). | +| request_protocol | http | Hypertext Transfer Protocol (http or https). | +| graphql_port_number | | Port number for GraphQL. | +| admin_password | 123123q | Admin backend password. | | admin_path | admin | Admin backend path. | | admin_user | admin | Admin backend user. | -| admin_password | 123123q | Admin backend password. | -| customer_password | 123123q | Storefront customer password. | -| customers_page_size | 50 | Page size for customers grid in Magento Admin. | -| files_folder | ./files/ | Path to various files that are used in scenario (`setup/performance-toolkit/files`). | +| cache_hits_percentage | 100 | Cache hits percentage. | +| seedForRandom | 1 | System option for setting random number method | | loops | 1 | Number of loops to run. | -| frontendPoolUsers | 1 | Total number of Frontend threads. | -| adminPoolUsers | 1 | Total number of Admin threads. | -| browseCatalogByGuestPercentage | 30 | Percentage of threads in Frontend Pool that emulate catalog browsing activities. | -| browseCatalogByCustomerPercentage | 0 | Percentage of threads in Frontend Pool that emulate catalog browsing activities. | -| siteSearchPercentage | 30 | Percentage of threads in Frontend Pool that emulate catalog search activities. | -| searchQuickPercentage | 60 | Percentage of threads in Frontend Pool that emulate catalog search activities. | -| searchQuickFilterPercentage | 30 | Percentage of threads in Frontend Pool that emulate catalog search activities. | -| searchAdvancedPercentage | 10 | Percentage of threads in Frontend Pool that emulate catalog search activities. | -| checkoutByGuestPercentage | 4 | Percentage of threads in Frontend Pool that emulate checkout by guest. | -| checkoutByCustomerPercentage | 4 | Percentage of threads in Frontend Pool that emulate checkout by customer. | -| addToCartByGuestPercentage | 28 | Percentage of threads in Frontend Pool that emulate abandoned cart activities. | -| addToWishlistPercentage | 2 | Percentage of threads in Frontend Pool that emulate adding products to Wishlist. | -| compareProductsPercentage | 2 | Percentage of threads in Frontend Pool that emulate products comparison. | -| productCompareDelay | 0 | Delay (s) between iterations of product comparison. | -| promotionRulesPercentage | 10 | Percentage of threads in Admin Pool that emulate creation of promotion rules. | -| adminPromotionsManagementDelay | 0 | Delay (s) between creation of promotion rules. | -| adminCategoryManagementPercentage | 10 | Percentage of threads in Merchandising Pool that emulate category management activities. | -| adminProductEditingPercentage | 35 | Percentage of threads in Merchandising Pool that emulate product editing. | -| adminProductCreationPercentage | 25 | Percentage of threads in Merchandising Pool that emulate creation of products. | -| adminPromotionRulesPercentage | 15 | Percentage of threads in Admin Pool that emulate admin rules creating activities. | -| adminCategoryManagementDelay | 0 | Delay (s) between iterations of category management activities. | -| apiProcessOrders | 5 | Number of orders for process in Admin API - Process Orders. | -| adminEditOrderPercentage | 15 | Percentage of threads in Admin Pool that emulate order edit. | -| csrPoolUsers | 0 | Users of Customer Support Request (CSR) Pool. | -| othersPoolUsers | 0 | Users of Others Pool. | -| browseCustomerGridPercentage | 10 | Percentage of threads in CSR Pool that emulate customers browsing activities. | -| adminCreateOrderPercentage | 70 | Percentage of threads in CSR Pool that emulate creation of orders. | -| adminReturnsManagementPercentage | 20 | Percentage of threads in CSR Pool that emulate creation/processing of returns. | -| adminCreateProcessReturnsDelay | 0 | Delay (s) between creation of returns. | -| wishlistDelay | 0 | Delay (s) between adding products to Wishlist. | -| categories_count | 100 | Total number of categories that are be used in scenario. | -| simple_products_count | 30 | Total number of simple products that are be used in scenario. | +| frontendPoolUsers | 0 | Total number of Frontend threads. | +| adminPoolUsers | 0 | Total number of Admin threads. | +| csrPoolUsers | 0 | Total number of CSR threads. | +| apiPoolUsers | 0 | Total number of API threads. | +| deadLocksPoolUsers | 0 | Total number of One Thread Scenarios threads. | +| graphQLPoolUsers | 0 | Total number of GraphQL threads. | +| cloudBenchmarkPoolUsers | 0 | Total number of Cloud Benchmark threads. | + +Parameters for Frontend pool: + +| Parameter Name | Default Value | Description | +| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------- | +| browseCatalogByCustomerPercentage | 0 | Percentage of threads in Frontend Pool that emulate customer catalog browsing activities. | +| browseCatalogByGuestPercentage | 0 | Percentage of threads in Frontend Pool that emulate guest catalog browsing activities. | +| siteSearchPercentage | 0 | Percentage of threads in Frontend Pool that emulate catalog search activities. | +| addToCartByGuestPercentage | 0 | Percentage of threads in Frontend Pool that emulate abandoned cart activities by guest. | +| addToWishlistPercentage | 0 | Percentage of threads in Frontend Pool that emulate adding products to Wishlist. | +| compareProductsPercentage | 0 | Percentage of threads in Frontend Pool that emulate products comparison. | +| checkoutByGuestPercentage | 0 | Percentage of threads in Frontend Pool that emulate checkout by guest. | +| checkoutByCustomerPercentage | 0 | Percentage of threads in Frontend Pool that emulate checkout by customer. | +| reviewByCustomerPercentage | 0 | Percentage of threads in Frontend Pool that emulate reviewing products. | +| addToCartByCustomerPercentage | 0 | Percentage of threads in Frontend Pool that emulate abandoned cart activities by customer.| +| accountManagementPercentage | 0 | Percentage of threads in Frontend Pool that emulate account management. | + +Parameters for Admin pool: + +| Parameter Name | Default Value | Description | +| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------- | +| adminCMSManagementPercentage | 0 | Percentage of threads in Admin Pool that emulate CMS management activities. | +| browseProductGridPercentage | 0 | Percentage of threads in Admin Pool that emulate products grid browsing activities. | +| browseOrderGridPercentage | 0 | Percentage of threads in Admin Pool that emulate orders grid browsing activities. | +| adminProductCreationPercentage | 0 | Percentage of threads in Admin Pool that emulate product creation activities. | +| adminProductEditingPercentage | 0 | Percentage of threads in Admin Pool that emulate product editing activities. | + +Parameters for CSR pool: + +| Parameter Name | Default Value | Description | +| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------- | +| adminReturnsManagementPercentage | 0 | Percentage of threads in CSR Pool that emulate admin returns management activities. | +| browseCustomerGridPercentage | 0 | Percentage of threads in CSR Pool that emulate customers grid browsing activities. | +| adminCreateOrderPercentage | 0 | Percentage of threads in CSR Pool that emulate creating orders activities. | + +Parameters for API pool: + +| Parameter Name | Default Value | Description | +| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------- | +| apiBasePercentage | 0 | Percentage of threads in API Pool that emulate API requests activities. | + +Parameters for One Thread Scenarios pool: + +| Parameter Name | Default Value | Description | +| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------- | +| productGridMassActionPercentage | 0 | Percentage of threads that emulate product mass action activities. | +| importProductsPercentage | 0 | Percentage of threads that emulate products import activities. | +| importCustomersPercentage | 0 | Percentage of threads that emulate customers import activities. | +| exportProductsPercentage | 0 | Percentage of threads that emulate products export activities. | +| exportCustomersPercentage | 0 | Percentage of threads that emulate customers export activities. | +| apiSinglePercentage | 0 | Percentage of threads that emulate API nonparallel requests activities. | +| adminCategoryManagementPercentage | 0 | Percentage of threads that emulate category management activities. | +| adminPromotionRulesPercentage | 0 | Percentage of threads that emulate promotion rules activities. | +| adminCustomerManagementPercentage | 0 | Percentage of threads that emulate customer management activities. | +| adminEditOrderPercentage | 0 | Percentage of threads that emulate edit order activities. | +| catalogGraphQLPercentage | 0 | Percentage of threads that emulate nonparallel catalogGraphQL activities. | + +Parameters for GraphQL pool: + +| Parameter Name | Default Value | Description | +| ----------------------------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------- | +| graphqlGetListOfProductsByCategoryIdPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetSimpleProductDetailsByProductUrlKeyPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetSimpleProductDetailsByNamePercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetConfigurableProductDetailsByProductUrlKeyPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetConfigurableProductDetailsByNamePercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetProductSearchByTextAndCategoryIdPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetCategoryListByCategoryIdPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlUrlInfoByUrlKeyPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetCmsPageByIdPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetNavigationMenuByCategoryIdPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlCreateEmptyCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlGetEmptyCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlSetShippingAddressOnCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlSetBillingAddressOnCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlAddSimpleProductToCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlAddConfigurableProductToCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlUpdateSimpleProductQtyInCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlUpdateConfigurableProductQtyInCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlRemoveSimpleProductFromCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlRemoveConfigurableProductFromCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlApplyCouponToCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlRemoveCouponFromCartPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlCatalogBrowsingByGuestPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | +| graphqlCheckoutByGuestPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | + +Parameters for Cloud Benchmark pool: + +| Parameter Name | Default Value | Description | +| ----------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------- | +| cloudBrowseCatalogByGuestPercentage | 29 | Percentage of threads in Cloud Benchmark Pool that emulate customer catalog browsing activities. | +| cloudSiteSearchPercentage | 29 | Percentage of threads in Cloud Benchmark Pool that emulate catalog search activities. | +| cloudAddToCartByGuestPercentage | 26 | Percentage of threads in Cloud Benchmark Pool that emulate abandoned cart activities. | +| cloudAddToWishlistPercentage | 1.5 | Percentage of threads in Cloud Benchmark Pool that emulate adding products to Wishlist. | +| cloudCompareProductsPercentage | 1.5 | Percentage of threads in Cloud Benchmark Pool that emulate products comparison. | +| cloudCheckoutByGuestPercentage | 3.5 | Percentage of threads in Cloud Benchmark Pool that emulate checkout by guest. | +| cloudCheckoutByCustomerPercentage | 3.5 | Percentage of threads in Cloud Benchmark Pool that emulate checkout by customer. | +| cloudAccountManagementPercentage | 1 | Percentage of threads in Cloud Benchmark Pool that emulate account management. | +| cloudAdminCMSManagementPercentage | 0.35 | Percentage of threads in Cloud Benchmark Pool that emulate CMS management activities. | +| cloudAdminBrowseProductGridPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate products grid browsing activities. | +| cloudAdminBrowseOrderGridPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate orders grid browsing activities. | +| cloudAdminProductCreationPercentage | 0.5 | Percentage of threads in Cloud Benchmark Pool that emulate product creation activities. | +| cloudAdminProductEditingPercentage | 0.65 | Percentage of threads in Cloud Benchmark Pool that emulate product editing activities. | +| cloudAdminReturnsManagementPercentage | 0.75 | Percentage of threads in Cloud Benchmark Pool that emulate admin returns management activities. | +| cloudAdminBrowseCustomerGridPercentage | 0.1 | Percentage of threads in Cloud Benchmark Pool that emulate customers grid browsing activities. | +| cloudAdminCreateOrderPercentage | 0.5 | Percentage of threads in Cloud Benchmark Pool that emulate creating orders activities. | +| cloudAdminCategoryManagementPercentage | 0.15 | Percentage of threads in Cloud Benchmark Pool that emulate admin category management activities. | +| cloudAdminPromotionRulesPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate admin promotion rules activities. | +| cloudAdminCustomerManagementPercentage | 0.4 | Percentage of threads in Cloud Benchmark Pool that emulate admin customers management activities. | +| cloudAdminEditOrderPercentage | 1 | Percentage of threads in Cloud Benchmark Pool that emulate admin edit order activities. | + Parameters must be passed to the command line with the `J` prefix: @@ -113,10 +203,17 @@ There are some options that you should pass to JMeter in the console mode: To get more details about available JMeter options, read [Non-GUI Mode](http://jmeter.apache.org/usermanual/get-started.html#non_gui). -For example, you can run the B2C scenario via console with 90 threads for the Frontend Pool and 10 threads for the Admin Pool: +For example, you can run the B2C scenario via console with: +90 threads for the Frontend Pool where: +- 80% - guest catalog browsing activities. +- 20% - checkout by customer. + +10 threads for the Admin Pool where: +- 10% - admin products grid browsing activities. +- 90% - admin product creation activities. cd {JMeter path}/bin/ - jmeter -n -t {path to performance toolkit}/benchmark.jmx -j ./jmeter.log -l ./jmeter-results.jtl -Jhost=magento2.dev -Jbase_path=/ -Jadmin_path=admin -JfrontendPoolUsers=90 -JadminPoolUsers=10 + jmeter -n -t {path to performance toolkit}/benchmark.jmx -j ./jmeter.log -l ./jmeter-results.jtl -Jhost=magento2.dev -Jbase_path=/ -Jadmin_path=admin -JfrontendPoolUsers=90 -JadminPoolUsers=10 -JbrowseCatalogByGuestPercentage=80 -JcheckoutByCustomerPercentage=20 -JbrowseProductGridPercentage=10 -JadminProductCreationPercentage=90 As a result, you will get `jmeter.log` and `jmeter-results.jtl`. The`jmeter.log` contains information about the test run and can be helpful in determining the cause of an error. The JTL file is a text file containing the results of a test run. It can be opened in the GUI mode to perform analysis of the results (see the *Output* section below). @@ -190,42 +287,21 @@ For more details, read [Summary Report](http://jmeter.apache.org/usermanual/comp ### Scenarios -`benchmark.jmx` scenario has the following pools and default percentage breakdown for each scenario: +`benchmark.jmx` scenario has the following pools: **Frontend Pool** (frontendPoolUsers) -| Scenario Name | % of Pool | -| ------------------------- | --------- | -| Catalog Browsing By Guest | 30 | -| Site Search | 30 | -| Add To Cart By Guest | 28 | -| Add to Wishlist | 2 | -| Compare Products | 2 | -| Checkout By Guest | 4 | -| Checkout By Customer | 4 | - -Site Search thread group contains 3 variations: -- Quick Search (60%) -- Quick Search With Filtration (30%) -- Advanced Search (10%) - **Admin Pool** (adminPoolUsers) -| Scenario Name |% of Pool | -| ----------------------------| --------- | -| Admin Promotion Rules | 15 | -| Admin Edit Order | 15 | -| Admin Category Management | 10 | -| Admin Edit Product | 35 | -| Admin Create Product | 25 | - **CSR Pool** (csrPoolUsers) -| Scenario Name | % of Pool | -| -------------------------- | --------- | -| Browse Customer Grid | 10 | -| Admin Create Order | 70 | -| Admin Returns Management | 20 | +**API Pool** (apiPoolUsers) + +**One Thread Scenarios (Vulnerable to deadlocks) Pool** (deadLocksPoolUsers) + +**GraphQL Pool** (graphQLPoolUsers) + +**Cloud Benchmark Pool** (cloudBenchmarkPoolUsers) **Legacy Threads** diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 1f12183f3a4ef..eb45b875c94b7 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -71,12 +71,12 @@ </elementProp> <elementProp name="frontendPoolUsers" elementType="Argument"> <stringProp name="Argument.name">frontendPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(frontendPoolUsers,1)}</stringProp> + <stringProp name="Argument.value">${__P(frontendPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="adminPoolUsers" elementType="Argument"> <stringProp name="Argument.name">adminPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(adminPoolUsers,1)}</stringProp> + <stringProp name="Argument.value">${__P(adminPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="csrPoolUsers" elementType="Argument"> @@ -91,12 +91,12 @@ </elementProp> <elementProp name="deadLocksPoolUsers" elementType="Argument"> <stringProp name="Argument.name">deadLocksPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(deadLocksPoolUsers,1)}</stringProp> + <stringProp name="Argument.value">${__P(deadLocksPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="graphQLPoolUsers" elementType="Argument"> <stringProp name="Argument.name">graphQLPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(graphQLPoolUsers,1)}</stringProp> + <stringProp name="Argument.value">${__P(graphQLPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="cloudBenchmarkPoolUsers" elementType="Argument"> From 00c3faeac6759e8dc8a731315870fbd8a543cd6a Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 30 May 2019 15:51:34 -0500 Subject: [PATCH 292/464] MC-16886: Add preload feature for fonts load --- .../blank/Magento_Theme/layout/default_head_blocks.xml | 4 ++++ .../Magento/Framework/View/Page/Config/Reader/Head.php | 5 +++++ .../Magento/Framework/View/Page/Config/Renderer.php | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml index eb1c8befb3a48..be2875273d55a 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml +++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml @@ -10,6 +10,10 @@ <css src="css/styles-m.css"/> <css src="css/styles-l.css" media="screen and (min-width: 768px)"/> <css src="css/print.css" media="print"/> + <font src="fonts/opensans/light/opensans-300"/> + <font src="fonts/opensans/light/opensans-400"/> + <font src="fonts/opensans/light/opensans-600"/> + <font src="fonts/opensans/light/opensans-700"/> <meta name="format-detection" content="telephone=no"/> </head> </page> diff --git a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php index 2e76493b8506d..de971e33b7c72 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php @@ -30,6 +30,7 @@ class Head implements Layout\ReaderInterface const HEAD_TITLE = 'title'; const HEAD_META = 'meta'; const HEAD_ATTRIBUTE = 'attribute'; + private const HEAD_FONT = 'font'; /**#@-*/ /** @@ -57,6 +58,9 @@ protected function addContentTypeByNodeName(Layout\Element $node) case self::HEAD_SCRIPT: $node->addAttribute('content_type', 'js'); break; + case self::HEAD_FONT: + $node->addAttribute('content_type', 'font'); + break; } } @@ -136,6 +140,7 @@ private function processNode(Layout\Element $node, Structure $pageConfigStructur case self::HEAD_CSS: case self::HEAD_SCRIPT: case self::HEAD_LINK: + case self::HEAD_FONT: $this->addContentTypeByNodeName($node); $pageConfigStructure->addAssets($node->getAttribute('src'), $this->getAttributes($node)); break; diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index ac46cf8a594cc..b272aca0556a2 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -20,7 +20,7 @@ class Renderer implements RendererInterface /** * @var array */ - protected $assetTypeOrder = ['css', 'ico', 'js']; + protected $assetTypeOrder = ['css', 'ico', 'js', 'font']; /** * @var Config @@ -321,6 +321,10 @@ protected function addDefaultAttributes($contentType, $attributes) case 'css': $attributes = ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"'); break; + + case 'font': + $attributes = 'rel="preload" as="font" crossorigin="anonymous"'; + break; } return $attributes; } @@ -340,6 +344,7 @@ protected function getAssetTemplate($contentType, $attributes) break; case 'css': + case 'font': default: $groupTemplate = '<link ' . $attributes . ' href="%s" />' . "\n"; break; From 5c4e850b31751a0a068c640353433e623cf185c9 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Thu, 30 May 2019 15:53:28 -0500 Subject: [PATCH 293/464] MC-16873: Generate critical css file for LUMA --- .../Theme/view/frontend/layout/default_head_blocks.xml | 1 + .../view/frontend/templates/js/css_rel_preload.phtml | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index f2a5d68b1ba99..6ff31de3303cd 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -15,6 +15,7 @@ <body> <referenceBlock name="head.additional"> <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="critical_css_block" as="critical_css" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> + <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> <referenceContainer name="after.body.start"> <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml" before="-"/> diff --git a/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml b/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml new file mode 100644 index 0000000000000..d90d528ffc6f8 --- /dev/null +++ b/app/code/Magento/Theme/view/frontend/templates/js/css_rel_preload.phtml @@ -0,0 +1,10 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +?> +<script> + /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */ + !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this); +</script> From dbc50704a83eb5cb78cf047fe505c209dc869be2 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Thu, 30 May 2019 16:21:06 -0500 Subject: [PATCH 294/464] MC-16608: Use escaper methods - clean up code --- .../templates/notification/window.phtml | 2 +- .../templates/system/messages/popup.phtml | 4 +- .../adminhtml/templates/toolbar_entry.phtml | 14 ++--- .../adminhtml/templates/backup/dialogs.phtml | 3 +- .../system/config/form/field/array.phtml | 19 +++---- .../templates/system/config/js.phtml | 2 +- .../templates/system/config/switcher.phtml | 8 +-- .../templates/system/config/tabs.phtml | 6 +- .../view/adminhtml/templates/grid.phtml | 17 +++--- .../system/currency/rate/matrix.phtml | 8 +-- .../view/adminhtml/templates/grid.phtml | 56 +++++++++---------- .../templates/report/grid/container.phtml | 2 +- .../adminhtml/templates/store/switcher.phtml | 8 +-- .../templates/store/switcher/enhanced.phtml | 6 +- .../templates/product/widget/viewed.phtml | 4 +- .../product/widget/viewed/item.phtml | 16 +++--- .../column/compared_default_list.phtml | 14 ++--- .../column/compared_images_list.phtml | 4 +- .../compared/column/compared_names_list.phtml | 2 +- .../compared/content/compared_grid.phtml | 22 ++++---- .../compared/content/compared_list.phtml | 32 +++++------ .../viewed/column/viewed_default_list.phtml | 12 ++-- .../viewed/column/viewed_images_list.phtml | 4 +- .../viewed/column/viewed_names_list.phtml | 2 +- .../widget/viewed/content/viewed_grid.phtml | 22 ++++---- .../widget/viewed/content/viewed_list.phtml | 24 ++++---- 26 files changed, 155 insertions(+), 158 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml index 84d2a628e6207..b4f19bda36cbf 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml @@ -15,7 +15,7 @@ "autoOpen": true, "buttons": false, "modalClass": "modal-system-messages", - "title": "<?= $block->escapeHtml($block->getHeaderText()) ?>" + "title": "<?= $block->escapeHtmlAttr($block->getHeaderText()) ?>" } }'> <li class="message message-warning warning"> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index 56d4ef8812c32..271af316227bb 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -8,10 +8,10 @@ ?> <div style="display:none" id="system_messages_list" data-role="system_messages_list" - title="<?= $block->escapeHtml($block->getPopupTitle()) ?>"> + title="<?= $block->escapeHtmlAttr($block->getPopupTitle()) ?>"> <ul class="message-system-list messages"> <?php foreach ($block->getUnreadMessages() as $message) : ?> - <li class="message message-warning <?= $block->escapeHtml($block->getItemClass($message)) ?>"> + <li class="message message-warning <?= $block->escapeHtmlAttr($block->getItemClass($message)) ?>"> <?= $block->escapeHtml($message->getText()) ?> </li> <?php endforeach;?> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml index 63fb0b6fce7fd..38398727e0f90 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml @@ -12,16 +12,16 @@ <div data-mage-init='{"toolbarEntry": {}}' class="notifications-wrapper admin__action-dropdown-wrap" - data-notification-count="<?= $block->escapeHtml($notificationCount) ?>"> + data-notification-count="<?= (int)$notificationCount ?>"> <?php if ($notificationCount > 0) : ?> <a href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" class="notifications-action admin__action-dropdown" data-mage-init='{"dropdown":{}}' - title="<?= $block->escapeHtml(__('Notifications')) ?>" + title="<?= $block->escapeHtmlAttr(__('Notifications')) ?>" data-toggle="dropdown"> <span class="notifications-counter"> - <?= ($notificationCount > $notificationCounterMax) ? $block->escapeHtml($notificationCounterMax) . '+' : $block->escapeHtml($notificationCount) ?> + <?= /* @noEscape */ ($notificationCount > $notificationCounterMax) ? (int)$notificationCounterMax . '+' : (int)$notificationCount ?> </span> </a> <ul @@ -30,7 +30,7 @@ <?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?> <?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?> <li class="notifications-entry<?php if ($notification->getSeverity() == 1) : ?> notifications-critical<?php endif; ?>" - data-notification-id="<?= $block->escapeHtml($notification->getId()) ?>" + data-notification-id="<?= $block->escapeHtmlAttr($notification->getId()) ?>" data-notification-severity="<?php if ($notification->getSeverity() == 1) : ?>1<?php endif; ?>"> <?php $notificationDescription = $notification->getDescription(); @@ -59,7 +59,7 @@ <button type="button" class="notifications-close" - title="<?= $block->escapeHtml(__('Close')) ?>" + title="<?= $block->escapeHtmlAttr(__('Close')) ?>" ></button> </li> <?php endforeach; ?> @@ -67,7 +67,7 @@ <a href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" class="action-tertiary action-more"> - <?= $block->escapeHtml(__('See All (')) ?><span class="notifications-counter"><?= $block->escapeHtml($notificationCount) ?></span><?= $block->escapeHtml(__(' unread)')) ?> + <?= $block->escapeHtml(__('See All (')) ?><span class="notifications-counter"><?= (int)$notificationCount ?></span><?= $block->escapeHtml(__(' unread)')) ?> </a> </li> </ul> @@ -75,7 +75,7 @@ <a class="notifications-action admin__action-dropdown" href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>" - title="<?= $block->escapeHtml(__('Notifications')) ?>"> + title="<?= $block->escapeHtmlAttr(__('Notifications')) ?>"> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml index 31051b6353133..81aa49efd11e8 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml @@ -6,8 +6,7 @@ ?> <!-- TODO: refactor form styles and js --> <script type="text/x-magento-template" id="rollback-warning-template"> -<p><?= $block->escapeHtml(__('You will lose any data created since the backup was made, including admin users, ' - . 'customers and orders.')) ?></p> +<p><?= $block->escapeHtml(__('You will lose any data created since the backup was made, including admin users, customers and orders.')) ?></p> <p><?= $block->escapeHtml(__('Are you sure you want to continue?')) ?></p> </script> <script type="text/x-magento-template" id="backup-options-template"> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index e2432ff35c174..b9cb02927a78f 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -10,31 +10,30 @@ $_htmlId = $block->getHtmlId() ? $block->getHtmlId() : '_' . uniqid(); $_colspan = $block->isAddAfter() ? 2 : 1; ?> -<div class="design_theme_ua_regexp" id="grid<?= $block->escapeHtml($_htmlId) ?>"> +<div class="design_theme_ua_regexp" id="grid<?= $block->escapeHtmlAttr($_htmlId) ?>"> <div class="admin__control-table-wrapper"> - <table class="admin__control-table" id="<?= $block->escapeHtml($block->getElement()->getId()) ?>"> + <table class="admin__control-table" id="<?= $block->escapeHtmlAttr($block->getElement()->getId()) ?>"> <thead> <tr> <?php foreach ($block->getColumns() as $columnName => $column) : ?> <th><?= $block->escapeHtml($column['label']) ?></th> <?php endforeach; ?> - <th class="col-actions" colspan="<?= $block->escapeHtml($_colspan) ?>"><?= $block->escapeHtml(__('Action')) ?></th> + <th class="col-actions" colspan="<?= (int)$_colspan ?>"><?= $block->escapeHtml(__('Action')) ?></th> </tr> </thead> <tfoot> <tr> <td colspan="<?= count($block->getColumns())+$_colspan ?>" class="col-actions-add"> - <button id="addToEndBtn<?= $block->escapeHtml($_htmlId) ?>" class="action-add" - title="<?= $block->escapeHtml(__('Add')) ?>" type="button"> + <button id="addToEndBtn<?= $block->escapeHtmlAttr($_htmlId) ?>" class="action-add" title="<?= $block->escapeHtmlAttr(__('Add')) ?>" type="button"> <span><?= $block->escapeHtml($block->getAddButtonLabel()) ?></span> </button> </td> </tr> </tfoot> - <tbody id="addRow<?= $block->escapeHtml($_htmlId) ?>"></tbody> + <tbody id="addRow<?= $block->escapeHtmlAttr($_htmlId) ?>"></tbody> </table> </div> - <input type="hidden" name="<?= $block->escapeHtml($block->getElement()->getName()) ?>[__empty]" value="" /> + <input type="hidden" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>[__empty]" value="" /> <script> require([ @@ -55,14 +54,14 @@ $_colspan = $block->isAddAfter() ? 2 : 1; <?php if ($block->isAddAfter()) : ?> + '<td><button class="action-add" type="button" id="addAfterBtn<%- _id %>"><span>' - + '<?= $block->escapeHtml(__('Add after')) ?>' + + '<?= $block->escapeJs($block->escapeHtml(__('Add after'))) ?>' + '<\/span><\/button><\/td>' <?php endif; ?> + '<td class="col-actions"><button ' + 'onclick="arrayRow<?= $block->escapeJs($_htmlId) ?>.del(\'<%- _id %>\')" ' + 'class="action-delete" type="button">' - + '<span><?= $block->escapeHtml(__('Delete')) ?><\/span><\/button><\/td>' + + '<span><?= $block->escapeJs($block->escapeHtml(__('Delete'))) ?><\/span><\/button><\/td>' + '<\/tr>' ), @@ -123,7 +122,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; // add existing rows <?php foreach ($block->getArrayRows() as $_rowId => $_row) { - echo /** noEscape */ "arrayRow{$block->escapeJs($_htmlId)}.add(" . /** noEscape */$_row->toJson() . ");\n"; + echo /* @noEscape */ "arrayRow{$block->escapeJs($_htmlId)}.add(" . /* @noEscape */ $_row->toJson() . ");\n"; } ?> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml index 161364c7d7fd5..a830eec0088c2 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml @@ -68,7 +68,7 @@ originModel.prototype = { { this.reload = false; this.loader = new varienLoader(true); - this.regionsUrl = "<?= $block->escapeUrl($block->getUrl('directory/json/countryRegion')) ?>"; + this.regionsUrl = "<?= $block->escapeJs($block->escapeUrl($block->getUrl('directory/json/countryRegion'))) ?>"; this.bindCountryRegionRelation(); }, diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml index d31a7dc21d51b..0d07051e6667d 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/switcher.phtml @@ -15,15 +15,15 @@ <?php if ($_option['is_close']) : ?> </optgroup> <?php else : ?> - <optgroup label="<?= $block->escapeHtml($_option['label']) ?>" - style="<?= $block->escapeHtml($_option['style']) ?>"> + <optgroup label="<?= $block->escapeHtmlAttr($_option['label']) ?>" + style="<?= $block->escapeHtmlAttr($_option['style']) ?>"> <?php endif; ?> <?php continue ?> <?php endif; ?> - <option value="<?= $block->escapeHtml($_value) ?>" + <option value="<?= $block->escapeHtmlAttr($_value) ?>" url="<?= $block->escapeUrl($_option['url']) ?>" <?= $_option['selected'] ? 'selected="selected"' : '' ?> - style="<?= $block->escapeHtml($_option['style']) ?>"> + style="<?= $block->escapeHtmlAttr($_option['style']) ?>"> <?= $block->escapeHtml($_option['label']) ?> </option> <?php endforeach ?> diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml index 8967fc0ed8cda..73641206a0256 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/tabs.phtml @@ -8,7 +8,7 @@ ?> <?php if ($block->getTabs()) : ?> - <div id="<?= $block->escapeHtml($block->getId()) ?>" class="config-nav"> + <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>" class="config-nav"> <?php /** @var $_tab \Magento\Config\Model\Config\Structure\Element\Tab */ foreach ($block->getTabs() as $_tab) : @@ -21,9 +21,9 @@ <div class="config-nav-block admin__page-nav _collapsed <?php if ($_tab->getClass()) : ?> - <?= $block->escapeHtml($_tab->getClass()) ?> + <?= $block->escapeHtmlAttr($_tab->getClass()) ?> <?php endif ?>" - data-mage-init='{"collapsible":{"active": "<?= $block->escapeHtml($activeCollapsible) ?>", + data-mage-init='{"collapsible":{"active": "<?= $block->escapeHtmlAttr($activeCollapsible) ?>", "openedState": "_show", "closedState": "_hide", "collapsible": true, diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index a58f05fb8d96a..9248337e5c413 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -11,29 +11,28 @@ ?> <form id="currency-symbols-form" action="<?= $block->escapeUrl($block->getFormActionUrl()) ?>" method="post"> - <input name="form_key" type="hidden" value="<?= $block->escapeHtml($block->getFormKey()) ?>" /> + <input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /> <fieldset class="admin__fieldset"> <?php foreach ($block->getCurrencySymbolsData() as $code => $data) : ?> <div class="admin__field _required"> - <label class="admin__field-label" for="custom_currency_symbol<?= $block->escapeHtml($code) ?>"> + <label class="admin__field-label" for="custom_currency_symbol<?= $block->escapeHtmlAttr($code) ?>"> <span><?= $block->escapeHtml($code) ?> (<?= $block->escapeHtml($data['displayName']) ?>)</span> </label> <div class="admin__field-control"> - <input id="custom_currency_symbol<?= $block->escapeHtml($code) ?>" + <input id="custom_currency_symbol<?= $block->escapeHtmlAttr($code) ?>" class="required-entry admin__control-text <?= $data['inherited'] ? 'disabled' : '' ?>" type="text" value="<?= $block->escapeHtmlAttr($data['displaySymbol']) ?>" - name="custom_currency_symbol[<?= $block->escapeHtml($code) ?>]"> + name="custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]"> <div class="admin__field admin__field-option"> - <input id="custom_currency_symbol_inherit<?= $block->escapeHtml($code) ?>" + <input id="custom_currency_symbol_inherit<?= $block->escapeHtmlAttr($code) ?>" class="admin__control-checkbox" type="checkbox" - onclick="toggleUseDefault(<?= '\'' . $block->escapeHtml($code) . '\',\'' . - $block->escapeJs($data['parentSymbol']) . '\'' ?>)" + onclick="toggleUseDefault(<?= '\'' . $block->escapeJs($code) . '\',\'' . $block->escapeJs($data['parentSymbol']) . '\'' ?>)" <?= $data['inherited'] ? ' checked="checked"' : '' ?> value="1" - name="inherit_custom_currency_symbol[<?= $block->escapeHtml($code) ?>]"> + name="inherit_custom_currency_symbol[<?= $block->escapeHtmlAttr($code) ?>]"> <label class="admin__field-label" - for="custom_currency_symbol_inherit<?= $block->escapeHtml($code) ?>"> + for="custom_currency_symbol_inherit<?= $block->escapeHtmlAttr($code) ?>"> <span> <?= $block->escapeHtml($block->getInheritText()) ?> </span> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml index ecbd772b05920..18b3c7eef746d 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml @@ -35,8 +35,8 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; <td><span class="admin__control-support-text"><?= $block->escapeHtml($_currencyCode) ?></span></td> <td> <input type="text" - name="rate[<?= $block->escapeHtml($_currencyCode) ?>][<?= $block->escapeHtml($_rate) ?>]" - value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" + name="rate[<?= $block->escapeHtmlAttr($_currencyCode) ?>][<?= $block->escapeHtmlAttr($_rate) ?>]" + value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtmlAttr($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtmlAttr($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])) : ?> @@ -46,8 +46,8 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates; <?php else : ?> <td> <input type="text" - name="rate[<?= $block->escapeHtml($_currencyCode) ?>][<?= $block->escapeHtml($_rate) ?>]" - value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtml($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtml($_oldRates[$_currencyCode][$_rate]) : '')) ?>" + name="rate[<?= $block->escapeHtmlAttr($_currencyCode) ?>][<?= $block->escapeHtmlAttr($_rate) ?>]" + value="<?= ($_currencyCode == $_rate) ? '1.0000' : ($_value>0 ? $block->escapeHtmlAttr($_value) : (isset($_oldRates[$_currencyCode][$_rate]) ? $block->escapeHtmlAttr($_oldRates[$_currencyCode][$_rate]) : '')) ?>" class="admin__control-text" <?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> /> <?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])) : ?> diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml index 81e2d7a96a9b3..81453a5a17ad2 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml @@ -9,7 +9,7 @@ ?> <?php if ($block->getCollection()) : ?> <?php if ($block->canDisplayContainer()) : ?> - <div id="<?= $block->escapeHtml($block->getId()) ?>"> + <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>"> <?php else : ?> <?= $block->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> @@ -17,41 +17,41 @@ <div class="admin__data-grid-header admin__data-grid-toolbar"> <div class="admin__data-grid-header-row"> <?php if ($block->getDateFilterVisibility()) : ?> - <div class="admin__filter-actions" data-role="filter-form" id="<?= $block->escapeHtml($block->getSuffixId('period_date_range')) ?>"> + <div class="admin__filter-actions" data-role="filter-form" id="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_range')) ?>"> <span class="field-row"> - <label for="<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" + <label for="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_from')) ?>" class="admin__control-support-text"> <span><?= $block->escapeHtml(__('From')) ?>:</span> </label> <input class="input-text no-changes required-entry admin__control-text" type="text" - id="<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" + id="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_from')) ?>" name="report_from" - value="<?= $block->escapeHtml($block->getFilter('report_from')) ?>"> - <span id="<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>"></span> + value="<?= $block->escapeHtmlAttr($block->getFilter('report_from')) ?>"> + <span id="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_from_advice')) ?>"></span> </span> <span class="field-row"> - <label for="<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" + <label for="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_to')) ?>" class="admin__control-support-text"> <span><?= $block->escapeHtml(__('To')) ?>:</span> </label> <input class="input-text no-changes required-entry admin__control-text" type="text" - id="<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" + id="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_to')) ?>" name="report_to" - value="<?= $block->escapeHtml($block->getFilter('report_to')) ?>"/> - <span id="<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>"></span> + value="<?= $block->escapeHtmlAttr($block->getFilter('report_to')) ?>"/> + <span id="<?= $block->escapeHtmlAttr($block->getSuffixId('period_date_to_advice')) ?>"></span> </span> <span class="field-row admin__control-filter"> - <label for="<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>" + <label for="<?= $block->escapeHtmlAttr($block->getSuffixId('report_period')) ?>" class="admin__control-support-text"> <span><?= $block->escapeHtml(__('Show By')) ?>:</span> </label> - <select name="report_period" id="<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>" class="admin__control-select"> + <select name="report_period" id="<?= $block->escapeHtmlAttr($block->getSuffixId('report_period')) ?>" class="admin__control-select"> <?php foreach ($block->getPeriods() as $_value => $_label) : ?> - <option value="<?= $block->escapeHtml($_value) ?>" <?php if ($block->getFilter('report_period') == $_value) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_label) ?></option> + <option value="<?= $block->escapeHtmlAttr($_value) ?>" <?php if ($block->getFilter('report_period') == $_value) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_label) ?></option> <?php endforeach; ?> </select> <?= $block->getRefreshButtonHtml() ?> @@ -62,14 +62,14 @@ "mage/calendar" ], function($){ - $("#<?= $block->escapeHtml($block->getSuffixId('period_date_range')) ?>").dateRange({ - dateFormat:"<?= $block->escapeHtml($block->getDateFormat()) ?>", - buttonText:"<?= $block->escapeHtml(__('Select Date')) ?>", + $("#<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_range'))) ?>").dateRange({ + dateFormat:"<?= $block->escapeJs($block->escapeHtml($block->getDateFormat())) ?>", + buttonText:"<?= $block->escapeJs($block->escapeHtml(__('Select Date'))) ?>", from:{ - id:"<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>" + id:"<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_from'))) ?>" }, to:{ - id:"<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>" + id:"<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_to'))) ?>" } }); }); @@ -83,7 +83,7 @@ </div> <?php endif; ?> <div class="admin__data-grid-wrap admin__data-grid-wrap-static"> - <table class="data-grid" id="<?= $block->escapeHtml($block->getId()) ?>_table"> + <table class="data-grid" id="<?= $block->escapeHtmlAttr($block->getId()) ?>_table"> <?= $block->getChildHtml('grid.columnSet') ?> </table> </div> @@ -98,16 +98,16 @@ ], function(jQuery){ //<![CDATA[ - <?= $block->escapeHtml($block->getJsObjectName()) ?> = new varienGrid('<?= $block->escapeHtml($block->getId()) ?>', '<?= $block->escapeUrl($block->getGridUrl()) ?>', '<?= $block->escapeHtml($block->getVarNamePage()) ?>', '<?= $block->escapeHtml($block->getVarNameSort()) ?>', '<?= $block->escapeHtml($block->getVarNameDir()) ?>', '<?= $block->escapeHtml($block->getVarNameFilter()) ?>'); - <?= $block->escapeHtml($block->getJsObjectName()) ?>.useAjax = '<?php if ($block->getUseAjax()) : - echo $block->escapeHtml($block->getUseAjax()); + <?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?> = new varienGrid('<?= $block->escapeJs($block->escapeHtml($block->getId())) ?>', '<?= $block->escapeJs($block->escapeUrl($block->getGridUrl())) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getVarNamePage())) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getVarNameSort())) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getVarNameDir())) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getVarNameFilter())) ?>'); + <?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.useAjax = '<?php if ($block->getUseAjax()) : + echo $block->escapeJs($block->escapeHtml($block->getUseAjax())); endif; ?>'; <?php if ($block->getDateFilterVisibility()) : ?> - <?= $block->escapeHtml($block->getJsObjectName()) ?>.doFilterCallback = validateFilterDate; - var period_date_from = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>'); - var period_date_to = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>'); - period_date_from.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_from_advice')) ?>'); - period_date_to.adviceContainer = $('<?= $block->escapeHtml($block->getSuffixId('period_date_to_advice')) ?>'); + <?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.doFilterCallback = validateFilterDate; + var period_date_from = $('<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_from'))) ?>'); + var period_date_to = $('<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_to'))) ?>'); + period_date_from.adviceContainer = $('<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_from_advice'))) ?>'); + period_date_to.adviceContainer = $('<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_to_advice'))) ?>'); var validateFilterDate = function() { if (period_date_from && period_date_to) { @@ -136,7 +136,7 @@ if (obj.switchParams) { storeParam += obj.switchParams; } - var formParam = new Array('<?= $block->escapeHtml($block->getSuffixId('period_date_from')) ?>', '<?= $block->escapeHtml($block->getSuffixId('period_date_to')) ?>', '<?= $block->escapeHtml($block->getSuffixId('report_period')) ?>'); + var formParam = new Array('<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_from'))) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('period_date_to'))) ?>', '<?= $block->escapeJs($block->escapeHtml($block->getSuffixId('report_period'))) ?>'); var paramURL = ''; var switchURL = '<?= $block->escapeUrl($block->getAbsoluteGridUrl(['_current' => false])) ?>'.replace(/(store|group|website)\/\d+\//, ''); diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml index 9701dc6d9fcb7..85145454428e2 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml @@ -31,7 +31,7 @@ require([ } if (jQuery('#filter_form').valid()) { - setLocation('<?= $block->escapeUrl($block->getFilterUrl()) ?>filter/'+ + setLocation('<?= $block->escapeJs($block->escapeUrl($block->getFilterUrl())) ?>filter/'+ Base64.encode(Form.serializeElements(elements))+'/' ); } diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml index df763d540ba9f..090bda48a351c 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml @@ -29,15 +29,15 @@ <?php foreach ($block->getStoreCollection($_group) as $_store) : ?> <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= $block->escapeHtml($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()) : ?> selected<?php endif; ?>> + <option website="true" value="<?= $block->escapeHtmlAttr($_website->getId()) ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()) : ?> selected<?php endif; ?>> <?= $block->escapeHtml($_website->getName()) ?> </option> <?php endif; ?> <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <option group="true" value="<?= $block->escapeHtml($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= $block->escapeHtmlAttr($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> @@ -60,7 +60,7 @@ require(['prototype'], function(){ if(obj.switchParams){ storeParam+= obj.switchParams; } - setLocation('<?= $block->escapeHtml($block->getSwitchUrl()) ?>'+storeParam); + setLocation('<?= $block->escapeUrl($block->getSwitchUrl()) ?>'+storeParam); } }); diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml index c299e15a23fac..e7a712e83e036 100644 --- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml +++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml @@ -34,13 +34,13 @@ <?php foreach ($block->getStoreCollection($_group) as $_store) : ?> <?php if ($showWebsite == false) : ?> <?php $showWebsite = true; ?> - <option website="true" value="<?= $block->escapeHtml(implode(',', $_website->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> + <option website="true" value="<?= $block->escapeHtmlAttr(implode(',', $_website->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_website->getStoreIds())) : ?> selected<?php endif; ?>><?= $block->escapeHtml($_website->getName()) ?></option> <?php endif; ?> <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <option group="true" value="<?= $block->escapeHtml(implode(',', $_group->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> + <option group="true" value="<?= $block->escapeHtmlAttr(implode(',', $_group->getStoreIds())) ?>"<?php if ($block->getRequest()->getParam('store_ids') == implode(',', $_group->getStoreIds())) : ?> selected<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> - <option value="<?= $block->escapeHtml($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> + <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> <?php endforeach; ?> <?php if ($showGroup) : ?> </optgroup> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml index 6e161404da34d..055a26b3dc308 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed.phtml @@ -17,12 +17,12 @@ $type = $block->getType() . '-' . $mode; $class = 'widget viewed' . ' ' . $mode; $title = __('Recently Viewed'); ?> -<div class="block <?= $block->escapeHtml($class) ?>" id="recently_viewed_container" data-mage-init='{"recentlyViewedProducts":{}}' data-count="<?= $block->escapeHtml($block->getCount()) ?>" style="display: none;"> +<div class="block <?= $block->escapeHtmlAttr($class) ?>" id="recently_viewed_container" data-mage-init='{"recentlyViewedProducts":{}}' data-count="<?= $block->escapeHtmlAttr($block->getCount()) ?>" style="display: none;"> <div class="title"> <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="content"> - <ol class="products list items <?= $block->escapeHtml($type) ?>"> + <ol class="products list items <?= $block->escapeHtmlAttr($type) ?>"> </ol> </div> </div> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index 15230f71ad397..69851bd80b8b0 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -21,7 +21,7 @@ $item = $block->getProduct(); $image = $block->getImageType(); $rating = 'short'; ?> -<div class="block" id="widget_viewed_item" data-sku="<?= $block->escapeHtml($item->getSku()) ?>" style="display: none;"> +<div class="block" id="widget_viewed_item" data-sku="<?= $block->escapeHtmlAttr($item->getSku()) ?>" style="display: none;"> <li class="item product"> <div class="product"> <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> @@ -29,7 +29,7 @@ $rating = 'short'; <?= $block->getImage($item, $image)->toHtml() ?> </a> <div class="product details"> - <strong class="product name"><a title="<?= $block->escapeHtml($item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> + <strong class="product name"><a title="<?= $block->escapeHtmlAttr($item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> <?= $block->escapeHtml($item->getName()) ?></a> </strong> @@ -50,7 +50,7 @@ $rating = 'short'; <div class="primary"> <?php if ($item->isSaleable()) : ?> <?php if ($item->getTypeInstance()->hasRequiredOptions($item)) : ?> - <button class="action tocart" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($item)) ?>"}}' type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + <button class="action tocart" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -58,8 +58,8 @@ $rating = 'short'; $postData = $postDataHelper->getPostData($block->getAddToCartUrl($item), ['product' => $item->getEntityId()]) ?> <button class="action tocart" - data-post='<?= $block->escapeHtml($postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr($postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> @@ -74,7 +74,7 @@ $rating = 'short'; <div class="secondary-addto-links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> - <a href="#" data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($item)) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + <a href="#" data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($item)) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> @@ -83,9 +83,9 @@ $rating = 'short'; $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($item)) ?>' + data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($item)) ?>' data-role="add-to-links" - title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index 47e1363030504..5c96c16a61bd2 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -32,24 +32,24 @@ if ($exist = $block->getRecentlyComparedProducts()) { } ?> <?php if ($exist) : ?> -<div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> +<div class="block widget block-compared-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-compared-<?= $block->escapeHtml($suffix) ?>"> + <ol class="product-items" id="widget-compared-<?= $block->escapeHtmlAttr($suffix) ?>"> <?php foreach ($items as $_product) : ?> <li class="product-item"> <div class="product-item-info"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" - title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> + title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" - title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>)"> + title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>)"> <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> @@ -67,7 +67,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -76,8 +76,8 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtml($postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr($postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml index 38c154c108394..6e902af350384 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml @@ -29,11 +29,11 @@ if ($exist = $block->getRecentlyComparedProducts()) { <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-images"> + <ol id="widget-compared-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-images"> <?php $i = 0; foreach ($items as $_product) : ?> <li class="product-item"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" - title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> + title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml index 353e6298c1b7b..f74754b9aa2e0 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml @@ -19,7 +19,7 @@ <strong><?= $block->escapeHtml(__('Recently Compared')) ?></span></strong> </div> <div class="block-content"> - <ol id="widget-compared-<?= $block->escapeHtml($block->getNameInLayout()) ?>" class="product-items product-items-names"> + <ol id="widget-compared-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-names"> <?php $i = 0; foreach ($_products as $_product) : ?> <li class="product-item"> <strong class="product-item-name"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index bc366df7ae0dd..cf97066b7539c 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -32,14 +32,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { ?> <?php if ($exist) : ?> - <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> + <div class="block widget block-compared-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> - <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> - <ol class="product-items <?= $block->escapeHtml($type)?>"> + <div class="products-<?= $block->escapeHtmlAttr($mode) ?> <?= $block->escapeHtmlAttr($mode) ?>"> + <ol class="product-items <?= $block->escapeHtmlAttr($type)?>"> <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> @@ -48,7 +48,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> @@ -72,7 +72,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -81,8 +81,8 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtml(postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr(postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> @@ -100,18 +100,18 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" - data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" class="action towishlist" - title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index d551b17eeac1b..e262c4f89eac9 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -33,24 +33,24 @@ if ($exist = $block->getRecentlyComparedProducts()) { ?> <?php if ($exist) : ?> - <div class="block widget block-compared-products-<?= $block->escapeHtml($mode) ?>"> + <div class="block widget block-compared-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> - <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> - <ol class="product-items <?= $block->escapeHtml($type) ?>"> + <div class="products-<?= $block->escapeHtmlAttr($mode) ?> <?= $block->escapeHtmlAttr($mode) ?>"> + <ol class="product-items <?= $block->escapeHtmlAttr($type) ?>"> <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" class="product-item-link"> + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> @@ -72,8 +72,8 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->isSaleable()) : ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtml($block->getAddToCartUrl($_item)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -82,8 +82,8 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtml($postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr($postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> @@ -101,18 +101,18 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" - data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' data-action="add-to-wishlist" class="action towishlist" - title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> @@ -123,8 +123,8 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($description) : ?> <div class="product-item-description"> <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= $block->escapeHtml($block->getProductUrl($_item)) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index 73a0159b58115..f3e83251fc816 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -35,24 +35,24 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr } ?> <?php if ($exist) : ?> -<div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> +<div class="block widget block-viewed-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-viewed-<?= $block->escapeHtml($suffix) ?>"> + <ol class="product-items" id="widget-viewed-<?= $block->escapeHtmlAttr($suffix) ?>"> <?php foreach ($items as $_product) : ?> <li class="product-item"> <div class="product-item-info"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" - title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> + title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" - title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>" + title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>" class="product-item-link"> <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> @@ -71,7 +71,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -79,7 +79,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); ?> - <button type="button" class="action tocart primary" data-post='<?= $block->escapeHtml($postData) ?>'> + <button type="button" class="action tocart primary" data-post='<?= $block->escapeHtmlAttr($postData) ?>'> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index e4662b22493aa..68550d70494a6 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -34,10 +34,10 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-images"> + <ol id="widget-viewed-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-images"> <?php foreach ($items as $_product) : ?> <li class="product-item"> - <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= $block->escapeHtml($block->stripTags($_product->getName(), null, true)) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" title="<?= $block->escapeHtmlAttr($block->stripTags($_product->getName(), null, true)) ?>"> <?= $block->getImage($_product, $image)->toHtml() ?> </a> </li> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml index f06f4620b9164..076af9125065e 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_names_list.phtml @@ -23,7 +23,7 @@ </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-viewed-<?= $block->escapeHtml($suffix) ?>" class="product-items product-items-names"> + <ol id="widget-viewed-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-names"> <?php foreach ($_products as $_product) : ?> <li class="product-item"> <strong class="product-item-name"> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index 5cbde2ad44945..3db5ed89ac32e 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -35,14 +35,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr } ?> <?php if ($exist) : ?> - <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> + <div class="block widget block-viewed-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> - <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> - <ol class="product-items <?= $block->escapeHtml($type) ?>"> + <div class="products-<?= $block->escapeHtmlAttr($mode) ?> <?= $block->escapeHtmlAttr($mode) ?>"> + <ol class="product-items <?= $block->escapeHtmlAttr($type) ?>"> <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> @@ -51,7 +51,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> @@ -75,7 +75,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -84,8 +84,8 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtml($postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr($postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> @@ -103,16 +103,16 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index 03257d32f48b6..f9c7fcc7290d4 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -37,14 +37,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ?> <?php if ($exist) : ?> - <div class="block widget block-viewed-products-<?= $block->escapeHtml($mode) ?>"> + <div class="block widget block-viewed-products-<?= $block->escapeHtmlAttr($mode) ?>"> <div class="block-title"> <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> <?= '<!-- ' . $block->escapeHtml($image) . '-->' ?> - <div class="products-<?= $block->escapeHtml($mode) ?> <?= $block->escapeHtml($mode) ?>"> - <ol class="product-items <?= $block->escapeHtml($type) ?>"> + <div class="products-<?= $block->escapeHtmlAttr($mode) ?> <?= $block->escapeHtmlAttr($mode) ?>"> + <ol class="product-items <?= $block->escapeHtmlAttr($type) ?>"> <?php foreach ($items as $_item) : ?> <li class="product-item"> <div class="product-item-info"> @@ -53,7 +53,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> @@ -77,7 +77,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php else : ?> @@ -86,8 +86,8 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtml($postData) ?>' - type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>"> + data-post='<?= $block->escapeHtmlAttr($postData) ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> @@ -106,16 +106,16 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= $block->escapeHtml($block->getAddToWishlistParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Wish List')) ?>"> + data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtml($compareHelper->getPostDataParams($_item)) ?>' - title="<?= $block->escapeHtml(__('Add to Compare')) ?>"> + data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> @@ -126,7 +126,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($description) : ?> <div class="product-item-description"> <?= $block->escapeHtml($_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description')) ?> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> From 04cf11a081806c3e51a74c64beb90a27908e56c1 Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 16:26:52 -0500 Subject: [PATCH 295/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - removed unused code --- .../Magento/AuthorizenetGraphQl/_files/request_authorize.php | 4 ---- .../AuthorizenetGraphQl/_files/request_authorize_customer.php | 4 ---- 2 files changed, 8 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php index 65ca4a09dca45..c91c8081736c4 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php @@ -5,10 +5,6 @@ */ declare(strict_types=1); -use Magento\TestFramework\ObjectManager; - -/** @var \Magento\Sales\Model\Order $order */ -$order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); return [ 'createTransactionRequest' => [ diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php index 05f1b5db5c8c6..0ef173009bd6c 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php @@ -5,10 +5,6 @@ */ declare(strict_types=1); -use Magento\TestFramework\ObjectManager; - -/** @var \Magento\Sales\Model\Order $order */ -$order = ObjectManager::getInstance()->get(\Magento\Payment\Gateway\Data\Order\OrderAdapter::class); return [ 'createTransactionRequest' => [ From 78a756ce87e2893947b7f91df00e8759cfc2f2d0 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Thu, 30 May 2019 16:32:48 -0500 Subject: [PATCH 296/464] MC-16608: Use escaper methods - clean up code --- .../templates/widget/compared/column/compared_images_list.phtml | 2 +- .../templates/widget/compared/column/compared_names_list.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml index 6e902af350384..6311f4c43e029 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_images_list.phtml @@ -29,7 +29,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <strong><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <ol id="widget-compared-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-images"> + <ol id="widget-compared-<?= $block->escapeHtmlAttr($block->getNameInLayout()) ?>" class="product-items product-items-images"> <?php $i = 0; foreach ($items as $_product) : ?> <li class="product-item"> <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml index f74754b9aa2e0..08ebffad3e618 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_names_list.phtml @@ -19,7 +19,7 @@ <strong><?= $block->escapeHtml(__('Recently Compared')) ?></span></strong> </div> <div class="block-content"> - <ol id="widget-compared-<?= $block->escapeHtmlAttr($suffix) ?>" class="product-items product-items-names"> + <ol id="widget-compared-<?= $block->escapeHtmlAttr($block->getNameInLayout()) ?>" class="product-items product-items-names"> <?php $i = 0; foreach ($_products as $_product) : ?> <li class="product-item"> <strong class="product-item-name"> From 952d857a5681c55b1bc271d2cc2da569f5d896b9 Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin <dyushkin@adobe.com> Date: Thu, 30 May 2019 17:12:36 -0500 Subject: [PATCH 297/464] MAGETWO-99035: Payflow Field format error: 10413-The totals of the cart item amounts do not match order amounts. --- app/code/Magento/Paypal/Model/Cart.php | 2 +- .../Paypal/Model/Payflow/Transparent.php | 18 +- .../Paypal/Test/Unit/Model/CartTest.php | 12 +- .../Unit/Model/Payflow/TransparentTest.php | 566 +++++++----------- 4 files changed, 229 insertions(+), 369 deletions(-) diff --git a/app/code/Magento/Paypal/Model/Cart.php b/app/code/Magento/Paypal/Model/Cart.php index cef17fab8d916..32451bbad363f 100644 --- a/app/code/Magento/Paypal/Model/Cart.php +++ b/app/code/Magento/Paypal/Model/Cart.php @@ -179,7 +179,7 @@ protected function _applyDiscountTaxCompensationWorkaround( ) { $dataContainer = $salesEntity->getTaxContainer(); $this->addTax((double)$dataContainer->getBaseDiscountTaxCompensationAmount()); - $this->addTax((double)$dataContainer->getBaseShippingDiscountTaxCompensationAmount()); + $this->addTax((double)$dataContainer->getBaseShippingDiscountTaxCompensationAmnt()); } /** diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index c308731c69527..4a3975dc05393 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -59,6 +59,11 @@ class Transparent extends Payflowpro implements TransparentInterface */ private $paymentExtensionFactory; + /** + * @var \Magento\Paypal\Model\CartFactory + */ + private $payPalCartFactory; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -76,6 +81,7 @@ class Transparent extends Payflowpro implements TransparentInterface * @param ResponseValidator $responseValidator * @param PaymentTokenInterfaceFactory $paymentTokenFactory * @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory + * @param \Magento\Paypal\Model\CartFactory $payPalCartFactory * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -98,6 +104,7 @@ public function __construct( ResponseValidator $responseValidator, PaymentTokenInterfaceFactory $paymentTokenFactory, OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory, + \Magento\Paypal\Model\CartFactory $payPalCartFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] @@ -123,6 +130,7 @@ public function __construct( $this->responseValidator = $responseValidator; $this->paymentTokenFactory = $paymentTokenFactory; $this->paymentExtensionFactory = $paymentExtensionFactory; + $this->payPalCartFactory = $payPalCartFactory; } /** @@ -162,13 +170,19 @@ public function authorize(InfoInterface $payment, $amount) $this->addRequestOrderInfo($request, $order); $request = $this->fillCustomerContacts($order, $request); + /** @var \Magento\Paypal\Model\Cart $payPalCart */ + $payPalCart = $this->payPalCartFactory->create(['salesModel' => $order]); + $payPalCart->getAmounts(); + $token = $payment->getAdditionalInformation(self::PNREF); $request->setData('trxtype', self::TRXTYPE_AUTH_ONLY); $request->setData('origid', $token); $request->setData('amt', $this->formatPrice($amount)); $request->setData('currency', $order->getBaseCurrencyCode()); - $request->setData('taxamt', $this->formatPrice($order->getBaseTaxAmount())); - $request->setData('freightamt', $this->formatPrice($order->getBaseShippingAmount())); + $request->setData('itemamt', $this->formatPrice($payPalCart->getSubtotal())); + $request->setData('taxamt', $this->formatPrice($payPalCart->getTax())); + $request->setData('freightamt', $this->formatPrice($payPalCart->getShipping())); + $request->setData('discount', $this->formatPrice($payPalCart->getDiscount())); $response = $this->postRequest($request, $this->getConfig()); $this->processErrors($response); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php index 28837727533d2..0f787f0f513a1 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php @@ -70,7 +70,7 @@ protected function setUp() public function testInvalidGetAllItems($items) { $taxContainer = new \Magento\Framework\DataObject( - ['base_discount_tax_compensation_amount' => 0.2, 'base_shipping_discount_tax_compensation_amount' => 0.1] + ['base_discount_tax_compensation_amount' => 0.2, 'base_shipping_discount_tax_compensation_amnt' => 0.1] ); $this->_salesModel->expects($this->once())->method('getTaxContainer')->will($this->returnValue($taxContainer)); $this->_salesModel->expects($this->once())->method('getAllItems')->will($this->returnValue($items)); @@ -146,7 +146,7 @@ public function testInvalidTotalsGetAllItems($values, $transferDiscount) $this->assertEquals( $values['base_tax_amount'] + $values['base_discount_tax_compensation_amount'] + - $values['base_shipping_discount_tax_compensation_amount'], + $values['base_shipping_discount_tax_compensation_amnt'], $this->_model->getTax() ); $this->assertEquals($values['base_shipping_amount'], $this->_model->getShipping()); @@ -162,7 +162,7 @@ public function invalidTotalsGetAllItemsDataProvider() [ [ 'base_discount_tax_compensation_amount' => 0, - 'base_shipping_discount_tax_compensation_amount' => 0, + 'base_shipping_discount_tax_compensation_amnt' => 0, 'base_subtotal' => 0, 'base_tax_amount' => 0, 'base_shipping_amount' => 0, @@ -174,7 +174,7 @@ public function invalidTotalsGetAllItemsDataProvider() [ [ 'base_discount_tax_compensation_amount' => 1, - 'base_shipping_discount_tax_compensation_amount' => 2, + 'base_shipping_discount_tax_compensation_amnt' => 2, 'base_subtotal' => 3, 'base_tax_amount' => 4, 'base_shipping_amount' => 5, @@ -255,8 +255,8 @@ protected function _prepareInvalidModelData($values, $transferDiscount) [ 'base_discount_tax_compensation_amount' => $values['base_discount_tax_compensation_amount'], - 'base_shipping_discount_tax_compensation_amount' => - $values['base_shipping_discount_tax_compensation_amount'], + 'base_shipping_discount_tax_compensation_amnt' => + $values['base_shipping_discount_tax_compensation_amnt'], ] ); $expectedSubtotal = $values['base_subtotal']; diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php index e6a994cba78c3..03383e6599961 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php @@ -3,446 +3,292 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Paypal\Test\Unit\Model\Payflow; -use Magento\Paypal\Block\Payment\Info; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\DataObject; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Payment\Model\Method\ConfigInterface as PaymentConfigInterface; +use Magento\Payment\Model\Method\ConfigInterfaceFactory as PaymentConfigInterfaceFactory; +use Magento\Paypal\Model\Cart as PayPalCart; +use Magento\Paypal\Model\CartFactory as PayPalCartFactory; +use Magento\Paypal\Model\Payflow\Service\Gateway as PayPalPayflowGateway; +use Magento\Paypal\Model\Payflow\Transparent as PayPalPayflowTransparent; use Magento\Paypal\Model\Payflowpro; -use Magento\Paypal\Model\Payflow\Transparent; +use Magento\Sales\Api\Data\OrderPaymentExtensionInterface; +use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory as PaymentExtensionInterfaceFactory; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Payment; +use Magento\Store\Api\Data\StoreInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Vault\Api\Data\PaymentTokenInterface; -use Magento\Vault\Model\CreditCardTokenFactory; +use Magento\Vault\Api\Data\PaymentTokenInterfaceFactory; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** - * Class TransparentTest - * - * Test class for \Magento\Paypal\Model\Payflow\Transparent * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class TransparentTest extends \PHPUnit\Framework\TestCase { - /** @var Transparent|\PHPUnit_Framework_MockObject_MockObject */ - protected $object; - - /** @var \Magento\Paypal\Model\Payflow\Service\Gateway|\PHPUnit_Framework_MockObject_MockObject */ - protected $gatewayMock; - - /** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $storeManagerMock; - - /** @var \Magento\Payment\Model\Method\ConfigInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $configFactoryMock; - - /** @var \Magento\Payment\Model\Method\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $configMock; - - /** @var \Magento\Framework\DataObject */ - protected $responseMock; - - /** @var \Magento\Sales\Model\Order\Payment\Info|\PHPUnit_Framework_MockObject_MockObject */ - protected $paymentMock; - - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ - protected $orderMock; - - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ - protected $addressBillingMock; - - /** @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject */ - protected $addressShippingMock; + /** + * @var PayPalPayflowTransparent + */ + private $subject; /** - * @var CreditCardTokenFactory|\PHPUnit_Framework_MockObject_MockObject + * @var PaymentConfigInterface|MockObject */ - protected $paymentTokenFactory; + private $paymentConfig; /** - * @var \PHPUnit_Framework_MockObject_MockObject| - * \Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator + * @var PayPalPayflowGateway|MockObject */ - protected $responseValidator; + private $payPalPayflowGateway; - protected function setUp() - { - $this->paymentMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Payment::class) - ->setMethods([]) - ->disableOriginalConstructor() - ->getMock(); + /** + * @var PaymentTokenInterface|MockObject + */ + private $paymentToken; - $this->paymentTokenFactory = $this->getMockBuilder(CreditCardTokenFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); + /** + * @var PayPalCart|MockObject + */ + private $payPalCart; - $this->gatewayMock = $this->getMockBuilder(\Magento\Paypal\Model\Payflow\Service\Gateway::class) - ->setMethods(['postRequest']) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) - ->setMethods(['getStore', 'getId']) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->storeManagerMock->method('getStore') - ->willReturnSelf(); - $this->configMock = $this->getMockBuilder(\Magento\Paypal\Model\PayflowConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $this->configFactoryMock = $this->getMockBuilder(\Magento\Payment\Model\Method\ConfigInterfaceFactory::class) - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $this->configFactoryMock->method('create') - ->willReturn($this->configMock); - $this->responseMock = new \Magento\Framework\DataObject(); - $this->responseValidator = $this->getMockBuilder( - \Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator::class - )->disableOriginalConstructor() - ->setMethods(['validate']) - ->getMock(); + /** + * @var ScopeConfigInterface|MockObject + */ + private $scopeConfig; - $objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->object = $objectHelper->getObject( - \Magento\Paypal\Model\Payflow\Transparent::class, - [ - 'gateway' => $this->gatewayMock, - 'storeManager' => $this->storeManagerMock, - 'configFactory' => $this->configFactoryMock, - 'responseValidator' => $this->responseValidator, - 'paymentTokenFactory' => $this->paymentTokenFactory - ] - ); - } + /** + * @var Payment|MockObject + */ + private $payment; /** - * Initializing a collection Mock for Authorize method - * - * @return void + * @var Order|MockObject */ - protected function initializationAuthorizeMock() + private $order; + + public function setUp() { - $this->orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) - ->setMethods([ - 'getCustomerId', 'getBillingAddress', 'getShippingAddress', 'getCustomerEmail', - 'getId', 'getIncrementId', 'getBaseCurrencyCode' - ]) - ->disableOriginalConstructor() - ->getMock(); - $this->addressBillingMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) - ->setMethods( - [ - 'getFirstname', - 'getLastname', - 'getStreet', - 'getCity', - 'getRegionCode', - 'getPostcode', - 'getCountryId' - ] - )->disableOriginalConstructor() - ->getMock(); - $this->addressShippingMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) - ->setMethods( + $this->initPayment(); + + $this->subject = (new ObjectManagerHelper($this)) + ->getObject( + PayPalPayflowTransparent::class, [ - 'getFirstname', - 'getLastname', - 'getStreet', - 'getCity', - 'getRegionCode', - 'getPostcode', - 'getCountryId' + 'configFactory' => $this->getPaymentConfigInterfaceFactory(), + 'paymentExtensionFactory' => $this->getPaymentExtensionInterfaceFactory(), + 'storeManager' => $this->getStoreManager(), + 'gateway' => $this->getPayPalPayflowGateway(), + 'paymentTokenFactory' => $this->getPaymentTokenFactory(), + 'payPalCartFactory' => $this->getPayPalCartFactory(), + 'scopeConfig' => $this->getScopeConfig(), ] - )->disableOriginalConstructor() - ->getMock(); + ); } /** - * Build data for request for operation Authorize + * Asserts that authorize request to Payflow gateway is valid. * - * @return void + * @dataProvider validAuthorizeRequestDataProvider + * @param DataObject $validAuthorizeRequest + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\State\InvalidTransitionException */ - protected function buildRequestData() + public function testValidAuthorizeRequest(DataObject $validAuthorizeRequest) { - $this->paymentMock->expects($this->once()) - ->method('getOrder') - ->willReturn($this->orderMock); - $this->orderMock->expects($this->once()) - ->method('getBaseCurrencyCode') - ->willReturn('USD'); - $this->orderMock->expects($this->once()) - ->method('getBillingAddress') - ->willReturn($this->addressBillingMock); - $this->orderMock->expects(static::once()) - ->method('getId') - ->willReturn(1); - $this->orderMock->expects(static::once()) - ->method('getIncrementId') - ->willReturn('0000001'); - $this->orderMock->expects($this->once()) - ->method('getShippingAddress') - ->willReturn($this->addressShippingMock); - $this->addressBillingMock->expects($this->once()) - ->method('getFirstname') - ->willReturn('Firstname'); - $this->addressBillingMock->expects($this->once()) - ->method('getLastname') - ->willReturn('Lastname'); - $this->addressBillingMock->expects($this->once()) - ->method('getStreet') - ->willReturn(['street-1', 'street-2']); - $this->addressBillingMock->expects($this->once()) - ->method('getCity') - ->willReturn('City'); - $this->addressBillingMock->expects($this->once()) - ->method('getRegionCode') - ->willReturn('RegionCode'); - $this->addressBillingMock->expects($this->once()) - ->method('getPostcode') - ->willReturn('Postcode'); - $this->addressBillingMock->expects($this->once()) - ->method('getCountryId') - ->willReturn('CountryId'); - $this->orderMock->expects($this->once()) - ->method('getCustomerEmail') - ->willReturn('customer@email.com'); - $this->addressShippingMock->expects($this->once()) - ->method('getFirstname') - ->willReturn('Firstname'); - $this->addressShippingMock->expects($this->once()) - ->method('getLastname') - ->willReturn('Lastname'); - $this->addressShippingMock->expects($this->once()) - ->method('getStreet') - ->willReturn(['street-1', 'street-2']); - $this->addressShippingMock->expects($this->once()) - ->method('getCity') - ->willReturn('City'); - $this->addressShippingMock->expects($this->once()) - ->method('getRegionCode') - ->willReturn('RegionCode'); - $this->addressShippingMock->expects($this->once()) - ->method('getPostcode') - ->willReturn('Postcode'); - $this->addressShippingMock->expects($this->once()) - ->method('getCountryId') - ->willReturn('CountryId'); + $this->scopeConfig->method('getValue') + ->willReturnMap([ + ['payment/payflowpro/user', ScopeInterface::SCOPE_STORE, null, 'user'], + ['payment/payflowpro/vendor', ScopeInterface::SCOPE_STORE, null, 'vendor'], + ['payment/payflowpro/partner', ScopeInterface::SCOPE_STORE, null, 'partner'], + ['payment/payflowpro/pwd', ScopeInterface::SCOPE_STORE, null, 'pwd'], + ['payment/payflowpro/verbosity', ScopeInterface::SCOPE_STORE, null, 'verbosity'], + ]); + $this->paymentConfig->method('getBuildNotationCode')->willReturn('BUTTONSOURCE'); + $this->payment->method('getAdditionalInformation') + ->willReturnMap([ + [Payflowpro::PNREF, 'XXXXXXXXXXXX'], + ]); + $this->order->method('getIncrementId')->willReturn('000000001'); + $this->order->method('getBaseCurrencyCode')->willReturn('USD'); + $this->payPalCart->method('getSubtotal')->willReturn(5.00); + $this->payPalCart->method('getTax')->willReturn(5.00); + $this->payPalCart->method('getShipping')->willReturn(5.00); + $this->payPalCart->method('getDiscount')->willReturn(5.00); + + $this->payPalPayflowGateway->expects($this->once()) + ->method('postRequest') + ->with($this->equalTo($validAuthorizeRequest)); + + $this->subject->authorize($this->payment, 10); } /** - * @return \Magento\Framework\DataObject + * @return array */ - protected function crateVoidResponseMock() + public function validAuthorizeRequestDataProvider(): array { - $voidResponseMock = new \Magento\Framework\DataObject( + return [ [ - 'result_code' => Transparent::RESPONSE_CODE_APPROVED, - 'pnref' => 'test-pnref' + new DataObject([ + 'user' => 'user', + 'vendor' => 'vendor', + 'partner' => 'partner', + 'pwd' => 'pwd', + 'verbosity' => 'verbosity', + 'BUTTONSOURCE' => 'BUTTONSOURCE', + 'tender' => 'C', + 'custref' => '000000001', + 'invnum' => '000000001', + 'comment_1' => '000000001', + 'trxtype' => 'A', + 'origid' => 'XXXXXXXXXXXX', + 'amt' => '10.00', + 'currency' => 'USD', + 'itemamt' => '5.00', + 'taxamt' => '5.00', + 'freightamt' => '5.00', + 'discount' => '5.00', + ]), ] - ); - - $this->responseMock->setData(Transparent::PNREF, 'test-pnref'); - - $this->paymentMock->expects($this->once()) - ->method('setParentTransactionId') - ->with('test-pnref'); - $this->paymentMock->expects($this->once()) - ->method('getParentTransactionId') - ->willReturn('test-pnref'); - $this->paymentMock->expects($this->once()) - ->method('setTransactionId') - ->with('test-pnref') - ->willReturnSelf(); - $this->paymentMock->expects($this->once()) - ->method('setIsTransactionClosed') - ->with(1) - ->willReturnSelf(); - $this->paymentMock->expects($this->once()) - ->method('setShouldCloseParentTransaction') - ->with(1); - - return $voidResponseMock; + ]; } /** - * @expectedException \Exception + * @return PaymentConfigInterfaceFactory|MockObject */ - public function testAuthorizeException() + private function getPaymentConfigInterfaceFactory() { - $this->initializationAuthorizeMock(); - $this->buildRequestData(); + $paymentConfigInterfaceFactory = $this->getMockBuilder(PaymentConfigInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->paymentConfig = $this->getMockBuilder(PaymentConfigInterface::class) + ->setMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode']) + ->getMockForAbstractClass(); - $this->gatewayMock->expects($this->once()) - ->method('postRequest') - ->willThrowException(new \Exception()); + $paymentConfigInterfaceFactory->method('create')->willReturn($this->paymentConfig); - $this->object->authorize($this->paymentMock, 33); + return $paymentConfigInterfaceFactory; } /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The payment couldn't be processed at this time. Please try again later. + * @return PaymentExtensionInterfaceFactory|MockObject */ - public function testAuthorizeValidationException() + private function getPaymentExtensionInterfaceFactory() { - $this->initializationAuthorizeMock(); - $this->buildRequestData(); - $voidResponseMock = $this->crateVoidResponseMock(); + $paymentExtensionInterfaceFactory = $this->getMockBuilder(PaymentExtensionInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $orderPaymentExtension = $this->getMockBuilder(OrderPaymentExtensionInterface::class) + ->setMethods(['setVaultPaymentToken']) + ->disableOriginalConstructor() + ->getMock(); - $this->gatewayMock->expects($this->at(0)) - ->method('postRequest') - ->willReturn($this->responseMock); + $paymentExtensionInterfaceFactory->method('create')->willReturn($orderPaymentExtension); - $this->responseValidator->expects($this->once()) - ->method('validate') - ->with($this->responseMock) - ->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('Error'))); + return $paymentExtensionInterfaceFactory; + } - $this->gatewayMock->expects($this->at(1)) - ->method('postRequest') - ->willReturn($voidResponseMock); + /** + * @return StoreManagerInterface|MockObject + */ + private function getStoreManager() + { + $storeManager = $this->getMockBuilder(StoreManagerInterface::class) + ->getMockForAbstractClass(); + $store = $this->getMockBuilder(StoreInterface::class) + ->getMockForAbstractClass(); + + $storeManager->method('getStore')->willReturn($store); - $this->paymentMock->expects($this->once()) - ->method('getAdditionalInformation') - ->with(Payflowpro::PNREF) - ->willReturn('test-pnref'); + return $storeManager; + } - $this->responseMock->setData('result_code', Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER); + /** + * @return PayPalPayflowGateway|MockObject + */ + private function getPayPalPayflowGateway() + { + $this->payPalPayflowGateway = $this->getMockBuilder(PayPalPayflowGateway::class) + ->disableOriginalConstructor() + ->getMock(); + $this->payPalPayflowGateway->method('postRequest') + ->willReturn(new DataObject()); - $this->object->authorize($this->paymentMock, 33); + return $this->payPalPayflowGateway; } /** - * @param int $resultCode - * @param int $origResult - * - * @expectedException \Magento\Framework\Exception\LocalizedException - * @dataProvider authorizeLocalizedExceptionDataProvider + * @return PaymentTokenInterfaceFactory|MockObject */ - public function testAuthorizeLocalizedException( - $resultCode, - $origResult - ) { - $this->initializationAuthorizeMock(); - $this->buildRequestData(); + private function getPaymentTokenFactory() + { + $paymentTokenInterfaceFactory = $this->getMockBuilder(PaymentTokenInterfaceFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $this->paymentToken = $this->getMockBuilder(PaymentTokenInterface::class) + ->getMockForAbstractClass(); - $this->responseMock->setData('result_code', $resultCode); - $this->responseMock->setData('origresult', $origResult); + $paymentTokenInterfaceFactory->method('create')->willReturn($this->paymentToken); - $this->gatewayMock->expects($this->exactly(1)) - ->method('postRequest') - ->willReturn($this->responseMock); - $this->object->authorize($this->paymentMock, 33); + return $paymentTokenInterfaceFactory; } /** - * @return array + * @return PayPalCartFactory|MockObject */ - public function authorizeLocalizedExceptionDataProvider() + private function getPayPalCartFactory() { - return [ - [ - 'origResult' => Payflowpro::RESPONSE_CODE_APPROVED, - 'resultCode' => Payflowpro::RESPONSE_CODE_DECLINED_BY_FILTER - ], - [ - 'origResult' => Payflowpro::RESPONSE_CODE_DECLINED_BY_FILTER, - 'resultCode' => Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER - ], - [ - 'origResult' => Payflowpro::RESPONSE_CODE_DECLINED, - 'resultCode' => 1111111111 - ], - [ - 'origResult' => 3432432423, - 'resultCode' => 23233432423 - ], - ]; + $payPalCartFactory = $this->getMockBuilder(PayPalCartFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->payPalCart = $this->getMockBuilder(PayPalCart::class) + ->disableOriginalConstructor() + ->getMock(); + + $payPalCartFactory->method('create')->willReturn($this->payPalCart); + + return $payPalCartFactory; } /** - * Test method - * with resultCode = RESPONSE_CODE_APPROVED and Origresult != RESPONSE_CODE_FRAUDSERVICE_FILTER + * @return ScopeConfigInterface|MockObject */ - public function testAuthorize() + private function getScopeConfig() { - $this->initializationAuthorizeMock(); - $this->buildRequestData(); - - $paymentTokenMock = $this->createMock(PaymentTokenInterface::class); - $extensionAttributes = $this->getMockBuilder(\Magento\Sales\Api\Data\OrderPaymentExtensionInterface::class) - ->disableOriginalConstructor() - ->setMethods(['setVaultPaymentToken']) + $this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class) ->getMockForAbstractClass(); - $ccDetails = [ - 'cc_type' => 'VI', - 'cc_number' => '1111' - ]; - - $this->responseMock->setData('result_code', Payflowpro::RESPONSE_CODE_APPROVED); - $this->responseMock->setData('origresult', 0); - $this->responseMock->setData('pnref', 'test-pnref'); - - $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($this->responseMock); - - $this->responseValidator->expects($this->once()) - ->method('validate') - ->with($this->responseMock); - - $this->paymentMock->expects($this->once()) - ->method('setTransactionId') - ->with('test-pnref') - ->willReturnSelf(); - $this->paymentMock->expects($this->once()) - ->method('setIsTransactionClosed') - ->with(0); - $this->paymentMock->expects($this->once()) - ->method('getCcExpYear') - ->willReturn('2017'); - $this->paymentMock->expects($this->once()) - ->method('getCcExpMonth') - ->willReturn('12'); - $this->paymentMock->expects(static::any()) - ->method('getAdditionalInformation') - ->willReturnMap( - [ - [Transparent::CC_DETAILS, $ccDetails], - [Transparent::PNREF, 'test-pnref'] - ] - ); - $this->paymentTokenFactory->expects(static::once()) - ->method('create') - ->willReturn($paymentTokenMock); - $paymentTokenMock->expects(static::once()) - ->method('setGatewayToken') - ->with('test-pnref'); - $paymentTokenMock->expects(static::once()) - ->method('setTokenDetails') - ->with(json_encode($ccDetails)); - $paymentTokenMock->expects(static::once()) - ->method('setExpiresAt') - ->with('2018-01-01 00:00:00'); - - $this->paymentMock->expects(static::once()) - ->method('getExtensionAttributes') - ->willReturn($extensionAttributes); - $extensionAttributes->expects(static::once()) - ->method('setVaultPaymentToken') - ->with($paymentTokenMock); - - $this->paymentMock->expects($this->at(8)) - ->method('unsAdditionalInformation') - ->with(Transparent::CC_DETAILS); - $this->paymentMock->expects($this->at(9)) - ->method('unsAdditionalInformation') - ->with(Transparent::PNREF); - - $this->assertSame($this->object, $this->object->authorize($this->paymentMock, 33)); + return $this->scopeConfig; } /** - * @covers \Magento\Paypal\Model\Payflow\Transparent::getInfoBlockType() + * @return Payment|MockObject */ - public function testGetInfoBlockType() + private function initPayment() { - static::assertEquals(Info::class, $this->object->getInfoBlockType()); + $this->payment = $this->getMockBuilder(Payment::class) + ->disableOriginalConstructor() + ->getMock(); + $this->order = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->payment->method('getOrder')->willReturn($this->order); + $this->payment->method('setTransactionId')->willReturnSelf(); + $this->payment->method('setIsTransactionClosed')->willReturnSelf(); + $this->payment->method('getCcExpYear')->willReturn('2019'); + $this->payment->method('getCcExpMonth')->willReturn('05'); + + return $this->payment; } } From 65ed52270942a551fa26797e26ff69b6f3e5abf4 Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@adobe.com> Date: Thu, 30 May 2019 17:25:17 -0500 Subject: [PATCH 298/464] MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method - fixed static failures --- .../Customer/PlaceOrderWithAuthorizeNetTest.php | 2 ++ .../SetAuthorizeNetPaymentMethodOnCartTest.php | 2 +- .../Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php | 11 ++++++----- .../_files/simple_product_authorizenet.php | 6 ++++-- .../_files/simple_product_authorizenet_rollback.php | 1 + 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php index 5c9eb3ad97274..1f9d5574ad3c3 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php @@ -143,7 +143,9 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void $this->request->setHeaders($webApiRequest->getHeaders()); $graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class); + // phpcs:ignore Magento2.Security.IncludeFile $expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php'; + // phpcs:ignore Magento2.Security.IncludeFile $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; $this->clientMock->method('setRawData') diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php index 68dc97e502bc0..4c84bbf0b58aa 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php @@ -22,7 +22,7 @@ * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SetAuthorizenetPaymentMethodOnCartTest extends TestCase +class SetAuthorizeNetPaymentMethodOnCartTest extends TestCase { const CONTENT_TYPE = 'application/json'; diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php index 45d4f59a3f7a6..1be7069b90cda 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php @@ -95,9 +95,9 @@ protected function setUp() : void */ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void { - $paymentMethod = 'authorizenet_acceptjs'; - $cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query + $paymentMethod = 'authorizenet_acceptjs'; + $cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $query = <<<QUERY mutation { setPaymentMethodOnCart(input: { @@ -135,8 +135,9 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void $headers = $this->objectManager->create(\Zend\Http\Headers::class) ->addHeaders(['Content-Type' => 'application/json']); $this->request->setHeaders($headers); - + // phpcs:ignore Magento2.Security.IncludeFile $expectedRequest = include __DIR__ . '/../../../_files/request_authorize.php'; + // phpcs:ignore Magento2.Security.IncludeFile $authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php'; $this->clientMock->method('setRawData') @@ -147,7 +148,7 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void $response = $this->graphql->dispatch($this->request); $responseData = $this->jsonSerializer->unserialize($response->getContent()); - $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); + $this->assertArrayNotHasKey('errors', $responseData, 'Response has errors'); $this->assertTrue( isset($responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']) ); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php index 47070c9af9095..50ec950853711 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php @@ -36,10 +36,12 @@ /** Out of interface */ $product ->setWebsiteIds([1]) - ->setStockData([ + ->setStockData( + [ 'qty' => 85.5, 'is_in_stock' => true, 'manage_stock' => true, 'is_qty_decimal' => true - ]); + ] + ); $productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php index 955f613e213bb..6b37585f8224f 100644 --- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php +++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php @@ -4,4 +4,5 @@ * See COPYING.txt for license details. */ +// phpcs:ignore Magento2.Security.IncludeFile require __DIR__ . '/../../GraphQl/Catalog/_files/simple_product_rollback.php'; From 19ea6d7b35f7a426367b234bdbfa1d7d93d467b1 Mon Sep 17 00:00:00 2001 From: Vishal Gelani <vishalgelani99@gmail.com> Date: Fri, 31 May 2019 11:35:26 +0530 Subject: [PATCH 299/464] Update Generator.php --- app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index e17e2b72efa50..c092f585c5203 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -44,7 +44,7 @@ class Generator extends AbstractSchemaGenerator /** * Wrapper node for XML requests */ - const XML_SCHEMA_PARAMWRAPPER = 'request'; + private const XML_SCHEMA_PARAMWRAPPER = 'request'; /** * Swagger factory instance. @@ -203,7 +203,7 @@ protected function getGeneralInfo() * * @return array */ - protected function getConsumableDatatypes() + private function getConsumableDatatypes() { return [ 'application/json', @@ -216,7 +216,7 @@ protected function getConsumableDatatypes() * * @return array */ - protected function getProducibleDatatypes() + private function getProducibleDatatypes() { return [ 'application/json', From 460a24942b307e255b3558dd81c50e391494983d Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Fri, 31 May 2019 10:47:42 +0300 Subject: [PATCH 300/464] api functional test for WebapiAsync --- .../Model/AsyncScheduleMultiStoreTest.php | 363 ++++++++++++++++++ 1 file changed, 363 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php diff --git a/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php new file mode 100644 index 0000000000000..8f2108d3d2cf5 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php @@ -0,0 +1,363 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\WebapiAsync\Model; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\Exception\NotFoundException; +use Magento\TestFramework\MessageQueue\PreconditionFailedException; +use Magento\TestFramework\MessageQueue\PublisherConsumerController; +use Magento\TestFramework\MessageQueue\EnvironmentPreconditionException; +use Magento\TestFramework\TestCase\WebapiAbstract; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Framework\Phrase; +use Magento\Framework\Registry; +use Magento\Framework\Webapi\Exception; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Api\Data\ProductInterface as Product; + +/** + * Check async request for multistore product creation service, scheduling bulk + * to rabbitmq running consumers and check async.operation.add consumer check + * if product was created by async requests + * + * @magentoAppIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class AsyncScheduleMultiStoreTest extends WebapiAbstract +{ + const SERVICE_NAME = 'catalogProductRepositoryV1'; + const SERVICE_VERSION = 'V1'; + const REST_RESOURCE_PATH = '/V1/products'; + const ASYNC_RESOURCE_PATH = '/async/V1/products'; + const ASYNC_CONSUMER_NAME = 'async.operations.all'; + + const STORE_CODE_FROM_FIXTURE = 'fixturestore'; + const STORE_NAME_FROM_FIXTURE = 'Fixture Store'; + + const STORE_CODE_ALL = 'all'; + const STORE_CODE_DEFAULT = 'default'; + + private $stores = [ + self::STORE_CODE_DEFAULT, + self::STORE_CODE_ALL, + self::STORE_CODE_FROM_FIXTURE, + ]; + + const KEY_TIER_PRICES = 'tier_prices'; + const KEY_SPECIAL_PRICE = 'special_price'; + const KEY_CATEGORY_LINKS = 'category_links'; + + const BULK_UUID_KEY = 'bulk_uuid'; + + protected $consumers = [ + self::ASYNC_CONSUMER_NAME, + ]; + + /** + * @var string[] + */ + private $skus = []; + + /** + * @var PublisherConsumerController + */ + private $publisherConsumerController; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + /** + * @var Registry + */ + private $registry; + + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->logFilePath = TESTS_TEMP_DIR . "/MessageQueueTestLog.txt"; + $this->registry = $this->objectManager->get(Registry::class); + + $params = array_merge_recursive( + \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInitParams(), + ['MAGE_DIRS' => ['cache' => ['path' => TESTS_TEMP_DIR . '/cache']]] + ); + + /** @var PublisherConsumerController publisherConsumerController */ + $this->publisherConsumerController = $this->objectManager->create(PublisherConsumerController::class, [ + 'consumers' => $this->consumers, + 'logFilePath' => $this->logFilePath, + 'appInitParams' => $params, + ]); + $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + + try { + $this->publisherConsumerController->initialize(); + } catch (EnvironmentPreconditionException $e) { + $this->markTestSkipped($e->getMessage()); + } catch (PreconditionFailedException $e) { + $this->fail( + $e->getMessage() + ); + } + + parent::setUp(); + } + + /** + * @dataProvider storeProvider + * @magentoApiDataFixture Magento/Store/_files/core_fixturestore.php + */ + public function testAsyncScheduleBulkMultistore($storeCode) + { + $product = $this->getProductData(); + $this->_markTestAsRestOnly(); + + /** @var $store \Magento\Store\Model\Group */ + $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + $store->load(self::STORE_CODE_FROM_FIXTURE); + $this->assertEquals( + self::STORE_NAME_FROM_FIXTURE, + $store->getName(), + 'Precondition failed: fixture store was not created.' + ); + + try { + /** @var \Magento\Catalog\Model\Product $productModel */ + $productModel = Bootstrap::getObjectManager()->create( + \Magento\Catalog\Model\Product::class, + ['data' => $product['product']] + ); + $this->productRepository->save($productModel); + } catch (\Exception $e) { + $this->fail("Precondition failed: product was not created."); + } + + $this->asyncScheduleAndTest($product, $storeCode); + $this->clearProducts(); + } + + private function asyncScheduleAndTest($product, $storeCode = null) + { + $sku = $product['product'][Product::SKU]; + $productName = $product['product'][Product::NAME]; + $newProductName = $product['product'][Product::NAME] . $storeCode; + + $this->skus[] = $sku; + + $product['product'][Product::NAME] = $newProductName; + $product['product'][Product::TYPE_ID] = 'virtual'; + + $response = $this->updateProductAsync($product, $sku, $storeCode); + + $this->assertArrayHasKey(self::BULK_UUID_KEY, $response); + $this->assertNotNull($response[self::BULK_UUID_KEY]); + + $this->assertCount(1, $response['request_items']); + $this->assertEquals('accepted', $response['request_items'][0]['status']); + $this->assertFalse($response['errors']); + + //assert one products is created + try { + $this->publisherConsumerController->waitForAsynchronousResult( + [$this, 'assertProductCreation'], + [$product] + ); + } catch (PreconditionFailedException $e) { + $this->fail("Not all products were created"); + } + + $requestData = ['id' => $sku, 'sku' => $sku]; + + foreach ($this->stores as $checkingStore) { + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::REST_RESOURCE_PATH . '/' . $sku, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET + ] + ]; + $storeResponse = $this->_webApiCall($serviceInfo, $requestData, null, $checkingStore); + if ($checkingStore == $storeCode || $storeCode == self::STORE_CODE_ALL) { + $this->assertEquals( + $newProductName, + $storeResponse[Product::NAME], + sprintf( + 'Product name in %s store is invalid after updating in store %s.', + $checkingStore, + $storeCode + ) + ); + } else { + $this->assertEquals( + $productName, + $storeResponse[Product::NAME], + sprintf( + 'Product name in %s store is invalid after updating in store %s.', + $checkingStore, + $storeCode + ) + ); + } + } + } + + public function tearDown() + { + $this->clearProducts(); + $this->publisherConsumerController->stopConsumers(); + parent::tearDown(); + } + + private function clearProducts() + { + $size = $this->objectManager->create(Collection::class) + ->addAttributeToFilter('sku', ['in' => $this->skus]) + ->load() + ->getSize(); + + if ($size == 0) { + return; + } + + $this->registry->unregister('isSecureArea'); + $this->registry->register('isSecureArea', true); + try { + foreach ($this->skus as $sku) { + $this->productRepository->deleteById($sku); + } + } catch (\Exception $e) { + throw $e; + //nothing to delete + } + $this->registry->unregister('isSecureArea'); + + $size = $this->objectManager->create(Collection::class) + ->addAttributeToFilter('sku', ['in' => $this->skus]) + ->load() + ->getSize(); + + if ($size > 0) { + throw new Exception(new Phrase("Collection size after clearing the products: %size", ['size' => $size])); + } + $this->skus = []; + } + + /** + * @return array + */ + public function getProductData() + { + $productBuilder = function ($data) { + return array_replace_recursive( + $this->getSimpleProductData(), + $data + ); + }; + + return [ + 'product' => + $productBuilder([ + ProductInterface::TYPE_ID => 'simple', + ProductInterface::SKU => 'multistore-sku-test-1', + ProductInterface::NAME => 'Test Name ', + ]), + ]; + } + + public function storeProvider() + { + $dataSets = []; + foreach ($this->stores as $store) { + $dataSets[$store] = [$store]; + } + return $dataSets; + } + + /** + * Get Simple Product Data + * + * @param array $productData + * @return array + */ + private function getSimpleProductData($productData = []) + { + return [ + ProductInterface::SKU => isset($productData[ProductInterface::SKU]) + ? $productData[ProductInterface::SKU] : uniqid('sku-', true), + ProductInterface::NAME => isset($productData[ProductInterface::NAME]) + ? $productData[ProductInterface::NAME] : uniqid('sku-', true), + ProductInterface::VISIBILITY => 4, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::PRICE => 3.62, + ProductInterface::STATUS => 1, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::ATTRIBUTE_SET_ID => 4, + ]; + } + + /** + * @param $requestData + * @param string|null $storeCode + * @return mixed + */ + private function updateProductAsync($requestData, $sku, $storeCode = null) + { + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::ASYNC_RESOURCE_PATH . '/' . $sku, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + ], + ]; + + return $this->_webApiCall($serviceInfo, $requestData, null, $storeCode); + } + + public function assertProductCreation($product) + { + $sku = $product['product'][Product::SKU]; + $collection = $this->objectManager->create(Collection::class) + ->addAttributeToFilter(Product::SKU, ['eq' => $sku]) + ->addAttributeToFilter(Product::TYPE_ID, ['eq' => 'virtual']) + ->load(); + $size = $collection->getSize(); + + return $size > 0; + } + + /** + * Remove test store + */ + public static function tearDownAfterClass() + { + parent::tearDownAfterClass(); + /** @var \Magento\Framework\Registry $registry */ + $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Framework\Registry::class); + + $registry->unregister('isSecureArea'); + $registry->register('isSecureArea', true); + + /** @var $store \Magento\Store\Model\Store */ + $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + $store->load('fixturestore'); + if ($store->getId()) { + $store->delete(); + } + + $registry->unregister('isSecureArea'); + $registry->register('isSecureArea', false); + } +} From c336e36091438a7c9d2205ab7013846a39e2c6e9 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Fri, 31 May 2019 11:03:52 +0300 Subject: [PATCH 301/464] WebapiAsync fix FQDN class name in api functional test --- .../Model/AsyncScheduleMultiStoreTest.php | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php index 8f2108d3d2cf5..a9bac96dd6c3f 100644 --- a/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php +++ b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php @@ -9,7 +9,6 @@ namespace Magento\WebapiAsync\Model; use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Framework\Exception\NotFoundException; use Magento\TestFramework\MessageQueue\PreconditionFailedException; use Magento\TestFramework\MessageQueue\PublisherConsumerController; use Magento\TestFramework\MessageQueue\EnvironmentPreconditionException; @@ -21,6 +20,9 @@ use Magento\Framework\Webapi\Exception; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Api\Data\ProductInterface as Product; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Model\Store; +use Magento\Framework\Webapi\Rest\Request; /** * Check async request for multistore product creation service, scheduling bulk @@ -76,7 +78,7 @@ class AsyncScheduleMultiStoreTest extends WebapiAbstract private $productRepository; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var ObjectManagerInterface */ private $objectManager; @@ -92,7 +94,7 @@ protected function setUp() $this->registry = $this->objectManager->get(Registry::class); $params = array_merge_recursive( - \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInitParams(), + Bootstrap::getInstance()->getAppInitParams(), ['MAGE_DIRS' => ['cache' => ['path' => TESTS_TEMP_DIR . '/cache']]] ); @@ -126,8 +128,8 @@ public function testAsyncScheduleBulkMultistore($storeCode) $product = $this->getProductData(); $this->_markTestAsRestOnly(); - /** @var $store \Magento\Store\Model\Group */ - $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + /** @var Store $store */ + $store = $this->objectManager->create(Store::class); $store->load(self::STORE_CODE_FROM_FIXTURE); $this->assertEquals( self::STORE_NAME_FROM_FIXTURE, @@ -136,9 +138,9 @@ public function testAsyncScheduleBulkMultistore($storeCode) ); try { - /** @var \Magento\Catalog\Model\Product $productModel */ - $productModel = Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product::class, + /** @var Product $productModel */ + $productModel = $this->objectManager->create( + Product::class, ['data' => $product['product']] ); $this->productRepository->save($productModel); @@ -186,7 +188,7 @@ private function asyncScheduleAndTest($product, $storeCode = null) $serviceInfo = [ 'rest' => [ 'resourcePath' => self::REST_RESOURCE_PATH . '/' . $sku, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET + 'httpMethod' => Request::HTTP_METHOD_GET ] ]; $storeResponse = $this->_webApiCall($serviceInfo, $requestData, null, $checkingStore); @@ -318,7 +320,7 @@ private function updateProductAsync($requestData, $sku, $storeCode = null) $serviceInfo = [ 'rest' => [ 'resourcePath' => self::ASYNC_RESOURCE_PATH . '/' . $sku, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + 'httpMethod' => Request::HTTP_METHOD_PUT, ], ]; @@ -343,15 +345,14 @@ public function assertProductCreation($product) public static function tearDownAfterClass() { parent::tearDownAfterClass(); - /** @var \Magento\Framework\Registry $registry */ - $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Framework\Registry::class); + /** @var Registry $registry */ + $registry = Bootstrap::getObjectManager()->get(Registry::class); $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); - /** @var $store \Magento\Store\Model\Store */ - $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + /** @var Store $store*/ + $store = Bootstrap::getObjectManager()->create(Store::class); $store->load('fixturestore'); if ($store->getId()) { $store->delete(); From 43fd7477506446348d1ac551a979c1a0eb0034b3 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Fri, 31 May 2019 12:20:22 +0300 Subject: [PATCH 302/464] MAGETWO-99616: Magento font icons are not loading when deployment optimization is implemented --- .../Processor/PostProcessor/CssUrls.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php b/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php index 1c139d5682df1..ffef9064b92b5 100644 --- a/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php +++ b/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php @@ -69,6 +69,7 @@ public function process(Package $package, array $options) /** @var PackageFile $file */ foreach (array_keys($package->getMap()) as $fileId) { $filePath = str_replace(\Magento\Framework\View\Asset\Repository::FILE_ID_SEPARATOR, '/', $fileId); + // phpcs:ignore Magento2.Functions.DiscouragedFunction if (strtolower(pathinfo($fileId, PATHINFO_EXTENSION)) == 'css') { $urlMap = $this->parseCss( $urlMap, @@ -100,6 +101,7 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent { $cssFilePath = $this->minification->addMinifiedSign($cssFilePath); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $cssFileBasePath = pathinfo($cssFilePath, PATHINFO_DIRNAME); $urls = $this->getCssUrls($cssContent); foreach ($urls as $url) { @@ -124,6 +126,22 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent . str_repeat('../', count(explode('/', $cssFileBasePath))) . $this->minification->addMinifiedSign($matchedFile->getDeployedFilePath()) ]; + } else { + $filePathInBase = $package->getArea() . + '/' . + Package::BASE_THEME . + '/' . + $package->getLocale() . + '/' . + $lookupFileId; + if ($this->staticDir->isReadable($this->minification->addMinifiedSign($filePathInBase))) { + $urlMap[$url][] = [ + 'filePath' => $this->minification->addMinifiedSign($packagePath . '/' . $cssFilePath), + 'replace' => '../../../../' // base path is always of four chunks size + . str_repeat('../', count(explode('/', $cssFileBasePath))) + . $this->minification->addMinifiedSign($filePathInBase) + ]; + } } } return $urlMap; From 7ea09873b099ca253bc5f9e83f45ea1eaf982686 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Fri, 31 May 2019 15:59:00 +0300 Subject: [PATCH 303/464] MAGETWO-99616: Magento font icons are not loading when deployment optimization is implemented --- .../Package/Processor/PostProcessor/CssUrls.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php b/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php index ffef9064b92b5..667232313a871 100644 --- a/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php +++ b/app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php @@ -128,22 +128,19 @@ private function parseCss(array $urlMap, $cssFilePath, $packagePath, $cssContent ]; } else { $filePathInBase = $package->getArea() . - '/' . - Package::BASE_THEME . - '/' . - $package->getLocale() . - '/' . - $lookupFileId; + '/' . Package::BASE_THEME . + '/' . $package->getLocale() . + '/' . $lookupFileId; if ($this->staticDir->isReadable($this->minification->addMinifiedSign($filePathInBase))) { $urlMap[$url][] = [ 'filePath' => $this->minification->addMinifiedSign($packagePath . '/' . $cssFilePath), - 'replace' => '../../../../' // base path is always of four chunks size - . str_repeat('../', count(explode('/', $cssFileBasePath))) - . $this->minification->addMinifiedSign($filePathInBase) + 'replace' => str_repeat('../', count(explode('/', $cssFileBasePath)) + 4) + . $this->minification->addMinifiedSign($filePathInBase), ]; } } } + return $urlMap; } From 01551217ed8473d692212df8873aea9c19306c7e Mon Sep 17 00:00:00 2001 From: Alexey Arendarenko <alexeya@ven.com> Date: Fri, 31 May 2019 16:24:01 +0300 Subject: [PATCH 304/464] Fix missing whitespace in JS navigation on mobile devices fix incorrect translation for mobile navigation items with "All" prefix --- lib/web/mage/menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index b8000640506f1..beddd1923beb3 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -461,7 +461,7 @@ define([ this.categoryLink = $('<a>') .attr('href', categoryUrl) - .text($.mage.__('All ') + category); + .text($.mage.__('All %1').replace('%1', category)); this.categoryParent = $('<li>') .addClass('ui-menu-item all-category') From 1bcf43e748a70304974e9f99bf24e3affd7546f7 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Fri, 31 May 2019 09:00:39 -0500 Subject: [PATCH 305/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 4e532c9d48cc6..e1ad21231f725 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -126,7 +126,7 @@ define([ } if (!shiftedValue.isValid()) { - shiftedValue = moment(value, this.inputDateFormat); + shiftedValue = moment(value, this.pickerDateTimeFormat); } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { From e1af0e72ac1ff621b6f1d3a2de9ab10aee29f517 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 09:28:32 -0500 Subject: [PATCH 306/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable tests - Fixing tests that clear schedule update filters but don't wait properly --- ...torefrontVerifySearchSuggestionByProductDescriptionTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index 9e3ed2def2f87..0446d64b792c2 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-14765"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> From 0c651cca64912c59d80ad09b02d13018dfac9f13 Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin <dyushkin@adobe.com> Date: Fri, 31 May 2019 11:12:18 -0500 Subject: [PATCH 307/464] MAGETWO-99035: Payflow Field format error: 10413-The totals of the cart item amounts do not match order amounts. --- app/code/Magento/Paypal/Model/Cart.php | 1 + .../Paypal/Model/Payflow/Transparent.php | 13 +++- .../Paypal/Test/Unit/Model/CartTest.php | 3 + .../Unit/Model/Payflow/TransparentTest.php | 66 ++++++++++--------- 4 files changed, 52 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Paypal/Model/Cart.php b/app/code/Magento/Paypal/Model/Cart.php index 32451bbad363f..90bc2b5e632de 100644 --- a/app/code/Magento/Paypal/Model/Cart.php +++ b/app/code/Magento/Paypal/Model/Cart.php @@ -9,6 +9,7 @@ /** * PayPal-specific model for shopping cart items and totals + * * The main idea is to accommodate all possible totals into PayPal-compatible 4 totals and line items */ class Cart extends \Magento\Payment\Model\Cart diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index 4a3975dc05393..1fb322b7a8199 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Paypal\Model\Payflow; @@ -134,6 +135,8 @@ public function __construct( } /** + * Gets response validator instance. + * * @return ResponseValidator */ public function getResponceValidator() @@ -189,6 +192,7 @@ public function authorize(InfoInterface $payment, $amount) try { $this->responseValidator->validate($response, $this); + // phpcs:ignore Magento2.Exceptions.DirectThrow } catch (LocalizedException $exception) { $payment->setParentTransactionId($response->getData(self::PNREF)); $this->void($payment); @@ -214,10 +218,12 @@ public function getConfigInterface() } /** + * Creates vault payment token. + * * @param Payment $payment * @param string $token - * @throws LocalizedException * @return void + * @throws \Exception */ protected function createPaymentToken(Payment $payment, $token) { @@ -236,8 +242,11 @@ protected function createPaymentToken(Payment $payment, $token) } /** + * Generates CC expiration date by year and month provided in payment. + * * @param Payment $payment * @return string + * @throws \Exception */ private function getExpirationDate(Payment $payment) { @@ -256,6 +265,8 @@ private function getExpirationDate(Payment $payment) } /** + * Returns payment extension attributes instance. + * * @param Payment $payment * @return \Magento\Sales\Api\Data\OrderPaymentExtensionInterface */ diff --git a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php index 0f787f0f513a1..88e7ee152b5de 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/CartTest.php @@ -7,6 +7,9 @@ use Magento\Paypal\Model\Cart; +/** + * @see \Magento\Paypal\Model\Cart + */ class CartTest extends \PHPUnit\Framework\TestCase { /** diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php index 03383e6599961..f6df35ae272b7 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php @@ -103,18 +103,22 @@ public function setUp() public function testValidAuthorizeRequest(DataObject $validAuthorizeRequest) { $this->scopeConfig->method('getValue') - ->willReturnMap([ - ['payment/payflowpro/user', ScopeInterface::SCOPE_STORE, null, 'user'], - ['payment/payflowpro/vendor', ScopeInterface::SCOPE_STORE, null, 'vendor'], - ['payment/payflowpro/partner', ScopeInterface::SCOPE_STORE, null, 'partner'], - ['payment/payflowpro/pwd', ScopeInterface::SCOPE_STORE, null, 'pwd'], - ['payment/payflowpro/verbosity', ScopeInterface::SCOPE_STORE, null, 'verbosity'], - ]); + ->willReturnMap( + [ + ['payment/payflowpro/user', ScopeInterface::SCOPE_STORE, null, 'user'], + ['payment/payflowpro/vendor', ScopeInterface::SCOPE_STORE, null, 'vendor'], + ['payment/payflowpro/partner', ScopeInterface::SCOPE_STORE, null, 'partner'], + ['payment/payflowpro/pwd', ScopeInterface::SCOPE_STORE, null, 'pwd'], + ['payment/payflowpro/verbosity', ScopeInterface::SCOPE_STORE, null, 'verbosity'], + ] + ); $this->paymentConfig->method('getBuildNotationCode')->willReturn('BUTTONSOURCE'); $this->payment->method('getAdditionalInformation') - ->willReturnMap([ - [Payflowpro::PNREF, 'XXXXXXXXXXXX'], - ]); + ->willReturnMap( + [ + [Payflowpro::PNREF, 'XXXXXXXXXXXX'], + ] + ); $this->order->method('getIncrementId')->willReturn('000000001'); $this->order->method('getBaseCurrencyCode')->willReturn('USD'); $this->payPalCart->method('getSubtotal')->willReturn(5.00); @@ -136,26 +140,28 @@ public function validAuthorizeRequestDataProvider(): array { return [ [ - new DataObject([ - 'user' => 'user', - 'vendor' => 'vendor', - 'partner' => 'partner', - 'pwd' => 'pwd', - 'verbosity' => 'verbosity', - 'BUTTONSOURCE' => 'BUTTONSOURCE', - 'tender' => 'C', - 'custref' => '000000001', - 'invnum' => '000000001', - 'comment_1' => '000000001', - 'trxtype' => 'A', - 'origid' => 'XXXXXXXXXXXX', - 'amt' => '10.00', - 'currency' => 'USD', - 'itemamt' => '5.00', - 'taxamt' => '5.00', - 'freightamt' => '5.00', - 'discount' => '5.00', - ]), + new DataObject( + [ + 'user' => 'user', + 'vendor' => 'vendor', + 'partner' => 'partner', + 'pwd' => 'pwd', + 'verbosity' => 'verbosity', + 'BUTTONSOURCE' => 'BUTTONSOURCE', + 'tender' => 'C', + 'custref' => '000000001', + 'invnum' => '000000001', + 'comment1' => '000000001', + 'trxtype' => 'A', + 'origid' => 'XXXXXXXXXXXX', + 'amt' => '10.00', + 'currency' => 'USD', + 'itemamt' => '5.00', + 'taxamt' => '5.00', + 'freightamt' => '5.00', + 'discount' => '5.00', + ] + ), ] ]; } From 7a1014b88d3c50ae3fbe28f0ef09ad75e0c73543 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Fri, 31 May 2019 11:12:41 -0500 Subject: [PATCH 308/464] MC-16608: Use escaper methods - clean up code --- .../adminhtml/templates/system/config/form/field/array.phtml | 2 +- .../templates/widget/compared/content/compared_list.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index b9cb02927a78f..cf188bfeb6868 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -122,7 +122,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; // add existing rows <?php foreach ($block->getArrayRows() as $_rowId => $_row) { - echo /* @noEscape */ "arrayRow{$block->escapeJs($_htmlId)}.add(" . /* @noEscape */ $_row->toJson() . ");\n"; + echo /** @noEscape */ "arrayRow{$block->escapeJs($_htmlId)}.add(" . /** @noEscape */ $_row->toJson() . ");\n"; } ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index e262c4f89eac9..a9e79d037a498 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -72,7 +72,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($_item->isSaleable()) : ?> <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?> <button class="action tocart primary" - data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeHtmlAttr($block->escapeUrl($block->getAddToCartUrl($_item))) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> From 7a0776f9713254688cbfcada1a8abb30e2ffaf9f Mon Sep 17 00:00:00 2001 From: dyushkin <dyushkin@ebay.com> Date: Fri, 31 May 2019 12:07:11 -0500 Subject: [PATCH 309/464] MAGETWO-99035: Payflow Field format error: 10413-The totals of the cart item amounts do not match order amounts. --- app/code/Magento/Paypal/Model/Payflow/Transparent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index 1fb322b7a8199..3fa9114e91d12 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -192,10 +192,10 @@ public function authorize(InfoInterface $payment, $amount) try { $this->responseValidator->validate($response, $this); - // phpcs:ignore Magento2.Exceptions.DirectThrow } catch (LocalizedException $exception) { $payment->setParentTransactionId($response->getData(self::PNREF)); $this->void($payment); + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new LocalizedException(__("The payment couldn't be processed at this time. Please try again later.")); } From 8104d2023dc1a593a0f3e50e67ba661220de73c6 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Fri, 31 May 2019 12:37:34 -0500 Subject: [PATCH 310/464] MC-16873: Generate critical css file for LUMA --- .../view/frontend/templates/html/main_css_preloader.phtml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml index e0e7f8a1440e4..2c1c7db75b111 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/main_css_preloader.phtml @@ -1,3 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +?> <div data-role="main-css-loader" class="loading-mask"> <div class="loader"> <img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')); ?>" From 038615bec1a94679582895b9799caa70f59a35af Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Fri, 31 May 2019 20:46:06 +0300 Subject: [PATCH 311/464] reject message in consumer plugin instead of throw exception, add classes/methods comment, fix code style issues --- .../MassConsumerEnvelopeCallback.php | 21 ++++++++++++------- .../Plugin/Framework/Amqp/Bulk/Exchange.php | 11 +++++++--- app/code/Magento/AmqpStore/composer.json | 3 +++ app/code/Magento/AmqpStore/etc/module.xml | 1 - .../Model/MassConsumer.php | 1 + .../Model/MassConsumerEnvelopeCallback.php | 12 ++++++++++- 6 files changed, 36 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php index bcfdbea4fd3e3..efa5db19af1bd 100644 --- a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php @@ -26,10 +26,12 @@ class MassConsumerEnvelopeCallback * @var StoreManagerInterface */ private $storeManager; + /** * @var EnvelopeFactory */ private $envelopeFactory; + /** * @var LoggerInterface */ @@ -52,13 +54,13 @@ public function __construct( /** * Check if amqpProperties['application_headers'] have 'store_id' and use it to setCurrentStore - * Restore currentStore of consumer process after execution. + * Restore original store value in consumer process after execution. + * Reject queue messages because of wrong store_id. * * @param SubjectMassConsumerEnvelopeCallback $subject * @param callable $proceed * @param EnvelopeInterface $message - * @return array|null - * @throws NoSuchEntityException + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundExecute(SubjectMassConsumerEnvelopeCallback $subject, callable $proceed, EnvelopeInterface $message) @@ -75,19 +77,22 @@ public function aroundExecute(SubjectMassConsumerEnvelopeCallback $subject, call $currentStoreId = $this->storeManager->getStore()->getId(); } catch (NoSuchEntityException $e) { $this->logger->error( - sprintf("Can't set currentStoreId during processing queue. Error %s.", $e->getMessage()) + sprintf( + "Can't set currentStoreId during processing queue. Message rejected. Error %s.", + $e->getMessage() + ) ); - throw new NoSuchEntityException(__($e->getMessage())); + $subject->getQueue()->reject($message, false, $e->getMessage()); + return; } if (isset($storeId) && $storeId !== $currentStoreId) { $this->storeManager->setCurrentStore($storeId); } } } - $result = $proceed($message); + $proceed($message); if (isset($storeId, $currentStoreId) && $storeId !== $currentStoreId) { - $this->storeManager->setCurrentStore($currentStoreId);//restore previous current store + $this->storeManager->setCurrentStore($currentStoreId);//restore original store value } - return $result; } } diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index 97a6151220e12..df580e4a2a1c4 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -27,10 +27,12 @@ class Exchange * @var StoreManagerInterface */ private $storeManager; + /** * @var EnvelopeFactory */ private $envelopeFactory; + /** * @var LoggerInterface */ @@ -51,11 +53,14 @@ public function __construct( } /** + * Set current store_id in amqpProperties['application_headers'] + * so consumer may check store_id and execute operation in correct store scope. + * Prevent publishing inconsistent messages because of store_id not defined or wrong. + * * @param SubjectExchange $subject * @param $topic * @param EnvelopeInterface[] $envelopes - * @return array|null - * @throws NoSuchEntityException + * @return array * @throws AMQPInvalidArgumentException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -67,7 +72,7 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes $this->logger->error( sprintf("Can't get current storeId and inject to amqp message. Error %s.", $e->getMessage()) ); - throw new NoSuchEntityException(__($e->getMessage())); + throw new \Exception($e->getMessage()); } $updatedEnvelopes = []; diff --git a/app/code/Magento/AmqpStore/composer.json b/app/code/Magento/AmqpStore/composer.json index 3b64b11bb8db5..b3c6b79e2f6c2 100644 --- a/app/code/Magento/AmqpStore/composer.json +++ b/app/code/Magento/AmqpStore/composer.json @@ -11,6 +11,9 @@ "magento/module-store": "*", "php": "~7.1.3||~7.2.0" }, + "suggest": { + "magento/module-asynchronous-operations": "*" + }, "type": "magento2-module", "license": [ "OSL-3.0", diff --git a/app/code/Magento/AmqpStore/etc/module.xml b/app/code/Magento/AmqpStore/etc/module.xml index 3e2cd542338a2..085b97b5e2f96 100644 --- a/app/code/Magento/AmqpStore/etc/module.xml +++ b/app/code/Magento/AmqpStore/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_AmqpStore"> <sequence> - <module name="Magento_Amqp"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 2a0c56a10f2a2..49f1a582fb4cc 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -36,6 +36,7 @@ class MassConsumer implements ConsumerInterface * @var Registry */ private $registry; + /** * @var MassConsumerEnvelopeCallbackFactory */ diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php index f284b621b6df9..5d5dd5d294997 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php @@ -20,7 +20,7 @@ use Magento\Framework\MessageQueue\MessageController; /** - * Class used by \Magento\AsynchronousOperations\Model\MassConsumer as public callback function. + * Class used as public callback function by async consumer. * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class MassConsumerEnvelopeCallback @@ -85,6 +85,7 @@ public function __construct( * Get transaction callback. This handles the case of async. * * @param EnvelopeInterface $message + * @return void */ public function execute(EnvelopeInterface $message) { @@ -121,4 +122,13 @@ public function execute(EnvelopeInterface $message) } } } + + /** + * Get message queue. + * @return QueueInterface + */ + public function getQueue() + { + return $this->queue; + } } From fb06c338f05c3dc98d845dceec8daefd5693296e Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Fri, 31 May 2019 20:49:11 +0300 Subject: [PATCH 312/464] fix method params and return type block --- .../Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index df580e4a2a1c4..ae8ff6948fc42 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -58,10 +58,11 @@ public function __construct( * Prevent publishing inconsistent messages because of store_id not defined or wrong. * * @param SubjectExchange $subject - * @param $topic + * @param string $topic * @param EnvelopeInterface[] $envelopes * @return array * @throws AMQPInvalidArgumentException + * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes) From 5f6e24fa20087d3d37063bfab77ffca42625c9c5 Mon Sep 17 00:00:00 2001 From: Graham Wharton <graham@gwharton.me.uk> Date: Fri, 31 May 2019 18:53:08 +0100 Subject: [PATCH 313/464] Admin Product Page now copies image files from database to local storage in database storage mode. --- .../Product/Helper/Form/Gallery/Content.php | 28 ++++++- .../Helper/Form/Gallery/ContentTest.php | 76 ++++++++++++++++++- 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index 063503682f4db..f5d0ec7da617e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -19,6 +19,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Exception\FileSystemException; use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider; +use Magento\MediaStorage\Helper\File\Storage\Database; /** * Block for gallery content. @@ -50,25 +51,34 @@ class Content extends \Magento\Backend\Block\Widget */ private $imageUploadConfigDataProvider; + /** + * @var Database + */ + private $fileStorageDatabase; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig * @param array $data * @param ImageUploadConfigDataProvider $imageUploadConfigDataProvider + * @param Database $fileStorageDatabase */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\Product\Media\Config $mediaConfig, array $data = [], - ImageUploadConfigDataProvider $imageUploadConfigDataProvider = null + ImageUploadConfigDataProvider $imageUploadConfigDataProvider = null, + Database $fileStorageDatabase = null ) { $this->_jsonEncoder = $jsonEncoder; $this->_mediaConfig = $mediaConfig; parent::__construct($context, $data); $this->imageUploadConfigDataProvider = $imageUploadConfigDataProvider ?: ObjectManager::getInstance()->get(ImageUploadConfigDataProvider::class); + $this->fileStorageDatabase = $fileStorageDatabase + ?: ObjectManager::getInstance()->get(Database::class); } /** @@ -164,6 +174,13 @@ public function getImagesJson() $images = $this->sortImagesByPosition($value['images']); foreach ($images as &$image) { $image['url'] = $this->_mediaConfig->getMediaUrl($image['file']); + if ($this->fileStorageDatabase->checkDbUsage() && + !$mediaDir->isFile($this->_mediaConfig->getMediaPath($image['file'])) + ) { + $this->fileStorageDatabase->saveFileToFilesystem( + $this->_mediaConfig->getMediaPath($image['file']) + ); + } try { $fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file'])); $image['size'] = $fileHandler['size']; @@ -187,9 +204,12 @@ public function getImagesJson() private function sortImagesByPosition($images) { if (is_array($images)) { - usort($images, function ($imageA, $imageB) { - return ($imageA['position'] < $imageB['position']) ? -1 : 1; - }); + usort( + $images, + function ($imageA, $imageB) { + return ($imageA['position'] < $imageB['position']) ? -1 : 1; + } + ); } return $images; } diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php index 249c32ff276c3..9a2199859a1df 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php @@ -9,6 +9,7 @@ use Magento\Catalog\Model\Entity\Attribute; use Magento\Catalog\Model\Product; use Magento\Framework\Phrase; +use Magento\MediaStorage\Helper\File\Storage\Database; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -50,6 +51,11 @@ class ContentTest extends \PHPUnit\Framework\TestCase */ protected $imageHelper; + /** + * @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject + */ + protected $databaseMock; + /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ @@ -71,13 +77,18 @@ public function setUp() ->disableOriginalConstructor() ->getMock(); + $this->databaseMock = $this->getMockBuilder(Database::class) + ->disableOriginalConstructor() + ->getMock(); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->content = $this->objectManager->getObject( \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content::class, [ 'mediaConfig' => $this->mediaConfigMock, 'jsonEncoder' => $this->jsonEncoderMock, - 'filesystem' => $this->fileSystemMock + 'filesystem' => $this->fileSystemMock, + 'fileStorageDatabase' => $this->databaseMock ] ); } @@ -143,6 +154,13 @@ public function testGetImagesJson() $this->readMock->expects($this->any())->method('stat')->willReturnMap($sizeMap); $this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode'); + $this->readMock->expects($this->any()) + ->method('isFile') + ->will($this->returnValue(true)); + $this->databaseMock->expects($this->any()) + ->method('checkDbUsage') + ->will($this->returnValue(false)); + $this->assertSame(json_encode($imagesResult), $this->content->getImagesJson()); } @@ -210,6 +228,14 @@ public function testGetImagesJsonWithException() $this->fileSystemMock->expects($this->any())->method('getDirectoryRead')->willReturn($this->readMock); $this->mediaConfigMock->expects($this->any())->method('getMediaUrl'); $this->mediaConfigMock->expects($this->any())->method('getMediaPath'); + + $this->readMock->expects($this->any()) + ->method('isFile') + ->will($this->returnValue(true)); + $this->databaseMock->expects($this->any()) + ->method('checkDbUsage') + ->will($this->returnValue(false)); + $this->readMock->expects($this->any())->method('stat')->willReturnOnConsecutiveCalls( $this->throwException( new \Magento\Framework\Exception\FileSystemException(new Phrase('test')) @@ -365,4 +391,52 @@ private function getMediaAttribute(string $label, string $attributeCode) return $mediaAttribute; } + + /** + * Test GetImagesJson() calls MediaStorage functions to obtain image from DB prior to stat call + * + * @return void + */ + public function testGetImagesJsonMediaStorageMode() + { + $images = [ + 'images' => [ + [ + 'value_id' => '0', + 'file' => 'file_1.jpg', + 'media_type' => 'image', + 'position' => '0' + ] + ] + ]; + + $mediaPath = [ + ['file_1.jpg', 'catalog/product/image_1.jpg'] + ]; + + $this->content->setElement($this->galleryMock); + + $this->galleryMock->expects($this->once()) + ->method('getImages') + ->willReturn($images); + $this->fileSystemMock->expects($this->once()) + ->method('getDirectoryRead') + ->willReturn($this->readMock); + $this->mediaConfigMock->expects($this->any()) + ->method('getMediaPath') + ->willReturnMap($mediaPath); + + $this->readMock->expects($this->any()) + ->method('isFile') + ->will($this->returnValue(false)); + $this->databaseMock->expects($this->any()) + ->method('checkDbUsage') + ->will($this->returnValue(true)); + + $this->databaseMock->expects($this->once()) + ->method('saveFileToFilesystem') + ->with('catalog/product/image_1.jpg'); + + $this->content->getImagesJson(); + } } From 0195dd8f45d947c9d6316ea550ee28714a6f7e79 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 13:09:41 -0500 Subject: [PATCH 314/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable tests --- .../Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml | 3 +++ ...xportSimpleAndConfigurableProductsWithCustomOptionsTest.xml | 3 +++ .../StorefrontConfigurableProductCategoryViewChildOnlyTest.xml | 3 +++ .../Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml | 3 +++ .../Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml | 3 +++ .../Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml | 3 +++ ...eateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml | 3 +++ 7 files changed, 21 insertions(+) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml index d3b2916ee5825..38749dfd792ca 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml @@ -18,6 +18,9 @@ <severity value="MAJOR"/> <group value="backend"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml index 8adbf566b65ec..12f72d5379fe3 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-14005"/> <group value="catalog_import_export"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create category --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml index 1959551f8de2d..ac468fc92e4db 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-5832"/> <group value="ConfigurableProduct"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create the category --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml index 89003ed89fd13..e498279ee99ae 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-15862"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml index 4da7ec3e22d42..06cffd27933d9 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-15865"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml index 1c3aaf0d3b440..95b326a13fa5b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-15864"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml index 22628e599823d..7f8ffd4fdfa7e 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> From 06bc3a2d2e7f41cf47b05f3f89b6030e2034998a Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" <avasiliev@comwrap.com> Date: Fri, 31 May 2019 21:35:30 +0300 Subject: [PATCH 315/464] fix exception type and message --- .../Plugin/Framework/Amqp/Bulk/Exchange.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index ae8ff6948fc42..9a8f92e5696df 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -62,7 +62,7 @@ public function __construct( * @param EnvelopeInterface[] $envelopes * @return array * @throws AMQPInvalidArgumentException - * @throws \Exception + * @throws \LogicException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes) @@ -70,10 +70,12 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes try { $storeId = $this->storeManager->getStore()->getId(); } catch (NoSuchEntityException $e) { - $this->logger->error( - sprintf("Can't get current storeId and inject to amqp message. Error %s.", $e->getMessage()) + $errorMessage = sprintf( + "Can't get current storeId and inject to amqp message. Error %s.", + $e->getMessage() ); - throw new \Exception($e->getMessage()); + $this->logger->error($errorMessage); + throw new \LogicException($errorMessage); } $updatedEnvelopes = []; @@ -88,10 +90,9 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes try { $headers->set('store_id', $storeId); } catch (AMQPInvalidArgumentException $ea) { - $this->logger->error( - sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage()) - ); - throw new AMQPInvalidArgumentException($ea->getMessage()); + $errorMessage = sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage()); + $this->logger->error($errorMessage); + throw new AMQPInvalidArgumentException($errorMessage); } $properties['application_headers'] = $headers; } From f16692c020ad34d1cff7e4489799a2c33dfde995 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Fri, 31 May 2019 14:06:15 -0500 Subject: [PATCH 316/464] MC-16886: Add preload feature for fonts load --- .../layout/default_head_blocks.xml | 8 ++-- .../Framework/View/Asset/MergeService.php | 17 ++++++++- .../Framework/View/Page/Config/Renderer.php | 37 +++++++++++++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml index be2875273d55a..9795a064c94d5 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml +++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml @@ -10,10 +10,10 @@ <css src="css/styles-m.css"/> <css src="css/styles-l.css" media="screen and (min-width: 768px)"/> <css src="css/print.css" media="print"/> - <font src="fonts/opensans/light/opensans-300"/> - <font src="fonts/opensans/light/opensans-400"/> - <font src="fonts/opensans/light/opensans-600"/> - <font src="fonts/opensans/light/opensans-700"/> + <font src="fonts/opensans/light/opensans-300.woff2"/> + <font src="fonts/opensans/regular/opensans-400.woff2"/> + <font src="fonts/opensans/semibold/opensans-600.woff2"/> + <font src="fonts/opensans/bold/opensans-700.woff2"/> <meta name="format-detection" content="telephone=no"/> </head> </page> diff --git a/lib/internal/Magento/Framework/View/Asset/MergeService.php b/lib/internal/Magento/Framework/View/Asset/MergeService.php index a5820a6d7651b..cac2b08413149 100644 --- a/lib/internal/Magento/Framework/View/Asset/MergeService.php +++ b/lib/internal/Magento/Framework/View/Asset/MergeService.php @@ -40,6 +40,21 @@ class MergeService */ protected $state; + /** + * List of supported types that can be processed by merge service + * + * @var array + */ + private const SUPPORTED_MERGE_TYPE = [ + 'css', + 'js', + 'eot', + 'svg', + 'ttf', + 'woff', + 'woff2', + ]; + /** * Constructor * @@ -72,7 +87,7 @@ public function getMergedAssets(array $assets, $contentType) { $isCss = $contentType == 'css'; $isJs = $contentType == 'js'; - if (!$isCss && !$isJs) { + if (!in_array($contentType, self::SUPPORTED_MERGE_TYPE)) { throw new \InvalidArgumentException("Merge for content type '{$contentType}' is not supported."); } diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index b272aca0556a2..d93b3c271995f 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -20,7 +20,28 @@ class Renderer implements RendererInterface /** * @var array */ - protected $assetTypeOrder = ['css', 'ico', 'js', 'font']; + protected $assetTypeOrder = [ + 'css', + 'js', + 'eot', + 'svg', + 'ttf', + 'woff', + 'woff2', + ]; + + /** + * Possible fonts type + * + * @var array + */ + private const FONTS_TYPE = [ + 'eot', + 'svg', + 'ttf', + 'woff', + 'woff2', + ]; /** * @var Config @@ -322,7 +343,7 @@ protected function addDefaultAttributes($contentType, $attributes) $attributes = ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"'); break; - case 'font': + case $this->canTypeBeFont($contentType): $attributes = 'rel="preload" as="font" crossorigin="anonymous"'; break; } @@ -344,7 +365,6 @@ protected function getAssetTemplate($contentType, $attributes) break; case 'css': - case 'font': default: $groupTemplate = '<link ' . $attributes . ' href="%s" />' . "\n"; break; @@ -396,6 +416,17 @@ protected function renderAssetHtml(\Magento\Framework\View\Asset\PropertyGroup $ return $result; } + /** + * Check if file type can be font + * + * @param $type + * @return bool + */ + private function canTypeBeFont($type) + { + return in_array($type, self::FONTS_TYPE); + } + /** * Get asset content type * From 0835f9df81901d03936b5807f474e4434481074e Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Fri, 31 May 2019 14:25:33 -0500 Subject: [PATCH 317/464] MC-16608: Use escaper methods - clean up code --- .../templates/system/config/js.phtml | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml index a830eec0088c2..769f8c916d6c6 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml @@ -143,24 +143,32 @@ originModel.prototype = { var value = this.regionElement.value; var disabled = this.regionElement.disabled; if (data.length) { - var html = '<select name="'+this.regionElement.name+'" id="'+this.regionElement.id+'" ' + - 'class="required-entry select" title="'+this.regionElement.title+'"'+(disabled?" disabled":"")+'>'; + var select = document.createElement('select'); + select.setAttribute('name', this.regionElement.name); + select.setAttribute('title', this.regionElement.title); + select.setAttribute('id', this.regionElement.id); + select.setAttribute('class', 'required-entry select'); + if (disabled) { + select.setAttribute('disabled', ''); + } for (var i in data) { if (data[i].label) { - html+= '<option value="'+data[i].value+'"'; + var option = document.createElement('option'); + option.setAttribute('value', data[i].value); + option.innerText = data[i].label; if (this.regionElement.value && (this.regionElement.value == data[i].value || this.regionElement.value == data[i].label) ) { - html+= ' selected'; + option.setAttribute('selected', ''); } - html+='>'+data[i].label+'<\/option>'; + select.add(option); } } - html+= '<\/select>'; var parentNode = this.regionElement.parentNode; var regionElementId = this.regionElement.id; - parentNode.innerHTML = html; + parentNode.innerHTML = select.outerHTML; + this.regionElement = $(regionElementId); } else if (this.reload) { this.clearRegionField(disabled); @@ -168,11 +176,17 @@ originModel.prototype = { } }, clearRegionField: function(disabled) { - var html = '<input type="text" name="' + this.regionElement.name + '" id="' + this.regionElement.id + '" ' + - 'class="input-text" title="' + this.regionElement.title + '"' + (disabled ? " disabled" : "") + '>'; + var text = document.createElement('text'); + text.setAttribute('name', this.regionElement.name); + text.setAttribute('title', this.regionElement.title); + text.setAttribute('id', this.regionElement.id); + text.setAttribute('class', 'input-text'); + if (disabled) { + text.setAttribute('disabled', ''); + } var parentNode = this.regionElement.parentNode; var regionElementId = this.regionElement.id; - parentNode.innerHTML = html; + parentNode.innerHTML = text.outerHTML; this.regionElement = $(regionElementId); } } From 84174b686a1172fe29e31b272a749fa77be2f263 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 14:42:04 -0500 Subject: [PATCH 318/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable tests --- .../Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml | 3 +++ ...dateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml | 3 +++ .../Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml | 3 +++ .../Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml | 3 +++ ...hMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml | 3 +++ 5 files changed, 15 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml index 2c3aa5db75171..d2a7c4ad59576 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml index a042c4d60ae4f..a542c9390c12e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 901018c2fd074..2b24233e8b072 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -17,6 +17,9 @@ <description value="New user signup and browses catalog, searches for product, adds product to cart, adds product to wishlist, compares products, uses coupon code and checks out."/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-87653"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <resetCookie userInput="PHPSESSID" stepKey="resetCookieForCart"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml index 03bd436834c11..256be7cde7188 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-15861"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index c62b0dd869281..7906a21fb4ee8 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="SalesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> From 80947996c5215ffb71a7001179860b53a0e43ac2 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Fri, 31 May 2019 15:14:32 -0500 Subject: [PATCH 319/464] MC-16607: Fix Unrelated Static Test Failures - fix tests failures --- app/code/Magento/Reports/Block/Adminhtml/Grid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index 9f1b9313e1c66..fac56fa966ec5 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -137,7 +137,7 @@ protected function _prepareCollection() } elseif ($filter && is_array($filter)) { $this->_setFilterValues($filter); // phpcs:ignore Magento2.Functions.DiscouragedFunction - } elseif (0 !== sizeof($this->_defaultFilter)) { + } elseif (0 !== count($this->_defaultFilter)) { $this->_setFilterValues($this->_defaultFilter); } From 67103b631c910fafe80e9f851b584c4a7b4daeff Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Fri, 31 May 2019 15:54:32 -0500 Subject: [PATCH 320/464] MC-16608: Use escaper methods - clean up code --- .../Config/view/adminhtml/templates/system/config/js.phtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml index 769f8c916d6c6..297687786833d 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml @@ -176,7 +176,8 @@ originModel.prototype = { } }, clearRegionField: function(disabled) { - var text = document.createElement('text'); + var text = document.createElement('input'); + text.setAttribute('type', 'text'); text.setAttribute('name', this.regionElement.name); text.setAttribute('title', this.regionElement.title); text.setAttribute('id', this.regionElement.id); From 64aa02b8879529c15c5f5ea7968ff19d28a5f272 Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin <dyushkin@adobe.com> Date: Fri, 31 May 2019 16:25:19 -0500 Subject: [PATCH 321/464] MAGETWO-99035: Payflow Field format error: 10413-The totals of the cart item amounts do not match order amounts. --- app/code/Magento/Paypal/Model/Payflow/Transparent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index 3fa9114e91d12..f90c8f3792428 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -195,7 +195,7 @@ public function authorize(InfoInterface $payment, $amount) } catch (LocalizedException $exception) { $payment->setParentTransactionId($response->getData(self::PNREF)); $this->void($payment); - // phpcs:ignore Magento2.Exceptions.DirectThrow + // phpcs:ignore Magento2.Exceptions.ThrowCatch throw new LocalizedException(__("The payment couldn't be processed at this time. Please try again later.")); } From 07a296a5abd558f543c6207c5746d03475ed9102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Fri, 31 May 2019 23:38:51 +0200 Subject: [PATCH 322/464] Fix #19872 - unit tests for fileInfo with pub/ and root Magento install dir --- .../Test/Unit/Model/Category/FileInfoTest.php | 57 +++++++++++++++---- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php index 8ca823127e66c..77efca7f80e11 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -67,7 +67,7 @@ protected function setUp() $this->baseDirectory->expects($this->any()) ->method('getAbsolutePath') ->with(null) - ->willReturn('/a/b/c'); + ->willReturn('/a/b/c/'); $this->model = new FileInfo( $this->filesystem, @@ -85,12 +85,12 @@ public function testGetMimeType() $this->mediaDirectory->expects($this->at(0)) ->method('getAbsolutePath') ->with(null) - ->willReturn('/a/b/c/pub/media'); + ->willReturn('/a/b/c/pub/media/'); $this->mediaDirectory->expects($this->at(1)) ->method('getAbsolutePath') ->with(null) - ->willReturn('/a/b/c/pub/media'); + ->willReturn('/a/b/c/pub/media/'); $this->mediaDirectory->expects($this->at(2)) ->method('getAbsolutePath') @@ -116,7 +116,7 @@ public function testGetStat() $this->mediaDirectory->expects($this->any()) ->method('getAbsolutePath') ->with(null) - ->willReturn('/a/b/c/pub/media'); + ->willReturn('/a/b/c/pub/media/'); $this->mediaDirectory->expects($this->once()) ->method('stat') @@ -130,22 +130,55 @@ public function testGetStat() $this->assertEquals(1, $result['size']); } - public function testIsExist() + /** + * @param $fileName + * @param $fileMediaPath + * @dataProvider isExistProvider + */ + public function testIsExist($fileName, $fileMediaPath) { - $mediaPath = '/catalog/category'; - - $fileName = '/filename.ext1'; - $this->mediaDirectory->expects($this->any()) ->method('getAbsolutePath') - ->with(null) - ->willReturn('/a/b/c/pub/media'); + ->willReturn('/a/b/c/pub/media/'); $this->mediaDirectory->expects($this->once()) ->method('isExist') - ->with($mediaPath . $fileName) + ->with($fileMediaPath) ->willReturn(true); $this->assertTrue($this->model->isExist($fileName)); } + + public function isExistProvider() + { + return [ + ['/filename.ext1', '/catalog/category/filename.ext1'], + ['/pub/media/filename.ext1', 'filename.ext1'], + ['/media/filename.ext1', 'filename.ext1'] + ]; + } + + /** + * @param $fileName + * @param $expected + * @dataProvider isBeginsWithMediaDirectoryPathProvider + */ + public function testIsBeginsWithMediaDirectoryPath($fileName, $expected) + { + $this->mediaDirectory->expects($this->any()) + ->method('getAbsolutePath') + ->willReturn('/a/b/c/pub/media/'); + + $this->assertEquals($expected, $this->model->isBeginsWithMediaDirectoryPath($fileName)); + } + + public function isBeginsWithMediaDirectoryPathProvider() + { + return [ + ['/pub/media/test/filename.ext1', true], + ['/media/test/filename.ext1', true], + ['/test/filename.ext1', false], + ['test2/filename.ext1', false] + ]; + } } From abcecd4adc1f396ac4e70a504d2d3d014b008447 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 17:37:21 -0500 Subject: [PATCH 323/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable tests --- .../Mftf/Test/CheckCreditMemoTotalsTest.xml | 3 +++ ...hSeveralWebsitesAndCheckURLRewritesTest.xml | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml index 83fcfbff6de62..38cc687ff53a4 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MAGETWO-95175"/> <group value="creditMemo"/> <group value="tax"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!--Create category and product--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index 83c1e5c0a5e0a..e77ca40d23b3c 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="urlRewrite"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> @@ -70,12 +73,15 @@ </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/> <waitForPageLoad stepKey="waitUntilProductIsOpened"/> - <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/> - <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$rootCategory.name$$" stepKey="fillSearchForInitialCategory"/> - <click selector="{{AdminProductFormSection.selectCategory($$rootCategory.name$$)}}" stepKey="unselectInitialCategory"/> - <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$category.name$$" stepKey="fillSearchCategory"/> - <click selector="{{AdminProductFormSection.selectCategory($$category.name$$)}}" stepKey="clickOnCategory"/> - <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$rootCategory.name$$,$$category.name$$]" stepKey="selectCategory"/> + + +<!-- <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>--> +<!-- <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$rootCategory.name$$" stepKey="fillSearchForInitialCategory"/>--> +<!-- <click selector="{{AdminProductFormSection.selectCategory($$rootCategory.name$$)}}" stepKey="unselectInitialCategory"/>--> +<!-- <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$category.name$$" stepKey="fillSearchCategory"/>--> +<!-- <click selector="{{AdminProductFormSection.selectCategory($$category.name$$)}}" stepKey="clickOnCategory"/>--> +<!-- <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>--> <scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/> <click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="waitForSimpleProductSaved"/> From 5851f378bad59f581c9de4c4670525ce22d738ab Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 17:49:42 -0500 Subject: [PATCH 324/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Fixing accidental commit --- ...WithSeveralWebsitesAndCheckURLRewritesTest.xml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index e77ca40d23b3c..2a1eda17361eb 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -73,15 +73,12 @@ </actionGroup> <click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/> <waitForPageLoad stepKey="waitUntilProductIsOpened"/> - <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$rootCategory.name$$,$$category.name$$]" stepKey="selectCategory"/> - - -<!-- <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>--> -<!-- <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$rootCategory.name$$" stepKey="fillSearchForInitialCategory"/>--> -<!-- <click selector="{{AdminProductFormSection.selectCategory($$rootCategory.name$$)}}" stepKey="unselectInitialCategory"/>--> -<!-- <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$category.name$$" stepKey="fillSearchCategory"/>--> -<!-- <click selector="{{AdminProductFormSection.selectCategory($$category.name$$)}}" stepKey="clickOnCategory"/>--> -<!-- <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>--> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/> + <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$rootCategory.name$$" stepKey="fillSearchForInitialCategory"/> + <click selector="{{AdminProductFormSection.selectCategory($$rootCategory.name$$)}}" stepKey="unselectInitialCategory"/> + <fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$category.name$$" stepKey="fillSearchCategory"/> + <click selector="{{AdminProductFormSection.selectCategory($$category.name$$)}}" stepKey="clickOnCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/> <scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/> <click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="waitForSimpleProductSaved"/> From b59cef08c0420685ad4dd6b62a34d20448b9d717 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Fri, 31 May 2019 18:21:43 -0500 Subject: [PATCH 325/464] MC-16873: Generate critical css file for LUMA --- .../Magento/luma/web/css/critical.css | 314 +++++++++++++++++- 1 file changed, 313 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css index 656bf46357243..3ec35afece06e 100644 --- a/app/design/frontend/Magento/luma/web/css/critical.css +++ b/app/design/frontend/Magento/luma/web/css/critical.css @@ -1 +1,313 @@ -.load.indicator{background-color:rgba(255,255,255,0.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url('../images/loader-2.gif') no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,0.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative} \ No newline at end of file +/*Common*/ + +body { + margin: 0; +} + +.page-wrapper { + display: flex; + flex-direction: column; + min-height: 100vh; +} + +.action.skip:not(:focus), .page-header .switcher .label, .minicart-wrapper .action.showcart .text, .minicart-wrapper .action.showcart .counter-label, .product-item-actions .actions-secondary>.action span, .block.newsletter .label { + border: 0; + clip: rect(0, 0, 0, 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +a, .alink { + color: #006bb4; + text-decoration: none; +} + +.page-header .panel.wrapper { + background-color: #6e716e; + color: #fff; +} + +.header.panel>.header.links { + list-style: none none; + float: right; + font-size: 0; + margin-right: 20px; +} + +.header.panel>.header.links>li { + font-size: 14px; + margin: 0 0 0 15px; +} + +.page-header .switcher .options ul.dropdown, .page-footer .switcher .options ul.dropdown, .no-display, .block-search .block-title, .block-search .action.search, .nav-toggle, .block-search .nested, .block.newsletter .title, .breadcrumbs .item { + display: none; +} + +.block-search .label>span { + height: 1px; + overflow: hidden; + position: absolute; +} + +.logo { + float: left; + margin: 0 0 10px 40px; +} + +.minicart-wrapper { + float: right; +} + +.page-footer { + margin-top: 25px; +} + +.footer.content { + border-top: 1px solid #cecece; + padding-top: 20px; +} + +.block.newsletter .actions { + display: table-cell; + vertical-align: top; + width: 1%; +} + +.product-items, .footer.content ul, .block-banners .banner-items, .block-banners-inline .banner-items, .block-event .slider-panel .slider { + margin: 0; + padding: 0; + list-style: none none; +} + +.copyright { + background-color: #6e716e; + color: #fff; + box-sizing: border-box; + display: block; + padding: 10px; + text-align: center; +} + +.modal-slide, .modal-popup { + visibility: hidden; + opacity: 0; +} + +input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="number"], input[type="email"] { + background: #fff; + background-clip: padding-box; + border: 1px solid #c2c2c2; + border-radius: 1px; + font-size: 14px; + height: 32px; + line-height: 1.42857143; + padding: 0 9px; + vertical-align: baseline; + width: 100%; + box-sizing: border-box; +} + +.action.primary { + background: #1979c3; + border: 1px solid #1979c3; + color: #fff; + font-weight: 600; + padding: 7px 15px; +} + +.block.newsletter .form.subscribe { + display: table; +} + +.footer.content .links a { + color: #575757; +} + +.load.indicator{background-color:rgba(255,255,255,0.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url('../images/loader-2.gif') no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,0.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative} + +/*Desktop*/ + +@media (min-width: 768px), print { + html, body { + height: 100%; + } + + .page-header { + border: 0; + margin-bottom: 0; + } + + .section-item-content .switcher-currency, ul.header.links li.customer-welcome, .nav-sections-item-title, ul.level0.submenu { + display: none; + } + + .abs-add-clearfix-desktop:before, .abs-add-clearfix-desktop:after, .paypal-review .block-content:before, .paypal-review .block-content:after, .paypal-review-discount:before, .paypal-review-discount:after, .order-review-form:before, .order-review-form:after, .block-cart-failed .block-content:before, .block-cart-failed .block-content:after, .cart-container:before, .cart-container:after, .login-container:before, .login-container:after, .account .page-title-wrapper:before, .account .page-title-wrapper:after, .account .column.main .block:not(.widget) .block-content:before, .account .column.main .block:not(.widget) .block-content:after, .block-addresses-list .items.addresses:before, .block-addresses-list .items.addresses:after, .block-giftregistry-shared .item-options:before, .block-giftregistry-shared .item-options:after, .data.table .gift-wrapping .nested:before, .data.table .gift-wrapping .nested:after, .data.table .gift-wrapping .content:before, .data.table .gift-wrapping .content:after, .block-wishlist-management:before, .block-wishlist-management:after, .magento-rma-guest-returns .column.main .block.block-order-details-view:before, .magento-rma-guest-returns .column.main .block.block-order-details-view:after, .order-links:before, .order-links:after, .account .column.main .block.block-order-details-view:before, .account .column.main .block.block-order-details-view:after, [class^='sales-guest-'] .column.main .block.block-order-details-view:before, [class^='sales-guest-'] .column.main .block.block-order-details-view:after, .sales-guest-view .column.main .block.block-order-details-view:before, .sales-guest-view .column.main .block.block-order-details-view:after, .page-header .header.panel:before, .page-header .header.panel:after, .header.content:before, .header.content:after { + content: ''; + display: table; + } + + .abs-add-clearfix-desktop:after, .paypal-review .block-content:after, .paypal-review-discount:after, .order-review-form:after, .block-cart-failed .block-content:after, .cart-container:after, .login-container:after, .account .page-title-wrapper:after, .account .column.main .block:not(.widget) .block-content:after, .block-addresses-list .items.addresses:after, .block-giftregistry-shared .item-options:after, .data.table .gift-wrapping .nested:after, .data.table .gift-wrapping .content:after, .block-wishlist-management:after, .magento-rma-guest-returns .column.main .block.block-order-details-view:after, .order-links:after, .account .column.main .block.block-order-details-view:after, [class^='sales-guest-'] .column.main .block.block-order-details-view:after, .sales-guest-view .column.main .block.block-order-details-view:after, .page-header .header.panel:after, .header.content:after { + clear: both; + } + + ul.header.links li { + display: inline-block; + } + + .navigation, .breadcrumbs, .page-header .header.panel, .header.content, .footer.content, .page-wrapper>.widget, .page-wrapper>.page-bottom, .block.category.event, .top-container, .page-main { + box-sizing: border-box; + margin-left: auto; + margin-right: auto; + max-width: 1280px; + padding-left: 20px; + padding-right: 20px; + width: auto; + } + + .panel.header { + padding: 10px 20px; + } + + .page-header .switcher { + float: right; + margin-left: 15px; + margin-right: -6px; + } + + .header.panel>.header.links>li>a { + color: #fff; + } + + .header.content { + padding: 30px 20px 0; + } + + .logo { + margin: -8px auto 25px 0; + } + + .minicart-wrapper { + margin-left: 13px; + } + + .compare.wrapper { + list-style: none none; + } + + .nav-sections { + margin-bottom: 25px; + } + + .nav-sections-item-content>.navigation { + display: block; + } + + .navigation { + background: #f0f0f0; + font-weight: 700; + height: inherit; + left: auto; + overflow: inherit; + padding: 0; + position: relative; + top: 0; + width: 100%; + z-index: 3; + } + + .navigation ul { + margin-top: 0; + margin-bottom: 0; + padding: 0 8px; + position: relative; + } + + .navigation .level0 { + margin: 0 10px 0 0; + display: inline-block; + } + + .navigation .level0>.level-top { + color: #575757; + line-height: 47px; + padding: 0 12px; + } + + .page-main { + width: 100%; + } + + .page-footer { + background: #f4f4f4; + padding-bottom: 25px; + } + + .footer.content .links { + display: inline-block; + padding-right: 50px; + vertical-align: top; + } + + .footer.content ul { + padding-right: 50px; + } + + .footer.content .links li { + border: none; + font-size: 14px; + margin: 0 0 8px; + padding: 0; + } + + .footer.content .block { + float: right; + } + + .block.newsletter { + width: 34%; + } +} + +/*Mobile*/ + +@media only screen and (max-width: 767px) { + .panel.wrapper, .compare.wrapper, [class*='block-compare'] { + display: none; + } + + .footer.content .links>li { + background: #f4f4f4; + font-size: 1.6rem; + border-top: 1px solid #cecece; + margin: 0 -15px; + padding: 0 15px; + } + + .page-header .header.panel, .page-main { + padding-left: 15px; + padding-right: 15px; + } + + .header.content { + padding-top: 10px; + } + + .nav-sections-items:before, .nav-sections-items:after { + content: ''; + display: table; + } + + .nav-sections-items:after { + clear: both; + } + + .nav-sections { + width: 100vw; + position: fixed; + left: -100vw; + } +} From 1589d0dc4b8b5ac033e3e20512bf3885a6cacfab Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 22:35:39 -0500 Subject: [PATCH 326/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable shipping assertion tests --- .../Test/StorefrontAddGroupedProductToShoppingCartTest.xml | 3 +++ ...frontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml index f24498a6bf524..42f7be0f6af06 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml @@ -15,6 +15,9 @@ <testCaseId value="MC-14718"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml index 08117dab13253..c852a1050fc38 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml @@ -15,6 +15,9 @@ <testCaseId value="MC-14727"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> From 8840bf2ea35a35fe58352c5ea822abdfc4c18d08 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Fri, 31 May 2019 22:49:37 -0500 Subject: [PATCH 327/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- ...pleProductAndConfigurableProductsWithAssignedImagesTest.xml | 3 +++ ...yWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml | 3 +++ .../Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml index 00bf647886ef5..3b8da4055ab7e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-14004"/> <group value="catalog_import_export"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create category --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml index fec5bb9fadb6e..9ec0bac48d08f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml @@ -15,6 +15,9 @@ <testCaseId value="MC-14720"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 39aa516077c56..1791fc002ab95 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-88"/> <group value="ConfigurableProduct"/> <severity value="AVERAGE"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> From 788a8aa62348ba3084048a361276f26236d131ec Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sat, 1 Jun 2019 11:05:15 -0500 Subject: [PATCH 328/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests - Adding waits after adding product to cart --- .../Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml | 1 + .../GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml | 2 ++ .../Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml | 2 ++ .../Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml | 2 ++ .../StorefrontAddProductToCartWithQtyActionGroup.xml | 1 + ...StorefrontAddToCartCustomOptionsProductPageActionGroup.xml | 1 + .../StorefrontClickAddToCartOnProductPageActionGroup.xml | 1 + .../Mftf/ActionGroup/StorefrontProductPageActionGroup.xml | 2 ++ .../Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml | 1 + ...ProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml | 4 ++++ ...pleProductWithRegularPriceInStockWithCustomOptionsTest.xml | 1 + .../Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml | 1 + .../Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml | 1 + .../Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml | 1 + .../StorefrontAddConfigurableProductToTheCartActionGroup.xml | 1 + .../Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml | 3 +++ .../Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml | 1 + .../Mftf/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml | 2 ++ .../Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml | 1 + .../Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml | 1 + .../Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml | 1 + .../Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml | 1 + .../Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml | 1 + .../Mftf/Test/CartPriceRuleForConfigurableProductTest.xml | 2 ++ .../Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml | 1 + .../Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml | 1 + .../Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml | 2 ++ .../SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml | 1 + .../Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml | 2 ++ 29 files changed, 42 insertions(+) diff --git a/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml b/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml index 42a78291436ed..6aa6792e0e0d4 100644 --- a/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml +++ b/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/FullCaptureAuthorizenetAcceptjsTest.xml @@ -54,6 +54,7 @@ <waitForPageLoad stepKey="waitForProductPage"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForCartToFill"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!--Checkout steps--> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup"/> diff --git a/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml b/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml index 95c2436905212..6f71bd180766f 100644 --- a/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml +++ b/app/code/Magento/AuthorizenetAcceptjs/Test/Mftf/Test/GuestCheckoutVirtualProductAuthorizenetAcceptjsTest.xml @@ -55,8 +55,10 @@ <waitForPageLoad stepKey="waitForProductPage"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForCartToFill"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCartAgain"/> <waitForPageLoad stepKey="waitForCartToFillAgain"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!--Checkout steps--> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup"/> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml b/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml index a781841e0a77b..ac653638b53a0 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml @@ -49,6 +49,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!--Proceed to checkout--> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup"/> @@ -74,6 +75,7 @@ <waitForPageLoad stepKey="waitForPageLoad6"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart1"/> <waitForPageLoad stepKey="waitForPageLoad7"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!--Proceed to checkout--> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup1"/> <click selector="{{CheckoutPaymentSection.addressAction('New Address')}}" stepKey="clickOnNewAddress"/> diff --git a/app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml b/app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml index 035e58de06ccf..977ee78c0d201 100644 --- a/app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml +++ b/app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml @@ -92,6 +92,8 @@ <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.sku$$)}}" stepKey="openProductPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart" /> + <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <waitForText userInput="You added $$createSimpleProduct.name$$ to your shopping cart." stepKey="waitForText"/> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCartWithQtyActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCartWithQtyActionGroup.xml index 816085cf0ca26..5432d547e8025 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCartWithQtyActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddProductToCartWithQtyActionGroup.xml @@ -16,6 +16,7 @@ <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="{{productQty}}" stepKey="fillProduct1Quantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="clickOnAddToCartButton"/> <waitForPageLoad stepKey="waitForProductToAddInCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <seeElement selector="{{StorefrontProductPageSection.successMsg}}" stepKey="seeSuccessSaveMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml index c7ae52d2b37c3..080b374c60b43 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml @@ -14,6 +14,7 @@ </arguments> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartOnProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartOnProductPageActionGroup.xml index fb2065d228d5a..1dcbc738c7651 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartOnProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartOnProductPageActionGroup.xml @@ -9,6 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="StorefrontClickAddToCartOnProductPageActionGroup"> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart" /> + <waitForPageLoad stepKey="waitForAddToCart"/> <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage" /> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml index 8e0ef3ccbcf28..e6392118f79b8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml @@ -13,9 +13,11 @@ <argument name="productName"/> </arguments> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/> <waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/> <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml index e3f4d6cbdde0d..feb4fffd12f5d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -77,6 +77,7 @@ <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="1" stepKey="fillProductQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="clickOnAddToCartButton"/> <waitForPageLoad stepKey="waitForProductToAddInCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <seeElement selector="{{StorefrontProductPageSection.successMsg}}" stepKey="seeSuccessSaveMessage"/> <seeElement selector="{{StorefrontMinicartSection.quantity(1)}}" stepKey="seeAddedProductQuantityInCart"/> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml index d5fc981b5b2e6..f698b3d89ffe9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -52,7 +52,11 @@ <!-- Assign simple product to created store view --> <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="clickCategoryStoreViewDropdownToggle"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(customStoreFR.name)}}" stepKey="waitForSelectCategoryStoreViewOption"/> <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(customStoreFR.name)}}" stepKey="selectCategoryStoreViewOption"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForElementVisible selector="{{AdminProductFormChangeStoreSection.acceptButton}}" stepKey="waitForAcceptButton"/> <click selector="{{AdminProductFormChangeStoreSection.acceptButton}}" stepKey="clickAcceptButton"/> <waitForPageLoad stepKey="waitForPageToLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml index 318ab6555235e..9a98d629f13ac 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml @@ -150,6 +150,7 @@ <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="1" stepKey="fillProductQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="clickOnAddToCartButton"/> <waitForPageLoad stepKey="waitForProductToAddInCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <seeElement selector="{{StorefrontProductPageSection.successMsg}}" stepKey="seeYouAddedSimpleprod4ToYourShoppingCartSuccessSaveMessage"/> <seeElement selector="{{StorefrontMinicartSection.quantity(1)}}" stepKey="seeAddedProductQuantityInCart"/> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml index 02539110dc1a9..06392764290ac 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml @@ -209,6 +209,7 @@ <selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="option1" stepKey="selectOption1"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart1"/> <waitForPageLoad time="30" stepKey="waitForPageLoad4"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <see selector="{{StorefrontMessagesSection.success}}" userInput="You added $$createConfigProduct1.name$ to your shopping cart." stepKey="seeAddToCartSuccessMessage"/> <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniShoppingCart1"/> <waitForPageLoad time="30" stepKey="waitForPageLoad5"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml index c6ecc1c6d9658..22fcf6870c19d 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml @@ -57,6 +57,7 @@ <!-- Verify price is not discounted in the cart --> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> <waitForPageLoad stepKey="waitForCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckout"/> <waitForPageLoad stepKey="waitForCheckout"/> <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$$createProduct.price$$" stepKey="seePrice3"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml index 88e81199e3705..1603758016e0d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml @@ -13,5 +13,6 @@ <scrollTo selector="{{StorefrontProductActionSection.addToCart}}" stepKey="scrollToAddToCartButton"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> <waitForPageLoad stepKey="waitForPageToLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontAddConfigurableProductToTheCartActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontAddConfigurableProductToTheCartActionGroup.xml index 9e3935501adee..380ffb1d0c781 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontAddConfigurableProductToTheCartActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/StorefrontAddConfigurableProductToTheCartActionGroup.xml @@ -21,6 +21,7 @@ <fillField selector="{{StorefrontProductPageSection.qtyInput}}" userInput="{{qty}}" stepKey="fillProductQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="clickOnAddToCartButton"/> <waitForPageLoad stepKey="waitForProductToAddInCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <seeElement selector="{{StorefrontProductPageSection.successMsg}}" stepKey="seeSuccessSaveMessage"/> </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml index fb083f39ad387..e35a1ad61dc7c 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml @@ -67,6 +67,9 @@ <stories value="Change Customer Group"/> <group value="customer"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <remove keyForRemoval="filterCustomer"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml index ab805193854b0..8469126547eb1 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml @@ -83,6 +83,7 @@ <!--Add a product to the cart--> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddProductToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!--Proceed to checkout--> <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup"/> <!-- Click next button to open payment section --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml index 37e171823b11a..60ee9fb1fa1a6 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml @@ -13,6 +13,8 @@ <argument name="couponCode" type="string"/> </arguments> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart" /> + <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <waitForText userInput="You added {{product.name}} to your shopping cart." stepKey="waitForText"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckoutPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml index 57ed2b67be10e..10f4dd562bf01 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml @@ -12,5 +12,6 @@ <scrollTo selector="{{StorefrontProductActionSection.addToCart}}" stepKey="scrollToAddToCartButton"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> <waitForPageLoad stepKey="waitForPageToLoad"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml index 3e55eb4f26607..3963fb13ca94d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml @@ -51,6 +51,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{quantity}}" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> <waitForPageLoad stepKey="waitForCartPage"/> <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml index e6676dab4eb5e..f5b285f2f0286 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml @@ -85,6 +85,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> <waitForPageLoad stepKey="waitForCartPage"/> <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyCoupon"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml index 3deb688de9c34..712475186d5bf 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml @@ -77,6 +77,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> <waitForPageLoad stepKey="waitForCartPage"/> <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyCoupon"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml index 7b350c0208cc1..03dffe9f448ea 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml @@ -76,6 +76,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> <waitForPageLoad stepKey="waitForCartPage"/> <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml index e2687f5f16baf..1eba06126ff6f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml @@ -122,11 +122,13 @@ <waitForPageLoad stepKey="waitForProductPageLoad1"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart1"/> <waitForPageLoad stepKey="waitForAddToCart1"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Add the second product to the cart --> <amOnPage url="$$createConfigChildProduct2.sku$$.html" stepKey="goToProductPage2"/> <waitForPageLoad stepKey="waitForProductPageLoad2"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> <waitForPageLoad stepKey="waitForAddToCart2"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!--View and edit cart--> <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickViewAndEditCartFromMiniCart"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml index 045fdbb33763f..ffd50e43a2344 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountry.xml @@ -68,6 +68,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Should not see the discount yet because we have not set country --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml index d8c3ef9c32b0b..765f10e44d81b 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcode.xml @@ -72,6 +72,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Should not see the discount yet because we have not filled in postcode --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml index 51d11b4e5cb1c..cde5e351e1b70 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantity.xml @@ -68,6 +68,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Should not see the discount yet because we have only 1 item in our cart --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> @@ -81,6 +82,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> <waitForPageLoad stepKey="waitForAddToCart2"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!-- Now we should see the discount because we have more than 1 item --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml index 647f4d6e5c800..d6806e2a2966b 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleState.xml @@ -68,6 +68,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Should not see the discount yet because we have not filled in postcode --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml index 7c9c52e1c02ac..8ff747607ea30 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotal.xml @@ -67,6 +67,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> <waitForPageLoad stepKey="waitForAddToCart"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> <!-- Should not see the discount yet because we have not exceeded $200 --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> @@ -80,6 +81,7 @@ <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> <waitForPageLoad stepKey="waitForAddToCart2"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage2"/> <!-- Now we should see the discount because we exceeded $200 --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> From bec17f049bdf06b9733be96adcb3a93a966f2277 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sat, 1 Jun 2019 12:38:48 -0500 Subject: [PATCH 329/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Fixing test broken in previous commit --- ...stomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml index 2ac84000fd1e8..d108dc3657a40 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartWithoutAnySelectedOptionTest.xml @@ -36,7 +36,8 @@ </actionGroup> <!--Click on Add To Cart button--> - <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> <!--Assert all types of product options field displayed Required message --> <actionGroup ref="AssertStorefrontSeeElementActionGroup" stepKey="assertRequiredProductOptionField"> From 81e1bb47e1d4f05fc70d405ae45a8325258d5ca3 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sat, 1 Jun 2019 13:21:44 -0500 Subject: [PATCH 330/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml | 3 +++ ...alesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml | 3 +++ .../Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml index 50a6b74a67233..016f07b8a2f44 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml @@ -16,6 +16,9 @@ <description value="Admin should be able to add widget to WYSIWYG Editor Newsletter"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84682"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml index 7baec93c73905..d106c086a6065 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <group value="salesRule"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17175"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml index a96a57cbfec55..9c63a362c7e41 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="tax"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> From 7420c64a64fce0e94eed966f4f997fbfc75cf43e Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Sat, 1 Jun 2019 13:25:47 -0500 Subject: [PATCH 331/464] MC-16873: Generate critical css file for LUMA - Enable critical css path by default for tests; --- app/code/Magento/Theme/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 3e26204d7788c..39e7d32a80ac3 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -70,7 +70,7 @@ Disallow: /*SID= <move_inline_to_bottom>0</move_inline_to_bottom> </js> <css> - <use_css_critical_path>0</use_css_critical_path> + <use_css_critical_path>1</use_css_critical_path> </css> </dev> </default> From 0407b7e2622bd73384b0ca9674d37c644989c192 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sat, 1 Jun 2019 13:46:59 -0500 Subject: [PATCH 332/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml index 29df8d56bd5a6..d7d2abb5b2e8a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-15863"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> From 36cfedb1c7e8b9314250046aba38c399e7c03775 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sat, 1 Jun 2019 14:56:12 -0500 Subject: [PATCH 333/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index c1159c030de0a..f7d24cda34142 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -412,6 +412,7 @@ <argument name="customer"/> </arguments> <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> + <waitForPageLoad stepKey="waitForNewOrderPageOpened"/> <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> <waitForPageLoad stepKey="waitForStoresPageOpened"/> <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> From 7856f0c1019fc40d14e3a869a9e74f54b7f91d56 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Sun, 2 Jun 2019 23:00:42 -0500 Subject: [PATCH 334/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- ...uctWithTierPriceInStockVisibleInCategoryAndSearchTest.xml | 3 +++ .../Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml | 5 ++++- .../Test/AdminMassOrdersCancelProcessingAndClosedTest.xml | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml index d4ec5e410d9ff..d4b62a09ebcd2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml index 00cd6409c6e60..938f2dc7f5c6d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16183"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> @@ -56,7 +59,7 @@ <assertNotEmpty actual="$getSecondOrderId" stepKey="assertSecondOrderIdIsNotEmpty" after="getSecondOrderId"/> <!-- Create CreditMemo for second Order --> - <actionGroup ref="AdminCreateInvoiceAndCreditMemoActionGroup" stepKey="createCreditMemo"/> + <actionGroup ref="AdminCreateInvoiceAndCreditMemoActionGroup" stepKey="createCreditMemo"/> <!-- Navigate to backend: Go to Sales > Orders --> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrderPage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml index 5e524bcf6e05c..9d5cd55b1b071 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16184"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> From b74b21068d5a0aabe91bcb383a132b4c0111a12f Mon Sep 17 00:00:00 2001 From: "rostyslav.hymon" <rostyslav.hymon@transoftgroup.com> Date: Mon, 3 Jun 2019 13:22:38 +0300 Subject: [PATCH 335/464] MAGETWO-99888: equalArrays function has quadratic complexity --- lib/web/mage/utils/compare.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/utils/compare.js b/lib/web/mage/utils/compare.js index e620677f01768..bfc2027d6fb89 100644 --- a/lib/web/mage/utils/compare.js +++ b/lib/web/mage/utils/compare.js @@ -43,7 +43,7 @@ define([ } return array.every(function (value, index) { - return target.indexOf(value) === index; + return target[index] === value; }); }); } From f2c323a4b47a47fbf45bdf6cae49c294551343e3 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Mon, 3 Jun 2019 14:20:37 +0300 Subject: [PATCH 336/464] MAGETWO-99302: Edit customer State and Province is duplicated in the drop down --- .../AdminCreateCustomerActionGroup.xml | 22 ------------------- ...omerWithWebsiteAndStoreViewActionGroup.xml | 8 +++---- .../Customer/Test/Mftf/Data/CustomerData.xml | 1 + ...tomerAddressStateContainValuesOnceTest.xml | 2 +- 4 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml deleted file mode 100644 index 99844461189e5..0000000000000 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerActionGroup.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCreateCustomerWithoutAddressActionGroup"> - <arguments> - <argument name="customerData" defaultValue="Simple_US_Customer"/> - </arguments> - <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="navigateToNewCustomerPage"/> - <fillField userInput="{{customerData.firstname}}" selector="{{AdminCustomerAccountInformationSection.firstName}}" stepKey="fillFirstName"/> - <fillField userInput="{{customerData.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/> - <fillField userInput="{{customerData.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> - <click selector="{{AdminMainActionsSection.save}}" stepKey="saveCustomer"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageVisible"/> - <see userInput="You saved the customer." selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/> - </actionGroup> -</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml index 37149e23dc87e..8f872c653e3a9 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml @@ -46,15 +46,13 @@ <actionGroup name="AdminCreateCustomerWithWebSiteAndGroup"> <arguments> <argument name="customerData" defaultValue="Simple_US_Customer"/> - <argument name="website" type="string" defaultValue="customWebsite"/> - <argument name="storeView" type="string" defaultValue="customStore"/> + <argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/> + <argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/> </arguments> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/> <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/> - <click selector="{{AdminCustomerAccountInformationSection.group}}" stepKey="ClickToExpandGroup"/> - <waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceGroupOrCatalogOption('Default (General)')}}" stepKey="waitForCustomerGroupExpand"/> - <click selector="{{AdminCustomerAccountInformationSection.groupValue('Default (General)')}}" after="waitForCustomerGroupExpand" stepKey="ClickToSelectGroup"/> + <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerGroup.group}}" stepKey="selectCustomerGroup"/> <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/> <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/> <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 5904067aea639..36087dd6cbecc 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -44,6 +44,7 @@ <data key="password">pwdTest123!</data> <data key="store_id">0</data> <data key="website_id">0</data> + <data key="group">General</data> <requiredEntity type="address">US_Address_TX</requiredEntity> </entity> <entity name="SimpleUsCustomerWithNewCustomerGroup" type="customer"> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml index e3e5744135b1a..daab5fd2061fb 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml @@ -52,7 +52,7 @@ <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesSection.regionId(US_Address_NY.state)}}" stepKey="seeOnlyOneRegionInSelectStateForFirstCustomer"/> <!--Go to Customers > All customers, Click Add new Customers, fill all necessary fields, Save--> - <actionGroup ref="AdminCreateCustomerWithoutAddressActionGroup" stepKey="createSimpleUSCustomerWithoutAddress"/> + <actionGroup ref="AdminCreateCustomerWithWebSiteAndGroup" stepKey="createSimpleUSCustomerWithoutAddress"/> <!--Select new created customer, Click Edit mode--> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithoutAddresses"> From b5699184576bf2b56c03c41bbc035075aa4467f1 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Mon, 3 Jun 2019 15:11:04 +0300 Subject: [PATCH 337/464] magento/magento2#18748 health-check-static-test-fix --- app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php | 6 +++--- app/code/Magento/Backend/Block/Dashboard/Sales.php | 6 +++--- .../Backend/Block/Dashboard/Tab/Products/Ordered.php | 6 +++--- app/code/Magento/Backend/Block/Dashboard/Totals.php | 6 +++--- .../Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php | 6 +++--- .../Model/ResourceModel/Product/Compare/Item/Collection.php | 4 ++-- .../CatalogSearch/Model/ResourceModel/Search/Collection.php | 4 ++-- app/code/Magento/Checkout/Block/Cart/Link.php | 6 +++--- app/code/Magento/Checkout/Block/Link.php | 6 +++--- .../Model/Config/Structure/Element/AbstractComposite.php | 4 ++-- .../Magento/Config/Model/Config/Structure/Element/Field.php | 4 ++-- .../Magento/Config/Model/Config/Structure/Element/Group.php | 4 ++-- .../Config/Model/Config/Structure/Element/Section.php | 4 ++-- .../Product/Type/Grouped/AssociatedProductsCollection.php | 4 ++-- app/code/Magento/PageCache/Model/DepersonalizeChecker.php | 6 +++--- .../Reports/Model/ResourceModel/Product/Collection.php | 4 ++-- .../Product/Index/Collection/AbstractCollection.php | 4 ++-- app/code/Magento/Review/Block/Adminhtml/Product/Grid.php | 4 ++-- app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php | 6 +++--- app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php | 6 +++--- app/code/Magento/Tax/Model/App/Action/ContextPlugin.php | 6 +++--- app/code/Magento/Weee/Model/App/Action/ContextPlugin.php | 6 +++--- 22 files changed, 56 insertions(+), 56 deletions(-) diff --git a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php index 50279786c0a5b..7bcadeccd7e5d 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php @@ -19,21 +19,21 @@ class Grid extends \Magento\Backend\Block\Dashboard\Grid protected $_collectionFactory; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory, array $data = [] ) { diff --git a/app/code/Magento/Backend/Block/Dashboard/Sales.php b/app/code/Magento/Backend/Block/Dashboard/Sales.php index 6d7a4d6458a8e..10006d74b6a87 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Sales.php +++ b/app/code/Magento/Backend/Block/Dashboard/Sales.php @@ -18,20 +18,20 @@ class Sales extends \Magento\Backend\Block\Dashboard\Bar protected $_template = 'Magento_Backend::dashboard/salebar.phtml'; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_moduleManager = $moduleManager; diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php index cac10ae372004..b668631fab1bc 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php @@ -19,21 +19,21 @@ class Ordered extends \Magento\Backend\Block\Dashboard\Grid protected $_collectionFactory; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory, array $data = [] ) { diff --git a/app/code/Magento/Backend/Block/Dashboard/Totals.php b/app/code/Magento/Backend/Block/Dashboard/Totals.php index 4dcda3677584c..7c152a6c34d3f 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Totals.php +++ b/app/code/Magento/Backend/Block/Dashboard/Totals.php @@ -19,20 +19,20 @@ class Totals extends \Magento\Backend\Block\Dashboard\Bar protected $_template = 'Magento_Backend::dashboard/totalbar.phtml'; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_moduleManager = $moduleManager; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php index 62c27a421419d..d168780a4eaef 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php @@ -23,7 +23,7 @@ class Wysiwyg extends \Magento\Framework\Data\Form\Element\Textarea /** * Catalog data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager = null; @@ -43,7 +43,7 @@ class Wysiwyg extends \Magento\Framework\Data\Form\Element\Textarea * @param \Magento\Framework\Escaper $escaper * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Framework\View\LayoutInterface $layout - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Backend\Helper\Data $backendData * @param array $data */ @@ -53,7 +53,7 @@ public function __construct( \Magento\Framework\Escaper $escaper, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Framework\View\LayoutInterface $layout, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Backend\Helper\Data $backendData, array $data = [] ) { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php index 7c78dbca5a004..fd21f8fb08898 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php @@ -63,7 +63,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -89,7 +89,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php index e706756515a14..f53d5b3777e1f 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php @@ -51,7 +51,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -76,7 +76,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php index abc1ce4e31010..ec25b62f49447 100644 --- a/app/code/Magento/Checkout/Block/Cart/Link.php +++ b/app/code/Magento/Checkout/Block/Cart/Link.php @@ -13,7 +13,7 @@ class Link extends \Magento\Framework\View\Element\Html\Link { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -24,14 +24,14 @@ class Link extends \Magento\Framework\View\Element\Html\Link /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Checkout\Helper\Cart $cartHelper * @param array $data * @codeCoverageIgnore */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Checkout\Helper\Cart $cartHelper, array $data = [] ) { diff --git a/app/code/Magento/Checkout/Block/Link.php b/app/code/Magento/Checkout/Block/Link.php index cb2fb3309b83c..62f0c60602218 100644 --- a/app/code/Magento/Checkout/Block/Link.php +++ b/app/code/Magento/Checkout/Block/Link.php @@ -13,7 +13,7 @@ class Link extends \Magento\Framework\View\Element\Html\Link { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -24,14 +24,14 @@ class Link extends \Magento\Framework\View\Element\Html\Link /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Checkout\Helper\Data $checkoutHelper * @param array $data * @codeCoverageIgnore */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Checkout\Helper\Data $checkoutHelper, array $data = [] ) { diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php b/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php index 724772622c35b..d8eeeeb892141 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php @@ -20,12 +20,12 @@ abstract class AbstractComposite extends \Magento\Config\Model\Config\Structure\ /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param Iterator $childrenIterator */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, Iterator $childrenIterator ) { parent::__construct($storeManager, $moduleManager); diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php index 0a6a600b41dd4..82012ff2cabf4 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php @@ -54,7 +54,7 @@ class Field extends \Magento\Config\Model\Config\Structure\AbstractElement /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Config\Model\Config\BackendFactory $backendFactory * @param \Magento\Config\Model\Config\SourceFactory $sourceFactory * @param \Magento\Config\Model\Config\CommentFactory $commentFactory @@ -63,7 +63,7 @@ class Field extends \Magento\Config\Model\Config\Structure\AbstractElement */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Config\Model\Config\BackendFactory $backendFactory, \Magento\Config\Model\Config\SourceFactory $sourceFactory, \Magento\Config\Model\Config\CommentFactory $commentFactory, diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Group.php b/app/code/Magento/Config/Model/Config/Structure/Element/Group.php index 8003132d2b822..488a33f627028 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Group.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Group.php @@ -27,14 +27,14 @@ class Group extends AbstractComposite /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param Iterator\Field $childrenIterator * @param \Magento\Config\Model\Config\BackendClone\Factory $cloneModelFactory * @param Dependency\Mapper $dependencyMapper */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Config\Model\Config\Structure\Element\Iterator\Field $childrenIterator, \Magento\Config\Model\Config\BackendClone\Factory $cloneModelFactory, \Magento\Config\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php index c3d927a1d6d1b..4e336e19fbe75 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php @@ -20,13 +20,13 @@ class Section extends AbstractComposite /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param Iterator $childrenIterator * @param \Magento\Framework\AuthorizationInterface $authorization */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, Iterator $childrenIterator, \Magento\Framework\AuthorizationInterface $authorization ) { diff --git a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php index 8d1548036cd3e..af69f4dbe27da 100644 --- a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php +++ b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php @@ -39,7 +39,7 @@ class AssociatedProductsCollection extends \Magento\Catalog\Model\ResourceModel\ * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -65,7 +65,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/PageCache/Model/DepersonalizeChecker.php b/app/code/Magento/PageCache/Model/DepersonalizeChecker.php index 3023efb7a71a6..4012499d5da5a 100644 --- a/app/code/Magento/PageCache/Model/DepersonalizeChecker.php +++ b/app/code/Magento/PageCache/Model/DepersonalizeChecker.php @@ -20,7 +20,7 @@ class DepersonalizeChecker /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; @@ -33,12 +33,12 @@ class DepersonalizeChecker /** * @param \Magento\Framework\App\RequestInterface $request - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param Config $cacheConfig */ public function __construct( \Magento\Framework\App\RequestInterface $request, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, Config $cacheConfig ) { $this->request = $request; diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Collection.php index 337c87f6da03d..d61c2abdf2e4c 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Collection.php @@ -75,7 +75,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -103,7 +103,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Index/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Index/Collection/AbstractCollection.php index 7371bc4359f46..4a18c4d0cea2b 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Index/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Index/Collection/AbstractCollection.php @@ -42,7 +42,7 @@ abstract class AbstractCollection extends \Magento\Catalog\Model\ResourceModel\P * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -67,7 +67,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index d3bbdf9a7eb40..509e826e6f7d3 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -29,7 +29,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid * @param \Magento\Catalog\Model\Product\Type $type * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status * @param \Magento\Catalog\Model\Product\Visibility $visibility - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Store\Model\ResourceModel\Website\CollectionFactory $websitesFactory * @param array $data * @@ -44,7 +44,7 @@ public function __construct( \Magento\Catalog\Model\Product\Type $type, \Magento\Catalog\Model\Product\Attribute\Source\Status $status, \Magento\Catalog\Model\Product\Visibility $visibility, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Store\Model\ResourceModel\Website\CollectionFactory $websitesFactory, array $data = [] ) { diff --git a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php index 5ead8437f943a..dbb8e7812ca29 100644 --- a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php +++ b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php @@ -24,7 +24,7 @@ class Last extends \Magento\Backend\Block\Dashboard\Grid protected $_queriesFactory; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -36,14 +36,14 @@ class Last extends \Magento\Backend\Block\Dashboard\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Search\Model\ResourceModel\Query\CollectionFactory $queriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Search\Model\ResourceModel\Query\CollectionFactory $queriesFactory, array $data = [] ) { diff --git a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php index 120e3121648fc..6f2d54e426540 100644 --- a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php +++ b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php @@ -24,7 +24,7 @@ class Top extends \Magento\Backend\Block\Dashboard\Grid protected $_queriesFactory; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -36,14 +36,14 @@ class Top extends \Magento\Backend\Block\Dashboard\Grid /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Search\Model\ResourceModel\Query\CollectionFactory $queriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Search\Model\ResourceModel\Query\CollectionFactory $queriesFactory, array $data = [] ) { diff --git a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php index 299d4db5e0d18..b73f3b2163a84 100644 --- a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php @@ -34,7 +34,7 @@ class ContextPlugin /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; @@ -50,7 +50,7 @@ class ContextPlugin * @param \Magento\Framework\App\Http\Context $httpContext * @param \Magento\Tax\Model\Calculation\Proxy $calculation * @param \Magento\Tax\Helper\Data $taxHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\PageCache\Model\Config $cacheConfig */ public function __construct( @@ -58,7 +58,7 @@ public function __construct( \Magento\Framework\App\Http\Context $httpContext, \Magento\Tax\Model\Calculation\Proxy $calculation, \Magento\Tax\Helper\Data $taxHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\PageCache\Model\Config $cacheConfig ) { $this->customerSession = $customerSession; diff --git a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php index 8363365372f63..ac3da52ef8d8f 100644 --- a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php @@ -33,7 +33,7 @@ class ContextPlugin protected $weeeHelper; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -63,7 +63,7 @@ class ContextPlugin * @param \Magento\Weee\Model\Tax $weeeTax * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Weee\Helper\Data $weeeHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\PageCache\Model\Config $cacheConfig * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -74,7 +74,7 @@ public function __construct( \Magento\Weee\Model\Tax $weeeTax, \Magento\Tax\Helper\Data $taxHelper, \Magento\Weee\Helper\Data $weeeHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\PageCache\Model\Config $cacheConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig From 3b7cc74ee57e9d98550eaf35804dc6a49b9f02d8 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Mon, 3 Jun 2019 15:48:23 +0300 Subject: [PATCH 338/464] MAGETWO-99302: Edit customer State and Province is duplicated in the drop down --- .../AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml index 8f872c653e3a9..02366415d9edb 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml @@ -52,7 +52,7 @@ <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/> <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/> - <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerGroup.group}}" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/> <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/> <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/> <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/> From 5d627f282bc7fe5aa7c65625bc66497d093a00d8 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 3 Jun 2019 17:03:37 +0300 Subject: [PATCH 339/464] magento/magento2#23036: Static test fix. --- .../Magento/Framework/Model/ResourceModel/Db/AbstractDb.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php index 8d859b4c7b2c1..3c88ee9dc5fed 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php @@ -18,6 +18,7 @@ * @SuppressWarnings(PHPMD.NumberOfChildren) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) + * phpcs:disable Magento2.Classes.AbstractApi * @api */ abstract class AbstractDb extends AbstractResource From 775c2a29a8dbd187ddc201ad50024c7da707b40e Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Mon, 3 Jun 2019 09:19:45 -0500 Subject: [PATCH 340/464] MC-16873: Generate critical css file for LUMA - Minify critical css; - Disable critical css path by default; --- app/code/Magento/Theme/etc/config.xml | 2 +- .../Magento/luma/web/css/critical.css | 314 +----------------- 2 files changed, 2 insertions(+), 314 deletions(-) diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 39e7d32a80ac3..3e26204d7788c 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -70,7 +70,7 @@ Disallow: /*SID= <move_inline_to_bottom>0</move_inline_to_bottom> </js> <css> - <use_css_critical_path>1</use_css_critical_path> + <use_css_critical_path>0</use_css_critical_path> </css> </dev> </default> diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css index 3ec35afece06e..030e45a87b9e2 100644 --- a/app/design/frontend/Magento/luma/web/css/critical.css +++ b/app/design/frontend/Magento/luma/web/css/critical.css @@ -1,313 +1 @@ -/*Common*/ - -body { - margin: 0; -} - -.page-wrapper { - display: flex; - flex-direction: column; - min-height: 100vh; -} - -.action.skip:not(:focus), .page-header .switcher .label, .minicart-wrapper .action.showcart .text, .minicart-wrapper .action.showcart .counter-label, .product-item-actions .actions-secondary>.action span, .block.newsletter .label { - border: 0; - clip: rect(0, 0, 0, 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -a, .alink { - color: #006bb4; - text-decoration: none; -} - -.page-header .panel.wrapper { - background-color: #6e716e; - color: #fff; -} - -.header.panel>.header.links { - list-style: none none; - float: right; - font-size: 0; - margin-right: 20px; -} - -.header.panel>.header.links>li { - font-size: 14px; - margin: 0 0 0 15px; -} - -.page-header .switcher .options ul.dropdown, .page-footer .switcher .options ul.dropdown, .no-display, .block-search .block-title, .block-search .action.search, .nav-toggle, .block-search .nested, .block.newsletter .title, .breadcrumbs .item { - display: none; -} - -.block-search .label>span { - height: 1px; - overflow: hidden; - position: absolute; -} - -.logo { - float: left; - margin: 0 0 10px 40px; -} - -.minicart-wrapper { - float: right; -} - -.page-footer { - margin-top: 25px; -} - -.footer.content { - border-top: 1px solid #cecece; - padding-top: 20px; -} - -.block.newsletter .actions { - display: table-cell; - vertical-align: top; - width: 1%; -} - -.product-items, .footer.content ul, .block-banners .banner-items, .block-banners-inline .banner-items, .block-event .slider-panel .slider { - margin: 0; - padding: 0; - list-style: none none; -} - -.copyright { - background-color: #6e716e; - color: #fff; - box-sizing: border-box; - display: block; - padding: 10px; - text-align: center; -} - -.modal-slide, .modal-popup { - visibility: hidden; - opacity: 0; -} - -input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="number"], input[type="email"] { - background: #fff; - background-clip: padding-box; - border: 1px solid #c2c2c2; - border-radius: 1px; - font-size: 14px; - height: 32px; - line-height: 1.42857143; - padding: 0 9px; - vertical-align: baseline; - width: 100%; - box-sizing: border-box; -} - -.action.primary { - background: #1979c3; - border: 1px solid #1979c3; - color: #fff; - font-weight: 600; - padding: 7px 15px; -} - -.block.newsletter .form.subscribe { - display: table; -} - -.footer.content .links a { - color: #575757; -} - -.load.indicator{background-color:rgba(255,255,255,0.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url('../images/loader-2.gif') no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,0.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative} - -/*Desktop*/ - -@media (min-width: 768px), print { - html, body { - height: 100%; - } - - .page-header { - border: 0; - margin-bottom: 0; - } - - .section-item-content .switcher-currency, ul.header.links li.customer-welcome, .nav-sections-item-title, ul.level0.submenu { - display: none; - } - - .abs-add-clearfix-desktop:before, .abs-add-clearfix-desktop:after, .paypal-review .block-content:before, .paypal-review .block-content:after, .paypal-review-discount:before, .paypal-review-discount:after, .order-review-form:before, .order-review-form:after, .block-cart-failed .block-content:before, .block-cart-failed .block-content:after, .cart-container:before, .cart-container:after, .login-container:before, .login-container:after, .account .page-title-wrapper:before, .account .page-title-wrapper:after, .account .column.main .block:not(.widget) .block-content:before, .account .column.main .block:not(.widget) .block-content:after, .block-addresses-list .items.addresses:before, .block-addresses-list .items.addresses:after, .block-giftregistry-shared .item-options:before, .block-giftregistry-shared .item-options:after, .data.table .gift-wrapping .nested:before, .data.table .gift-wrapping .nested:after, .data.table .gift-wrapping .content:before, .data.table .gift-wrapping .content:after, .block-wishlist-management:before, .block-wishlist-management:after, .magento-rma-guest-returns .column.main .block.block-order-details-view:before, .magento-rma-guest-returns .column.main .block.block-order-details-view:after, .order-links:before, .order-links:after, .account .column.main .block.block-order-details-view:before, .account .column.main .block.block-order-details-view:after, [class^='sales-guest-'] .column.main .block.block-order-details-view:before, [class^='sales-guest-'] .column.main .block.block-order-details-view:after, .sales-guest-view .column.main .block.block-order-details-view:before, .sales-guest-view .column.main .block.block-order-details-view:after, .page-header .header.panel:before, .page-header .header.panel:after, .header.content:before, .header.content:after { - content: ''; - display: table; - } - - .abs-add-clearfix-desktop:after, .paypal-review .block-content:after, .paypal-review-discount:after, .order-review-form:after, .block-cart-failed .block-content:after, .cart-container:after, .login-container:after, .account .page-title-wrapper:after, .account .column.main .block:not(.widget) .block-content:after, .block-addresses-list .items.addresses:after, .block-giftregistry-shared .item-options:after, .data.table .gift-wrapping .nested:after, .data.table .gift-wrapping .content:after, .block-wishlist-management:after, .magento-rma-guest-returns .column.main .block.block-order-details-view:after, .order-links:after, .account .column.main .block.block-order-details-view:after, [class^='sales-guest-'] .column.main .block.block-order-details-view:after, .sales-guest-view .column.main .block.block-order-details-view:after, .page-header .header.panel:after, .header.content:after { - clear: both; - } - - ul.header.links li { - display: inline-block; - } - - .navigation, .breadcrumbs, .page-header .header.panel, .header.content, .footer.content, .page-wrapper>.widget, .page-wrapper>.page-bottom, .block.category.event, .top-container, .page-main { - box-sizing: border-box; - margin-left: auto; - margin-right: auto; - max-width: 1280px; - padding-left: 20px; - padding-right: 20px; - width: auto; - } - - .panel.header { - padding: 10px 20px; - } - - .page-header .switcher { - float: right; - margin-left: 15px; - margin-right: -6px; - } - - .header.panel>.header.links>li>a { - color: #fff; - } - - .header.content { - padding: 30px 20px 0; - } - - .logo { - margin: -8px auto 25px 0; - } - - .minicart-wrapper { - margin-left: 13px; - } - - .compare.wrapper { - list-style: none none; - } - - .nav-sections { - margin-bottom: 25px; - } - - .nav-sections-item-content>.navigation { - display: block; - } - - .navigation { - background: #f0f0f0; - font-weight: 700; - height: inherit; - left: auto; - overflow: inherit; - padding: 0; - position: relative; - top: 0; - width: 100%; - z-index: 3; - } - - .navigation ul { - margin-top: 0; - margin-bottom: 0; - padding: 0 8px; - position: relative; - } - - .navigation .level0 { - margin: 0 10px 0 0; - display: inline-block; - } - - .navigation .level0>.level-top { - color: #575757; - line-height: 47px; - padding: 0 12px; - } - - .page-main { - width: 100%; - } - - .page-footer { - background: #f4f4f4; - padding-bottom: 25px; - } - - .footer.content .links { - display: inline-block; - padding-right: 50px; - vertical-align: top; - } - - .footer.content ul { - padding-right: 50px; - } - - .footer.content .links li { - border: none; - font-size: 14px; - margin: 0 0 8px; - padding: 0; - } - - .footer.content .block { - float: right; - } - - .block.newsletter { - width: 34%; - } -} - -/*Mobile*/ - -@media only screen and (max-width: 767px) { - .panel.wrapper, .compare.wrapper, [class*='block-compare'] { - display: none; - } - - .footer.content .links>li { - background: #f4f4f4; - font-size: 1.6rem; - border-top: 1px solid #cecece; - margin: 0 -15px; - padding: 0 15px; - } - - .page-header .header.panel, .page-main { - padding-left: 15px; - padding-right: 15px; - } - - .header.content { - padding-top: 10px; - } - - .nav-sections-items:before, .nav-sections-items:after { - content: ''; - display: table; - } - - .nav-sections-items:after { - clear: both; - } - - .nav-sections { - width: 100vw; - position: fixed; - left: -100vw; - } -} +body{margin:0}.page-wrapper{display:flex;flex-direction:column;min-height:100vh}.action.skip:not(:focus),.block.newsletter .label,.minicart-wrapper .action.showcart .counter-label,.minicart-wrapper .action.showcart .text,.page-header .switcher .label,.product-item-actions .actions-secondary>.action span{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.alink,a{color:#006bb4;text-decoration:none}.page-header .panel.wrapper{background-color:#6e716e;color:#fff}.header.panel>.header.links{list-style:none none;float:right;font-size:0;margin-right:20px}.header.panel>.header.links>li{font-size:14px;margin:0 0 0 15px}.block-search .action.search,.block-search .block-title,.block-search .nested,.block.newsletter .title,.breadcrumbs .item,.nav-toggle,.no-display,.page-footer .switcher .options ul.dropdown,.page-header .switcher .options ul.dropdown{display:none}.block-search .label>span{height:1px;overflow:hidden;position:absolute}.logo{float:left;margin:0 0 10px 40px}.minicart-wrapper{float:right}.page-footer{margin-top:25px}.footer.content{border-top:1px solid #cecece;padding-top:20px}.block.newsletter .actions{display:table-cell;vertical-align:top;width:1%}.block-banners .banner-items,.block-banners-inline .banner-items,.block-event .slider-panel .slider,.footer.content ul,.product-items{margin:0;padding:0;list-style:none none}.copyright{background-color:#6e716e;color:#fff;box-sizing:border-box;display:block;padding:10px;text-align:center}.modal-popup,.modal-slide{visibility:hidden;opacity:0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],input[type=url]{background:#fff;background-clip:padding-box;border:1px solid #c2c2c2;border-radius:1px;font-size:14px;height:32px;line-height:1.42857143;padding:0 9px;vertical-align:baseline;width:100%;box-sizing:border-box}.action.primary{background:#1979c3;border:1px solid #1979c3;color:#fff;font-weight:600;padding:7px 15px}.block.newsletter .form.subscribe{display:table}.footer.content .links a{color:#575757}.load.indicator{background-color:rgba(255,255,255,.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url(../images/loader-2.gif) no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative}@media (min-width:768px),print{body,html{height:100%}.page-header{border:0;margin-bottom:0}.nav-sections-item-title,.section-item-content .switcher-currency,ul.header.links li.customer-welcome,ul.level0.submenu{display:none}.abs-add-clearfix-desktop:after,.abs-add-clearfix-desktop:before,.account .column.main .block.block-order-details-view:after,.account .column.main .block.block-order-details-view:before,.account .column.main .block:not(.widget) .block-content:after,.account .column.main .block:not(.widget) .block-content:before,.account .page-title-wrapper:after,.account .page-title-wrapper:before,.block-addresses-list .items.addresses:after,.block-addresses-list .items.addresses:before,.block-cart-failed .block-content:after,.block-cart-failed .block-content:before,.block-giftregistry-shared .item-options:after,.block-giftregistry-shared .item-options:before,.block-wishlist-management:after,.block-wishlist-management:before,.cart-container:after,.cart-container:before,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .content:before,.data.table .gift-wrapping .nested:after,.data.table .gift-wrapping .nested:before,.header.content:after,.header.content:before,.login-container:after,.login-container:before,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:before,.order-links:after,.order-links:before,.order-review-form:after,.order-review-form:before,.page-header .header.panel:after,.page-header .header.panel:before,.paypal-review .block-content:after,.paypal-review .block-content:before,.paypal-review-discount:after,.paypal-review-discount:before,.sales-guest-view .column.main .block.block-order-details-view:after,.sales-guest-view .column.main .block.block-order-details-view:before,[class^=sales-guest-] .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:before{content:'';display:table}.abs-add-clearfix-desktop:after,.account .column.main .block.block-order-details-view:after,.account .column.main .block:not(.widget) .block-content:after,.account .page-title-wrapper:after,.block-addresses-list .items.addresses:after,.block-cart-failed .block-content:after,.block-giftregistry-shared .item-options:after,.block-wishlist-management:after,.cart-container:after,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .nested:after,.header.content:after,.login-container:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.order-links:after,.order-review-form:after,.page-header .header.panel:after,.paypal-review .block-content:after,.paypal-review-discount:after,.sales-guest-view .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:after{clear:both}ul.header.links li{display:inline-block}.block.category.event,.breadcrumbs,.footer.content,.header.content,.navigation,.page-header .header.panel,.page-main,.page-wrapper>.page-bottom,.page-wrapper>.widget,.top-container{box-sizing:border-box;margin-left:auto;margin-right:auto;max-width:1280px;padding-left:20px;padding-right:20px;width:auto}.panel.header{padding:10px 20px}.page-header .switcher{float:right;margin-left:15px;margin-right:-6px}.header.panel>.header.links>li>a{color:#fff}.header.content{padding:30px 20px 0}.logo{margin:-8px auto 25px 0}.minicart-wrapper{margin-left:13px}.compare.wrapper{list-style:none none}.nav-sections{margin-bottom:25px}.nav-sections-item-content>.navigation{display:block}.navigation{background:#f0f0f0;font-weight:700;height:inherit;left:auto;overflow:inherit;padding:0;position:relative;top:0;width:100%;z-index:3}.navigation ul{margin-top:0;margin-bottom:0;padding:0 8px;position:relative}.navigation .level0{margin:0 10px 0 0;display:inline-block}.navigation .level0>.level-top{color:#575757;line-height:47px;padding:0 12px}.page-main{width:100%}.page-footer{background:#f4f4f4;padding-bottom:25px}.footer.content .links{display:inline-block;padding-right:50px;vertical-align:top}.footer.content ul{padding-right:50px}.footer.content .links li{border:none;font-size:14px;margin:0 0 8px;padding:0}.footer.content .block{float:right}.block.newsletter{width:34%}}@media only screen and (max-width:767px){.compare.wrapper,.panel.wrapper,[class*=block-compare]{display:none}.footer.content .links>li{background:#f4f4f4;font-size:1.6rem;border-top:1px solid #cecece;margin:0 -15px;padding:0 15px}.page-header .header.panel,.page-main{padding-left:15px;padding-right:15px}.header.content{padding-top:10px}.nav-sections-items:after,.nav-sections-items:before{content:'';display:table}.nav-sections-items:after{clear:both}.nav-sections{width:100vw;position:fixed;left:-100vw}} From deedc34a5c23e96c4956319d470f84fb5ffa3b36 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 09:31:44 -0500 Subject: [PATCH 341/464] MC-16886: Add preload feature for fonts load --- lib/internal/Magento/Framework/View/Page/Config/Renderer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index d93b3c271995f..91723d81c9d31 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -22,6 +22,7 @@ class Renderer implements RendererInterface */ protected $assetTypeOrder = [ 'css', + 'ico', 'js', 'eot', 'svg', From 2dc52a172ffb7cb13965b2b7ebbbce1d55e6f8ad Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Mon, 3 Jun 2019 09:45:52 -0500 Subject: [PATCH 342/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml | 3 +++ ...tualProductWithCustomOptionsSuiteAndImportOptionsTest.xml | 3 +++ ...nCreateVirtualProductWithTierPriceForGeneralGroupTest.xml | 3 +++ .../Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml | 3 +++ .../Test/AdminCreateVirtualProductWithoutManageStockTest.xml | 3 +++ .../Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml | 3 +++ ...ProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml | 5 +++++ .../Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml | 2 +- ...teSimpleProductWithRegularPriceInStockEnabledFlatTest.xml | 2 +- ...ductWithRegularPriceInStockNotVisibleIndividuallyTest.xml | 3 +++ ...tWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml | 3 +++ ...roductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml | 3 +++ ...ProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml | 3 +++ ...leProductWithRegularPriceInStockWithCustomOptionsTest.xml | 3 +++ ...dminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml | 3 +++ ...oductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml | 3 +++ ...rPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml | 3 +++ ...ctWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml | 3 +++ ...WithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml | 3 +++ ...hSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml | 3 +++ ...uctWithTierPriceInStockVisibleInCategoryAndSearchTest.xml | 2 +- ...lProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml | 3 +++ ...WithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml | 3 +++ ...eateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml | 2 +- 24 files changed, 66 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml index 26ad7a46a73d7..e516a046e489e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml index 17769c79677f7..6ee3fa6c60b82 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml index 78247f4943596..b777babf3b3aa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml index 6ef2569945fa6..28923674f4ab3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml index cb41b0292d33a..8c5085501b799 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml index 8a44c8093ca5e..87e0bf3d2e9a0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-56"/> <group value="Catalog"/> <group value="Product Attributes"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml index 18e4ff9ee2c99..80f0c8ad10ede 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml @@ -52,9 +52,14 @@ <!-- Assign simple product to created store view --> <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="clickCategoryStoreViewDropdownToggle"/> + <waitForPageLoad stepKey="waitForStoreViewDropdown"/> + <waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(customStoreFR.name)}}" stepKey="waitForStoreViewOption"/> <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(customStoreFR.name)}}" stepKey="selectCategoryStoreViewOption"/> + <waitForPageLoad stepKey="waitForAcceptModal"/> + <waitForElementVisible selector="{{AdminProductFormChangeStoreSection.acceptButton}}" stepKey="waitForAcceptButton"/> <click selector="{{AdminProductFormChangeStoreSection.acceptButton}}" stepKey="clickAcceptButton"/> <waitForPageLoad stepKey="waitForThePageToLoad"/> + <waitForElementNotVisible selector="{{AdminProductFormChangeStoreSection.acceptButton}}" stepKey="waitForAcceptButtonGone"/> <uncheckOption selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="uncheckProductStatus"/> <!-- Update default simple product with name --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml index d2a7c4ad59576..d151bae3ee110 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml @@ -18,7 +18,7 @@ <group value="catalog"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17181"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml index a542c9390c12e..d30500de64a32 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml @@ -18,7 +18,7 @@ <group value="catalog"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17181"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml index d08ef9c93999c..cb7b3d6278aa8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml index a695982921cfd..75b4a9728d08b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml index ba52c6d2bc261..f8b0b17c06253 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml index cb5c24839e387..ee2a2514c9c7e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml index 9a98d629f13ac..7921ed6c3e459 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml index 54ed753b80a1c..0125b4c1e713d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml index 9bdc93e61e499..d7ceefb03d3b1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml index 34d85e7b46850..ef02b73ea16d4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml index e64022b311614..b5ee6d8112b50 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml index 9b6a56d6f81d8..64342d18198c5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml index 920a0a494bae5..7378a7f111c30 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml index d4b62a09ebcd2..ddb4002a5dba3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml @@ -18,7 +18,7 @@ <group value="catalog"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17181"/> </skip> </annotations> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml index 717d710b4a288..9aff504f58f81 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml index 703a4e24cdca9..41796bcc2c3a9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <group value="catalog"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17181"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index 2a1eda17361eb..8712edb69e499 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -17,7 +17,7 @@ <group value="urlRewrite"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17181"/> </skip> </annotations> From aa7a1ba24cc1c77216fa66662d60bbc97196b6a2 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Mon, 3 Jun 2019 10:12:19 -0500 Subject: [PATCH 343/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/Mftf/Test/AdminExportBundleProductTest.xml | 2 +- .../Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml | 2 +- ...ExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml | 2 +- .../Test/AdminExportSimpleProductWithCustomAttributeTest.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml index 4649dee67370f..281c8c0db307a 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml @@ -19,7 +19,7 @@ <group value="catalog_import_export"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-15934"/> </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml index 28431fbc720df..c47b7dc83af28 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml @@ -19,7 +19,7 @@ <group value="catalog_import_export"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-15934"/> </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml index 6ef26e5b615bd..160abe617995d 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml @@ -19,7 +19,7 @@ <group value="catalog_import_export"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-15934"/> </skip> </annotations> <before> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml index d85cb9f0be14a..f958978a9efae 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml @@ -19,7 +19,7 @@ <group value="catalog_import_export"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-15934"/> </skip> </annotations> <before> From 19acb44ff368b333b5f55b43234de918f41c10c9 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Mon, 3 Jun 2019 10:41:45 -0500 Subject: [PATCH 344/464] MC-16709: Create new benchmark scenario for cloud measurements --- setup/performance-toolkit/README.md | 56 ++--- setup/performance-toolkit/benchmark.jmx | 284 ++++++++++++------------ 2 files changed, 170 insertions(+), 170 deletions(-) diff --git a/setup/performance-toolkit/README.md b/setup/performance-toolkit/README.md index ed87855eef211..ede66e040753f 100644 --- a/setup/performance-toolkit/README.md +++ b/setup/performance-toolkit/README.md @@ -73,9 +73,9 @@ Main parameters: | adminPoolUsers | 0 | Total number of Admin threads. | | csrPoolUsers | 0 | Total number of CSR threads. | | apiPoolUsers | 0 | Total number of API threads. | -| deadLocksPoolUsers | 0 | Total number of One Thread Scenarios threads. | +| oneThreadScenariosPoolUsers | 0 | Total number of One Thread Scenarios threads. | | graphQLPoolUsers | 0 | Total number of GraphQL threads. | -| cloudBenchmarkPoolUsers | 0 | Total number of Cloud Benchmark threads. | +| combinedBenchmarkPoolUsers | 0 | Total number of Combined Benchmark threads. | Parameters for Frontend pool: @@ -162,30 +162,30 @@ Parameters for GraphQL pool: | graphqlCatalogBrowsingByGuestPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | | graphqlCheckoutByGuestPercentage | 0 | Percentage of threads in GraphQL Pool that emulate GraphQL requests activities. | -Parameters for Cloud Benchmark pool: - -| Parameter Name | Default Value | Description | -| ----------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------- | -| cloudBrowseCatalogByGuestPercentage | 29 | Percentage of threads in Cloud Benchmark Pool that emulate customer catalog browsing activities. | -| cloudSiteSearchPercentage | 29 | Percentage of threads in Cloud Benchmark Pool that emulate catalog search activities. | -| cloudAddToCartByGuestPercentage | 26 | Percentage of threads in Cloud Benchmark Pool that emulate abandoned cart activities. | -| cloudAddToWishlistPercentage | 1.5 | Percentage of threads in Cloud Benchmark Pool that emulate adding products to Wishlist. | -| cloudCompareProductsPercentage | 1.5 | Percentage of threads in Cloud Benchmark Pool that emulate products comparison. | -| cloudCheckoutByGuestPercentage | 3.5 | Percentage of threads in Cloud Benchmark Pool that emulate checkout by guest. | -| cloudCheckoutByCustomerPercentage | 3.5 | Percentage of threads in Cloud Benchmark Pool that emulate checkout by customer. | -| cloudAccountManagementPercentage | 1 | Percentage of threads in Cloud Benchmark Pool that emulate account management. | -| cloudAdminCMSManagementPercentage | 0.35 | Percentage of threads in Cloud Benchmark Pool that emulate CMS management activities. | -| cloudAdminBrowseProductGridPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate products grid browsing activities. | -| cloudAdminBrowseOrderGridPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate orders grid browsing activities. | -| cloudAdminProductCreationPercentage | 0.5 | Percentage of threads in Cloud Benchmark Pool that emulate product creation activities. | -| cloudAdminProductEditingPercentage | 0.65 | Percentage of threads in Cloud Benchmark Pool that emulate product editing activities. | -| cloudAdminReturnsManagementPercentage | 0.75 | Percentage of threads in Cloud Benchmark Pool that emulate admin returns management activities. | -| cloudAdminBrowseCustomerGridPercentage | 0.1 | Percentage of threads in Cloud Benchmark Pool that emulate customers grid browsing activities. | -| cloudAdminCreateOrderPercentage | 0.5 | Percentage of threads in Cloud Benchmark Pool that emulate creating orders activities. | -| cloudAdminCategoryManagementPercentage | 0.15 | Percentage of threads in Cloud Benchmark Pool that emulate admin category management activities. | -| cloudAdminPromotionRulesPercentage | 0.2 | Percentage of threads in Cloud Benchmark Pool that emulate admin promotion rules activities. | -| cloudAdminCustomerManagementPercentage | 0.4 | Percentage of threads in Cloud Benchmark Pool that emulate admin customers management activities. | -| cloudAdminEditOrderPercentage | 1 | Percentage of threads in Cloud Benchmark Pool that emulate admin edit order activities. | +Parameters for Combined Benchmark pool: + +| Parameter Name | Default Value | Description | +| ----------------------------------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------- | +| cBrowseCatalogByGuestPercentage | 29 | Percentage of threads in Combined Benchmark Pool that emulate customer catalog browsing activities. | +| cSiteSearchPercentage | 29 | Percentage of threads in Combined Benchmark Pool that emulate catalog search activities. | +| cAddToCartByGuestPercentage | 26 | Percentage of threads in Combined Benchmark Pool that emulate abandoned cart activities. | +| cAddToWishlistPercentage | 1.5 | Percentage of threads in Combined Benchmark Pool that emulate adding products to Wishlist. | +| cCompareProductsPercentage | 1.5 | Percentage of threads in Combined Benchmark Pool that emulate products comparison. | +| cCheckoutByGuestPercentage | 3.5 | Percentage of threads in Combined Benchmark Pool that emulate checkout by guest. | +| cCheckoutByCustomerPercentage | 3.5 | Percentage of threads in Combined Benchmark Pool that emulate checkout by customer. | +| cAccountManagementPercentage | 1 | Percentage of threads in Combined Benchmark Pool that emulate account management. | +| cAdminCMSManagementPercentage | 0.35 | Percentage of threads in Combined Benchmark Pool that emulate CMS management activities. | +| cAdminBrowseProductGridPercentage | 0.2 | Percentage of threads in Combined Benchmark Pool that emulate products grid browsing activities. | +| cAdminBrowseOrderGridPercentage | 0.2 | Percentage of threads in Combined Benchmark Pool that emulate orders grid browsing activities. | +| cAdminProductCreationPercentage | 0.5 | Percentage of threads in Combined Benchmark Pool that emulate product creation activities. | +| cAdminProductEditingPercentage | 0.65 | Percentage of threads in Combined Benchmark Pool that emulate product editing activities. | +| cAdminReturnsManagementPercentage | 0.75 | Percentage of threads in Combined Benchmark Pool that emulate admin returns management activities. | +| cAdminBrowseCustomerGridPercentage | 0.1 | Percentage of threads in Combined Benchmark Pool that emulate customers grid browsing activities. | +| cAdminCreateOrderPercentage | 0.5 | Percentage of threads in Combined Benchmark Pool that emulate creating orders activities. | +| cAdminCategoryManagementPercentage | 0.15 | Percentage of threads in Combined Benchmark Pool that emulate admin category management activities. | +| cAdminPromotionRulesPercentage | 0.2 | Percentage of threads in Combined Benchmark Pool that emulate admin promotion rules activities. | +| cAdminCustomerManagementPercentage | 0.4 | Percentage of threads in Combined Benchmark Pool that emulate admin customers management activities. | +| cAdminEditOrderPercentage | 1 | Percentage of threads in Combined Benchmark Pool that emulate admin edit order activities. | Parameters must be passed to the command line with the `J` prefix: @@ -297,11 +297,11 @@ For more details, read [Summary Report](http://jmeter.apache.org/usermanual/comp **API Pool** (apiPoolUsers) -**One Thread Scenarios (Vulnerable to deadlocks) Pool** (deadLocksPoolUsers) +**One Thread Scenarios Pool** (oneThreadScenariosPoolUsers) **GraphQL Pool** (graphQLPoolUsers) -**Cloud Benchmark Pool** (cloudBenchmarkPoolUsers) +**Combined Benchmark Pool** (combinedBenchmarkPoolUsers) **Legacy Threads** diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index eb45b875c94b7..c2e64b9c244b8 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -89,9 +89,9 @@ <stringProp name="Argument.value">${__P(apiPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="deadLocksPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">deadLocksPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(deadLocksPoolUsers,0)}</stringProp> + <elementProp name="oneThreadScenariosPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">oneThreadScenariosPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(oneThreadScenariosPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="graphQLPoolUsers" elementType="Argument"> @@ -99,9 +99,9 @@ <stringProp name="Argument.value">${__P(graphQLPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudBenchmarkPoolUsers" elementType="Argument"> - <stringProp name="Argument.name">cloudBenchmarkPoolUsers</stringProp> - <stringProp name="Argument.value">${__P(cloudBenchmarkPoolUsers,0)}</stringProp> + <elementProp name="combinedBenchmarkPoolUsers" elementType="Argument"> + <stringProp name="Argument.name">combinedBenchmarkPoolUsers</stringProp> + <stringProp name="Argument.value">${__P(combinedBenchmarkPoolUsers,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="accountManagementPercentage" elementType="Argument"> @@ -299,124 +299,124 @@ <stringProp name="Argument.value">${__P(browseProductGridPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="catalogGraphQLPercentage" elementType="Argument"> - <stringProp name="Argument.name">catalogGraphQLPercentage</stringProp> - <stringProp name="Argument.value">${__P(catalogGraphQLPercentage,0)}</stringProp> + <elementProp name="cAccountManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAccountManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAccountManagementPercentage,1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="categories_count" elementType="Argument"> - <stringProp name="Argument.name">categories_count</stringProp> - <stringProp name="Argument.value">${__P(categories_count,100)}</stringProp> + <elementProp name="cAddToCartByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAddToCartByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAddToCartByGuestPercentage,26)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="checkoutByCustomerPercentage" elementType="Argument"> - <stringProp name="Argument.name">checkoutByCustomerPercentage</stringProp> - <stringProp name="Argument.value">${__P(checkoutByCustomerPercentage,0)}</stringProp> + <elementProp name="cAddToWishlistPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAddToWishlistPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAddToWishlistPercentage,1.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="checkoutByGuestPercentage" elementType="Argument"> - <stringProp name="Argument.name">checkoutByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(checkoutByGuestPercentage,0)}</stringProp> + <elementProp name="cAdminBrowseCustomerGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminBrowseCustomerGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminBrowseCustomerGridPercentage,0.1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAccountManagementPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAccountManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAccountManagementPercentage,1)}</stringProp> + <elementProp name="cAdminBrowseOrderGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminBrowseOrderGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminBrowseOrderGridPercentage,0.2)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAddToCartByGuestPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAddToCartByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAddToCartByGuestPercentage,26)}</stringProp> + <elementProp name="cAdminBrowseProductGridPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminBrowseProductGridPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminBrowseProductGridPercentage,0.2)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAddToWishlistPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAddToWishlistPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAddToWishlistPercentage,1.5)}</stringProp> + <elementProp name="cAdminCMSManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminCMSManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminCMSManagementPercentage,0.35)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminBrowseCustomerGridPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminBrowseCustomerGridPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminBrowseCustomerGridPercentage,0.1)}</stringProp> + <elementProp name="cAdminCategoryManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminCategoryManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminCategoryManagementPercentage,0.15)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminBrowseOrderGridPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminBrowseOrderGridPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminBrowseOrderGridPercentage,0.2)}</stringProp> + <elementProp name="cAdminCreateOrderPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminCreateOrderPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminCreateOrderPercentage,0.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminBrowseProductGridPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminBrowseProductGridPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminBrowseProductGridPercentage,0.2)}</stringProp> + <elementProp name="cAdminCustomerManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminCustomerManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminCustomerManagementPercentage,0.4)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminCMSManagementPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminCMSManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminCMSManagementPercentage,0.35)}</stringProp> + <elementProp name="cAdminEditOrderPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminEditOrderPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminEditOrderPercentage,1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminCategoryManagementPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminCategoryManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminCategoryManagementPercentage,0.15)}</stringProp> + <elementProp name="cAdminProductCreationPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminProductCreationPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminProductCreationPercentage,0.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminCreateOrderPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminCreateOrderPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminCreateOrderPercentage,0.5)}</stringProp> + <elementProp name="cAdminProductEditingPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminProductEditingPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminProductEditingPercentage,0.65)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminCustomerManagementPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminCustomerManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminCustomerManagementPercentage,0.4)}</stringProp> + <elementProp name="cAdminPromotionRulesPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminPromotionRulesPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminPromotionRulesPercentage,0.2)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminEditOrderPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminEditOrderPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminEditOrderPercentage,1)}</stringProp> + <elementProp name="cAdminReturnsManagementPercentage" elementType="Argument"> + <stringProp name="Argument.name">cAdminReturnsManagementPercentage</stringProp> + <stringProp name="Argument.value">${__P(cAdminReturnsManagementPercentage,0.75)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminProductCreationPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminProductCreationPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminProductCreationPercentage,0.5)}</stringProp> + <elementProp name="cBrowseCatalogByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cBrowseCatalogByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cBrowseCatalogByGuestPercentage,29)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminProductEditingPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminProductEditingPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminProductEditingPercentage,0.65)}</stringProp> + <elementProp name="cCheckoutByCustomerPercentage" elementType="Argument"> + <stringProp name="Argument.name">cCheckoutByCustomerPercentage</stringProp> + <stringProp name="Argument.value">${__P(cCheckoutByCustomerPercentage,3.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminPromotionRulesPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminPromotionRulesPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminPromotionRulesPercentage,0.2)}</stringProp> + <elementProp name="cCheckoutByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">cCheckoutByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(cCheckoutByGuestPercentage,3.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudAdminReturnsManagementPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudAdminReturnsManagementPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudAdminReturnsManagementPercentage,0.75)}</stringProp> + <elementProp name="cCompareProductsPercentage" elementType="Argument"> + <stringProp name="Argument.name">cCompareProductsPercentage</stringProp> + <stringProp name="Argument.value">${__P(cCompareProductsPercentage,1.5)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudBrowseCatalogByGuestPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudBrowseCatalogByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudBrowseCatalogByGuestPercentage,29)}</stringProp> + <elementProp name="cSiteSearchPercentage" elementType="Argument"> + <stringProp name="Argument.name">cSiteSearchPercentage</stringProp> + <stringProp name="Argument.value">${__P(cSiteSearchPercentage,29)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudCheckoutByCustomerPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudCheckoutByCustomerPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudCheckoutByCustomerPercentage,3.5)}</stringProp> + <elementProp name="catalogGraphQLPercentage" elementType="Argument"> + <stringProp name="Argument.name">catalogGraphQLPercentage</stringProp> + <stringProp name="Argument.value">${__P(catalogGraphQLPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudCheckoutByGuestPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudCheckoutByGuestPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudCheckoutByGuestPercentage,3.5)}</stringProp> + <elementProp name="categories_count" elementType="Argument"> + <stringProp name="Argument.name">categories_count</stringProp> + <stringProp name="Argument.value">${__P(categories_count,100)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudCompareProductsPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudCompareProductsPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudCompareProductsPercentage,1.5)}</stringProp> + <elementProp name="checkoutByCustomerPercentage" elementType="Argument"> + <stringProp name="Argument.name">checkoutByCustomerPercentage</stringProp> + <stringProp name="Argument.value">${__P(checkoutByCustomerPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="cloudSiteSearchPercentage" elementType="Argument"> - <stringProp name="Argument.name">cloudSiteSearchPercentage</stringProp> - <stringProp name="Argument.value">${__P(cloudSiteSearchPercentage,29)}</stringProp> + <elementProp name="checkoutByGuestPercentage" elementType="Argument"> + <stringProp name="Argument.name">checkoutByGuestPercentage</stringProp> + <stringProp name="Argument.value">${__P(checkoutByGuestPercentage,0)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="compareProductsPercentage" elementType="Argument"> @@ -27205,13 +27205,13 @@ if (testLabel </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="One Thread Scenarios (Vulnerable to deadlocks) Pool" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="One Thread Scenarios Pool" enabled="true"> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> <boolProp name="LoopController.continue_forever">false</boolProp> <stringProp name="LoopController.loops">${loops}</stringProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">${deadLocksPoolUsers}</stringProp> + <stringProp name="ThreadGroup.num_threads">${oneThreadScenariosPoolUsers}</stringProp> <stringProp name="ThreadGroup.ramp_time">${ramp_period}</stringProp> <longProp name="ThreadGroup.start_time">1505803944000</longProp> <longProp name="ThreadGroup.end_time">1505803944000</longProp> @@ -44431,13 +44431,13 @@ vars.put("coupon_code", coupons[number].code); </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Cloud Benchmark Pool" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Combined Benchmark Pool" enabled="true"> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> <boolProp name="LoopController.continue_forever">false</boolProp> <stringProp name="LoopController.loops">${loops}</stringProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">${cloudBenchmarkPoolUsers}</stringProp> + <stringProp name="ThreadGroup.num_threads">${combinedBenchmarkPoolUsers}</stringProp> <stringProp name="ThreadGroup.ramp_time">${ramp_period}</stringProp> <longProp name="ThreadGroup.start_time">1505803944000</longProp> <longProp name="ThreadGroup.end_time">1505803944000</longProp> @@ -44470,11 +44470,11 @@ function doCache(){ <stringProp name="TestPlan.comments">mpaf/tool/fragments/ce/common/cache_hit_miss.jmx</stringProp></JSR223PreProcessor> <hashTree/> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Catalog Browsing By Guest" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Catalog Browsing By Guest" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudBrowseCatalogByGuestPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cBrowseCatalogByGuestPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -44495,7 +44495,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Catalog Browsing By Guest"); + vars.put("testLabel", "[C] Catalog Browsing By Guest"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -44783,11 +44783,11 @@ vars.put("product_sku", product.get("sku")); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Site Search" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Site Search" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudSiteSearchPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cSiteSearchPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -44808,7 +44808,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Site Search"); + vars.put("testLabel", "[C] Site Search"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -45866,11 +45866,11 @@ vars.put("product_url_key", product); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Add To Cart By Guest" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Add To Cart By Guest" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAddToCartByGuestPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAddToCartByGuestPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -45891,7 +45891,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Add To Cart By Guest"); + vars.put("testLabel", "[C] Add To Cart By Guest"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -46643,11 +46643,11 @@ vars.put("totalProductsAdded", String.valueOf(productsAdded)); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Add to Wishlist" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Add to Wishlist" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAddToWishlistPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAddToWishlistPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -46668,7 +46668,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Add to Wishlist"); + vars.put("testLabel", "[C] Add to Wishlist"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -47182,11 +47182,11 @@ customerUserList.add(vars.get("customer_email")); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Compare Products" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Compare Products" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudCompareProductsPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cCompareProductsPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -47207,7 +47207,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Compare Products"); + vars.put("testLabel", "[C] Compare Products"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -47751,11 +47751,11 @@ vars.put("totalProductsAdded", String.valueOf(productsAdded)); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Checkout By Guest" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Checkout By Guest" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudCheckoutByGuestPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cCheckoutByGuestPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -47776,7 +47776,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Checkout By Guest"); + vars.put("testLabel", "[C] Checkout By Guest"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -48892,11 +48892,11 @@ vars.put("totalProductsAdded", String.valueOf(productsAdded)); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Checkout By Customer" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Checkout By Customer" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudCheckoutByCustomerPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cCheckoutByCustomerPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -48917,7 +48917,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Checkout By Customer"); + vars.put("testLabel", "[C] Checkout By Customer"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -50229,11 +50229,11 @@ customerUserList.add(vars.get("customer_email")); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Account management" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Account management" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAccountManagementPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAccountManagementPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -50254,7 +50254,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Account management"); + vars.put("testLabel", "[C] Account management"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -50952,11 +50952,11 @@ customerUserList.add(vars.get("customer_email")); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin CMS Management" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin CMS Management" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminCMSManagementPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminCMSManagementPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -50977,7 +50977,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin CMS Management"); + vars.put("testLabel", "[C] Admin CMS Management"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -51432,11 +51432,11 @@ vars.put("admin_user", adminUser); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Product Grid" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Browse Product Grid" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseProductGridPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminBrowseProductGridPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -51457,7 +51457,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Browse Product Grid"); + vars.put("testLabel", "[C] Admin Browse Product Grid"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -52209,11 +52209,11 @@ vars.put("grid_pages_count_filtered", pageCount); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Order Grid" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Browse Order Grid" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseOrderGridPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminBrowseOrderGridPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -52234,7 +52234,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Browse Order Grid"); + vars.put("testLabel", "[C] Admin Browse Order Grid"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -52986,11 +52986,11 @@ vars.put("grid_pages_count_filtered", pageCount); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Create Product" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Create Product" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminProductCreationPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminProductCreationPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -53011,7 +53011,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Create Product"); + vars.put("testLabel", "[C] Admin Create Product"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -59908,11 +59908,11 @@ function addConfigurableMatrix(attributes) { </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Edit Product" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Edit Product" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminProductEditingPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminProductEditingPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -59933,7 +59933,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Edit Product"); + vars.put("testLabel", "[C] Admin Edit Product"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -62403,11 +62403,11 @@ vars.put("admin_user", adminUser); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Returns Management" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Returns Management" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminReturnsManagementPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminReturnsManagementPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -62428,7 +62428,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Returns Management"); + vars.put("testLabel", "[C] Admin Returns Management"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -63294,11 +63294,11 @@ vars.put("admin_user", adminUser); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Browse Customer Grid" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Browse Customer Grid" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminBrowseCustomerGridPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminBrowseCustomerGridPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -63319,7 +63319,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Browse Customer Grid"); + vars.put("testLabel", "[C] Admin Browse Customer Grid"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -64071,11 +64071,11 @@ vars.put("grid_pages_count_filtered", pageCount); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Create Order" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Create Order" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminCreateOrderPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminCreateOrderPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -64096,7 +64096,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Create Order"); + vars.put("testLabel", "[C] Admin Create Order"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -65389,11 +65389,11 @@ catch (java.lang.Exception e) { </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Category Management" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Category Management" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminCategoryManagementPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminCategoryManagementPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -65414,7 +65414,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Category Management"); + vars.put("testLabel", "[C] Admin Category Management"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -66433,11 +66433,11 @@ vars.put("new_parent_category_id", props.get("admin_category_ids_list").get(cate </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Promotion Rules" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Promotion Rules" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminPromotionRulesPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminPromotionRulesPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -66458,7 +66458,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Promotion Rules"); + vars.put("testLabel", "[C] Admin Promotion Rules"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -67117,11 +67117,11 @@ vars.put("admin_user", adminUser); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Customer Management" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Customer Management" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminCustomerManagementPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminCustomerManagementPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -67142,7 +67142,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Customer Management"); + vars.put("testLabel", "[C] Admin Customer Management"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> @@ -69266,11 +69266,11 @@ vars.put("admin_user", adminUser); </hashTree> - <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Cloud Admin Edit Order" enabled="true"> + <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="[C] Admin Edit Order" enabled="true"> <intProp name="ThroughputController.style">1</intProp> <boolProp name="ThroughputController.perThread">false</boolProp> <intProp name="ThroughputController.maxThroughput">1</intProp> - <stringProp name="ThroughputController.percentThroughput">${cloudAdminEditOrderPercentage}</stringProp> + <stringProp name="ThroughputController.percentThroughput">${cAdminEditOrderPercentage}</stringProp> <stringProp name="TestPlan.comments">mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx</stringProp></ThroughputController> <hashTree> <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="Set Test Label" enabled="true"> @@ -69291,7 +69291,7 @@ if (testLabel <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="SetUp - Set Label" enabled="true"> <stringProp name="BeanShellSampler.query"> - vars.put("testLabel", "Cloud Admin Edit Order"); + vars.put("testLabel", "[C] Admin Edit Order"); </stringProp> <boolProp name="BeanShellSampler.resetInterpreter">true</boolProp> </BeanShellSampler> From f34dfbc98b787f91778747a97884108223ae19c4 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Mon, 3 Jun 2019 10:44:29 -0500 Subject: [PATCH 345/464] MC-16607: Fix Unrelated Static Test Failures - fix tests failures --- app/code/Magento/Reports/Block/Adminhtml/Grid.php | 7 ++++--- lib/internal/Magento/Framework/Data/Form/FormKey.php | 2 ++ .../Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index fac56fa966ec5..f6836e8f1a0ae 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -109,9 +109,11 @@ protected function _prepareCollection() } if (is_string($filter)) { - $data = []; $filter = $this->urlDecoder->decode($filter); - parse_str(urldecode($filter), $data); + + /** @var $request \Magento\Framework\HTTP\PhpEnvironment\Request */ + $request = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\HTTP\PhpEnvironment\Request::class); + $data = $request->setRequestUri(urldecode($filter))->getQuery()->toArray(); if (!isset($data['report_from'])) { // getting all reports from 2001 year @@ -136,7 +138,6 @@ protected function _prepareCollection() $this->_setFilterValues($data); } elseif ($filter && is_array($filter)) { $this->_setFilterValues($filter); - // phpcs:ignore Magento2.Functions.DiscouragedFunction } elseif (0 !== count($this->_defaultFilter)) { $this->_setFilterValues($this->_defaultFilter); } diff --git a/lib/internal/Magento/Framework/Data/Form/FormKey.php b/lib/internal/Magento/Framework/Data/Form/FormKey.php index 484cea1f795cc..355460902eee6 100644 --- a/lib/internal/Magento/Framework/Data/Form/FormKey.php +++ b/lib/internal/Magento/Framework/Data/Form/FormKey.php @@ -11,6 +11,8 @@ * Class FormKey * * @api + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class FormKey { diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php index 5f9d2eaf8ef5e..eb642278694c0 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php @@ -10,6 +10,9 @@ use Magento\Framework\Math\Random; use Magento\Framework\Session\SessionManager; +/** + * Class FormKeyTest + */ class FormKeyTest extends \PHPUnit\Framework\TestCase { /** From f0e8b7a32c9e37df3b0790acfc56c78e27e8cd7d Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Mon, 3 Jun 2019 11:50:29 -0500 Subject: [PATCH 346/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules - Deleting file again (originally in the 8e79510 commit) after merge conflict resolved incorrectly. --- .../Magento/Test/Php/_files/whitelist/exempt_modules/ce.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 19a39adb84387a158d5bde661e49bffc555f8699 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 11:56:03 -0500 Subject: [PATCH 347/464] MC-16871: Test for possible bugs --- .../Theme/Block/Html/Header/CriticalCss.php | 15 ++++----------- app/code/Magento/Theme/etc/frontend/di.xml | 2 +- .../view/frontend/layout/default_head_blocks.xml | 6 +++++- .../Theme/view/frontend/requirejs-config.js | 2 +- .../templates/html/header/criticalCss.phtml | 6 +++--- .../Magento_Theme/layout/default_head_blocks.xml | 1 + .../Magento/blank/web/css/source/_loaders.less | 2 +- .../Framework/View/Page/Config/Renderer.php | 4 ++-- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 587101d7fed59..ee80ff6cf10cd 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -9,15 +9,15 @@ namespace Magento\Theme\Block\Html\Header; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\View\Element\Block\ArgumentInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Asset\Repository; use Magento\Framework\View\Asset\File\NotFoundException; /** - * This block will add inline critical css - * in case dev/css/use_css_critical_path is enabled + * This ViewModel will add inline critical css in case dev/css/use_css_critical_path is enabled */ -class CriticalCss extends Template +class CriticalCss implements ArgumentInterface { /** * @var Repository @@ -36,14 +36,11 @@ class CriticalCss extends Template * @param array $data */ public function __construct( - Template\Context $context, Repository $assetRepo, - string $filePath = '', - array $data = [] + string $filePath = '' ) { $this->assetRepo = $assetRepo; $this->filePath = $filePath; - parent::__construct($context, $data); } /** @@ -55,10 +52,6 @@ public function __construct( public function getCriticalCssData() { try { - if ($this->filePath === '') { - throw new LocalizedException(__("Empty path for critical css")); - } - $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); } catch (LocalizedException | NotFoundException $e) { diff --git a/app/code/Magento/Theme/etc/frontend/di.xml b/app/code/Magento/Theme/etc/frontend/di.xml index 75f0b5af9272c..310f4a717c294 100644 --- a/app/code/Magento/Theme/etc/frontend/di.xml +++ b/app/code/Magento/Theme/etc/frontend/di.xml @@ -32,7 +32,7 @@ </type> <type name="Magento\Theme\Block\Html\Header\CriticalCss"> <arguments> - <item name="filePath" xsi:type="string">css/critical.css</item> + <argument name="filePath" xsi:type="string">css/critical.css</argument> </arguments> </type> </config> diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 6ff31de3303cd..ab4dabfa6d1a0 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -14,7 +14,11 @@ </head> <body> <referenceBlock name="head.additional"> - <block class="Magento\Theme\Block\Html\Header\CriticalCss" name="critical_css_block" as="critical_css" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path" /> + <block name="critical_css_block" as="critical_css" template="Magento_Theme::html/header/criticalCss.phtml" ifconfig="dev/css/use_css_critical_path"> + <arguments> + <argument name="criticalCssViewModel" xsi:type="object">Magento\Theme\Block\Html\Header\CriticalCss</argument> + </arguments> + </block> <block name="css_rel_preload_script" ifconfig="dev/css/use_css_critical_path" template="Magento_Theme::js/css_rel_preload.phtml"/> </referenceBlock> <referenceContainer name="after.body.start"> diff --git a/app/code/Magento/Theme/view/frontend/requirejs-config.js b/app/code/Magento/Theme/view/frontend/requirejs-config.js index a9f874ace6628..aacec30edf188 100644 --- a/app/code/Magento/Theme/view/frontend/requirejs-config.js +++ b/app/code/Magento/Theme/view/frontend/requirejs-config.js @@ -29,7 +29,7 @@ var config = { 'validation': 'mage/validation/validation', 'welcome': 'Magento_Theme/js/view/welcome', 'breadcrumbs': 'Magento_Theme/js/view/breadcrumbs', - 'criticalCssLoader': 'Magento_Theme/js/view/critical-css-loader', + 'criticalCssLoader': 'Magento_Theme/js/view/critical-css-loader' } }, paths: { diff --git a/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml b/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml index 6421f0d5496a9..1a191f5649a19 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/header/criticalCss.phtml @@ -5,11 +5,11 @@ */ /** - * @var \Magento\Theme\Block\Html\Header\CriticalCss $block + * @var \Magento\Theme\Block\Html\Header\CriticalCss $criticalCssViewModel */ ?> -<?php $criticalCssData = $block->getCriticalCssData(); ?> +<?php $criticalCssViewModel = $block->getData('criticalCssViewModel'); ?> <style type="text/css" data-type="criticalCss"> - <?= $criticalCssData; ?> + <?= /* @noEscape */ $criticalCssViewModel->getCriticalCssData() ?> </style> \ No newline at end of file diff --git a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml index 9795a064c94d5..3c9f6036d0dbe 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml +++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml @@ -14,6 +14,7 @@ <font src="fonts/opensans/regular/opensans-400.woff2"/> <font src="fonts/opensans/semibold/opensans-600.woff2"/> <font src="fonts/opensans/bold/opensans-700.woff2"/> + <font src="fonts/Luma-Icons.woff2"/> <meta name="format-detection" content="telephone=no"/> </head> </page> diff --git a/app/design/frontend/Magento/blank/web/css/source/_loaders.less b/app/design/frontend/Magento/blank/web/css/source/_loaders.less index 12ed4d9633075..ed062c382442a 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_loaders.less +++ b/app/design/frontend/Magento/blank/web/css/source/_loaders.less @@ -43,7 +43,7 @@ position: relative; } - [data-role="main-css-loader"] { + [data-role='main-css-loader'] { display: none; } } diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index 91723d81c9d31..ee4894b13c2f2 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -420,10 +420,10 @@ protected function renderAssetHtml(\Magento\Framework\View\Asset\PropertyGroup $ /** * Check if file type can be font * - * @param $type + * @param string $type * @return bool */ - private function canTypeBeFont($type) + private function canTypeBeFont(string $type): bool { return in_array($type, self::FONTS_TYPE); } From 25c9c48eefc4021c623adad1de2263f6c66923f2 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Mon, 3 Jun 2019 12:27:31 -0500 Subject: [PATCH 348/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml | 2 +- ...StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml | 3 +++ .../Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml | 3 +++ .../Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml | 3 +++ .../Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml index 5d2654ed5e75b..055eacaeb2b78 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml @@ -18,7 +18,7 @@ <group value="CatalogRule"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-16684"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml index b4747a6bf7273..d27cb83a8ca5b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-58179"/> <group value="checkout"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> <createData entity="SimpleProduct2" stepKey="createSimpleProduct"> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml index 8469126547eb1..0cba9159dd5ac 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml @@ -17,6 +17,9 @@ <severity value="MAJOR"/> <testCaseId value="MAGETWO-95028"/> <group value="customer"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> <!--Log In--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index ab085dc5ae137..dc5b624c4eabf 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MAGETWO-96722"/> <useCaseId value="MAGETWO-96410"/> <group value="SalesRule"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index 05ced7e61b3b7..345777f0aa0b0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -17,6 +17,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-295"/> <group value="Tax"/> + <skip> + <issueId value="MC-16684"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From b38b57f28b6f5e1c64459740510dbed09f866386 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Mon, 3 Jun 2019 13:21:09 -0500 Subject: [PATCH 349/464] MC-16607: Fix Unrelated Static Test Failures - fix tests failures --- app/code/Magento/Reports/Block/Adminhtml/Grid.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index f6836e8f1a0ae..0b02d0f046d19 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -109,6 +109,7 @@ protected function _prepareCollection() } if (is_string($filter)) { + // this is a replacement for base64_decode() $filter = $this->urlDecoder->decode($filter); /** @var $request \Magento\Framework\HTTP\PhpEnvironment\Request */ From e6ee6ec27e54f5322019dd072a5586a5480ef9e1 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 13:31:21 -0500 Subject: [PATCH 350/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- .../Magento/Theme/Block/Html/Header/CriticalCss.php | 11 ++++++----- .../Magento/Framework/View/Asset/Repository.php | 4 +++- .../Magento/Framework/View/Layout/etc/head.xsd | 1 + .../Framework/View/Page/Config/Reader/Head.php | 6 ------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index ee80ff6cf10cd..b0e2df531bf9b 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -15,7 +15,7 @@ use Magento\Framework\View\Asset\File\NotFoundException; /** - * This ViewModel will add inline critical css in case dev/css/use_css_critical_path is enabled + * This ViewModel will add inline critical css in case dev/css/use_css_critical_path is enabled. */ class CriticalCss implements ArgumentInterface { @@ -30,10 +30,8 @@ class CriticalCss implements ArgumentInterface private $filePath; /** - * @param Template\Context $context * @param Repository $assetRepo * @param string $filePath - * @param array $data */ public function __construct( Repository $assetRepo, @@ -54,8 +52,11 @@ public function getCriticalCssData() try { $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); - } catch (LocalizedException | NotFoundException $e) { - throw new LocalizedException(__("Cannot get critical css file data: ", $e->getMessage())); + } catch (NotFoundException $e) { + throw new LocalizedException(__( + 'Cannot get critical css file data: "%1"', + $e->getMessage() + )); }; return $content; diff --git a/lib/internal/Magento/Framework/View/Asset/Repository.php b/lib/internal/Magento/Framework/View/Asset/Repository.php index 19c9ddd1e9186..74587606db104 100644 --- a/lib/internal/Magento/Framework/View/Asset/Repository.php +++ b/lib/internal/Magento/Framework/View/Asset/Repository.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; use Magento\Framework\View\Design\Theme\ThemeProviderInterface; +use Magento\Framework\Exception\LocalizedException; /** * A repository service for view assets @@ -201,9 +202,10 @@ private function getDefaultParameter($name) /** * Create a file asset that's subject of fallback system * - * @param string $fileId + * @param $fileId * @param array $params * @return File + * @throws LocalizedException */ public function createAsset($fileId, array $params = []) { diff --git a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd index 15762dc2f0ae6..4f0dcf63cbf45 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd @@ -67,6 +67,7 @@ <xs:element name="script" type="scriptType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="remove" type="srcRemoveType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="attribute" type="headAttributeType" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="font" type="linkType" minOccurs="0" maxOccurs="unbounded"/>app/code/Magento/Theme/Block/Html/Header/CriticalCss.php </xs:sequence> </xs:complexType> </xs:schema> diff --git a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php index de971e33b7c72..4da296a585c69 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php @@ -35,8 +35,6 @@ class Head implements Layout\ReaderInterface /** * {@inheritdoc} - * - * @return string[] */ public function getSupportedNodes() { @@ -66,10 +64,6 @@ protected function addContentTypeByNodeName(Layout\Element $node) /** * {@inheritdoc} - * - * @param Layout\Reader\Context $readerContext - * @param Layout\Element $headElement - * @return $this */ public function interpret( Layout\Reader\Context $readerContext, From 2d098e108adb9d3f91cf7608a9d3231911405c3c Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 13:59:09 -0500 Subject: [PATCH 351/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- lib/internal/Magento/Framework/View/Layout/etc/head.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd index 4f0dcf63cbf45..51acc5789a4f8 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd @@ -67,7 +67,7 @@ <xs:element name="script" type="scriptType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="remove" type="srcRemoveType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="attribute" type="headAttributeType" minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="font" type="linkType" minOccurs="0" maxOccurs="unbounded"/>app/code/Magento/Theme/Block/Html/Header/CriticalCss.php + <xs:element name="font" type="linkType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:schema> From 6913ccda938175a01897ccca2a9b3c3e6b50268a Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 14:03:49 -0500 Subject: [PATCH 352/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- lib/internal/Magento/Framework/View/Asset/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Asset/Repository.php b/lib/internal/Magento/Framework/View/Asset/Repository.php index 74587606db104..15b9a7130180a 100644 --- a/lib/internal/Magento/Framework/View/Asset/Repository.php +++ b/lib/internal/Magento/Framework/View/Asset/Repository.php @@ -202,7 +202,7 @@ private function getDefaultParameter($name) /** * Create a file asset that's subject of fallback system * - * @param $fileId + * @param string $fileId * @param array $params * @return File * @throws LocalizedException From 743fecccb4d0c95ae886f06c4de16d222389f18c Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Mon, 3 Jun 2019 14:05:05 -0500 Subject: [PATCH 353/464] MAGETWO-99890: Cannot use the mass update action with the Select All option to assign more than the number of displayed products per page to a website --- app/code/Magento/Ui/view/base/web/js/grid/massactions.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js index 3626f52806881..a1884c20da2e8 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js @@ -153,11 +153,6 @@ define([ var itemsType = data.excludeMode ? 'excluded' : 'selected', selections = {}; - if (itemsType === 'excluded' && data.selected && data.selected.length) { - itemsType = 'selected'; - data[itemsType] = _.difference(data.selected, data.excluded); - } - selections[itemsType] = data[itemsType]; if (!selections[itemsType].length) { From 2888f119aa13c40eb67918037765a89bc4fdd16b Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Mon, 3 Jun 2019 14:26:33 -0500 Subject: [PATCH 354/464] MQE-1583: Stabilize tests with XSD schema fixes --- .../Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index f7d7721778b03..17bc10f350af9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -114,6 +114,6 @@ <waitForPageLoad stepKey="waitForCustomersGrid"/> <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomersGrid"/> <executeJS function="var len = document.querySelectorAll('{{AdminCustomerFiltersSection.countryOptions}}').length; return len-1;" stepKey="countriesAmount2"/> - <assertEquals expected='($countriesAmount)' expectedType="int" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> + <assertEquals expected="($countriesAmount)" expectedType="int" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> </test> </tests> From b223a0e53d003d0c4a9aaadec22a55926e6cb7ba Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Mon, 3 Jun 2019 15:01:48 -0500 Subject: [PATCH 355/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/AdminImportCustomizableOptionToProductWithSKUTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml index 4e182c2e0e5ac..877c3ecab7edf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MAGETWO-98211"/> <useCaseId value="MAGETWO-70232"/> <group value="catalog"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> From 104ba037c6e299034c5d16f6e7fd81d5c0e2d0ec Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 15:50:04 -0500 Subject: [PATCH 356/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- app/code/Magento/Theme/Block/Html/Header/CriticalCss.php | 5 +---- .../Magento/Framework/View/Page/Config/Reader/Head.php | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index b0e2df531bf9b..cbbb7754c374c 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -53,10 +53,7 @@ public function getCriticalCssData() $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); } catch (NotFoundException $e) { - throw new LocalizedException(__( - 'Cannot get critical css file data: "%1"', - $e->getMessage() - )); + $content = ''; }; return $content; diff --git a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php index 4da296a585c69..3bd72da1382a3 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php @@ -34,7 +34,7 @@ class Head implements Layout\ReaderInterface /**#@-*/ /** - * {@inheritdoc} + * @inheritdoc */ public function getSupportedNodes() { @@ -63,7 +63,9 @@ protected function addContentTypeByNodeName(Layout\Element $node) } /** - * {@inheritdoc} + * @param Layout\Reader\Context $readerContext + * @param Layout\Element $headElement + * @return $this|Layout\ReaderInterface */ public function interpret( Layout\Reader\Context $readerContext, From 70f6edb49dc0cf7b12de95950fd6f01e4583edda Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Mon, 3 Jun 2019 15:52:13 -0500 Subject: [PATCH 357/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- app/code/Magento/Theme/Block/Html/Header/CriticalCss.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index cbbb7754c374c..21e0b1b16ba72 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -45,14 +45,13 @@ public function __construct( * Returns critical css data as string. * * @return bool|string - * @throws LocalizedException */ public function getCriticalCssData() { try { $asset = $this->assetRepo->createAsset($this->filePath, ['_secure' => 'false']); $content = $asset->getContent(); - } catch (NotFoundException $e) { + } catch (LocalizedException | NotFoundException $e) { $content = ''; }; From ea5d6f06cf3a28f52a1a6a967d66a959dd901703 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <spruiell@adobe.com> Date: Mon, 3 Jun 2019 16:04:05 -0500 Subject: [PATCH 358/464] MC-16607: Fix Unrelated Static Test Failures - fix tests failures --- app/code/Magento/Reports/Block/Adminhtml/Grid.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index 0b02d0f046d19..676fb455fa5fb 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -113,7 +113,8 @@ protected function _prepareCollection() $filter = $this->urlDecoder->decode($filter); /** @var $request \Magento\Framework\HTTP\PhpEnvironment\Request */ - $request = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\HTTP\PhpEnvironment\Request::class); + $request = \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\HTTP\PhpEnvironment\Request::class); $data = $request->setRequestUri(urldecode($filter))->getQuery()->toArray(); if (!isset($data['report_from'])) { From 000b36e838bbccebd6c6750d8e3ff5520654a3aa Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Mon, 3 Jun 2019 17:24:38 -0500 Subject: [PATCH 359/464] MQE-1583: Stabilize tests with XSD schema fixes --- .../Test/AllowedCountriesRestrictionApplyOnBackendTest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 17bc10f350af9..4a4d955131300 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -17,6 +17,7 @@ <testCaseId value="MC-6441"/> <useCaseId value="MAGETWO-91523"/> <group value="customer"/> + <group value="banana"/> </annotations> <before> <createData entity="ApiCategory" stepKey="createCategory"/> @@ -114,6 +115,6 @@ <waitForPageLoad stepKey="waitForCustomersGrid"/> <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomersGrid"/> <executeJS function="var len = document.querySelectorAll('{{AdminCustomerFiltersSection.countryOptions}}').length; return len-1;" stepKey="countriesAmount2"/> - <assertEquals expected="($countriesAmount)" expectedType="int" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> + <assertEquals expected="($countriesAmount)" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> </test> </tests> From f753406a7fc705a7fab584ac46194fdf35dff827 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Mon, 3 Jun 2019 18:07:09 -0500 Subject: [PATCH 360/464] MC-16871: Test for possible bugs --- app/code/Magento/Theme/etc/config.xml | 2 +- app/design/frontend/Magento/luma/web/css/critical.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 3e26204d7788c..39e7d32a80ac3 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -70,7 +70,7 @@ Disallow: /*SID= <move_inline_to_bottom>0</move_inline_to_bottom> </js> <css> - <use_css_critical_path>0</use_css_critical_path> + <use_css_critical_path>1</use_css_critical_path> </css> </dev> </default> diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css index 030e45a87b9e2..5e0b1fbd3d346 100644 --- a/app/design/frontend/Magento/luma/web/css/critical.css +++ b/app/design/frontend/Magento/luma/web/css/critical.css @@ -1 +1 @@ -body{margin:0}.page-wrapper{display:flex;flex-direction:column;min-height:100vh}.action.skip:not(:focus),.block.newsletter .label,.minicart-wrapper .action.showcart .counter-label,.minicart-wrapper .action.showcart .text,.page-header .switcher .label,.product-item-actions .actions-secondary>.action span{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.alink,a{color:#006bb4;text-decoration:none}.page-header .panel.wrapper{background-color:#6e716e;color:#fff}.header.panel>.header.links{list-style:none none;float:right;font-size:0;margin-right:20px}.header.panel>.header.links>li{font-size:14px;margin:0 0 0 15px}.block-search .action.search,.block-search .block-title,.block-search .nested,.block.newsletter .title,.breadcrumbs .item,.nav-toggle,.no-display,.page-footer .switcher .options ul.dropdown,.page-header .switcher .options ul.dropdown{display:none}.block-search .label>span{height:1px;overflow:hidden;position:absolute}.logo{float:left;margin:0 0 10px 40px}.minicart-wrapper{float:right}.page-footer{margin-top:25px}.footer.content{border-top:1px solid #cecece;padding-top:20px}.block.newsletter .actions{display:table-cell;vertical-align:top;width:1%}.block-banners .banner-items,.block-banners-inline .banner-items,.block-event .slider-panel .slider,.footer.content ul,.product-items{margin:0;padding:0;list-style:none none}.copyright{background-color:#6e716e;color:#fff;box-sizing:border-box;display:block;padding:10px;text-align:center}.modal-popup,.modal-slide{visibility:hidden;opacity:0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],input[type=url]{background:#fff;background-clip:padding-box;border:1px solid #c2c2c2;border-radius:1px;font-size:14px;height:32px;line-height:1.42857143;padding:0 9px;vertical-align:baseline;width:100%;box-sizing:border-box}.action.primary{background:#1979c3;border:1px solid #1979c3;color:#fff;font-weight:600;padding:7px 15px}.block.newsletter .form.subscribe{display:table}.footer.content .links a{color:#575757}.load.indicator{background-color:rgba(255,255,255,.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url(../images/loader-2.gif) no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative}@media (min-width:768px),print{body,html{height:100%}.page-header{border:0;margin-bottom:0}.nav-sections-item-title,.section-item-content .switcher-currency,ul.header.links li.customer-welcome,ul.level0.submenu{display:none}.abs-add-clearfix-desktop:after,.abs-add-clearfix-desktop:before,.account .column.main .block.block-order-details-view:after,.account .column.main .block.block-order-details-view:before,.account .column.main .block:not(.widget) .block-content:after,.account .column.main .block:not(.widget) .block-content:before,.account .page-title-wrapper:after,.account .page-title-wrapper:before,.block-addresses-list .items.addresses:after,.block-addresses-list .items.addresses:before,.block-cart-failed .block-content:after,.block-cart-failed .block-content:before,.block-giftregistry-shared .item-options:after,.block-giftregistry-shared .item-options:before,.block-wishlist-management:after,.block-wishlist-management:before,.cart-container:after,.cart-container:before,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .content:before,.data.table .gift-wrapping .nested:after,.data.table .gift-wrapping .nested:before,.header.content:after,.header.content:before,.login-container:after,.login-container:before,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:before,.order-links:after,.order-links:before,.order-review-form:after,.order-review-form:before,.page-header .header.panel:after,.page-header .header.panel:before,.paypal-review .block-content:after,.paypal-review .block-content:before,.paypal-review-discount:after,.paypal-review-discount:before,.sales-guest-view .column.main .block.block-order-details-view:after,.sales-guest-view .column.main .block.block-order-details-view:before,[class^=sales-guest-] .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:before{content:'';display:table}.abs-add-clearfix-desktop:after,.account .column.main .block.block-order-details-view:after,.account .column.main .block:not(.widget) .block-content:after,.account .page-title-wrapper:after,.block-addresses-list .items.addresses:after,.block-cart-failed .block-content:after,.block-giftregistry-shared .item-options:after,.block-wishlist-management:after,.cart-container:after,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .nested:after,.header.content:after,.login-container:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.order-links:after,.order-review-form:after,.page-header .header.panel:after,.paypal-review .block-content:after,.paypal-review-discount:after,.sales-guest-view .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:after{clear:both}ul.header.links li{display:inline-block}.block.category.event,.breadcrumbs,.footer.content,.header.content,.navigation,.page-header .header.panel,.page-main,.page-wrapper>.page-bottom,.page-wrapper>.widget,.top-container{box-sizing:border-box;margin-left:auto;margin-right:auto;max-width:1280px;padding-left:20px;padding-right:20px;width:auto}.panel.header{padding:10px 20px}.page-header .switcher{float:right;margin-left:15px;margin-right:-6px}.header.panel>.header.links>li>a{color:#fff}.header.content{padding:30px 20px 0}.logo{margin:-8px auto 25px 0}.minicart-wrapper{margin-left:13px}.compare.wrapper{list-style:none none}.nav-sections{margin-bottom:25px}.nav-sections-item-content>.navigation{display:block}.navigation{background:#f0f0f0;font-weight:700;height:inherit;left:auto;overflow:inherit;padding:0;position:relative;top:0;width:100%;z-index:3}.navigation ul{margin-top:0;margin-bottom:0;padding:0 8px;position:relative}.navigation .level0{margin:0 10px 0 0;display:inline-block}.navigation .level0>.level-top{color:#575757;line-height:47px;padding:0 12px}.page-main{width:100%}.page-footer{background:#f4f4f4;padding-bottom:25px}.footer.content .links{display:inline-block;padding-right:50px;vertical-align:top}.footer.content ul{padding-right:50px}.footer.content .links li{border:none;font-size:14px;margin:0 0 8px;padding:0}.footer.content .block{float:right}.block.newsletter{width:34%}}@media only screen and (max-width:767px){.compare.wrapper,.panel.wrapper,[class*=block-compare]{display:none}.footer.content .links>li{background:#f4f4f4;font-size:1.6rem;border-top:1px solid #cecece;margin:0 -15px;padding:0 15px}.page-header .header.panel,.page-main{padding-left:15px;padding-right:15px}.header.content{padding-top:10px}.nav-sections-items:after,.nav-sections-items:before{content:'';display:table}.nav-sections-items:after{clear:both}.nav-sections{width:100vw;position:fixed;left:-100vw}} +body{margin:0}.page-wrapper{display:flex;flex-direction:column;min-height:100vh}.action.skip:not(:focus),.block.newsletter .label,.minicart-wrapper .action.showcart .counter-label,.minicart-wrapper .action.showcart .text,.page-header .switcher .label,.product-item-actions .actions-secondary>.action span{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.alink,a{color:#006bb4;text-decoration:none}.page-header .panel.wrapper{background-color:#6e716e;color:#fff}.header.panel>.header.links{list-style:none none;float:right;font-size:0;margin-right:20px}.header.panel>.header.links>li{font-size:14px;margin:0 0 0 15px}.block-search .action.search,.block-search .block-title,.block-search .nested,.block.newsletter .title,.breadcrumbs .item,.nav-toggle,.no-display,.page-footer .switcher .options ul.dropdown,.page-header .switcher .options ul.dropdown{display:none}.block-search .label>span{height:1px;overflow:hidden;position:absolute}.logo{float:left;margin:0 0 10px 40px}.minicart-wrapper{float:right}.page-footer{margin-top:25px}.footer.content{border-top:1px solid #cecece;padding-top:20px}.block.newsletter .actions{display:table-cell;vertical-align:top;width:1%}.block-banners .banner-items,.block-banners-inline .banner-items,.block-event .slider-panel .slider,.footer.content ul,.product-items{margin:0;padding:0;list-style:none none}.copyright{background-color:#6e716e;color:#fff;box-sizing:border-box;display:block;padding:10px;text-align:center}.modal-popup,.modal-slide{visibility:hidden;opacity:0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],input[type=url]{background:#fff;background-clip:padding-box;border:1px solid #c2c2c2;border-radius:1px;font-size:14px;height:32px;line-height:1.42857143;padding:0 9px;vertical-align:baseline;width:100%;box-sizing:border-box}.action.primary{background:#1979c3;border:1px solid #1979c3;color:#fff;font-weight:600;padding:7px 15px}.block.newsletter .form.subscribe{display:table}.footer.content .links a{color:#575757}.load.indicator{background-color:rgba(255,255,255,.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url(../images/loader-2.gif) no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative}@media (min-width:768px),print{body,html{height:100%}.page-header{border:0;margin-bottom:0}.nav-sections-item-title,.section-item-content .switcher-currency,ul.header.links li.customer-welcome,ul.level0.submenu{display:none}.abs-add-clearfix-desktop:after,.abs-add-clearfix-desktop:before,.account .column.main .block.block-order-details-view:after,.account .column.main .block.block-order-details-view:before,.account .column.main .block:not(.widget) .block-content:after,.account .column.main .block:not(.widget) .block-content:before,.account .page-title-wrapper:after,.account .page-title-wrapper:before,.block-addresses-list .items.addresses:after,.block-addresses-list .items.addresses:before,.block-cart-failed .block-content:after,.block-cart-failed .block-content:before,.block-giftregistry-shared .item-options:after,.block-giftregistry-shared .item-options:before,.block-wishlist-management:after,.block-wishlist-management:before,.cart-container:after,.cart-container:before,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .content:before,.data.table .gift-wrapping .nested:after,.data.table .gift-wrapping .nested:before,.header.content:after,.header.content:before,.login-container:after,.login-container:before,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:before,.order-links:after,.order-links:before,.order-review-form:after,.order-review-form:before,.page-header .header.panel:after,.page-header .header.panel:before,.paypal-review .block-content:after,.paypal-review .block-content:before,.paypal-review-discount:after,.paypal-review-discount:before,.sales-guest-view .column.main .block.block-order-details-view:after,.sales-guest-view .column.main .block.block-order-details-view:before,[class^=sales-guest-] .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:before{content:'';display:table}.abs-add-clearfix-desktop:after,.account .column.main .block.block-order-details-view:after,.account .column.main .block:not(.widget) .block-content:after,.account .page-title-wrapper:after,.block-addresses-list .items.addresses:after,.block-cart-failed .block-content:after,.block-giftregistry-shared .item-options:after,.block-wishlist-management:after,.cart-container:after,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .nested:after,.header.content:after,.login-container:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.order-links:after,.order-review-form:after,.page-header .header.panel:after,.paypal-review .block-content:after,.paypal-review-discount:after,.sales-guest-view .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:after{clear:both}.block.category.event,.breadcrumbs,.footer.content,.header.content,.navigation,.page-header .header.panel,.page-main,.page-wrapper>.page-bottom,.page-wrapper>.widget,.top-container{box-sizing:border-box;margin-left:auto;margin-right:auto;max-width:1280px;padding-left:20px;padding-right:20px;width:auto}.panel.header{padding:10px 20px}.page-header .switcher{float:right;margin-left:15px;margin-right:-6px}.header.panel>.header.links>li>a{color:#fff}.header.content{padding:30px 20px 0}.logo{margin:-8px auto 25px 0}.minicart-wrapper{margin-left:13px}.compare.wrapper{list-style:none none}.nav-sections{margin-bottom:25px}.nav-sections-item-content>.navigation{display:block}.navigation{background:#f0f0f0;font-weight:700;height:inherit;left:auto;overflow:inherit;padding:0;position:relative;top:0;width:100%;z-index:3}.navigation ul{margin-top:0;margin-bottom:0;padding:0 8px;position:relative}.navigation .level0{margin:0 10px 0 0;display:inline-block}.navigation .level0>.level-top{color:#575757;line-height:47px;padding:0 12px}.page-main{width:100%}.page-footer{background:#f4f4f4;padding-bottom:25px}.footer.content .links{display:inline-block;padding-right:50px;vertical-align:top}.footer.content ul{padding-right:50px}.footer.content .links li{border:none;font-size:14px;margin:0 0 8px;padding:0}.footer.content .block{float:right}.block.newsletter{width:34%}}@media only screen and (max-width:767px){.compare.wrapper,.panel.wrapper,[class*=block-compare]{display:none}.footer.content .links>li{background:#f4f4f4;font-size:1.6rem;border-top:1px solid #cecece;margin:0 -15px;padding:0 15px}.page-header .header.panel,.page-main{padding-left:15px;padding-right:15px}.header.content{padding-top:10px}.nav-sections-items:after,.nav-sections-items:before{content:'';display:table}.nav-sections-items:after{clear:both}.nav-sections{width:100vw;position:fixed;left:-100vw}} From 5e14e8a7aaf24cc12cae42ad4589c2e150bbc011 Mon Sep 17 00:00:00 2001 From: Nazarn96 <nazarn96@gmail.com> Date: Mon, 3 Jun 2019 15:41:28 +0300 Subject: [PATCH 361/464] magento/magento2#18748 health-check-static-test-fix --- .../Model/ReportXml/ModuleIterator.php | 2 +- .../Model/ReportXml/ModuleIteratorTest.php | 5 ++- .../Backend/Block/Dashboard/Orders/Grid.php | 12 +++++-- .../Magento/Backend/Block/Dashboard/Sales.php | 2 ++ .../Block/Dashboard/Tab/Products/Ordered.php | 6 ++-- .../Backend/Block/Dashboard/Totals.php | 4 +++ app/code/Magento/Backend/Model/Menu/Item.php | 6 ++-- .../Block/Checkout/Cart/Item/Renderer.php | 4 +-- .../Model/ResourceModel/Indexer/Price.php | 36 +++++++++++-------- .../ResourceModel/Selection/Collection.php | 8 +++-- .../Block/Adminhtml/Helper/Form/Wysiwyg.php | 3 ++ .../Product/Edit/Tab/Alerts/Price.php | 14 ++++++-- .../Product/Edit/Tab/Alerts/Stock.php | 14 ++++++-- .../Adminhtml/Product/Edit/Tab/Inventory.php | 20 +++++++++-- .../Edit/Tab/Price/Group/AbstractGroup.php | 6 ++-- .../Block/Adminhtml/Product/Edit/Tabs.php | 8 ++--- .../Catalog/Block/Adminhtml/Product/Grid.php | 25 ++++++++++--- .../Block/Product/ProductList/Related.php | 6 ++-- .../Block/Product/ProductList/Upsell.php | 6 ++-- app/code/Magento/Catalog/Model/Product.php | 14 ++++---- .../ResourceModel/Product/Collection.php | 6 ++-- .../Product/Indexer/Price/DefaultPrice.php | 24 ++++++++----- .../Indexer/Price/Query/BaseFinalPrice.php | 18 ++++++---- .../Product/Edit/Tab/InventoryTest.php | 2 +- .../Catalog/Test/Unit/Model/ProductTest.php | 32 ++++++++++------- .../ResourceModel/Product/CollectionTest.php | 2 +- .../Form/Modifier/AdvancedPricingTest.php | 9 +++-- .../Product/Form/Modifier/AdvancedPricing.php | 2 +- .../ResourceModel/Advanced/Collection.php | 22 +++++++----- .../ResourceModel/Fulltext/Collection.php | 22 +++++++----- .../Checkout/Block/Cart/Item/Renderer.php | 16 ++++----- app/code/Magento/Checkout/Block/Cart/Link.php | 4 +++ app/code/Magento/Checkout/Block/Link.php | 2 ++ .../Model/Layout/DepersonalizePluginTest.php | 2 +- .../Config/Structure/AbstractElement.php | 14 +++++--- .../Structure/Element/AbstractComposite.php | 3 ++ .../Model/Config/Structure/Element/Field.php | 3 ++ .../Model/Config/Structure/Element/Group.php | 2 ++ .../Config/Structure/Element/Section.php | 2 ++ .../Element/AbstractCompositeTest.php | 7 ++-- .../Model/Product/Type/Plugin.php | 11 +++--- .../Magento/Customer/Block/Form/Register.php | 6 ++-- .../Helper/Session/CurrentCustomer.php | 5 +-- .../Customer/Model/Customer/Source/Group.php | 5 ++- .../Test/Unit/Block/Form/RegisterTest.php | 2 +- .../Helper/Session/CurrentCustomerTest.php | 7 ++-- .../Unit/Model/Customer/Source/GroupTest.php | 9 +++-- .../Magento/Deploy/Collector/Collector.php | 10 +++--- .../Block/Checkout/Cart/Item/Renderer.php | 9 +++-- .../Model/Product/Type/Plugin.php | 11 +++--- .../Grouped/AssociatedProductsCollection.php | 1 - .../Test/Unit/Model/ProductTest.php | 11 ++++-- .../Model/Export/Config/Converter.php | 9 +++-- .../Model/Import/Config/Converter.php | 11 +++--- .../Model/Export/Config/ConverterTest.php | 5 ++- .../Model/Import/Config/ConverterTest.php | 5 ++- ...ductAttributeFormBuildFrontTabObserver.php | 8 ++--- .../ProductAttributeGridBuildObserver.php | 15 +++++--- .../Model/Module/Collect.php | 8 ++--- .../Test/Unit/Model/Module/CollectTest.php | 1 - .../Unit/Model/DepersonalizeCheckerTest.php | 7 ++-- .../Model/Layout/DepersonalizePluginTest.php | 14 ++++++-- .../Product/Lowstock/Collection.php | 4 +-- .../ResourceModel/Product/CollectionTest.php | 2 +- .../Review/Model/ResourceModel/Rating.php | 6 ++-- .../Review/Product/Collection.php | 4 +-- .../Product/Form/Modifier/ReviewTest.php | 9 +++-- .../Product/Form/Modifier/Review.php | 7 ++-- .../Search/Block/Adminhtml/Dashboard/Last.php | 6 ++++ .../Search/Block/Adminhtml/Dashboard/Top.php | 8 +++-- .../Observer/AddFieldsToAttributeObserver.php | 10 +++--- .../AddSwatchAttributeTypeObserver.php | 10 +++--- .../AddFieldsToAttributeObserverTest.php | 2 +- .../AddSwatchAttributeTypeObserverTest.php | 2 +- .../Tax/Model/App/Action/ContextPlugin.php | 2 ++ .../Tax/Observer/AfterAddressSaveObserver.php | 13 ++++--- .../Tax/Observer/CustomerLoggedInObserver.php | 14 +++++--- .../Unit/App/Action/ContextPluginTest.php | 13 ++++--- .../Observer/AfterAddressSaveObserverTest.php | 6 ++-- .../Observer/CustomerLoggedInObserverTest.php | 19 ++++++---- .../Weee/Model/App/Action/ContextPlugin.php | 4 +++ .../Weee/Observer/AfterAddressSave.php | 13 ++++--- .../Weee/Observer/CustomerLoggedIn.php | 11 ++++-- .../Unit/App/Action/ContextPluginTest.php | 10 +++--- .../Unit/Observer/AfterAddressSaveTest.php | 7 ++-- .../Unit/Observer/CustomerLoggedInTest.php | 13 ++++--- .../Wishlist/Test/Unit/Helper/RssTest.php | 4 +-- .../Block/Account/Dashboard/AddressTest.php | 5 ++- .../Test/Legacy/_files/obsolete_methods.php | 4 +-- .../Framework/App/Helper/AbstractHelper.php | 4 +-- .../Magento/Framework/App/Helper/Context.php | 30 +++++++++++++--- .../Module/Test/Unit/ManagerTest.php | 31 ++++++++++------ .../Unit/Plugin/DbStatusValidatorTest.php | 5 ++- .../File/Collector/Decorator/ModuleOutput.php | 6 ++-- 94 files changed, 570 insertions(+), 279 deletions(-) diff --git a/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php b/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php index fecbf2033c1ba..4d62344197405 100644 --- a/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php +++ b/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php @@ -5,7 +5,7 @@ */ namespace Magento\Analytics\Model\ReportXml; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; /** * Iterator for ReportXml modules diff --git a/app/code/Magento/Analytics/Test/Unit/Model/ReportXml/ModuleIteratorTest.php b/app/code/Magento/Analytics/Test/Unit/Model/ReportXml/ModuleIteratorTest.php index f314d77f32b41..b08d41ac829b7 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/ReportXml/ModuleIteratorTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/ReportXml/ModuleIteratorTest.php @@ -7,9 +7,12 @@ namespace Magento\Analytics\Test\Unit\Model\ReportXml; use Magento\Analytics\Model\ReportXml\ModuleIterator; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Module iterator test. + */ class ModuleIteratorTest extends \PHPUnit\Framework\TestCase { /** diff --git a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php index 7bcadeccd7e5d..bca7f13b0cee3 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php @@ -43,6 +43,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -52,6 +54,8 @@ protected function _construct() } /** + * Prepare collection. + * * @return $this */ protected function _prepareCollection() @@ -110,6 +114,8 @@ protected function _preparePage() } /** + * Prepare columns. + * * @return $this */ protected function _prepareColumns() @@ -129,7 +135,9 @@ protected function _prepareColumns() ] ); - $baseCurrencyCode = $this->_storeManager->getStore((int)$this->getParam('store'))->getBaseCurrencyCode(); + $baseCurrencyCode = $this->_storeManager->getStore( + (int)$this->getParam('store') + )->getBaseCurrencyCode(); $this->addColumn( 'total', @@ -149,7 +157,7 @@ protected function _prepareColumns() } /** - * {@inheritdoc} + * @inheritdoc */ public function getRowUrl($row) { diff --git a/app/code/Magento/Backend/Block/Dashboard/Sales.php b/app/code/Magento/Backend/Block/Dashboard/Sales.php index 10006d74b6a87..3455ff087a799 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Sales.php +++ b/app/code/Magento/Backend/Block/Dashboard/Sales.php @@ -39,6 +39,8 @@ public function __construct( } /** + * Prepare layout. + * * @return $this|void */ protected function _prepareLayout() diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php index b668631fab1bc..7dc897a62a320 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php @@ -43,6 +43,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -52,7 +54,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ protected function _prepareCollection() { @@ -81,7 +83,7 @@ protected function _prepareCollection() } /** - * {@inheritdoc} + * @inheritdoc */ protected function _prepareColumns() { diff --git a/app/code/Magento/Backend/Block/Dashboard/Totals.php b/app/code/Magento/Backend/Block/Dashboard/Totals.php index 7c152a6c34d3f..e57a6249af47d 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Totals.php +++ b/app/code/Magento/Backend/Block/Dashboard/Totals.php @@ -11,6 +11,9 @@ */ namespace Magento\Backend\Block\Dashboard; +/** + * Totals block. + */ class Totals extends \Magento\Backend\Block\Dashboard\Bar { /** @@ -40,6 +43,7 @@ public function __construct( } /** + * @inheritDoc * @return $this|void */ protected function _prepareLayout() diff --git a/app/code/Magento/Backend/Model/Menu/Item.php b/app/code/Magento/Backend/Model/Menu/Item.php index 67c6216cbbc06..d535e9c84df24 100644 --- a/app/code/Magento/Backend/Model/Menu/Item.php +++ b/app/code/Magento/Backend/Model/Menu/Item.php @@ -145,7 +145,7 @@ class Item protected $_moduleList; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $_moduleManager; @@ -163,7 +163,7 @@ class Item * @param \Magento\Backend\Model\MenuFactory $menuFactory * @param \Magento\Backend\Model\UrlInterface $urlModel * @param \Magento\Framework\Module\ModuleListInterface $moduleList - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( @@ -173,7 +173,7 @@ public function __construct( \Magento\Backend\Model\MenuFactory $menuFactory, \Magento\Backend\Model\UrlInterface $urlModel, \Magento\Framework\Module\ModuleListInterface $moduleList, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_validator = $validator; diff --git a/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php b/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php index 863f273225693..c0a2d9d43034d 100644 --- a/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php @@ -32,7 +32,7 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer * @param \Magento\Framework\Url\Helper\Data $urlHelper * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param PriceCurrencyInterface $priceCurrency - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param InterpretationStrategyInterface $messageInterpretationStrategy * @param Configuration $bundleProductConfiguration * @param array $data @@ -46,7 +46,7 @@ public function __construct( \Magento\Framework\Url\Helper\Data $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, PriceCurrencyInterface $priceCurrency, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, InterpretationStrategyInterface $messageInterpretationStrategy, Configuration $bundleProductConfiguration, array $data = [] diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php index b5dfd312cd0c4..b71853cde41ac 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php @@ -85,7 +85,7 @@ class Price implements DimensionalIndexerInterface private $eventManager; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; @@ -97,7 +97,7 @@ class Price implements DimensionalIndexerInterface * @param BasePriceModifier $basePriceModifier * @param JoinAttributeProcessor $joinAttributeProcessor * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param bool $fullReindexAction * @param string $connectionName * @@ -111,7 +111,7 @@ public function __construct( BasePriceModifier $basePriceModifier, JoinAttributeProcessor $joinAttributeProcessor, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, $fullReindexAction = false, $connectionName = 'indexer' ) { @@ -128,7 +128,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * @param array $dimensions * @param \Traversable $entityIds * @throws \Exception @@ -137,7 +137,8 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds) { $this->tableMaintainer->createMainTmpTable($dimensions); - $temporaryPriceTable = $this->indexTableStructureFactory->create([ + $temporaryPriceTable = $this->indexTableStructureFactory->create( + [ 'tableName' => $this->tableMaintainer->getMainTmpTable($dimensions), 'entityField' => 'entity_id', 'customerGroupField' => 'customer_group_id', @@ -148,7 +149,8 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds) 'minPriceField' => 'min_price', 'maxPriceField' => 'max_price', 'tierPriceField' => 'tier_price', - ]); + ] + ); $entityIds = iterator_to_array($entityIds); @@ -331,11 +333,13 @@ private function prepareBundlePriceByType($priceType, array $dimensions, $entity 'ROUND((1 - ' . $tierExpr . ' / 100) * ' . $price . ', 4)', 'NULL' ); - $finalPrice = $connection->getLeastSql([ + $finalPrice = $connection->getLeastSql( + [ $price, $connection->getIfNullSql($specialPriceExpr, $price), $connection->getIfNullSql($tierPrice, $price), - ]); + ] + ); } else { $finalPrice = new \Zend_Db_Expr('0'); $tierPrice = $connection->getCheckSql($tierExpr . ' IS NOT NULL', '0', 'NULL'); @@ -471,10 +475,12 @@ private function calculateBundleSelectionPrice($dimensions, $priceType) 'NULL' ); - $priceExpr = $connection->getLeastSql([ + $priceExpr = $connection->getLeastSql( + [ $priceExpr, $connection->getIfNullSql($tierExpr, $priceExpr), - ]); + ] + ); } else { $price = 'idx.min_price * bs.selection_qty'; $specialExpr = $connection->getCheckSql( @@ -487,10 +493,12 @@ private function calculateBundleSelectionPrice($dimensions, $priceType) 'ROUND((1 - i.tier_percent / 100) * ' . $price . ', 4)', 'NULL' ); - $priceExpr = $connection->getLeastSql([ + $priceExpr = $connection->getLeastSql( + [ $specialExpr, $connection->getIfNullSql($tierExpr, $price), - ]); + ] + ); } $metadata = $this->metadataPool->getMetadata(ProductInterface::class); @@ -613,7 +621,7 @@ private function prepareTierPriceIndex($dimensions, $entityIds) * Create bundle price. * * @param IndexTableStructure $priceTable - * @return void + * @return void */ private function applyBundlePrice($priceTable): void { @@ -699,7 +707,7 @@ private function getMainTable($dimensions) /** * Get connection * - * return \Magento\Framework\DB\Adapter\AdapterInterface + * @return \Magento\Framework\DB\Adapter\AdapterInterface * @throws \DomainException */ private function getConnection(): \Magento\Framework\DB\Adapter\AdapterInterface diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 5b88288ff72ca..21ba1f75ba90b 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -15,6 +15,7 @@ * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @since 100.0.2 */ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection @@ -60,7 +61,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -87,7 +88,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, @@ -145,7 +146,8 @@ protected function _construct() } /** - * Set store id for each collection item when collection was loaded + * Set store id for each collection item when collection was loaded. + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod * * @return $this */ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php index d168780a4eaef..a829c058d89bf 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php @@ -11,6 +11,9 @@ */ namespace Magento\Catalog\Block\Adminhtml\Helper\Form; +/** + * Wysiwyg helper. + */ class Wysiwyg extends \Magento\Framework\Data\Form\Element\Textarea { /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php index 3b4a5f9eabfd2..e754ab9700517 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php @@ -19,7 +19,7 @@ class Price extends Extended /** * Catalog data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -32,14 +32,14 @@ class Price extends Extended * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\ProductAlert\Model\PriceFactory $priceFactory - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, \Magento\ProductAlert\Model\PriceFactory $priceFactory, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_priceFactory = $priceFactory; @@ -48,6 +48,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -63,6 +65,8 @@ protected function _construct() } /** + * @inheritDoc + * * @return Grid */ protected function _prepareCollection() @@ -80,6 +84,8 @@ protected function _prepareCollection() } /** + * @inheritDoc + * * @return $this */ protected function _prepareColumns() @@ -116,6 +122,8 @@ protected function _prepareColumns() } /** + * @inheritDoc + * * @return string */ public function getGridUrl() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php index d572690143ca4..2c6647fd57be6 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Stock.php @@ -19,7 +19,7 @@ class Stock extends Extended /** * Catalog data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -32,14 +32,14 @@ class Stock extends Extended * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\ProductAlert\Model\StockFactory $stockFactory - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, \Magento\ProductAlert\Model\StockFactory $stockFactory, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_stockFactory = $stockFactory; @@ -48,6 +48,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -63,6 +65,8 @@ protected function _construct() } /** + * @inheritDoc + * * @return Grid */ protected function _prepareCollection() @@ -80,6 +84,8 @@ protected function _prepareCollection() } /** + * @inheritDoc + * * @return $this */ protected function _prepareColumns() @@ -103,6 +109,8 @@ protected function _prepareColumns() } /** + * Get grid url. + * * @return string */ public function getGridUrl() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php index 20e12889cae0d..9278b84362e77 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php @@ -18,7 +18,7 @@ class Inventory extends \Magento\Backend\Block\Widget protected $_template = 'Magento_Catalog::catalog/product/tab/inventory.phtml'; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -53,7 +53,7 @@ class Inventory extends \Magento\Backend\Block\Widget * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\CatalogInventory\Model\Source\Backorders $backorders * @param \Magento\CatalogInventory\Model\Source\Stock $stock - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration @@ -63,7 +63,7 @@ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\CatalogInventory\Model\Source\Backorders $backorders, \Magento\CatalogInventory\Model\Source\Stock $stock, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Framework\Registry $coreRegistry, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration, @@ -79,6 +79,8 @@ public function __construct( } /** + * Get backorder option. + * * @return array */ public function getBackordersOption() @@ -128,6 +130,8 @@ public function getStockItem() } /** + * Get field value. + * * @param string $field * @return string|null */ @@ -145,6 +149,8 @@ public function getFieldValue($field) } /** + * Get config field value. + * * @param string $field * @return string|null */ @@ -163,6 +169,8 @@ public function getConfigFieldValue($field) } /** + * Get default config value. + * * @param string $field * @return string|null */ @@ -182,6 +190,8 @@ public function isReadonly() } /** + * Is new. + * * @return bool */ public function isNew() @@ -193,6 +203,8 @@ public function isNew() } /** + * Get field suffix. + * * @return string */ public function getFieldSuffix() @@ -221,6 +233,8 @@ public function isVirtual() } /** + * Is single store mode enabled. + * * @return bool */ public function isSingleStoreMode() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index 5ffd3d1dda38d..42990116e933f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -41,7 +41,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface /** * Catalog data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -81,7 +81,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface * @param \Magento\Backend\Block\Template\Context $context * @param GroupRepositoryInterface $groupRepository * @param \Magento\Directory\Helper\Data $directoryHelper - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Framework\Registry $registry * @param GroupManagementInterface $groupManagement * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder @@ -92,7 +92,7 @@ public function __construct( \Magento\Backend\Block\Template\Context $context, GroupRepositoryInterface $groupRepository, \Magento\Directory\Helper\Data $directoryHelper, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Framework\Registry $registry, GroupManagementInterface $groupManagement, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index 37ad3f4bea20e..51c326763b09c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -14,7 +14,7 @@ use Magento\Catalog\Helper\Data; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\Json\EncoderInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Registry; use Magento\Framework\Translate\InlineInterface; @@ -65,7 +65,7 @@ class Tabs extends WidgetTabs protected $_collectionFactory; /** - * @var Manager + * @var ModuleManagerInterface */ protected $_moduleManager; @@ -78,7 +78,7 @@ class Tabs extends WidgetTabs * @param Context $context * @param EncoderInterface $jsonEncoder * @param Session $authSession - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param CollectionFactory $collectionFactory * @param Catalog $helperCatalog * @param Data $catalogData @@ -91,7 +91,7 @@ public function __construct( Context $context, EncoderInterface $jsonEncoder, Session $authSession, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, CollectionFactory $collectionFactory, Catalog $helperCatalog, Data $catalogData, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index 8f3a0793cc49f..238af3dddf322 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -8,13 +8,15 @@ use Magento\Store\Model\Store; /** + * Grid. + * * @api * @since 100.0.2 */ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -57,7 +59,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended * @param \Magento\Catalog\Model\Product\Type $type * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status * @param \Magento\Catalog\Model\Product\Visibility $visibility - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -71,7 +73,7 @@ public function __construct( \Magento\Catalog\Model\Product\Type $type, \Magento\Catalog\Model\Product\Attribute\Source\Status $status, \Magento\Catalog\Model\Product\Visibility $visibility, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_websiteFactory = $websiteFactory; @@ -85,6 +87,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -99,6 +103,8 @@ protected function _construct() } /** + * Get store. + * * @return Store */ protected function _getStore() @@ -108,6 +114,8 @@ protected function _getStore() } /** + * @inheritDoc + * * @return $this */ protected function _prepareCollection() @@ -136,7 +144,6 @@ protected function _prepareCollection() ); } if ($store->getId()) { - //$collection->setStoreId($store->getId()); $collection->addStoreFilter($store); $collection->joinAttribute( 'name', @@ -187,6 +194,8 @@ protected function _prepareCollection() } /** + * @inheritDoc + * * @param \Magento\Backend\Block\Widget\Grid\Column $column * @return $this */ @@ -208,6 +217,8 @@ protected function _addColumnFilterToCollection($column) } /** + * @inheritDoc + * * @return $this * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -373,6 +384,8 @@ protected function _prepareColumns() } /** + * @inheritDoc + * * @return $this */ protected function _prepareMassaction() @@ -425,6 +438,8 @@ protected function _prepareMassaction() } /** + * Get grid Url. + * * @return string */ public function getGridUrl() @@ -433,6 +448,8 @@ public function getGridUrl() } /** + * Get row url. + * * @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $row * @return string */ diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 6de70bb971367..088619511545f 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -46,7 +46,7 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements protected $_checkoutCart; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -55,7 +55,7 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements * @param \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( @@ -63,7 +63,7 @@ public function __construct( \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_checkoutCart = $checkoutCart; diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 24822447ae915..d888f44a6fbfb 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -60,7 +60,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements protected $_checkoutCart; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -69,7 +69,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements * @param \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param array $data */ public function __construct( @@ -77,7 +77,7 @@ public function __construct( \Magento\Checkout\Model\ResourceModel\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, array $data = [] ) { $this->_checkoutCart = $checkoutCart; diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 1e774e45df41f..61544f8fb5766 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -175,7 +175,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements protected $_catalogProduct = null; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -369,7 +369,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements * @param Product\Attribute\Source\Status $catalogProductStatus * @param Product\Media\Config $catalogProductMediaConfig * @param Product\Type $catalogProductType - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Helper\Product $catalogProduct * @param ResourceModel\Product $resource * @param ResourceModel\Product\Collection $resourceCollection @@ -410,7 +410,7 @@ public function __construct( \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus, \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig, Product\Type $catalogProductType, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Catalog\Model\ResourceModel\Product $resource, \Magento\Catalog\Model\ResourceModel\Product\Collection $resourceCollection, @@ -487,6 +487,7 @@ protected function _construct() /** * Get resource instance + * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod * * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\Catalog\Model\ResourceModel\Product @@ -1166,8 +1167,7 @@ public function getFormattedPrice() /** * Get formatted by currency product price * - * @return array|double - * + * @return array|double* * @deprecated * @see getFormattedPrice() */ @@ -1815,9 +1815,9 @@ public function formatUrlKey($str) } /** - * Save current attribute with code $code and assign new value + * Save current attribute with code $code and assign new value. * - * @param string $code Attribute code + * @param string $code Attribute code * @param mixed $value New attribute value * @param int $store Store ID * @return void diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 384b6ddcefc31..dbd6a7a2e1094 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -191,7 +191,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac /** * Catalog data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager = null; @@ -315,7 +315,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -344,7 +344,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index 3b4c3408e742b..9643f4c3a7181 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -40,7 +40,7 @@ class DefaultPrice extends AbstractIndexer implements PriceInterface /** * Core data * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -73,7 +73,7 @@ class DefaultPrice extends AbstractIndexer implements PriceInterface * @param \Magento\Framework\Indexer\Table\StrategyInterface $tableStrategy * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param string|null $connectionName * @param IndexTableStructureFactory $indexTableStructureFactory * @param PriceModifierInterface[] $priceModifiers @@ -83,7 +83,7 @@ public function __construct( \Magento\Framework\Indexer\Table\StrategyInterface $tableStrategy, \Magento\Eav\Model\Config $eavConfig, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, $connectionName = null, IndexTableStructureFactory $indexTableStructureFactory = null, array $priceModifiers = [] @@ -259,7 +259,8 @@ private function prepareFinalPriceTable() $tableName = $this->_getDefaultFinalPriceTable(); $this->getConnection()->delete($tableName); - $finalPriceTable = $this->indexTableStructureFactory->create([ + $finalPriceTable = $this->indexTableStructureFactory->create( + [ 'tableName' => $tableName, 'entityField' => 'entity_id', 'customerGroupField' => 'customer_group_id', @@ -270,7 +271,8 @@ private function prepareFinalPriceTable() 'minPriceField' => 'min_price', 'maxPriceField' => 'max_price', 'tierPriceField' => 'tier_price', - ]); + ] + ); return $finalPriceTable; } @@ -465,11 +467,13 @@ protected function getSelect($entityIds = null, $type = null) ); $tierPrice = $this->getTotalTierPriceExpression($price); $tierPriceExpr = $connection->getIfNullSql($tierPrice, $maxUnsignedBigint); - $finalPrice = $connection->getLeastSql([ + $finalPrice = $connection->getLeastSql( + [ $price, $specialPriceExpr, $tierPriceExpr, - ]); + ] + ); $select->columns( [ @@ -848,7 +852,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression) ] ), 'NULL', - $this->getConnection()->getLeastSql([ + $this->getConnection()->getLeastSql( + [ $this->getConnection()->getIfNullSql( $this->getTierPriceExpressionForTable('tier_price_1', $priceExpression), $maxUnsignedBigint @@ -865,7 +870,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression) $this->getTierPriceExpressionForTable('tier_price_4', $priceExpression), $maxUnsignedBigint ), - ]) + ] + ) ); } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php index 499312aadf6a1..a3f463d53e7a8 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php @@ -37,7 +37,7 @@ class BaseFinalPrice private $joinAttributeProcessor; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; @@ -69,7 +69,7 @@ class BaseFinalPrice /** * @param \Magento\Framework\App\ResourceConnection $resource * @param JoinAttributeProcessor $joinAttributeProcessor - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param string $connectionName @@ -77,7 +77,7 @@ class BaseFinalPrice public function __construct( \Magento\Framework\App\ResourceConnection $resource, JoinAttributeProcessor $joinAttributeProcessor, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\EntityManager\MetadataPool $metadataPool, $connectionName = 'indexer' @@ -200,11 +200,13 @@ public function getQuery(array $dimensions, string $productType, array $entityId ); $tierPrice = $this->getTotalTierPriceExpression($price); $tierPriceExpr = $connection->getIfNullSql($tierPrice, $maxUnsignedBigint); - $finalPrice = $connection->getLeastSql([ + $finalPrice = $connection->getLeastSql( + [ $price, $specialPriceExpr, $tierPriceExpr, - ]); + ] + ); $select->columns( [ @@ -262,7 +264,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression) ] ), 'NULL', - $this->getConnection()->getLeastSql([ + $this->getConnection()->getLeastSql( + [ $this->getConnection()->getIfNullSql( $this->getTierPriceExpressionForTable('tier_price_1', $priceExpression), $maxUnsignedBigint @@ -279,7 +282,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression) $this->getTierPriceExpressionForTable('tier_price_4', $priceExpression), $maxUnsignedBigint ), - ]) + ] + ) ); } diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php index 19c578e976cdd..2008d0b9414c5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Edit/Tab/InventoryTest.php @@ -85,7 +85,7 @@ protected function setUp() $this->backordersMock = $this->createMock(\Magento\CatalogInventory\Model\Source\Backorders::class); $this->stockMock = $this->createMock(\Magento\CatalogInventory\Model\Source\Stock::class); $this->coreRegistryMock = $this->createMock(\Magento\Framework\Registry::class); - $this->moduleManager = $this->createMock(\Magento\Framework\Module\Manager::class); + $this->moduleManager = $this->createMock(\Magento\Framework\Module\ModuleManagerInterface::class); $this->storeManagerMock = $this->getMockForAbstractClass( \Magento\Store\Model\StoreManagerInterface::class, [], diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php index 22ba6bfa9f7fd..8bf8473080c54 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php @@ -40,7 +40,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase protected $model; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManager; @@ -215,7 +215,7 @@ protected function setUp() $this->categoryIndexerMock = $this->getMockForAbstractClass(\Magento\Framework\Indexer\IndexerInterface::class); $this->moduleManager = $this->createPartialMock( - \Magento\Framework\Module\Manager::class, + \Magento\Framework\Module\ModuleManagerInterface::class, ['isEnabled'] ); $this->extensionAttributes = $this->getMockBuilder(\Magento\Framework\Api\ExtensionAttributesInterface::class) @@ -484,9 +484,11 @@ public function testGetCategoryCollectionCollectionNull($initCategoryCollection, $abstractDbMock = $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\Db\AbstractDb::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getCategoryCollection', - ]) + ] + ) ->getMockForAbstractClass(); $getCategoryCollectionMock = $this->createMock( \Magento\Framework\Data\Collection::class @@ -1217,8 +1219,10 @@ public function testSetMediaGalleryEntries() public function testGetMediaGalleryImagesMerging() { - $mediaEntries = [ - 'images' => [ + $mediaEntries = + [ + 'images' => + [ [ 'value_id' => 1, 'file' => 'imageFile.jpg', @@ -1233,24 +1237,28 @@ public function testGetMediaGalleryImagesMerging() 'file' => 'smallImageFile.jpg', 'media_type' => 'image', ], - ] - ]; - $expectedImageDataObject = new \Magento\Framework\DataObject([ + ] + ]; + $expectedImageDataObject = new \Magento\Framework\DataObject( + [ 'value_id' => 1, 'file' => 'imageFile.jpg', 'media_type' => 'image', 'url' => 'http://magento.dev/pub/imageFile.jpg', 'id' => 1, 'path' => '/var/www/html/pub/imageFile.jpg', - ]); - $expectedSmallImageDataObject = new \Magento\Framework\DataObject([ + ] + ); + $expectedSmallImageDataObject = new \Magento\Framework\DataObject( + [ 'value_id' => 2, 'file' => 'smallImageFile.jpg', 'media_type' => 'image', 'url' => 'http://magento.dev/pub/smallImageFile.jpg', 'id' => 2, 'path' => '/var/www/html/pub/smallImageFile.jpg', - ]); + ] + ); $directoryMock = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadInterface::class); $directoryMock->method('getAbsolutePath')->willReturnOnConsecutiveCalls( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php index 0316b2e374d2f..6370a4a7a27e2 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php @@ -98,7 +98,7 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['getStore', 'getId', 'getWebsiteId']) ->getMockForAbstractClass(); - $moduleManager = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $moduleManager = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); $catalogProductFlatState = $this->getMockBuilder(\Magento\Catalog\Model\Indexer\Product\Flat\State::class) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AdvancedPricingTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AdvancedPricingTest.php index 1a23aaace6e0f..e9f9349100f15 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AdvancedPricingTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AdvancedPricingTest.php @@ -11,7 +11,7 @@ use Magento\Customer\Api\GroupManagementInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Directory\Helper\Data as DirectoryHelper; use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\Catalog\Model\ResourceModel\Eav\Attribute; @@ -106,7 +106,9 @@ protected function setUp() */ protected function createModel() { - return $this->objectManager->getObject(AdvancedPricing::class, [ + return $this->objectManager->getObject( + AdvancedPricing::class, + [ 'locator' => $this->locatorMock, 'storeManager' => $this->storeManagerMock, 'groupRepository' => $this->groupRepositoryMock, @@ -114,7 +116,8 @@ protected function createModel() 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock, 'moduleManager' => $this->moduleManagerMock, 'directoryHelper' => $this->directoryHelperMock - ]); + ] + ); } public function testModifyMeta() diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index 00132c6ad89e8..9ad75b5fda923 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -14,7 +14,7 @@ use Magento\Customer\Api\GroupManagementInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Ui\Component\Container; use Magento\Ui\Component\Form\Element\DataType\Number; use Magento\Ui\Component\Form\Element\DataType\Price; diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php index 7791dc761ae39..9bd9a895a2af9 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php @@ -119,7 +119,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param Product\OptionFactory $productOptionFactory @@ -153,7 +153,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, @@ -348,9 +348,11 @@ protected function _renderFiltersBefore() */ private function getTotalRecordsResolver(SearchResultInterface $searchResult): TotalRecordsResolverInterface { - return $this->totalRecordsResolverFactory->create([ + return $this->totalRecordsResolverFactory->create( + [ 'searchResult' => $searchResult, - ]); + ] + ); } /** @@ -360,14 +362,16 @@ private function getTotalRecordsResolver(SearchResultInterface $searchResult): T */ private function getSearchCriteriaResolver(): SearchCriteriaResolverInterface { - return $this->searchCriteriaResolverFactory->create([ + return $this->searchCriteriaResolverFactory->create( + [ 'builder' => $this->getSearchCriteriaBuilder(), 'collection' => $this, 'searchRequestName' => $this->searchRequestName, 'currentPage' => $this->_curPage, 'size' => $this->getPageSize(), 'orders' => $this->searchOrders, - ]); + ] + ); } /** @@ -378,12 +382,14 @@ private function getSearchCriteriaResolver(): SearchCriteriaResolverInterface */ private function getSearchResultApplier(SearchResultInterface $searchResult): SearchResultApplierInterface { - return $this->searchResultApplierFactory->create([ + return $this->searchResultApplierFactory->create( + [ 'collection' => $this, 'searchResult' => $searchResult, /** This variable sets by serOrder method, but doesn't have a getter method. */ 'orders' => $this->_orders - ]); + ] + ); } /** diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php index 59f6cd1c6e7eb..7e4b4f764f64b 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php @@ -146,7 +146,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -185,7 +185,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, @@ -461,9 +461,11 @@ private function isCurrentEngineMysql() */ private function getTotalRecordsResolver(SearchResultInterface $searchResult): TotalRecordsResolverInterface { - return $this->totalRecordsResolverFactory->create([ + return $this->totalRecordsResolverFactory->create( + [ 'searchResult' => $searchResult, - ]); + ] + ); } /** @@ -473,14 +475,16 @@ private function getTotalRecordsResolver(SearchResultInterface $searchResult): T */ private function getSearchCriteriaResolver(): SearchCriteriaResolverInterface { - return $this->searchCriteriaResolverFactory->create([ + return $this->searchCriteriaResolverFactory->create( + [ 'builder' => $this->getSearchCriteriaBuilder(), 'collection' => $this, 'searchRequestName' => $this->searchRequestName, 'currentPage' => $this->_curPage, 'size' => $this->getPageSize(), 'orders' => $this->searchOrders, - ]); + ] + ); } /** @@ -491,12 +495,14 @@ private function getSearchCriteriaResolver(): SearchCriteriaResolverInterface */ private function getSearchResultApplier(SearchResultInterface $searchResult): SearchResultApplierInterface { - return $this->searchResultApplierFactory->create([ + return $this->searchResultApplierFactory->create( + [ 'collection' => $this, 'searchResult' => $searchResult, /** This variable sets by serOrder method, but doesn't have a getter method. */ 'orders' => $this->_orders, - ]); + ] + ); } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index a43f074d8df67..4941bf8451bf8 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -85,7 +85,7 @@ class Renderer extends \Magento\Framework\View\Element\Template implements protected $priceCurrency; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ public $moduleManager; @@ -105,7 +105,7 @@ class Renderer extends \Magento\Framework\View\Element\Template implements * @param \Magento\Framework\Url\Helper\Data $urlHelper * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param PriceCurrencyInterface $priceCurrency - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param InterpretationStrategyInterface $messageInterpretationStrategy * @param array $data * @param ItemResolverInterface|null $itemResolver @@ -120,7 +120,7 @@ public function __construct( \Magento\Framework\Url\Helper\Data $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, PriceCurrencyInterface $priceCurrency, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, InterpretationStrategyInterface $messageInterpretationStrategy, array $data = [], ItemResolverInterface $itemResolver = null @@ -185,6 +185,8 @@ public function getProductForThumbnail() } /** + * Override product url. + * * @param string $productUrl * @return $this * @codeCoverageIgnore @@ -313,11 +315,7 @@ public function getCheckoutSession() } /** - * Retrieve item messages - * Return array with keys - * - * text => the message text - * type => type of a message + * Retrieve item messages, return array with keys, text => the message text, type => type of a message * * @return array */ @@ -472,6 +470,8 @@ public function getProductPriceHtml(\Magento\Catalog\Model\Product $product) } /** + * Get price renderer. + * * @return \Magento\Framework\Pricing\Render * @codeCoverageIgnore */ diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php index ec25b62f49447..6ea5137521106 100644 --- a/app/code/Magento/Checkout/Block/Cart/Link.php +++ b/app/code/Magento/Checkout/Block/Cart/Link.php @@ -41,6 +41,8 @@ public function __construct( } /** + * Get label. + * * @return string * @codeCoverageIgnore */ @@ -50,6 +52,8 @@ public function getLabel() } /** + * Get href. + * * @return string * @codeCoverageIgnore */ diff --git a/app/code/Magento/Checkout/Block/Link.php b/app/code/Magento/Checkout/Block/Link.php index 62f0c60602218..3d0740181f4a5 100644 --- a/app/code/Magento/Checkout/Block/Link.php +++ b/app/code/Magento/Checkout/Block/Link.php @@ -41,6 +41,8 @@ public function __construct( } /** + * Get href. + * * @return string * @codeCoverageIgnore */ diff --git a/app/code/Magento/Checkout/Test/Unit/Model/Layout/DepersonalizePluginTest.php b/app/code/Magento/Checkout/Test/Unit/Model/Layout/DepersonalizePluginTest.php index 350f9954208fa..3cc80e14fd026 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/Layout/DepersonalizePluginTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/Layout/DepersonalizePluginTest.php @@ -43,7 +43,7 @@ protected function setUp() ); $this->checkoutSessionMock = $this->createPartialMock(\Magento\Checkout\Model\Session::class, ['clearStorage']); $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class); - $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\Manager::class); + $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\ModuleManagerInterface::class); $this->cacheConfigMock = $this->createMock(\Magento\PageCache\Model\Config::class); $this->depersonalizeCheckerMock = $this->createMock(\Magento\PageCache\Model\DepersonalizeChecker::class); diff --git a/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php b/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php index 78025587c49ba..db815ec87ed76 100644 --- a/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php +++ b/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php @@ -11,6 +11,8 @@ use Magento\Framework\App\ObjectManager; /** + * Abstract element. + * phpcs:disable Magento2.Classes.AbstractApi * @api * @since 100.0.2 */ @@ -38,7 +40,7 @@ abstract class AbstractElement implements StructureElementInterface protected $_storeManager; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -48,11 +50,15 @@ abstract class AbstractElement implements StructureElementInterface private $elementVisibility; /** + * Construct. + * * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager */ - public function __construct(StoreManagerInterface $storeManager, \Magento\Framework\Module\Manager $moduleManager) - { + public function __construct( + StoreManagerInterface $storeManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager + ) { $this->_storeManager = $storeManager; $this->moduleManager = $moduleManager; } diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php b/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php index d8eeeeb892141..efb918226aa31 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/AbstractComposite.php @@ -6,6 +6,9 @@ namespace Magento\Config\Model\Config\Structure\Element; /** + * Abstract Composite. + * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @since 100.0.2 */ diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php index 82012ff2cabf4..6a8cc6e767466 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php @@ -8,6 +8,8 @@ namespace Magento\Config\Model\Config\Structure\Element; /** + * Element field. + * * @api * @since 100.0.2 */ @@ -243,6 +245,7 @@ public function getSectionId() */ public function getGroupPath() { + // phpcs:ignore Magento2.Functions.DiscouragedFunction return dirname($this->getConfigPath() ?: $this->getPath()); } diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Group.php b/app/code/Magento/Config/Model/Config/Structure/Element/Group.php index 488a33f627028..db479e8b795a0 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Group.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Group.php @@ -7,6 +7,8 @@ namespace Magento\Config\Model\Config\Structure\Element; /** + * Group element. + * * @api * @since 100.0.2 */ diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php index 4e336e19fbe75..134411fbd87ca 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php @@ -6,6 +6,8 @@ namespace Magento\Config\Model\Config\Structure\Element; /** + * Section + * * @api * @since 100.0.2 */ diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/AbstractCompositeTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/AbstractCompositeTest.php index 57d6fa28a7822..e448b628ef020 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/AbstractCompositeTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/AbstractCompositeTest.php @@ -8,6 +8,9 @@ use Magento\Config\Model\Config\Structure\ElementVisibilityInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Abstract composite test. + */ class AbstractCompositeTest extends \PHPUnit\Framework\TestCase { /** @@ -26,7 +29,7 @@ class AbstractCompositeTest extends \PHPUnit\Framework\TestCase protected $_iteratorMock; /** - * @var \Magento\Framework\Module\Manager | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface | \PHPUnit_Framework_MockObject_MockObject */ protected $moduleManagerMock; @@ -53,7 +56,7 @@ protected function setUp() ->getMockForAbstractClass(); $this->_iteratorMock = $this->createMock(\Magento\Config\Model\Config\Structure\Element\Iterator::class); $this->_storeManagerMock = $this->createMock(\Magento\Store\Model\StoreManager::class); - $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\Manager::class); + $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\ModuleManagerInterface::class); $this->_model = $this->getMockForAbstractClass( \Magento\Config\Model\Config\Structure\Element\AbstractComposite::class, [$this->_storeManagerMock, $this->moduleManagerMock, $this->_iteratorMock] diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Plugin.php index 16fff36063219..e8b7299a03db9 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Plugin.php @@ -6,19 +6,22 @@ */ namespace Magento\ConfigurableProduct\Model\Product\Type; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; +/** + * Type plugin. + */ class Plugin { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index 59966768a2eda..a190ccde50b5a 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -23,7 +23,7 @@ class Register extends \Magento\Directory\Block\Data protected $_customerSession; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -41,7 +41,7 @@ class Register extends \Magento\Directory\Block\Data * @param \Magento\Framework\App\Cache\Type\Config $configCacheType * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Url $customerUrl * @param array $data @@ -55,7 +55,7 @@ public function __construct( \Magento\Framework\App\Cache\Type\Config $configCacheType, \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory, \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Url $customerUrl, array $data = [] diff --git a/app/code/Magento/Customer/Helper/Session/CurrentCustomer.php b/app/code/Magento/Customer/Helper/Session/CurrentCustomer.php index e6082de1da4e7..5cd09aca9f873 100644 --- a/app/code/Magento/Customer/Helper/Session/CurrentCustomer.php +++ b/app/code/Magento/Customer/Helper/Session/CurrentCustomer.php @@ -10,11 +10,12 @@ use Magento\Customer\Model\Session as CustomerSession; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\ViewInterface; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Framework\View\LayoutInterface; /** * Class CurrentCustomer + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class CurrentCustomer { @@ -44,7 +45,7 @@ class CurrentCustomer protected $request; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; diff --git a/app/code/Magento/Customer/Model/Customer/Source/Group.php b/app/code/Magento/Customer/Model/Customer/Source/Group.php index e4c1d2e75be22..efcc7d0fe93a4 100644 --- a/app/code/Magento/Customer/Model/Customer/Source/Group.php +++ b/app/code/Magento/Customer/Model/Customer/Source/Group.php @@ -6,11 +6,14 @@ namespace Magento\Customer\Model\Customer\Source; use Magento\Customer\Api\Data\GroupSearchResultsInterface; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Customer\Api\Data\GroupInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; +/** + * Group. + */ class Group implements GroupSourceInterface { /** diff --git a/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php b/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php index d234ebfb334d6..b93b9f40d75b2 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Form/RegisterTest.php @@ -40,7 +40,7 @@ class RegisterTest extends \PHPUnit\Framework\TestCase /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Model\Session */ private $_customerSession; - /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Module\Manager */ + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Module\ModuleManagerInterface */ private $_moduleManager; /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Model\Url */ diff --git a/app/code/Magento/Customer/Test/Unit/Helper/Session/CurrentCustomerTest.php b/app/code/Magento/Customer/Test/Unit/Helper/Session/CurrentCustomerTest.php index 364c3700cab26..03158d05db8e4 100644 --- a/app/code/Magento/Customer/Test/Unit/Helper/Session/CurrentCustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Helper/Session/CurrentCustomerTest.php @@ -6,6 +6,9 @@ namespace Magento\Customer\Test\Unit\Helper\Session; +/** + * Current customer test. + */ class CurrentCustomerTest extends \PHPUnit\Framework\TestCase { /** @@ -44,7 +47,7 @@ class CurrentCustomerTest extends \PHPUnit\Framework\TestCase protected $requestMock; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManagerMock; @@ -77,7 +80,7 @@ protected function setUp() $this->customerDataMock = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); $this->customerRepositoryMock = $this->createMock(\Magento\Customer\Api\CustomerRepositoryInterface::class); $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class); - $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\Manager::class); + $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\ModuleManagerInterface::class); $this->viewMock = $this->createMock(\Magento\Framework\App\View::class); $this->currentCustomer = new \Magento\Customer\Helper\Session\CurrentCustomer( diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php index e07f2f0add972..9128d7c675262 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php @@ -6,12 +6,15 @@ namespace Magento\Customer\Test\Unit\Model\Customer\Source; use Magento\Customer\Model\Customer\Source\Group; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteria; use Magento\Customer\Api\Data\GroupSearchResultsInterface; +/** + * Group test. + */ class GroupTest extends \PHPUnit\Framework\TestCase { /** @@ -20,7 +23,7 @@ class GroupTest extends \PHPUnit\Framework\TestCase private $model; /** - * @var Manager|\PHPUnit_Framework_MockObject_MockObject + * @var ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $moduleManagerMock; @@ -46,7 +49,7 @@ class GroupTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->moduleManagerMock = $this->getMockBuilder(Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class) diff --git a/app/code/Magento/Deploy/Collector/Collector.php b/app/code/Magento/Deploy/Collector/Collector.php index 5974297a76cc7..7742f2971a2fe 100644 --- a/app/code/Magento/Deploy/Collector/Collector.php +++ b/app/code/Magento/Deploy/Collector/Collector.php @@ -9,7 +9,7 @@ use Magento\Deploy\Package\Package; use Magento\Deploy\Package\PackageFactory; use Magento\Deploy\Package\PackageFile; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\View\Asset\PreProcessor\FileNameResolver; /** @@ -46,7 +46,7 @@ class Collector implements CollectorInterface */ private $packageFactory; - /** @var \Magento\Framework\Module\Manager */ + /** @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; /** @@ -66,19 +66,19 @@ class Collector implements CollectorInterface * @param SourcePool $sourcePool * @param FileNameResolver $fileNameResolver * @param PackageFactory $packageFactory - * @param Manager|null $moduleManager + * @param ModuleManagerInterface|null $moduleManager */ public function __construct( SourcePool $sourcePool, FileNameResolver $fileNameResolver, PackageFactory $packageFactory, - Manager $moduleManager = null + ModuleManagerInterface $moduleManager = null ) { $this->sourcePool = $sourcePool; $this->fileNameResolver = $fileNameResolver; $this->packageFactory = $packageFactory; $this->moduleManager = $moduleManager ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Module\Manager::class); + ->get(\Magento\Framework\Module\ModuleManagerInterface::class); } /** diff --git a/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php b/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php index 65073f267c859..51efc74738043 100644 --- a/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/Magento/Downloadable/Block/Checkout/Cart/Item/Renderer.php @@ -15,6 +15,8 @@ use Magento\Framework\View\Element\Message\InterpretationStrategyInterface; /** + * Item renderer. + * * @api * @since 100.0.2 */ @@ -35,7 +37,7 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer * @param \Magento\Framework\Url\Helper\Data $urlHelper * @param \Magento\Framework\Message\ManagerInterface $messageManager * @param PriceCurrencyInterface $priceCurrency - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param InterpretationStrategyInterface $messageInterpretationStrategy * @param \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration * @param array $data @@ -49,7 +51,7 @@ public function __construct( \Magento\Framework\Url\Helper\Data $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, PriceCurrencyInterface $priceCurrency, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, InterpretationStrategyInterface $messageInterpretationStrategy, \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration, array $data = [] @@ -103,7 +105,8 @@ public function getOptionList() } /** - * Get list of all options for product + * Get list of all options for product. + * * @param \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item * @return array */ diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Plugin.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Plugin.php index 866a55c265f83..4777b2bae07a5 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Plugin.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Plugin.php @@ -6,19 +6,22 @@ */ namespace Magento\GroupedProduct\Model\Product\Type; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; +/** + * Plugin. + */ class Plugin { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } diff --git a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php index 0a2a5299a7d73..519da20510815 100644 --- a/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php +++ b/app/code/Magento/GroupedProduct/Model/ResourceModel/Product/Type/Grouped/AssociatedProductsCollection.php @@ -21,7 +21,6 @@ class AssociatedProductsCollection extends \Magento\Catalog\Model\ResourceModel\ * @var \Magento\Framework\Registry */ protected $_coreRegistry = null; - /** * Product types config * diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Model/ProductTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Model/ProductTest.php index 78fa2445ff583..cec7931c1c61f 100644 --- a/app/code/Magento/GroupedProduct/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/GroupedProduct/Test/Unit/Model/ProductTest.php @@ -30,7 +30,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase protected $model; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManager; @@ -159,9 +159,14 @@ class ProductTest extends \PHPUnit\Framework\TestCase */ protected function setUp() { - $this->categoryIndexerMock = $this->getMockForAbstractClass(\Magento\Framework\Indexer\IndexerInterface::class); + $this->categoryIndexerMock = $this->getMockForAbstractClass( + \Magento\Framework\Indexer\IndexerInterface::class + ); - $this->moduleManager = $this->createPartialMock(\Magento\Framework\Module\Manager::class, ['isEnabled']); + $this->moduleManager = $this->createPartialMock( + \Magento\Framework\Module\ModuleManagerInterface::class, + ['isEnabled'] + ); $this->stockItemFactoryMock = $this->createPartialMock( \Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory::class, ['create'] diff --git a/app/code/Magento/ImportExport/Model/Export/Config/Converter.php b/app/code/Magento/ImportExport/Model/Export/Config/Converter.php index 13b7e52c8d5a4..20ab81ec1cd5b 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config/Converter.php +++ b/app/code/Magento/ImportExport/Model/Export/Config/Converter.php @@ -5,20 +5,23 @@ */ namespace Magento\ImportExport\Model\Export\Config; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\App\Utility\Classes; +/** + * Converter. + */ class Converter implements \Magento\Framework\Config\ConverterInterface { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** * @param Manager $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } diff --git a/app/code/Magento/ImportExport/Model/Import/Config/Converter.php b/app/code/Magento/ImportExport/Model/Import/Config/Converter.php index 8169b8fe63bbd..f2d1596ec3d9d 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config/Converter.php +++ b/app/code/Magento/ImportExport/Model/Import/Config/Converter.php @@ -5,20 +5,23 @@ */ namespace Magento\ImportExport\Model\Import\Config; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\App\Utility\Classes; +/** + * Converter. + */ class Converter implements \Magento\Framework\Config\ConverterInterface { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/ConverterTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/ConverterTest.php index 2e102d3ae3fab..c888c6b447348 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/ConverterTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/ConverterTest.php @@ -5,6 +5,9 @@ */ namespace Magento\ImportExport\Test\Unit\Model\Export\Config; +/** + * Converter test + */ class ConverterTest extends \PHPUnit\Framework\TestCase { /** @@ -18,7 +21,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase protected $filePath; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManager; diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/ConverterTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/ConverterTest.php index 58f9a81474f25..b29a04322ce4f 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/ConverterTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/ConverterTest.php @@ -5,6 +5,9 @@ */ namespace Magento\ImportExport\Test\Unit\Model\Import\Config; +/** + * Converter test + */ class ConverterTest extends \PHPUnit\Framework\TestCase { /** @@ -18,7 +21,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase protected $filePath; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManager; diff --git a/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php b/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php index ce618f97883b0..0b9cb377d1d08 100644 --- a/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php +++ b/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php @@ -8,7 +8,7 @@ namespace Magento\LayeredNavigation\Observer\Edit\Tab\Front; use Magento\Config\Model\Config\Source; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Event\ObserverInterface; /** @@ -22,15 +22,15 @@ class ProductAttributeFormBuildFrontTabObserver implements ObserverInterface protected $optionList; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Source\Yesno $optionList */ - public function __construct(Manager $moduleManager, Source\Yesno $optionList) + public function __construct(ModuleManagerInterface $moduleManager, Source\Yesno $optionList) { $this->optionList = $optionList; $this->moduleManager = $moduleManager; diff --git a/app/code/Magento/LayeredNavigation/Observer/Grid/ProductAttributeGridBuildObserver.php b/app/code/Magento/LayeredNavigation/Observer/Grid/ProductAttributeGridBuildObserver.php index 0f1c95df5313c..b98230c1ebe3c 100644 --- a/app/code/Magento/LayeredNavigation/Observer/Grid/ProductAttributeGridBuildObserver.php +++ b/app/code/Magento/LayeredNavigation/Observer/Grid/ProductAttributeGridBuildObserver.php @@ -7,25 +7,32 @@ */ namespace Magento\LayeredNavigation\Observer\Grid; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Event\ObserverInterface; +/** + * Product attribute grid build observer + */ class ProductAttributeGridBuildObserver implements ObserverInterface { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * Construct. + * + * @param ModuleManagerInterface $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } /** + * Execute. + * * @param \Magento\Framework\Event\Observer $observer * @return void */ diff --git a/app/code/Magento/NewRelicReporting/Model/Module/Collect.php b/app/code/Magento/NewRelicReporting/Model/Module/Collect.php index fe5389e258aa5..0d8a94fbed940 100644 --- a/app/code/Magento/NewRelicReporting/Model/Module/Collect.php +++ b/app/code/Magento/NewRelicReporting/Model/Module/Collect.php @@ -6,7 +6,7 @@ namespace Magento\NewRelicReporting\Model\Module; use Magento\Framework\Module\FullModuleList; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Module\ModuleListInterface; use Magento\NewRelicReporting\Model\Config; use Magento\NewRelicReporting\Model\Module; @@ -22,7 +22,7 @@ class Collect protected $moduleList; /** - * @var Manager + * @var ModuleManagerInterface */ protected $moduleManager; @@ -46,14 +46,14 @@ class Collect * * @param ModuleListInterface $moduleList * @param FullModuleList $fullModuleList - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param \Magento\NewRelicReporting\Model\ModuleFactory $moduleFactory * @param \Magento\NewRelicReporting\Model\ResourceModel\Module\CollectionFactory $moduleCollectionFactory */ public function __construct( ModuleListInterface $moduleList, FullModuleList $fullModuleList, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, \Magento\NewRelicReporting\Model\ModuleFactory $moduleFactory, \Magento\NewRelicReporting\Model\ResourceModel\Module\CollectionFactory $moduleCollectionFactory ) { diff --git a/app/code/Magento/NewRelicReporting/Test/Unit/Model/Module/CollectTest.php b/app/code/Magento/NewRelicReporting/Test/Unit/Model/Module/CollectTest.php index 4286406d6e9ab..3c30d95b77de0 100644 --- a/app/code/Magento/NewRelicReporting/Test/Unit/Model/Module/CollectTest.php +++ b/app/code/Magento/NewRelicReporting/Test/Unit/Model/Module/CollectTest.php @@ -8,7 +8,6 @@ use Magento\NewRelicReporting\Model\Module\Collect; use Magento\Framework\Module\FullModuleList; use Magento\Framework\Module\ModuleListInterface; -use Magento\Framework\Module\Manager; use Magento\NewRelicReporting\Model\Module; /** diff --git a/app/code/Magento/PageCache/Test/Unit/Model/DepersonalizeCheckerTest.php b/app/code/Magento/PageCache/Test/Unit/Model/DepersonalizeCheckerTest.php index aeaeba9384129..6857c637bab84 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/DepersonalizeCheckerTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/DepersonalizeCheckerTest.php @@ -7,6 +7,9 @@ use Magento\PageCache\Model\DepersonalizeChecker; +/** + * Depersonalize checker test + */ class DepersonalizeCheckerTest extends \PHPUnit\Framework\TestCase { /** @@ -15,7 +18,7 @@ class DepersonalizeCheckerTest extends \PHPUnit\Framework\TestCase private $requestMock; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $moduleManagerMock; @@ -27,7 +30,7 @@ class DepersonalizeCheckerTest extends \PHPUnit\Framework\TestCase public function setup() { $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class); - $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\Manager::class); + $this->moduleManagerMock = $this->createMock(\Magento\Framework\Module\ModuleManagerInterface::class); $this->cacheConfigMock = $this->createMock(\Magento\PageCache\Model\Config::class); } diff --git a/app/code/Magento/Persistent/Test/Unit/Model/Layout/DepersonalizePluginTest.php b/app/code/Magento/Persistent/Test/Unit/Model/Layout/DepersonalizePluginTest.php index 9731811ea8a97..5ba0182ecc57a 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/Layout/DepersonalizePluginTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/Layout/DepersonalizePluginTest.php @@ -46,9 +46,17 @@ protected function setUp() $this->requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class); - $this->moduleManagerMock = $this->createPartialMock(\Magento\Framework\Module\Manager::class, ['isEnabled']); - $this->cacheConfigMock = $this->createPartialMock(\Magento\PageCache\Model\Config::class, ['isEnabled']); - $this->depersonalizeCheckerMock = $this->createMock(\Magento\PageCache\Model\DepersonalizeChecker::class); + $this->moduleManagerMock = $this->createPartialMock( + \Magento\Framework\Module\ModuleManagerInterface::class, + ['isEnabled'] + ); + $this->cacheConfigMock = $this->createPartialMock( + \Magento\PageCache\Model\Config::class, + ['isEnabled'] + ); + $this->depersonalizeCheckerMock = $this->createMock( + \Magento\PageCache\Model\DepersonalizeChecker::class + ); $this->plugin = $this->objectManager->getObject( \Magento\Persistent\Model\Layout\DepersonalizePlugin::class, diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php index 39d673911111f..c02de01117a74 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php @@ -63,7 +63,7 @@ class Collection extends \Magento\Reports\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -94,7 +94,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Product/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Product/CollectionTest.php index 038d37a990442..c8a16c2476824 100644 --- a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Product/CollectionTest.php +++ b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Product/CollectionTest.php @@ -26,7 +26,7 @@ use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Select; use Magento\Framework\Event\ManagerInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface as Manager; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; diff --git a/app/code/Magento/Review/Model/ResourceModel/Rating.php b/app/code/Magento/Review/Model/ResourceModel/Rating.php index 37a93d40b1107..42c14e16a50e2 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Rating.php +++ b/app/code/Magento/Review/Model/ResourceModel/Rating.php @@ -29,7 +29,7 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb protected $_storeManager; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; @@ -46,7 +46,7 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Review\Summary $reviewSummary * @param string $connectionName @@ -55,7 +55,7 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary, $connectionName = null, diff --git a/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php b/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php index ab264ef1b6179..7175baa92a2f8 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php +++ b/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php @@ -75,7 +75,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory @@ -103,7 +103,7 @@ public function __construct( \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, diff --git a/app/code/Magento/Review/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ReviewTest.php b/app/code/Magento/Review/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ReviewTest.php index f618651930dcd..e1e5503ad475f 100644 --- a/app/code/Magento/Review/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ReviewTest.php +++ b/app/code/Magento/Review/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ReviewTest.php @@ -8,7 +8,7 @@ use Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier\AbstractModifierTest; use Magento\Framework\UrlInterface; use Magento\Review\Ui\DataProvider\Product\Form\Modifier\Review; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\Manager as ModuleManager; use Magento\Ui\DataProvider\Modifier\ModifierInterface; /** @@ -39,10 +39,13 @@ protected function setUp() */ protected function createModel() { - $model = $this->objectManager->getObject(Review::class, [ + $model = $this->objectManager->getObject( + Review::class, + [ 'locator' => $this->locatorMock, 'urlBuilder' => $this->urlBuilderMock, - ]); + ] + ); $reviewClass = new \ReflectionClass(Review::class); $moduleManagerProperty = $reviewClass->getProperty('moduleManager'); diff --git a/app/code/Magento/Review/Ui/DataProvider/Product/Form/Modifier/Review.php b/app/code/Magento/Review/Ui/DataProvider/Product/Form/Modifier/Review.php index 727cd973de32d..433be1c860988 100644 --- a/app/code/Magento/Review/Ui/DataProvider/Product/Form/Modifier/Review.php +++ b/app/code/Magento/Review/Ui/DataProvider/Product/Form/Modifier/Review.php @@ -12,7 +12,7 @@ use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Ui\Component\Form; use Magento\Framework\UrlInterface; -use Magento\Framework\Module\Manager as ModuleManager; +use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager; use Magento\Framework\App\ObjectManager; /** @@ -59,7 +59,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * @since 100.1.0 */ public function modifyMeta(array $meta) @@ -117,7 +117,7 @@ public function modifyMeta(array $meta) } /** - * {@inheritdoc} + * @inheritdoc * @since 100.1.0 */ public function modifyData(array $data) @@ -133,7 +133,6 @@ public function modifyData(array $data) * Retrieve module manager instance using dependency lookup to keep this class backward compatible. * * @return ModuleManager - * * @deprecated 100.2.0 */ private function getModuleManager() diff --git a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php index dbb8e7812ca29..ad8d247b2a6fb 100644 --- a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php +++ b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php @@ -53,6 +53,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -62,6 +64,8 @@ protected function _construct() } /** + * Prepare collection. + * * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -86,6 +90,8 @@ protected function _prepareCollection() } /** + * Prepare columns. + * * @return $this * @throws \Exception */ diff --git a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php index 6f2d54e426540..63893f788673d 100644 --- a/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php +++ b/app/code/Magento/Search/Block/Adminhtml/Dashboard/Top.php @@ -53,6 +53,8 @@ public function __construct( } /** + * Construct. + * * @return void */ protected function _construct() @@ -62,7 +64,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ protected function _prepareCollection() { @@ -86,7 +88,7 @@ protected function _prepareCollection() } /** - * {@inheritdoc} + * @inheritdoc */ protected function _prepareColumns() { @@ -119,7 +121,7 @@ protected function _prepareColumns() } /** - * {@inheritdoc} + * @inheritdoc */ public function getRowUrl($row) { diff --git a/app/code/Magento/Swatches/Observer/AddFieldsToAttributeObserver.php b/app/code/Magento/Swatches/Observer/AddFieldsToAttributeObserver.php index cfef5ab499e5d..3ef202af95a1a 100644 --- a/app/code/Magento/Swatches/Observer/AddFieldsToAttributeObserver.php +++ b/app/code/Magento/Swatches/Observer/AddFieldsToAttributeObserver.php @@ -6,7 +6,7 @@ namespace Magento\Swatches\Observer; use Magento\Config\Model\Config\Source; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Event\Observer as EventObserver; use Magento\Framework\Event\ObserverInterface; @@ -21,21 +21,23 @@ class AddFieldsToAttributeObserver implements ObserverInterface protected $yesNo; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Source\Yesno $yesNo */ - public function __construct(Manager $moduleManager, Source\Yesno $yesNo) + public function __construct(ModuleManagerInterface $moduleManager, Source\Yesno $yesNo) { $this->moduleManager = $moduleManager; $this->yesNo = $yesNo; } /** + * Execute. + * * @param \Magento\Framework\Event\Observer $observer * @return void */ diff --git a/app/code/Magento/Swatches/Observer/AddSwatchAttributeTypeObserver.php b/app/code/Magento/Swatches/Observer/AddSwatchAttributeTypeObserver.php index 3a517bd835146..ca75da3321698 100644 --- a/app/code/Magento/Swatches/Observer/AddSwatchAttributeTypeObserver.php +++ b/app/code/Magento/Swatches/Observer/AddSwatchAttributeTypeObserver.php @@ -6,7 +6,7 @@ namespace Magento\Swatches\Observer; use Magento\Config\Model\Config\Source; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\Event\Observer as EventObserver; use Magento\Framework\Event\ObserverInterface; @@ -16,19 +16,21 @@ class AddSwatchAttributeTypeObserver implements ObserverInterface { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManager; /** - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager */ - public function __construct(Manager $moduleManager) + public function __construct(ModuleManagerInterface $moduleManager) { $this->moduleManager = $moduleManager; } /** + * Execute. + * * @param \Magento\Framework\Event\Observer $observer * @return void */ diff --git a/app/code/Magento/Swatches/Test/Unit/Observer/AddFieldsToAttributeObserverTest.php b/app/code/Magento/Swatches/Test/Unit/Observer/AddFieldsToAttributeObserverTest.php index 45c680366264b..f8ba5c20250ad 100644 --- a/app/code/Magento/Swatches/Test/Unit/Observer/AddFieldsToAttributeObserverTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Observer/AddFieldsToAttributeObserverTest.php @@ -10,7 +10,7 @@ */ class AddFieldsToAttributeObserverTest extends \PHPUnit\Framework\TestCase { - /** @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManagerMock; /** @var \Magento\Config\Model\Config\Source\Yesno|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/app/code/Magento/Swatches/Test/Unit/Observer/AddSwatchAttributeTypeObserverTest.php b/app/code/Magento/Swatches/Test/Unit/Observer/AddSwatchAttributeTypeObserverTest.php index f78797d93cb0d..24afa1045e5cb 100644 --- a/app/code/Magento/Swatches/Test/Unit/Observer/AddSwatchAttributeTypeObserverTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Observer/AddSwatchAttributeTypeObserverTest.php @@ -10,7 +10,7 @@ */ class AddSwatchAttributeTypeObserverTest extends \PHPUnit\Framework\TestCase { - /** @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManagerMock; /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php index b73f3b2163a84..bba9bc3f3ebe7 100644 --- a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php @@ -70,6 +70,8 @@ public function __construct( } /** + * Before dispatch. + * * @param \Magento\Framework\App\ActionInterface $subject * @param \Magento\Framework\App\RequestInterface $request * @return mixed diff --git a/app/code/Magento/Tax/Observer/AfterAddressSaveObserver.php b/app/code/Magento/Tax/Observer/AfterAddressSaveObserver.php index 025a16a1aea55..ef84eac32e95a 100644 --- a/app/code/Magento/Tax/Observer/AfterAddressSaveObserver.php +++ b/app/code/Magento/Tax/Observer/AfterAddressSaveObserver.php @@ -8,11 +8,14 @@ use Magento\Customer\Model\Address; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\PageCache\Model\Config; use Magento\Tax\Api\TaxAddressManagerInterface; use Magento\Tax\Helper\Data; +/** + * After address save observer. + */ class AfterAddressSaveObserver implements ObserverInterface { /** @@ -23,7 +26,7 @@ class AfterAddressSaveObserver implements ObserverInterface /** * Module manager * - * @var Manager + * @var ModuleManagerInterface */ private $moduleManager; @@ -43,13 +46,13 @@ class AfterAddressSaveObserver implements ObserverInterface /** * @param Data $taxHelper - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Config $cacheConfig * @param TaxAddressManagerInterface $addressManager */ public function __construct( Data $taxHelper, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, Config $cacheConfig, TaxAddressManagerInterface $addressManager ) { @@ -60,6 +63,8 @@ public function __construct( } /** + * Execute. + * * @param Observer $observer * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) diff --git a/app/code/Magento/Tax/Observer/CustomerLoggedInObserver.php b/app/code/Magento/Tax/Observer/CustomerLoggedInObserver.php index eda7898e9a1b2..00b3a9f9e09ad 100644 --- a/app/code/Magento/Tax/Observer/CustomerLoggedInObserver.php +++ b/app/code/Magento/Tax/Observer/CustomerLoggedInObserver.php @@ -9,11 +9,15 @@ use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\PageCache\Model\Config; use Magento\Tax\Api\TaxAddressManagerInterface; use Magento\Tax\Helper\Data; +/** + * Customer logged in observer + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ class CustomerLoggedInObserver implements ObserverInterface { /** @@ -29,7 +33,7 @@ class CustomerLoggedInObserver implements ObserverInterface /** * Module manager * - * @var Manager + * @var ModuleManagerInterface */ private $moduleManager; @@ -56,7 +60,7 @@ class CustomerLoggedInObserver implements ObserverInterface * @param GroupRepositoryInterface $groupRepository * @param Session $customerSession * @param Data $taxHelper - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Config $cacheConfig * @param TaxAddressManagerInterface $addressManager */ @@ -64,7 +68,7 @@ public function __construct( GroupRepositoryInterface $groupRepository, Session $customerSession, Data $taxHelper, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, Config $cacheConfig, TaxAddressManagerInterface $addressManager ) { @@ -77,6 +81,8 @@ public function __construct( } /** + * Execute. + * * @param Observer $observer * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) diff --git a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php index 9a85ba0a9089b..020baa0c30ec5 100644 --- a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Tax\Test\Unit\App\Action; +/** + * Context plugin test + */ class ContextPluginTest extends \PHPUnit\Framework\TestCase { /** @@ -35,7 +38,7 @@ class ContextPluginTest extends \PHPUnit\Framework\TestCase /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManagerMock; @@ -78,13 +81,15 @@ protected function setUp() $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getDefaultTaxBillingAddress', 'getDefaultTaxShippingAddress', 'getCustomerTaxClassId', 'getWebsiteId', 'isLoggedIn' - ]) + ] + ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Tax/Test/Unit/Observer/AfterAddressSaveObserverTest.php b/app/code/Magento/Tax/Test/Unit/Observer/AfterAddressSaveObserverTest.php index 96b4b81ae2817..2e957e528e294 100644 --- a/app/code/Magento/Tax/Test/Unit/Observer/AfterAddressSaveObserverTest.php +++ b/app/code/Magento/Tax/Test/Unit/Observer/AfterAddressSaveObserverTest.php @@ -6,7 +6,7 @@ namespace Magento\Tax\Test\Unit\Observer; use Magento\Framework\Event\Observer; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\PageCache\Model\Config; use Magento\Tax\Api\TaxAddressManagerInterface; @@ -31,7 +31,7 @@ class AfterAddressSaveObserverTest extends \PHPUnit\Framework\TestCase /** * Module manager * - * @var Manager|\PHPUnit_Framework_MockObject_MockObject + * @var ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $moduleManagerMock; @@ -65,7 +65,7 @@ protected function setUp() ->setMethods(['getCustomerAddress']) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Tax/Test/Unit/Observer/CustomerLoggedInObserverTest.php b/app/code/Magento/Tax/Test/Unit/Observer/CustomerLoggedInObserverTest.php index 9e15e529288eb..facbb6733b5c8 100644 --- a/app/code/Magento/Tax/Test/Unit/Observer/CustomerLoggedInObserverTest.php +++ b/app/code/Magento/Tax/Test/Unit/Observer/CustomerLoggedInObserverTest.php @@ -8,6 +8,9 @@ use Magento\Tax\Api\TaxAddressManagerInterface; use PHPUnit_Framework_MockObject_MockObject as MockObject; +/** + * Customer logged in observer test + */ class CustomerLoggedInObserverTest extends \PHPUnit\Framework\TestCase { /** @@ -28,7 +31,7 @@ class CustomerLoggedInObserverTest extends \PHPUnit\Framework\TestCase /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManagerMock; @@ -59,9 +62,11 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getCustomerAddress', 'getData' - ]) + ] + ) ->getMock(); $this->groupRepositoryMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\GroupRepository::class) @@ -70,12 +75,14 @@ protected function setUp() $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'setCustomerTaxClassId', 'setDefaultTaxBillingAddress', 'setDefaultTaxShippingAddress', 'setWebsiteId' - ]) + ] + ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php index ac3da52ef8d8f..5d5426660d8f1 100644 --- a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php @@ -91,6 +91,8 @@ public function __construct( } /** + * Before dispatch. + * * @param \Magento\Framework\App\ActionInterface $subject * @param \Magento\Framework\App\RequestInterface $request * @return void @@ -159,6 +161,8 @@ public function beforeDispatch( } /** + * Get wee tax region. + * * @param string $basedOn * @return array */ diff --git a/app/code/Magento/Weee/Observer/AfterAddressSave.php b/app/code/Magento/Weee/Observer/AfterAddressSave.php index 1644ce43f86f0..9acea506adf67 100644 --- a/app/code/Magento/Weee/Observer/AfterAddressSave.php +++ b/app/code/Magento/Weee/Observer/AfterAddressSave.php @@ -8,11 +8,14 @@ use Magento\Customer\Model\Address; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\PageCache\Model\Config; use Magento\Tax\Api\TaxAddressManagerInterface; use Magento\Weee\Helper\Data; +/** + * @inheritDoc + */ class AfterAddressSave implements ObserverInterface { /** @@ -23,7 +26,7 @@ class AfterAddressSave implements ObserverInterface /** * Module manager * - * @var Manager + * @var ModuleManagerInterface */ private $moduleManager; @@ -43,13 +46,13 @@ class AfterAddressSave implements ObserverInterface /** * @param Data $weeeHelper - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Config $cacheConfig * @param TaxAddressManagerInterface $addressManager */ public function __construct( Data $weeeHelper, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, Config $cacheConfig, TaxAddressManagerInterface $addressManager ) { @@ -60,6 +63,8 @@ public function __construct( } /** + * Execute. + * * @param Observer $observer * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) diff --git a/app/code/Magento/Weee/Observer/CustomerLoggedIn.php b/app/code/Magento/Weee/Observer/CustomerLoggedIn.php index 8a498d628dabd..95299d96cabd2 100644 --- a/app/code/Magento/Weee/Observer/CustomerLoggedIn.php +++ b/app/code/Magento/Weee/Observer/CustomerLoggedIn.php @@ -8,12 +8,15 @@ use Magento\Customer\Model\Session; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\PageCache\Model\Config; use Magento\Tax\Api\TaxAddressManagerInterface; use Magento\Weee\Helper\Data; use Magento\Tax\Helper\Data as TaxHelper; +/** + * Customer logged in. + */ class CustomerLoggedIn implements ObserverInterface { /** @@ -49,13 +52,13 @@ class CustomerLoggedIn implements ObserverInterface /** * @param Data $weeeHelper - * @param Manager $moduleManager + * @param ModuleManagerInterface $moduleManager * @param Config $cacheConfig * @param TaxAddressManagerInterface $addressManager */ public function __construct( Data $weeeHelper, - Manager $moduleManager, + ModuleManagerInterface $moduleManager, Config $cacheConfig, TaxAddressManagerInterface $addressManager ) { @@ -66,6 +69,8 @@ public function __construct( } /** + * Execute. + * * @param Observer $observer * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) diff --git a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php index 5500350e243ad..b720f42378fa9 100644 --- a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php @@ -39,7 +39,7 @@ class ContextPluginTest extends \PHPUnit\Framework\TestCase protected $taxCalculationMock; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $moduleManagerMock; @@ -85,13 +85,15 @@ protected function setUp() $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getDefaultTaxBillingAddress', 'getDefaultTaxShippingAddress', 'getCustomerTaxClassId', 'getWebsiteId', 'isLoggedIn' - ]) + ] + ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Weee/Test/Unit/Observer/AfterAddressSaveTest.php b/app/code/Magento/Weee/Test/Unit/Observer/AfterAddressSaveTest.php index 6d363847bf9e6..a7b88f5727126 100644 --- a/app/code/Magento/Weee/Test/Unit/Observer/AfterAddressSaveTest.php +++ b/app/code/Magento/Weee/Test/Unit/Observer/AfterAddressSaveTest.php @@ -9,6 +9,9 @@ use Magento\Tax\Api\TaxAddressManagerInterface; use PHPUnit_Framework_MockObject_MockObject as MockObject; +/** + * After address save test. + */ class AfterAddressSaveTest extends \PHPUnit\Framework\TestCase { /** @@ -24,7 +27,7 @@ class AfterAddressSaveTest extends \PHPUnit\Framework\TestCase /** * Module manager * - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $moduleManagerMock; @@ -58,7 +61,7 @@ protected function setUp() ->setMethods(['getCustomerAddress']) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Weee/Test/Unit/Observer/CustomerLoggedInTest.php b/app/code/Magento/Weee/Test/Unit/Observer/CustomerLoggedInTest.php index aaca1c237aad1..06d1dbedcfd80 100644 --- a/app/code/Magento/Weee/Test/Unit/Observer/CustomerLoggedInTest.php +++ b/app/code/Magento/Weee/Test/Unit/Observer/CustomerLoggedInTest.php @@ -8,6 +8,9 @@ use Magento\Tax\Api\TaxAddressManagerInterface; use PHPUnit_Framework_MockObject_MockObject as MockObject; +/** + * Customer logged in test + */ class CustomerLoggedInTest extends \PHPUnit\Framework\TestCase { /** @@ -18,7 +21,7 @@ class CustomerLoggedInTest extends \PHPUnit\Framework\TestCase /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManagerMock; @@ -49,12 +52,14 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) ->disableOriginalConstructor() - ->setMethods([ + ->setMethods( + [ 'getCustomerAddress', 'getData' - ]) + ] + ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Wishlist/Test/Unit/Helper/RssTest.php b/app/code/Magento/Wishlist/Test/Unit/Helper/RssTest.php index d0397be83fac7..b55766d77fee3 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Helper/RssTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Helper/RssTest.php @@ -46,7 +46,7 @@ class RssTest extends \PHPUnit\Framework\TestCase protected $customerRepositoryMock; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $moduleManagerMock; @@ -80,7 +80,7 @@ protected function setUp() $this->customerRepositoryMock = $this->getMockBuilder(\Magento\Customer\Api\CustomerRepositoryInterface::class) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\ModuleManagerInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Account/Dashboard/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Account/Dashboard/AddressTest.php index 844325540e407..b159dceadfb77 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Account/Dashboard/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Account/Dashboard/AddressTest.php @@ -9,6 +9,9 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\TestFramework\Helper\Bootstrap; +/** + * Class address test. + */ class AddressTest extends \PHPUnit\Framework\TestCase { /** @@ -66,7 +69,7 @@ public function testGetCustomer() public function testGetCustomerMissingCustomer() { - $moduleManager = $this->objectManager->get(\Magento\Framework\Module\Manager::class); + $moduleManager = $this->objectManager->get(\Magento\Framework\Module\ModuleManagerInterface::class); if ($moduleManager->isEnabled('Magento_PageCache')) { $customerDataFactory = $this->objectManager->create( \Magento\Customer\Api\Data\CustomerInterfaceFactory::class diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index ff8e7db0f4260..9417baea67ba9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1982,8 +1982,8 @@ ['_escapeDefaultValue', 'Magento\Framework\Code\Generator\EntityAbstract'], ['urlEncode', 'Magento\Framework\App\Helper\AbstractHelper', 'Magento\Framework\Url\EncoderInterface::encode'], ['urlDecode', 'Magento\Framework\App\Helper\AbstractHelper', 'Magento\Framework\Url\DecoderInterface::decode'], - ['isModuleEnabled', 'Magento\Framework\App\Helper\AbstractHelper', 'Magento\Framework\Module\Manager::isEnabled()'], - ['isModuleOutputEnabled', 'Magento\Framework\App\Helper\AbstractHelper', 'Magento\Framework\Module\Manager::isOutputEnabled()'], + ['isModuleEnabled', 'Magento\Framework\App\Helper\AbstractHelper', '\Magento\Framework\Module\ModuleManagerInterface::isEnabled()'], + ['isModuleOutputEnabled', 'Magento\Framework\App\Helper\AbstractHelper', '\Magento\Framework\Module\ModuleManagerInterface::isOutputEnabled()'], ['_packToTar', 'Magento\Framework\Archive\Tar'], ['_parseHeader', 'Magento\Framework\Archive\Tar'], ['getIdentities', 'Magento\Wishlist\Block\Link'], diff --git a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php index 1a76610bc0811..7875e0c8885f5 100644 --- a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php +++ b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php @@ -27,7 +27,7 @@ abstract class AbstractHelper protected $_request; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -125,7 +125,7 @@ protected function _getModuleName() * * @param string $moduleName Full module name * @return boolean - * use \Magento\Framework\Module\Manager::isOutputEnabled() + * use \Magento\Framework\Module\ModuleManagerInterface::isOutputEnabled() */ public function isModuleOutputEnabled($moduleName = null) { diff --git a/lib/internal/Magento/Framework/App/Helper/Context.php b/lib/internal/Magento/Framework/App/Helper/Context.php index dc8afd061cba1..cc57f109cc8ec 100644 --- a/lib/internal/Magento/Framework/App/Helper/Context.php +++ b/lib/internal/Magento/Framework/App/Helper/Context.php @@ -21,7 +21,7 @@ class Context implements \Magento\Framework\ObjectManager\ContextInterface { /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ protected $_moduleManager; @@ -79,7 +79,7 @@ class Context implements \Magento\Framework\ObjectManager\ContextInterface * @param \Magento\Framework\Url\EncoderInterface $urlEncoder * @param \Magento\Framework\Url\DecoderInterface $urlDecoder * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager * @param \Magento\Framework\App\RequestInterface $httpRequest * @param \Magento\Framework\Cache\ConfigInterface $cacheConfig * @param \Magento\Framework\Event\ManagerInterface $eventManager @@ -94,7 +94,7 @@ public function __construct( \Magento\Framework\Url\EncoderInterface $urlEncoder, \Magento\Framework\Url\DecoderInterface $urlDecoder, \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Module\Manager $moduleManager, + \Magento\Framework\Module\ModuleManagerInterface $moduleManager, \Magento\Framework\App\RequestInterface $httpRequest, \Magento\Framework\Cache\ConfigInterface $cacheConfig, \Magento\Framework\Event\ManagerInterface $eventManager, @@ -117,7 +117,9 @@ public function __construct( } /** - * @return \Magento\Framework\Module\Manager + * Get module manager. + * + * @return \Magento\Framework\Module\ModuleManagerInterface */ public function getModuleManager() { @@ -125,6 +127,8 @@ public function getModuleManager() } /** + * Get url builder. + * * @return \Magento\Framework\UrlInterface */ public function getUrlBuilder() @@ -133,6 +137,8 @@ public function getUrlBuilder() } /** + * Get request. + * * @return \Magento\Framework\App\RequestInterface */ public function getRequest() @@ -141,6 +147,8 @@ public function getRequest() } /** + * Get cache configs. + * * @return \Magento\Framework\Cache\ConfigInterface */ public function getCacheConfig() @@ -149,6 +157,8 @@ public function getCacheConfig() } /** + * Get event manager. + * * @return \Magento\Framework\Event\ManagerInterface */ public function getEventManager() @@ -157,6 +167,8 @@ public function getEventManager() } /** + * Get logger. + * * @return \Psr\Log\LoggerInterface */ public function getLogger() @@ -165,6 +177,8 @@ public function getLogger() } /** + * Get http header. + * * @return \Magento\Framework\HTTP\Header */ public function getHttpHeader() @@ -173,6 +187,8 @@ public function getHttpHeader() } /** + * Get remote address. + * * @return \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress */ public function getRemoteAddress() @@ -181,6 +197,8 @@ public function getRemoteAddress() } /** + * Get url encoder. + * * @return \Magento\Framework\Url\EncoderInterface */ public function getUrlEncoder() @@ -189,6 +207,8 @@ public function getUrlEncoder() } /** + * Get url decoder. + * * @return \Magento\Framework\Url\DecoderInterface */ public function getUrlDecoder() @@ -197,6 +217,8 @@ public function getUrlDecoder() } /** + * Get scope config. + * * @return \Magento\Framework\App\Config\ScopeConfigInterface */ public function getScopeConfig() diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/ManagerTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/ManagerTest.php index 2a718ced1b025..e4cf4c41599e9 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/ManagerTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/ManagerTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Module\Test\Unit; +/** + * Manager test + */ class ManagerTest extends \PHPUnit\Framework\TestCase { /** @@ -13,7 +16,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase const XML_PATH_OUTPUT_ENABLED = 'custom/is_module_output_enabled'; /** - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $_model; @@ -35,11 +38,15 @@ protected function setUp() $this->_moduleList = $this->getMockForAbstractClass(\Magento\Framework\Module\ModuleListInterface::class); $this->_moduleList->expects($this->any()) ->method('getOne') - ->will($this->returnValueMap([ - ['Module_One', ['name' => 'One_Module', 'setup_version' => '1']], - ['Module_Two', ['name' => 'Two_Module', 'setup_version' => '2']], - ['Module_Three', ['name' => 'Two_Three']], - ])); + ->will( + $this->returnValueMap( + [ + ['Module_One', ['name' => 'One_Module', 'setup_version' => '1']], + ['Module_Two', ['name' => 'Two_Module', 'setup_version' => '2']], + ['Module_Three', ['name' => 'Two_Three']], + ] + ) + ); $this->_outputConfig = $this->getMockForAbstractClass(\Magento\Framework\Module\Output\ConfigInterface::class); $this->_model = new \Magento\Framework\Module\Manager( $this->_outputConfig, @@ -52,10 +59,14 @@ protected function setUp() public function testIsEnabled() { - $this->_moduleList->expects($this->exactly(2))->method('has')->will($this->returnValueMap([ - ['Module_Exists', true], - ['Module_NotExists', false], - ])); + $this->_moduleList->expects($this->exactly(2))->method('has')->will( + $this->returnValueMap( + [ + ['Module_Exists', true], + ['Module_NotExists', false], + ] + ) + ); $this->assertTrue($this->_model->isEnabled('Module_Exists')); $this->assertFalse($this->_model->isEnabled('Module_NotExists')); } diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php index 72a9ba7df0e77..7a631eed1adbf 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php @@ -9,6 +9,9 @@ use Magento\Framework\Module\DbVersionInfo; +/** + * DbStatus validator test. + */ class DbStatusValidatorTest extends \PHPUnit\Framework\TestCase { /** @@ -32,7 +35,7 @@ class DbStatusValidatorTest extends \PHPUnit\Framework\TestCase protected $requestMock; /** - * @var \Magento\Framework\Module\Manager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Module\ModuleManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $moduleManager; diff --git a/lib/internal/Magento/Framework/View/File/Collector/Decorator/ModuleOutput.php b/lib/internal/Magento/Framework/View/File/Collector/Decorator/ModuleOutput.php index 34f32b2f6b7b2..71fa8d2c0ae6b 100644 --- a/lib/internal/Magento/Framework/View/File/Collector/Decorator/ModuleOutput.php +++ b/lib/internal/Magento/Framework/View/File/Collector/Decorator/ModuleOutput.php @@ -6,7 +6,7 @@ namespace Magento\Framework\View\File\Collector\Decorator; -use Magento\Framework\Module\Manager; +use Magento\Framework\Module\ModuleManagerInterface; use Magento\Framework\View\Design\ThemeInterface; use Magento\Framework\View\File; use Magento\Framework\View\File\CollectorInterface; @@ -26,7 +26,7 @@ class ModuleOutput implements CollectorInterface /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var \Magento\Framework\Module\ModuleManagerInterface */ private $moduleManager; @@ -38,7 +38,7 @@ class ModuleOutput implements CollectorInterface */ public function __construct( CollectorInterface $subject, - Manager $moduleManager + ModuleManagerInterface $moduleManager ) { $this->subject = $subject; $this->moduleManager = $moduleManager; From 064a4ef1856bd1455875919e29308235d22089ec Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Tue, 4 Jun 2019 08:10:14 -0400 Subject: [PATCH 362/464] Return error when invalid currentPage is provided Adds missing validation for the minimum page value Fixes #727 --- .../Model/Resolver/Category/Products.php | 4 +++ .../Model/Resolver/Products.php | 4 +++ .../GraphQl/Catalog/ProductSearchTest.php | 31 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php index 7a41f8fc94e74..1d84fd258f96c 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php @@ -66,6 +66,10 @@ public function resolve( ] ]; $searchCriteria = $this->searchCriteriaBuilder->build($field->getName(), $args); + if ($args['currentPage'] < 1) { + throw new GraphQlInputException(__('currentPage value must be greater than 0.')); + } + $searchCriteria->setCurrentPage($args['currentPage']); $searchCriteria->setPageSize($args['pageSize']); $searchResult = $this->filterQuery->getResult($searchCriteria, $info); diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php index 24c5e664831e4..80607351b9c4c 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php @@ -71,6 +71,10 @@ public function resolve( array $args = null ) { $searchCriteria = $this->searchCriteriaBuilder->build($field->getName(), $args); + if ($args['currentPage'] < 1) { + throw new GraphQlInputException(__('currentPage value must be greater than 0.')); + } + $searchCriteria->setCurrentPage($args['currentPage']); $searchCriteria->setPageSize($args['pageSize']); if (!isset($args['search']) && !isset($args['filter'])) { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php index 99de6088b19a7..d113363875c96 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php @@ -1131,6 +1131,37 @@ public function testFilterProductsThatAreOutOfStockWithConfigSettings() $this->assertEquals(1, $response['products']['total_count']); } + /** + * Verify that invalid page numbers return an error + * + * @magentoApiDataFixture Magento/Catalog/_files/products_with_layered_navigation_attribute.php + * @expectedException \Exception + * @expectedExceptionMessage currentPage value must be greater than 0 + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testInvalidPageNumbers() + { + $query = <<<QUERY +{ + products ( + filter: { + sku: { + like:"simple%" + } + } + pageSize: 4 + currentPage: 0 + ) { + items { + sku + } + } +} +QUERY; + + $this->graphQlQuery($query); + } + /** * Asserts the different fields of items returned after search query is executed * From d85b3c289235e8d4565fae75c373d378a370945f Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Tue, 4 Jun 2019 09:46:19 -0500 Subject: [PATCH 363/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php index 3bd72da1382a3..195ba5cd1f38d 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php @@ -63,6 +63,8 @@ protected function addContentTypeByNodeName(Layout\Element $node) } /** + * Read children elements structure and fill scheduled structure + * * @param Layout\Reader\Context $readerContext * @param Layout\Element $headElement * @return $this|Layout\ReaderInterface From 5332cc6f769b9a61b4db54ce68be11dacb431e67 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 4 Jun 2019 09:55:44 -0500 Subject: [PATCH 364/464] MC-16607: Fix Unrelated Static Test Failures - refactor to fix static --- .../Setup/Model/UninstallDependencyCheck.php | 78 +++++++++++-------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php index 8894b2c399d63..f3deb405ab6c0 100644 --- a/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php +++ b/setup/src/Magento/Setup/Model/UninstallDependencyCheck.php @@ -8,6 +8,7 @@ use Magento\Framework\Composer\ComposerInformation; use Magento\Framework\Composer\DependencyChecker; +use Magento\Framework\Exception\RuntimeException; use Magento\Theme\Model\Theme\ThemeDependencyChecker; /** @@ -64,51 +65,62 @@ public function __construct( * * @param array $packages * @return array - * @throws \RuntimeException */ public function runUninstallReadinessCheck(array $packages) { try { - $packagesAndTypes = $this->composerInfo->getRootRequiredPackageTypesByName(); - $dependencies = $this->packageDependencyChecker->checkDependencies($packages, true); - $messages = []; - $themes = []; - - foreach ($packages as $package) { - if (!isset($packagesAndTypes[$package])) { - throw new \RuntimeException('Package ' . $package . ' not found in the system.'); - } + return $this->checkForMissingDependencies($packages); + } catch (\RuntimeException $e) { + $message = str_replace(PHP_EOL, '<br/>', $this->escaper->escapeHtml($e->getMessage())); + return ['success' => false, 'error' => $message]; + } + } - switch ($packagesAndTypes[$package]) { - case ComposerInformation::METAPACKAGE_PACKAGE_TYPE: - unset($dependencies[$package]); - break; - case ComposerInformation::THEME_PACKAGE_TYPE: - $themes[] = $package; - break; - } + /** + * Check for missing dependencies + * + * @param array $packages + * @return array + * @throws \RuntimeException + */ + private function checkForMissingDependencies(array $packages) + { + $packagesAndTypes = $this->composerInfo->getRootRequiredPackageTypesByName(); + $dependencies = $this->packageDependencyChecker->checkDependencies($packages, true); + $messages = []; + $themes = []; - if (!empty($dependencies[$package])) { - $messages[] = $package . " has the following dependent package(s): " - . implode(', ', $dependencies[$package]); - } + foreach ($packages as $package) { + if (!isset($packagesAndTypes[$package])) { + throw new \RuntimeException('Package ' . $package . ' not found in the system.'); } - if (!empty($themes)) { - $messages = array_merge( - $messages, - $this->themeDependencyChecker->checkChildThemeByPackagesName($themes) - ); + switch ($packagesAndTypes[$package]) { + case ComposerInformation::METAPACKAGE_PACKAGE_TYPE: + unset($dependencies[$package]); + break; + case ComposerInformation::THEME_PACKAGE_TYPE: + $themes[] = $package; + break; } - if (!empty($messages)) { - throw new \RuntimeException(implode(PHP_EOL, $messages)); + if (!empty($dependencies[$package])) { + $messages[] = $package . " has the following dependent package(s): " + . implode(', ', $dependencies[$package]); } + } - return ['success' => true]; - } catch (\Exception $e) { - $message = str_replace(PHP_EOL, '<br/>', $this->escaper->escapeHtml($e->getMessage())); - return ['success' => false, 'error' => $message]; + if (!empty($themes)) { + $messages = array_merge( + $messages, + $this->themeDependencyChecker->checkChildThemeByPackagesName($themes) + ); + } + + if (!empty($messages)) { + throw new \RuntimeException(implode(PHP_EOL, $messages)); } + + return ['success' => true]; } } From 5997307445298146380df65fa312dc48353abcd2 Mon Sep 17 00:00:00 2001 From: Serhii Dzhepa <sdzhepa@adobe.com> Date: Tue, 4 Jun 2019 09:57:22 -0500 Subject: [PATCH 365/464] fixed typos --- app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index c092f585c5203..847def6e8922c 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -877,7 +877,7 @@ private function generateBodySchema($parameterName, $parameterInfo, $description $bodySchema['type'] = 'object'; /* - * Make shure we have a proper XML wrapper for request parameters for the XML fromat. + * Make sure we have a proper XML wrapper for request parameters for the XML format. */ if (!isset($bodySchema['xml']) || !is_array($bodySchema['xml'])) { $bodySchema['xml'] = []; From 911d3a5f0de13a25c2c636f39b6c0a3cebc2e63f Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan <sunnikri@adobe.com> Date: Tue, 4 Jun 2019 10:10:48 -0500 Subject: [PATCH 366/464] MQE-1583: Stabilize tests with XSD schema fixes --- .../Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 4a4d955131300..6de03e225ae08 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -17,7 +17,6 @@ <testCaseId value="MC-6441"/> <useCaseId value="MAGETWO-91523"/> <group value="customer"/> - <group value="banana"/> </annotations> <before> <createData entity="ApiCategory" stepKey="createCategory"/> From 1d14cb8abf640a158f1b919a99ddb3cc9a1b7124 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov <ikolesov@magento.com> Date: Tue, 4 Jun 2019 10:14:15 -0500 Subject: [PATCH 367/464] MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules - Reverting removal of css class suffix --- app/code/Magento/Tax/view/frontend/templates/order/tax.phtml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml index 5e6f4e5277a30..6115ed5ee9311 100644 --- a/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/order/tax.phtml @@ -5,11 +5,14 @@ */ // phpcs:disable Magento2.Templates.ThisInTemplate +// phpcs:disable Squiz.PHP.GlobalKeyword.NotAllowed ?> <?php $_order = $block->getOrder(); $_source = $block->getSource(); $_fullInfo = $this->helper(\Magento\Tax\Helper\Data::class)->getCalculatedTaxes($_source); + global $taxIter; + $taxIter++; ?> <?php if ($_fullInfo && $block->displayFullSummary()) : ?> @@ -20,7 +23,7 @@ $baseAmount = $info['base_tax_amount']; $title = $info['title']; ?> - <tr class="totals tax details <?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> + <tr class="totals tax details details-<?= (int) $taxIter ?><?= ($block->getIsPlaneMode()) ? ' plane' : '' ?>"> <td <?= /* @noEscape */ $block->getLabelProperties() ?>> <?= $block->escapeHtml($title) ?> <?php if ($percent !== null) : ?> From a63c06a1e3d727367501f7b1dda38cb5c7d50148 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Tue, 4 Jun 2019 10:43:48 -0500 Subject: [PATCH 368/464] MC-16871: Test for possible bugs - Add wait to functional test; --- .../Magento/Customer/Test/Block/Account/AuthenticationPopup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php index 1ef9267e73785..36368a943d35e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php @@ -73,5 +73,6 @@ public function loginCustomer(Customer $customer) $this->fill($customer); $this->_rootElement->find($this->login)->click(); $this->waitForElementNotVisible($this->loadingMask); + sleep(10); } } From 762bbca8f18f0c7ddc3c63934d92dde5d26ded3d Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Tue, 4 Jun 2019 10:56:52 -0500 Subject: [PATCH 369/464] MC-12599: Checkout can properly process flow if list of shipping carriers are changed during place order Fixed: MC-4461 --- .../Checkout/Test/Mftf/Data/ConfigData.xml | 84 +++++++++++++++++++ ...sNotAffectedStartedCheckoutProcessTest.xml | 8 +- ...BundleDynamicProductToShoppingCartTest.xml | 5 +- ...pingCartWithDisableMiniCartSidebarTest.xml | 5 +- ...dConfigurableProductToShoppingCartTest.xml | 10 +-- ...dDownloadableProductToShoppingCartTest.xml | 2 +- ...ontAddGroupedProductToShoppingCartTest.xml | 2 +- ...MultiSelectOptionToTheShoppingCartTest.xml | 2 +- ...ultiSelectOptionsToTheShoppingCartTest.xml | 5 +- ...isplayWithDefaultDisplayLimitationTest.xml | 2 +- ...edToTheCartThanDefaultDisplayLimitTest.xml | 2 +- ...rtItemDisplayWithDefaultLimitationTest.xml | 2 +- 12 files changed, 101 insertions(+), 28 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml new file mode 100644 index 0000000000000..12974617d55ae --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <!-- Free shipping --> + <entity name="EnableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToSpecificCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToAfghanistanConfigData"> + <data key="path">carriers/freeshipping/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFreeShippingToAllAllowedCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> + + <!-- Flat Rate shipping --> + <entity name="EnableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToSpecificCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToAfghanistanConfigData"> + <data key="path">carriers/flatrate/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFlatRateToAllAllowedCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> +</entities> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml index ff9b3b1be9cbf..31a9d011a91c7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml @@ -23,15 +23,15 @@ <createData entity="SimpleProduct2" stepKey="createProduct"/> <!-- Enable free shipping method --> - <createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/> + <magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/> <!-- Disable flat rate method --> - <createData entity="DisableFlatRateShippingMethodConfig" stepKey="disableFlatRate"/> + <magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/> </before> <after> <!-- Roll back configuration --> - <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> - <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> + <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> <!-- Delete simple product --> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml index cb34e1b3810b8..4d9b90f5713c2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml @@ -15,13 +15,10 @@ <testCaseId value="MC-14715"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml index b9b88f0c6dfbd..3dae3b3ae58d5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml @@ -15,14 +15,11 @@ <testCaseId value="MC-14719"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> <magentoCLI stepKey="disableShoppingCartSidebar" command="config:set checkout/sidebar/display 0"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple products--> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml index 90dc47ca9c215..d1196d9abec46 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml @@ -15,12 +15,10 @@ <testCaseId value="MC-14716"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!-- Create Default Category --> <createData entity="_defaultCategory" stepKey="createCategory"/> @@ -112,9 +110,9 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> - <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> - <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml index 7a4655bb19ce3..982c5fb339bf2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> <createData entity="downloadableLink1" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createDownloadableProduct"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml index f24498a6bf524..604c3a07e01ae 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create Grouped product with three simple product --> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"> <field key="price">100.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml index 08117dab13253..d69f14ba12c7d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml index 7137804f12898..a6b7fd80e1d68 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml @@ -15,13 +15,10 @@ <testCaseId value="MC-14728"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml index 92c612b75f07a..1f39cc67218a2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml index fec5bb9fadb6e..f77fa96c5d017 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml index bca14c8379ca3..c05469b282426 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> From fe4c8a40d8ce3675cff87c1e4952fca4ed86c56c Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 4 Jun 2019 11:49:18 -0500 Subject: [PATCH 370/464] MC-16607: Fix Unrelated Static Test Failures - refactor to fix integration --- .../Magento/Reports/Block/Adminhtml/Grid.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid.php index 676fb455fa5fb..570805a664f5b 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid.php @@ -20,6 +20,11 @@ class Grid extends \Magento\Backend\Block\Widget\Grid */ private $urlDecoder; + /** + * @var \Zend\Stdlib\Parameters + */ + private $parameters; + /** * Should Store Switcher block be visible * @@ -81,16 +86,21 @@ class Grid extends \Magento\Backend\Block\Widget\Grid * @param \Magento\Backend\Helper\Data $backendHelper * @param array $data * @param \Magento\Framework\Url\DecoderInterface|null $urlDecoder + * @param \Zend\Stdlib\Parameters $parameters */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, array $data = [], - \Magento\Framework\Url\DecoderInterface $urlDecoder = null + \Magento\Framework\Url\DecoderInterface $urlDecoder = null, + \Zend\Stdlib\Parameters $parameters = null ) { $this->urlDecoder = $urlDecoder ?? \Magento\Framework\App\ObjectManager::getInstance()->get( \Magento\Framework\Url\DecoderInterface::class ); + + $this->parameters = $parameters ?? new \Zend\Stdlib\Parameters(); + parent::__construct($context, $backendHelper, $data); } @@ -112,10 +122,9 @@ protected function _prepareCollection() // this is a replacement for base64_decode() $filter = $this->urlDecoder->decode($filter); - /** @var $request \Magento\Framework\HTTP\PhpEnvironment\Request */ - $request = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\HTTP\PhpEnvironment\Request::class); - $data = $request->setRequestUri(urldecode($filter))->getQuery()->toArray(); + // this is a replacement for parse_str() + $this->parameters->fromString(urldecode($filter)); + $data = $this->parameters->toArray(); if (!isset($data['report_from'])) { // getting all reports from 2001 year From 31ea0674bdd0b08c103ee4c9e50f7d322afb6426 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Tue, 4 Jun 2019 12:11:36 -0500 Subject: [PATCH 371/464] MC-16871: Test for possible bugs - Disable critical css in config; --- app/code/Magento/Theme/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index 39e7d32a80ac3..3e26204d7788c 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -70,7 +70,7 @@ Disallow: /*SID= <move_inline_to_bottom>0</move_inline_to_bottom> </js> <css> - <use_css_critical_path>1</use_css_critical_path> + <use_css_critical_path>0</use_css_critical_path> </css> </dev> </default> From 848818f7926219e545639e3a38a27480f633aedc Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Tue, 4 Jun 2019 12:48:22 -0500 Subject: [PATCH 372/464] magento/async-import#102: Fixed static test failures --- app/code/Magento/AmqpStore/LICENSE.txt | 48 ++++++++++++++++++++++ app/code/Magento/AmqpStore/LICENSE_AFL.txt | 48 ++++++++++++++++++++++ app/code/Magento/AmqpStore/README.md | 3 ++ composer.lock | 4 +- 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/AmqpStore/LICENSE.txt create mode 100644 app/code/Magento/AmqpStore/LICENSE_AFL.txt create mode 100644 app/code/Magento/AmqpStore/README.md diff --git a/app/code/Magento/AmqpStore/LICENSE.txt b/app/code/Magento/AmqpStore/LICENSE.txt new file mode 100644 index 0000000000000..49525fd99da9c --- /dev/null +++ b/app/code/Magento/AmqpStore/LICENSE.txt @@ -0,0 +1,48 @@ + +Open Software License ("OSL") v. 3.0 + +This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Open Software License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/app/code/Magento/AmqpStore/LICENSE_AFL.txt b/app/code/Magento/AmqpStore/LICENSE_AFL.txt new file mode 100644 index 0000000000000..f39d641b18a19 --- /dev/null +++ b/app/code/Magento/AmqpStore/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/app/code/Magento/AmqpStore/README.md b/app/code/Magento/AmqpStore/README.md new file mode 100644 index 0000000000000..0f84c8ff3276e --- /dev/null +++ b/app/code/Magento/AmqpStore/README.md @@ -0,0 +1,3 @@ +# Amqp Store + +**AmqpStore** provides ability to specify store before publish messages with Amqp. diff --git a/composer.lock b/composer.lock index d17e9670a1850..5454994ca82db 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "16b51215b2f8bc7726cee946bb5e70a0", + "content-hash": "912e04a44c38c8918799bd01b828fba0", "packages": [ { "name": "braintree/braintree_php", @@ -2169,7 +2169,7 @@ }, { "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", From 045dbc159098e5f02914b5cafd837bda195029ae Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Tue, 4 Jun 2019 13:08:45 -0500 Subject: [PATCH 373/464] MC-12599: Checkout can properly process flow if list of shipping carriers are changed during place order --- .../StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml | 2 +- ...refrontDeleteDownloadableProductFromMiniShoppingCartTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml index 05bbc49dd3484..e8843ed841b49 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml @@ -20,7 +20,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml index 461139b6d4b3f..be74a080317ea 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml @@ -20,7 +20,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> <createData entity="downloadableLink1" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createDownloadableProduct"/> From 5a842a2576938e0af7ab3831447b330ee6cd7e24 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Tue, 4 Jun 2019 13:14:26 -0500 Subject: [PATCH 374/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php index 1a62fceb21358..f5326ae15cdb1 100644 --- a/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/AsyncCssPlugin.php @@ -58,7 +58,9 @@ function ($matches) use (&$cssMatches) { } $media = $media ?? 'all'; $loadCssAsync = sprintf( - '<link rel="preload" as="style" media="%s" href="%s">', + '<link rel="preload" as="style" media="%s" . + onload="this.onload=null;this.rel=\'stylesheet\'"' . + 'href="%s">', $media, $href ); From a9607445dcc606666c06c6e4022a10530c8bef58 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Tue, 4 Jun 2019 13:48:03 -0500 Subject: [PATCH 375/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- app/code/Magento/Theme/Block/Html/Header/CriticalCss.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 21e0b1b16ba72..104b5023e48c6 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -10,7 +10,6 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Element\Block\ArgumentInterface; -use Magento\Framework\View\Element\Template; use Magento\Framework\View\Asset\Repository; use Magento\Framework\View\Asset\File\NotFoundException; From b5dbea6601bcf25560511a59bef36ada5153a726 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Tue, 4 Jun 2019 13:54:24 -0500 Subject: [PATCH 376/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- .../Test/AdminMoveProductBetweenCategoriesTest.xml | 13 +++++++++++++ .../AdminSwitchIndexerToActionModeActionGroup.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml index f270ec705ff37..8a3ddf379b549 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -72,6 +72,19 @@ <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> </before> <after> + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> + <waitForPageLoad stepKey="waitForManagementPage"/> + + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> + <argument name="indexerValue" value="catalog_category_product"/> + <argument name="action" value="Update on Save"/> + </actionGroup> + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> + <argument name="indexerValue" value="catalog_product_category"/> + <argument name="action" value="Update on Save"/> + </actionGroup> + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml index 4866d337b54ef..7b77af08614cf 100644 --- a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml @@ -17,6 +17,6 @@ <selectOption userInput="{{action}}" selector="{{AdminIndexManagementSection.massActionSelect}}" stepKey="selectAction"/> <click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> <waitForPageLoad stepKey="waitForSubmit"/> - <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="1 indexer(s) are in "Update by Schedule" mode." stepKey="seeMessage"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="1 indexer(s) are in "{{action}}" mode." stepKey="seeMessage"/> </actionGroup> </actionGroups> \ No newline at end of file From 77426000246fecf726557baf54d09412b4e9c82e Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Tue, 4 Jun 2019 13:58:11 -0500 Subject: [PATCH 377/464] MC-16871: Test for possible bugs --- app/code/Magento/Theme/Block/Html/Header/CriticalCss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php index 104b5023e48c6..34c7c301ba85f 100644 --- a/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php +++ b/app/code/Magento/Theme/Block/Html/Header/CriticalCss.php @@ -52,7 +52,7 @@ public function getCriticalCssData() $content = $asset->getContent(); } catch (LocalizedException | NotFoundException $e) { $content = ''; - }; + } return $content; } From 175ff68f819c926235e46ce2190ec3a95f675bf6 Mon Sep 17 00:00:00 2001 From: Anthoula Wojczak <awojczak@adobe.com> Date: Tue, 4 Jun 2019 14:13:01 -0500 Subject: [PATCH 378/464] MC-16607: Fix Unrelated Static Test Failures - revert fix and use phpcs:disable --- app/code/Magento/Email/Model/Template/Filter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index e5e3a9a4f2a61..aa018d6fd44d6 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -956,7 +956,8 @@ public function getCssFilesContent(array $files) } } catch (ContentProcessorException $exception) { $css = $exception->getMessage(); - } catch (\Exception $exception) { + // phpcs:disable Magento2.Exceptions.ThrowCatch + } catch (\Magento\Framework\View\Asset\File\NotFoundException $exception) { $css = ''; } From 3c1de98705d119c9b41826fe7bf2e87ff23ddb47 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@adobe.com> Date: Tue, 4 Jun 2019 14:55:10 -0500 Subject: [PATCH 379/464] magento/async-import#102: Move dependency from require section --- app/code/Magento/AmqpStore/composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AmqpStore/composer.json b/app/code/Magento/AmqpStore/composer.json index b3c6b79e2f6c2..bd11527bbb36e 100644 --- a/app/code/Magento/AmqpStore/composer.json +++ b/app/code/Magento/AmqpStore/composer.json @@ -7,12 +7,12 @@ "require": { "magento/framework": "*", "magento/framework-amqp": "*", - "magento/framework-message-queue": "*", "magento/module-store": "*", "php": "~7.1.3||~7.2.0" }, "suggest": { - "magento/module-asynchronous-operations": "*" + "magento/module-asynchronous-operations": "*", + "magento/framework-message-queue": "*" }, "type": "magento2-module", "license": [ From b8801a063d3aefbe01d253013a9bbf5171215602 Mon Sep 17 00:00:00 2001 From: Vladyslav Podorozhnyi <vpodorozh@gmail.com> Date: Tue, 4 Jun 2019 23:00:52 +0300 Subject: [PATCH 380/464] #682: [Test coverage] added test cases for missed parameters at 'setBillingAddressMutation' Fix static tests --- .../_files/set_multishipping_with_two_shipping_addresses.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php index c7ff96bc7e3d7..8c9641d6fdc2a 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php @@ -18,9 +18,11 @@ $quote = $quoteFactory->create(); $quoteResource->load($quote, 'test_quote', 'reserved_order_id'); +// phpcs:disable require __DIR__ . '/../../../Multishipping/Fixtures/shipping_address_list.php'; +// phpcs:enable /** @var CartRepositoryInterface $quoteRepository */ $quoteRepository = $objectManager->get(CartRepositoryInterface::class); $quote->collectTotals(); -$quoteRepository->save($quote); \ No newline at end of file +$quoteRepository->save($quote); From 06381f10c9647dec62e6d9ef6fe44c2fcb964776 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Tue, 4 Jun 2019 15:34:31 -0500 Subject: [PATCH 381/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- .../Ui/view/base/web/js/form/element/date.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index e1ad21231f725..7c50c0e273810 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -76,7 +76,16 @@ define([ * * @type {String} */ - shiftedValue: '' + shiftedValue: '', + + /** + * Stored Date format initially received from server + * for offline date formatting + * + * @private + * @type {String} + */ + storedDateFormat: '' }, /** @@ -125,9 +134,12 @@ define([ shiftedValue = moment(value, dateFormat); } - if (!shiftedValue.isValid()) { - shiftedValue = moment(value, this.pickerDateTimeFormat); + if (this.storedDateFormat) { + shiftedValue = moment(value, this.storedDateFormat); + } else { + this.storedDateFormat = dateFormat; } + shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { shiftedValue = ''; From 14e5489bc2cc788558f56236971e223d8b199b01 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Tue, 4 Jun 2019 15:39:02 -0500 Subject: [PATCH 382/464] MAGETWO-99894: Customer Import -> Created: 0, Updated: 0, Deleted: 0 --- .../Model/Import/CustomerComposite.php | 4 +++ .../Model/Import/CustomerCompositeTest.php | 25 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php index 2086f41d27fa6..0f4c5f82bfe1d 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php @@ -270,6 +270,10 @@ protected function _initAddressAttributes() protected function _importData() { $result = $this->_customerEntity->importData(); + $this->countItemsCreated += $this->_customerEntity->getCreatedItemsCount(); + $this->countItemsUpdated += $this->_customerEntity->getUpdatedItemsCount(); + $this->countItemsDeleted += $this->_customerEntity->getDeletedItemsCount(); + if ($this->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE) { return $result && $this->_addressEntity->setCustomerAttributes($this->_customerAttributes)->importData(); } diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php index ea2b47a9b806f..45efffbedb549 100644 --- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php @@ -130,14 +130,25 @@ protected function _assertCustomerData(array $expectedData) * @param array $dataBefore * @param array $dataAfter * @param array $errors + * @param int $updatedItemsCount + * @param int $createdItemsCount + * @param int $deletedItemsCount * * @magentoDataFixture Magento/Customer/_files/import_export/customers_for_address_import.php * @magentoAppIsolation enabled * * @dataProvider importDataDataProvider */ - public function testImportData($behavior, $sourceFile, array $dataBefore, array $dataAfter, array $errors = []) - { + public function testImportData( + $behavior, + $sourceFile, + array $dataBefore, + array $dataAfter, + array $errors = [], + $updatedItemsCount, + $createdItemsCount, + $deletedItemsCount + ) { \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND); // set entity adapter parameters @@ -173,6 +184,9 @@ public function testImportData($behavior, $sourceFile, array $dataBefore, array // import data $this->_entityAdapter->importData(); + $this->assertSame($updatedItemsCount, $this->_entityAdapter->getUpdatedItemsCount()); + $this->assertSame($createdItemsCount, $this->_entityAdapter->getCreatedItemsCount()); + $this->assertSame($deletedItemsCount, $this->_entityAdapter->getDeletedItemsCount()); // assert data after import $this->_assertCustomerData($dataAfter); @@ -192,6 +206,10 @@ public function importDataDataProvider() '$sourceFile' => $filesDirectory . self::DELETE_FILE_NAME, '$dataBefore' => $this->_beforeImport, '$dataAfter' => [], + '$errors' => [], + '$updatedItemsCount' => 0, + '$createdItemsCount' => 0, + '$deletedItemsCount' => 1, ], ]; @@ -201,6 +219,9 @@ public function importDataDataProvider() '$dataBefore' => $this->_beforeImport, '$dataAfter' => $this->_afterImport, '$errors' => [], + '$updatedItemsCount' => 1, + '$createdItemsCount' => 3, + '$deletedItemsCount' => 0, ]; return $sourceData; From 168b3636a519955f866fd78a2e9471575569fbab Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 4 Jun 2019 15:45:01 -0500 Subject: [PATCH 383/464] MC-17041: Add fixture for second store with different currency --- .../second_store_with_second_currency.php | 42 +++++++++++++++++++ ...nd_store_with_second_currency_rollback.php | 26 ++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency.php create mode 100644 dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency.php new file mode 100644 index 0000000000000..85ac9abaf2cf9 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require_once 'second_store.php'; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$store = $objectManager->create(\Magento\Store\Model\Store::class); +$storeId = $store->load('fixture_second_store', 'code')->getId(); +/** @var \Magento\Config\Model\ResourceModel\Config $configResource */ +$configResource = $objectManager->get(\Magento\Config\Model\ResourceModel\Config::class); +$configResource->saveConfig( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT, + 'EUR', + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $storeId +); +$configResource->saveConfig( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW, + 'EUR', + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $storeId +); + +/** + * Configuration cache clean is required to reload currency setting + */ +/** @var Magento\Config\App\Config\Type\System $config */ +$config = $objectManager->get(\Magento\Config\App\Config\Type\System::class); +$config->clean(); + +/** @var \Magento\Directory\Model\ResourceModel\Currency $rate */ +$rate = $objectManager->create(\Magento\Directory\Model\ResourceModel\Currency::class); +$rate->saveRates( + [ + 'USD' => ['EUR' => 2], + 'EUR' => ['USD' => 0.5] + ] +); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency_rollback.php new file mode 100644 index 0000000000000..a87fdf092e737 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_with_second_currency_rollback.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$store = $objectManager->create(\Magento\Store\Model\Store::class); +$storeId = $store->load('fixture_second_store', 'code')->getId(); + +if ($storeId) { + $configResource = $objectManager->get(\Magento\Config\Model\ResourceModel\Config::class); + $configResource->deleteConfig( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $storeId + ); + $configResource->deleteConfig( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW, + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $storeId + ); +} + +require_once 'second_store_rollback.php'; From 26730052befb285112dcc9e685ad3ed73e7cb4d7 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Tue, 4 Jun 2019 16:13:46 -0500 Subject: [PATCH 384/464] MAGETWO-99894: Customer Import -> Created: 0, Updated: 0, Deleted: 0 --- .../Model/Import/CustomerCompositeTest.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php index 45efffbedb549..321e56cd16906 100644 --- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/CustomerCompositeTest.php @@ -8,6 +8,9 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; +/** + * Test for CustomerComposite import class + */ class CustomerCompositeTest extends \PHPUnit\Framework\TestCase { /**#@+ @@ -129,10 +132,10 @@ protected function _assertCustomerData(array $expectedData) * @param string $sourceFile * @param array $dataBefore * @param array $dataAfter - * @param array $errors * @param int $updatedItemsCount * @param int $createdItemsCount * @param int $deletedItemsCount + * @param array $errors * * @magentoDataFixture Magento/Customer/_files/import_export/customers_for_address_import.php * @magentoAppIsolation enabled @@ -144,10 +147,10 @@ public function testImportData( $sourceFile, array $dataBefore, array $dataAfter, - array $errors = [], $updatedItemsCount, $createdItemsCount, - $deletedItemsCount + $deletedItemsCount, + array $errors = [] ) { \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND); @@ -206,10 +209,10 @@ public function importDataDataProvider() '$sourceFile' => $filesDirectory . self::DELETE_FILE_NAME, '$dataBefore' => $this->_beforeImport, '$dataAfter' => [], - '$errors' => [], '$updatedItemsCount' => 0, '$createdItemsCount' => 0, '$deletedItemsCount' => 1, + '$errors' => [], ], ]; @@ -218,10 +221,10 @@ public function importDataDataProvider() '$sourceFile' => $filesDirectory . self::UPDATE_FILE_NAME, '$dataBefore' => $this->_beforeImport, '$dataAfter' => $this->_afterImport, - '$errors' => [], '$updatedItemsCount' => 1, '$createdItemsCount' => 3, '$deletedItemsCount' => 0, + '$errors' => [], ]; return $sourceData; From a142ef2f71eaa78e18829e9b6990bd523254e158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?= <bartlomiejszubert@gmail.com> Date: Tue, 4 Jun 2019 23:40:18 +0200 Subject: [PATCH 385/464] Fix #19872 - replace hardcoded pub path with getRelativePath call --- .../Catalog/Model/Category/FileInfo.php | 25 +++++++- .../Test/Unit/Model/Category/FileInfoTest.php | 63 +++++++++++-------- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php index a474eb764d2c0..cd3592ef40a0f 100644 --- a/app/code/Magento/Catalog/Model/Category/FileInfo.php +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -43,6 +43,11 @@ class FileInfo */ private $baseDirectory; + /** + * @var ReadInterface + */ + private $pubDirectory; + /** * @param Filesystem $filesystem * @param Mime $mime @@ -82,6 +87,20 @@ private function getBaseDirectory() return $this->baseDirectory; } + /** + * Get Pub Directory read instance + * + * @return ReadInterface + */ + private function getPubDirectory() + { + if (!isset($this->pubDirectory)) { + $this->pubDirectory = $this->filesystem->getDirectoryRead(DirectoryList::PUB); + } + + return $this->pubDirectory; + } + /** * Retrieve MIME type of requested file * @@ -174,11 +193,13 @@ public function isBeginsWithMediaDirectoryPath($fileName) */ private function getMediaDirectoryPathRelativeToBaseDirectoryPath(string $filePath = '') { - $baseDirectoryPath = $this->getBaseDirectory()->getAbsolutePath(); + $baseDirectory = $this->getBaseDirectory(); + $baseDirectoryPath = $baseDirectory->getAbsolutePath(); $mediaDirectoryPath = $this->getMediaDirectory()->getAbsolutePath(); + $pubDirectoryPath = $this->getPubDirectory()->getAbsolutePath(); $mediaDirectoryRelativeSubpath = substr($mediaDirectoryPath, strlen($baseDirectoryPath)); - $pubDirectory = 'pub' . DIRECTORY_SEPARATOR; + $pubDirectory = $baseDirectory->getRelativePath($pubDirectoryPath); if (strpos($mediaDirectoryRelativeSubpath, $pubDirectory) === 0 && strpos($filePath, $pubDirectory) !== 0) { $mediaDirectoryRelativeSubpath = substr($mediaDirectoryRelativeSubpath, strlen($pubDirectory)); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php index 77efca7f80e11..f9c77cc624e11 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -11,29 +11,36 @@ use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\WriteInterface; use Magento\Framework\Filesystem\Directory\ReadInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class FileInfoTest extends \PHPUnit\Framework\TestCase +class FileInfoTest extends TestCase { /** - * @var Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var Filesystem|MockObject */ private $filesystem; /** - * @var Mime|\PHPUnit_Framework_MockObject_MockObject + * @var Mime|MockObject */ private $mime; /** - * @var WriteInterface|\PHPUnit_Framework_MockObject_MockObject + * @var WriteInterface|MockObject */ private $mediaDirectory; /** - * @var ReadInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ReadInterface|MockObject */ private $baseDirectory; + /** + * @var ReadInterface|MockObject + */ + private $pubDirectory; + /** * @var FileInfo */ @@ -44,31 +51,42 @@ protected function setUp() $this->mediaDirectory = $this->getMockBuilder(WriteInterface::class) ->getMockForAbstractClass(); - $this->baseDirectory = $this->getMockBuilder(ReadInterface::class) + $this->baseDirectory = $baseDirectory = $this->getMockBuilder(ReadInterface::class) + ->getMockForAbstractClass(); + + $this->pubDirectory = $pubDirectory = $this->getMockBuilder(ReadInterface::class) ->getMockForAbstractClass(); $this->filesystem = $this->getMockBuilder(Filesystem::class) ->disableOriginalConstructor() ->getMock(); - $this->filesystem->expects($this->any()) - ->method('getDirectoryWrite') + + $this->filesystem->method('getDirectoryWrite') ->with(DirectoryList::MEDIA) ->willReturn($this->mediaDirectory); - $this->filesystem->expects($this->any()) - ->method('getDirectoryRead') - ->with(DirectoryList::ROOT) - ->willReturn($this->baseDirectory); + $this->filesystem->method('getDirectoryRead') + ->willReturnCallback(function ($arg) use ($baseDirectory, $pubDirectory) { + if ($arg === DirectoryList::PUB) { + return $pubDirectory; + } + return $baseDirectory; + }); $this->mime = $this->getMockBuilder(Mime::class) ->disableOriginalConstructor() ->getMock(); - $this->baseDirectory->expects($this->any()) - ->method('getAbsolutePath') - ->with(null) + $this->baseDirectory->method('getAbsolutePath') ->willReturn('/a/b/c/'); + $this->baseDirectory->method('getRelativePath') + ->with('/a/b/c/pub/') + ->willReturn('pub/'); + + $this->pubDirectory->method('getAbsolutePath') + ->willReturn('/a/b/c/pub/'); + $this->model = new FileInfo( $this->filesystem, $this->mime @@ -113,13 +131,11 @@ public function testGetStat() $expected = ['size' => 1]; - $this->mediaDirectory->expects($this->any()) - ->method('getAbsolutePath') + $this->mediaDirectory->method('getAbsolutePath') ->with(null) ->willReturn('/a/b/c/pub/media/'); - $this->mediaDirectory->expects($this->once()) - ->method('stat') + $this->mediaDirectory->method('stat') ->with($mediaPath . $fileName) ->willReturn($expected); @@ -137,12 +153,10 @@ public function testGetStat() */ public function testIsExist($fileName, $fileMediaPath) { - $this->mediaDirectory->expects($this->any()) - ->method('getAbsolutePath') + $this->mediaDirectory->method('getAbsolutePath') ->willReturn('/a/b/c/pub/media/'); - $this->mediaDirectory->expects($this->once()) - ->method('isExist') + $this->mediaDirectory->method('isExist') ->with($fileMediaPath) ->willReturn(true); @@ -165,8 +179,7 @@ public function isExistProvider() */ public function testIsBeginsWithMediaDirectoryPath($fileName, $expected) { - $this->mediaDirectory->expects($this->any()) - ->method('getAbsolutePath') + $this->mediaDirectory->method('getAbsolutePath') ->willReturn('/a/b/c/pub/media/'); $this->assertEquals($expected, $this->model->isBeginsWithMediaDirectoryPath($fileName)); From 036e2586f9087f95444cb679e82e7dbd601afc02 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Tue, 4 Jun 2019 16:42:42 -0500 Subject: [PATCH 386/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml index c292afe65cdf3..1552f0e9ded38 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-16053"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!-- Create customer --> From 50e187a33cfc036a85d1360208de85eda6edd67a Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Tue, 4 Jun 2019 16:48:26 -0500 Subject: [PATCH 387/464] MC-11146: Product Categories Indexer in Update on Schedule mode --- ...roductCategoryIndexerInUpdateOnScheduleModeTest.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml index 98ae29ae79d40..ec0d86ac066fd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml @@ -90,7 +90,7 @@ <dontSee userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProductA1"/> <!-- 4. Run cron to reindex --> - <wait time="30" stepKey="waitForChanges"/> + <wait time="60" stepKey="waitForChanges"/> <magentoCLI command="cron:run" stepKey="runCron"/> <!-- 5. Open category A on Storefront again --> @@ -117,7 +117,7 @@ <see userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductA1"/> <!-- 8. Run cron reindex (Ensure that at least one minute passed since last cron run) --> - <wait time="30" stepKey="waitOneMinute"/> + <wait time="60" stepKey="waitOneMinute"/> <magentoCLI command="cron:run" stepKey="runCron1"/> <!-- 9. Open category A on Storefront again --> @@ -170,7 +170,7 @@ <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC2InCategoryC2"/> <!-- 14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> - <wait time="30" stepKey="waitMinute"/> + <wait time="60" stepKey="waitMinute"/> <magentoCLI command="cron:run" stepKey="runCron2"/> <!-- 15. Open category B on Storefront --> @@ -227,7 +227,7 @@ <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryCPageProductC2"/> <!-- 17.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> - <wait time="30" stepKey="waitForOneMinute"/> + <wait time="60" stepKey="waitForOneMinute"/> <magentoCLI command="cron:run" stepKey="runCron3"/> <!-- 17.15. Open category B on Storefront --> @@ -286,7 +286,7 @@ <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCProductC2"/> <!-- 18.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> - <wait time="30" stepKey="waitExtraMinute"/> + <wait time="60" stepKey="waitExtraMinute"/> <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- 18.15. Open category B on Storefront --> From c282591dd3ea8ab84ef8733a5e30509a61baf641 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Tue, 4 Jun 2019 16:54:04 -0500 Subject: [PATCH 388/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml | 3 +++ .../Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml | 3 +++ .../Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml | 3 +++ .../Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index 03f3e93bb30ec..3674252f4d5c4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -16,6 +16,9 @@ <description value="Admin should be able to add image to WYSIWYG Editor on Product Page"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84375"/> + <skip> + <issueId value="MC-17232"/> + </skip> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml index 03edc69e6d625..5baf75d43c53f 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml @@ -16,6 +16,9 @@ <description value="Admin should be able to add image to WYSIWYG content of Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84376"/> + <skip> + <issueId value="MC-17232"/> + </skip> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml index 205850f888797..e63a6be51bcc0 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml @@ -16,6 +16,9 @@ <description value="Admin should be able to add image to WYSIWYG content of CMS Page"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-85825"/> + <skip> + <issueId value="MC-17232"/> + </skip> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml index f69f94dbd79e3..a343a20a6d57c 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml @@ -16,6 +16,9 @@ <description value="Admin should be able to add image to WYSIWYG content Newsletter"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84377"/> + <skip> + <issueId value="MC-17233"/> + </skip> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> From 0c843c88b0641877e96c3c686f83c5628df958e4 Mon Sep 17 00:00:00 2001 From: Matthew O'Loughlin <matthew.oloughlin@aligent.com.au> Date: Wed, 5 Jun 2019 10:18:35 +0930 Subject: [PATCH 389/464] GRAPHQL-673: Update tests with new error message and fix code style issues. --- .../Magento/GraphQl/Customer/IsEmailAvailableTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php index 3e0f97081da2d..183ebe046d22a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/IsEmailAvailableTest.php @@ -50,7 +50,7 @@ public function testEmailAvailable() /** * @expectedException \Exception - * @expectedExceptionMessage GraphQL response contains errors: Email should be specified + * @expectedExceptionMessage GraphQL response contains errors: Email must be specified */ public function testEmailAvailableEmptyValue() { @@ -62,12 +62,12 @@ public function testEmailAvailableEmptyValue() } } QUERY; - $response = $this->graphQlQuery($query); + $this->graphQlQuery($query); } /** * @expectedException \Exception - * @expectedExceptionMessage GraphQL response contains errors: Field "isEmailAvailable" argument "email" of type "String!" is required but not provided. + * @expectedExceptionMessage Field "isEmailAvailable" argument "email" of type "String!" is required */ public function testEmailAvailableMissingValue() { @@ -79,7 +79,7 @@ public function testEmailAvailableMissingValue() } } QUERY; - $response = $this->graphQlQuery($query); + $this->graphQlQuery($query); } /** @@ -96,6 +96,6 @@ public function testEmailAvailableInvalidValue() } } QUERY; - $response = $this->graphQlQuery($query); + $this->graphQlQuery($query); } } From 51e11c12bc8a9213d9e88af58a497b65116e3fcf Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 5 Jun 2019 12:49:54 +0300 Subject: [PATCH 390/464] magento/magento2#23138: Magento_Theme. Incorrect configuration file location --- app/code/Magento/Theme/etc/{ => adminhtml}/system.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/code/Magento/Theme/etc/{ => adminhtml}/system.xml (100%) diff --git a/app/code/Magento/Theme/etc/system.xml b/app/code/Magento/Theme/etc/adminhtml/system.xml similarity index 100% rename from app/code/Magento/Theme/etc/system.xml rename to app/code/Magento/Theme/etc/adminhtml/system.xml From f31a73c4556636461d6610a47b7540bd3375ac73 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 5 Jun 2019 09:16:24 -0500 Subject: [PATCH 391/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- .../Ui/view/base/web/js/form/element/date.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 7c50c0e273810..3d62f10d3bfe5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -130,16 +130,15 @@ define([ if (this.options.showsTime) { shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone); } else { - dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; + if (this.storedDateFormat) { + dateFormat = this.storedDateFormat; + } else { + dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; + this.storedDateFormat = dateFormat; + } shiftedValue = moment(value, dateFormat); } - if (this.storedDateFormat) { - shiftedValue = moment(value, this.storedDateFormat); - } else { - this.storedDateFormat = dateFormat; - } - shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { shiftedValue = ''; From 85ddf9a7c23d9b7f1c418dd847b6c496c1c59be0 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 5 Jun 2019 09:36:14 -0500 Subject: [PATCH 392/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- .../Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml index 3c05f72ff1597..e9ff40f98bb16 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml @@ -10,5 +10,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCategoryProductsSection"> <element name="sectionHeader" type="button" selector="div[data-index='assign_products']" timeout="30"/> + <element name="addProducts" type="button" selector="#catalog_category_add_product_tabs" timeout="30"/> </section> </sections> \ No newline at end of file From 92692dfd17ceb57fa7d8f365cd38c6d6cabbd846 Mon Sep 17 00:00:00 2001 From: Dave Macaulay <macaulay@adobe.com> Date: Wed, 5 Jun 2019 09:57:19 -0500 Subject: [PATCH 393/464] MC-16608: Eliminate @escapeNotVerified in Backend-related Modules - Resolve CR comments --- .../view/adminhtml/templates/system/messages.phtml | 4 ++-- .../templates/product/widget/viewed/item.phtml | 10 +++++----- .../widget/compared/column/compared_default_list.phtml | 6 +++--- .../widget/compared/content/compared_grid.phtml | 10 +++++----- .../widget/compared/content/compared_list.phtml | 10 +++++----- .../widget/viewed/column/viewed_default_list.phtml | 6 +++--- .../templates/widget/viewed/content/viewed_grid.phtml | 10 +++++----- .../templates/widget/viewed/content/viewed_list.phtml | 10 +++++----- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml index e77a5ff1cd057..22512b9055f95 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml @@ -27,7 +27,7 @@ <?php if ($block->getCriticalCount()) : ?> <div class="message message-warning error"> <a class="message-link" href="#" title="<?= $block->escapeHtml(__('Critical System Messages')) ?>"> - <?= $block->escapeHtml($block->getCriticalCount()) ?> + <?= (int) $block->getCriticalCount() ?> </a> </div> <?php endif; ?> @@ -35,7 +35,7 @@ <?php if ($block->getMajorCount()) : ?> <div class="message message-warning warning"> <a class="message-link" href="#" title="<?= $block->escapeHtml(__('Major System Messages')) ?>"> - <?= $block->escapeHtml($block->getMajorCount()) ?> + <?= (int) $block->getMajorCount() ?> </a> </div> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml index 69851bd80b8b0..b76d79a26c040 100644 --- a/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/product/widget/viewed/item.phtml @@ -33,14 +33,14 @@ $rating = 'short'; <?= $block->escapeHtml($item->getName()) ?></a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - )) ?> + ) ?> <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($item, $rating) ?> @@ -58,7 +58,7 @@ $rating = 'short'; $postData = $postDataHelper->getPostData($block->getAddToCartUrl($item), ['product' => $item->getEntityId()]) ?> <button class="action tocart" - data-post='<?= $block->escapeHtmlAttr($postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> @@ -74,7 +74,7 @@ $rating = 'short'; <div class="secondary-addto-links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> - <a href="#" data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($item)) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> + <a href="#" data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> @@ -83,7 +83,7 @@ $rating = 'short'; $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($item)) ?>' + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($item) ?>' data-role="add-to-links" title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index 5c96c16a61bd2..0d8ea99e4e767 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -53,14 +53,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-widget-compared-' . $suffix ] - )) ?> + ) ?> <div class="product-item-actions"> <?php if ($_product->isSaleable()) : ?> <div class="actions-primary"> @@ -76,7 +76,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtmlAttr($postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index cf97066b7539c..a321b78e6db00 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -53,14 +53,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - )) ?> + ) ?> <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -81,7 +81,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtmlAttr(postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> @@ -100,7 +100,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" - data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' data-action="add-to-wishlist" class="action towishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> @@ -110,7 +110,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index a9e79d037a498..87c647526c9cf 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -54,14 +54,14 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - )) ?> + ) ?> <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -82,7 +82,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtmlAttr($postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> @@ -101,7 +101,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <div class="actions-secondary" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" - data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' data-action="add-to-wishlist" class="action towishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> @@ -111,7 +111,7 @@ if ($exist = $block->getRecentlyComparedProducts()) { <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index f3e83251fc816..0d285a827a2f3 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -57,14 +57,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name')) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-widget-viewed-' . $suffix ] - )) ?> + ) ?> <div class="product-item-actions"> <?php if ($_product->isSaleable()) : ?> <div class="actions-primary"> @@ -79,7 +79,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); ?> - <button type="button" class="action tocart primary" data-post='<?= $block->escapeHtmlAttr($postData) ?>'> + <button type="button" class="action tocart primary" data-post='<?= /* @noEscape */ $postData ?>'> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index 3db5ed89ac32e..c2b727e7e1c25 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -56,14 +56,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - )) ?> + ) ?> <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -84,7 +84,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtmlAttr($postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> @@ -103,7 +103,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> @@ -111,7 +111,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index f9c7fcc7290d4..36c1f127929d5 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -58,14 +58,14 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?= $block->escapeHtml($block->getProductPriceHtml( + <?= /* @noEscape */ $block->getProductPriceHtml( $_item, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, [ 'price_id_suffix' => '-' . $type ] - )) ?> + ) ?> <?php if ($rating) : ?> <?= $block->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> @@ -86,7 +86,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); ?> <button class="action tocart primary" - data-post='<?= $block->escapeHtmlAttr($postData) ?>' + data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> @@ -106,7 +106,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist) : ?> <a href="#" class="action towishlist" data-action="add-to-wishlist" - data-post='<?= $block->escapeHtmlAttr($block->getAddToWishlistParams($_item)) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> @@ -114,7 +114,7 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr <?php if ($block->getAddToCompareUrl() && $showCompare) : ?> <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> <a href="#" class="action tocompare" - data-post='<?= $block->escapeHtmlAttr($compareHelper->getPostDataParams($_item)) ?>' + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> From 6cc4a892ef3edda1cfa37e7aa079fe7dfabb2e6b Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 5 Jun 2019 10:18:59 -0500 Subject: [PATCH 394/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- .../Test/Mftf/Page/AdminCategoryPage.xml | 1 + .../AdminMoveProductBetweenCategoriesTest.xml | 28 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml index f7d8abf8b2fea..715a2a6a2b784 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml @@ -19,5 +19,6 @@ <section name="AdminCategoryModalSection"/> <section name="AdminCategoryMessagesSection"/> <section name="AdminCategoryContentSection"/> + <section name="AdminCategoryAddProductsModalSection"/> </page> </pages> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml index 8a3ddf379b549..dd026388ae0e3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -36,28 +36,28 @@ <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> </actionGroup> - <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> <!-- Create subcategory <Sub1> of the anchored category --> <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> - - <!-- Assign <product1> to the <Sub1> --> - <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> - <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> - <click selector="{{AdminCategoryProductsSection.addProducts}}" stepKey="clickButtonAddProducts"/> - <waitForPageLoad stepKey="waitForPanelAddProducts"/> - <conditionalClick selector="{{AdminCategoryAddProductsModalSection.clearAll}}" dependentSelector="{{AdminCategoryAddProductsModalSection.clearAll}}" visible="true" stepKey="clearFilters"/> - <fillField selector="{{AdminCategoryAddProductsModalSection.searchKeyword}}" userInput="$$simpleProduct.name$$" stepKey="fillSearch"/> - <click selector="{{AdminCategoryAddProductsModalSection.searchFullText}}" stepKey="clickSearch"/> - <click selector="{{AdminCategoryAddProductsModalSection.gridActionToggle}}" stepKey="clickActionToggle"/> - <click selector="{{AdminCategoryAddProductsModalSection.gridSelectAll}}" stepKey="clickSelectAll"/> - <click selector="{{AdminCategoryAddProductsModalSection.saveClose}}" stepKey="saveAndClose"/> - <waitForLoadingMaskToDisappear stepKey="waitForSavingSearch"/> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> + <!-- Assign <product1> to the <Sub1> --> + <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> + + <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/> + <fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/> + <waitForPageLoad stepKey="waitForSearchSubCategory"/> + <click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSubCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> + <waitForPageLoad stepKey="waitForCategoryApply"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> + <waitForPageLoad stepKey="waitForSave"/> + <!-- Create another non-anchored category <Cat2> --> <createData entity="_defaultCategory" stepKey="createSecondCategory"/> From fa3bee177e987c1aa02f5bf4f2173e5cab1b0cf9 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 5 Jun 2019 10:20:07 -0500 Subject: [PATCH 395/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml index 715a2a6a2b784..f7d8abf8b2fea 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml @@ -19,6 +19,5 @@ <section name="AdminCategoryModalSection"/> <section name="AdminCategoryMessagesSection"/> <section name="AdminCategoryContentSection"/> - <section name="AdminCategoryAddProductsModalSection"/> </page> </pages> From 1e675494b29424bed5d2183e85b4f619cf6e4c47 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Wed, 5 Jun 2019 10:22:44 -0500 Subject: [PATCH 396/464] magento/async-import#102: Fixed code style issues --- .../MassConsumerEnvelopeCallback.php | 7 +++-- .../Plugin/Framework/Amqp/Bulk/Exchange.php | 3 ++ .../Model/MassConsumer.php | 10 ++++--- .../Model/MassConsumerEnvelopeCallback.php | 9 ++++-- .../Model/AsyncScheduleMultiStoreTest.php | 29 ++++++++++++------- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php index efa5db19af1bd..e05004cea78cd 100644 --- a/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php @@ -63,8 +63,11 @@ public function __construct( * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundExecute(SubjectMassConsumerEnvelopeCallback $subject, callable $proceed, EnvelopeInterface $message) - { + public function aroundExecute( + SubjectMassConsumerEnvelopeCallback $subject, + callable $proceed, + EnvelopeInterface $message + ) { $amqpProperties = $message->getProperties(); if (isset($amqpProperties['application_headers'])) { $headers = $amqpProperties['application_headers']; diff --git a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php index 9a8f92e5696df..c5db1f5300c29 100644 --- a/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php +++ b/app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php @@ -39,8 +39,10 @@ class Exchange private $logger; /** + * Exchange constructor. * @param EnvelopeFactory $envelopeFactory * @param StoreManagerInterface $storeManager + * @param LoggerInterface $logger */ public function __construct( EnvelopeFactory $envelopeFactory, @@ -89,6 +91,7 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes if ($headers instanceof AMQPTable) { try { $headers->set('store_id', $storeId); + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (AMQPInvalidArgumentException $ea) { $errorMessage = sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage()); $this->logger->error($errorMessage); diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php index 49f1a582fb4cc..e3ba8b0681971 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumer.php @@ -89,10 +89,12 @@ public function process($maxNumberOfMessages = null) */ private function getTransactionCallback(QueueInterface $queue) { - $callbackInstance = $this->massConsumerEnvelopeCallback->create([ - 'configuration' => $this->configuration, - 'queue' => $queue, - ]); + $callbackInstance = $this->massConsumerEnvelopeCallback->create( + [ + 'configuration' => $this->configuration, + 'queue' => $queue, + ] + ); return function (EnvelopeInterface $message) use ($callbackInstance) { $callbackInstance->execute($message); }; diff --git a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php index 5d5dd5d294997..42437292e6f00 100644 --- a/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php +++ b/app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php @@ -74,9 +74,11 @@ public function __construct( $this->resource = $resource; $this->messageController = $messageController; $this->configuration = $configuration; - $this->operationProcessor = $operationProcessorFactory->create([ - 'configuration' => $configuration - ]); + $this->operationProcessor = $operationProcessorFactory->create( + [ + 'configuration' => $configuration + ] + ); $this->logger = $logger; $this->queue = $queue; } @@ -125,6 +127,7 @@ public function execute(EnvelopeInterface $message) /** * Get message queue. + * * @return QueueInterface */ public function getQueue() diff --git a/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php index a9bac96dd6c3f..a58bb6b14d069 100644 --- a/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php +++ b/dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php @@ -99,11 +99,14 @@ protected function setUp() ); /** @var PublisherConsumerController publisherConsumerController */ - $this->publisherConsumerController = $this->objectManager->create(PublisherConsumerController::class, [ - 'consumers' => $this->consumers, - 'logFilePath' => $this->logFilePath, - 'appInitParams' => $params, - ]); + $this->publisherConsumerController = $this->objectManager->create( + PublisherConsumerController::class, + [ + 'consumers' => $this->consumers, + 'logFilePath' => $this->logFilePath, + 'appInitParams' => $params, + ] + ); $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); try { @@ -240,6 +243,7 @@ private function clearProducts() foreach ($this->skus as $sku) { $this->productRepository->deleteById($sku); } + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { throw $e; //nothing to delete @@ -252,6 +256,7 @@ private function clearProducts() ->getSize(); if ($size > 0) { + //phpcs:ignore Magento2.Exceptions.DirectThrow throw new Exception(new Phrase("Collection size after clearing the products: %size", ['size' => $size])); } $this->skus = []; @@ -271,11 +276,13 @@ public function getProductData() return [ 'product' => - $productBuilder([ - ProductInterface::TYPE_ID => 'simple', - ProductInterface::SKU => 'multistore-sku-test-1', - ProductInterface::NAME => 'Test Name ', - ]), + $productBuilder( + [ + ProductInterface::TYPE_ID => 'simple', + ProductInterface::SKU => 'multistore-sku-test-1', + ProductInterface::NAME => 'Test Name ', + ] + ), ]; } @@ -341,10 +348,12 @@ public function assertProductCreation($product) /** * Remove test store + * //phpcs:disable */ public static function tearDownAfterClass() { parent::tearDownAfterClass(); + //phpcs:enable /** @var Registry $registry */ $registry = Bootstrap::getObjectManager()->get(Registry::class); From 9fec0ecccb953072ef3ebc3f45468568d5c21ed0 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 5 Jun 2019 10:30:57 -0500 Subject: [PATCH 397/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../templates/dashboard/graph/disabled.phtml | 2 +- .../templates/dashboard/store/switcher.phtml | 2 +- .../adminhtml/templates/page/copyright.phtml | 2 +- .../templates/page/js/calendar.phtml | 20 +++++++++---------- .../adminhtml/templates/store/switcher.phtml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml index 86152d661a4a7..f8e584ce5b9cd 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml @@ -5,5 +5,5 @@ */ ?> <div class="dashboard-diagram-disabled"> - <?= /* @noEscape */ __('Chart is disabled. To enable the chart, click <a href="%1">here</a>.', $block->getConfigUrl()) ?> + <?= /* @noEscape */ __('Chart is disabled. To enable the chart, click <a href="%1">here</a>.', $block->escapeUrl($block->getConfigUrl())) ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index 37b76aaffbcc9..87e5399ddda44 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -19,7 +19,7 @@ <?php endif; ?> <?php if ($showGroup == false) : ?> <?php $showGroup = true; ?> - <!--optgroup label="   <?= /* @noEscape */ $_group->getName() ?>"--> + <!--optgroup label="   <?= $block->escapeHtmlAttr($_group->getName()) ?>"--> <option group="true" value="<?= $block->escapeHtmlAttr($_group->getId()) ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()) : ?> selected="selected"<?php endif; ?>>   <?= $block->escapeHtml($_group->getName()) ?></option> <?php endif; ?> <option value="<?= $block->escapeHtmlAttr($_store->getId()) ?>"<?php if ($block->getStoreId() == $_store->getId()) : ?> selected="selected"<?php endif; ?>>      <?= $block->escapeHtml($_store->getName()) ?></option> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml index edd3a0d9e5ebc..e3a5c84ea4522 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml @@ -4,5 +4,5 @@ * See COPYING.txt for license details. */ ?> -<a class="link-copyright" href="http://magento.com" target="_blank" title="<?= $block->escapeHtml(__('Magento')) ?>"></a> +<a class="link-copyright" href="http://magento.com" target="_blank" title="<?= $block->escapeHtmlAttr(__('Magento')) ?>"></a> <?= $block->escapeHtml(__('Copyright © %1 Magento Commerce Inc. All rights reserved.', date('Y'))) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml index 38707284a6971..94df9ef9eb872 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml @@ -25,16 +25,16 @@ require([ dayNamesMin: <?= /* @noEscape */ $days['abbreviated'] ?>, monthNames: <?= /* @noEscape */ $months['wide'] ?>, monthNamesShort: <?= /* @noEscape */ $months['abbreviated'] ?>, - infoTitle: "<?= $block->escapeHtml(__('About the calendar')) ?>", + infoTitle: "<?= $block->escapeJs(__('About the calendar')) ?>", firstDay: <?= /* @noEscape */ $firstDay ?>, - closeText: "<?= $block->escapeHtml(__('Close')) ?>", - currentText: "<?= $block->escapeHtml(__('Go Today')) ?>", - prevText: "<?= $block->escapeHtml(__('Previous')) ?>", - nextText: "<?= $block->escapeHtml(__('Next')) ?>", - weekHeader: "<?= $block->escapeHtml(__('WK')) ?>", - timeText: "<?= $block->escapeHtml(__('Time')) ?>", - hourText: "<?= $block->escapeHtml(__('Hour')) ?>", - minuteText: "<?= $block->escapeHtml(__('Minute')) ?>", + closeText: "<?= $block->escapeJs(__('Close')) ?>", + currentText: "<?= $block->escapeJs(__('Go Today')) ?>", + prevText: "<?= $block->escapeJs(__('Previous')) ?>", + nextText: "<?= $block->escapeJs(__('Next')) ?>", + weekHeader: "<?= $block->escapeJs(__('WK')) ?>", + timeText: "<?= $block->escapeJs(__('Time')) ?>", + hourText: "<?= $block->escapeJs(__('Hour')) ?>", + minuteText: "<?= $block->escapeJs(__('Minute')) ?>", dateFormat: $.datepicker.RFC_2822, showOn: "button", showAnim: "", @@ -51,7 +51,7 @@ require([ showMinute: false, serverTimezoneSeconds: <?= (int) $block->getStoreTimestamp() ?>, serverTimezoneOffset: <?= (int) $block->getTimezoneOffsetSeconds() ?>, - yearRange: '<?= /* @noEscape */ $block->getYearRange() ?>' + yearRange: '<?= $block->escapeJs($block->getYearRange()) ?>' } }); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index 8f3e214615c19..8674a167d28e5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -143,7 +143,7 @@ require([ <?php if ($block->getUseConfirm()) : ?> confirm({ - content: "<?= $block->escapeHtml(__('Please confirm scope switching. All data that hasn\'t been saved will be lost.')) ?>", + content: "<?= $block->escapeJs(__('Please confirm scope switching. All data that hasn\'t been saved will be lost.')) ?>", actions: { confirm: function() { reload(); From 59b0242f189c4de55b9ead04bb8b946179942ed4 Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 5 Jun 2019 12:27:21 -0500 Subject: [PATCH 398/464] MC-12084: Address is not lost for Guest checkout if Guest refresh page during checkout Renamed stepKey --- .../Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml index 5537f2cec7379..1db460de44996 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml @@ -30,7 +30,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <!-- Logout admin --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="logout" stepKey="logoutAsAdmin"/> </after> <!-- Add simple product to cart as Guest --> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> From 8a28fa68d4cec957d35b9af2ad511c1cb0fdafca Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Wed, 5 Jun 2019 14:13:29 -0500 Subject: [PATCH 399/464] MC-12599: Checkout can properly process flow if list of shipping carriers are changed during place order Fixed typo --- .../AdminChangeFlatRateShippingMethodStatusActionGroup.xml | 2 +- .../Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml index ba77695a326f4..977ee065a8fb1 100644 --- a/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml +++ b/app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml @@ -12,7 +12,7 @@ <arguments> <argument name="status" type="string" defaultValue="1"/> </arguments> - <conditionalClick selector="{{AdminShippingMethodFlatRateSection.carriersFratRateTab}}" dependentSelector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" visible="false" stepKey="expandTab"/> + <conditionalClick selector="{{AdminShippingMethodFlatRateSection.carriersFlatRateTab}}" dependentSelector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" visible="false" stepKey="expandTab"/> <selectOption selector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" userInput="{{status}}" stepKey="changeFlatRateMethodStatus"/> <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfigs"/> <waitForPageLoad stepKey="waitForPageLoad"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml b/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml index b03e319b25bad..a7ed0ab498bea 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml @@ -9,7 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminShippingMethodFlatRateSection"> - <element name="carriersFratRateTab" type="button" selector="#carriers_flatrate-head"/> + <element name="carriersFlatRateTab" type="button" selector="#carriers_flatrate-head"/> <element name="carriersFlatRateActive" type="select" selector="#carriers_flatrate_active"/> </section> </sections> From 79f8f112dfd8ba6e15c8c68d954ac28d2f81434a Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 5 Jun 2019 14:59:03 -0500 Subject: [PATCH 400/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- .../Ui/view/base/web/js/form/element/date.js | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 3d62f10d3bfe5..05991ec0856fe 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -76,16 +76,7 @@ define([ * * @type {String} */ - shiftedValue: '', - - /** - * Stored Date format initially received from server - * for offline date formatting - * - * @private - * @type {String} - */ - storedDateFormat: '' + shiftedValue: '' }, /** @@ -130,18 +121,16 @@ define([ if (this.options.showsTime) { shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone); } else { - if (this.storedDateFormat) { - dateFormat = this.storedDateFormat; - } else { - dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; - this.storedDateFormat = dateFormat; - } + dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat; shiftedValue = moment(value, dateFormat); } + if (!shiftedValue.isValid()) { + shiftedValue = moment(value, this.inputDateFormat); + } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); } else { - shiftedValue = ''; + shiftedValue = this.shiftedValue(); } if (shiftedValue !== this.shiftedValue()) { From 11e102dfbc5a8b100f118d388f883b81645b9b91 Mon Sep 17 00:00:00 2001 From: Mila Lesechko <llesechk@adobe.com> Date: Wed, 5 Jun 2019 15:06:28 -0500 Subject: [PATCH 401/464] MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode) --- .../Mftf/Section/AdminProductFormSection.xml | 2 +- .../AdminMoveProductBetweenCategoriesTest.xml | 86 +++++++++---------- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index dfc6d07f37c4d..76feba43bef31 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -32,7 +32,7 @@ <element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/> <element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/> <element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/> - <element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb span[data-bind='text: label']"/> + <element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb > span"/> <element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/> <element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/> <element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml index dd026388ae0e3..da985fc2ce34d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -17,8 +17,12 @@ <testCaseId value="MC-11296"/> <group value="catalog"/> </annotations> + <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> + <createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/> + <createData entity="_defaultCategory" stepKey="createSecondCategory"/> <!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode --> <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> @@ -30,47 +34,8 @@ <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> <argument name="indexerValue" value="catalog_product_category"/> </actionGroup> - - <!-- Create the anchored category <Cat1_anchored> --> - <createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/> - <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> - <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> - </actionGroup> - - <!-- Create subcategory <Sub1> of the anchored category --> - <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> - <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> - <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> - - <!-- Assign <product1> to the <Sub1> --> - <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> - - <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/> - <waitForPageLoad stepKey="waitForProductPage"/> - <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/> - <fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/> - <waitForPageLoad stepKey="waitForSearchSubCategory"/> - <click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSubCategory"/> - <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> - <waitForPageLoad stepKey="waitForCategoryApply"/> - <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> - <waitForPageLoad stepKey="waitForSave"/> - - <!-- Create another non-anchored category <Cat2> --> - <createData entity="_defaultCategory" stepKey="createSecondCategory"/> - - <!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization --> - <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/> - <waitForPageLoad stepKey="waitForLoading"/> - <conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/> - <uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/> - <selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/> - <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> - <waitForPageLoad stepKey="waitForSaving"/> - <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> </before> + <after> <!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode --> <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> @@ -90,6 +55,39 @@ <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> <actionGroup ref="logout" stepKey="logout"/> </after> + <!-- Create the anchored category <Cat1_anchored> --> + <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> + <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> + </actionGroup> + + <!-- Create subcategory <Sub1> of the anchored category --> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/> + + <!-- Assign <product1> to the <Sub1> --> + <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDownCategory"/> + <fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearch"/> + <waitForPageLoad stepKey="waitForSubCategory"/> + <click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSub1Category"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForApplyCategory"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingChanges"/> + + <!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization --> + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/> + <waitForPageLoad stepKey="waitForLoading"/> + <conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/> + <uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/> + <selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSaving"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> <!-- Navigate to the Catalog > Products --> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onCatalogProductPage"/> @@ -107,9 +105,9 @@ <click selector="{{AdminProductFormSection.unselectCategories(SimpleSubCategory.name)}}" stepKey="removeCategory"/> <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> <checkOption selector="{{AdminProductFormSection.selectCategory($$createSecondCategory.name$$)}}" stepKey="selectCategory"/> - <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> - <waitForPageLoad stepKey="waitForApplyCategory"/> - <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="pressButtonDone"/> + <waitForPageLoad stepKey="waitForApplyCategory2"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="pushButtonSave"/> <waitForPageLoad stepKey="waitForSavingProduct"/> <!--Product is saved --> @@ -183,7 +181,7 @@ <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> <waitForPageLoad stepKey="waitForCategoryApply"/> <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> - <waitForPageLoad stepKey="waitForSaving"/> + <waitForPageLoad stepKey="waitForSaveChanges"/> <!-- Product is saved successfully --> <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSaveMessage"/> From 65308b558beddea9e8c15f501558c9c1f0773e22 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov <vzabaznov@magento.com> Date: Wed, 5 Jun 2019 16:01:42 -0500 Subject: [PATCH 402/464] MC-15763: Introduce critical CSS scope loaded through head - Stabilization --- lib/internal/Magento/Framework/View/Asset/MergeService.php | 2 +- lib/internal/Magento/Framework/View/Page/Config/Renderer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Asset/MergeService.php b/lib/internal/Magento/Framework/View/Asset/MergeService.php index cac2b08413149..594235ea2fa28 100644 --- a/lib/internal/Magento/Framework/View/Asset/MergeService.php +++ b/lib/internal/Magento/Framework/View/Asset/MergeService.php @@ -87,7 +87,7 @@ public function getMergedAssets(array $assets, $contentType) { $isCss = $contentType == 'css'; $isJs = $contentType == 'js'; - if (!in_array($contentType, self::SUPPORTED_MERGE_TYPE)) { + if (!in_array($contentType, self::SUPPORTED_MERGE_TYPE, true)) { throw new \InvalidArgumentException("Merge for content type '{$contentType}' is not supported."); } diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index ee4894b13c2f2..b7a1e0b707013 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -425,7 +425,7 @@ protected function renderAssetHtml(\Magento\Framework\View\Asset\PropertyGroup $ */ private function canTypeBeFont(string $type): bool { - return in_array($type, self::FONTS_TYPE); + return in_array($type, self::FONTS_TYPE, true); } /** From 7ac170aefd40ca3c17418feb4ac17a1c9a6122bc Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 5 Jun 2019 16:26:02 -0500 Subject: [PATCH 403/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- .../Magento/Ui/view/base/web/js/form/element/date.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 05991ec0856fe..833e828fbd406 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -129,13 +129,12 @@ define([ shiftedValue = moment(value, this.inputDateFormat); } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); - } else { - shiftedValue = this.shiftedValue(); - } - if (shiftedValue !== this.shiftedValue()) { - this.shiftedValue(shiftedValue); + if (shiftedValue !== this.shiftedValue()) { + this.shiftedValue(shiftedValue); + } } + }, /** From b947c12a4eb3b662297506d085c11228bf9f2068 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko <lytvynen@adobe.com> Date: Wed, 5 Jun 2019 16:32:25 -0500 Subject: [PATCH 404/464] MAGETWO-99832: Order grid saved view with Purchased date show Invalid date after switching views --- app/code/Magento/Ui/view/base/web/js/form/element/date.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index 833e828fbd406..0817b31d737b9 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -125,9 +125,6 @@ define([ shiftedValue = moment(value, dateFormat); } - if (!shiftedValue.isValid()) { - shiftedValue = moment(value, this.inputDateFormat); - } shiftedValue = shiftedValue.format(this.pickerDateTimeFormat); if (shiftedValue !== this.shiftedValue()) { From ef12f0006900d30ac48fb79ffeadaac3cb70b270 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Thu, 6 Jun 2019 00:40:51 +0300 Subject: [PATCH 405/464] magento/magento2#23138: Magento_Theme. Incorrect configuration file location --- .../Magento/Theme/etc/adminhtml/system.xml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 app/code/Magento/Theme/etc/adminhtml/system.xml diff --git a/app/code/Magento/Theme/etc/adminhtml/system.xml b/app/code/Magento/Theme/etc/adminhtml/system.xml deleted file mode 100644 index 4abc87e845122..0000000000000 --- a/app/code/Magento/Theme/etc/adminhtml/system.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> - <system> - <section id="dev" translate="label" type="text" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="1"> - <group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> - <field id="move_inline_to_bottom" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> - <label>Move JS code to the bottom of the page</label> - <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> - </field> - </group> - </section> - </system> -</config> From 96aaf95ca838f373c77acec7dbe0ee6eecc18152 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Wed, 5 Jun 2019 14:27:47 -0500 Subject: [PATCH 406/464] MAGETWO-99585: When backorders are allowed on an item, the qty_backordered value in sales_order_item is 0 - fixed - modified test --- .../Initializer/StockItem.php | 43 ++++++++++++++----- .../Initializer/StockItemTest.php | 36 ++++++++++++++-- 2 files changed, 65 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php index 6fb0a949941ec..e1e6f799b5183 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php @@ -7,8 +7,14 @@ use Magento\Catalog\Model\ProductTypes\ConfigInterface; use Magento\CatalogInventory\Api\StockStateInterface; +use Magento\CatalogInventory\Api\Data\StockItemInterface; use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList; +use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface; +use Magento\Quote\Model\Quote\Item; +/** + * Class StockItem initializes stock item and populates it with data + */ class StockItem { /** @@ -26,26 +32,34 @@ class StockItem */ protected $stockState; + /** + * @var StockStateProviderInterface + */ + private $stockStateProvider; + /** * @param ConfigInterface $typeConfig * @param QuoteItemQtyList $quoteItemQtyList * @param StockStateInterface $stockState + * @param StockStateProviderInterface $stockStateProvider */ public function __construct( ConfigInterface $typeConfig, QuoteItemQtyList $quoteItemQtyList, - StockStateInterface $stockState + StockStateInterface $stockState, + StockStateProviderInterface $stockStateProvider ) { $this->quoteItemQtyList = $quoteItemQtyList; $this->typeConfig = $typeConfig; $this->stockState = $stockState; + $this->stockStateProvider = $stockStateProvider; } /** * Initialize stock item * - * @param \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem - * @param \Magento\Quote\Model\Quote\Item $quoteItem + * @param StockItemInterface $stockItem + * @param Item $quoteItem * @param int $qty * * @return \Magento\Framework\DataObject @@ -54,11 +68,14 @@ public function __construct( * @SuppressWarnings(PHPMD.NPathComplexity) */ public function initialize( - \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem, - \Magento\Quote\Model\Quote\Item $quoteItem, + StockItemInterface $stockItem, + Item $quoteItem, $qty ) { $product = $quoteItem->getProduct(); + $quoteItemId = $quoteItem->getId(); + $quoteId = $quoteItem->getQuoteId(); + $productId = $product->getId(); /** * When we work with subitem */ @@ -68,14 +85,14 @@ public function initialize( * we are using 0 because original qty was processed */ $qtyForCheck = $this->quoteItemQtyList - ->getQty($product->getId(), $quoteItem->getId(), $quoteItem->getQuoteId(), 0); + ->getQty($productId, $quoteItemId, $quoteId, 0); } else { $increaseQty = $quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty; $rowQty = $qty; $qtyForCheck = $this->quoteItemQtyList->getQty( - $product->getId(), - $quoteItem->getId(), - $quoteItem->getQuoteId(), + $productId, + $quoteItemId, + $quoteId, $increaseQty ); } @@ -90,14 +107,20 @@ public function initialize( $stockItem->setProductName($product->getName()); + /** @var \Magento\Framework\DataObject $result */ $result = $this->stockState->checkQuoteItemQty( - $product->getId(), + $productId, $rowQty, $qtyForCheck, $qty, $product->getStore()->getWebsiteId() ); + /* We need to ensure that any possible plugin will not erase the data */ + $backOrdersQty = $this->stockStateProvider->checkQuoteItemQty($stockItem, $rowQty, $qtyForCheck, $qty) + ->getItemBackorders(); + $result->setItemBackorders($backOrdersQty); + if ($stockItem->hasIsChildItem()) { $stockItem->unsIsChildItem(); } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php index 8c9a1aa7715ec..01dab7fce3323 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php @@ -8,6 +8,7 @@ use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList; /** + * Class StockItemTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StockItemTest extends \PHPUnit\Framework\TestCase @@ -28,10 +29,18 @@ class StockItemTest extends \PHPUnit\Framework\TestCase protected $typeConfig; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\CatalogInventory\Api\StockStateInterface\PHPUnit_Framework_MockObject_MockObject */ protected $stockStateMock; + /** + * @var \Magento\CatalogInventory\Model\StockStateProviderInterface| \PHPUnit_Framework_MockObject_MockObject + */ + private $stockStateProviderMock; + + /** + * @inheritdoc + */ protected function setUp() { $this->quoteItemQtyList = $this @@ -48,17 +57,25 @@ protected function setUp() $this->stockStateMock = $this->getMockBuilder(\Magento\CatalogInventory\Api\StockStateInterface::class) ->disableOriginalConstructor() ->getMock(); + + $this->stockStateProviderMock = $this + ->getMockBuilder(\Magento\CatalogInventory\Model\StockStateProvider::class) + ->disableOriginalConstructor() + ->getMock(); + $this->model = $objectManagerHelper->getObject( \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem::class, [ 'quoteItemQtyList' => $this->quoteItemQtyList, 'typeConfig' => $this->typeConfig, - 'stockState' => $this->stockStateMock + 'stockState' => $this->stockStateMock, + 'stockStateProvider' => $this->stockStateProviderMock ] ); } /** + * Test initialize with Subitem * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testInitializeWithSubitem() @@ -141,6 +158,10 @@ public function testInitializeWithSubitem() ->method('checkQuoteItemQty') ->withAnyParameters() ->will($this->returnValue($result)); + $this->stockStateProviderMock->expects($this->once()) + ->method('checkQuoteItemQty') + ->withAnyParameters() + ->will($this->returnValue($result)); $product->expects($this->once()) ->method('getCustomOption') ->with('product_type') @@ -177,13 +198,16 @@ public function testInitializeWithSubitem() $quoteItem->expects($this->once())->method('setUseOldQty')->with('item')->will($this->returnSelf()); $result->expects($this->exactly(2))->method('getMessage')->will($this->returnValue('message')); $quoteItem->expects($this->once())->method('setMessage')->with('message')->will($this->returnSelf()); - $result->expects($this->exactly(2))->method('getItemBackorders')->will($this->returnValue('backorders')); + $result->expects($this->exactly(3))->method('getItemBackorders')->will($this->returnValue('backorders')); $quoteItem->expects($this->once())->method('setBackorders')->with('backorders')->will($this->returnSelf()); $quoteItem->expects($this->once())->method('setStockStateResult')->with($result)->will($this->returnSelf()); $this->model->initialize($stockItem, $quoteItem, $qty); } + /** + * Test initialize without Subitem + */ public function testInitializeWithoutSubitem() { $qty = 3; @@ -234,6 +258,10 @@ public function testInitializeWithoutSubitem() ->with($productId, 'quote_item_id', 'quote_id', $qty) ->will($this->returnValue('summary_qty')); $this->stockStateMock->expects($this->once()) + ->method('checkQuoteItemQty') + ->withAnyParameters() + ->will($this->returnValue($result)); + $this->stockStateProviderMock->expects($this->once()) ->method('checkQuoteItemQty') ->withAnyParameters() ->will($this->returnValue($result)); @@ -256,7 +284,7 @@ public function testInitializeWithoutSubitem() $result->expects($this->once())->method('getHasQtyOptionUpdate')->will($this->returnValue(false)); $result->expects($this->once())->method('getItemUseOldQty')->will($this->returnValue(null)); $result->expects($this->once())->method('getMessage')->will($this->returnValue(null)); - $result->expects($this->once())->method('getItemBackorders')->will($this->returnValue(null)); + $result->expects($this->exactly(2))->method('getItemBackorders')->will($this->returnValue(null)); $this->model->initialize($stockItem, $quoteItem, $qty); } From 76d6afca120dd9a9968f00da1124b2b5b707b48d Mon Sep 17 00:00:00 2001 From: Oleksandr Gorkun <ogorkun@magento.com> Date: Wed, 5 Jun 2019 17:40:54 -0500 Subject: [PATCH 407/464] MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend --- .../Backend/view/adminhtml/templates/system/search.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index 9fbfab135feea..6e94770c6e408 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -21,7 +21,7 @@ <button type="submit" class="search-global-action" - title="<?= $block->escapeHtml(__('Search')) ?>" + title="<?= $block->escapeHtmlAttr(__('Search')) ?>" ></button> </div> </form> From 8538a7b92c8d515eacf06bd724ef13f764443ba3 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Wed, 5 Jun 2019 17:45:34 -0500 Subject: [PATCH 408/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml | 3 +++ .../Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml | 2 +- .../Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml | 2 +- .../Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml | 3 +++ .../Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml | 3 +++ .../Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml | 3 +++ .../Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml | 3 +++ .../Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml | 3 +++ .../Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml | 1 + .../Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml | 2 +- .../Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml | 3 +++ 11 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml index 7cb23e54aa1b7..ee39eac1e3719 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml @@ -17,6 +17,9 @@ <severity value="MAJOR"/> <testCaseId value="MAGETWO-95960"/> <useCaseId value="MAGETWO-95823"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml index 938f2dc7f5c6d..e5f43818c1524 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml @@ -18,7 +18,7 @@ <group value="sales"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17274"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml index 9d5cd55b1b071..b9e7106676e2c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml @@ -18,7 +18,7 @@ <group value="sales"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17274"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml index 179e1aa35a4e9..913361c77cdd2 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16186"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml index ec0ec8ca222da..8e3b3b5361437 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16185"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml index 6c97c4add6313..e7a936b088f4f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16188"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml index d7c9664b8bce2..f2995f07d137d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16182"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml index 009f86256a910..30f66cb9fd312 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml @@ -17,6 +17,9 @@ <testCaseId value="MC-16187"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml index e6f40b586d2ae..650152a191d16 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml @@ -10,6 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminSaveInAddressBookCheckboxStateTest"> <annotations> + <stories value="Create Order"/> <title value="The state of 'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> <description value="The state of 'Save in address book' check-box inside 'Shipping Address' section on 'create Order' Admin page"/> <features value="Sales"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml index 1552f0e9ded38..d66078e245aee 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml @@ -19,7 +19,7 @@ <group value="sales"/> <group value="mtf_migrated"/> <skip> - <issueId value="MC-17140"/> + <issueId value="MC-17274"/> </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml index f13a934276e35..66f0a14ea2712 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-16154"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <before> <!-- Login as admin --> From afeafc16d103e0daf4590831c28f6e54bde0dc3e Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Wed, 5 Jun 2019 18:07:31 -0500 Subject: [PATCH 409/464] MC-15763: Introduce critical CSS scope loaded through head - Add sticky footer to critical css; --- app/design/frontend/Magento/luma/web/css/critical.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/web/css/critical.css b/app/design/frontend/Magento/luma/web/css/critical.css index 5e0b1fbd3d346..6b85ecd745790 100644 --- a/app/design/frontend/Magento/luma/web/css/critical.css +++ b/app/design/frontend/Magento/luma/web/css/critical.css @@ -1 +1 @@ -body{margin:0}.page-wrapper{display:flex;flex-direction:column;min-height:100vh}.action.skip:not(:focus),.block.newsletter .label,.minicart-wrapper .action.showcart .counter-label,.minicart-wrapper .action.showcart .text,.page-header .switcher .label,.product-item-actions .actions-secondary>.action span{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.alink,a{color:#006bb4;text-decoration:none}.page-header .panel.wrapper{background-color:#6e716e;color:#fff}.header.panel>.header.links{list-style:none none;float:right;font-size:0;margin-right:20px}.header.panel>.header.links>li{font-size:14px;margin:0 0 0 15px}.block-search .action.search,.block-search .block-title,.block-search .nested,.block.newsletter .title,.breadcrumbs .item,.nav-toggle,.no-display,.page-footer .switcher .options ul.dropdown,.page-header .switcher .options ul.dropdown{display:none}.block-search .label>span{height:1px;overflow:hidden;position:absolute}.logo{float:left;margin:0 0 10px 40px}.minicart-wrapper{float:right}.page-footer{margin-top:25px}.footer.content{border-top:1px solid #cecece;padding-top:20px}.block.newsletter .actions{display:table-cell;vertical-align:top;width:1%}.block-banners .banner-items,.block-banners-inline .banner-items,.block-event .slider-panel .slider,.footer.content ul,.product-items{margin:0;padding:0;list-style:none none}.copyright{background-color:#6e716e;color:#fff;box-sizing:border-box;display:block;padding:10px;text-align:center}.modal-popup,.modal-slide{visibility:hidden;opacity:0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],input[type=url]{background:#fff;background-clip:padding-box;border:1px solid #c2c2c2;border-radius:1px;font-size:14px;height:32px;line-height:1.42857143;padding:0 9px;vertical-align:baseline;width:100%;box-sizing:border-box}.action.primary{background:#1979c3;border:1px solid #1979c3;color:#fff;font-weight:600;padding:7px 15px}.block.newsletter .form.subscribe{display:table}.footer.content .links a{color:#575757}.load.indicator{background-color:rgba(255,255,255,.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url(../images/loader-2.gif) no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative}@media (min-width:768px),print{body,html{height:100%}.page-header{border:0;margin-bottom:0}.nav-sections-item-title,.section-item-content .switcher-currency,ul.header.links li.customer-welcome,ul.level0.submenu{display:none}.abs-add-clearfix-desktop:after,.abs-add-clearfix-desktop:before,.account .column.main .block.block-order-details-view:after,.account .column.main .block.block-order-details-view:before,.account .column.main .block:not(.widget) .block-content:after,.account .column.main .block:not(.widget) .block-content:before,.account .page-title-wrapper:after,.account .page-title-wrapper:before,.block-addresses-list .items.addresses:after,.block-addresses-list .items.addresses:before,.block-cart-failed .block-content:after,.block-cart-failed .block-content:before,.block-giftregistry-shared .item-options:after,.block-giftregistry-shared .item-options:before,.block-wishlist-management:after,.block-wishlist-management:before,.cart-container:after,.cart-container:before,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .content:before,.data.table .gift-wrapping .nested:after,.data.table .gift-wrapping .nested:before,.header.content:after,.header.content:before,.login-container:after,.login-container:before,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:before,.order-links:after,.order-links:before,.order-review-form:after,.order-review-form:before,.page-header .header.panel:after,.page-header .header.panel:before,.paypal-review .block-content:after,.paypal-review .block-content:before,.paypal-review-discount:after,.paypal-review-discount:before,.sales-guest-view .column.main .block.block-order-details-view:after,.sales-guest-view .column.main .block.block-order-details-view:before,[class^=sales-guest-] .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:before{content:'';display:table}.abs-add-clearfix-desktop:after,.account .column.main .block.block-order-details-view:after,.account .column.main .block:not(.widget) .block-content:after,.account .page-title-wrapper:after,.block-addresses-list .items.addresses:after,.block-cart-failed .block-content:after,.block-giftregistry-shared .item-options:after,.block-wishlist-management:after,.cart-container:after,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .nested:after,.header.content:after,.login-container:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.order-links:after,.order-review-form:after,.page-header .header.panel:after,.paypal-review .block-content:after,.paypal-review-discount:after,.sales-guest-view .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:after{clear:both}.block.category.event,.breadcrumbs,.footer.content,.header.content,.navigation,.page-header .header.panel,.page-main,.page-wrapper>.page-bottom,.page-wrapper>.widget,.top-container{box-sizing:border-box;margin-left:auto;margin-right:auto;max-width:1280px;padding-left:20px;padding-right:20px;width:auto}.panel.header{padding:10px 20px}.page-header .switcher{float:right;margin-left:15px;margin-right:-6px}.header.panel>.header.links>li>a{color:#fff}.header.content{padding:30px 20px 0}.logo{margin:-8px auto 25px 0}.minicart-wrapper{margin-left:13px}.compare.wrapper{list-style:none none}.nav-sections{margin-bottom:25px}.nav-sections-item-content>.navigation{display:block}.navigation{background:#f0f0f0;font-weight:700;height:inherit;left:auto;overflow:inherit;padding:0;position:relative;top:0;width:100%;z-index:3}.navigation ul{margin-top:0;margin-bottom:0;padding:0 8px;position:relative}.navigation .level0{margin:0 10px 0 0;display:inline-block}.navigation .level0>.level-top{color:#575757;line-height:47px;padding:0 12px}.page-main{width:100%}.page-footer{background:#f4f4f4;padding-bottom:25px}.footer.content .links{display:inline-block;padding-right:50px;vertical-align:top}.footer.content ul{padding-right:50px}.footer.content .links li{border:none;font-size:14px;margin:0 0 8px;padding:0}.footer.content .block{float:right}.block.newsletter{width:34%}}@media only screen and (max-width:767px){.compare.wrapper,.panel.wrapper,[class*=block-compare]{display:none}.footer.content .links>li{background:#f4f4f4;font-size:1.6rem;border-top:1px solid #cecece;margin:0 -15px;padding:0 15px}.page-header .header.panel,.page-main{padding-left:15px;padding-right:15px}.header.content{padding-top:10px}.nav-sections-items:after,.nav-sections-items:before{content:'';display:table}.nav-sections-items:after{clear:both}.nav-sections{width:100vw;position:fixed;left:-100vw}} +body{margin:0}.product-image-wrapper{display:block;height:0;overflow:hidden;position:relative;z-index:1}.product-image-wrapper .product-image-photo{bottom:0;display:block;height:auto;left:0;margin:auto;max-width:100%;position:absolute;right:0;top:0}.product-image-container{display:inline-block}.modal-popup{position:fixed}.page-wrapper{display:flex;flex-direction:column;min-height:100vh}.action.skip:not(:focus),.block.newsletter .label,.minicart-wrapper .action.showcart .counter-label,.minicart-wrapper .action.showcart .text,.page-header .switcher .label,.product-item-actions .actions-secondary>.action span{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.alink,a{color:#006bb4;text-decoration:none}.page-header .panel.wrapper{background-color:#6e716e;color:#fff}.header.panel>.header.links{list-style:none none;float:right;font-size:0;margin-right:20px}.header.panel>.header.links>li{font-size:14px;margin:0 0 0 15px}.block-search .action.search,.block-search .block-title,.block-search .nested,.block.newsletter .title,.breadcrumbs .item,.nav-toggle,.no-display,.page-footer .switcher .options ul.dropdown,.page-header .switcher .options ul.dropdown{display:none}.block-search .label>span{height:1px;overflow:hidden;position:absolute}.logo{float:left;margin:0 0 10px 40px}.minicart-wrapper{float:right}.page-footer{margin-top:25px}.footer.content{border-top:1px solid #cecece;padding-top:20px}.block.newsletter .actions{display:table-cell;vertical-align:top;width:1%}.block-banners .banner-items,.block-banners-inline .banner-items,.block-event .slider-panel .slider,.footer.content ul,.product-items{margin:0;padding:0;list-style:none none}.copyright{background-color:#6e716e;color:#fff;box-sizing:border-box;display:block;padding:10px;text-align:center}.modal-popup,.modal-slide{visibility:hidden;opacity:0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],input[type=url]{background:#fff;background-clip:padding-box;border:1px solid #c2c2c2;border-radius:1px;font-size:14px;height:32px;line-height:1.42857143;padding:0 9px;vertical-align:baseline;width:100%;box-sizing:border-box}.action.primary{background:#1979c3;border:1px solid #1979c3;color:#fff;font-weight:600;padding:7px 15px}.block.newsletter .form.subscribe{display:table}.footer.content .links a{color:#575757}.load.indicator{background-color:rgba(255,255,255,.7);z-index:9999;bottom:0;left:0;position:fixed;right:0;top:0;position:absolute}.load.indicator:before{background:transparent url(../images/loader-2.gif) no-repeat 50% 50%;border-radius:5px;height:160px;width:160px;bottom:0;box-sizing:border-box;content:'';left:0;margin:auto;position:absolute;right:0;top:0}.load.indicator>span{display:none}.loading-mask{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100;background:rgba(255,255,255,.5)}.loading-mask .loader>img{bottom:0;left:0;margin:auto;position:fixed;right:0;top:0;z-index:100}.loading-mask .loader>p{display:none}body>.loading-mask{z-index:9999}._block-content-loading{position:relative}@media (min-width:768px),print{body,html{height:100%}.page-header{border:0;margin-bottom:0}.nav-sections-item-title,.section-item-content .switcher-currency,ul.header.links li.customer-welcome,ul.level0.submenu{display:none}.abs-add-clearfix-desktop:after,.abs-add-clearfix-desktop:before,.account .column.main .block.block-order-details-view:after,.account .column.main .block.block-order-details-view:before,.account .column.main .block:not(.widget) .block-content:after,.account .column.main .block:not(.widget) .block-content:before,.account .page-title-wrapper:after,.account .page-title-wrapper:before,.block-addresses-list .items.addresses:after,.block-addresses-list .items.addresses:before,.block-cart-failed .block-content:after,.block-cart-failed .block-content:before,.block-giftregistry-shared .item-options:after,.block-giftregistry-shared .item-options:before,.block-wishlist-management:after,.block-wishlist-management:before,.cart-container:after,.cart-container:before,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .content:before,.data.table .gift-wrapping .nested:after,.data.table .gift-wrapping .nested:before,.header.content:after,.header.content:before,.login-container:after,.login-container:before,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:before,.order-links:after,.order-links:before,.order-review-form:after,.order-review-form:before,.page-header .header.panel:after,.page-header .header.panel:before,.paypal-review .block-content:after,.paypal-review .block-content:before,.paypal-review-discount:after,.paypal-review-discount:before,.sales-guest-view .column.main .block.block-order-details-view:after,.sales-guest-view .column.main .block.block-order-details-view:before,[class^=sales-guest-] .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:before{content:'';display:table}.abs-add-clearfix-desktop:after,.account .column.main .block.block-order-details-view:after,.account .column.main .block:not(.widget) .block-content:after,.account .page-title-wrapper:after,.block-addresses-list .items.addresses:after,.block-cart-failed .block-content:after,.block-giftregistry-shared .item-options:after,.block-wishlist-management:after,.cart-container:after,.data.table .gift-wrapping .content:after,.data.table .gift-wrapping .nested:after,.header.content:after,.login-container:after,.magento-rma-guest-returns .column.main .block.block-order-details-view:after,.order-links:after,.order-review-form:after,.page-header .header.panel:after,.paypal-review .block-content:after,.paypal-review-discount:after,.sales-guest-view .column.main .block.block-order-details-view:after,[class^=sales-guest-] .column.main .block.block-order-details-view:after{clear:both}.block.category.event,.breadcrumbs,.footer.content,.header.content,.navigation,.page-header .header.panel,.page-main,.page-wrapper>.page-bottom,.page-wrapper>.widget,.top-container{box-sizing:border-box;margin-left:auto;margin-right:auto;max-width:1280px;padding-left:20px;padding-right:20px;width:auto}.panel.header{padding:10px 20px}.page-header .switcher{float:right;margin-left:15px;margin-right:-6px}.header.panel>.header.links>li>a{color:#fff}.header.content{padding:30px 20px 0}.logo{margin:-8px auto 25px 0}.minicart-wrapper{margin-left:13px}.compare.wrapper{list-style:none none}.nav-sections{margin-bottom:25px}.nav-sections-item-content>.navigation{display:block}.navigation{background:#f0f0f0;font-weight:700;height:inherit;left:auto;overflow:inherit;padding:0;position:relative;top:0;width:100%;z-index:3}.navigation ul{margin-top:0;margin-bottom:0;padding:0 8px;position:relative}.navigation .level0{margin:0 10px 0 0;display:inline-block}.navigation .level0>.level-top{color:#575757;line-height:47px;padding:0 12px}.page-main{width:100%}.page-footer{background:#f4f4f4;padding-bottom:25px}.footer.content .links{display:inline-block;padding-right:50px;vertical-align:top}.footer.content ul{padding-right:50px}.footer.content .links li{border:none;font-size:14px;margin:0 0 8px;padding:0}.footer.content .block{float:right}.block.newsletter{width:34%}}@media only screen and (max-width:767px){.compare.wrapper,.panel.wrapper,[class*=block-compare]{display:none}.footer.content .links>li{background:#f4f4f4;font-size:1.6rem;border-top:1px solid #cecece;margin:0 -15px;padding:0 15px}.page-header .header.panel,.page-main{padding-left:15px;padding-right:15px}.header.content{padding-top:10px}.nav-sections-items:after,.nav-sections-items:before{content:'';display:table}.nav-sections-items:after{clear:both}.nav-sections{width:100vw;position:fixed;left:-100vw}} From 2543fd83b7f0f353176f052b648573f1c96603f2 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Wed, 5 Jun 2019 21:57:00 -0500 Subject: [PATCH 410/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml index f4b133167819c..d2c9bd0f24b77 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml @@ -18,6 +18,9 @@ <useCaseId value="MAGETWO-99691"/> <group value="sales"/> <group value="catalogRule"/> + <skip> + <issueId value="MC-17140"/> + </skip> </annotations> <before> <!--Create the catalog price rule --> From e9b07f59a754e543ff01cd8aec3a00e1bbb4b5d9 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@magento.com> Date: Wed, 5 Jun 2019 23:36:00 -0500 Subject: [PATCH 411/464] MC-17139: Multiple Unstable MFTF Tests The Are Slowing Down PRs - Skipping unstable MFTF tests --- .../Test/AssignCustomOrderStatusVisibleOnStorefrontTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusVisibleOnStorefrontTest.xml index d81baf7755eab..102fec494d125 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusVisibleOnStorefrontTest.xml @@ -18,6 +18,9 @@ <testCaseId value="MC-16054"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-17274"/> + </skip> </annotations> <remove keyForRemoval="seeEmptyMessage"/> From 265e0d4e7ca2bc051652241020a1609e48523f72 Mon Sep 17 00:00:00 2001 From: Wirson <m.wirson@gmail.com> Date: Tue, 4 Jun 2019 12:51:45 +0200 Subject: [PATCH 412/464] #23053 : sendfriend verifies product visibility instead of status --- .../Magento/SendFriend/Controller/Product.php | 2 +- .../SendFriend/Controller/SendmailTest.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/SendFriend/Controller/Product.php b/app/code/Magento/SendFriend/Controller/Product.php index 732bcef8b957a..388fcd23c2e0a 100644 --- a/app/code/Magento/SendFriend/Controller/Product.php +++ b/app/code/Magento/SendFriend/Controller/Product.php @@ -102,7 +102,7 @@ protected function _initProduct() } try { $product = $this->productRepository->getById($productId); - if (!$product->isVisibleInCatalog()) { + if (!$product->isVisibleInSiteVisibility() || !$product->isVisibleInCatalog()) { return false; } } catch (NoSuchEntityException $noEntityException) { diff --git a/dev/tests/integration/testsuite/Magento/SendFriend/Controller/SendmailTest.php b/dev/tests/integration/testsuite/Magento/SendFriend/Controller/SendmailTest.php index a075398e9cdb7..f5851a55d760a 100644 --- a/dev/tests/integration/testsuite/Magento/SendFriend/Controller/SendmailTest.php +++ b/dev/tests/integration/testsuite/Magento/SendFriend/Controller/SendmailTest.php @@ -85,6 +85,24 @@ public function testSendActionAsGuestWithInvalidData() ); } + /** + * Share the product invisible in catalog to friend as guest customer + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoConfigFixture default_store sendfriend/email/enabled 1 + * @magentoConfigFixture default_store sendfriend/email/allow_guest 1 + * @magentoDataFixture Magento/Catalog/_files/simple_products_not_visible_individually.php + */ + public function testSendInvisibleProduct() + { + $product = $this->getInvisibleProduct(); + $this->prepareRequestData(); + + $this->dispatch('sendfriend/product/sendmail/id/' . $product->getId()); + $this->assert404NotFound(); + } + /** * @return ProductInterface */ @@ -93,6 +111,14 @@ private function getProduct() return $this->_objectManager->get(ProductRepositoryInterface::class)->get('custom-design-simple-product'); } + /** + * @return ProductInterface + */ + private function getInvisibleProduct() + { + return $this->_objectManager->get(ProductRepositoryInterface::class)->get('simple_not_visible_1'); + } + /** * Login the user * From e2f577dbd5c2235bd2f8bf2b17df34b61bb9af50 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 5 Jun 2019 13:14:52 +0300 Subject: [PATCH 413/464] magento/magento2#20848: Static test fix. --- .../Magento/Newsletter/Block/Adminhtml/Problem.php | 2 +- .../Controller/Adminhtml/Subscriber/MassDelete.php | 12 ++++++++---- .../Magento/Newsletter/Controller/Manage/Save.php | 8 ++++---- .../Newsletter/Controller/Subscriber/Confirm.php | 2 +- app/code/Magento/Newsletter/Model/Subscriber.php | 10 +++++++--- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php index 6534f39451275..0c66e46a850ee 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Problem.php @@ -41,7 +41,7 @@ public function __construct( } /** - * @return void + * @inheritDoc * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ protected function _construct() diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php index 0afc98a5cc12e..cdef44b2da757 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php @@ -6,13 +6,17 @@ */ namespace Magento\Newsletter\Controller\Adminhtml\Subscriber; -use Magento\Newsletter\Controller\Adminhtml\Subscriber; use Magento\Backend\App\Action\Context; +use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\Response\Http\FileFactory; +use Magento\Newsletter\Controller\Adminhtml\Subscriber; use Magento\Newsletter\Model\SubscriberFactory; -use Magento\Framework\App\ObjectManager; -class MassDelete extends Subscriber +/** + * Subscriber mass delete controller. + */ +class MassDelete extends Subscriber implements HttpPostActionInterface { /** * @var SubscriberFactory @@ -32,7 +36,7 @@ public function __construct( $this->subscriberFactory = $subscriberFactory ?: ObjectManager::getInstance()->get(SubscriberFactory::class); parent::__construct($context, $fileFactory); } - + /** * Delete one or more subscribers action * diff --git a/app/code/Magento/Newsletter/Controller/Manage/Save.php b/app/code/Magento/Newsletter/Controller/Manage/Save.php index 400922f149f8e..d7d511e2d1906 100644 --- a/app/code/Magento/Newsletter/Controller/Manage/Save.php +++ b/app/code/Magento/Newsletter/Controller/Manage/Save.php @@ -8,7 +8,7 @@ namespace Magento\Newsletter\Controller\Manage; use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository; -use Magento\Customer\Model\Customer; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Newsletter\Model\Subscriber; @@ -68,7 +68,7 @@ public function __construct( * * @return \Magento\Framework\App\ResponseInterface */ - public function execute(): \Magento\Framework\App\ResponseInterface + public function execute() { if (!$this->formKeyValidator->validate($this->getRequest())) { return $this->_redirect('customer/account/'); @@ -117,10 +117,10 @@ public function execute(): \Magento\Framework\App\ResponseInterface /** * Set ignore_validation_flag to skip unnecessary address and customer validation * - * @param Customer $customer + * @param CustomerInterface $customer * @return void */ - private function setIgnoreValidationFlag(Customer $customer): void + private function setIgnoreValidationFlag(CustomerInterface $customer): void { $customer->setData('ignore_validation_flag', true); } diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php b/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php index 658290f756a00..6f566761b2f87 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php @@ -20,7 +20,7 @@ class Confirm extends \Magento\Newsletter\Controller\Subscriber implements HttpG * * @return \Magento\Framework\Controller\Result\Redirect */ - public function execute(): \Magento\Framework\Controller\Result\Redirect + public function execute() { $id = (int)$this->getRequest()->getParam('id'); $code = (string)$this->getRequest()->getParam('code'); diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index eb87f303b84d2..117783495406a 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -7,11 +7,11 @@ use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; -use Magento\Framework\Exception\MailException; -use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\MailException; +use Magento\Framework\Exception\NoSuchEntityException; /** * Subscriber model @@ -31,6 +31,7 @@ * @method int getSubscriberId() * @method Subscriber setSubscriberId(int $value) * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @@ -402,6 +403,7 @@ public function loadByCustomerId($customerId) $this->setSubscriberConfirmCode($this->randomSequence()); $this->save(); } + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock } catch (NoSuchEntityException $e) { } return $this; @@ -493,7 +495,9 @@ public function subscribe($email) $this->sendConfirmationSuccessEmail(); } return $this->getStatus(); + // phpcs:ignore Magento2.Exceptions.ThrowCatch } catch (\Exception $e) { + // phpcs:ignore Magento2.Exceptions.DirectThrow throw new \Exception($e->getMessage()); } } @@ -559,7 +563,7 @@ public function updateSubscription($customerId) * * @param int $customerId * @param bool $subscribe indicates whether the customer should be subscribed or unsubscribed - * @return $this + * @return $this * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) From 40cc415a21ddc38dc5f410698c830c2918628891 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 5 Jun 2019 15:38:41 +0300 Subject: [PATCH 414/464] magento/magento2#23007: Code demarcation standard fix. --- app/code/Magento/Ui/view/base/web/js/form/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/form.js b/app/code/Magento/Ui/view/base/web/js/form/form.js index bf27cbbb7660f..3692108675bc7 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/form.js +++ b/app/code/Magento/Ui/view/base/web/js/form/form.js @@ -339,7 +339,7 @@ define([ */ reset: function () { this.source.trigger('data.reset'); - $('._has-datepicker').val(''); + $('[data-bind*=datepicker]').val(''); }, /** From d06fb10173f5080090c9983ed6b9f3f106788313 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 6 Jun 2019 14:38:53 +0300 Subject: [PATCH 415/464] magento/magento2#21131: Static test fix. --- .../Test/Unit/Model/Category/FileInfoTest.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php index f9c77cc624e11..6c6a69ec39c85 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -9,11 +9,14 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\File\Mime; use Magento\Framework\Filesystem; -use Magento\Framework\Filesystem\Directory\WriteInterface; use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\Filesystem\Directory\WriteInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +/** + * Test for Magento\Catalog\Model\Category\FileInfo class. + */ class FileInfoTest extends TestCase { /** @@ -66,12 +69,14 @@ protected function setUp() ->willReturn($this->mediaDirectory); $this->filesystem->method('getDirectoryRead') - ->willReturnCallback(function ($arg) use ($baseDirectory, $pubDirectory) { - if ($arg === DirectoryList::PUB) { - return $pubDirectory; + ->willReturnCallback( + function ($arg) use ($baseDirectory, $pubDirectory) { + if ($arg === DirectoryList::PUB) { + return $pubDirectory; + } + return $baseDirectory; } - return $baseDirectory; - }); + ); $this->mime = $this->getMockBuilder(Mime::class) ->disableOriginalConstructor() From 1d2b8f2e3d5b33f53a6e7d3e885a360280cb8cad Mon Sep 17 00:00:00 2001 From: Maria Kovdrysh <kovdrysh@adobe.com> Date: Thu, 6 Jun 2019 11:49:04 -0500 Subject: [PATCH 416/464] MC-11438: There is no XSS vulnerability if Create Order with sample email Resolved conflicts --- SECURITY.md | 10 + .../templates/system/messages/popup.phtml | 2 +- .../system/config/testconnection.phtml | 8 +- .../view/frontend/templates/search_data.phtml | 6 +- .../Model/AuthorizenetDataProvider.php | 62 + .../Magento/AuthorizenetGraphQl/README.md | 3 + .../Magento/AuthorizenetGraphQl/composer.json | 25 + .../AuthorizenetGraphQl/etc/graphql/di.xml | 16 + .../AuthorizenetGraphQl/etc/module.xml | 10 + .../AuthorizenetGraphQl/etc/schema.graphqls | 12 + .../AuthorizenetGraphQl/registration.php | 10 + .../Section/AdminSlideOutDialogSection.xml | 2 +- .../Widget/Grid/Column/Filter/TextTest.php | 15 +- .../Magento/Braintree/Block/Paypal/Button.php | 30 +- .../Braintree/Gateway/Config/Config.php | 25 +- .../Request/VaultThreeDSecureDataBuilder.php | 55 + .../Model/Multishipping/PlaceOrder.php | 5 + .../Model/Paypal/Helper/QuoteUpdater.php | 12 +- .../Braintree/Model/Ui/ConfigProvider.php | 5 +- .../Model/Paypal/Helper/QuoteUpdaterTest.php | 28 +- .../Test/Unit/Model/Ui/ConfigProviderTest.php | 6 +- .../Braintree/etc/adminhtml/system.xml | 8 - app/code/Magento/Braintree/etc/config.xml | 3 +- app/code/Magento/Braintree/etc/di.xml | 3 +- .../view/adminhtml/web/js/braintree.js | 184 +- .../view/frontend/requirejs-config.js | 14 +- .../templates/multishipping/form.phtml | 2 +- .../frontend/templates/paypal/button.phtml | 23 +- .../view/frontend/web/js/paypal/button.js | 154 +- .../frontend/web/js/view/payment/3d-secure.js | 169 +- .../frontend/web/js/view/payment/adapter.js | 71 +- .../frontend/web/js/view/payment/braintree.js | 2 +- .../frontend/web/js/view/payment/kount.js | 61 + .../view/payment/method-renderer/cc-form.js | 482 +- .../payment/method-renderer/hosted-fields.js | 171 - .../{hosted-fields.js => cc-form.js} | 32 +- .../method-renderer/multishipping/paypal.js | 74 +- .../js/view/payment/method-renderer/paypal.js | 260 +- .../js/view/payment/method-renderer/vault.js | 12 +- .../web/js/view/payment/validator-handler.js | 58 +- .../frontend/web/template/payment/form.html | 2 +- .../template/payment/multishipping/form.html | 2 +- .../payment/multishipping/paypal.html | 1 + .../frontend/web/template/payment/paypal.html | 10 +- .../AdminOrderBundleProductActionGroup.xml | 23 + .../AdminOrderBundleProductSection.xml | 14 + .../AdminDeleteBundleDynamicProductTest.xml | 3 + .../product/edit/tab/attributes/extend.phtml | 26 +- .../composite/fieldset/options/bundle.phtml | 11 +- .../fieldset/options/type/checkbox.phtml | 48 +- .../fieldset/options/type/multi.phtml | 38 +- .../fieldset/options/type/radio.phtml | 68 +- .../fieldset/options/type/select.phtml | 55 +- .../templates/product/edit/bundle.phtml | 20 +- .../product/edit/bundle/option.phtml | 83 +- .../edit/bundle/option/selection.phtml | 88 +- .../creditmemo/create/items/renderer.phtml | 151 +- .../creditmemo/view/items/renderer.phtml | 91 +- .../sales/invoice/create/items/renderer.phtml | 146 +- .../sales/invoice/view/items/renderer.phtml | 91 +- .../sales/order/view/items/renderer.phtml | 155 +- .../shipment/create/items/renderer.phtml | 75 +- .../sales/shipment/view/items/renderer.phtml | 75 +- .../templates/product/price/final_price.phtml | 62 +- .../product/price/selection/amount.phtml | 5 +- .../templates/product/price/tier_prices.phtml | 7 +- .../catalog/product/view/backbutton.phtml | 2 +- .../catalog/product/view/customize.phtml | 7 +- .../catalog/product/view/options/notice.phtml | 2 +- .../catalog/product/view/summary.phtml | 25 +- .../catalog/product/view/type/bundle.phtml | 16 +- .../view/type/bundle/option/checkbox.phtml | 39 +- .../view/type/bundle/option/multi.phtml | 39 +- .../view/type/bundle/option/radio.phtml | 59 +- .../view/type/bundle/option/select.phtml | 61 +- .../product/view/type/bundle/options.phtml | 31 +- .../order/items/creditmemo/default.phtml | 44 +- .../email/order/items/invoice/default.phtml | 44 +- .../email/order/items/order/default.phtml | 46 +- .../email/order/items/shipment/default.phtml | 46 +- .../frontend/templates/js/components.phtml | 4 +- .../order/creditmemo/items/renderer.phtml | 66 +- .../sales/order/invoice/items/renderer.phtml | 60 +- .../sales/order/items/renderer.phtml | 70 +- .../sales/order/shipment/items/renderer.phtml | 52 +- .../Adminhtml/Product/Edit/AttributeSet.php | 9 +- .../Product/Edit/Tab/Attributes/Search.php | 9 +- .../Magento/Catalog/Block/Product/Gallery.php | 24 +- .../Catalog/Block/Product/ListProduct.php | 2 +- .../Magento/Catalog/Block/Product/View.php | 13 +- .../Catalog/Block/Product/View/Gallery.php | 22 +- .../ResourceModel/Product/Collection.php | 90 +- .../Model/ResourceModel/Product/Option.php | 248 +- .../AdminAnchorCategoryActionGroup.xml | 29 + ...ignCategoryToProductAndSaveActionGroup.xml | 24 + .../AdminProductGridActionGroup.xml | 2 +- ...ignCategoryOnProductAndSaveActionGroup.xml | 22 + .../ActionGroup/CustomOptionsActionGroup.xml | 4 +- .../StorefrontCategoryActionGroup.xml | 7 + .../StorefrontGoToCategoryPageActionGroup.xml | 27 + .../Mftf/Data/CatalogAttributeGroupData.xml | 17 + .../Catalog/Test/Mftf/Data/ProductData.xml | 3 + .../Section/AdminCategoryProductsSection.xml | 1 + .../AdminProductAttributeSetEditSection.xml | 7 + .../Mftf/Section/AdminProductFormSection.xml | 4 + .../AdminAddImageToWYSIWYGProductTest.xml | 14 +- ...AdminCreateNewGroupForAttributeSetTest.xml | 111 + .../AdminMoveProductBetweenCategoriesTest.xml | 227 + ...egoryIndexerInUpdateOnScheduleModeTest.xml | 314 + app/code/Magento/Catalog/etc/acl.xml | 5 +- .../catalog/category/checkboxes/tree.phtml | 1 - .../templates/catalog/category/edit.phtml | 6 +- .../category/edit/assign_products.phtml | 4 +- .../templates/catalog/category/tree.phtml | 47 +- .../catalog/category/widget/tree.phtml | 33 +- .../form/renderer/fieldset/element.phtml | 47 +- .../adminhtml/templates/catalog/product.phtml | 3 - .../catalog/product/attribute/form.phtml | 10 +- .../catalog/product/attribute/js.phtml | 19 +- .../catalog/product/attribute/labels.phtml | 18 +- .../catalog/product/attribute/options.phtml | 24 +- .../catalog/product/attribute/set/main.phtml | 39 +- .../product/attribute/set/toolbar/add.phtml | 2 +- .../product/attribute/set/toolbar/main.phtml | 3 - .../catalog/product/composite/configure.phtml | 7 +- .../product/composite/fieldset/options.phtml | 24 +- .../fieldset/options/type/date.phtml | 132 +- .../fieldset/options/type/file.phtml | 45 +- .../fieldset/options/type/select.phtml | 11 +- .../fieldset/options/type/text.phtml | 29 +- .../product/composite/fieldset/qty.phtml | 7 +- .../templates/catalog/product/edit.phtml | 37 +- .../product/edit/action/attribute.phtml | 11 +- .../product/edit/action/inventory.phtml | 208 +- .../product/edit/action/websites.phtml | 48 +- .../catalog/product/edit/attribute_set.phtml | 6 +- .../product/edit/category/new/form.phtml | 2 +- .../catalog/product/edit/options.phtml | 7 +- .../catalog/product/edit/options/option.phtml | 84 +- .../product/edit/options/type/date.phtml | 8 +- .../product/edit/options/type/file.phtml | 45 +- .../product/edit/options/type/select.phtml | 14 +- .../product/edit/options/type/text.phtml | 10 +- .../catalog/product/edit/price/tier.phtml | 76 +- .../catalog/product/edit/serializer.phtml | 9 +- .../catalog/product/edit/websites.phtml | 41 +- .../catalog/product/helper/gallery.phtml | 212 +- .../templates/catalog/product/js.phtml | 12 +- .../templates/catalog/product/tab/alert.phtml | 4 +- .../catalog/product/tab/inventory.phtml | 734 +- .../product/edit/attribute/search.phtml | 16 +- .../templates/product/edit/tabs.phtml | 65 +- .../product/edit/tabs/child_tab.phtml | 4 +- .../product/grid/massaction_extended.phtml | 45 +- .../adminhtml/templates/rss/grid/link.phtml | 6 +- .../view/base/templates/js/components.phtml | 3 - .../fieldset/options/view/checkable.phtml | 71 +- .../product/price/amount/default.phtml | 31 +- .../templates/product/price/default.phtml | 5 +- .../templates/product/price/final_price.phtml | 25 +- .../templates/product/price/tier_prices.phtml | 66 +- .../frontend/templates/category/cms.phtml | 5 +- .../templates/category/description.phtml | 13 +- .../frontend/templates/category/image.phtml | 19 +- .../templates/category/products.phtml | 5 +- .../frontend/templates/category/rss.phtml | 8 +- .../category/widget/link/link_block.phtml | 4 +- .../category/widget/link/link_href.phtml | 1 - .../category/widget/link/link_inline.phtml | 4 +- .../templates/frontend_storage_manager.phtml | 8 +- .../messages/addCompareSuccessMessage.phtml | 12 +- .../frontend/templates/navigation/left.phtml | 24 +- .../templates/product/compare/link.phtml | 8 +- .../templates/product/compare/list.phtml | 108 +- .../templates/product/compare/sidebar.phtml | 22 +- .../frontend/templates/product/gallery.phtml | 52 +- .../frontend/templates/product/image.phtml | 10 +- .../product/image_with_borders.phtml | 16 +- .../frontend/templates/product/list.phtml | 77 +- .../product/list/addto/compare.phtml | 5 +- .../templates/product/list/items.phtml | 205 +- .../templates/product/list/toolbar.phtml | 15 +- .../product/list/toolbar/amount.phtml | 35 +- .../product/list/toolbar/limiter.phtml | 18 +- .../product/list/toolbar/sorter.phtml | 32 +- .../product/list/toolbar/viewmode.phtml | 56 +- .../frontend/templates/product/listing.phtml | 131 +- .../templates/product/view/additional.phtml | 7 +- .../templates/product/view/addto.phtml | 2 - .../product/view/addto/compare.phtml | 8 +- .../templates/product/view/addtocart.phtml | 16 +- .../templates/product/view/attribute.phtml | 20 +- .../templates/product/view/attributes.phtml | 12 +- .../templates/product/view/counter.phtml | 2 +- .../templates/product/view/description.phtml | 8 +- .../templates/product/view/details.phtml | 32 +- .../templates/product/view/form.phtml | 22 +- .../templates/product/view/gallery.phtml | 30 +- .../templates/product/view/mailto.phtml | 9 +- .../product/view/opengraph/currency.phtml | 5 +- .../product/view/opengraph/general.phtml | 15 +- .../templates/product/view/options.phtml | 8 +- .../product/view/options/type/date.phtml | 31 +- .../product/view/options/type/default.phtml | 3 - .../product/view/options/type/file.phtml | 47 +- .../product/view/options/type/select.phtml | 13 +- .../product/view/options/type/text.phtml | 47 +- .../product/view/options/wrapper.phtml | 6 +- .../templates/product/view/price_clone.phtml | 3 - .../templates/product/view/review.phtml | 3 - .../templates/product/view/type/default.phtml | 17 +- .../product/widget/compared/grid.phtml | 12 +- .../product/widget/compared/list.phtml | 10 +- .../product/widget/compared/sidebar.phtml | 10 +- .../product/widget/link/link_block.phtml | 4 +- .../product/widget/link/link_inline.phtml | 4 +- .../widget/new/column/new_default_list.phtml | 63 +- .../widget/new/column/new_images_list.phtml | 16 +- .../widget/new/column/new_names_list.phtml | 20 +- .../product/widget/new/content/new_grid.phtml | 100 +- .../product/widget/new/content/new_list.phtml | 104 +- .../product/widget/viewed/grid.phtml | 9 +- .../product/widget/viewed/list.phtml | 9 +- .../product/widget/viewed/sidebar.phtml | 10 +- .../Model/Import/Product.php | 379 +- .../Test/AdminExportBundleProductTest.xml | 1 + ...portGroupedProductWithSpecialPriceTest.xml | 1 + ...figurableProductsWithCustomOptionsTest.xml | 1 + ...igurableProductsWithAssignedImagesTest.xml | 1 + ...ableProductAssignedToCustomWebsiteTest.xml | 1 + ...rtSimpleProductWithCustomAttributeTest.xml | 1 + .../frontend/templates/qtyincrements.phtml | 4 +- .../templates/stockqty/composite.phtml | 24 +- .../frontend/templates/stockqty/default.phtml | 8 +- .../Model/Indexer/IndexBuilder.php | 180 +- .../Indexer/RuleProductPricesPersistor.php | 30 +- ...GroupOnCatalogPriceRuleFormActionGroup.xml | 18 + ...NewCatalogPriceRuleFormPageActionGroup.xml | 2 +- .../CatalogPriceRuleActionGroup.xml | 21 + .../Page/AdminCatalogPriceRuleGridPage.xml | 14 + ...ewPage.xml => AdminNewCatalogRulePage.xml} | 3 +- .../AdminCatalogPriceRuleGridSection.xml | 15 + .../Unit/Model/Indexer/IndexBuilderTest.php | 47 +- .../Indexer/Fulltext/Action/DataProvider.php | 16 +- .../frontend/templates/advanced/form.phtml | 111 +- .../frontend/templates/advanced/link.phtml | 8 +- .../frontend/templates/advanced/result.phtml | 31 +- .../view/frontend/templates/result.phtml | 29 +- .../frontend/templates/search_terms_log.phtml | 5 +- .../Model/ProductUrlPathGenerator.php | 65 +- .../Model/ProductUrlPathGeneratorTest.php | 18 +- .../Model/Layout/AbstractTotalsProcessor.php | 7 +- .../Model/PaymentInformationManagement.php | 6 + ...pingCartSummaryWithShippingActionGroup.xml | 5 +- ...eckoutFillNewBillingAddressActionGroup.xml | 2 +- ...ginAsCustomerOnCheckoutPageActionGroup.xml | 2 +- ...reFrontCheckoutShippingPageActionGroup.xml | 14 + ...frontCheckoutCustomerSignInActionGroup.xml | 22 - .../Checkout/Test/Mftf/Data/ConfigData.xml | 84 + .../Section/CheckoutCartProductSection.xml | 2 +- .../CheckoutShippingMethodsSection.xml | 1 + ...sNotAffectedStartedCheckoutProcessTest.xml | 102 + ...eCheckoutAsCustomerUsingNewAddressTest.xml | 2 +- ...utAsCustomerUsingNonDefaultAddressTest.xml | 2 +- .../OnePageCheckoutUsingSignInLinkTest.xml | 2 +- ...OnePageCheckoutWithAllProductTypesTest.xml | 2 +- ...BundleDynamicProductToShoppingCartTest.xml | 5 +- ...pingCartWithDisableMiniCartSidebarTest.xml | 5 +- ...dConfigurableProductToShoppingCartTest.xml | 10 +- ...dDownloadableProductToShoppingCartTest.xml | 2 +- ...ontAddGroupedProductToShoppingCartTest.xml | 4 +- ...MultiSelectOptionToTheShoppingCartTest.xml | 5 +- ...ultiSelectOptionsToTheShoppingCartTest.xml | 5 +- ...isplayWithDefaultDisplayLimitationTest.xml | 2 +- ...edToTheCartThanDefaultDisplayLimitTest.xml | 2 +- ...rtItemDisplayWithDefaultLimitationTest.xml | 2 +- .../Test/StorefrontCustomerCheckoutTest.xml | 2 +- ...eBundleProductFromMiniShoppingCartTest.xml | 2 +- ...oadableProductFromMiniShoppingCartTest.xml | 2 +- ...tGuestCheckoutForSpecificCountriesTest.xml | 98 + ...rontRefreshPageDuringGuestCheckoutTest.xml | 65 + .../PaymentInformationManagementTest.php | 28 +- .../view/frontend/templates/button.phtml | 7 +- .../view/frontend/templates/cart.phtml | 2 + .../templates/cart/additional/info.phtml | 3 +- .../view/frontend/templates/cart/coupon.phtml | 34 +- .../view/frontend/templates/cart/form.phtml | 40 +- .../cart/item/configure/updatecart.phtml | 14 +- .../templates/cart/item/default.phtml | 79 +- .../templates/cart/item/price/sidebar.phtml | 10 +- .../cart/item/renderer/actions/edit.phtml | 10 +- .../cart/item/renderer/actions/remove.phtml | 6 +- .../frontend/templates/cart/methods.phtml | 22 +- .../frontend/templates/cart/minicart.phtml | 18 +- .../frontend/templates/cart/noItems.phtml | 16 +- .../frontend/templates/cart/shipping.phtml | 29 +- .../view/frontend/templates/cart/totals.phtml | 2 +- .../frontend/templates/item/price/row.phtml | 6 +- .../frontend/templates/item/price/unit.phtml | 6 +- .../frontend/templates/js/components.phtml | 2 - .../messages/addCartSuccessMessage.phtml | 2 +- .../view/frontend/templates/onepage.phtml | 14 +- .../frontend/templates/onepage/failure.phtml | 17 +- .../frontend/templates/onepage/link.phtml | 18 +- .../templates/onepage/review/item.phtml | 51 +- .../review/item/price/row_excl_tax.phtml | 4 +- .../review/item/price/row_incl_tax.phtml | 6 +- .../review/item/price/unit_excl_tax.phtml | 6 +- .../review/item/price/unit_incl_tax.phtml | 6 +- .../frontend/templates/registration.phtml | 7 +- .../frontend/templates/shipping/price.phtml | 4 +- .../view/frontend/templates/success.phtml | 12 +- .../frontend/templates/total/default.phtml | 39 +- .../frontend/web/js/view/payment/default.js | 15 +- .../templates/additional_agreements.phtml | 2 - .../view/frontend/templates/agreements.phtml | 44 +- .../templates/multishipping_agreements.phtml | 44 +- .../Cms/Controller/Adminhtml/Page/Index.php | 15 +- app/code/Magento/Cms/Model/Block.php | 6 +- app/code/Magento/Cms/Model/Page.php | 14 +- .../Cms/Test/Mftf/Data/WysiwygConfigData.xml | 31 + .../GeneralConfigurationActionGroup.xml | 6 +- .../AdminCatalogSearchConfigurationPage.xml | 1 + ...atalogSearchEngineConfigurationSection.xml | 15 + ...minOrderConfigurableProductActionGroup.xml | 22 + .../Section/AdminNewAttributePanelSection.xml | 4 +- ...bleProductPriceAdditionalStoreViewTest.xml | 2 +- .../product/attribute/new/created.phtml | 2 +- .../catalog/product/attribute/set/js.phtml | 2 - .../composite/fieldset/configurable.phtml | 28 +- .../attribute/steps/attributes_values.phtml | 34 +- .../product/edit/attribute/steps/bulk.phtml | 196 +- .../attribute/steps/select_attributes.phtml | 6 +- .../edit/attribute/steps/summary.phtml | 6 +- .../catalog/product/edit/super/config.phtml | 20 +- .../catalog/product/edit/super/matrix.phtml | 41 +- .../product/edit/super/wizard-ajax.phtml | 2 - .../catalog/product/edit/super/wizard.phtml | 8 +- .../form.phtml | 2 - .../affected-attribute-set-selector/js.phtml | 14 +- .../configurable/attribute-selector/js.phtml | 8 +- .../templates/product/price/final_price.phtml | 31 +- .../templates/product/price/tier_price.phtml | 1 - .../frontend/templates/js/components.phtml | 3 - .../view/type/options/configurable.phtml | 25 +- .../Controller/Account/CreatePost.php | 24 +- ...CustomerGroupOnCustomerFormActionGroup.xml | 18 + ...tCustomerGroupOnProductFormActionGroup.xml | 21 + ...tCustomerGroupPresentInGridActionGroup.xml | 14 + ...eCustomerGroupAlreadyExistsActionGroup.xml | 15 + .../AssertCustomerLoggedInActionGroup.xml | 1 + ...ssertRegistrationPageFieldsActionGroup.xml | 19 + .../Customer/Test/Mftf/Data/CustomerData.xml | 10 + .../StorefrontCustomerSignInFormSection.xml | 1 + ...inCreateCustomerGroupAlreadyExistsTest.xml | 39 + .../AdminCreateRetailCustomerGroupTest.xml | 71 + .../AdminCreateTaxClassCustomerGroupTest.xml | 58 + ...dminExactMatchSearchInCustomerGridTest.xml | 47 + ...CountriesRestrictionApplyOnBackendTest.xml | 2 +- .../customer_account_forgotpassword.xml | 2 +- .../Magento/Deploy/Service/DeployPackage.php | 8 +- .../ResourceModel/Country/Collection.php | 53 +- .../ResourceModel/Country/CollectionTest.php | 9 +- .../composite/fieldset/downloadable.phtml | 64 +- .../templates/product/edit/downloadable.phtml | 12 +- .../product/edit/downloadable/links.phtml | 92 +- .../product/edit/downloadable/samples.phtml | 38 +- .../column/downloadable/creditmemo/name.phtml | 44 +- .../column/downloadable/invoice/name.phtml | 47 +- .../items/column/downloadable/name.phtml | 49 +- .../templates/catalog/product/links.phtml | 39 +- .../templates/catalog/product/samples.phtml | 6 +- .../templates/catalog/product/type.phtml | 14 +- .../frontend/templates/checkout/success.phtml | 7 +- .../templates/customer/products/list.phtml | 41 +- .../order/items/creditmemo/downloadable.phtml | 23 +- .../order/items/invoice/downloadable.phtml | 25 +- .../order/items/order/downloadable.phtml | 36 +- .../frontend/templates/js/components.phtml | 3 - .../items/renderer/downloadable.phtml | 28 +- .../invoice/items/renderer/downloadable.phtml | 26 +- .../order/items/renderer/downloadable.phtml | 50 +- .../adminhtml/templates/giftoptionsform.phtml | 11 +- .../view/adminhtml/templates/popup.phtml | 7 +- .../sales/order/create/giftoptions.phtml | 15 +- .../templates/sales/order/create/items.phtml | 13 +- .../sales/order/view/giftoptions.phtml | 44 +- .../templates/sales/order/view/items.phtml | 36 +- .../templates/cart/gift_options.phtml | 4 +- .../item/renderer/actions/gift_options.phtml | 12 +- .../view/frontend/templates/inline.phtml | 233 +- .../AdminOrderGroupedProductActionGroup.xml | 21 + .../product/composite/fieldset/grouped.phtml | 64 +- .../templates/product/grouped/grouped.phtml | 6 +- .../templates/product/grouped/list.phtml | 10 +- .../templates/product/price/final_price.phtml | 6 +- .../templates/product/view/type/default.phtml | 17 +- .../templates/product/view/type/grouped.phtml | 50 +- .../view/adminhtml/templates/busy.phtml | 4 +- .../templates/export/form/after.phtml | 12 +- .../templates/export/form/before.phtml | 2 +- .../templates/import/form/after.phtml | 4 +- .../templates/import/form/before.phtml | 12 +- .../templates/import/frame/result.phtml | 2 +- ...witchAllIndexerToActionModeActionGroup.xml | 23 + ...inSwitchIndexerToActionModeActionGroup.xml | 22 + .../Section/AdminIndexManagementSection.xml | 1 + .../integration/popup_container.phtml | 2 +- .../frontend/templates/layer/filter.phtml | 33 +- .../view/frontend/templates/layer/state.phtml | 33 +- .../view/frontend/templates/layer/view.phtml | 26 +- .../system/storage/media/synchronize.phtml | 17 +- .../Magento/Msrp/Pricing/Price/MsrpPrice.php | 2 + .../Magento/Msrp/Pricing/Render/PriceBox.php | 12 + .../base/templates/product/price/msrp.phtml | 2 +- .../templates/checkout/address/select.phtml | 8 +- .../templates/checkout/addresses.phtml | 12 +- .../frontend/templates/checkout/billing.phtml | 34 +- .../templates/checkout/billing/items.phtml | 20 +- .../templates/checkout/item/default.phtml | 17 +- .../frontend/templates/checkout/link.phtml | 4 +- .../templates/checkout/overview.phtml | 2 + .../templates/checkout/overview/item.phtml | 12 +- .../templates/checkout/shipping.phtml | 89 +- .../frontend/templates/checkout/state.phtml | 8 +- .../frontend/templates/js/components.phtml | 2 - .../multishipping/item/default.phtml | 17 +- .../frontend/web/js/view/payment/iframe.js | 18 +- app/code/Magento/Paypal/Model/Express.php | 22 +- app/code/Magento/Paypal/Model/Pro.php | 22 +- ...figPaymentsConflictResolutionForPayPal.xml | 12 +- .../Test/PayPalSmartButtonInCheckoutPage.xml | 2 +- .../Paypal/Test/Unit/Model/ExpressTest.php | 52 +- .../templates/express/shortcut_button.phtml | 2 +- .../method-renderer/payflowpro-method.js | 5 +- .../PaypalExpressAdditionalDataProvider.php | 47 + .../Resolver/SetPaymentMethodOnCart.php | 137 + .../PaypalGraphQl/Model/Provider/Checkout.php | 69 + .../PaypalGraphQl/Model/Provider/Config.php | 65 + .../Model/Resolver/PaypalExpressToken.php | 155 + app/code/Magento/PaypalGraphQl/README.md | 3 + app/code/Magento/PaypalGraphQl/composer.json | 31 + .../Magento/PaypalGraphQl/etc/graphql/di.xml | 39 + app/code/Magento/PaypalGraphQl/etc/module.xml | 16 + .../Magento/PaypalGraphQl/etc/schema.graphqls | 46 + .../Magento/PaypalGraphQl/registration.php | 9 + ...stentRegistrationPageFieldsActionGroup.xml | 14 + .../StorefrontCustomerActionGroup.xml | 14 + ...ssertCustomerWelcomeMessageActionGroup.xml | 23 + .../Test/Mftf/Data/PersistentData.xml | 57 + .../Mftf/Metadata/persistent_config-meta.xml | 32 +- ...omeMessageAfterCustomerIsLoggedOutTest.xml | 4 +- ...CartPersistenceUnderLongTermCookieTest.xml | 159 + .../StorefrontProductInfoMainSection.xml | 8 +- .../adminhtml/templates/helper/gallery.phtml | 206 +- .../templates/product/edit/base_image.phtml | 30 +- .../product/edit/slideout/form.phtml | 14 +- .../templates/product/view/gallery.phtml | 4 +- .../Magento/Quote/Model/QuoteManagement.php | 121 +- .../Model/QuoteRepository/SaveHandler.php | 20 +- .../Quote/Model/SubmitQuoteValidator.php | 71 + .../Test/Unit/Model/QuoteManagementTest.php | 97 +- .../AdditionalDataProviderInterface.php | 22 + .../Payment/AdditionalDataProviderPool.php | 44 + .../Model/Resolver/SetPaymentMethodOnCart.php | 22 +- .../Magento/QuoteGraphQl/etc/schema.graphqls | 4 + .../Mftf/Section/OrderReportMainSection.xml | 4 +- .../Magento/Review/Block/Customer/View.php | 23 +- .../Compare/ListCompare/Plugin/Review.php | 58 - .../Review/Block/Product/ReviewRenderer.php | 31 +- app/code/Magento/Review/Block/View.php | 20 +- .../Model/ResourceModel/Review/Summary.php | 43 + app/code/Magento/Review/Model/Review.php | 11 +- .../Magento/Review/Model/ReviewSummary.php | 52 + ...kProductCollectionBeforeToHtmlObserver.php | 49 - ...tCollectionAppendSummaryFieldsObserver.php | 62 + .../TagProductCollectionLoadAfterObserver.php | 41 - .../Test/Unit/Model/ReviewSummaryTest.php | 94 + .../Review/Test/Unit/Model/ReviewTest.php | 5 +- app/code/Magento/Review/etc/frontend/di.xml | 3 - .../Magento/Review/etc/frontend/events.xml | 5 +- .../Order/Create/Shipping/Address.php | 12 + .../Adminhtml/Order/AddressSave.php | 19 +- .../Adminhtml/Order/Create/Index.php | 2 +- .../Magento/Sales/Model/AdminOrder/Create.php | 9 +- .../Sales/Model/Order/AddressRepository.php | 77 +- .../Sales/Model/Service/InvoiceService.php | 184 +- .../Sales/Model/Service/OrderService.php | 38 +- .../ActionGroup/AdminInvoiceActionGroup.xml | 1 + .../Sales/Test/Mftf/Data/OrderData.xml | 5 + .../Page/StorefrontOrderInformationPage.xml | 2 +- .../Page/StorefrontOrdersAndReturnsPage.xml | 2 +- .../Section/AdminOrderFormAccountSection.xml | 1 + .../AdminOrderFormItemsOrderedSection.xml | 1 + ...efrontOrderAndReturnInformationSection.xml | 4 +- .../StorefrontOrderInformationMainSection.xml | 4 +- .../Test/AdminReorderWithCatalogPriceTest.xml | 70 + ...dminSaveInAddressBookCheckboxStateTest.xml | 68 + .../Model/Order/AddressRepositoryTest.php | 292 +- .../Unit/Model/Service/OrderServiceTest.php | 13 +- app/code/Magento/Sales/etc/db_schema.xml | 2 +- .../adminhtml/web/order/create/scripts.js | 24 +- ...merGroupOnCartPriceRuleFormActionGroup.xml | 18 + app/code/Magento/SalesRule/etc/db_schema.xml | 2 +- ...archSuggestionByProductDescriptionTest.xml | 3 + .../view/frontend/templates/form.mini.phtml | 20 +- .../Search/view/frontend/templates/term.phtml | 15 +- ...latRateShippingMethodStatusActionGroup.xml | 21 + ...enShippingMethodsConfigPageActionGroup.xml | 15 + ...rtStoreFrontNoQuotesMessageActionGroup.xml | 15 + ...rontShippingMethodAvailableActionGroup.xml | 18 + ...ntShippingMethodUnavailableActionGroup.xml | 18 + .../AdminShippingMethodFlatRateSection.xml} | 4 +- .../adminhtml/templates/create/form.phtml | 32 +- .../adminhtml/templates/create/items.phtml | 49 +- .../create/items/renderer/default.phtml | 25 +- .../templates/order/packaging/grid.phtml | 58 +- .../templates/order/packaging/packed.phtml | 111 +- .../templates/order/packaging/popup.phtml | 21 +- .../order/packaging/popup_content.phtml | 118 +- .../adminhtml/templates/order/tracking.phtml | 17 +- .../templates/order/tracking/view.phtml | 42 +- .../adminhtml/templates/order/view/info.phtml | 29 +- .../view/adminhtml/templates/view/form.phtml | 23 +- .../view/adminhtml/templates/view/items.phtml | 23 +- .../view/items/renderer/default.phtml | 5 +- .../view/frontend/templates/items.phtml | 129 +- .../frontend/templates/order/shipment.phtml | 4 +- .../frontend/templates/tracking/details.phtml | 23 +- .../frontend/templates/tracking/link.phtml | 18 +- .../frontend/templates/tracking/popup.phtml | 22 +- .../templates/tracking/progress.phtml | 18 +- app/code/Magento/Store/Model/StoreManager.php | 2 +- .../Store/Model/StoreManagerInterface.php | 2 +- .../catalog/product/attribute/js.phtml | 5 +- .../catalog/product/attribute/text.phtml | 37 +- .../catalog/product/attribute/visual.phtml | 29 +- .../attribute/steps/attributes_values.phtml | 28 +- .../templates/product/layered/renderer.phtml | 69 +- .../templates/product/listing/renderer.phtml | 20 +- .../templates/product/view/renderer.phtml | 14 +- .../view/frontend/web/js/swatch-renderer.js | 2 +- .../adminhtml/templates/items/price/row.phtml | 24 +- .../templates/items/price/total.phtml | 5 +- .../templates/items/price/unit.phtml | 23 +- .../order/create/items/price/row.phtml | 21 +- .../order/create/items/price/total.phtml | 19 +- .../order/create/items/price/unit.phtml | 21 +- .../view/adminhtml/templates/rate/form.phtml | 3 - .../view/adminhtml/templates/rate/js.phtml | 5 +- .../view/adminhtml/templates/rate/title.phtml | 19 +- .../view/adminhtml/templates/rule/edit.phtml | 34 +- .../adminhtml/templates/rule/rate/form.phtml | 3 +- .../templates/toolbar/class/add.phtml | 6 +- .../templates/toolbar/class/save.phtml | 17 +- .../templates/toolbar/rate/add.phtml | 3 - .../templates/toolbar/rate/save.phtml | 62 +- .../templates/toolbar/rule/add.phtml | 6 +- .../templates/toolbar/rule/save.phtml | 17 +- .../base/templates/pricing/adjustment.phtml | 13 +- .../templates/pricing/adjustment/bundle.phtml | 19 +- .../checkout/cart/item/price/sidebar.phtml | 14 +- .../templates/checkout/grandtotal.phtml | 62 +- .../templates/checkout/shipping.phtml | 44 +- .../templates/checkout/shipping/price.phtml | 27 +- .../templates/checkout/subtotal.phtml | 34 +- .../frontend/templates/checkout/tax.phtml | 60 +- .../templates/email/items/price/row.phtml | 21 +- .../frontend/templates/item/price/row.phtml | 14 +- .../item/price/total_after_discount.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 15 +- .../view/frontend/templates/order/tax.phtml | 49 +- .../adminhtml/templates/importExport.phtml | 36 +- app/code/Magento/Theme/Block/Html/Topmenu.php | 149 +- app/code/Magento/Theme/i18n/en_US.csv | 1 + .../adminhtml/templates/browser/content.phtml | 3 +- .../templates/browser/content/files.phtml | 22 +- .../templates/browser/content/uploader.phtml | 11 +- .../templates/design/config/edit/scope.phtml | 6 +- .../view/adminhtml/templates/tabs/css.phtml | 5 +- .../templates/tabs/fieldset/js.phtml | 10 +- .../view/adminhtml/templates/tabs/js.phtml | 5 +- .../view/adminhtml/templates/title.phtml | 10 +- .../Theme/view/base/templates/root.phtml | 19 +- .../templates/callouts/left_col.phtml | 21 +- .../templates/callouts/right_col.phtml | 21 +- .../templates/html/absolute_footer.phtml | 2 +- .../view/frontend/templates/html/block.phtml | 11 +- .../frontend/templates/html/breadcrumbs.phtml | 12 +- .../frontend/templates/html/bugreport.phtml | 6 +- .../frontend/templates/html/collapsible.phtml | 15 +- .../frontend/templates/html/container.phtml | 5 +- .../frontend/templates/html/copyright.phtml | 2 +- .../view/frontend/templates/html/footer.phtml | 9 +- .../view/frontend/templates/html/header.phtml | 55 +- .../frontend/templates/html/header/logo.phtml | 16 +- .../frontend/templates/html/notices.phtml | 20 +- .../view/frontend/templates/html/pager.phtml | 101 +- .../frontend/templates/html/sections.phtml | 38 +- .../view/frontend/templates/html/skip.phtml | 8 +- .../frontend/templates/html/skiptarget.phtml | 4 +- .../view/frontend/templates/html/title.phtml | 23 +- .../frontend/templates/html/topmenu.phtml | 13 +- .../view/frontend/templates/js/calendar.phtml | 33 +- .../frontend/templates/js/components.phtml | 5 +- .../view/frontend/templates/js/cookie.phtml | 9 +- .../Theme/view/frontend/templates/link.phtml | 8 +- .../templates/page/js/require_js.phtml | 2 +- .../view/frontend/templates/template.phtml | 1 + .../Theme/view/frontend/templates/text.phtml | 14 +- .../themes/advanced/js/source_editor.js | 5 +- .../Translation/Model/Js/PreProcessor.php | 4 +- .../Test/Unit/Model/Js/PreProcessorTest.php | 85 - app/code/Magento/Translation/etc/di.xml | 4 +- .../templates/control/button/default.phtml | 8 +- .../base/templates/control/button/split.phtml | 22 +- .../Ui/view/base/templates/form/default.phtml | 13 +- .../view/base/templates/label/default.phtml | 2 +- .../base/templates/layout/tabs/default.phtml | 3 +- .../templates/layout/tabs/nav/default.phtml | 3 +- .../Ui/view/base/templates/logger.phtml | 8 +- .../Ui/view/base/templates/stepswizard.phtml | 34 +- .../templates/wysiwyg/active_editor.phtml | 7 +- .../view/adminhtml/templates/categories.phtml | 2 +- .../Api/PaymentTokenManagementInterface.php | 4 +- .../adminhtml/templates/items/price/row.phtml | 41 +- .../templates/items/price/total.phtml | 5 +- .../templates/items/price/unit.phtml | 41 +- .../order/create/items/price/row.phtml | 47 +- .../order/create/items/price/total.phtml | 50 +- .../order/create/items/price/unit.phtml | 47 +- .../adminhtml/templates/renderer/tax.phtml | 65 +- .../base/templates/pricing/adjustment.phtml | 38 +- .../checkout/cart/item/price/sidebar.phtml | 54 +- .../review/item/price/row_excl_tax.phtml | 28 +- .../review/item/price/row_incl_tax.phtml | 30 +- .../review/item/price/unit_excl_tax.phtml | 29 +- .../review/item/price/unit_incl_tax.phtml | 30 +- .../templates/email/items/price/row.phtml | 45 +- .../frontend/templates/item/price/row.phtml | 62 +- .../item/price/total_after_discount.phtml | 4 +- .../frontend/templates/item/price/unit.phtml | 62 +- app/code/Magento/Wishlist/Helper/Data.php | 17 +- .../Wishlist/Test/Mftf/Data/WishlistData.xml | 4 +- .../web/css/source/_module.less | 2 +- .../layout/customer_account.xml | 52 +- .../templates/layer/state.phtml | 22 +- composer.json | 2 + composer.lock | 2 +- .../TestFramework/TestCase/GraphQl/Client.php | 7 +- .../Magento/Quote/Api/CartAddingItemsTest.php | 95 + .../Magento/Quote/Api/CartManagementTest.php | 10 +- .../Quote/Api/GuestCartAddingItemsTest.php | 120 + .../Braintree/Test/Block/Form/BraintreeCc.php | 6 - .../Catalog/Test/Block/Product/View.php | 19 + .../AssertProductInventoryMaxAllowedQty.php | 4 +- .../AssertProductInventoryMinAllowedQty.php | 2 +- .../CreateSimpleProductEntityPartOneTest.xml | 1 - .../Test/TestCase/UpdateTaxRuleEntityTest.xml | 1 - dev/tests/integration/framework/bootstrap.php | 18 +- .../framework/deployTestModules.php | 41 +- dev/tests/integration/phpunit.xml.dist | 1 + .../PlaceOrderWithAuthorizeNetTest.php | 183 + ...SetAuthorizeNetPaymentMethodOnCartTest.php | 115 + .../Guest/PlaceOrderWithAuthorizeNetTest.php | 175 + ...SetAuthorizeNetPaymentMethodOnCartTest.php | 107 + .../add_simple_products_authorizenet.php | 28 + .../_files/request_authorize.php | 65 + .../_files/request_authorize_customer.php | 65 + .../_files/response_authorize.php | 47 + .../set_new_billing_address_authorizenet.php | 44 + .../set_new_shipping_address_authorizenet.php | 43 + .../_files/simple_product_authorizenet.php | 47 + .../simple_product_authorizenet_rollback.php | 8 + .../Catalog/Model/Product/OptionTest.php | 43 + .../ResourceModel/Product/CollectionTest.php | 17 + .../product_simple_with_non_latin_url_key.php | 63 + ...simple_with_non_latin_url_key_rollback.php | 37 + ...roduct_without_options_with_stock_data.php | 30 + ...thout_options_with_stock_data_rollback.php | 26 + .../Model/Import/ProductTest.php | 79 +- ...ucts_to_import_with_non_latin_url_keys.csv | 5 + .../Customer/_files/customer_one_address.php | 78 + .../_files/customer_one_address_rollback.php | 34 + .../GetMaskedQuoteIdByReservedOrderId.php | 64 + .../_files/enable_offline_payment_methods.php | 1 + ...nable_offline_payment_methods_rollback.php | 1 + .../Magento/PaypalGraphQl/AbstractTest.php | 203 + .../PaypalExpressSetPaymentMethodTest.php | 247 + .../Customer/PaypalExpressTokenTest.php | 129 + .../PaypalExpressSetPaymentMethodTest.php | 238 + .../Resolver/Guest/PaypalExpressTokenTest.php | 232 + .../customer_paypal_create_token_request.php | 56 + .../guest_paypal_create_token_request.php | 56 + .../_files/paypal_place_order_request.php | 57 + .../_files/paypal_set_payer_id_repsonse.php | 35 + .../Fixtures/quote_without_customer_email.php | 28 + .../Quote/Model/QuoteManagementTest.php | 29 + .../Model/Order/AddressRepositoryTest.php | 56 +- .../Model/Service/InvoiceServiceTest.php | 94 + .../order_address_with_multi_attribute.php | 100 + ..._address_with_multi_attribute_rollback.php | 62 + .../Sales/_files/order_with_bundle.php | 10 +- .../_files/core_second_third_fixturestore.php | 4 +- .../Translation/Model/Js/PreProcessorTest.php | 189 + .../frontend/js/paypal/button.test.js | 93 - .../payment/method-renderer/cc-form.test.js | 112 - .../payment/method-renderer/paypal.test.js | 120 - .../Rule/Design/AllPurposeAction.php | 4 + .../_files/whitelist/exempt_modules/ce.php | 51 - .../Framework/App/Test/Unit/BootstrapTest.php | 9 + .../Framework/Data/Collection/AbstractDb.php | 8 +- .../Filter/Test/Unit/TranslitTest.php | 7 +- .../Filter/Test/Unit/TranslitUrlTest.php | 7 +- .../Magento/Framework/Filter/Translit.php | 12 +- .../Model/ResourceModel/Db/AbstractDb.php | 3 +- .../Mview/Test/Unit/View/ChangelogTest.php | 19 +- lib/internal/Magento/Framework/Mview/View.php | 2 +- .../Framework/Mview/View/Changelog.php | 29 +- .../Framework/Pricing/Render/PriceBox.php | 42 +- .../Pricing/Test/Unit/Render/PriceBoxTest.php | 13 - .../Framework/Setup/Patch/PatchApplier.php | 35 +- .../Schema/Db/SchemaBuilderTest.php | 2 +- .../Unserialize/Test/Unit/UnserializeTest.php | 9 + .../Framework/View/Element/AbstractBlock.php | 17 +- .../DataProvider/FulltextFilter.php | 3 +- .../Test/Unit/Element/AbstractBlockTest.php | 29 +- .../View/Test/Unit/Element/MessagesTest.php | 26 +- .../View/Test/Unit/TemplateEngine/PhpTest.php | 8 +- lib/web/mage/adminhtml/grid.js | 50 +- lib/web/mage/trim-input.js | 13 +- lib/web/mage/validation.js | 18 +- setup/performance-toolkit/README.md | 210 +- setup/performance-toolkit/benchmark.jmx | 25977 +++++++++++++++- 734 files changed, 42151 insertions(+), 9066 deletions(-) create mode 100644 SECURITY.md create mode 100644 app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php create mode 100644 app/code/Magento/AuthorizenetGraphQl/README.md create mode 100644 app/code/Magento/AuthorizenetGraphQl/composer.json create mode 100644 app/code/Magento/AuthorizenetGraphQl/etc/graphql/di.xml create mode 100644 app/code/Magento/AuthorizenetGraphQl/etc/module.xml create mode 100644 app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls create mode 100644 app/code/Magento/AuthorizenetGraphQl/registration.php create mode 100644 app/code/Magento/Braintree/Gateway/Request/VaultThreeDSecureDataBuilder.php create mode 100644 app/code/Magento/Braintree/view/frontend/web/js/view/payment/kount.js delete mode 100644 app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js rename app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/{hosted-fields.js => cc-form.js} (66%) create mode 100644 app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml create mode 100644 app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml rename app/code/Magento/CatalogRule/Test/Mftf/Page/{CatalogRuleNewPage.xml => AdminNewCatalogRulePage.xml} (65%) create mode 100644 app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml delete mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCustomerSignInActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml create mode 100644 app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml create mode 100644 app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml create mode 100644 app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AdminOrderGroupedProductActionGroup.xml create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml create mode 100644 app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml create mode 100644 app/code/Magento/PaypalGraphQl/Model/PaypalExpressAdditionalDataProvider.php create mode 100644 app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php create mode 100644 app/code/Magento/PaypalGraphQl/Model/Provider/Checkout.php create mode 100644 app/code/Magento/PaypalGraphQl/Model/Provider/Config.php create mode 100644 app/code/Magento/PaypalGraphQl/Model/Resolver/PaypalExpressToken.php create mode 100644 app/code/Magento/PaypalGraphQl/README.md create mode 100644 app/code/Magento/PaypalGraphQl/composer.json create mode 100644 app/code/Magento/PaypalGraphQl/etc/graphql/di.xml create mode 100644 app/code/Magento/PaypalGraphQl/etc/module.xml create mode 100644 app/code/Magento/PaypalGraphQl/etc/schema.graphqls create mode 100644 app/code/Magento/PaypalGraphQl/registration.php create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontAssertPersistentRegistrationPageFieldsActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontPersistentAssertCustomerWelcomeMessageActionGroup.xml create mode 100644 app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml create mode 100644 app/code/Magento/Quote/Model/SubmitQuoteValidator.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Payment/AdditionalDataProviderInterface.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Payment/AdditionalDataProviderPool.php delete mode 100644 app/code/Magento/Review/Block/Product/Compare/ListCompare/Plugin/Review.php create mode 100644 app/code/Magento/Review/Model/ReviewSummary.php delete mode 100644 app/code/Magento/Review/Observer/CatalogBlockProductCollectionBeforeToHtmlObserver.php create mode 100644 app/code/Magento/Review/Observer/CatalogProductListCollectionAppendSummaryFieldsObserver.php delete mode 100644 app/code/Magento/Review/Observer/TagProductCollectionLoadAfterObserver.php create mode 100644 app/code/Magento/Review/Test/Unit/Model/ReviewSummaryTest.php create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceTest.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCartPriceRuleFormActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminChangeFlatRateShippingMethodStatusActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AdminOpenShippingMethodsConfigPageActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontNoQuotesMessageActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodAvailableActionGroup.xml create mode 100644 app/code/Magento/Shipping/Test/Mftf/ActionGroup/AssertStoreFrontShippingMethodUnavailableActionGroup.xml rename app/code/Magento/{Theme/Test/Mftf/Section/StorefrontFooterSection.xml => Shipping/Test/Mftf/Section/AdminShippingMethodFlatRateSection.xml} (56%) delete mode 100644 app/code/Magento/Translation/Test/Unit/Model/Js/PreProcessorTest.php create mode 100644 dev/tests/api-functional/testsuite/Magento/Quote/Api/CartAddingItemsTest.php create mode 100644 dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/add_simple_products_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/request_authorize_customer.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/response_authorize.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_billing_address_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/set_new_shipping_address_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php create mode 100644 dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_non_latin_url_key.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_non_latin_url_key_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_without_options_with_stock_data_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_with_non_latin_url_keys.csv create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_one_address_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Quote/GetMaskedQuoteIdByReservedOrderId.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/AbstractTest.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressTokenTest.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressTokenTest.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/_files/customer_paypal_create_token_request.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/_files/guest_paypal_create_token_request.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/_files/paypal_place_order_request.php create mode 100644 dev/tests/integration/testsuite/Magento/PaypalGraphQl/_files/paypal_set_payer_id_repsonse.php create mode 100644 dev/tests/integration/testsuite/Magento/Quote/Fixtures/quote_without_customer_email.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_address_with_multi_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_address_with_multi_attribute_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Translation/Model/Js/PreProcessorTest.php delete mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/paypal/button.test.js delete mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js delete mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js delete mode 100644 dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000000..2b06199e5f95a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,10 @@ +# Reporting Security Issues + +Magento values the contributions of the security research community, and we look forward to working with you to minimize risk to Magento merchants. + +## Where should I report security issues? + +We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/magento). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps. + +## Learning More About Security +To learn more about securing a Magento store, please visit the [Security Center](https://magento.com/security). diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index 0448daaf17644..37548e1599004 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -27,4 +27,4 @@ } } } -</script> \ No newline at end of file +</script> diff --git a/app/code/Magento/AdvancedSearch/view/adminhtml/templates/system/config/testconnection.phtml b/app/code/Magento/AdvancedSearch/view/adminhtml/templates/system/config/testconnection.phtml index ae202cbfaf442..71697d2fd0bc2 100644 --- a/app/code/Magento/AdvancedSearch/view/adminhtml/templates/system/config/testconnection.phtml +++ b/app/code/Magento/AdvancedSearch/view/adminhtml/templates/system/config/testconnection.phtml @@ -6,10 +6,10 @@ // @codingStandardsIgnoreFile ?> <button class="scalable" type="button" id="<?= $block->getHtmlId() ?>" data-mage-init='{"testConnection":{ - "url": "<?= /* @escapeNotVerified */ $block->getAjaxUrl() ?>", + "url": "<?= $block->escapeUrl($block->getAjaxUrl()) ?>", "elementId": "<?= $block->getHtmlId() ?>", - "successText": "<?= /* @escapeNotVerified */ __('Successful! Test again?') ?>", - "failedText": "<?= /* @escapeNotVerified */ __('Connection failed! Test again?') ?>", - "fieldMapping": "<?= /* @escapeNotVerified */ $block->getFieldMapping() ?>"}, "validation": {}}'> + "successText": "<?= $block->escapeHtmlAttr(__('Successful! Test again?')) ?>", + "failedText": "<?= $block->escapeHtmlAttr(__('Connection failed! Test again?')) ?>", + "fieldMapping": "<?= /* @noEscape */ $block->getFieldMapping() ?>"}, "validation": {}}'> <span><span><span id="<?= $block->getHtmlId() ?>_result"><?= $block->escapeHtml($block->getButtonLabel()) ?></span></span></span> </button> diff --git a/app/code/Magento/AdvancedSearch/view/frontend/templates/search_data.phtml b/app/code/Magento/AdvancedSearch/view/frontend/templates/search_data.phtml index 6e660555053a1..053670ca19dac 100644 --- a/app/code/Magento/AdvancedSearch/view/frontend/templates/search_data.phtml +++ b/app/code/Magento/AdvancedSearch/view/frontend/templates/search_data.phtml @@ -13,13 +13,13 @@ $data = $block->getItems(); if (count($data)):?> <dl class="block"> - <dt class="title"><?= /* @escapeNotVerified */ __($block->getTitle()) ?></dt> + <dt class="title"><?= $block->escapeHtml(__($block->getTitle())) ?></dt> <?php foreach ($data as $additionalInfo) : ?> <dd class="item"> - <a href="<?= /* @escapeNotVerified */ $block->getLink($additionalInfo->getQueryText()) ?>" + <a href="<?= $block->escapeUrl($block->getLink($additionalInfo->getQueryText())) ?>" ><?= $block->escapeHtml($additionalInfo->getQueryText()) ?></a> <?php if ($block->isShowResultsCount()): ?> - <span class="count"><?= /* @escapeNotVerified */ $additionalInfo->getResultsCount() ?></span> + <span class="count"><?= /* @noEscape */ (int)$additionalInfo->getResultsCount() ?></span> <?php endif; ?> </dd> <?php endforeach; ?> diff --git a/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php b/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php new file mode 100644 index 0000000000000..1f8baa266f32f --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\AuthorizenetGraphQl\Model; + +use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface; +use Magento\Framework\Stdlib\ArrayManager; +use Magento\Framework\GraphQL\DataObjectConverter; + +/** + * DataProvider Model for Authorizenet + */ +class AuthorizenetDataProvider implements AdditionalDataProviderInterface +{ + private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data/authorizenet_acceptjs'; + + /** + * @var ArrayManager + */ + private $arrayManager; + + /** + * AuthorizenetDataProvider constructor. + * @param ArrayManager $arrayManager + */ + public function __construct( + ArrayManager $arrayManager + ) { + $this->arrayManager = $arrayManager; + } + + /** + * Return additional data + * + * @param array $args + * @return array + */ + public function getData(array $args): array + { + $additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $args) ?? []; + foreach ($additionalData as $key => $value) { + $additionalData[$this->snakeCaseToCamelCase($key)] = $value; + unset($additionalData[$key]); + } + return $additionalData; + } + + /** + * Converts an input string from snake_case to camelCase. + * + * @param string $input + * @return string + */ + private function snakeCaseToCamelCase($input) + { + return lcfirst(str_replace('_', '', ucwords($input, '_'))); + } +} diff --git a/app/code/Magento/AuthorizenetGraphQl/README.md b/app/code/Magento/AuthorizenetGraphQl/README.md new file mode 100644 index 0000000000000..8b920e569341f --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/README.md @@ -0,0 +1,3 @@ +# AuthorizenetGraphQl + + **AuthorizenetGraphQl** defines the data types needed to pass payment information data from the client to Magento. diff --git a/app/code/Magento/AuthorizenetGraphQl/composer.json b/app/code/Magento/AuthorizenetGraphQl/composer.json new file mode 100644 index 0000000000000..6adf11ff72b5a --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/composer.json @@ -0,0 +1,25 @@ +{ + "name": "magento/module-authorizenet-graph-ql", + "description": "N/A", + "type": "magento2-module", + "require": { + "php": "~7.1.3||~7.2.0", + "magento/framework": "*", + "magento/module-quote-graph-ql": "*" + }, + "suggest": { + "magento/module-graph-ql": "*" + }, + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\AuthorizenetGraphQl\\": "" + } + } +} diff --git a/app/code/Magento/AuthorizenetGraphQl/etc/graphql/di.xml b/app/code/Magento/AuthorizenetGraphQl/etc/graphql/di.xml new file mode 100644 index 0000000000000..e8ea45091c044 --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/etc/graphql/di.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderPool"> + <arguments> + <argument name="dataProviders" xsi:type="array"> + <item name="authorizenet_acceptjs" xsi:type="object">Magento\AuthorizenetGraphQl\Model\AuthorizenetDataProvider</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/AuthorizenetGraphQl/etc/module.xml b/app/code/Magento/AuthorizenetGraphQl/etc/module.xml new file mode 100644 index 0000000000000..85a780a881975 --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/etc/module.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> + <module name="Magento_AuthorizenetGraphQl"/> +</config> diff --git a/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls b/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls new file mode 100644 index 0000000000000..1d724bbde3c5d --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls @@ -0,0 +1,12 @@ +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + +input PaymentMethodAdditionalDataInput { + authorizenet_acceptjs: AuthorizenetInput @doc(description: "Defines the required attributes for Authorize.Net payments") +} + +input AuthorizenetInput { + opaque_data_descriptor: String! @doc(description: "Authorize.Net's description of the transaction request") + opaque_data_value: String! @doc(description: "The nonce returned by Authorize.Net") + cc_last_4: Int! @doc(description: "The last four digits of the credit or debit card") +} \ No newline at end of file diff --git a/app/code/Magento/AuthorizenetGraphQl/registration.php b/app/code/Magento/AuthorizenetGraphQl/registration.php new file mode 100644 index 0000000000000..2e50f9fe92aaa --- /dev/null +++ b/app/code/Magento/AuthorizenetGraphQl/registration.php @@ -0,0 +1,10 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AuthorizenetGraphQl', __DIR__); diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml index a01e025ba3dca..2f799721a8cef 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminSlideOutDialogSection"> - <element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/> + <element name="closeButton" type="button" selector=".modal-slide._show [data-role="closeBtn"]" timeout="30"/> <element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/> <element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/> <element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/> diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php index 1bf23649e2ea8..5aa8cf7a0c579 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/TextTest.php @@ -8,6 +8,9 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Unit test for \Magento\Backend\Block\Widget\Grid\Column\Filter\Text + */ class TextTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\Backend\Block\Widget\Grid\Column\Filter\Text*/ @@ -31,7 +34,10 @@ protected function setUp() ->setMethods(['getEscaper']) ->disableOriginalConstructor() ->getMock(); - $this->escaper = $this->createPartialMock(\Magento\Framework\Escaper::class, ['escapeHtml']); + $this->escaper = $this->createPartialMock( + \Magento\Framework\Escaper::class, + ['escapeHtml', 'escapeHtmlAttr'] + ); $this->helper = $this->createMock(\Magento\Framework\DB\Helper::class); $this->context->expects($this->once())->method('getEscaper')->willReturn($this->escaper); @@ -60,6 +66,13 @@ public function testGetHtml() $this->block->setColumn($column); $this->escaper->expects($this->any())->method('escapeHtml')->willReturn('escapedHtml'); + $this->escaper->expects($this->once()) + ->method('escapeHtmlAttr') + ->willReturnCallback( + function ($string) { + return $string; + } + ); $column->expects($this->any())->method('getId')->willReturn('id'); $column->expects($this->once())->method('getHtmlId')->willReturn('htmlId'); diff --git a/app/code/Magento/Braintree/Block/Paypal/Button.php b/app/code/Magento/Braintree/Block/Paypal/Button.php index efd9e473699c3..fe829cf9f1fdd 100644 --- a/app/code/Magento/Braintree/Block/Paypal/Button.php +++ b/app/code/Magento/Braintree/Block/Paypal/Button.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Braintree\Block\Paypal; use Magento\Braintree\Gateway\Config\PayPal\Config; @@ -49,8 +51,6 @@ class Button extends Template implements ShortcutInterface private $payment; /** - * Constructor - * * @param Context $context * @param ResolverInterface $localeResolver * @param Session $checkoutSession @@ -98,6 +98,8 @@ public function getAlias() } /** + * Returns container id. + * * @return string */ public function getContainerId() @@ -106,6 +108,8 @@ public function getContainerId() } /** + * Returns locale. + * * @return string */ public function getLocale() @@ -114,6 +118,8 @@ public function getLocale() } /** + * Returns currency. + * * @return string */ public function getCurrency() @@ -122,6 +128,8 @@ public function getCurrency() } /** + * Returns amount. + * * @return float */ public function getAmount() @@ -130,6 +138,8 @@ public function getAmount() } /** + * Returns if is active. + * * @return bool */ public function isActive() @@ -139,6 +149,8 @@ public function isActive() } /** + * Returns merchant name. + * * @return string */ public function getMerchantName() @@ -147,6 +159,8 @@ public function getMerchantName() } /** + * Returns client token. + * * @return string|null */ public function getClientToken() @@ -155,10 +169,22 @@ public function getClientToken() } /** + * Returns action success. + * * @return string */ public function getActionSuccess() { return $this->getUrl(ConfigProvider::CODE . '/paypal/review', ['_secure' => true]); } + + /** + * Gets environment value. + * + * @return string + */ + public function getEnvironment(): string + { + return $this->configProvider->getConfig()['payment'][ConfigProvider::CODE]['environment']; + } } diff --git a/app/code/Magento/Braintree/Gateway/Config/Config.php b/app/code/Magento/Braintree/Gateway/Config/Config.php index 2089a9646ae94..905b802061aa6 100644 --- a/app/code/Magento/Braintree/Gateway/Config/Config.php +++ b/app/code/Magento/Braintree/Gateway/Config/Config.php @@ -30,7 +30,6 @@ class Config extends \Magento\Payment\Gateway\Config\Config const KEY_VERIFY_SPECIFIC = 'verify_specific_countries'; const VALUE_3DSECURE_ALL = 0; const CODE_3DSECURE = 'three_d_secure'; - const KEY_KOUNT_MERCHANT_ID = 'kount_id'; const FRAUD_PROTECTION = 'fraudprotection'; /** @@ -173,6 +172,7 @@ public function get3DSecureSpecificCountries($storeId = null) /** * Gets value of configured environment. + * * Possible values: production or sandbox. * * @param int|null $storeId @@ -183,17 +183,6 @@ public function getEnvironment($storeId = null) return $this->getValue(Config::KEY_ENVIRONMENT, $storeId); } - /** - * Gets Kount merchant ID. - * - * @param int|null $storeId - * @return string - */ - public function getKountMerchantId($storeId = null) - { - return $this->getValue(Config::KEY_KOUNT_MERCHANT_ID, $storeId); - } - /** * Gets merchant ID. * @@ -217,6 +206,8 @@ public function getMerchantAccountId($storeId = null) } /** + * Returns SDK url. + * * @return string */ public function getSdkUrl() @@ -224,6 +215,16 @@ public function getSdkUrl() return $this->getValue(Config::KEY_SDK_URL); } + /** + * Gets Hosted Fields SDK Url + * + * @return string + */ + public function getHostedFieldsSdkUrl(): string + { + return $this->getValue('hosted_fields_sdk_url'); + } + /** * Checks if fraud protection is enabled. * diff --git a/app/code/Magento/Braintree/Gateway/Request/VaultThreeDSecureDataBuilder.php b/app/code/Magento/Braintree/Gateway/Request/VaultThreeDSecureDataBuilder.php new file mode 100644 index 0000000000000..5441067b9d813 --- /dev/null +++ b/app/code/Magento/Braintree/Gateway/Request/VaultThreeDSecureDataBuilder.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Braintree\Gateway\Request; + +use Magento\Braintree\Gateway\SubjectReader; +use Magento\Payment\Gateway\Request\BuilderInterface; + +/** + * Since we can't validate 3Dsecure for sequence multishipping orders based on vault tokens, + * we skip 3D secure verification for vault transactions. + * For common vault transaction original 3d secure verification builder is called. + */ +class VaultThreeDSecureDataBuilder implements BuilderInterface +{ + /** + * @var ThreeDSecureDataBuilder + */ + private $threeDSecureDataBuilder; + + /** + * @var SubjectReader + */ + private $subjectReader; + + /** + * Constructor + * + * @param ThreeDSecureDataBuilder $threeDSecureDataBuilder + * @param SubjectReader $subjectReader + */ + public function __construct( + ThreeDSecureDataBuilder $threeDSecureDataBuilder, + SubjectReader $subjectReader + ) { + $this->threeDSecureDataBuilder = $threeDSecureDataBuilder; + $this->subjectReader = $subjectReader; + } + + /** + * @inheritdoc + */ + public function build(array $buildSubject) + { + $paymentDO = $this->subjectReader->readPayment($buildSubject); + $payment = $paymentDO->getPayment(); + if ($payment->getAdditionalInformation('is_multishipping')) { + return []; + } + + return $this->threeDSecureDataBuilder->build($buildSubject); + } +} diff --git a/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php b/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php index a6c1b088400a7..a95d7a922f9bd 100644 --- a/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php +++ b/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php @@ -8,6 +8,7 @@ namespace Magento\Braintree\Model\Multishipping; use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand; +use Magento\Braintree\Gateway\Config\Config; use Magento\Braintree\Model\Ui\ConfigProvider; use Magento\Braintree\Observer\DataAssignObserver; use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PaypalConfigProvider; @@ -118,6 +119,10 @@ private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTok PaymentTokenInterface::CUSTOMER_ID, $customerId ); + $orderPayment->setAdditionalInformation( + 'is_multishipping', + 1 + ); } /** diff --git a/app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php b/app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php index ae2b1b1423640..197b398380f74 100644 --- a/app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php +++ b/app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php @@ -173,14 +173,14 @@ private function updateBillingAddress(Quote $quote, array $details) */ private function updateAddressData(Address $address, array $addressData) { - $extendedAddress = isset($addressData['extendedAddress']) - ? $addressData['extendedAddress'] + $extendedAddress = isset($addressData['line2']) + ? $addressData['line2'] : null; - $address->setStreet([$addressData['streetAddress'], $extendedAddress]); - $address->setCity($addressData['locality']); - $address->setRegionCode($addressData['region']); - $address->setCountryId($addressData['countryCodeAlpha2']); + $address->setStreet([$addressData['line1'], $extendedAddress]); + $address->setCity($addressData['city']); + $address->setRegionCode($addressData['state']); + $address->setCountryId($addressData['countryCode']); $address->setPostcode($addressData['postalCode']); // PayPal's address supposes not saving against customer account diff --git a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php index 928769498a035..ab23037b4e98e 100644 --- a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php @@ -13,6 +13,8 @@ /** * Class ConfigProvider + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class ConfigProvider implements ConfigProviderInterface { @@ -72,11 +74,11 @@ public function getConfig() 'clientToken' => $this->getClientToken(), 'ccTypesMapper' => $this->config->getCcTypesMapper(), 'sdkUrl' => $this->config->getSdkUrl(), + 'hostedFieldsSdkUrl' => $this->config->getHostedFieldsSdkUrl(), 'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig($storeId), 'availableCardTypes' => $this->config->getAvailableCardTypes($storeId), 'useCvv' => $this->config->isCvvEnabled($storeId), 'environment' => $this->config->getEnvironment($storeId), - 'kountMerchantId' => $this->config->getKountMerchantId($storeId), 'hasFraudProtection' => $this->config->hasFraudProtection($storeId), 'merchantId' => $this->config->getMerchantId($storeId), 'ccVaultCode' => self::CC_VAULT_CODE, @@ -92,6 +94,7 @@ public function getConfig() /** * Generate a new client token if necessary + * * @return string */ public function getClientToken() diff --git a/app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/QuoteUpdaterTest.php b/app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/QuoteUpdaterTest.php index c2678d1c78437..ec716732b114e 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/QuoteUpdaterTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/QuoteUpdaterTest.php @@ -159,21 +159,21 @@ private function getDetails(): array 'phone' => '312-123-4567', 'countryCode' => 'US', 'shippingAddress' => [ - 'streetAddress' => '123 Division Street', - 'extendedAddress' => 'Apt. #1', - 'locality' => 'Chicago', - 'region' => 'IL', + 'line1' => '123 Division Street', + 'line2' => 'Apt. #1', + 'city' => 'Chicago', + 'state' => 'IL', 'postalCode' => '60618', - 'countryCodeAlpha2' => 'US', + 'countryCode' => 'US', 'recipientName' => 'Jane Smith', ], 'billingAddress' => [ - 'streetAddress' => '123 Billing Street', - 'extendedAddress' => 'Apt. #1', - 'locality' => 'Chicago', - 'region' => 'IL', + 'line1' => '123 Billing Street', + 'line2' => 'Apt. #1', + 'city' => 'Chicago', + 'state' => 'IL', 'postalCode' => '60618', - 'countryCodeAlpha2' => 'US', + 'countryCode' => 'US', ], ]; } @@ -206,13 +206,13 @@ private function updateShippingAddressStep(array $details): void private function updateAddressDataStep(MockObject $address, array $addressData): void { $address->method('setStreet') - ->with([$addressData['streetAddress'], $addressData['extendedAddress']]); + ->with([$addressData['line1'], $addressData['line2']]); $address->method('setCity') - ->with($addressData['locality']); + ->with($addressData['city']); $address->method('setRegionCode') - ->with($addressData['region']); + ->with($addressData['state']); $address->method('setCountryId') - ->with($addressData['countryCodeAlpha2']); + ->with($addressData['countryCode']); $address->method('setPostcode') ->with($addressData['postalCode']); } diff --git a/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php index 24bc4eae960be..55bc2cb195d6e 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Braintree\Test\Unit\Model\Ui; use Magento\Braintree\Gateway\Config\Config; @@ -124,6 +126,7 @@ public function getConfigDataProvider() 'isActive' => true, 'getCcTypesMapper' => ['visa' => 'VI', 'american-express'=> 'AE'], 'getSdkUrl' => self::SDK_URL, + 'getHostedFieldsSdkUrl' => 'https://sdk.com/test.js', 'getCountrySpecificCardTypeConfig' => [ 'GB' => ['VI', 'AE'], 'US' => ['DI', 'JCB'] @@ -134,7 +137,6 @@ public function getConfigDataProvider() 'getThresholdAmount' => 20, 'get3DSecureSpecificCountries' => ['GB', 'US', 'CA'], 'getEnvironment' => 'test-environment', - 'getKountMerchantId' => 'test-kount-merchant-id', 'getMerchantId' => 'test-merchant-id', 'hasFraudProtection' => true, ], @@ -145,6 +147,7 @@ public function getConfigDataProvider() 'clientToken' => self::CLIENT_TOKEN, 'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'], 'sdkUrl' => self::SDK_URL, + 'hostedFieldsSdkUrl' => 'https://sdk.com/test.js', 'countrySpecificCardTypes' =>[ 'GB' => ['VI', 'AE'], 'US' => ['DI', 'JCB'] @@ -152,7 +155,6 @@ public function getConfigDataProvider() 'availableCardTypes' => ['AE', 'VI', 'MC', 'DI', 'JCB'], 'useCvv' => true, 'environment' => 'test-environment', - 'kountMerchantId' => 'test-kount-merchant-id', 'merchantId' => 'test-merchant-id', 'hasFraudProtection' => true, 'ccVaultCode' => ConfigProvider::CC_VAULT_CODE diff --git a/app/code/Magento/Braintree/etc/adminhtml/system.xml b/app/code/Magento/Braintree/etc/adminhtml/system.xml index 67c47f8ea9dc3..bd4346e095c6d 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/system.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/system.xml @@ -95,14 +95,6 @@ <comment>Be sure to Enable Advanced Fraud Protection in Your Braintree Account in Settings/Processing Section</comment> <config_path>payment/braintree/fraudprotection</config_path> </field> - <field id="kount_id" translate="label comment" sortOrder="35" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Kount Merchant ID</label> - <comment><![CDATA[Used for direct fraud tool integration. Make sure you also contact <a href="mailto:accounts@braintreepayments.com">accounts@braintreepayments.com</a> to setup your Kount account.]]></comment> - <depends> - <field id="fraudprotection">1</field> - </depends> - <config_path>payment/braintree/kount_id</config_path> - </field> <field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Debug</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/Braintree/etc/config.xml b/app/code/Magento/Braintree/etc/config.xml index fe4cfab9c0e30..522d32302168e 100644 --- a/app/code/Magento/Braintree/etc/config.xml +++ b/app/code/Magento/Braintree/etc/config.xml @@ -34,7 +34,8 @@ <order_status>processing</order_status> <environment>sandbox</environment> <allowspecific>0</allowspecific> - <sdk_url><![CDATA[https://js.braintreegateway.com/js/braintree-2.32.0.min.js]]></sdk_url> + <sdk_url><![CDATA[https://js.braintreegateway.com/web/3.44.1/js/client.min.js]]></sdk_url> + <hosted_fields_sdk_url><![CDATA[https://js.braintreegateway.com/web/3.44.1/js/hosted-fields.min.js]]></hosted_fields_sdk_url> <public_key backend_model="Magento\Config\Model\Config\Backend\Encrypted" /> <private_key backend_model="Magento\Config\Model\Config\Backend\Encrypted" /> <masked_fields>cvv,number</masked_fields> diff --git a/app/code/Magento/Braintree/etc/di.xml b/app/code/Magento/Braintree/etc/di.xml index b81513caf17a2..6f8b7d1d6c368 100644 --- a/app/code/Magento/Braintree/etc/di.xml +++ b/app/code/Magento/Braintree/etc/di.xml @@ -288,7 +288,7 @@ <item name="payment" xsi:type="string">Magento\Braintree\Gateway\Request\PaymentDataBuilder</item> <item name="channel" xsi:type="string">Magento\Braintree\Gateway\Request\ChannelDataBuilder</item> <item name="address" xsi:type="string">Magento\Braintree\Gateway\Request\AddressDataBuilder</item> - <item name="3dsecure" xsi:type="string">Magento\Braintree\Gateway\Request\ThreeDSecureDataBuilder</item> + <item name="3dsecure" xsi:type="string">Magento\Braintree\Gateway\Request\VaultThreeDSecureDataBuilder</item> <item name="device_data" xsi:type="string">Magento\Braintree\Gateway\Request\KountPaymentDataBuilder</item> <item name="dynamic_descriptor" xsi:type="string">Magento\Braintree\Gateway\Request\DescriptorDataBuilder</item> <item name="store" xsi:type="string">Magento\Braintree\Gateway\Request\StoreConfigBuilder</item> @@ -614,7 +614,6 @@ <item name="payment/braintree/merchant_id" xsi:type="string">1</item> <item name="payment/braintree/private_key" xsi:type="string">1</item> <item name="payment/braintree/merchant_account_id" xsi:type="string">1</item> - <item name="payment/braintree/kount_id" xsi:type="string">1</item> <item name="payment/braintree_paypal/merchant_name_override" xsi:type="string">1</item> <item name="payment/braintree/descriptor_phone" xsi:type="string">1</item> <item name="payment/braintree/descriptor_url" xsi:type="string">1</item> diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js index ab01565d7f1e5..0359c16283d50 100644 --- a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js +++ b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js @@ -22,9 +22,16 @@ define([ container: 'payment_form_braintree', active: false, scriptLoaded: false, - braintree: null, + braintreeClient: null, + braintreeHostedFields: null, + hostedFieldsInstance: null, selectedCardType: null, - checkout: null, + selectorsMapper: { + 'expirationMonth': 'expirationMonth', + 'expirationYear': 'expirationYear', + 'number': 'cc_number', + 'cvv': 'cc_cid' + }, imports: { onActiveChange: 'active' } @@ -108,9 +115,10 @@ define([ state = self.scriptLoaded; $('body').trigger('processStart'); - require([this.sdkUrl], function (braintree) { + require([this.sdkUrl, this.hostedFieldsSdkUrl], function (client, hostedFields) { state(true); - self.braintree = braintree; + self.braintreeClient = client; + self.braintreeHostedFields = hostedFields; self.initBraintree(); $('body').trigger('processStop'); }); @@ -146,46 +154,26 @@ define([ _initBraintree: function () { var self = this; - this.disableEventListeners(); - - if (self.checkout) { - self.checkout.teardown(function () { - self.checkout = null; - }); - } - - self.braintree.setup(self.clientToken, 'custom', { - id: self.selector, - hostedFields: self.getHostedFields(), - - /** - * Triggered when sdk was loaded - */ - onReady: function (checkout) { - self.checkout = checkout; - $('body').trigger('processStop'); + self.disableEventListeners(); + + self.braintreeClient.create({ + authorization: self.clientToken + }) + .then(function (clientInstance) { + return self.braintreeHostedFields.create({ + client: clientInstance, + fields: self.getHostedFields() + }); + }) + .then(function (hostedFieldsInstance) { + self.hostedFieldsInstance = hostedFieldsInstance; self.enableEventListeners(); - }, - - /** - * Callback for success response - * @param {Object} response - */ - onPaymentMethodReceived: function (response) { - if (self.validateCardType()) { - self.setPaymentDetails(response.nonce); - self.placeOrder(); - } - }, - - /** - * Error callback - * @param {Object} response - */ - onError: function (response) { - self.error(response.message); - } - }); + self.fieldEventHandler(hostedFieldsInstance); + $('body').trigger('processStop'); + }) + .catch(function () { + self.error($t('Braintree can\'t be initialized.')); + }); }, /** @@ -205,14 +193,6 @@ define([ expirationYear: { selector: self.getSelector('cc_exp_year'), placeholder: $t('YY') - }, - - /** - * Triggered when hosted field is changed - * @param {Object} event - */ - onFieldEvent: function (event) { - return self.fieldEventHandler(event); } }; @@ -227,36 +207,49 @@ define([ /** * Function to handle hosted fields events - * @param {Object} event - * @returns {Boolean} + * @param {Object} hostedFieldsInstance */ - fieldEventHandler: function (event) { + fieldEventHandler: function (hostedFieldsInstance) { var self = this, $cardType = $('#' + self.container).find('.icon-type'); - if (event.isEmpty === false) { - self.validateCardType(); - } + hostedFieldsInstance.on('empty', function (event) { + if (event.emittedBy === 'number') { + $cardType.attr('class', 'icon-type'); + self.selectedCardType(null); + } - if (event.type !== 'fieldStateChange') { + }); - return false; - } + hostedFieldsInstance.on('validityChange', function (event) { + var field = event.fields[event.emittedBy], + fieldKey = event.emittedBy; - // Handle a change in validation or card type - if (event.target.fieldKey === 'number') { - self.selectedCardType(null); - } + if (fieldKey === 'number') { + $cardType.addClass('icon-type-' + event.cards[0].type); + } + + if (fieldKey in self.selectorsMapper && field.isValid === false) { + self.addInvalidClass(self.selectorsMapper[fieldKey]); + } + }); - // remove previously set classes - $cardType.attr('class', 'icon-type'); + hostedFieldsInstance.on('blur', function (event) { + if (event.emittedBy === 'number') { + self.validateCardType(); + } + }); + + hostedFieldsInstance.on('cardTypeChange', function (event) { + if (event.cards.length !== 1) { + return; + } - if (event.card) { - $cardType.addClass('icon-type-' + event.card.type); + $cardType.addClass('icon-type-' + event.cards[0].type); self.selectedCardType( - validator.getMageCardType(event.card.type, self.getCcAvailableTypes()) + validator.getMageCardType(event.cards[0].type, self.getCcAvailableTypes()) ); - } + }); }, /** @@ -298,16 +291,31 @@ define([ * Trigger order submit */ submitOrder: function () { - this.$selector.validate().form(); - this.$selector.trigger('afterValidate.beforeSubmit'); + var self = this; + + self.$selector.validate().form(); + self.$selector.trigger('afterValidate.beforeSubmit'); $('body').trigger('processStop'); // validate parent form - if (this.$selector.validate().errorList.length) { + if (self.$selector.validate().errorList.length) { + return false; + } + + if (!self.validateCardType()) { return false; } - $('#' + this.container).find('[type="submit"]').trigger('click'); + self.hostedFieldsInstance.tokenize(function (err, payload) { + if (err) { + self.error($t('Some payment input fields are invalid.')); + + return false; + } + + self.setPaymentDetails(payload.nonce); + $('#' + self.container).find('[type="submit"]').trigger('click'); + }); }, /** @@ -337,12 +345,10 @@ define([ * @returns {Boolean} */ validateCardType: function () { - var $input = $(this.getSelector('cc_number')); - - $input.removeClass('braintree-hosted-fields-invalid'); + this.removeInvalidClass('cc_number'); if (!this.selectedCardType()) { - $input.addClass('braintree-hosted-fields-invalid'); + this.addInvalidClass('cc_number'); return false; } @@ -358,6 +364,28 @@ define([ */ getSelector: function (field) { return '#' + this.code + '_' + field; + }, + + /** + * Add invalid class to field. + * + * @param {String} field + * @returns void + * @private + */ + addInvalidClass: function (field) { + $(this.getSelector(field)).addClass('braintree-hosted-fields-invalid'); + }, + + /** + * Remove invalid class from field. + * + * @param {String} field + * @returns void + * @private + */ + removeInvalidClass: function (field) { + $(this.getSelector(field)).removeClass('braintree-hosted-fields-invalid'); } }); }); diff --git a/app/code/Magento/Braintree/view/frontend/requirejs-config.js b/app/code/Magento/Braintree/view/frontend/requirejs-config.js index 9fc38064677ef..e2f5fb03e58bf 100644 --- a/app/code/Magento/Braintree/view/frontend/requirejs-config.js +++ b/app/code/Magento/Braintree/view/frontend/requirejs-config.js @@ -6,7 +6,19 @@ var config = { map: { '*': { - braintree: 'https://js.braintreegateway.com/js/braintree-2.32.0.min.js' + braintreeClient: 'https://js.braintreegateway.com/web/3.44.1/js/client.min.js', + braintreeHostedFields: 'https://js.braintreegateway.com/web/3.44.1/js/hosted-fields.min.js', + braintreePayPal: 'https://js.braintreegateway.com/web/3.44.1/js/paypal-checkout.min.js', + braintree3DSecure: 'https://js.braintreegateway.com/web/3.44.1/js/three-d-secure.min.js', + braintreeDataCollector: 'https://js.braintreegateway.com/web/3.44.1/js/data-collector.min.js' + } + }, + paths: { + braintreePayPalCheckout: 'https://www.paypalobjects.com/api/checkout.min' + }, + shim: { + braintreePayPalCheckout: { + exports: 'paypal' } } }; diff --git a/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml index bf8aa8dd09c2c..fc3030b6a4b36 100644 --- a/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml +++ b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml @@ -15,7 +15,7 @@ }; layout([ { - component: 'Magento_Braintree/js/view/payment/method-renderer/multishipping/hosted-fields', + component: 'Magento_Braintree/js/view/payment/method-renderer/multishipping/cc-form', name: 'payment_method_braintree', method: paymentMethodData.method, item: paymentMethodData diff --git a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml index c1ef461ecae7c..e0a9e46bd7c5c 100644 --- a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml +++ b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml @@ -15,21 +15,18 @@ $config = [ 'id' => $id, 'clientToken' => $block->getClientToken(), 'displayName' => $block->getMerchantName(), - 'actionSuccess' => $block->getActionSuccess() + 'actionSuccess' => $block->getActionSuccess(), + 'environment' => $block->getEnvironment() ] ]; ?> -<div data-mage-init='<?= /* @noEscape */ json_encode($config) ?>' - class="paypal checkout paypal-logo braintree-paypal-logo<?= /* @noEscape */ $block->getContainerId() ?>-container"> - <button data-currency="<?= /* @noEscape */ $block->getCurrency() ?>" - data-locale="<?= /* @noEscape */ $block->getLocale() ?>" - data-amount="<?= /* @noEscape */ $block->getAmount() ?>" - id="<?= /* @noEscape */ $id ?>" - class="action-braintree-paypal-logo" disabled> - <img class="braintree-paypal-button-hidden" - src="https://checkout.paypal.com/pwpp/2.17.6/images/pay-with-paypal.png" - alt="<?= $block->escapeHtml(__('Pay with PayPal')) ?>" - title="<?= $block->escapeHtml(__('Pay with PayPal')) ?>"/> - </button> +<div data-mage-init='<?= /* @noEscape */ json_encode($config); ?>' + class="paypal checkout paypal-logo braintree-paypal-logo<?= /* @noEscape */ $block->getContainerId(); ?>-container"> + <div data-currency="<?= /* @noEscape */ $block->getCurrency(); ?>" + data-locale="<?= /* @noEscape */ $block->getLocale(); ?>" + data-amount="<?= /* @noEscape */ $block->getAmount(); ?>" + id="<?= /* @noEscape */ $id; ?>" + class="action-braintree-paypal-logo"> + </div> </div> diff --git a/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js b/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js index 3ac50fbcb47cc..aacd3016d7367 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js @@ -9,7 +9,9 @@ define( 'uiComponent', 'underscore', 'jquery', - 'braintree', + 'braintreeClient', + 'braintreePayPal', + 'braintreePayPalCheckout', 'Magento_Braintree/js/paypal/form-builder', 'domReady!' ], @@ -19,7 +21,9 @@ define( Component, _, $, - braintree, + braintreeClient, + braintreePayPal, + braintreePayPalCheckout, formBuilder ) { 'use strict'; @@ -27,58 +31,34 @@ define( return Component.extend({ defaults: { - - integrationName: 'braintreePaypal.currentIntegration', - - /** - * {String} - */ displayName: null, - - /** - * {String} - */ clientToken: null, - - /** - * {Object} - */ - clientConfig: { - - /** - * @param {Object} integration - */ - onReady: function (integration) { - resolver(function () { - registry.set(this.integrationName, integration); - $('#' + this.id).removeAttr('disabled'); - }, this); - }, - - /** - * @param {Object} payload - */ - onPaymentMethodReceived: function (payload) { - $('body').trigger('processStart'); - - formBuilder.build( - { - action: this.actionSuccess, - fields: { - result: JSON.stringify(payload) - } - } - ).submit(); - } - } + paypalCheckoutInstance: null }, /** * @returns {Object} */ initialize: function () { - this._super() - .initComponent(); + var self = this; + + self._super(); + + braintreeClient.create({ + authorization: self.clientToken + }) + .then(function (clientInstance) { + return braintreePayPal.create({ + client: clientInstance + }); + }) + .then(function (paypalCheckoutInstance) { + self.paypalCheckoutInstance = paypalCheckoutInstance; + + return self.paypalCheckoutInstance; + }); + + self.initComponent(); return this; }, @@ -87,64 +67,76 @@ define( * @returns {Object} */ initComponent: function () { - var currentIntegration = registry.get(this.integrationName), - $this = $('#' + this.id), - self = this, + var self = this, + selector = '#' + self.id, + $this = $(selector), data = { amount: $this.data('amount'), locale: $this.data('locale'), currency: $this.data('currency') + }; + + $this.html(''); + braintreePayPalCheckout.Button.render({ + env: self.environment, + style: { + color: 'blue', + shape: 'rect', + size: 'medium', + label: 'pay', + tagline: false + }, + + /** + * Payment setup + */ + payment: function () { + return self.paypalCheckoutInstance.createPayment(self.getClientConfig(data)); }, - initCallback = function () { - $this.attr('disabled', 'disabled'); - registry.remove(this.integrationName); - braintree.setup(this.clientToken, 'custom', this.getClientConfig(data)); - - $this.off('click') - .on('click', function (event) { - event.preventDefault(); - - registry.get(self.integrationName, function (integration) { - try { - integration.paypal.initAuthFlow(); - } catch (e) { - $this.attr('disabled', 'disabled'); + + /** + * Triggers on `onAuthorize` event + * + * @param {Object} response + */ + onAuthorize: function (response) { + return self.paypalCheckoutInstance.tokenizePayment(response) + .then(function (payload) { + $('body').trigger('processStart'); + + formBuilder.build( + { + action: self.actionSuccess, + fields: { + result: JSON.stringify(payload) + } } - }); + ).submit(); }); - }.bind(this); - - currentIntegration ? - currentIntegration.teardown(initCallback) : - initCallback(); + } + }, selector); return this; }, /** * @returns {Object} + * @private */ getClientConfig: function (data) { - this.clientConfig.paypal = { - singleUse: true, + var config = { + flow: 'checkout', amount: data.amount, currency: data.currency, locale: data.locale, - enableShippingAddress: true, - headless: true + enableShippingAddress: true }; if (this.displayName) { - this.clientConfig.paypal.displayName = this.displayName; + config.displayName = this.displayName; } - _.each(this.clientConfig, function (fn, name) { - if (typeof fn === 'function') { - this.clientConfig[name] = fn.bind(this); - } - }, this); - - return this.clientConfig; + return config; } }); } diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js index e3b806bf21384..84fa8cf62720f 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js @@ -7,17 +7,57 @@ define([ 'jquery', + 'braintree3DSecure', 'Magento_Braintree/js/view/payment/adapter', 'Magento_Checkout/js/model/quote', - 'mage/translate' -], function ($, braintree, quote, $t) { + 'mage/translate', + 'Magento_Ui/js/modal/modal', + 'Magento_Checkout/js/model/full-screen-loader' +], function ( + $, + braintree3DSecure, + braintreeAdapter, + quote, + $t, + Modal, + fullScreenLoader +) { 'use strict'; return { config: null, + modal: null, + threeDSecureInstance: null, + state: null, /** - * Set 3d secure config + * Initializes component + */ + initialize: function () { + var self = this, + promise = $.Deferred(); + + self.state = $.Deferred(); + braintreeAdapter.getApiClient() + .then(function (clientInstance) { + return braintree3DSecure.create({ + client: clientInstance + }); + }) + .then(function (threeDSecureInstance) { + self.threeDSecureInstance = threeDSecureInstance; + promise.resolve(self.threeDSecureInstance); + }) + .catch(function (err) { + promise.reject(err); + }); + + return promise.promise(); + }, + + /** + * Sets 3D Secure config + * * @param {Object} config */ setConfig: function (config) { @@ -26,7 +66,8 @@ define([ }, /** - * Get code + * Gets code + * * @returns {String} */ getCode: function () { @@ -34,54 +75,114 @@ define([ }, /** - * Validate Braintree payment nonce + * Validates 3D Secure + * * @param {Object} context * @returns {Object} */ validate: function (context) { - var client = braintree.getApiClient(), - state = $.Deferred(), + var self = this, totalAmount = quote.totals()['base_grand_total'], - billingAddress = quote.billingAddress(); + billingAddress = quote.billingAddress(), + options = { + amount: totalAmount, + nonce: context.paymentPayload.nonce, + + /** + * Adds iframe to page + * @param {Object} err + * @param {Object} iframe + */ + addFrame: function (err, iframe) { + self.createModal($(iframe)); + fullScreenLoader.stopLoader(); + self.modal.openModal(); + }, + + /** + * Removes iframe from page + */ + removeFrame: function () { + self.modal.closeModal(); + } + }; if (!this.isAmountAvailable(totalAmount) || !this.isCountryAvailable(billingAddress.countryId)) { - state.resolve(); + self.state.resolve(); - return state.promise(); + return self.state.promise(); } - client.verify3DS({ - amount: totalAmount, - creditCard: context.paymentMethodNonce - }, function (error, response) { - var liability; + fullScreenLoader.startLoader(); + this.initialize() + .then(function () { + self.threeDSecureInstance.verifyCard(options, function (err, payload) { + if (err) { + self.state.reject(err.message); + + return; + } + + // `liabilityShifted` indicates that 3DS worked and authentication succeeded + // if `liabilityShifted` and `liabilityShiftPossible` are false - card is ineligible for 3DS + if (payload.liabilityShifted || !payload.liabilityShifted && !payload.liabilityShiftPossible) { + context.paymentPayload.nonce = payload.nonce; + self.state.resolve(); + } else { + self.state.reject($t('Please try again with another form of payment.')); + } + }); + }) + .fail(function () { + fullScreenLoader.stopLoader(); + self.state.reject($t('Please try again with another form of payment.')); + }); + + return self.state.promise(); + }, - if (error) { - state.reject(error.message); + /** + * Creates modal window + * + * @param {Object} $context + * @private + */ + createModal: function ($context) { + var self = this, + options = { + clickableOverlay: false, + buttons: [], + modalCloseBtnHandler: self.cancelFlow.bind(self), + keyEventHandlers: { + escapeKey: self.cancelFlow.bind(self) + } + }; - return; - } + // adjust iframe styles + $context.attr('width', '100%'); + self.modal = Modal(options, $context); + }, - liability = { - shifted: response.verificationDetails.liabilityShifted, - shiftPossible: response.verificationDetails.liabilityShiftPossible - }; + /** + * Cancels 3D Secure flow + * + * @private + */ + cancelFlow: function () { + var self = this; - if (liability.shifted || !liability.shifted && !liability.shiftPossible) { - context.paymentMethodNonce = response.nonce; - state.resolve(); - } else { - state.reject($t('Please try again with another form of payment.')); - } + self.threeDSecureInstance.cancelVerifyCard(function () { + self.modal.closeModal(); + self.state.reject(); }); - - return state.promise(); }, /** - * Check minimal amount for 3d secure activation + * Checks minimal amount for 3D Secure activation + * * @param {Number} amount * @returns {Boolean} + * @private */ isAmountAvailable: function (amount) { amount = parseFloat(amount); @@ -90,9 +191,11 @@ define([ }, /** - * Check if current country is available for 3d secure + * Checks if current country is available for 3D Secure + * * @param {String} countryId * @returns {Boolean} + * @private */ isCountryAvailable: function (countryId) { var key, diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/adapter.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/adapter.js index 185e347bc9fd1..9cd6aa688674e 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/adapter.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/adapter.js @@ -6,81 +6,42 @@ /*global define*/ define([ 'jquery', - 'braintree', - 'Magento_Ui/js/model/messageList', - 'mage/translate' -], function ($, braintree, globalMessageList, $t) { + 'braintreeClient' +], function ($, braintreeClient) { 'use strict'; return { apiClient: null, - config: {}, checkout: null, + code: 'braintree', /** - * Get Braintree api client + * Returns Braintree API client * @returns {Object} */ getApiClient: function () { - if (!this.apiClient) { - this.apiClient = new braintree.api.Client({ - clientToken: this.getClientToken() - }); - } - - return this.apiClient; - }, - - /** - * Set configuration - * @param {Object} config - */ - setConfig: function (config) { - this.config = config; - }, - - /** - * Setup Braintree SDK - */ - setup: function () { - if (!this.getClientToken()) { - this.showError($t('Sorry, but something went wrong.')); - } - - braintree.setup(this.getClientToken(), 'custom', this.config); + return braintreeClient.create({ + authorization: this.getClientToken() + }); }, /** - * Get payment name + * Returns payment code + * * @returns {String} */ getCode: function () { - return 'braintree'; + return this.code; }, /** - * Get client token - * @returns {String|*} - */ - getClientToken: function () { - - return window.checkoutConfig.payment[this.getCode()].clientToken; - }, - - /** - * Show error message + * Returns client token * - * @param {String} errorMessage - */ - showError: function (errorMessage) { - globalMessageList.addErrorMessage({ - message: errorMessage - }); - }, - - /** - * May be triggered on Braintree SDK setup + * @returns {String} + * @private */ - onReady: function () {} + getClientToken: function () { + return window.checkoutConfig.payment[this.code].clientToken; + } }; }); diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/braintree.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/braintree.js index 2e1c65632e85f..132fcd6b3b06c 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/braintree.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/braintree.js @@ -23,7 +23,7 @@ define( rendererList.push( { type: braintreeType, - component: 'Magento_Braintree/js/view/payment/method-renderer/hosted-fields' + component: 'Magento_Braintree/js/view/payment/method-renderer/cc-form' } ); } diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/kount.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/kount.js new file mode 100644 index 0000000000000..cd0d024387b8c --- /dev/null +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/kount.js @@ -0,0 +1,61 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/*browser:true*/ +/*global define*/ + +define([ + 'jquery', + 'braintreeDataCollector', + 'Magento_Braintree/js/view/payment/adapter' +], function ( + $, + braintreeDataCollector, + braintreeAdapter +) { + 'use strict'; + + return { + paymentCode: 'braintree', + + /** + * Returns information about a customer's device on checkout page for passing to Kount for review. + * + * @returns {Object} + */ + getDeviceData: function () { + var state = $.Deferred(); + + if (this.hasFraudProtection()) { + braintreeAdapter.getApiClient() + .then(function (clientInstance) { + return braintreeDataCollector.create({ + client: clientInstance, + kount: true + }); + }) + .then(function (dataCollectorInstance) { + var deviceData = dataCollectorInstance.deviceData; + + state.resolve(deviceData); + }) + .catch(function (err) { + state.reject(err); + }); + } + + return state.promise(); + }, + + /** + * Returns setting value. + * + * @returns {Boolean} + * @private + */ + hasFraudProtection: function () { + return window.checkoutConfig.payment[this.paymentCode].hasFraudProtection; + } + }; +}); diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js index 39bdf582c8cd7..ac97e4fa5eb58 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js @@ -9,90 +9,97 @@ define( 'underscore', 'jquery', 'Magento_Payment/js/view/payment/cc-form', - 'Magento_Checkout/js/model/quote', 'Magento_Braintree/js/view/payment/adapter', - 'mage/translate', + 'braintreeHostedFields', + 'Magento_Checkout/js/model/quote', 'Magento_Braintree/js/validator', + 'Magento_Ui/js/model/messageList', 'Magento_Braintree/js/view/payment/validator-handler', - 'Magento_Checkout/js/model/full-screen-loader' + 'Magento_Vault/js/view/payment/vault-enabler', + 'Magento_Braintree/js/view/payment/kount', + 'mage/translate', + 'prototype', + 'domReady!' ], function ( _, $, Component, + braintreeAdapter, + hostedFields, quote, - braintree, - $t, validator, + globalMessageList, validatorManager, - fullScreenLoader + VaultEnabler, + kount, + $t ) { 'use strict'; return Component.extend({ defaults: { + template: 'Magento_Braintree/payment/form', active: false, - braintreeClient: null, - braintreeDeviceData: null, - paymentMethodNonce: null, - lastBillingAddress: null, - ccCode: null, - ccMessageContainer: null, - validatorManager: validatorManager, code: 'braintree', - - /** - * Additional payment data - * - * {Object} - */ - additionalData: {}, - - /** - * Braintree client configuration - * - * {Object} - */ - clientConfig: { - - /** - * Triggers on payment nonce receive - * @param {Object} response - */ - onPaymentMethodReceived: function (response) { - this.beforePlaceOrder(response); - }, - - /** - * Device data initialization - * - * @param {Object} checkout - */ - onReady: function (checkout) { - braintree.checkout = checkout; - braintree.onReady(); - }, - - /** - * Triggers on any Braintree error - * @param {Object} response - */ - onError: function (response) { - braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized')); - this.isPlaceOrderActionAllowed(true); - throw response.message; - }, - - /** - * Triggers when customer click "Cancel" - */ - onCancelled: function () { - this.paymentMethodNonce = null; - } + lastBillingAddress: null, + hostedFieldsInstance: null, + selectorsMapper: { + 'expirationMonth': 'expirationMonth', + 'expirationYear': 'expirationYear', + 'number': 'cc_number', + 'cvv': 'cc_cid' }, - imports: { - onActiveChange: 'active' - } + paymentPayload: { + nonce: null + }, + additionalData: {} + }, + + /** + * @returns {exports.initialize} + */ + initialize: function () { + var self = this; + + self._super(); + self.vaultEnabler = new VaultEnabler(); + self.vaultEnabler.setPaymentCode(self.getVaultCode()); + + kount.getDeviceData() + .then(function (deviceData) { + self.additionalData['device_data'] = deviceData; + }); + + return self; + }, + + /** + * Init hosted fields. + * + * Is called after knockout finishes input fields bindings. + */ + initHostedFields: function () { + var self = this; + + braintreeAdapter.getApiClient() + .then(function (clientInstance) { + + return hostedFields.create({ + client: clientInstance, + fields: self.getFieldsConfiguration() + }); + }) + .then(function (hostedFieldsInstance) { + self.hostedFieldsInstance = hostedFieldsInstance; + self.isPlaceOrderActionAllowed(true); + self.initFormValidationEvents(hostedFieldsInstance); + + return self.hostedFieldsInstance; + }) + .catch(function () { + self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized')); + }); }, /** @@ -104,8 +111,6 @@ define( validator.setConfig(window.checkoutConfig.payment[this.getCode()]); this._super() .observe(['active']); - this.validatorManager.initialize(); - this.initClientConfig(); return this; }, @@ -133,225 +138,288 @@ define( }, /** - * Triggers when payment method change - * @param {Boolean} isActive + * Get data + * + * @returns {Object} */ - onActiveChange: function (isActive) { - if (!isActive) { - return; - } + getData: function () { + var data = { + 'method': this.getCode(), + 'additional_data': { + 'payment_method_nonce': this.paymentPayload.nonce + } + }; - this.restoreMessageContainer(); - this.restoreCode(); + data['additional_data'] = _.extend(data['additional_data'], this.additionalData); + this.vaultEnabler.visitAdditionalData(data); - /** - * Define onReady callback - */ - braintree.onReady = function () {}; - this.initBraintree(); + return data; }, /** - * Restore original message container for cc-form component + * Get list of available CC types + * + * @returns {Object} */ - restoreMessageContainer: function () { - this.messageContainer = this.ccMessageContainer; + getCcAvailableTypes: function () { + var availableTypes = validator.getAvailableCardTypes(), + billingAddress = quote.billingAddress(), + billingCountryId; + + this.lastBillingAddress = quote.shippingAddress(); + + if (!billingAddress) { + billingAddress = this.lastBillingAddress; + } + + billingCountryId = billingAddress.countryId; + + if (billingCountryId && validator.getCountrySpecificCardTypes(billingCountryId)) { + return validator.collectTypes( + availableTypes, + validator.getCountrySpecificCardTypes(billingCountryId) + ); + } + + return availableTypes; }, /** - * Restore original code for cc-form component + * @returns {Boolean} */ - restoreCode: function () { - this.code = this.ccCode; + isVaultEnabled: function () { + return this.vaultEnabler.isVaultEnabled(); }, - /** @inheritdoc */ - initChildren: function () { - this._super(); - this.ccMessageContainer = this.messageContainer; - this.ccCode = this.code; - - return this; + /** + * Returns vault code. + * + * @returns {String} + */ + getVaultCode: function () { + return window.checkoutConfig.payment[this.getCode()].ccVaultCode; }, /** - * Init config + * Action to place order + * @param {String} key */ - initClientConfig: function () { - // Advanced fraud tools settings - if (this.hasFraudProtection()) { - this.clientConfig = _.extend(this.clientConfig, this.kountConfig()); + placeOrder: function (key) { + var self = this; + + if (key) { + return self._super(); } + // place order on success validation + validatorManager.validate(self, function () { + return self.placeOrder('parent'); + }, function (err) { - _.each(this.clientConfig, function (fn, name) { - if (typeof fn === 'function') { - this.clientConfig[name] = fn.bind(this); + if (err) { + self.showError(err); } - }, this); + }); + + return false; }, /** - * Init Braintree configuration + * Returns state of place order button + * + * @returns {Boolean} */ - initBraintree: function () { - var intervalId = setInterval(function () { - // stop loader when frame will be loaded - if ($('#braintree-hosted-field-number').length) { - clearInterval(intervalId); - fullScreenLoader.stopLoader(); - } - }, 500); - - if (braintree.checkout) { - braintree.checkout.teardown(function () { - braintree.checkout = null; - }); - } - - fullScreenLoader.startLoader(); - braintree.setConfig(this.clientConfig); - braintree.setup(); + isButtonActive: function () { + return this.isActive() && this.isPlaceOrderActionAllowed(); }, /** - * @returns {Object} + * Trigger order placing */ - kountConfig: function () { - var config = { - dataCollector: { - kount: { - environment: this.getEnvironment() + placeOrderClick: function () { + var self = this; + + if (this.isFormValid(this.hostedFieldsInstance)) { + self.hostedFieldsInstance.tokenize(function (err, payload) { + if (err) { + self.showError($t('Some payment input fields are invalid.')); + + return; } - }, - - /** - * Device data initialization - * - * @param {Object} checkout - */ - onReady: function (checkout) { - braintree.checkout = checkout; - this.additionalData['device_data'] = checkout.deviceData; - braintree.onReady(); - } - }; - if (this.getKountMerchantId()) { - config.dataCollector.kount.merchantId = this.getKountMerchantId(); + self.setPaymentPayload(payload); + self.placeOrder(); + }); } - - return config; }, /** - * Get full selector name + * Validates credit card form. * - * @param {String} field - * @returns {String} + * @param {Object} hostedFieldsInstance + * @returns {Boolean} + * @private */ - getSelector: function (field) { - return '#' + this.getCode() + '_' + field; + isFormValid: function (hostedFieldsInstance) { + var self = this, + state = hostedFieldsInstance.getState(); + + return Object.keys(state.fields).every(function (fieldKey) { + if (fieldKey in self.selectorsMapper && state.fields[fieldKey].isValid === false) { + self.addInvalidClass(self.selectorsMapper[fieldKey]); + } + + return state.fields[fieldKey].isValid; + }); }, /** - * Get list of available CC types + * Init form validation events. * - * @returns {Object} + * @param {Object} hostedFieldsInstance + * @private */ - getCcAvailableTypes: function () { - var availableTypes = validator.getAvailableCardTypes(), - billingAddress = quote.billingAddress(), - billingCountryId; + initFormValidationEvents: function (hostedFieldsInstance) { + var self = this; - this.lastBillingAddress = quote.shippingAddress(); + hostedFieldsInstance.on('empty', function (event) { + if (event.emittedBy === 'number') { + self.selectedCardType(null); + } - if (!billingAddress) { - billingAddress = this.lastBillingAddress; - } + }); - billingCountryId = billingAddress.countryId; + hostedFieldsInstance.on('blur', function (event) { + if (event.emittedBy === 'number') { + self.validateCardType(); + } + }); - if (billingCountryId && validator.getCountrySpecificCardTypes(billingCountryId)) { - return validator.collectTypes( - availableTypes, validator.getCountrySpecificCardTypes(billingCountryId) - ); - } + hostedFieldsInstance.on('validityChange', function (event) { + var field = event.fields[event.emittedBy], + fieldKey = event.emittedBy; - return availableTypes; + if (fieldKey === 'number') { + self.isValidCardNumber = field.isValid; + } + + if (fieldKey in self.selectorsMapper && field.isValid === false) { + self.addInvalidClass(self.selectorsMapper[fieldKey]); + } + }); + + hostedFieldsInstance.on('cardTypeChange', function (event) { + if (event.cards.length === 1) { + self.selectedCardType( + validator.getMageCardType(event.cards[0].type, self.getCcAvailableTypes()) + ); + } + }); }, /** - * @returns {Boolean} + * Get full selector name + * + * @param {String} field + * @returns {String} + * @private */ - hasFraudProtection: function () { - return window.checkoutConfig.payment[this.getCode()].hasFraudProtection; + getSelector: function (field) { + return '#' + this.getCode() + '_' + field; }, /** - * @returns {String} + * Add invalid class to field. + * + * @param {String} field + * @returns void + * @private */ - getEnvironment: function () { - return window.checkoutConfig.payment[this.getCode()].environment; + addInvalidClass: function (field) { + $(this.getSelector(field)).addClass('braintree-hosted-fields-invalid'); }, /** - * @returns {String} + * Remove invalid class from field. + * + * @param {String} field + * @returns void + * @private */ - getKountMerchantId: function () { - return window.checkoutConfig.payment[this.getCode()].kountMerchantId; + removeInvalidClass: function (field) { + $(this.getSelector(field)).removeClass('braintree-hosted-fields-invalid'); }, /** - * Get data + * Get Braintree Hosted Fields * * @returns {Object} + * @private */ - getData: function () { - var data = { - 'method': this.getCode(), - 'additional_data': { - 'payment_method_nonce': this.paymentMethodNonce - } - }; + getFieldsConfiguration: function () { + var self = this, + fields = { + number: { + selector: self.getSelector('cc_number') + }, + expirationMonth: { + selector: self.getSelector('expirationMonth'), + placeholder: $t('MM') + }, + expirationYear: { + selector: self.getSelector('expirationYear'), + placeholder: $t('YY') + } + }; - data['additional_data'] = _.extend(data['additional_data'], this.additionalData); + if (self.hasVerification()) { + fields.cvv = { + selector: self.getSelector('cc_cid') + }; + } - return data; + return fields; }, /** - * Set payment nonce - * @param {String} paymentMethodNonce + * Validate current credit card type. + * + * @returns {Boolean} + * @private */ - setPaymentMethodNonce: function (paymentMethodNonce) { - this.paymentMethodNonce = paymentMethodNonce; + validateCardType: function () { + var cardFieldName = 'cc_number'; + + this.removeInvalidClass(cardFieldName); + + if (this.selectedCardType() === null || !this.isValidCardNumber) { + this.addInvalidClass(cardFieldName); + + return false; + } + + return true; }, /** - * Prepare data to place order - * @param {Object} data + * Sets payment payload + * + * @param {Object} paymentPayload + * @private */ - beforePlaceOrder: function (data) { - this.setPaymentMethodNonce(data.nonce); - this.placeOrder(); + setPaymentPayload: function (paymentPayload) { + this.paymentPayload = paymentPayload; }, /** - * Action to place order - * @param {String} key + * Show error message + * + * @param {String} errorMessage + * @private */ - placeOrder: function (key) { - var self = this; - - if (key) { - return self._super(); - } - // place order on success validation - self.validatorManager.validate(self, function () { - return self.placeOrder('parent'); + showError: function (errorMessage) { + globalMessageList.addErrorMessage({ + message: errorMessage }); - - return false; } }); } diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js deleted file mode 100644 index 9e496e43b27c5..0000000000000 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -/*browser:true*/ -/*global define*/ - -define([ - 'jquery', - 'Magento_Braintree/js/view/payment/method-renderer/cc-form', - 'Magento_Braintree/js/validator', - 'Magento_Vault/js/view/payment/vault-enabler', - 'mage/translate', - 'Magento_Checkout/js/model/payment/additional-validators' -], function ($, Component, validator, VaultEnabler, $t, additionalValidators) { - 'use strict'; - - return Component.extend({ - - defaults: { - template: 'Magento_Braintree/payment/form', - clientConfig: { - - /** - * {String} - */ - id: 'co-transparent-form-braintree' - }, - isValidCardNumber: false - }, - - /** - * @returns {exports.initialize} - */ - initialize: function () { - this._super(); - this.vaultEnabler = new VaultEnabler(); - this.vaultEnabler.setPaymentCode(this.getVaultCode()); - - return this; - }, - - /** - * Init config - */ - initClientConfig: function () { - this._super(); - - // Hosted fields settings - this.clientConfig.hostedFields = this.getHostedFields(); - }, - - /** - * @returns {Object} - */ - getData: function () { - var data = this._super(); - - this.vaultEnabler.visitAdditionalData(data); - - return data; - }, - - /** - * @returns {Boolean} - */ - isVaultEnabled: function () { - return this.vaultEnabler.isVaultEnabled(); - }, - - /** - * Get Braintree Hosted Fields - * @returns {Object} - */ - getHostedFields: function () { - var self = this, - fields = { - number: { - selector: self.getSelector('cc_number') - }, - expirationMonth: { - selector: self.getSelector('expirationMonth'), - placeholder: $t('MM') - }, - expirationYear: { - selector: self.getSelector('expirationYear'), - placeholder: $t('YY') - } - }; - - if (self.hasVerification()) { - fields.cvv = { - selector: self.getSelector('cc_cid') - }; - } - - /** - * Triggers on Hosted Field changes - * @param {Object} event - * @returns {Boolean} - */ - fields.onFieldEvent = function (event) { - if (event.isEmpty === false) { - self.validateCardType(); - } - - if (event.type !== 'fieldStateChange') { - return false; - } - - // Handle a change in validation or card type - if (event.target.fieldKey === 'number') { - self.selectedCardType(null); - } - - if (event.target.fieldKey === 'number' && event.card) { - self.isValidCardNumber = event.isValid; - self.selectedCardType( - validator.getMageCardType(event.card.type, self.getCcAvailableTypes()) - ); - } - }; - - return fields; - }, - - /** - * Validate current credit card type - * @returns {Boolean} - */ - validateCardType: function () { - var $selector = $(this.getSelector('cc_number')), - invalidClass = 'braintree-hosted-fields-invalid'; - - $selector.removeClass(invalidClass); - - if (this.selectedCardType() === null || !this.isValidCardNumber) { - $(this.getSelector('cc_number')).addClass(invalidClass); - - return false; - } - - return true; - }, - - /** - * Returns state of place order button - * @returns {Boolean} - */ - isButtonActive: function () { - return this.isActive() && this.isPlaceOrderActionAllowed(); - }, - - /** - * Trigger order placing - */ - placeOrderClick: function () { - if (this.validateCardType() && additionalValidators.validate()) { - this.isPlaceOrderActionAllowed(false); - $(this.getSelector('submit')).trigger('click'); - } - }, - - /** - * @returns {String} - */ - getVaultCode: function () { - return window.checkoutConfig.payment[this.getCode()].ccVaultCode; - } - }); -}); diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/hosted-fields.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/cc-form.js similarity index 66% rename from app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/hosted-fields.js rename to app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/cc-form.js index 1ceebc8e66282..dc816c035a23d 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/hosted-fields.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/cc-form.js @@ -7,13 +7,14 @@ define([ 'jquery', - 'Magento_Braintree/js/view/payment/method-renderer/hosted-fields', + 'Magento_Braintree/js/view/payment/method-renderer/cc-form', 'Magento_Braintree/js/validator', 'Magento_Ui/js/model/messageList', 'mage/translate', 'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/action/set-payment-information', - 'Magento_Checkout/js/model/payment/additional-validators' + 'Magento_Checkout/js/model/payment/additional-validators', + 'Magento_Braintree/js/view/payment/validator-handler' ], function ( $, Component, @@ -22,7 +23,8 @@ define([ $t, fullScreenLoader, setPaymentInformationAction, - additionalValidators + additionalValidators, + validatorManager ) { 'use strict'; @@ -31,33 +33,13 @@ define([ template: 'Magento_Braintree/payment/multishipping/form' }, - /** - * Get list of available CC types - * - * @returns {Object} - */ - getCcAvailableTypes: function () { - var availableTypes = validator.getAvailableCardTypes(), - billingCountryId; - - billingCountryId = $('#multishipping_billing_country_id').val(); - - if (billingCountryId && validator.getCountrySpecificCardTypes(billingCountryId)) { - return validator.collectTypes( - availableTypes, validator.getCountrySpecificCardTypes(billingCountryId) - ); - } - - return availableTypes; - }, - /** * @override */ placeOrder: function () { var self = this; - this.validatorManager.validate(self, function () { + validatorManager.validate(self, function () { return self.setPaymentInformation(); }); }, @@ -67,9 +49,7 @@ define([ */ setPaymentInformation: function () { if (additionalValidators.validate()) { - fullScreenLoader.startLoader(); - $.when( setPaymentInformationAction( this.messageContainer, diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js index 6702e58d1214b..0a9ec4fb6c6ee 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js @@ -10,32 +10,56 @@ define([ 'Magento_Braintree/js/view/payment/method-renderer/paypal', 'Magento_Checkout/js/action/set-payment-information', 'Magento_Checkout/js/model/payment/additional-validators', - 'Magento_Checkout/js/model/full-screen-loader', - 'mage/translate' + 'Magento_Checkout/js/model/full-screen-loader' ], function ( $, _, Component, setPaymentInformationAction, additionalValidators, - fullScreenLoader, - $t + fullScreenLoader ) { 'use strict'; return Component.extend({ defaults: { template: 'Magento_Braintree/payment/multishipping/paypal', - submitButtonSelector: '#payment-continue span' + submitButtonSelector: '#payment-continue span', + paypalButtonSelector: '[id="parent-payment-continue"]', + reviewButtonHtml: '' }, /** * @override */ - onActiveChange: function (isActive) { - this.updateSubmitButtonTitle(isActive); + initObservable: function () { + this.reviewButtonHtml = $(this.paypalButtonSelector).html(); + + return this._super(); + }, + /** + * Get configuration for PayPal. + * + * @returns {Object} + */ + getPayPalConfig: function () { + var config; + + config = this._super(); + config.flow = 'vault'; + config.enableShippingAddress = false; + config.shippingAddressEditable = false; + + return config; + }, + + /** + * @override + */ + onActiveChange: function (isActive) { this._super(isActive); + this.updateSubmitButton(isActive); }, /** @@ -44,7 +68,7 @@ define([ beforePlaceOrder: function (data) { this._super(data); - this.updateSubmitButtonTitle(true); + this.updateSubmitButton(true); }, /** @@ -87,38 +111,32 @@ define([ * @returns {Boolean} */ isPaymentMethodNonceReceived: function () { - return this.paymentMethodNonce !== null; + return this.paymentPayload.nonce !== null; }, /** - * Updates submit button title on multi-addresses checkout billing form. + * Updates submit button on multi-addresses checkout billing form. * * @param {Boolean} isActive */ - updateSubmitButtonTitle: function (isActive) { - var title = this.isPaymentMethodNonceReceived() || !isActive ? - $t('Go to Review Your Order') : $t('Continue to PayPal'); - - $(this.submitButtonSelector).html(title); + updateSubmitButton: function (isActive) { + if (this.isPaymentMethodNonceReceived() || !isActive) { + $(this.paypalButtonSelector).html(this.reviewButtonHtml); + } }, /** * @override */ placeOrder: function () { - if (!this.isPaymentMethodNonceReceived()) { - this.payWithPayPal(); - } else { - fullScreenLoader.startLoader(); - - $.when( - setPaymentInformationAction( - this.messageContainer, - this.getData() - ) - ).done(this.done.bind(this)) - .fail(this.fail.bind(this)); - } + fullScreenLoader.startLoader(); + $.when( + setPaymentInformationAction( + this.messageContainer, + this.getData() + ) + ).done(this.done.bind(this)) + .fail(this.fail.bind(this)); }, /** diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js index eaebd8492b0a1..c46e65ffb8abd 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js @@ -9,22 +9,28 @@ define([ 'underscore', 'Magento_Checkout/js/view/payment/default', 'Magento_Braintree/js/view/payment/adapter', + 'braintreePayPal', + 'braintreePayPalCheckout', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Vault/js/view/payment/vault-enabler', 'Magento_Checkout/js/action/create-billing-address', + 'Magento_Braintree/js/view/payment/kount', 'mage/translate' ], function ( $, _, Component, - Braintree, + BraintreeAdapter, + BraintreePayPal, + BraintreePayPalCheckout, quote, fullScreenLoader, additionalValidators, VaultEnabler, createBillingAddress, + kount, $t ) { 'use strict'; @@ -34,10 +40,15 @@ define([ template: 'Magento_Braintree/payment/paypal', code: 'braintree_paypal', active: false, - paymentMethodNonce: null, grandTotalAmount: null, isReviewRequired: false, + paypalCheckoutInstance: null, customerEmail: null, + vaultEnabler: null, + paymentPayload: { + nonce: null + }, + paypalButtonSelector: '[data-container="paypal-button"]', /** * Additional payment data @@ -46,39 +57,42 @@ define([ */ additionalData: {}, - /** - * PayPal client configuration - * {Object} - */ - clientConfig: { - dataCollector: { - paypal: true - }, - - /** - * Triggers when widget is loaded - * @param {Object} checkout - */ - onReady: function (checkout) { - Braintree.checkout = checkout; - this.additionalData['device_data'] = checkout.deviceData; - this.enableButton(); - Braintree.onReady(); - }, - - /** - * Triggers on payment nonce receive - * @param {Object} response - */ - onPaymentMethodReceived: function (response) { - this.beforePlaceOrder(response); - } - }, imports: { onActiveChange: 'active' } }, + /** + * Initialize view. + * + * @return {exports} + */ + initialize: function () { + var self = this; + + self._super(); + + BraintreeAdapter.getApiClient().then(function (clientInstance) { + return BraintreePayPal.create({ + client: clientInstance + }); + }).then(function (paypalCheckoutInstance) { + self.paypalCheckoutInstance = paypalCheckoutInstance; + + return self.paypalCheckoutInstance; + }); + + kount.getDeviceData() + .then(function (deviceData) { + self.additionalData['device_data'] = deviceData; + }); + + // for each component initialization need update property + this.isReviewRequired(false); + + return self; + }, + /** * Set list of observable attributes * @returns {exports.initObservable} @@ -109,10 +123,6 @@ define([ } }); - // for each component initialization need update property - this.isReviewRequired(false); - this.initClientConfig(); - return this; }, @@ -161,24 +171,13 @@ define([ }, /** - * Init config - */ - initClientConfig: function () { - this.clientConfig = _.extend(this.clientConfig, this.getPayPalConfig()); - - _.each(this.clientConfig, function (fn, name) { - if (typeof fn === 'function') { - this.clientConfig[name] = fn.bind(this); - } - }, this); - }, - - /** - * Set payment nonce - * @param {String} paymentMethodNonce + * Sets payment payload + * + * @param {Object} paymentPayload + * @private */ - setPaymentMethodNonce: function (paymentMethodNonce) { - this.paymentMethodNonce = paymentMethodNonce; + setPaymentPayload: function (paymentPayload) { + this.paymentPayload = paymentPayload; }, /** @@ -205,21 +204,21 @@ define([ /** * Prepare data to place order - * @param {Object} data + * @param {Object} payload */ - beforePlaceOrder: function (data) { - this.setPaymentMethodNonce(data.nonce); + beforePlaceOrder: function (payload) { + this.setPaymentPayload(payload); if ((this.isRequiredBillingAddress() || quote.billingAddress() === null) && - typeof data.details.billingAddress !== 'undefined' + typeof payload.details.billingAddress !== 'undefined' ) { - this.setBillingAddress(data.details, data.details.billingAddress); + this.setBillingAddress(payload.details, payload.details.billingAddress); } if (this.isSkipOrderReview()) { this.placeOrder(); } else { - this.customerEmail(data.details.email); + this.customerEmail(payload.details.email); this.isReviewRequired(true); } }, @@ -228,18 +227,46 @@ define([ * Re-init PayPal Auth Flow */ reInitPayPal: function () { - if (Braintree.checkout) { - Braintree.checkout.teardown(function () { - Braintree.checkout = null; - }); - } + var self = this; - this.disableButton(); - this.clientConfig.paypal.amount = this.grandTotalAmount; - this.clientConfig.paypal.shippingAddressOverride = this.getShippingAddress(); + $(self.paypalButtonSelector).html(''); + + return BraintreePayPalCheckout.Button.render({ + env: this.getEnvironment(), + style: { + color: 'blue', + shape: 'rect', + size: 'medium', + label: 'pay', + tagline: false + }, + + /** + * Creates a PayPal payment + */ + payment: function () { + return self.paypalCheckoutInstance.createPayment( + self.getPayPalConfig() + ); + }, - Braintree.setConfig(this.clientConfig); - Braintree.setup(); + /** + * Tokenizes the authorize data + */ + onAuthorize: function (data) { + return self.paypalCheckoutInstance.tokenizePayment(data) + .then(function (payload) { + self.beforePlaceOrder(payload); + }); + }, + + /** + * Triggers on error + */ + onError: function () { + self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized')); + } + }, self.paypalButtonSelector); }, /** @@ -272,37 +299,22 @@ define([ */ getPayPalConfig: function () { var totals = quote.totals(), - config = {}, + config, isActiveVaultEnabler = this.isActiveVault(); - config.paypal = { - container: 'paypal-container', - singleUse: !isActiveVaultEnabler, - headless: true, + config = { + flow: !isActiveVaultEnabler ? 'checkout' : 'vault', amount: this.grandTotalAmount, currency: totals['base_currency_code'], locale: this.getLocale(), enableShippingAddress: true, - - /** - * Triggers on any Braintree error - */ - onError: function () { - this.paymentMethodNonce = null; - }, - - /** - * Triggers if browser doesn't support PayPal Checkout - */ - onUnsupported: function () { - this.paymentMethodNonce = null; - } + shippingAddressEditable: this.isAllowOverrideShippingAddress() }; - config.paypal.shippingAddressOverride = this.getShippingAddress(); + config.shippingAddressOverride = this.getShippingAddress(); if (this.getMerchantName()) { - config.paypal.displayName = this.getMerchantName(); + config.displayName = this.getMerchantName(); } return config; @@ -320,14 +332,13 @@ define([ } return { - recipientName: address.firstname + ' ' + address.lastname, - streetAddress: address.street[0], - locality: address.city, - countryCodeAlpha2: address.countryId, + line1: address.street[0], + city: address.city, + state: address.regionCode, postalCode: address.postcode, - region: address.regionCode, + countryCode: address.countryId, phone: address.telephone, - editable: this.isAllowOverrideShippingAddress() + recipientName: address.firstname + ' ' + address.lastname }; }, @@ -347,7 +358,7 @@ define([ var data = { 'method': this.getCode(), 'additional_data': { - 'payment_method_nonce': this.paymentMethodNonce + 'payment_method_nonce': this.paymentPayload.nonce } }; @@ -374,6 +385,13 @@ define([ return window.checkoutConfig.payment[this.getCode()].vaultCode; }, + /** + * @returns {String} + */ + getEnvironment: function () { + return window.checkoutConfig.payment[BraintreeAdapter.getCode()].environment; + }, + /** * Check if need to skip order review * @returns {Boolean} @@ -394,59 +412,7 @@ define([ * Re-init PayPal Auth flow to use Vault */ onVaultPaymentTokenEnablerChange: function () { - this.clientConfig.paypal.singleUse = !this.isActiveVault(); this.reInitPayPal(); - }, - - /** - * Disable submit button - */ - disableButton: function () { - // stop any previous shown loaders - fullScreenLoader.stopLoader(true); - fullScreenLoader.startLoader(); - $('[data-button="place"]').attr('disabled', 'disabled'); - }, - - /** - * Enable submit button - */ - enableButton: function () { - $('[data-button="place"]').removeAttr('disabled'); - fullScreenLoader.stopLoader(); - }, - - /** - * Triggers when customer click "Continue to PayPal" button - */ - payWithPayPal: function () { - if (!additionalValidators.validate()) { - return; - } - - try { - Braintree.checkout.paypal.initAuthFlow(); - } catch (e) { - this.messageContainer.addErrorMessage({ - message: $t('Payment ' + this.getTitle() + ' can\'t be initialized.') - }); - } - }, - - /** - * Get button title - * @returns {String} - */ - getButtonTitle: function () { - return this.isSkipOrderReview() ? 'Pay with PayPal' : 'Continue to PayPal'; - }, - - /** - * Get button id - * @returns {String} - */ - getButtonId: function () { - return this.getCode() + (this.isSkipOrderReview() ? '_pay_with' : '_continue_to'); } }); }); diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js index 85e531706d62e..ad8ac02bfb8c6 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js @@ -51,15 +51,7 @@ define([ placeOrder: function () { var self = this; - /** - * Define onReady callback - */ - Braintree.onReady = function () { - self.getPaymentMethodNonce(); - }; - self.hostedFields(function (formComponent) { - formComponent.initBraintree(); - }); + self.getPaymentMethodNonce(); }, /** @@ -75,7 +67,7 @@ define([ .done(function (response) { fullScreenLoader.stopLoader(); self.hostedFields(function (formComponent) { - formComponent.setPaymentMethodNonce(response.paymentMethodNonce); + formComponent.paymentPayload.nonce = response.paymentMethodNonce; formComponent.additionalData['public_hash'] = self.publicHash; formComponent.code = self.code; formComponent.messageContainer = self.messageContainer; diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/validator-handler.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/validator-handler.js index fbe85c3b46027..992c241fad665 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/validator-handler.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/validator-handler.js @@ -7,28 +7,26 @@ define([ 'jquery', - 'Magento_Ui/js/model/messageList', 'Magento_Braintree/js/view/payment/3d-secure' -], function ($, globalMessageList, verify3DSecure) { +], function ($, verify3DSecure) { 'use strict'; return { + initialized: false, validators: [], /** - * Get payment config - * @returns {Object} - */ - getConfig: function () { - return window.checkoutConfig.payment; - }, - - /** - * Init list of validators + * Inits list of validators */ initialize: function () { var config = this.getConfig(); + if (this.initialized) { + return; + } + + this.initialized = true; + if (config[verify3DSecure.getCode()].enabled) { verify3DSecure.setConfig(config[verify3DSecure.getCode()]); this.add(verify3DSecure); @@ -36,7 +34,17 @@ define([ }, /** - * Add new validator + * Gets payment config + * + * @returns {Object} + */ + getConfig: function () { + return window.checkoutConfig.payment; + }, + + /** + * Adds new validator + * * @param {Object} validator */ add: function (validator) { @@ -44,17 +52,21 @@ define([ }, /** - * Run pull of validators + * Runs pull of validators + * * @param {Object} context - * @param {Function} callback + * @param {Function} successCallback + * @param {Function} errorCallback */ - validate: function (context, callback) { + validate: function (context, successCallback, errorCallback) { var self = this, deferred; + self.initialize(); + // no available validators if (!self.validators.length) { - callback(); + successCallback(); return; } @@ -66,20 +78,10 @@ define([ $.when.apply($, deferred) .done(function () { - callback(); + successCallback(); }).fail(function (error) { - self.showError(error); + errorCallback(error); }); - }, - - /** - * Show error message - * @param {String} errorMessage - */ - showError: function (errorMessage) { - globalMessageList.addErrorMessage({ - message: errorMessage - }); } }; }); diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/form.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/form.html index 819b06ca75788..9bcb5dad8b636 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/form.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/form.html @@ -87,7 +87,7 @@ <span><!-- ko i18n: 'Card Verification Number'--><!-- /ko --></span> </label> <div class="control _with-tooltip"> - <div data-bind="attr: {id: getCode() + '_cc_cid'}" class="hosted-control hosted-cid"></div> + <div data-bind="afterRender: initHostedFields, attr: {id: getCode() + '_cc_cid'}" class="hosted-control hosted-cid"></div> <div class="hosted-error"><!-- ko i18n: 'Please, enter valid Card Verification Number'--><!-- /ko --></div> <div class="field-tooltip toggle"> diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/form.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/form.html index 964e15df166d3..b72ef24b81b63 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/form.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/form.html @@ -41,7 +41,7 @@ </div> </div> <div class="field number required"> - <label data-bind="attr: {for: getCode() + '_cc_number'}" class="label"> + <label data-bind="afterRender: initHostedFields, attr: {for: getCode() + '_cc_number'}" class="label"> <span><!-- ko i18n: 'Credit Card Number'--><!-- /ko --></span> </label> <div class="control"> diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/paypal.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/paypal.html index 722989e41f98f..fcd5320351938 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/paypal.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/paypal.html @@ -20,6 +20,7 @@ <fieldset class="braintree-paypal-fieldset" data-bind='attr: {id: "payment_form_" + getCode()}'> <div id="paypal-container"></div> </fieldset> + <div data-container="paypal-button"></div> <div class="actions-toolbar braintree-paypal-actions" data-bind="visible: isReviewRequired()"> <div class="payment-method-item braintree-paypal-account"> <span class="payment-method-type">PayPal</span> diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html index e1f6a1b4c25ce..0abf3483ac76c 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html @@ -65,15 +65,7 @@ </div> </div> <div class="actions-toolbar" data-bind="visible: !isReviewRequired()"> - <div class="primary"> - <button data-button="place" data-role="review-save" - type="submit" - data-bind="attr: {id: getButtonId(), title: $t(getButtonTitle())}, enable: (isActive()), click: payWithPayPal" - class="action primary checkout" - disabled> - <span translate="getButtonTitle()"></span> - </button> - </div> + <div data-container="paypal-button" class="primary"></div> </div> </div> </div> diff --git a/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml new file mode 100644 index 0000000000000..d73d31c4498f8 --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/ActionGroup/AdminOrderBundleProductActionGroup.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderConfigureBundleProduct"> + <arguments> + <argument name="productName" type="string" defaultValue="{{SimpleProduct.sku}}"/> + <argument name="productNumber" type="string" defaultValue="1"/> + <argument name="productQty" type="string" defaultValue="1"/> + </arguments> + <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> + <waitForPageLoad stepKey="waitForConfigurePageLoad"/> + <checkOption selector="{{AdminOrderBundleProductSection.bundleProductCheckbox(productNumber)}}" stepKey="checkProduct"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml new file mode 100644 index 0000000000000..915b11ebdbbaa --- /dev/null +++ b/app/code/Magento/Bundle/Test/Mftf/Section/AdminOrderBundleProductSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> +<section name="AdminOrderBundleProductSection"> + <element name="bundleProductCheckbox" type="checkbox" selector="(//input[contains(@class, 'admin__control-checkbox') and contains(@class, 'bundle-option')])[{{productNumber}}]" parameterized="true"/> +</section> +</sections> diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml index bc9a3dba9a5f1..a4e26256e9773 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml @@ -16,6 +16,9 @@ <severity value="CRITICAL"/> <testCaseId value="MC-11016"/> <group value="mtf_migrated"/> + <skip> + <issueId value="MC-16393"/> + </skip> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml index a770ae864a74c..f028c7013df90 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend */ $elementHtml = $block->getParentElementHtml(); @@ -20,8 +18,8 @@ $isElementReadonly = $block->getElement() ->getReadonly(); ?> -<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)): ?> - <div class="<?= /* @escapeNotVerified */ $attributeCode ?> "><?= /* @escapeNotVerified */ $elementHtml ?></div> +<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)) : ?> + <div class="<?= $block->escapeHtmlAttr($attributeCode) ?> "><?= /* @noEscape */ $elementHtml ?></div> <?php endif; ?> <?= $block->getExtendedElement($switchAttributeCode)->toHtml() ?> @@ -29,9 +27,9 @@ $isElementReadonly = $block->getElement() <?php if (!$isElementReadonly && $block->getDisableChild()) { ?> <script> require(['prototype'], function () { - function <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change() { - var $attribute = $('<?= /* @escapeNotVerified */ $attributeCode ?>'); - if ($('<?= /* @escapeNotVerified */ $switchAttributeCode ?>').value == '<?= /* @escapeNotVerified */ $block::DYNAMIC ?>') { + function <?= /* @noEscape */ $switchAttributeCode ?>_change() { + var $attribute = $('<?= $block->escapeJs($attributeCode) ?>'); + if ($('<?= /* @noEscape */ $switchAttributeCode ?>').value == '<?= $block->escapeJs($block::DYNAMIC) ?>') { if ($attribute) { $attribute.disabled = true; $attribute.value = ''; @@ -43,10 +41,10 @@ $isElementReadonly = $block->getElement() } else { if ($attribute) { <?php if ($attributeCode === 'price' && !$block->getCanEditPrice() && $block->getCanReadPrice() - && $block->getProduct()->isObjectNew()): ?> - <?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?> - $attribute.value = <?= /* @escapeNotVerified */ $defaultProductPrice ?>; - <?php else: ?> + && $block->getProduct()->isObjectNew()) : ?> + <?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?> + $attribute.value = <?= /* @noEscape */ (string)$defaultProductPrice ?>; + <?php else : ?> $attribute.disabled = false; $attribute.addClassName('required-entry'); <?php endif; ?> @@ -58,11 +56,11 @@ $isElementReadonly = $block->getElement() } <?php if (!($attributeCode === 'price' && !$block->getCanEditPrice() - && !$block->getProduct()->isObjectNew())): ?> - $('<?= /* @escapeNotVerified */ $switchAttributeCode ?>').observe('change', <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change); + && !$block->getProduct()->isObjectNew())) : ?> + $('<?= /* @noEscape */ $switchAttributeCode ?>').observe('change', <?= /* @noEscape */ $switchAttributeCode ?>_change); <?php endif; ?> Event.observe(window, 'load', function(){ - <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change(); + <?= /* @noEscape */ $switchAttributeCode ?>_change(); }); }); </script> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml index 87798a6ba622f..53ad0a963244d 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml @@ -3,17 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Bundle */ ?> <?php $options = $block->decorateArray($block->getOptions(true)); ?> -<?php if (count($options)): ?> +<?php if (count($options)) : ?> <fieldset id="catalog_product_composite_configure_fields_bundle" class="fieldset admin__fieldset composite-bundle<?= $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>"> - <legend class="legend admin__legend"><span><?= /* @escapeNotVerified */ __('Bundle Items') ?></span></legend><br /> + <legend class="legend admin__legend"> + <span><?= $block->escapeHtml(__('Bundle Items')) ?></span> + </legend><br /> <?php foreach ($options as $option) : ?> <?php if ($option->getSelections()) : ?> <?= $block->getOptionHtml($option) ?> @@ -71,7 +70,7 @@ require([ } } }; - ProductConfigure.bundleControl = new BundleControl(<?= /* @escapeNotVerified */ $block->getJsonConfig() ?>); + ProductConfigure.bundleControl = new BundleControl(<?= /* @noEscape */ $block->getJsonConfig() ?>); }); </script> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml index 44ed02f2758d0..08e89699b1f71 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml @@ -3,60 +3,58 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox */ ?> <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> -<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> +<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> -<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required _required' ?>"> +<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required _required'; } ?>"> <label class="label admin__field-label"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control admin__field-control"> - <div class="nested <?php if ($_option->getDecoratedIsLast()):?> last<?php endif;?>"> + <div class="nested <?php if ($_option->getDecoratedIsLast()) :?> last<?php endif;?>"> - <?php if (count($_selections) == 1 && $_option->getRequired()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> + <?php if (count($_selections) == 1 && $_option->getRequired()) : ?> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> <input type="hidden" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selections[0]) ?>" /> - <?php else:?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>" + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" /> + <?php else :?> - <?php foreach ($_selections as $_selection): ?> + <?php foreach ($_selections as $_selection) : ?> <div class="field choice admin__field admin__field-option"> <input - class="change-container-classname admin__control-checkbox checkbox bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" + class="change-container-classname admin__control-checkbox checkbox bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> <?php if ($_option->getRequired()) { echo 'validate-one-required-by-name'; } ?>" + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" type="checkbox" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][<?= /* @escapeNotVerified */ $_selection->getId() ?>]" - <?php if ($block->isSelected($_selection)):?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]" + <?php if ($block->isSelected($_selection)) :?> <?= ' checked="checked"' ?> <?php endif;?> - <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck):?> + <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) :?> <?= ' disabled="disabled"' ?> <?php endif;?> - value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" + value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" onclick="ProductConfigure.bundleControl.changeSelection(this)" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selection) ?>" /> + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>" /> <label class="admin__field-label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"> - <span><?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selection) ?></span> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"> + <span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span> </label> - <?php if ($_option->getRequired()): ?> - <?= /* @escapeNotVerified */ $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?> + <?php if ($_option->getRequired()) : ?> + <?= /* @noEscape */ $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?> <?php endif;?> </div> <?php endforeach; ?> - <div id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></div> + <div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml index 8c13dd6479d4d..f4c4e3e51ae09 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml @@ -3,32 +3,34 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Multi */ ?> <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> -<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> -<div class="field admin__field <?php if ($_option->getRequired()) echo ' required' ?><?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>"> +<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> +<div class="field admin__field <?php if ($_option->getRequired()) { echo ' required'; } ?><?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>"> <label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label> <div class="control admin__field-control"> - <?php if (count($_selections) == 1 && $_option->getRequired()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> - <input type="hidden" name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selections[0]) ?>" /> - <?php else: ?> - <select multiple="multiple" size="5" id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][]" - class="admin__control-multiselect bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> multiselect change-container-classname" + <?php if (count($_selections) == 1 && $_option->getRequired()) : ?> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> + <input type="hidden" name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>" + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" /> + <?php else : ?> + <select multiple="multiple" size="5" id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][]" + class="admin__control-multiselect bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> multiselect change-container-classname" onchange="ProductConfigure.bundleControl.changeSelection(this)"> - <?php if(!$_option->getRequired()): ?> - <option value=""><?= /* @escapeNotVerified */ __('None') ?></option> + <?php if (!$_option->getRequired()) : ?> + <option value=""><?= $block->escapeHtml(__('None')) ?></option> <?php endif; ?> - <?php foreach ($_selections as $_selection): ?> - <option value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"<?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?> price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selection) ?>"><?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selection, false) ?></option> + <?php foreach ($_selections as $_selection) : ?> + <option value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + <?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?> + <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?> + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>"> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection, false) ?></option> <?php endforeach; ?> </select> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml index f0912979a9248..0c3835fb32af8 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml @@ -3,69 +3,73 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Radio */ ?> <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> <?php $_default = $_option->getDefaultSelection(); ?> -<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> +<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> <?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?> -<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required' ?>"> +<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required'; } ?>"> <label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label> <div class="control admin__field-control"> - <div class="nested<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selections[0]) ?> + <div class="nested<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>"> + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?> <input type="hidden" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selections[0]) ?>" /> - <?php else:?> - <?php if (!$_option->getRequired()): ?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>" + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" /> + <?php else :?> + <?php if (!$_option->getRequired()) : ?> <div class="field choice admin__field admin__field-option"> <input type="radio" class="radio admin__control-radio" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]"<?= ($_default && $_default->isSalable()) ? '' : ' checked="checked" ' ?> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"<?= ($_default && $_default->isSalable()) ? '' : ' checked="checked" ' ?> value="" onclick="ProductConfigure.bundleControl.changeSelection(this)" /> <label class="admin__field-label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>"><span><?= /* @escapeNotVerified */ __('None') ?></span></label> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"><span><?= $block->escapeHtml(__('None')) ?></span></label> </div> <?php endif; ?> - <?php foreach ($_selections as $_selection): ?> + <?php foreach ($_selections as $_selection) : ?> <div class="field choice admin__field admin__field-option"> <input type="radio" class="radio admin__control-radio <?= $_option->getRequired() ? ' validate-one-required-by-name' : '' ?> change-container-classname" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - <?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?> - value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + <?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?> + <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?> + value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" onclick="ProductConfigure.bundleControl.changeSelection(this)" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selection) ?>" - qtyId="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input" /> + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>" + qtyId="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input" /> <label class="admin__field-label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"><span><?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selection) ?></span></label> - <?php if ($_option->getRequired()): ?> - <?= /* @escapeNotVerified */ $block->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"> + <span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span> + </label> + <?php if ($_option->getRequired()) : ?> + <?= /* @noEscape */ $block->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?> <?php endif; ?> </div> <?php endforeach; ?> - <div id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></div> + <div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div> <?php endif; ?> <div class="field admin__field qty"> <label class="label admin__field-label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"><span><?= /* @escapeNotVerified */ __('Quantity:') ?></span></label> - <div class="control admin__field-control"><input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input" - class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"> + <span><?= $block->escapeHtml(__('Quantity:')) ?></span> + </label> + <div class="control admin__field-control"><input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input" + class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>" type="text" - name="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" value="<?= /* @escapeNotVerified */ $_defaultQty ?>" /> + name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" /> </div> </div> </div> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml index 32766f62163ed..fbb7f7fbb7b38 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml @@ -3,36 +3,39 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Select */ ?> <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> <?php $_default = $_option->getDefaultSelection(); ?> -<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> +<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> <?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?> -<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?><?php if ($_option->getRequired()) echo ' required _required' ?>"> +<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?><?php if ($_option->getRequired()) { echo ' required _required'; } ?>"> <label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label> <div class="control admin__field-control"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selections[0]) ?> - <input type="hidden" name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>" - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selections[0]) ?>" /> - <?php else:?> - <select id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> select admin__control-select change-container-classname" + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?> + <input type="hidden" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>" + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" /> + <?php else :?> + <select id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> select admin__control-select change-container-classname" onchange="ProductConfigure.bundleControl.changeSelection(this)"> - <option value=""><?= /* @escapeNotVerified */ __('Choose a selection...') ?></option> - <?php foreach ($_selections as $_selection): ?> + <option value=""><?= $block->escapeHtml(__('Choose a selection...')) ?></option> + <?php foreach ($_selections as $_selection) : ?> <option - value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"<?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?> - price="<?= /* @escapeNotVerified */ $block->getSelectionPrice($_selection) ?>" - qtyId="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"><?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selection, false) ?></option> + value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + <?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?> + <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?> + price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>" + qtyId="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selection, false) ?> + </option> <?php endforeach; ?> </select> <?php endif; ?> @@ -40,12 +43,16 @@ <div class="nested"> <div class="field admin__field qty"> <label class="label admin__field-label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"><span><?= /* @escapeNotVerified */ __('Quantity:') ?></span></label> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"> + <span><?= $block->escapeHtml(__('Quantity:')) ?></span> + </label> <div class="control admin__field-control"> - <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input" - class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" - name="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" value="<?= /* @escapeNotVerified */ $_defaultQty ?>" /> + <input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input" + class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>" + type="text" + name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" /> </div> </div> </div> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml index 5b27412dd885b..c8ab6cc5b98d2 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle */ ?> <script> @@ -19,14 +17,20 @@ if(typeof Bundle=='undefined') { <div id="bundle_product_container" class="entry-edit form-inline"> <fieldset class="fieldset"> <div class="field field-ship-bundle-items"> - <label for="shipment_type" class="label"><?= /* @escapeNotVerified */ __('Ship Bundle Items') ?></label> + <label for="shipment_type" class="label"><?= $block->escapeHtml(__('Ship Bundle Items')) ?></label> <div class="control"> - <select <?php if ($block->isReadonly()): ?>disabled="disabled" <?php endif;?> + <select <?php if ($block->isReadonly()) : ?>disabled="disabled" <?php endif;?> id="shipment_type" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[shipment_type]" + name="<?= $block->escapeHtmlAttr($block->getFieldSuffix()) ?>[shipment_type]" class="select"> - <option value="1"><?= /* @escapeNotVerified */ __('Separately') ?></option> - <option value="0"<?php if ($block->getProduct()->getShipmentType() == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Together') ?></option> + <option value="1"><?= $block->escapeHtml(__('Separately')) ?></option> + <option value="0" + <?php if ($block->getProduct()->getShipmentType() == 0) : ?> + selected="selected" + <?php endif; ?> + > + <?= $block->escapeHtml(__('Together')) ?> + </option> </select> </div> </div> @@ -48,7 +52,7 @@ require(["prototype", "mage/adminhtml/form"], function(){ // re-bind form elements onchange varienWindowOnload(true); - <?php if ($block->isReadonly()):?> + <?php if ($block->isReadonly()) :?> $('product_bundle_container').select('input', 'select', 'textarea', 'button').each(function(input){ input.disabled = true; if (input.tagName.toLowerCase() == 'button') { diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml index 783d71beb1646..4d68d363b7484 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml @@ -3,16 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option */ ?> <script id="bundle-option-template" type="text/x-magento-template"> - <div id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>" class="option-box"> - <div class="fieldset-wrapper admin__collapsible-block-wrapper opened" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>-wrapper"> + <div id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>" class="option-box"> + <div class="fieldset-wrapper admin__collapsible-block-wrapper opened" id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>-wrapper"> <div class="fieldset-wrapper-title"> - <strong class="admin__collapsible-title" data-toggle="collapse" data-target="#<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>-content"> + <strong class="admin__collapsible-title" data-toggle="collapse" data-target="#<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>-content"> <span><%- data.default_title %></span> </strong> <div class="actions"> @@ -20,55 +18,56 @@ </div> <div data-role="draggable-handle" class="draggable-handle"></div> </div> - <div class="fieldset-wrapper-content in collapse" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>-content"> + <div class="fieldset-wrapper-content in collapse" id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>-content"> <fieldset class="fieldset"> <fieldset class="fieldset-alt"> <div class="field field-option-title required"> - <label class="label" for="id_<?= /* @escapeNotVerified */ $block->getFieldName() ?>_<%- data.index %>_title"> - <?= /* @escapeNotVerified */ __('Option Title') ?> + <label class="label" for="id_<?= $block->escapeHtmlAttr($block->getFieldName()) ?>_<%- data.index %>_title"> + <?= $block->escapeHtml(__('Option Title')) ?> </label> <div class="control"> - <?php if ($block->isDefaultStore()): ?> + <?php if ($block->isDefaultStore()) : ?> <input class="input-text required-entry" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][title]" - id="id_<?= /* @escapeNotVerified */ $block->getFieldName() ?>_<%- data.index %>_title" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][title]" + id="id_<?= $block->escapeHtmlAttr($block->getFieldName()) ?>_<%- data.index %>_title" value="<%- data.title %>" data-original-value="<%- data.title %>" /> - <?php else: ?> + <?php else : ?> <input class="input-text required-entry" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][default_title]" - id="id_<?= /* @escapeNotVerified */ $block->getFieldName() ?>_<%- data.index %>_default_title" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][default_title]" + id="id_<?= $block->escapeHtmlAttr($block->getFieldName()) ?>_<%- data.index %>_default_title" value="<%- data.default_title %>" data-original-value="<%- data.default_title %>" /> <?php endif; ?> <input type="hidden" - id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_id_<%- data.index %>" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][option_id]" + id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_id_<%- data.index %>" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][option_id]" value="<%- data.option_id %>" /> <input type="hidden" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][delete]" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][delete]" value="" data-state="deleted" /> </div> </div> - <?php if (!$block->isDefaultStore()): ?> + <?php if (!$block->isDefaultStore()) : ?> <div class="field field-option-store-view required"> - <label class="label" for="id_<?= /* @escapeNotVerified */ $block->getFieldName() ?>_<%- data.index %>_title_store"> - <?= /* @escapeNotVerified */ __('Store View Title') ?> + <label class="label" for="id_<?= $block->escapeHtmlAttr($block->getFieldName()) ?>_<%- data.index %>_title_store"> + <?= $block->escapeHtml(__('Store View Title')) ?> </label> <div class="control"> - <input class="input-text required-entry" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][title]" - id="id_<?= /* @escapeNotVerified */ $block->getFieldName() ?>_<%- data.index %>_title_store" + <input class="input-text required-entry" + type="text" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][title]" + id="id_<?= $block->escapeHtmlAttr($block->getFieldName()) ?>_<%- data.index %>_title_store" value="<%- data.title %>" /> </div> </div> <?php endif; ?> <div class="field field-option-input-type required"> - <label class="label" for="<?= /* @escapeNotVerified */ $block->getFieldId() . '_<%- data.index %>_type' ?>"> - <?= /* @escapeNotVerified */ __('Input Type') ?> + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId() . '_<%- data.index %>_type') ?>"> + <?= $block->escapeHtml(__('Input Type')) ?> </label> <div class="control"> <?= $block->getTypeSelectHtml() ?> @@ -81,19 +80,19 @@ checked="checked" id="field-option-req" /> <label for="field-option-req"> - <?= /* @escapeNotVerified */ __('Required') ?> + <?= $block->escapeHtml(__('Required')) ?> </label> <span style="display:none"><?= $block->getRequireSelectHtml() ?></span> </div> </div> <div class="field field-option-position no-display"> <label class="label" for="field-option-position"> - <?= /* @escapeNotVerified */ __('Position') ?> + <?= $block->escapeHtml(__('Position')) ?> </label> <div class="control"> <input class="input-text validate-zero-or-greater" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.index %>][position]" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.index %>][position]" value="<%- data.position %>" id="field-option-position" /> </div> @@ -101,13 +100,13 @@ </fieldset> <div class="no-products-message"> - <?= /* @escapeNotVerified */ __('There are no products in this option.') ?> + <?= $block->escapeHtml(__('There are no products in this option.')) ?> </div> <?= $block->getAddSelectionButtonHtml() ?> </fieldset> </div> </div> - <div id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_search_<%- data.index %>" class="selection-search"></div> + <div id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_search_<%- data.index %>" class="selection-search"></div> </div> </script> @@ -141,7 +140,7 @@ function changeInputType(oldObject, oType) { Bundle.Option = Class.create(); Bundle.Option.prototype = { - idLabel : '<?= /* @escapeNotVerified */ $block->getFieldId() ?>', + idLabel : '<?= $block->escapeJs($block->getFieldId()) ?>', templateText : '', itemsCount : 0, initialize : function(template) { @@ -150,7 +149,7 @@ Bundle.Option.prototype = { add : function(data) { if (!data) { - data = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode(['default_title' => __('New Option')]) ?>; + data = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode(['default_title' => __('New Option')]) ?>; } else { data.title = data.title.replace(/</g, "<"); data.title = data.title.replace(/"/g, """); @@ -280,17 +279,17 @@ Bundle.Option.prototype = { var optionIndex = 0; bOption = new Bundle.Option(optionTemplate); <?php - foreach ($block->getOptions() as $_option) { - /** @var $_option \Magento\Bundle\Model\Option */ - /* @escapeNotVerified */ echo 'optionIndex = bOption.add(', $_option->toJson(), ');', PHP_EOL; - if ($_option->getSelections()) { - foreach ($_option->getSelections() as $_selection) { - /** @var $_selection \Magento\Catalog\Model\Product */ - $_selection->setName($block->escapeHtml($_selection->getName())); - /* @escapeNotVerified */ echo 'bSelection.addRow(optionIndex,', $_selection->toJson(), ');', PHP_EOL; - } +foreach ($block->getOptions() as $_option) { + /** @var $_option \Magento\Bundle\Model\Option */ + /* @noEscape */ echo 'optionIndex = bOption.add(', $_option->toJson(), ');', PHP_EOL; + if ($_option->getSelections()) { + foreach ($_option->getSelections() as $_selection) { + /** @var $_selection \Magento\Catalog\Model\Product */ + $_selection->setName($block->escapeHtml($_selection->getName())); + /* @noEscape */ echo 'bSelection.addRow(optionIndex,', $_selection->toJson(), ');', PHP_EOL; } } +} ?> function togglePriceType() { bOption['priceType' + ($('price_type').value == '1' ? 'Fixed' : 'Dynamic')](); diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml index 91c245afe5717..0f1167f3d3eaa 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Selection */ ?> <script id="bundle-option-selection-box-template" type="text/x-magento-template"> @@ -13,16 +11,16 @@ <thead> <tr class="headings"> <th class="col-draggable"></th> - <th class="col-default"><?= /* @escapeNotVerified */ __('Default') ?></th> - <th class="col-name"><?= /* @escapeNotVerified */ __('Name') ?></th> - <th class="col-sku"><?= /* @escapeNotVerified */ __('SKU') ?></th> - <?php if ($block->getCanReadPrice() !== false): ?> - <th class="col-price price-type-box"><?= /* @escapeNotVerified */ __('Price') ?></th> - <th class="col-price price-type-box"><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th class="col-default"><?= $block->escapeHtml(__('Default')) ?></th> + <th class="col-name"><?= $block->escapeHtml(__('Name')) ?></th> + <th class="col-sku"><?= $block->escapeHtml(__('SKU')) ?></th> + <?php if ($block->getCanReadPrice() !== false) : ?> + <th class="col-price price-type-box"><?= $block->escapeHtml(__('Price')) ?></th> + <th class="col-price price-type-box"><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th class="col-qty"><?= /* @escapeNotVerified */ __('Default Quantity') ?></th> - <th class="col-uqty qty-box"><?= /* @escapeNotVerified */ __('User Defined') ?></th> - <th class="col-order type-order" style="display:none"><?= /* @escapeNotVerified */ __('Position') ?></th> + <th class="col-qty"><?= $block->escapeHtml(__('Default Quantity')) ?></th> + <th class="col-uqty qty-box"><?= $block->escapeHtml(__('User Defined')) ?></th> + <th class="col-order type-order" style="display:none"><?= $block->escapeHtml(__('Position')) ?></th> <th class="col-actions"></th> </tr> </thead> @@ -33,31 +31,38 @@ <script id="bundle-option-selection-row-template" type="text/x-magento-template"> <td class="col-draggable"> <span data-role="draggable-handle" class="draggable-handle"></span> - <input type="hidden" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_id<%- data.index %>" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_id]" + <input type="hidden" + id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_id<%- data.index %>" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][selection_id]" value="<%- data.selection_id %>"/> - <input type="hidden" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][option_id]" + <input type="hidden" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][option_id]" value="<%- data.option_id %>"/> - <input type="hidden" class="product" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][product_id]" + <input type="hidden" + class="product" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][product_id]" value="<%- data.product_id %>"/> - <input type="hidden" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][delete]" - value="" class="delete"/> + <input type="hidden" name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][delete]" + value="" + class="delete"/> </td> <td class="col-default"> - <input onclick="bSelection.checkGroup(event)" type="<%- data.option_type %>" class="default" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][is_default]" + <input onclick="bSelection.checkGroup(event)" + type="<%- data.option_type %>" + class="default" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][is_default]" value="1" <%- data.checked %> /> </td> <td class="col-name"><%- data.name %></td> <td class="col-sku"><%- data.sku %></td> -<?php if ($block->getCanReadPrice() !== false): ?> +<?php if ($block->getCanReadPrice() !== false) : ?> <td class="col-price price-type-box"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>_price_value" - class="input-text required-entry validate-zero-or-greater" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" + <input id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>_price_value" + class="input-text required-entry validate-zero-or-greater" + type="text" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" value="<%- data.selection_price_value %>" - <?php if ($block->getCanEditPrice() === false): ?> + <?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>/> </td> @@ -65,19 +70,23 @@ <?= $block->getPriceTypeSelectHtml() ?> <div><?= $block->getCheckboxScopeHtml() ?></div> </td> -<?php else: ?> - <input type="hidden" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>_price_value" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" value="0" /> - <input type="hidden" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>_price_type" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_type]" value="0" /> - <?php if ($block->isUsedWebsitePrice()): ?> - <input type="hidden" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.index %>_price_scope" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][default_price_scope]" value="1" /> +<?php else : ?> + <input type="hidden" + id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>_price_value" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" value="0" /> + <input type="hidden" + id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>_price_type" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_type]" value="0" /> + <?php if ($block->isUsedWebsitePrice()) : ?> + <input type="hidden" + id="<?= $block->escapeHtmlAttr($block->getFieldId()) ?>_<%- data.index %>_price_scope" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][default_price_scope]" value="1" /> <?php endif; ?> <?php endif; ?> <td class="col-qty"> - <input class="input-text required-entry validate-greater-zero-based-on-option validate-zero-or-greater" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_qty]" + <input class="input-text required-entry validate-greater-zero-based-on-option validate-zero-or-greater" + type="text" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][selection_qty]" value="<%- data.selection_qty %>" /> </td> <td class="col-uqty qty-box"> @@ -85,8 +94,9 @@ <span style="display:none"><?= $block->getQtyTypeSelectHtml() ?></span> </td> <td class="col-order type-order" style="display:none"> - <input class="input-text required-entry validate-zero-or-greater" type="text" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][position]" + <input class="input-text required-entry validate-zero-or-greater" + type="text" + name="<?= $block->escapeHtmlAttr($block->getFieldName()) ?>[<%- data.parentIndex %>][<%- data.index %>][position]" value="<%- data.position %>" /> </td> <td class="col-actions"> @@ -106,7 +116,7 @@ var bundleTemplateBox = jQuery('#bundle-option-selection-box-template').html(), Bundle.Selection = Class.create(); Bundle.Selection.prototype = { - idLabel : '<?= /* @escapeNotVerified */ $block->getFieldId() ?>', + idLabel : '<?= $block->escapeJs($block->getFieldId()) ?>', scopePrice : <?= (int)$block->isUsedWebsitePrice() ?>, templateBox : '', templateRow : '', @@ -115,7 +125,7 @@ Bundle.Selection.prototype = { gridSelection: new Hash(), gridRemoval: new Hash(), gridSelectedProductSkus: [], - selectionSearchUrl: '<?= /* @escapeNotVerified */ $block->getSelectionSearchUrl() ?>', + selectionSearchUrl: '<?= $block->escapeUrl($block->getSelectionSearchUrl()) ?>', initialize : function() { this.templateBox = '<div class="tier form-list" id="' + this.idLabel + '_box_<%- data.parentIndex %>">' + bundleTemplateBox + '</div>'; diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml index 3aba02fadffbb..e65269559a3a9 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -21,19 +19,19 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td> </td> <td> </td> <td> </td> @@ -43,165 +41,164 @@ <td> </td> <td class="last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index == $_count && !$_showlastRow) ? ' class="border"' : '' ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"><div class="option-value"><?= $block->getValueHtml($_item) ?></div></td> <?php endif; ?> <td class="col-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'price') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-ordered-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyOrdered()*1 ?></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyOrdered()*1) ?></td> </tr> - <?php if ((float) $_item->getOrderItem()->getQtyInvoiced()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyInvoiced()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Invoiced') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyInvoiced()*1 ?></td> + <th><?= $block->escapeHtml(__('Invoiced')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyInvoiced()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyShipped() && $block->isShipmentSeparately($_item)): ?> + <?php if ((float) $_item->getOrderItem()->getQtyShipped() && $block->isShipmentSeparately($_item)) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyRefunded()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyRefunded()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Refunded') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyRefunded()*1 ?></td> + <th><?= $block->escapeHtml(__('Refunded')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyRefunded()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyCanceled()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyCanceled()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Canceled') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyCanceled()*1 ?></td> + <th><?= $block->escapeHtml(__('Canceled')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyCanceled()*1) ?></td> </tr> <?php endif; ?> </table> - <?php elseif ($block->isShipmentSeparately($_item)): ?> + <?php elseif ($block->isShipmentSeparately($_item)) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyOrdered()*1 ?></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyOrdered()*1) ?></td> </tr> - <?php if ((float) $_item->getOrderItem()->getQtyShipped()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyShipped()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> </table> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <?php if ($block->canParentReturnToStock($_item)) : ?> <td class="col-return-to-stock"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?php if ($block->canReturnItemToStock($_item)) : ?> <input type="checkbox" class="admin__control-checkbox" - name="creditmemo[items][<?= /* @escapeNotVerified */ $_item->getOrderItemId() ?>][back_to_stock]" - value="1"<?php if ($_item->getBackToStock()):?> checked="checked"<?php endif;?> /> + name="creditmemo[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>][back_to_stock]" + value="1"<?php if ($_item->getBackToStock()) :?> checked="checked"<?php endif;?> /> <label class="admin__field-label"></label> <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <?php endif; ?> <td class="col-refund col-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?php if ($block->canEditQty()) : ?> <input type="text" class="input-text admin__control-text qty-input" - name="creditmemo[items][<?= /* @escapeNotVerified */ $_item->getOrderItemId() ?>][qty]" - value="<?= /* @escapeNotVerified */ $_item->getQty()*1 ?>" /> - <?php else: ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> + name="creditmemo[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>][qty]" + value="<?= $block->escapeHtmlAttr($_item->getQty()*1) ?>" /> + <?php else : ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-subtotal"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'subtotal') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax-amount"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('tax_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-discont"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('discount_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('discount_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-total last"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'total') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions($_item->getOrderItem())): ?> + <?php if ($block->getOrderOptions($_item->getOrderItem())) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> <?php endforeach; ?> </dl> - <?php else: ?> + <?php else : ?>   <?php endif; ?> <?= $block->escapeHtml($_item->getDescription()) ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml index a9e71a79f8977..18dc5db23d562 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -21,19 +19,19 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td> </td> <td> </td> <td> </td> @@ -41,88 +39,87 @@ <td> </td> <td class="last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index == $_count && !$_showlastRow) ? ' class="border"' : '' ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"><div class="option-value"><?= $block->getValueHtml($_item) ?></div></td> <?php endif; ?> <td class="col-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'price') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-subtotal"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'subtotal') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('tax_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-discount"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('discount_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('discount_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-total last"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'total') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions()): ?> + <?php if ($block->getOrderOptions()) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions() as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions() as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml index 12da960a9c6cf..de0ac23340cc5 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -21,28 +19,28 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $shipTogether = ($_item->getOrderItem()->getProductType() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) ? !$_item->getOrderItem()->isShipSeparately() : !$_item->getOrderItem()->getParentItem()->isShipSeparately() ?> <?php $block->setPriceDataObject($_item) ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php - if ($shipTogether) { - continue; - } + if ($shipTogether) { + continue; + } ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td> </td> <td> </td> <td> </td> @@ -51,152 +49,152 @@ <td> </td> <td class="last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index == $_count && !$_showlastRow) ? ' class="border"' : '' ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"> <div class="option-value"><?= $block->getValueHtml($_item) ?></div> </td> <?php endif; ?> <td class="col-price"> - <?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?> + <?php if ($block->canShowPriceInfo($_item) || $shipTogether) : ?> <?= $block->getColumnHtml($_item, 'price') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-qty"> - <?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?> + <?php if ($block->canShowPriceInfo($_item) || $shipTogether) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><span><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyOrdered()*1 ?></span></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><span><?= $block->escapeHtml($_item->getOrderItem()->getQtyOrdered()*1) ?></span></td> </tr> - <?php if ((float) $_item->getOrderItem()->getQtyInvoiced()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyInvoiced()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Invoiced') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyInvoiced()*1 ?></td> + <th><?= $block->escapeHtml(__('Invoiced')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyInvoiced()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyShipped() && $block->isShipmentSeparately($_item)): ?> + <?php if ((float) $_item->getOrderItem()->getQtyShipped() && $block->isShipmentSeparately($_item)) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyRefunded()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyRefunded()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Refunded') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyRefunded()*1 ?></td> + <th><?= $block->escapeHtml(__('Refunded')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyRefunded()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getOrderItem()->getQtyCanceled()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyCanceled()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Canceled') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyCanceled()*1 ?></td> + <th><?= $block->escapeHtml(__('Canceled')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyCanceled()*1) ?></td> </tr> <?php endif; ?> </table> - <?php elseif ($block->isShipmentSeparately($_item)): ?> + <?php elseif ($block->isShipmentSeparately($_item)) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyOrdered()*1 ?></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyOrdered()*1) ?></td> </tr> - <?php if ((float) $_item->getOrderItem()->getQtyShipped()): ?> + <?php if ((float) $_item->getOrderItem()->getQtyShipped()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getOrderItem()->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getOrderItem()->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> </table> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-qty-invoice"> - <?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?> + <?php if ($block->canShowPriceInfo($_item) || $shipTogether) : ?> <?php if ($block->canEditQty()) : ?> <input type="text" class="input-text admin__control-text qty-input" - name="invoice[items][<?= /* @escapeNotVerified */ $_item->getOrderItemId() ?>]" - value="<?= /* @escapeNotVerified */ $_item->getQty()*1 ?>" /> + name="invoice[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>]" + value="<?= $block->escapeHtmlAttr($_item->getQty()*1) ?>" /> <?php else : ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-subtotal"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'subtotal') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('tax_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-discount"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('discount_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('discount_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-total last"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'total') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions($_item->getOrderItem())): ?> + <?php if ($block->getOrderOptions($_item->getOrderItem())) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); -}); -</script> + }); + </script> <?php endif;?> <?php endif;?> </dd> <?php endforeach; ?> </dl> - <?php else: ?> + <?php else : ?>   <?php endif; ?> <?= $block->escapeHtml($_item->getDescription()) ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml index 5f344409b6a4c..b8a2c0db82d4b 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -21,19 +19,19 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td> </td> <td> </td> <td> </td> @@ -41,89 +39,88 @@ <td> </td> <td class="last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index == $_count && !$_showlastRow) ? ' class="border"' : '' ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> - <?php else: ?> + <?php else : ?> <td class="col-product"> <div class="option-value"><?= $block->getValueHtml($_item) ?></div> </td> <?php endif; ?> <td class="col-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'price') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-subtotal"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'subtotal') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('tax_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-discount"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('discount_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('discount_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-total last"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'total') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions()): ?> + <?php if ($block->getOrderOptions()) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions() as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions() as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['protoype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml index bb0857a80d689..280bf67d63787 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -16,24 +14,24 @@ <?php $_item = $block->getItem() ?> <?php $items = array_merge([$_item], $_item->getChildrenItems()); ?> -<?php $_count = count ($items) ?> +<?php $_count = count($items) ?> <?php $_index = 0 ?> <?php $_prevOptionId = '' ?> -<?php if($block->getOrderOptions() || $_item->getDescription() || $block->canDisplayGiftmessage()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription() || $block->canDisplayGiftmessage()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_item->getParentItem()): ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_item->getParentItem()) : ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td> </td> <td> </td> <td> </td> @@ -44,161 +42,160 @@ <td> </td> <td class="last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index==$_count && !$_showlastRow)?' class="border"':'' ?>> - <?php if (!$_item->getParentItem()): ?> + <?php if (!$_item->getParentItem()) : ?> <td class="col-product"> - <div class="product-title" id="order_item_<?= /* @escapeNotVerified */ $_item->getId() ?>_title"> + <div class="product-title" id="order_item_<?= $block->escapeHtmlAttr($_item->getId()) ?>_title"> <?= $block->escapeHtml($_item->getName()) ?> </div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"> <div class="option-value"><?= $block->getValueHtml($_item) ?></div> </td> <?php endif; ?> <td class="col-status"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getStatus() ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getStatus()) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-price-original"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('original_price') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('original_price') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'price') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-ordered-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyOrdered()*1 ?></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyOrdered()*1) ?></td> </tr> - <?php if ((float) $_item->getQtyInvoiced()): ?> + <?php if ((float) $_item->getQtyInvoiced()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Invoiced') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyInvoiced()*1 ?></td> + <th><?= $block->escapeHtml(__('Invoiced')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyInvoiced()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getQtyShipped() && $block->isShipmentSeparately($_item)): ?> + <?php if ((float) $_item->getQtyShipped() && $block->isShipmentSeparately($_item)) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getQtyRefunded()): ?> + <?php if ((float) $_item->getQtyRefunded()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Refunded') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyRefunded()*1 ?></td> + <th><?= $block->escapeHtml(__('Refunded')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyRefunded()*1) ?></td> </tr> <?php endif; ?> - <?php if ((float) $_item->getQtyCanceled()): ?> + <?php if ((float) $_item->getQtyCanceled()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Canceled') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyCanceled()*1 ?></td> + <th><?= $block->escapeHtml(__('Canceled')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyCanceled()*1) ?></td> </tr> <?php endif; ?> </table> - <?php elseif ($block->isShipmentSeparately($_item)): ?> + <?php elseif ($block->isShipmentSeparately($_item)) : ?> <table class="qty-table"> <tr> - <th><?= /* @escapeNotVerified */ __('Ordered') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyOrdered()*1 ?></td> + <th><?= $block->escapeHtml(__('Ordered')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyOrdered()*1) ?></td> </tr> - <?php if ((float) $_item->getQtyShipped()): ?> + <?php if ((float) $_item->getQtyShipped()) : ?> <tr> - <th><?= /* @escapeNotVerified */ __('Shipped') ?></th> - <td><?= /* @escapeNotVerified */ $_item->getQtyShipped()*1 ?></td> + <th><?= $block->escapeHtml(__('Shipped')) ?></th> + <td><?= $block->escapeHtml($_item->getQtyShipped()*1) ?></td> </tr> <?php endif; ?> </table> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-subtotal"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'subtotal') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax-amount"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('tax_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-tax-percent"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayTaxPercent($_item) ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= /* @noEscape */ $block->displayTaxPercent($_item) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-discont"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->displayPriceAttribute('discount_amount') ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($block->displayPriceAttribute('discount_amount')) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-total last"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getColumnHtml($_item, 'total') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if($_showlastRow): ?> - <tr<?php if (!$block->canDisplayGiftmessage()) echo ' class="border"' ?>> +<?php if ($_showlastRow) : ?> + <tr<?php if (!$block->canDisplayGiftmessage()) { echo ' class="border"'; } ?>> <td class="col-product"> - <?php if ($block->getOrderOptions()): ?> + <?php if ($block->getOrderOptions()) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions() as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?>:</dt> + <?php foreach ($block->getOrderOptions() as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?>:</dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> <?php endforeach; ?> </dl> - <?php else: ?> + <?php else : ?>   <?php endif; ?> <?= $block->escapeHtml($_item->getDescription()) ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml index 2ede8277bcfc9..fe446ec095719 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer */ ?> @@ -17,85 +15,84 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td class="col-product"> </td> <td class="col-qty last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr class="<?= (++$_index == $_count && !$_showlastRow) ? 'border' : '' ?>"> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"><div class="option-value"><?= $block->getValueHtml($_item) ?></div></td> <?php endif; ?> <td class="col-ordered-qty"> - <?php if ($block->isShipmentSeparately($_item)): ?> + <?php if ($block->isShipmentSeparately($_item)) : ?> <?= $block->getColumnHtml($_item, 'qty') ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col-qty last"> - <?php if ($block->isShipmentSeparately($_item)): ?> + <?php if ($block->isShipmentSeparately($_item)) : ?> <input type="text" class="input-text admin__control-text" - name="shipment[items][<?= /* @escapeNotVerified */ $_item->getOrderItemId() ?>]" - value="<?= /* @escapeNotVerified */ $_item->getQty()*1 ?>" /> - <?php else: ?> + name="shipment[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>]" + value="<?= $block->escapeHtmlAttr($_item->getQty()*1) ?>" /> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions($_item->getOrderItem())): ?> + <?php if ($block->getOrderOptions($_item->getOrderItem())) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> <?php endforeach; ?> </dl> - <?php else: ?> + <?php else : ?>   <?php endif; ?> <?= $block->escapeHtml($_item->getDescription()) ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml index 71eabd45cbb57..d99cabe41420b 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer */ ?> @@ -17,74 +15,73 @@ <?php $_prevOptionId = '' ?> -<?php if ($block->getOrderOptions() || $_item->getDescription()): ?> +<?php if ($block->getOrderOptions() || $_item->getDescription()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php $block->setPriceDataObject($_item) ?> - <?php if ($_item->getParentItem()): ?> + <?php if ($_item->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr> - <td class="col-product"><div class="option-label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col-product"><div class="option-label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> <td class="col-qty last"> </td> </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> + <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> <tr<?= (++$_index == $_count && !$_showlastRow) ? ' class="border"' : '' ?>> - <?php if (!$_item->getParentItem()): ?> + <?php if (!$_item->getParentItem()) : ?> <td class="col-product"> <div class="product-title"><?= $block->escapeHtml($_item->getName()) ?></div> <div class="product-sku-block"> - <span><?= /* @escapeNotVerified */ __('SKU') ?>:</span> - <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))) ?> + <span><?= $block->escapeHtml(__('SKU')) ?>:</span> + <?= /* @noEscape */ implode('<br />', $this->helper(Magento\Catalog\Helper\Data::class)->splitSku($_item->getSku())) ?> </div> </td> - <?php else: ?> + <?php else : ?> <td class="col-product"><div class="option-value"><?= $block->getValueHtml($_item) ?></div></td> <?php endif; ?> <td class="col-qty last"> - <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())): ?> - <?php if (isset($shipItems[$_item->getId()])): ?> - <?= /* @escapeNotVerified */ $shipItems[$_item->getId()]->getQty()*1 ?> - <?php elseif ($_item->getIsVirtual()): ?> - <?= /* @escapeNotVerified */ __('N/A') ?> - <?php else: ?> + <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())) : ?> + <?php if (isset($shipItems[$_item->getId()])) : ?> + <?= $block->escapeHtml($shipItems[$_item->getId()]->getQty()*1) ?> + <?php elseif ($_item->getIsVirtual()) : ?> + <?= $block->escapeHtml(__('N/A')) ?> + <?php else : ?> 0 <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr class="border"> <td class="col-product"> - <?php if ($block->getOrderOptions($_item->getOrderItem())): ?> + <?php if ($block->getOrderOptions($_item->getOrderItem())) : ?> <dl class="item-options"> - <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option): ?> - <dt><?= /* @escapeNotVerified */ $option['label'] ?></dt> + <?php foreach ($block->getOrderOptions($_item->getOrderItem()) as $option) : ?> + <dt><?= $block->escapeHtml($option['label']) ?></dt> <dd> - <?php if (isset($option['custom_view']) && $option['custom_view']): ?> - <?= /* @escapeNotVerified */ $option['value'] ?> - <?php else: ?> - <?= $block->truncateString($option['value'], 55, '', $_remainder) ?> - <?php if ($_remainder):?> - ... <span id="<?= /* @escapeNotVerified */ $_id = 'id' . uniqid() ?>"><?= /* @escapeNotVerified */ $_remainder ?></span> + <?php if (isset($option['custom_view']) && $option['custom_view']) : ?> + <?= $block->escapeHtml($option['value']) ?> + <?php else : ?> + <?= $block->escapeHtml($block->truncateString($option['value'], 55, '', $_remainder)) ?> + <?php if ($_remainder) :?> + ... <span id="<?= $block->escapeHtmlAttr($_id = 'id' . uniqid()) ?>"><?= $block->escapeHtml($_remainder) ?></span> <script> -require(['prototype'], function(){ - - $('<?= /* @escapeNotVerified */ $_id ?>').hide(); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseover', function(){$('<?= /* @escapeNotVerified */ $_id ?>').show();}); - $('<?= /* @escapeNotVerified */ $_id ?>').up().observe('mouseout', function(){$('<?= /* @escapeNotVerified */ $_id ?>').hide();}); - -}); -</script> + require(['prototype'], function(){ + <?php $escapedId = $block->escapeJs($_id) ?> + $('<?= /* @noEscape */ $escapedId ?>').hide(); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseover', function(){$('<?= /* @noEscape */ $escapedId ?>').show();}); + $('<?= /* @noEscape */ $escapedId ?>').up().observe('mouseout', function(){$('<?= /* @noEscape */ $escapedId ?>').hide();}); + }); + </script> <?php endif;?> <?php endif;?> </dd> diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml index 5955d0337bb6e..26264cc2cc87f 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -21,76 +18,63 @@ $maximalPrice = $finalPriceModel->getMaximalPrice(); $regularPriceModel = $block->getPriceType('regular_price'); $maximalRegularPrice = $regularPriceModel->getMaximalPrice(); $minimalRegularPrice = $regularPriceModel->getMinimalPrice(); +$regularPriceAttributes = [ + 'display_label' => __('Regular Price'), + 'price_id' => $block->getPriceId('old-price-' . $idSuffix), + 'include_container' => true, + 'skip_adjustments' => true +]; +$renderMinimalRegularPrice = $block->renderAmount($minimalRegularPrice, $regularPriceAttributes); ?> -<?php if ($block->getSaleableItem()->getPriceView()): ?> +<?php if ($block->getSaleableItem()->getPriceView()) : ?> <p class="minimal-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [ + <?= /* @noEscape */ $block->renderAmount($minimalPrice, [ 'display_label' => __('As low as'), 'price_id' => $block->getPriceId('from-'), 'include_container' => true ]); ?> - <?php if ($minimalPrice < $minimalRegularPrice): ?> + <?php if ($minimalPrice < $minimalRegularPrice) : ?> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [ - 'display_label' => __('Regular Price'), - 'price_id' => $block->getPriceId('old-price-' . $idSuffix), - 'include_container' => true, - 'skip_adjustments' => true - ]); ?> + <?= /* @noEscape */ $renderMinimalRegularPrice ?> </span> <?php endif ?> </p> -<?php else: ?> - <?php if ($block->showRangePrice()): ?> +<?php else : ?> + <?php if ($block->showRangePrice()) : ?> <p class="price-from"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [ + <?= /* @noEscape */ $block->renderAmount($minimalPrice, [ 'display_label' => __('From'), 'price_id' => $block->getPriceId('from-'), 'price_type' => 'minPrice', 'include_container' => true ]); ?> - <?php if ($minimalPrice < $minimalRegularPrice): ?> + <?php if ($minimalPrice < $minimalRegularPrice) : ?> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [ - 'display_label' => __('Regular Price'), - 'price_id' => $block->getPriceId('old-price-' . $idSuffix), - 'include_container' => true, - 'skip_adjustments' => true - ]); ?> + <?= /* @noEscape */ $renderMinimalRegularPrice ?> </span> <?php endif ?> </p> <p class="price-to"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($maximalPrice, [ + <?= /* @noEscape */ $block->renderAmount($maximalPrice, [ 'display_label' => __('To'), 'price_id' => $block->getPriceId('to-'), 'price_type' => 'maxPrice', 'include_container' => true ]); ?> - <?php if ($maximalPrice < $maximalRegularPrice): ?> + <?php if ($maximalPrice < $maximalRegularPrice) : ?> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($maximalRegularPrice, [ - 'display_label' => __('Regular Price'), - 'price_id' => $block->getPriceId('old-price-' . $idSuffix), - 'include_container' => true, - 'skip_adjustments' => true - ]); ?> + <?= /* @noEscape */ $block->renderAmount($maximalRegularPrice, $regularPriceAttributes); ?> </span> <?php endif ?> </p> - <?php else: ?> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalPrice, [ + <?php else : ?> + <?= /* @noEscape */ $block->renderAmount($minimalPrice, [ 'price_id' => $block->getPriceId('product-price-'), 'include_container' => true ]); ?> - <?php if ($minimalPrice < $minimalRegularPrice): ?> + <?php if ($minimalPrice < $minimalRegularPrice) : ?> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($minimalRegularPrice, [ - 'display_label' => __('Regular Price'), - 'price_id' => $block->getPriceId('old-price-' . $idSuffix), - 'include_container' => true, - 'skip_adjustments' => true - ]); ?> + <?= /* @noEscape */ $renderMinimalRegularPrice ?> </span> <?php endif ?> <?php endif ?> diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/selection/amount.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/selection/amount.phtml index 53d24dd7c2c07..00bd9955632e5 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/selection/amount.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/selection/amount.phtml @@ -3,11 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Framework\Pricing\Render\Amount $block */ ?> -<?= /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool) $block->getIncludeContainer()) ?> +<?= /* @noEscape */ $block->formatCurrency($block->getDisplayValue(), (bool) $block->getIncludeContainer()) ?> diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml index 5f152c4bbefbc..f5f67588a1c49 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/tier_prices.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -16,10 +13,10 @@ $tierPriceModel = $block->getPrice(); $tierPrices = $tierPriceModel->getTierPriceList(); ?> <?php if (count($tierPrices)) : ?> - <ul class="<?= /* @escapeNotVerified */ ($block->hasListClass() ? $block->getListClass() : 'prices-tier items') ?>"> + <ul class="<?= $block->escapeHtmlAttr(($block->hasListClass() ? $block->getListClass() : 'prices-tier items')) ?>"> <?php foreach ($tierPrices as $index => $price) : ?> <li class="item"> - <?php /* @escapeNotVerified */ echo __( + <?= /* @noEscape */ __( 'Buy %1 with %2 discount each', $price['price_qty'], '<strong class="benefit">' . round($price['percentage_value']) . '%</strong>' diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml index 31a39c1cd162c..ba58544c26af5 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml @@ -6,5 +6,5 @@ ?> <button type="button" class="action back customization"> - <span><?= /* @escapeNotVerified */ __('Go back to product details') ?></span> + <span><?= $block->escapeHtml(__('Go back to product details')) ?></span> </button> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml index d7aea4237b100..480ffea5bc8b3 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml @@ -3,18 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_product = $block->getProduct() ?> -<?php if ($_product->isSaleable() && $block->hasOptions()):?> +<?php if ($_product->isSaleable() && $block->hasOptions()) :?> <div class="bundle-actions"> <button id="bundle-slide" class="action primary customize" type="button"> - <span><?= /* @escapeNotVerified */ __('Customize and Add to Cart') ?></span> + <span><?= $block->escapeHtml(__('Customize and Add to Cart')) ?></span> </button> </div> <?php endif;?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/options/notice.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/options/notice.phtml index 2dbea0fd21395..927b64352d591 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/options/notice.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/options/notice.phtml @@ -4,4 +4,4 @@ * See COPYING.txt for license details. */ ?> -<p class="required"><?= /* @escapeNotVerified */ __('* Required Fields') ?></p> +<p class="required"><?= $block->escapeHtml(__('* Required Fields')) ?></p> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml index bc4337fa7ae24..9bf179e622f17 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml @@ -3,40 +3,37 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_product = $block->getProduct(); ?> -<?php if ($_product->isSaleable() && $block->hasOptions()): ?> +<?php if ($_product->isSaleable() && $block->hasOptions()) : ?> <div id="bundleSummary" class="block-bundle-summary" data-mage-init='{"sticky":{"container": ".product-add-form"}}'> <div class="title"> - <strong><?= /* @escapeNotVerified */ __('Your Customization') ?></strong> + <strong><?= $block->escapeHtml(__('Your Customization')) ?></strong> </div> <div class="content"> <div class="bundle-info"> <?= $block->getImage($_product, 'bundled_product_customization_page')->toHtml() ?> <div class="product-details"> <strong class="product name"><?= $block->escapeHtml($_product->getName()) ?></strong> - <?php if ($_product->getIsSalable()): ?> - <p class="available stock" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> + <?php if ($_product->getIsSalable()) : ?> + <p class="available stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </p> - <?php else: ?> - <p class="unavailable stock" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else : ?> + <p class="unavailable stock" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </p> <?php endif; ?> <?= $block->getChildHtml('', true) ?> </div> </div> <div class="bundle-summary"> - <strong class="subtitle"><?= /* @escapeNotVerified */ __('Summary') ?></strong> + <strong class="subtitle"><?= $block->escapeHtml(__('Summary')) ?></strong> <div id="bundle-summary" data-container="product-summary"> <ul data-mage-init='{"productSummary": []}' class="bundle items"></ul> <script data-template="bundle-summary" type="text/x-magento-template"> @@ -46,7 +43,7 @@ </li> </script> <script data-template="bundle-option" type="text/x-magento-template"> - <div><?= /* @escapeNotVerified */ __('%1 x %2', '<%- data._quantity_ %>', '<%- data._label_ %>') ?></div> + <div><?= /* @noEscape */ __('%1 x %2', '<%- data._quantity_ %>', '<%- data._label_ %>') ?></div> </script> </div> </div> @@ -61,7 +58,7 @@ "slideBackSelector": ".action.customization.back", "bundleProductSelector": "#bundleProduct", "bundleOptionsContainer": ".product-add-form" - <?php if ($block->isStartCustomization()): ?> + <?php if ($block->isStartCustomization()) : ?> ,"autostart": true <?php endif;?> } diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml index ce9ef89a82bd1..ee29fc61d0145 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml @@ -4,19 +4,17 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle */ ?> <?php $_product = $block->getProduct() ?> -<?php if ($block->displayProductStockStatus()): ?> - <?php if ($_product->isAvailable()): ?> - <p class="stock available" title="<?= /* @escapeNotVerified */ __('Availability:') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> +<?php if ($block->displayProductStockStatus()) : ?> + <?php if ($_product->isAvailable()) : ?> + <p class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability:')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </p> - <?php else: ?> - <p class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability:') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else : ?> + <p class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability:')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </p> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml index 830d03c826f32..5b56598dc58e2 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox */ ?> @@ -17,34 +14,34 @@ </label> <div class="control"> <div class="nested options-list"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?> <input type="hidden" - class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> product bundle option" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>"/> - <?php else:?> - <?php foreach($_selections as $_selection): ?> + class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option" + name="bundle_option[<?= $block->escapeHtml($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/> + <?php else :?> + <?php foreach ($_selections as $_selection) : ?> <div class="field choice"> - <input class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> checkbox product bundle option change-container-classname" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" + <input class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> checkbox product bundle option change-container-classname" + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" type="checkbox" - <?php if ($_option->getRequired()) /* @escapeNotVerified */ echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . $_option->getId() . ']"]:checked\'}"'?> - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][<?= /* @escapeNotVerified */ $_selection->getId() ?>]" - data-selector="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][<?= /* @escapeNotVerified */ $_selection->getId() ?>]" - <?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?> - <?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?> - value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"/> + <?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']"]:checked\'}"'; } ?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]" + data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]" + <?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?> + <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?> + value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/> <label class="label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"> - <span><?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selection) ?></span> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"> + <span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span> <br/> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?> </label> </div> <?php endforeach; ?> - <div id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></div> + <div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml index 718d43070a5fd..d6f9fdb74ef62 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml @@ -3,39 +3,36 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Multi */ ?> <?php $_option = $block->getOption() ?> <?php $_selections = $_option->getSelections() ?> <div class="field option <?= ($_option->getRequired()) ? ' required': '' ?>"> - <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>"> + <label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> <input type="hidden" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>"/> - <?php else: ?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/> + <?php else : ?> <select multiple="multiple" size="5" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][]" - data-selector="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>][]" - class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> multiselect product bundle option change-container-classname" - <?php if ($_option->getRequired()) echo 'data-validate={required:true}' ?>> - <?php if(!$_option->getRequired()): ?> - <option value=""><?= /* @escapeNotVerified */ __('None') ?></option> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][]" + data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][]" + class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> multiselect product bundle option change-container-classname" + <?php if ($_option->getRequired()) { echo 'data-validate={required:true}'; } ?>> + <?php if (!$_option->getRequired()) : ?> + <option value=""><?= $block->escapeHtml(__('None')) ?></option> <?php endif; ?> - <?php foreach ($_selections as $_selection): ?> - <option value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" - <?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?> - <?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>> - <?= /* @escapeNotVerified */ $block->getSelectionQtyTitlePrice($_selection, false) ?> + <?php foreach ($_selections as $_selection) : ?> + <option value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + <?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?> + <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>> + <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection, false) ?> </option> <?php endforeach; ?> </select> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml index 1f33d97227ea3..11ed226c176c8 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Radio */ ?> <?php $_option = $block->getOption(); ?> @@ -19,8 +16,8 @@ </label> <div class="control"> <div class="nested options-list"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selections[0]) ?> + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?> <input type="hidden" class="bundle-option-<?= (int)$_option->getId() ?> product bundle option" @@ -29,54 +26,54 @@ id="bundle-option-<?= (int)$_option->getId() ?>-<?= (int)$_selections[0]->getSelectionId() ?>" checked="checked" /> - <?php else:?> - <?php if (!$_option->getRequired()): ?> + <?php else :?> + <?php if (!$_option->getRequired()) : ?> <div class="field choice"> <input type="radio" class="radio product bundle option" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" <?= ($_default && $_default->isSalable())?'':' checked="checked" ' ?> value=""/> - <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>"> - <span><?= /* @escapeNotVerified */ __('None') ?></span> + <label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"> + <span><?= $block->escapeHtml(__('None')) ?></span> </label> </div> <?php endif; ?> - <?php foreach ($_selections as $_selection): ?> + <?php foreach ($_selections as $_selection) : ?> <div class="field choice"> <input type="radio" class="radio product bundle option change-container-classname" - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" - <?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':true}"'?> - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - <?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?> - <?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?> - value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"/> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + <?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':true}"'; }?> + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + <?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?> + <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?> + value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/> <label class="label" - for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>"> - <span><?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selection) ?></span> + for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"> + <span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span> <br/> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?> </label> </div> <?php endforeach; ?> - <div id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></div> + <div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div> <?php endif; ?> <div class="field qty qty-holder"> - <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"> - <span><?= /* @escapeNotVerified */ __('Quantity') ?></span> + <label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"> + <span><?= $block->escapeHtml(__('Quantity')) ?></span> </label> <div class="control"> - <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input" - class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" + <input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input" + class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>" type="number" - name="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_defaultQty ?>"/> + name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/> </div> </div> </div> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/select.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/select.phtml index 4ea00f62b2043..1edf45fe8ca99 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/select.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/select.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Select */ ?> @@ -14,36 +11,36 @@ <?php $_default = $_option->getDefaultSelection(); ?> <?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?> <div class="field option <?= ($_option->getRequired()) ? ' required': '' ?>"> - <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>"> + <label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control"> - <?php if ($block->showSingle()): ?> - <?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selections[0]) ?> + <?php if ($block->showSingle()) : ?> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?> <input type="hidden" - class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> product bundle option" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_selections[0]->getSelectionId() ?>"/> - <?php else:?> - <select id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>" - name="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="bundle_option[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - class="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?> product bundle option bundle-option-select change-container-classname" - <?php if ($_option->getRequired()) echo 'data-validate = {required:true}' ?>> - <option value=""><?= /* @escapeNotVerified */ __('Choose a selection...') ?></option> - <?php foreach ($_selections as $_selection): ?> - <option value="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" - <?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?> - <?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>> - <?= /* @escapeNotVerified */ $block->getSelectionTitlePrice($_selection, false) ?> + class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/> + <?php else :?> + <select id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>" + name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option bundle-option-select change-container-classname" + <?php if ($_option->getRequired()) { echo 'data-validate = {required:true}'; } ?>> + <option value=""><?= $block->escapeHtml(__('Choose a selection...')) ?></option> + <?php foreach ($_selections as $_selection) : ?> + <option value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" + <?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?> + <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>> + <?= /* @noEscape */ $block->getSelectionTitlePrice($_selection, false) ?> </option> <?php endforeach; ?> </select> - <div id="option-tier-prices-<?= /* @escapeNotVerified */ $_option->getId() ?>" class="option-tier-prices"> - <?php foreach ($_selections as $_selection): ?> + <div id="option-tier-prices-<?= $block->escapeHtmlAttr($_option->getId()) ?>" class="option-tier-prices"> + <?php foreach ($_selections as $_selection) : ?> <div data-role="selection-tier-prices" - data-selection-id="<?= /* @escapeNotVerified */ $_selection->getSelectionId() ?>" + data-selection-id="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" class="selection-tier-prices"> <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?> </div> @@ -52,17 +49,17 @@ <?php endif; ?> <div class="nested"> <div class="field qty qty-holder"> - <label class="label" for="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input"> - <span><?= /* @escapeNotVerified */ __('Quantity') ?></span> + <label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"> + <span><?= $block->escapeHtml(__('Quantity')) ?></span> </label> <div class="control"> - <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> - id="bundle-option-<?= /* @escapeNotVerified */ $_option->getId() ?>-qty-input" - class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" + <input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?> + id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input" + class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>" type="number" - name="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="bundle_option_qty[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - value="<?= /* @escapeNotVerified */ $_defaultQty ?>"/> + name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/> </div> </div> </div> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml index 157e2d959720b..cac96a8aca7c3 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml @@ -3,24 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block Magento\Bundle\Block\Catalog\Product\View\Type\Bundle */ ?> <?php $product = $block->getProduct(); -$helper = $this->helper('Magento\Catalog\Helper\Output'); +$helper = $this->helper(Magento\Catalog\Helper\Output::class); $stripSelection = $product->getConfigureMode() ? true : false; $options = $block->decorateArray($block->getOptions($stripSelection)); ?> -<?php if ($product->isSaleable()):?> - <?php if (count($options)): ?> +<?php if ($product->isSaleable()) :?> + <?php if (count($options)) : ?> <script type="text/x-magento-init"> { "#product_addtocart_form": { "priceBundle": { - "optionConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>, + "optionConfig": <?= /* @noEscape */ $block->getJsonConfig() ?>, "controlContainer": ".field.option" } } @@ -28,17 +26,20 @@ $options = $block->decorateArray($block->getOptions($stripSelection)); </script> <fieldset class="fieldset fieldset-bundle-options"> <legend id="customizeTitle" class="legend title"> - <span><?= /* @escapeNotVerified */ __('Customize %1', $helper->productAttribute($product, $product->getName(), 'name')) ?></span> + <span><?= /* @noEscape */ __('Customize %1', $helper->productAttribute($product, $product->getName(), 'name')) ?></span> </legend><br /> <?= $block->getChildHtml('product_info_bundle_options_top') ?> - <?php foreach ($options as $option): ?> - <?php if (!$option->getSelections()): ?> - <?php continue; ?> - <?php endif; ?> - <?= $block->getOptionHtml($option) ?> + <?php foreach ($options as $option) : ?> + <?php + if (!$option->getSelections()) { + continue; + } else { + echo $block->getOptionHtml($option); + } + ?> <?php endforeach; ?> </fieldset> - <?php else: ?> - <p class="empty"><?= /* @escapeNotVerified */ __('No options of this product are available.') ?></p> + <?php else : ?> + <p class="empty"><?= $block->escapeHtml(__('No options of this product are available.')) ?></p> <?php endif; ?> <?php endif;?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml index a87c2167e66d4..47f9eade7f6a7 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $block->getItem() ?> @@ -13,15 +11,15 @@ <?php $items = $block->getChildren($parentItem) ?> -<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> +<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php // As part of invoice item renderer logic, the order is set on each invoice item. @@ -30,40 +28,40 @@ $_item->setOrder($_order); ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="bundle-option-label"> <td colspan="3"> - <strong><?= /* @escapeNotVerified */ $attributes['option_label'] ?></strong> + <strong><?= $block->escapeHtml($attributes['option_label']) ?></strong> </td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <tr class="bundle-item bundle-parent"> <td class="item-info"> <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> - <p class="sku"><?= /* @escapeNotVerified */ __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> </td> - <?php else: ?> + <?php else : ?> <tr class="bundle-item bundle-option-value"> <td class="item-info"> <p><?= $block->getValueHtml($_item) ?></p> </td> <?php endif; ?> <td class="item-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty() * 1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty() * 1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="item-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->getItemPrice($_item) ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($block->getItemPrice($_item)) ?> + <?php else : ?>   <?php endif; ?> </td> @@ -71,14 +69,14 @@ <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr> <td colspan="3" class="item-extra"> - <?php if ($block->getItemOptions()): ?> + <?php if ($block->getItemOptions()) : ?> <dl> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt> - <dd><?= /* @escapeNotVerified */ $option['value'] ?></dd> + <?php foreach ($block->getItemOptions() as $option) : ?> + <dt><strong><em><?= $block->escapeHtml($option['label']) ?></em></strong></dt> + <dd><?= $block->escapeHtml($option['value']) ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml index ee79ca3b0a7a5..544e5f60f54b4 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> @@ -14,15 +12,15 @@ <?php $_index = 0 ?> <?php $_order = $block->getItem()->getOrder(); ?> -<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> +<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> <?php // As part of invoice item renderer logic, the order is set on each invoice item. @@ -31,40 +29,40 @@ $_item->setOrder($_order); ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="bundle-option-label"> <td colspan="3"> - <strong><em><?= /* @escapeNotVerified */ $attributes['option_label'] ?></em></strong> + <strong><em><?= $block->escapeHtml($attributes['option_label']) ?></em></strong> </td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <tr class="bundle-item bundle-parent"> <td class="item-info"> <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> - <p class="sku"><?= /* @escapeNotVerified */ __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> </td> - <?php else: ?> + <?php else : ?> <tr class="bundle-item bundle-option-value"> <td class="item-info"> <p><?= $block->getValueHtml($_item) ?></p> </td> <?php endif; ?> <td class="item-qty"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty() * 1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty() * 1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="item-price"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->getItemPrice($_item) ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($block->getItemPrice($_item)) ?> + <?php else : ?>   <?php endif; ?> </td> @@ -72,14 +70,14 @@ <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr> <td colspan="3" class="item-extra"> - <?php if ($block->getItemOptions()): ?> + <?php if ($block->getItemOptions()) : ?> <dl> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt> - <dd><?= /* @escapeNotVerified */ $option['value'] ?></dd> + <?php foreach ($block->getItemOptions() as $option) : ?> + <dt><strong><em><?= $block->escapeHtml($option['label']) ?></em></strong></dt> + <dd><?= $block->escapeHtml($option['value']) ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml index c9c3103c448e4..2b34016f81508 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $_item = $block->getItem() ?> @@ -14,41 +12,41 @@ <?php $parentItem = $block->getItem() ?> <?php $items = array_merge([$parentItem], $parentItem->getChildrenItems()); ?> -<?php if ($block->getItemOptions() || $_item->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $_item) && $_item->getGiftMessageId()): ?> +<?php if ($block->getItemOptions() || $_item->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $_item) && $_item->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> - <?php if ($_item->getParentItem()): ?> + <?php if ($_item->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="bundle-option-label"> <td colspan="3"> - <strong><em><?= /* @escapeNotVerified */ $attributes['option_label'] ?></em></strong> + <strong><em><?= $block->escapeHtml($attributes['option_label']) ?></em></strong> </td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <?php if (!$_item->getParentItem()): ?> + <?php if (!$_item->getParentItem()) : ?> <tr class="bundle-item bundle-parent"> <td class="item-info"> <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> - <p class="sku"><?= /* @escapeNotVerified */ __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> </td> <td class="item-qty"> - <?= /* @escapeNotVerified */ $_item->getQtyOrdered() * 1 ?> + <?= $block->escapeHtml($_item->getQtyOrdered() * 1) ?> </td> <td class="item-price"> - <?= /* @escapeNotVerified */ $block->getItemPrice($_item) ?> + <?= $block->escapeHtml($block->getItemPrice($_item)) ?> </td> </tr> - <?php else: ?> + <?php else : ?> <tr class="bundle-item bundle-option-value"> <td class="item-info" colspan="3"> <p><?= $block->getValueHtml($_item) ?></p> @@ -58,25 +56,25 @@ <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr> <td colspan="3" class="item-extra"> - <?php if ($block->getItemOptions()): ?> + <?php if ($block->getItemOptions()) : ?> <dl> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt> - <dd><?= /* @escapeNotVerified */ $option['value'] ?></dd> + <?php foreach ($block->getItemOptions() as $option) : ?> + <dt><strong><em><?= $block->escapeHtml($option['label']) ?></em></strong></dt> + <dd><?= $block->escapeHtml($option['value']) ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> - <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> + <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper(Magento\GiftMessage\Helper\Message::class)->getGiftMessage($_item->getGiftMessageId())) : ?> <table class="message-gift"> <tr> <td> - <h3><?= /* @escapeNotVerified */ __('Gift Message') ?></h3> - <strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> - <br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> - <br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong> + <h3><?= $block->escapeHtml(__('Gift Message')) ?></h3> + <strong><?= $block->escapeHtml(__('From:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> + <br /><strong><?= $block->escapeHtml(__('To:')) ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> + <br /><strong><?= $block->escapeHtml(__('Message:')) ?></strong> <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?> </td> </tr> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml index 61582087d1fcc..0dbcbbb392bdc 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> @@ -14,49 +12,49 @@ <?php $items = array_merge([$parentItem->getOrderItem()], $parentItem->getOrderItem()->getChildrenItems()) ?> <?php $shipItems = $block->getChildren($parentItem) ?> -<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> +<?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> -<?php else: ?> +<?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> - <?php if ($_item->getParentItem()): ?> + <?php if ($_item->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="bundle-option-label"> <td colspan="2"> - <strong><em><?= /* @escapeNotVerified */ $attributes['option_label'] ?></em></strong> + <strong><em><?= $block->escapeHtml($attributes['option_label']) ?></em></strong> </td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <?php if (!$_item->getParentItem()): ?> + <?php if (!$_item->getParentItem()) : ?> <tr class="bundle-item bundle-parent"> <td class="item-info"> <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> - <p class="sku"><?= /* @escapeNotVerified */ __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> </td> - <?php else: ?> + <?php else : ?> <tr class="bundle-item bundle-option-value"> <td class="item-info"> <p><?= $block->getValueHtml($_item) ?></p> </td> <?php endif; ?> <td class="item-qty"> - <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())): ?> - <?php if (isset($shipItems[$_item->getId()])): ?> - <?= /* @escapeNotVerified */ $shipItems[$_item->getId()]->getQty() * 1 ?> - <?php elseif ($_item->getIsVirtual()): ?> - <?= /* @escapeNotVerified */ __('N/A') ?> - <?php else: ?> + <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())) : ?> + <?php if (isset($shipItems[$_item->getId()])) : ?> + <?= $block->escapeHtml($shipItems[$_item->getId()]->getQty() * 1) ?> + <?php elseif ($_item->getIsVirtual()) : ?> + <?= $block->escapeHtml(__('N/A')) ?> + <?php else : ?> 0 <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> @@ -64,14 +62,14 @@ <?php endforeach; ?> -<?php if ($_showlastRow): ?> +<?php if ($_showlastRow) : ?> <tr> <td colspan="2" class="item-extra"> - <?php if ($block->getItemOptions()): ?> + <?php if ($block->getItemOptions()) : ?> <dl> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt> - <dd><?= /* @escapeNotVerified */ $option['value'] ?></dd> + <?php foreach ($block->getItemOptions() as $option) : ?> + <dt><strong><em><?= $block->escapeHtml($option['label']) ?></em></strong></dt> + <dd><?= $block->escapeHtml($option['value']) ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml b/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml index bad5acc209b5f..1bd7e554a73d6 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml @@ -3,8 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml() ?> + diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml index b9d075966c5d1..2c204da2cd13d 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $block->getItem() ?> @@ -16,91 +14,95 @@ <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> - <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> + <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> - <?php else: ?> + <?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="options-label"> - <td class="col label" colspan="7"><div class="option label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col label" colspan="7"><div class="option label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> -<tr id="order-item-row-<?= /* @escapeNotVerified */ $_item->getId() ?>" class="<?php if ($_item->getOrderItem()->getParentItem()): ?>item-options-container<?php else: ?>item-parent<?php endif; ?>"<?php if ($_item->getParentItem()): ?> data-th="<?= /* @escapeNotVerified */ $attributes['option_label'] ?>"<?php endif; ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> +<tr id="order-item-row-<?= $block->escapeHtmlAttr($_item->getId()) ?>" + class="<?php if ($_item->getOrderItem()->getParentItem()) : ?>item-options-container<?php else : ?>item-parent<?php endif; ?>" + <?php if ($_item->getParentItem()) : ?> + data-th="<?= $block->escapeHtmlAttr($attributes['option_label']) ?>" + <?php endif; ?>> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"> <strong class="product name product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong> </td> - <?php else: ?> + <?php else : ?> <td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"><?= $block->getValueHtml($_item) ?></td> <?php endif; ?> <td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>"><?= $block->escapeHtml($_item->getSku()) ?></td> <td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getItemPriceHtml($_item) ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col qty" data-th="<?= $block->escapeHtml(__('Quantity')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getItemRowTotalHtml($_item) ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col discount" data-th="<?= $block->escapeHtml(__('Discount Amount')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $block->getOrder()->formatPrice(-$_item->getDiscountAmount()) ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($block->getOrder()->formatPrice(-$_item->getDiscountAmount())) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col rowtotal" data-th="<?= $block->escapeHtml(__('Row Total')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getItemRowTotalAfterDiscountHtml($_item) ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))): ?> +<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))) : ?> <tr> <td class="col options" colspan="7"> - <?php if ($_options = $block->getItemOptions()): ?> + <?php if ($_options = $block->getItemOptions()) : ?> <dl class="item-options"> <?php foreach ($_options as $_option) : ?> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <?php if (!$block->getPrintStatus()): ?> + <?php if (!$block->getPrintStatus()) : ?> <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> - <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>> - <?= /* @escapeNotVerified */ $_formatedOptionValue['value'] ?> - <?php if (isset($_formatedOptionValue['full_view'])): ?> + <dd<?php if (isset($_formatedOptionValue['full_view'])) : ?> class="tooltip wrapper"<?php endif; ?>> + <?= /* @noEscape */ $_formatedOptionValue['value'] ?> + <?php if (isset($_formatedOptionValue['full_view'])) : ?> <div class="tooltip content"> <dl class="item options"> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <dd><?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?></dd> + <dd><?= /* @noEscape */ $_formatedOptionValue['full_view'] ?></dd> </dl> </div> <?php endif; ?> </dd> - <?php else: ?> + <?php else : ?> <dd><?= $block->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd> <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml index e18d75ce77b9c..097139fbace0e 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $block->getItem() ?> @@ -15,77 +13,85 @@ <?php $_index = 0 ?> <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> - <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> + <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> - <?php else: ?> + <?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> - <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php if ($_item->getOrderItem()->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="options-label"> - <td class="col label" colspan="5"><div class="option label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td class="col label" colspan="5"> + <div class="option label"><?= $block->escapeHtml($attributes['option_label']) ?></div> + </td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <tr id="order-item-row-<?= /* @escapeNotVerified */ $_item->getId() ?>" class="<?php if ($_item->getOrderItem()->getParentItem()): ?>item-options-container<?php else: ?>item-parent<?php endif; ?>"<?php if ($_item->getOrderItem()->getParentItem()): ?> data-th="<?= /* @escapeNotVerified */ $attributes['option_label'] ?>"<?php endif; ?>> - <?php if (!$_item->getOrderItem()->getParentItem()): ?> + <tr id="order-item-row-<?= $block->escapeHtmlAttr($_item->getId()) ?>" + class="<?php if ($_item->getOrderItem()->getParentItem()) : ?>item-options-container + <?php else : ?>item-parent + <?php endif; ?>" + <?php if ($_item->getOrderItem()->getParentItem()) : ?> + data-th="<?= $block->escapeHtmlAttr($attributes['option_label']) ?>" + <?php endif; ?>> + <?php if (!$_item->getOrderItem()->getParentItem()) : ?> <td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"> <strong class="product name product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong> </td> - <?php else: ?> + <?php else : ?> <td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"><?= $block->getValueHtml($_item) ?></td> <?php endif; ?> <td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>"><?= $block->escapeHtml($_item->getSku()) ?></td> <td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getItemPriceHtml($_item) ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col qty" data-th="<?= $block->escapeHtml(__('Qty Invoiced')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?= /* @escapeNotVerified */ $_item->getQty()*1 ?> - <?php else: ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> + <?= $block->escapeHtml($_item->getQty()*1) ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>"> - <?php if ($block->canShowPriceInfo($_item)): ?> + <?php if ($block->canShowPriceInfo($_item)) : ?> <?= $block->getItemRowTotalHtml($_item) ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))): ?> +<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))) : ?> <tr> <td class="col options" colspan="5"> - <?php if ($_options = $block->getItemOptions()): ?> + <?php if ($_options = $block->getItemOptions()) : ?> <dl class="item-options"> <?php foreach ($_options as $_option) : ?> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <?php if (!$block->getPrintStatus()): ?> + <?php if (!$block->getPrintStatus()) : ?> <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> - <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>> - <?= /* @escapeNotVerified */ $_formatedOptionValue['value'] ?> - <?php if (isset($_formatedOptionValue['full_view'])): ?> + <dd<?php if (isset($_formatedOptionValue['full_view'])) : ?> class="tooltip wrapper"<?php endif; ?>> + <?= /* @noEscape */ $_formatedOptionValue['value'] ?> + <?php if (isset($_formatedOptionValue['full_view'])) : ?> <div class="tooltip content"> <dl class="item options"> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <dd><?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?></dd> + <dd><?= /* @noEscape */ $_formatedOptionValue['full_view'] ?></dd> </dl> </div> <?php endif; ?> </dd> - <?php else: ?> + <?php else : ?> <dd><?= $block->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd> <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml index 74e1c5f874954..14c7de8429fdf 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ $parentItem = $block->getItem(); $items = array_merge([$parentItem], $parentItem->getChildrenItems()); @@ -13,20 +11,20 @@ $index = 0; $prevOptionId = ''; ?> -<?php foreach ($items as $item): ?> +<?php foreach ($items as $item) : ?> <?php if ($block->getItemOptions() || $parentItem->getDescription() - || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) - && $parentItem->getGiftMessageId()): ?> + || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) + && $parentItem->getGiftMessageId()) : ?> <?php $showLastRow = true; ?> - <?php else: ?> + <?php else : ?> <?php $showLastRow = false; ?> <?php endif; ?> - <?php if ($item->getParentItem()): ?> + <?php if ($item->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($item) ?> - <?php if ($prevOptionId != $attributes['option_id']): ?> + <?php if ($prevOptionId != $attributes['option_id']) : ?> <tr class="options-label"> <td class="col label" colspan="5"><?= $block->escapeHtml($attributes['option_label']); ?></td> </tr> @@ -34,19 +32,19 @@ $prevOptionId = ''; <?php endif; ?> <?php endif; ?> <tr id="order-item-row-<?= /* @noEscape */ $item->getId() ?>" - class="<?php if ($item->getParentItem()): ?> + class="<?php if ($item->getParentItem()) : ?> item-options-container - <?php else: ?> + <?php else : ?> item-parent <?php endif; ?>" - <?php if ($item->getParentItem()): ?> + <?php if ($item->getParentItem()) : ?> data-th="<?= $block->escapeHtml($attributes['option_label']); ?>" <?php endif; ?>> - <?php if (!$item->getParentItem()): ?> + <?php if (!$item->getParentItem()) : ?> <td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')); ?>"> <strong class="product name product-item-name"><?= $block->escapeHtml($item->getName()); ?></strong> </td> - <?php else: ?> + <?php else : ?> <td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')); ?>"> <?= $block->getValueHtml($item); ?> </td> @@ -55,84 +53,82 @@ $prevOptionId = ''; <?= /* @noEscape */ $block->prepareSku($item->getSku()); ?> </td> <td class="col price" data-th="<?= $block->escapeHtml(__('Price')); ?>"> - <?php if (!$item->getParentItem()): ?> + <?php if (!$item->getParentItem()) : ?> <?= /* @noEscape */ $block->getItemPriceHtml(); ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> <td class="col qty" data-th="<?= $block->escapeHtml(__('Quantity')); ?>"> - <?php if ( - ($item->getParentItem() && $block->isChildCalculated()) || + <?php if (($item->getParentItem() && $block->isChildCalculated()) || (!$item->getParentItem() && !$block->isChildCalculated()) || - ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())): ?> + ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())) : ?> <ul class="items-qty"> <?php endif; ?> <?php if (($item->getParentItem() && $block->isChildCalculated()) || - (!$item->getParentItem() && !$block->isChildCalculated())): ?> - <?php if ($item->getQtyOrdered() > 0): ?> + (!$item->getParentItem() && !$block->isChildCalculated())) : ?> + <?php if ($item->getQtyOrdered() > 0) : ?> <li class="item"> <span class="title"><?= $block->escapeHtml(__('Ordered')); ?></span> <span class="content"><?= /* @noEscape */ $item->getQtyOrdered() * 1; ?></span> </li> <?php endif; ?> - <?php if ($item->getQtyShipped() > 0 && !$block->isShipmentSeparately()): ?> + <?php if ($item->getQtyShipped() > 0 && !$block->isShipmentSeparately()) : ?> <li class="item"> <span class="title"><?= $block->escapeHtml(__('Shipped')); ?></span> <span class="content"><?= /* @noEscape */ $item->getQtyShipped() * 1; ?></span> </li> <?php endif; ?> - <?php if ($item->getQtyCanceled() > 0): ?> + <?php if ($item->getQtyCanceled() > 0) : ?> <li class="item"> <span class="title"><?= $block->escapeHtml(__('Canceled')); ?></span> <span class="content"><?= /* @noEscape */ $item->getQtyCanceled() * 1; ?></span> </li> <?php endif; ?> - <?php if ($item->getQtyRefunded() > 0): ?> + <?php if ($item->getQtyRefunded() > 0) : ?> <li class="item"> <span class="title"><?= $block->escapeHtml(__('Refunded')); ?></span> <span class="content"><?= /* @noEscape */ $item->getQtyRefunded() * 1; ?></span> </li> <?php endif; ?> - <?php elseif ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately()): ?> + <?php elseif ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately()) : ?> <li class="item"> <span class="title"><?= $block->escapeHtml(__('Shipped')); ?></span> <span class="content"><?= /* @noEscape */ $item->getQtyShipped() * 1; ?></span> </li> - <?php else: ?> + <?php else : ?> <span class="content"><?= /* @noEscape */ $parentItem->getQtyOrdered() * 1; ?></span> <?php endif; ?> - <?php if ( - ($item->getParentItem() && $block->isChildCalculated()) || + <?php if (($item->getParentItem() && $block->isChildCalculated()) || (!$item->getParentItem() && !$block->isChildCalculated()) || - ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())):?> + ($item->getQtyShipped() > 0 && $item->getParentItem() && $block->isShipmentSeparately())) :?> </ul> <?php endif; ?> </td> <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>"> - <?php if (!$item->getParentItem()): ?> + <?php if (!$item->getParentItem()) : ?> <?= /* @noEscape */ $block->getItemRowTotalHtml(); ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($showLastRow && (($options = $block->getItemOptions()) || $block->escapeHtml($item->getDescription()))): ?> +<?php if ($showLastRow && (($options = $block->getItemOptions()) || $block->escapeHtml($item->getDescription()))) : ?> <tr> <td class="col options" colspan="5"> - <?php if ($options = $block->getItemOptions()): ?> + <?php if ($options = $block->getItemOptions()) : ?> <dl class="item-options"> <?php foreach ($options as $option) : ?> <dt><?= $block->escapeHtml($option['label']) ?></dt> - <?php if (!$block->getPrintStatus()): ?> + <?php if (!$block->getPrintStatus()) : ?> <?php $formattedOptionValue = $block->getFormatedOptionValue($option) ?> - <dd<?php if (isset($formattedOptionValue['full_view'])): ?> + <dd<?php if (isset($formattedOptionValue['full_view'])) : ?> class="tooltip wrapper" <?php endif; ?>> <?= /* @noEscape */ $formattedOptionValue['value'] ?> - <?php if (isset($formattedOptionValue['full_view'])): ?> + <?php if (isset($formattedOptionValue['full_view'])) : ?> <div class="tooltip content"> <dl class="item options"> <dt><?= $block->escapeHtml($option['label']); ?></dt> @@ -141,7 +137,7 @@ $prevOptionId = ''; </div> <?php endif; ?> </dd> - <?php else: ?> + <?php else : ?> <dd><?= $block->escapeHtml((isset($option['print_value']) ? $option['print_value'] : $option['value'])); ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml index 0cd39156b2513..db658964253ea 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> @@ -16,69 +14,69 @@ <?php $_prevOptionId = '' ?> -<?php foreach ($items as $_item): ?> +<?php foreach ($items as $_item) : ?> - <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> + <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper(Magento\GiftMessage\Helper\Message::class)->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()) : ?> <?php $_showlastRow = true ?> - <?php else: ?> + <?php else : ?> <?php $_showlastRow = false ?> <?php endif; ?> - <?php if ($_item->getParentItem()): ?> + <?php if ($_item->getParentItem()) : ?> <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> + <?php if ($_prevOptionId != $attributes['option_id']) : ?> <tr class="options-label"> - <td colspan="3" class="col label"><div class="option label"><?= /* @escapeNotVerified */ $attributes['option_label'] ?></div></td> + <td colspan="3" class="col label"><div class="option label"><?= $block->escapeHtml($attributes['option_label']) ?></div></td> </tr> <?php $_prevOptionId = $attributes['option_id'] ?> <?php endif; ?> <?php endif; ?> - <tr id="order-item-row-<?= /* @escapeNotVerified */ $_item->getId() ?>" class="<?php if ($_item->getParentItem()): ?>item-options-container<?php else: ?>item-parent<?php endif; ?>"<?php if ($_item->getParentItem()): ?> data-th="<?= /* @escapeNotVerified */ $attributes['option_label'] ?>"<?php endif; ?>> - <?php if (!$_item->getParentItem()): ?> + <tr id="order-item-row-<?= $block->escapeHtmlAttr($_item->getId()) ?>" class="<?php if ($_item->getParentItem()) : ?>item-options-container<?php else : ?>item-parent<?php endif; ?>"<?php if ($_item->getParentItem()) : ?> data-th="<?= $block->escapeHtmlAttr($attributes['option_label']) ?>"<?php endif; ?>> + <?php if (!$_item->getParentItem()) : ?> <td class="col name" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"> <strong class="product name product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong> </td> - <?php else: ?> + <?php else : ?> <td class="col value" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"><?= $block->getValueHtml($_item) ?></td> <?php endif; ?> <td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>"><?= $block->escapeHtml($_item->getSku()) ?></td> <td class="col qty" data-th="<?= $block->escapeHtml(__('Qty Shipped')) ?>"> - <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())): ?> - <?php if (isset($shipItems[$_item->getId()])): ?> - <?= /* @escapeNotVerified */ $shipItems[$_item->getId()]->getQty()*1 ?> - <?php elseif ($_item->getIsVirtual()): ?> - <?= /* @escapeNotVerified */ __('N/A') ?> - <?php else: ?> + <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())) : ?> + <?php if (isset($shipItems[$_item->getId()])) : ?> + <?= $block->escapeHtml($shipItems[$_item->getId()]->getQty()*1) ?> + <?php elseif ($_item->getIsVirtual()) : ?> + <?= $block->escapeHtml(__('N/A')) ?> + <?php else : ?> 0 <?php endif; ?> - <?php else: ?> + <?php else : ?>   <?php endif; ?> </td> </tr> <?php endforeach; ?> -<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))): ?> +<?php if ($_showlastRow && (($_options = $block->getItemOptions()) || $block->escapeHtml($_item->getDescription()))) : ?> <tr> <td class="col options" colspan="3"> - <?php if ($_options = $block->getItemOptions()): ?> + <?php if ($_options = $block->getItemOptions()) : ?> <dl class="item-options"> <?php foreach ($_options as $_option) : ?> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <?php if (!$block->getPrintStatus()): ?> + <?php if (!$block->getPrintStatus()) : ?> <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> - <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="tooltip wrapper"<?php endif; ?>> - <?= /* @escapeNotVerified */ $_formatedOptionValue['value'] ?> - <?php if (isset($_formatedOptionValue['full_view'])): ?> + <dd<?php if (isset($_formatedOptionValue['full_view'])) : ?> class="tooltip wrapper"<?php endif; ?>> + <?= /* @noEscape */ $_formatedOptionValue['value'] ?> + <?php if (isset($_formatedOptionValue['full_view'])) : ?> <div class="tooltip content"> <dl class="item options"> <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <dd><?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?></dd> + <dd><?= /* @noEscape */ $_formatedOptionValue['full_view'] ?></dd> </dl> </div> <?php endif; ?> </dd> - <?php else: ?> + <?php else : ?> <dd><?= $block->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd> <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php index 3467c7aac289b..d95ee7f8f2cf9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php @@ -11,6 +11,9 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit; +/** + * Admin AttributeSet block + */ class AttributeSet extends \Magento\Backend\Block\Widget\Form { /** @@ -42,12 +45,14 @@ public function __construct( public function getSelectorOptions() { return [ - 'source' => $this->getUrl('catalog/product/suggestAttributeSets'), + 'source' => $this->escapeUrl($this->getUrl('catalog/product/suggestAttributeSets')), 'className' => 'category-select', 'showRecent' => true, 'storageKey' => 'product-template-key', 'minLength' => 0, - 'currentlySelected' => $this->_coreRegistry->registry('product')->getAttributeSetId() + 'currentlySelected' => $this->escapeHtml( + $this->_coreRegistry->registry('product')->getAttributeSetId() + ) ]; } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index e1b97f996c769..42463354926dd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -11,6 +11,9 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes; +/** + * Admin product attribute search block + */ class Search extends \Magento\Backend\Block\Widget { /** @@ -62,13 +65,15 @@ protected function _construct() } /** + * Get selector options + * * @return array */ public function getSelectorOptions() { $templateId = $this->_coreRegistry->registry('product')->getAttributeSetId(); return [ - 'source' => $this->getUrl('catalog/product/suggestAttributes'), + 'source' => $this->escapeUrl($this->getUrl('catalog/product/suggestAttributes')), 'minLength' => 0, 'ajaxOptions' => ['data' => ['template_id' => $templateId]], 'template' => '[data-template-for="product-attribute-search-' . $this->getGroupId() . '"]', @@ -110,6 +115,8 @@ public function getSuggestedAttributes($labelPart, $templateId = null) } /** + * Get add attribute url + * * @return string */ public function getAddAttributeUrl() diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index e7c7b81ec29c9..54f848a92e958 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -16,6 +16,8 @@ use Magento\Framework\Data\Collection; /** + * Product gallery block + * * @api * @since 100.0.2 */ @@ -43,6 +45,8 @@ public function __construct( } /** + * Prepare layout + * * @return $this */ protected function _prepareLayout() @@ -52,6 +56,8 @@ protected function _prepareLayout() } /** + * Get product + * * @return Product */ public function getProduct() @@ -60,6 +66,8 @@ public function getProduct() } /** + * Get gallery collection + * * @return Collection */ public function getGalleryCollection() @@ -68,6 +76,8 @@ public function getGalleryCollection() } /** + * Get current image + * * @return Image|null */ public function getCurrentImage() @@ -85,6 +95,8 @@ public function getCurrentImage() } /** + * Get image url + * * @return string */ public function getImageUrl() @@ -93,6 +105,8 @@ public function getImageUrl() } /** + * Get image file + * * @return mixed */ public function getImageFile() @@ -115,7 +129,7 @@ public function getImageWidth() if ($size[0] > 600) { return 600; } else { - return $size[0]; + return (int) $size[0]; } } } @@ -124,6 +138,8 @@ public function getImageWidth() } /** + * Get previous image + * * @return Image|false */ public function getPreviousImage() @@ -143,6 +159,8 @@ public function getPreviousImage() } /** + * Get next image + * * @return Image|false */ public function getNextImage() @@ -166,6 +184,8 @@ public function getNextImage() } /** + * Get previous image url + * * @return false|string */ public function getPreviousImageUrl() @@ -178,6 +198,8 @@ public function getPreviousImageUrl() } /** + * Get next image url + * * @return false|string */ public function getNextImageUrl() diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index c1d79894162ae..144cb682e2d22 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -373,7 +373,7 @@ public function getAddToCartPostParams(Product $product) return [ 'action' => $url, 'data' => [ - 'product' => $product->getEntityId(), + 'product' => (int) $product->getEntityId(), ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlHelper->getEncodedUrl($url), ] ]; diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 8b53223de0b9f..ed6278c2b585d 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -187,24 +187,25 @@ public function getJsonConfig() } $tierPrices = []; - $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); + $priceInfo = $product->getPriceInfo(); + $tierPricesList = $priceInfo->getPrice('tier_price')->getTierPriceList(); foreach ($tierPricesList as $tierPrice) { - $tierPrices[] = $tierPrice['price']->getValue(); + $tierPrices[] = $tierPrice['price']->getValue() * 1; } $config = [ - 'productId' => $product->getId(), + 'productId' => (int)$product->getId(), 'priceFormat' => $this->_localeFormat->getPriceFormat(), 'prices' => [ 'oldPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), + 'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1, 'adjustments' => [] ], 'basePrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(), + 'amount' => $priceInfo->getPrice('final_price')->getAmount()->getBaseAmount() * 1, 'adjustments' => [] ], 'finalPrice' => [ - 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(), + 'amount' => $priceInfo->getPrice('final_price')->getAmount()->getValue() * 1, 'adjustments' => [] ] ], diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 8b98fbdc8f7ef..b6a58c07c428b 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -137,16 +137,18 @@ public function getGalleryImagesJson() $imagesItems = []; /** @var DataObject $image */ foreach ($this->getGalleryImages() as $image) { - $imageItem = new DataObject([ - 'thumb' => $image->getData('small_image_url'), - 'img' => $image->getData('medium_image_url'), - 'full' => $image->getData('large_image_url'), - 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()), - 'position' => $image->getData('position'), - 'isMain' => $this->isMainImage($image), - 'type' => str_replace('external-', '', $image->getMediaType()), - 'videoUrl' => $image->getVideoUrl(), - ]); + $imageItem = new DataObject( + [ + 'thumb' => $image->getData('small_image_url'), + 'img' => $image->getData('medium_image_url'), + 'full' => $image->getData('large_image_url'), + 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()), + 'position' => $image->getData('position'), + 'isMain' => $this->isMainImage($image), + 'type' => str_replace('external-', '', $image->getMediaType()), + 'videoUrl' => $image->getVideoUrl(), + ] + ); foreach ($this->getGalleryImagesConfig()->getItems() as $imageConfig) { $imageItem->setData( $imageConfig->getData('json_object_key'), diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index a60e8f3ff7c2e..384b6ddcefc31 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -1578,26 +1578,9 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType = $this->_allIdsCache = null; if (is_string($attribute) && $attribute == 'is_saleable') { - $columns = $this->getSelect()->getPart(\Magento\Framework\DB\Select::COLUMNS); - foreach ($columns as $columnEntry) { - list($correlationName, $column, $alias) = $columnEntry; - if ($alias == 'is_saleable') { - if ($column instanceof \Zend_Db_Expr) { - $field = $column; - } else { - $connection = $this->getSelect()->getConnection(); - if (empty($correlationName)) { - $field = $connection->quoteColumnAs($column, $alias, true); - } else { - $field = $connection->quoteColumnAs([$correlationName, $column], $alias, true); - } - } - $this->getSelect()->where("{$field} = ?", $condition); - break; - } - } - - return $this; + $this->addIsSaleableAttributeToFilter($condition); + } elseif (is_string($attribute) && $attribute == 'tier_price') { + $this->addTierPriceAttributeToFilter($attribute, $condition); } else { return parent::addAttributeToFilter($attribute, $condition, $joinType); } @@ -2481,4 +2464,71 @@ public function getPricesCount() return $this->_pricesCount; } + + /** + * Add is_saleable attribute to filter + * + * @param array|null $condition + * @return $this + */ + private function addIsSaleableAttributeToFilter(?array $condition): self + { + $columns = $this->getSelect()->getPart(Select::COLUMNS); + foreach ($columns as $columnEntry) { + list($correlationName, $column, $alias) = $columnEntry; + if ($alias == 'is_saleable') { + if ($column instanceof \Zend_Db_Expr) { + $field = $column; + } else { + $connection = $this->getSelect()->getConnection(); + if (empty($correlationName)) { + $field = $connection->quoteColumnAs($column, $alias, true); + } else { + $field = $connection->quoteColumnAs([$correlationName, $column], $alias, true); + } + } + $this->getSelect()->where("{$field} = ?", $condition); + break; + } + } + + return $this; + } + + /** + * Add tier price attribute to filter + * + * @param string $attribute + * @param array|null $condition + * @return $this + */ + private function addTierPriceAttributeToFilter(string $attribute, ?array $condition): self + { + $attrCode = $attribute; + $connection = $this->getConnection(); + $attrTable = $this->_getAttributeTableAlias($attrCode); + $entity = $this->getEntity(); + $fKey = 'e.' . $this->getEntityPkName($entity); + $pKey = $attrTable . '.' . $this->getEntityPkName($entity); + $attribute = $entity->getAttribute($attrCode); + $attrFieldName = $attrTable . '.value'; + $fKey = $connection->quoteColumnAs($fKey, null); + $pKey = $connection->quoteColumnAs($pKey, null); + + $condArr = ["{$pKey} = {$fKey}"]; + $this->getSelect()->join( + [$attrTable => $this->getTable('catalog_product_entity_tier_price')], + '(' . implode(') AND (', $condArr) . ')', + [$attrCode => $attrFieldName] + ); + $this->removeAttributeToSelect($attrCode); + $this->_filterAttributes[$attrCode] = $attribute->getId(); + $this->_joinFields[$attrCode] = ['table' => '', 'field' => $attrFieldName]; + $field = $this->_getAttributeTableAlias($attrCode) . '.value'; + $conditionSql = $this->_getConditionSql($field, $condition); + $this->getSelect()->where($conditionSql, null, Select::TYPE_CONDITION); + $this->_totalRecords = null; + + return $this; + } } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php index 7f211c3330bf0..2238ad91550e4 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php @@ -6,7 +6,10 @@ namespace Magento\Catalog\Model\ResourceModel\Product; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\DataObject; +use Magento\Framework\Model\AbstractModel; use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\Store; /** * Catalog product custom option resource model @@ -77,10 +80,10 @@ protected function _construct() /** * Save options store data * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function _afterSave(AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -91,138 +94,38 @@ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) /** * Save value prices * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return $this - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $object) + protected function _saveValuePrices(AbstractModel $object) { - $priceTable = $this->getTable('catalog_product_option_price'); - $connection = $this->getConnection(); - /* * Better to check param 'price' and 'price_type' for saving. * If there is not price skip saving price */ - if (in_array($object->getType(), $this->getPriceTypes())) { - //save for store_id = 0 + // save for store_id = 0 if (!$object->getData('scope', 'price')) { - $statement = $connection->select()->from( - $priceTable, - 'option_id' - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID - ); - $optionId = $connection->fetchOne($statement); - - if ($optionId) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - ['price' => $object->getPrice(), 'price_type' => $object->getPriceType()] - ), - $priceTable - ); - - $connection->update( - $priceTable, - $data, - [ - 'option_id = ?' => $object->getId(), - 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID - ] - ); - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - [ - 'option_id' => $object->getId(), - 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, - 'price' => $object->getPrice(), - 'price_type' => $object->getPriceType(), - ] - ), - $priceTable - ); - $connection->insert($priceTable, $data); - } + $this->savePriceByStore($object, Store::DEFAULT_STORE_ID); } $scope = (int)$this->_config->getValue( - \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, - ScopeInterface::SCOPE_STORE + Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { - $website = $this->_storeManager->getStore($object->getStoreId())->getWebsite(); - - $websiteBaseCurrency = $this->_config->getValue( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, - ScopeInterface::SCOPE_WEBSITE, - $website - ); - - $storeIds = $website->getStoreIds(); - if (is_array($storeIds)) { - foreach ($storeIds as $storeId) { - if ($object->getPriceType() == 'fixed') { - $storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode(); - $rate = $this->_currencyFactory->create()->load($websiteBaseCurrency) - ->getRate($storeCurrency); - $rate ?: $rate = 1; - $newPrice = $object->getPrice() * $rate; - } else { - $newPrice = $object->getPrice(); - } - - $statement = $connection->select()->from( - $priceTable - )->where( - 'option_id = ?', - $object->getId() - )->where( - 'store_id = ?', - $storeId - ); - - if ($connection->fetchOne($statement)) { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - ['price' => $newPrice, 'price_type' => $object->getPriceType()] - ), - $priceTable - ); - - $connection->update( - $priceTable, - $data, - ['option_id = ?' => $object->getId(), 'store_id = ?' => $storeId] - ); - } else { - $data = $this->_prepareDataForTable( - new \Magento\Framework\DataObject( - [ - 'option_id' => $object->getId(), - 'store_id' => $storeId, - 'price' => $newPrice, - 'price_type' => $object->getPriceType(), - ] - ), - $priceTable - ); - $connection->insert($priceTable, $data); - } - } + if ($object->getStoreId() != '0' && $scope == Store::PRICE_SCOPE_WEBSITE) { + $storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds(); + if (empty($storeIds)) { + return $this; + } + foreach ($storeIds as $storeId) { + $newPrice = $this->calculateStorePrice($object, $storeId); + $this->savePriceByStore($object, (int)$storeId, $newPrice); } - } elseif ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price') - ) { - $connection->delete( - $priceTable, + } elseif ($scope == Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { + $this->getConnection()->delete( + $this->getTable('catalog_product_option_price'), ['option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()] ); } @@ -231,31 +134,114 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje return $this; } + /** + * Save option price by store + * + * @param AbstractModel $object + * @param int $storeId + * @param float|null $newPrice + */ + private function savePriceByStore(AbstractModel $object, int $storeId, float $newPrice = null): void + { + $priceTable = $this->getTable('catalog_product_option_price'); + $connection = $this->getConnection(); + $price = $newPrice === null ? $object->getPrice() : $newPrice; + + $statement = $connection->select()->from($priceTable, 'option_id') + ->where('option_id = ?', $object->getId()) + ->where('store_id = ?', $storeId); + $optionId = $connection->fetchOne($statement); + + if (!$optionId) { + $data = $this->_prepareDataForTable( + new DataObject( + [ + 'option_id' => $object->getId(), + 'store_id' => $storeId, + 'price' => $price, + 'price_type' => $object->getPriceType(), + ] + ), + $priceTable + ); + $connection->insert($priceTable, $data); + } else { + // skip to update the default price when the store price is saving + if ($storeId === Store::DEFAULT_STORE_ID && (int)$object->getStoreId() !== $storeId) { + return; + } + + $data = $this->_prepareDataForTable( + new DataObject( + [ + 'price' => $price, + 'price_type' => $object->getPriceType() + ] + ), + $priceTable + ); + + $connection->update( + $priceTable, + $data, + [ + 'option_id = ?' => $object->getId(), + 'store_id = ?' => $storeId + ] + ); + } + } + + /** + * Calculate price by store + * + * @param AbstractModel $object + * @param int $storeId + * @return float + */ + private function calculateStorePrice(AbstractModel $object, int $storeId): float + { + $price = $object->getPrice(); + if ($object->getPriceType() == 'fixed') { + $website = $this->_storeManager->getStore($storeId)->getWebsite(); + $websiteBaseCurrency = $this->_config->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + ScopeInterface::SCOPE_WEBSITE, + $website + ); + $storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode(); + $rate = $this->_currencyFactory->create()->load($websiteBaseCurrency)->getRate($storeCurrency); + $price = $object->getPrice() * ($rate ?: 1); + } + + return (float)$price; + } + /** * Save titles * - * @param \Magento\Framework\Model\AbstractModel $object + * @param AbstractModel $object * @return void * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $object) + protected function _saveValueTitles(AbstractModel $object) { $connection = $this->getConnection(); $titleTableName = $this->getTable('catalog_product_option_title'); - foreach ([\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { + foreach ([Store::DEFAULT_STORE_ID, $object->getStoreId()] as $storeId) { $existInCurrentStore = $this->getColFromOptionTable($titleTableName, (int)$object->getId(), (int)$storeId); - $existInDefaultStore = (int)$storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID ? + $existInDefaultStore = (int)$storeId == Store::DEFAULT_STORE_ID ? $existInCurrentStore : $this->getColFromOptionTable( $titleTableName, (int)$object->getId(), - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ); if ($object->getTitle()) { $isDeleteStoreTitle = (bool)$object->getData('is_delete_store_title'); if ($existInCurrentStore) { - if ($isDeleteStoreTitle && (int)$storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID) { + if ($isDeleteStoreTitle && (int)$storeId != Store::DEFAULT_STORE_ID) { $connection->delete($titleTableName, ['option_title_id = ?' => $existInCurrentStore]); } elseif ($object->getStoreId() == $storeId) { $data = $this->_prepareDataForTable( @@ -273,9 +259,9 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje } } else { // we should insert record into not default store only of if it does not exist in default store - if (($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID && !$existInDefaultStore) || + if (($storeId == Store::DEFAULT_STORE_ID && !$existInDefaultStore) || ( - $storeId != \Magento\Store\Model\Store::DEFAULT_STORE_ID && + $storeId != Store::DEFAULT_STORE_ID && !$existInCurrentStore && !$isDeleteStoreTitle ) @@ -294,7 +280,7 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje } } } else { - if ($object->getId() && $object->getStoreId() > \Magento\Store\Model\Store::DEFAULT_STORE_ID + if ($object->getId() && $object->getStoreId() > Store::DEFAULT_STORE_ID && $storeId ) { $connection->delete( @@ -473,7 +459,7 @@ public function getSearchableData($productId, $storeId) 'option_title_default.option_id=product_option.option_id', $connection->quoteInto( 'option_title_default.store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ) ] ); @@ -520,7 +506,7 @@ public function getSearchableData($productId, $storeId) 'option_title_default.option_type_id=option_type.option_type_id', $connection->quoteInto( 'option_title_default.store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID ) ] ); @@ -585,7 +571,7 @@ public function getPriceTypes() } /** - * Returns metadata poll. + * Get Metadata Pool * * @return \Magento\Framework\EntityManager\MetadataPool */ diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml new file mode 100644 index 0000000000000..62e9a4b6615b2 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAnchorCategoryActionGroup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAnchorCategoryActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!--Open Category page--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/> + <waitForPageLoad stepKey="waitForCategoryToLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryName)}}" stepKey="selectCategory"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + + <!--Enable Anchor for category --> + <scrollTo selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" x="0" y="-80" stepKey="scrollToDisplaySetting"/> + <click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="selectDisplaySetting"/> + <checkOption selector="{{CategoryDisplaySettingsSection.anchor}}" stepKey="enableAnchor"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml new file mode 100644 index 0000000000000..0cb7c4885ac77 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssignCategoryToProductAndSaveActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!-- on edit Product page catalog/product/edit/id/{{product_id}}/ --> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> + <checkOption selector="{{AdminProductFormSection.selectCategory(categoryName)}}" stepKey="selectCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForApplyCategory"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index ad32b8edbd243..3e967cb9c6901 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -256,7 +256,7 @@ <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> <click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/> - <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled" parameterized="true"/> + <click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/> <waitForPageLoad stepKey="waitForStatusToBeChanged"/> <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/> <waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml new file mode 100644 index 0000000000000..35816f3cd6750 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminUnassignCategoryOnProductAndSaveActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUnassignCategoryOnProductAndSaveActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <!-- on edit Product page catalog/product/edit/id/{{product_id}}/ --> + <click selector="{{AdminProductFormSection.unselectCategories(categoryName)}}" stepKey="clearCategory"/> + <waitForPageLoad stepKey="waitForDelete"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml index b914d5e20712d..838ac7d288ead 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/CustomOptionsActionGroup.xml @@ -55,7 +55,7 @@ <actionGroup name="AddProductCustomOptionField"> <arguments> <argument name="option" defaultValue="ProductOptionField"/> - <argiment name="optionIndex" type="string"/> + <argument name="optionIndex" type="string"/> </arguments> <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> @@ -90,7 +90,7 @@ <actionGroup name="checkCustomizableOptionImport"> <arguments> <argument name="option" defaultValue="ProductOptionField"/> - <argiment name="optionIndex" type="string"/> + <argument name="optionIndex" type="string"/> </arguments> <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionTitleInput(optionIndex)}}" stepKey="grabOptionTitle"/> <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionPrice(optionIndex)}}" stepKey="grabOptionPrice"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml index 4c7c011028c92..7e79182616fd0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml @@ -62,6 +62,13 @@ <seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart" /> </actionGroup> + <actionGroup name="StorefrontCheckAddToCartButtonAbsence"> + <arguments> + <argument name="product" defaultValue="_defaultProduct"/> + </arguments> + <moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct" /> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="checkAddToCartButtonAbsence"/> + </actionGroup> <actionGroup name="StorefrontSwitchCategoryViewToListMode"> <click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/> <waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..e8be0db38fe2c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontGoToCategoryPageActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontGoToCategoryPageActionGroup"> + <arguments> + <argument name="categoryName" type="string"/> + </arguments> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> + <waitForPageLoad stepKey="waitForCategoryPage"/> + </actionGroup> + <actionGroup name="StorefrontGoToSubCategoryPageActionGroup" extends="StorefrontGoToCategoryPageActionGroup"> + <arguments> + <argument name="subCategoryName" type="string"/> + </arguments> + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(categoryName)}}" stepKey="toCategory"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategoryName)}}" stepKey="openSubCategory" after="toCategory"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml new file mode 100644 index 0000000000000..4413cbcf86a96 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeGroupData.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="customGroup"> + <data key="name">Custom Group</data> + </entity> + <entity name="emptyGroup"> + <data key="name">Empty Group</data> + </entity> +</entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index 62276b12b99b6..33dab7ee8fd7e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -240,6 +240,9 @@ <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> </entity> + <entity name="ApiSimpleProductWithShortSKU" type="product2" extends="ApiSimpleOne"> + <data key="sku" unique="suffix">pr</data> + </entity> <entity name="ApiSimpleOneHidden" type="product2"> <data key="sku" unique="suffix">api-simple-product</data> <data key="type_id">simple</data> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml index 3c05f72ff1597..e9ff40f98bb16 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml @@ -10,5 +10,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCategoryProductsSection"> <element name="sectionHeader" type="button" selector="div[data-index='assign_products']" timeout="30"/> + <element name="addProducts" type="button" selector="#catalog_category_add_product_tabs" timeout="30"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml index 0814c7ea7dc3e..df8915a499843 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeSetEditSection.xml @@ -17,9 +17,16 @@ <element name="assignedAttribute" type="text" selector="//*[@id='tree-div1']//span[text()='{{attributeName}}']" parameterized="true"/> <element name="xThLineItemYthAttributeGroup" type="text" selector="//*[@id='tree-div1']/ul/div/li[{{y}}]//li[{{x}}]" parameterized="true"/> <element name="xThLineItemAttributeGroup" type="text" selector="//*[@id='tree-div1']//span[text()='{{groupName}}']/parent::*/parent::*/parent::*//li[{{x}}]//a/span" parameterized="true"/> + <element name="attributesInGroup" type="text" selector="//span[text()='{{GroupName}}']/../../following-sibling::ul/li" parameterized="true"/> <!-- Unassigned Attributes Column --> <element name="unassignedAttributesTree" type="block" selector="#tree-div2"/> <element name="unassignedAttribute" type="text" selector="//*[@id='tree-div2']//span[text()='{{attributeName}}']" parameterized="true"/> <element name="xThLineItemUnassignedAttribute" type="text" selector="//*[@id='tree-div2']//li[{{x}}]//a/span" parameterized="true"/> + <!-- Buttons --> + <element name="AddNewGroup" type="button" selector="button[data-ui-id='adminhtml-catalog-product-set-edit-add-group-button']"/> + <!-- Modal Window Add New Group --> + <element name="newGroupName" type="input" selector="input[data-role='promptField']"/> + <element name="buttonOk" type="button" selector=".modal-footer .action-primary.action-accept"/> + <element name="errorLabel" type="text" selector="label.mage-error"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index f515171e835db..06f854bcc955c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -32,6 +32,7 @@ <element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/> <element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/> <element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/> + <element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb > span"/> <element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/> <element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/> <element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/> @@ -70,6 +71,7 @@ <element name="selectMultipleCategories" type="input" selector="//*[@data-index='container_category_ids']//*[contains(@class, '_selected')]"/> <element name="countryOfManufacture" type="select" selector="select[name='product[country_of_manufacture]']"/> <element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/> + <element name="footerBlock" type="block" selector="//footer"/> </section> <section name="ProductInWebsitesSection"> <element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/> @@ -207,5 +209,7 @@ <element name="textAttributeByName" type="text" selector="//div[@data-index='attributes']//fieldset[contains(@class, 'admin__field') and .//*[contains(.,'{{var}}')]]//input" parameterized="true"/> <element name="dropDownAttribute" type="select" selector="//select[@name='product[{{arg}}]']" parameterized="true" timeout="30"/> <element name="attributeSection" type="block" selector="//div[@data-index='attributes']/div[contains(@class, 'admin__collapsible-content _show')]" timeout="30"/> + <element name="attributeGroupByName" type="button" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']" parameterized="true"/> + <element name="attributeByGroupAndName" type="text" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']/../../following-sibling::div//span[contains(text(),'attribute')]" parameterized="true"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index 03f3e93bb30ec..fd27b232053b8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -47,9 +47,9 @@ <conditionalClick selector="{{ProductDescriptionWYSIWYGToolbarSection.WysiwygArrow}}" dependentSelector="{{ProductDescriptionWYSIWYGToolbarSection.checkIfWysiwygArrowExpand}}" stepKey="clickWysiwygArrowIfClosed" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder1" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder1" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading4" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading4"/> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage1"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload1" timeout="30"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload1"/> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage1" /> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.imageSelected(ImageUpload1.value)}}" stepKey="seeImageSelected1" /> <see selector="{{ProductDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn1"/> @@ -60,7 +60,7 @@ <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="dontSeeImage1" /> <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn2" /> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.value}}" stepKey="uploadImage2"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload2" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload2"/> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload1.value)}}" stepKey="waitForUploadImage2" /> <click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn1" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" stepKey="waitForImageDescriptionButton1" /> @@ -72,12 +72,12 @@ <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.CancelBtn}}" stepKey="waitForCancelButton2"/> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn2" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading13" timeout="30"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading13"/> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn2" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading14" timeout="40"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading14"/> <dontSeeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn3" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage3"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload3" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload3"/> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage3" /> <waitForElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" stepKey="waitForDeletebtn" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn2"/> @@ -86,7 +86,7 @@ <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete2" /> <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn4" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage4"/> - <waitForLoadingMaskToDisappear stepKey="waitForFileUpload4" timeout="45"/> + <waitForLoadingMaskToDisappear stepKey="waitForFileUpload4"/> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload3.value)}}" stepKey="waitForUploadImage4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading11" /> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml new file mode 100644 index 0000000000000..3219bca233bee --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateNewGroupForAttributeSetTest"> + <annotations> + <stories value="Edit attribute set"/> + <title value="Admin should be able to create new group in an Attribute Set"/> + <description value="The test verifies creating a new group in an attribute set and a validation message in case of empty group name"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-170"/> + <group value="Catalog"/> + </annotations> + <before> + <!-- Create a custom attribute set and custom product attribute --> + <createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + + <!-- Login to Admin --> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Navigate to Stores > Attributes > Attribute Set --> + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + + <!-- Search and open Attribute Set from preconditions --> + <actionGroup ref="goToAttributeSetByName" stepKey="searchAttribute"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- Click 'Add New': Show 'New Group' Modal --> + <click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddNew"/> + <waitForAjaxLoad stepKey="waitForAjax"/> + + <!-- Fill 'name' for new group and click 'Ok': Name = <empty> --> + <fillField userInput="" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOk"/> + + <!-- Error message 'This is a required field.' is displayed --> + <see userInput="This is a required field." selector="{{AdminProductAttributeSetEditSection.errorLabel}}" stepKey="seeErrorMessage"/> + + <!-- Fill 'name' for new group and click 'Ok': Name = Custom group --> + <fillField userInput="{{customGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillCustomGroupName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickButtonOk"/> + + <!-- Group is created and displayed in 'Groups' block --> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(customGroup.name)}}" stepKey="assertCustomGroup"/> + + <!-- Move custom Product Attribute to new 'Custom group' Group --> + <waitForAjaxLoad stepKey="waitForAjaxLoad"/> + <click selector="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="click"/> + <waitForPageLoad stepKey="waitForPageLoadAfterClick"/> + <dragAndDrop selector1="{{AdminProductAttributeSetEditSection.unassignedAttribute($$createConfigProductAttribute.attribute_code$$)}}" selector2="{{AdminProductAttributeSetEditSection.attributeGroupExtender(customGroup.name)}}" stepKey="moveAttribute"/> + <waitForPageLoad stepKey="waitForDragAndDrop"/> + + <!-- Attribute is displayed in the new group --> + <see userInput="$$createConfigProductAttribute.attribute_code$$" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttribute"/> + + <!-- Click 'Save' --> + <actionGroup ref="SaveAttributeSet" stepKey="saveAttribute"/> + + <actionGroup ref="goToAttributeSetByName" stepKey="backTohAttributeSet"> + <argument name="name" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- Create another group: Name = Empty group --> + <click selector="{{AdminProductAttributeSetEditSection.AddNewGroup}}" stepKey="clickAddEmptyGroup"/> + <waitForAjaxLoad stepKey="waitForLoad"/> + + <fillField userInput="{{emptyGroup.name}}" selector="{{AdminProductAttributeSetEditSection.newGroupName}}" stepKey="fillGroupName"/> + <click selector="{{AdminProductAttributeSetEditSection.buttonOk}}" stepKey="clickOnOk"/> + <waitForPageLoad stepKey="waitForNewGroup"/> + + <!-- Empty group is created. No attributes are assigned to it. --> + <seeElement selector="{{AdminProductAttributeSetEditSection.attributeGroup(emptyGroup.name)}}" stepKey="assertEmptyGroup"/> + <dontSeeElement selector="{{AdminProductAttributeSetEditSection.attributesInGroup(emptyGroup.name)}}" stepKey="seeNoAttributes"/> + + <!-- Navigate to Catalog > Products --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Start to create a new simple product with the custom attribute set from the preconditions --> + <click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddProduct"/> + <waitForPageLoad stepKey="waitForNewProductPage"/> + + <actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttribute"> + <argument name="attributeSetName" value="$$createAttributeSet.attribute_set_name$$"/> + </actionGroup> + + <!-- New Section 'Custom group' is present in form. The section contains the attribute from preconditions --> + <seeElement selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="seeSectionCustomGroup"/> + <click selector="{{AdminProductAttributeSection.attributeGroupByName(customGroup.name)}}" stepKey="openCustomGroupSection"/> + <waitForAjaxLoad stepKey="waitForOpenSection"/> + <scrollTo selector="{{AdminProductFormSection.footerBlock}}" stepKey="scrollToFooter"/> + <seeElement selector="{{AdminProductAttributeSection.attributeByGroupAndName(customGroup.name)}}" stepKey="seeAttributePresent"/> + + <!-- Empty section is absent in Product Form --> + <dontSeeElement selector="{{AdminProductAttributeSection.attributeGroupByName(emptyGroup.name)}}" stepKey="dontSeeEmptyGroup"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml new file mode 100644 index 0000000000000..da985fc2ce34d --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml @@ -0,0 +1,227 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminMoveProductBetweenCategoriesTest"> + <annotations> + <stories value="Move Product"/> + <title value="Move Product between Categories (Cron is ON, 'Update by Schedule' Mode)"/> + <description value="Verifies correctness of showing data (products, categories) on Storefront after moving an anchored category in terms of products/categories association"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11296"/> + <group value="catalog"/> + </annotations> + + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> + <createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/> + <createData entity="_defaultCategory" stepKey="createSecondCategory"/> + + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> + <waitForPageLoad stepKey="waitForManagementPage"/> + + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> + <argument name="indexerValue" value="catalog_category_product"/> + </actionGroup> + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> + <argument name="indexerValue" value="catalog_product_category"/> + </actionGroup> + </before> + + <after> + <!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode --> + <amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/> + <waitForPageLoad stepKey="waitForManagementPage"/> + + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct"> + <argument name="indexerValue" value="catalog_category_product"/> + <argument name="action" value="Update on Save"/> + </actionGroup> + <actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory"> + <argument name="indexerValue" value="catalog_product_category"/> + <argument name="action" value="Update on Save"/> + </actionGroup> + + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> + <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Create the anchored category <Cat1_anchored> --> + <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> + <argument name="categoryName" value="$$createAnchoredCategory1.name$$"/> + </actionGroup> + + <!-- Create subcategory <Sub1> of the anchored category --> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/> + <waitForPageLoad stepKey="waitForSecondCategoryToSave"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/> + + <!-- Assign <product1> to the <Sub1> --> + <amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDownCategory"/> + <fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearch"/> + <waitForPageLoad stepKey="waitForSubCategory"/> + <click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSub1Category"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/> + <waitForPageLoad stepKey="waitForApplyCategory"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/> + <waitForPageLoad stepKey="waitForSavingChanges"/> + + <!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization --> + <amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/> + <waitForPageLoad stepKey="waitForLoading"/> + <conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/> + <uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/> + <selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/> + <click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/> + <waitForPageLoad stepKey="waitForSaving"/> + <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/> + + <!-- Navigate to the Catalog > Products --> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onCatalogProductPage"/> + <waitForPageLoad stepKey="waitForProductPage"/> + + <!-- Click on <product1>: Product page opens--> + <actionGroup ref="filterProductGridByName" stepKey="filterProduct"> + <argument name="product" value="$$simpleProduct$$"/> + </actionGroup> + <click selector="{{AdminProductGridSection.productGridNameProduct($$simpleProduct.name$$)}}" stepKey="clickProduct1"/> + <waitForPageLoad stepKey="waitForProductLoad"/> + + <!-- Clear "Categories" field and assign the product to <Cat2> and save the product --> + <grabTextFrom selector="{{AdminProductFormSection.currentCategory}}" stepKey="grabNameSubCategory"/> + <click selector="{{AdminProductFormSection.unselectCategories(SimpleSubCategory.name)}}" stepKey="removeCategory"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/> + <checkOption selector="{{AdminProductFormSection.selectCategory($$createSecondCategory.name$$)}}" stepKey="selectCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="pressButtonDone"/> + <waitForPageLoad stepKey="waitForApplyCategory2"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="pushButtonSave"/> + <waitForPageLoad stepKey="waitForSavingProduct"/> + + <!--Product is saved --> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/> + + <!-- Run cron --> + <magentoCLI command="cron:run" stepKey="runCron"/> + + <!-- Clear invalidated cache on System>Tools>Cache Management page --> + <amOnPage url="{{AdminCacheManagementPage.url}}" stepKey="onCachePage"/> + <waitForPageLoad stepKey="waitForCacheManagementPage"/> + + <checkOption selector="{{AdminCacheManagementSection.configurationCheckbox}}" stepKey="checkConfigCache"/> + <checkOption selector="{{AdminCacheManagementSection.pageCacheCheckbox}}" stepKey="checkPageCache"/> + + <selectOption userInput="Refresh" selector="{{AdminCacheManagementSection.massActionSelect}}" stepKey="selectRefresh"/> + <waitForElementVisible selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="waitSubmitButton"/> + <click selector="{{AdminCacheManagementSection.massActionSubmit}}" stepKey="clickSubmit"/> + <waitForPageLoad stepKey="waitForRefresh"/> + + <see userInput="2 cache type(s) refreshed." stepKey="seeCacheRefreshedMessage"/> + <actionGroup ref="logout" stepKey="logout"/> + + <!-- Open frontend --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> + <waitForPageLoad stepKey="waitForStorefrontPageLoad"/> + + <!-- Open <Cat2> from navigation menu --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openCat2"/> + <waitForPageLoad stepKey="waitForCategory2Page"/> + + <!-- # <Cat 2> should open # <product1> should be present on the page --> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryName"/> + <see userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProduct"/> + + <!-- Open <product1> --> + <click selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.urlKey$$)}}" stepKey="openProduct"/> + <waitForPageLoad stepKey="waitForProductPageLoading"/> + + <!-- # Product page should open successfully # Breadcrumb for product should be like <Cat 2> --> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductName"/> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCategoryInBreadcrumbs"/> + + <!-- Open <Cat1_anchored> category --> + <click selector="{{StorefrontNavigationSection.topCategory($$createAnchoredCategory1.name$$)}}" stepKey="clickCat1"/> + <waitForPageLoad stepKey="waitForCategory1PageLoad"/> + + <!-- # Category should open successfully # <product1> should be absent on the page --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategory1Name"/> + <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProduct"/> + + <!-- Log in to the backend: Admin user is logged in--> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAdmin"/> + + <!-- Navigate to the Catalog > Products: Navigate to the Catalog>Products --> + <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="amOnProductPage"/> + <waitForPageLoad stepKey="waitForProductsPage"/> + + <!-- Click on <product1> --> + <actionGroup ref="filterAndSelectProduct" stepKey="openSimpleProduct"> + <argument name="productSku" value="$$simpleProduct.sku$$"/> + </actionGroup> + + <!-- Clear "Categories" field and assign the product to <Sub1> and save the product --> + <click selector="{{AdminProductFormSection.unselectCategories($$createSecondCategory.name$$)}}" stepKey="clearCategory"/> + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/> + <fillField userInput="{$grabNameSubCategory}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/> + <waitForPageLoad stepKey="waitForSearchSubCategory"/> + <click selector="{{AdminProductFormSection.selectCategory({$grabNameSubCategory})}}" stepKey="selectSubCategory"/> + <click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/> + <waitForPageLoad stepKey="waitForCategoryApply"/> + <click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/> + <waitForPageLoad stepKey="waitForSaveChanges"/> + + <!-- Product is saved successfully --> + <see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSaveMessage"/> + + <!-- Run cron --> + <magentoCLI command="cron:run" stepKey="runCron2"/> + + <!-- Open frontend --> + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontendPage"/> + <waitForPageLoad stepKey="waitForFrontPageLoad"/> + + <!-- Open <Cat2> from navigation menu --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSecondCategory.name$$)}}" stepKey="openSecondCategory"/> + <waitForPageLoad stepKey="waitForSecondCategoryPage"/> + + <!-- # <Cat 2> should open # <product1> should be absent on the page --> + <see userInput="$$createSecondCategory.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSecondCategory1Name"/> + <dontSee userInput="$$simpleProduct.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeSimpleProduct"/> + + <!-- Click on <Cat1_anchored> category --> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="clickAnchoredCategory"/> + <waitForPageLoad stepKey="waitForAnchoredCategoryPage"/> + + <!-- # Category should open successfully # <product1> should be present on the page --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="see1CategoryName"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnCategory1Page"/> + + <!-- Breadcrumb for product should be like <Cat1_anchored>/<product> (if you clicks from anchor category) --> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1inBreadcrumbs"/> + <dontSee userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="dontSeeSubCategoryInBreadCrumbs"/> + + <!-- <Cat1_anchored>/<Sub1>/<product> (if you clicks from Sub1 category) --> + <moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createAnchoredCategory1.name$$)}}" stepKey="hoverCategory1"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName({$grabNameSubCategory})}}" stepKey="clickSubCat"/> + <waitForPageLoad stepKey="waitForSubCategoryPageLoad"/> + + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeSubCategoryName"/> + <see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$simpleProduct.name$$" stepKey="seeProductNameOnSubCategoryPage"/> + + <see userInput="{$grabNameSubCategory}" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeSubCategoryInBreadcrumbs"/> + <see userInput="$$createAnchoredCategory1.name$$" selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="seeCat1InBreadcrumbs"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml new file mode 100644 index 0000000000000..ec0d86ac066fd --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml @@ -0,0 +1,314 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminProductCategoryIndexerInUpdateOnScheduleModeTest"> + <annotations> + <stories value="Product Categories Indexer"/> + <title value="Product Categories Indexer in Update on Schedule mode"/> + <description value="The test verifies that in Update on Schedule mode if displaying of category products on Storefront changes due to product properties change, + the changes are NOT applied immediately, but applied only after cron runs (twice)."/> + <severity value="CRITICAL"/> + <testCaseId value="MC-11146"/> + <group value="catalog"/> + <group value="indexer"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <!-- Create category A without products --> + <createData entity="_defaultCategory" stepKey="createCategoryA"/> + + <!-- Create product A1 not assigned to any category --> + <createData entity="simpleProductWithoutCategory" stepKey="createProductA1"/> + + <!-- Create anchor category B with subcategory C--> + <createData entity="_defaultCategory" stepKey="createCategoryB"/> + <createData entity="SubCategoryWithParent" stepKey="createCategoryC"> + <requiredEntity createDataKey="createCategoryB"/> + </createData> + + <!-- Assign product B1 to category B --> + <createData entity="ApiSimpleProduct" stepKey="createProductB1"> + <requiredEntity createDataKey="createCategoryB"/> + </createData> + + <!-- Assign product C1 to category C --> + <createData entity="ApiSimpleProduct" stepKey="createProductC1"> + <requiredEntity createDataKey="createCategoryC"/> + </createData> + + <!-- Assign product C2 to category C --> + <createData entity="ApiSimpleProduct" stepKey="createProductC2"> + <requiredEntity createDataKey="createCategoryC"/> + </createData> + + <!-- Switch indexers to "Update by Schedule" mode --> + <actionGroup ref="AdminSwitchAllIndexerToActionModeActionGroup" stepKey="onUpdateBySchedule"> + <argument name="action" value="Update by Schedule"/> + </actionGroup> + </before> + <after> + <!-- Switch indexers to "Update on Save" mode --> + <actionGroup ref="AdminSwitchAllIndexerToActionModeActionGroup" stepKey="onUpdateOnSave"> + <argument name="action" value="Update on Save"/> + </actionGroup> + <!-- Delete data --> + <deleteData createDataKey="createProductA1" stepKey="deleteProductA1"/> + <deleteData createDataKey="createProductB1" stepKey="deleteProductB1"/> + <deleteData createDataKey="createProductC1" stepKey="deleteProductC1"/> + <deleteData createDataKey="createProductC2" stepKey="deleteProductC2"/> + <deleteData createDataKey="createCategoryA" stepKey="deleteCategoryA"/> + <deleteData createDataKey="createCategoryC" stepKey="deleteCategoryC"/> + <deleteData createDataKey="createCategoryB" stepKey="deleteCategoryB"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Case: change product category from product page --> + <!-- 1. Open Admin > Catalog > Products > Product A1 --> + <amOnPage url="{{AdminProductEditPage.url($$createProductA1.id$$)}}" stepKey="goToProductA1"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- 2. Assign category A to product A1. Save product --> + <actionGroup ref="AdminAssignCategoryToProductAndSaveActionGroup" stepKey="assignProduct"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- 3. Open category A on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goToCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- The category is still empty --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryA1Name"/> + <see userInput="We can't find products matching the selection." stepKey="seeEmptyNotice"/> + <dontSee userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProductA1"/> + + <!-- 4. Run cron to reindex --> + <wait time="60" stepKey="waitForChanges"/> + <magentoCLI command="cron:run" stepKey="runCron"/> + + <!-- 5. Open category A on Storefront again --> + <reloadPage stepKey="reloadCategoryA"/> + + <!-- Category A displays product A1 now --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryA1"/> + <see userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductA1"/> + + <!--6. Open Admin > Catalog > Products > Product A1. Unassign category A from product A1 --> + <amOnPage url="{{AdminProductEditPage.url($$createProductA1.id$$)}}" stepKey="OnPageProductA1"/> + <waitForPageLoad stepKey="waitForProductA1PageLoad"/> + <actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unassignCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- 7. Open category A on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryA"> + <argument name="categoryName" value="$$createCategoryA.name$$"/> + </actionGroup> + + <!-- Category A still contains product A1 --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryAOnPage"/> + <see userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductA1"/> + + <!-- 8. Run cron reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="60" stepKey="waitOneMinute"/> + <magentoCLI command="cron:run" stepKey="runCron1"/> + + <!-- 9. Open category A on Storefront again --> + <reloadPage stepKey="refreshCategoryAPage"/> + + <!-- Category A is empty now --> + <see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeOnPageCategoryAName"/> + <see userInput="We can't find products matching the selection." stepKey="seeOnPageEmptyNotice"/> + <dontSee userInput="$$createProductA1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeProductA1OnPage"/> + + <!-- Case: change product status --> + <!-- 10. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1, C1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeNameProductC2"/> + + <!-- 11. Open product C1 in Admin. Make it disabled (Enable Product = No)--> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="goToProductC1"/> + <waitForPageLoad stepKey="waitForProductC1PageLoad"/> + <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOffEnableToggleAgain"/> + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="saveProductC1"/> + + <!-- 12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="toCategoryBStorefront"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1, C1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="categoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC2"/> + + <!-- 13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="goToCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C still displays products C1 and C2 --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="categoryCOnPage"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC1inCategoryC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductC2InCategoryC2"/> + + <!-- 14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="60" stepKey="waitMinute"/> + <magentoCLI command="cron:run" stepKey="runCron2"/> + + <!-- 15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="onPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 only--> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryBPageProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryBPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryBPageProductC2"/> + + <!-- 16. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays only product C2 now --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleOnCategoryCPage"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryCPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCPageProductC2"/> + + <!-- 17. Repeat steps 10-16, but enable products instead. --> + <!-- 17.11 Open product C1 in Admin. Make it enabled --> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="goToEditProductC1"/> + <waitForPageLoad stepKey="waitForProductC1Page"/> + <click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickOnEnableToggleAgain"/> + + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="saveChangedProductC1"/> + + <!-- 17.12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="titleCategoryBOnPage"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBPageProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeCategoryBPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBPageProductC2"/> + + <!-- 17.13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openToCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays product C2 --> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="titleOnCategoryCPage"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeCategoryCPageProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryCPageProductC2"/> + + <!-- 17.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="60" stepKey="waitForOneMinute"/> + <magentoCLI command="cron:run" stepKey="runCron3"/> + + <!-- 17.15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays products B1, C1, C2 again, but only after reindex. --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="onPageSeeCategoryBTitle"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryBProductC2"/> + + <!-- 17.16. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="openOnStorefrontCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays products C1, C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="onPageSeeCategoryCTitle"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="onPageSeeCategoryCProductC2"/> + + <!-- Case: change product visibility --> + <!-- 18. Repeat steps 10-17 but change product Visibility instead of product status --> + <!-- 18.11 Open product C1 in Admin. Make it enabled --> + <amOnPage url="{{AdminProductEditPage.url($$createProductC1.id$$)}}" stepKey="editProductC1"/> + <waitForPageLoad stepKey="waitProductC1Page"/> + <selectOption selector="{{AdminProductFormBundleSection.visibilityDropDown}}" userInput="Search" + stepKey="changeVisibility"/> + + <!-- Saved successfully --> + <actionGroup ref="saveProductForm" stepKey="productC1Saved"/> + + <!-- 18.12. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="goPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays products B1, C1, C2 again, but only after reindex. --> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryBTitle"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductB1"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeCategoryBProductC2"/> + + <!-- 18.13. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="goPageCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays products C1, C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeCategoryCTitle"/> + <see userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnCategoryCProductC2"/> + + <!-- 18.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) --> + <wait time="60" stepKey="waitExtraMinute"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> + + <!-- 18.15. Open category B on Storefront --> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="navigateToPageCategoryB"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + </actionGroup> + + <!-- Category B displays product B1 and C2 only--> + <see userInput="$$createCategoryB.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryB"/> + <see userInput="$$createProductB1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeTitleProductB1"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontseeCategoryBProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeTitleProductC2"/> + + <!-- 18.18. Open category C on Storefront --> + <actionGroup ref="StorefrontGoToSubCategoryPageActionGroup" stepKey="navigateToPageCategoryC"> + <argument name="categoryName" value="$$createCategoryB.name$$"/> + <argument name="subCategoryName" value="$$createCategoryC.name$$"/> + </actionGroup> + + <!-- Category C displays product C2 again, but only after reindex.--> + <see userInput="$$createCategoryC.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryC"/> + <dontSee userInput="$$createProductC1.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="dontSeeOnCategoryCProductC1"/> + <see userInput="$$createProductC2.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeOnPageTitleProductC2"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/etc/acl.xml b/app/code/Magento/Catalog/etc/acl.xml index 358a798fc7579..4d4b7bdc672d1 100644 --- a/app/code/Magento/Catalog/etc/acl.xml +++ b/app/code/Magento/Catalog/etc/acl.xml @@ -11,7 +11,9 @@ <resource id="Magento_Backend::admin"> <resource id="Magento_Catalog::catalog" title="Catalog" translate="title" sortOrder="30"> <resource id="Magento_Catalog::catalog_inventory" title="Inventory" translate="title" sortOrder="10"> - <resource id="Magento_Catalog::products" title="Products" translate="title" sortOrder="10" /> + <resource id="Magento_Catalog::products" title="Products" translate="title" sortOrder="10"> + <resource id="Magento_Catalog::update_attributes" title="Update Attributes" translate="title" /> + </resource> <resource id="Magento_Catalog::categories" title="Categories" translate="title" sortOrder="20" /> </resource> </resource> @@ -23,7 +25,6 @@ </resource> <resource id="Magento_Backend::stores_attributes"> <resource id="Magento_Catalog::attributes_attributes" title="Product" translate="title" sortOrder="30" /> - <resource id="Magento_Catalog::update_attributes" title="Update Attributes" translate="title" sortOrder="35" /> <resource id="Magento_Catalog::sets" title="Attribute Set" translate="title" sortOrder="40"/> </resource> </resource> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml index ee67acd0ebd46..cea54e883d2aa 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** * @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree */ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml index f58b39a819a0c..c77b66733afc4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml @@ -5,18 +5,18 @@ */ /** - * Template for \Magento\Catalog\Block\Adminhtml\Category\Edit + * @var $block \Magento\Catalog\Block\Adminhtml\Category\Edit */ ?> <div data-id="information-dialog-category" class="messages" style="display: none;"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('This operation can take a long time') ?></div> + <div><?= $block->escapeHtml(__('This operation can take a long time')) ?></div> </div> </div> <script type="text/x-magento-init"> { "*": { - "categoryForm": {"refreshUrl": "<?= /* @escapeNotVerified */ $block->getRefreshPathUrl() ?>"} + "categoryForm": {"refreshUrl": "<?= $block->escapeJs($block->escapeUrl($block->getRefreshPathUrl())) ?>"} } } </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml index 4691a709cadeb..af7aec12a57ed 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml @@ -16,8 +16,8 @@ $gridJsObjectName = $blockGrid->getJsObjectName(); { "*": { "Magento_Catalog/catalog/category/assign-products": { - "selectedProducts": <?= /* @escapeNotVerified */ $block->getProductsJson() ?>, - "gridJsObjectName": <?= /* @escapeNotVerified */ '"' . $gridJsObjectName . '"' ?: '{}' ?> + "selectedProducts": <?= /* @noEscape */ $block->getProductsJson() ?>, + "gridJsObjectName": <?= /* @noEscape */ '"' . $gridJsObjectName . '"' ?: '{}' ?> } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index f448edc692ce2..b2d33f0d12b9d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -4,27 +4,26 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree */ ?> <div class="categories-side-col"> <div class="sidebar-actions"> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <?= $block->getAddRootButtonHtml() ?><br/> <?= $block->getAddSubButtonHtml() ?> <?php endif; ?> </div> <div class="tree-actions"> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <?php //echo $block->getCollapseButtonHtml() ?> <?php //echo $block->getExpandButtonHtml() ?> <a href="#" - onclick="tree.collapseTree(); return false;"><?= /* @escapeNotVerified */ __('Collapse All') ?></a> + onclick="tree.collapseTree(); return false;"><?= $block->escapeHtml(__('Collapse All')) ?></a> <span class="separator">|</span> <a href="#" - onclick="tree.expandTree(); return false;"><?= /* @escapeNotVerified */ __('Expand All') ?></a> + onclick="tree.expandTree(); return false;"><?= $block->escapeHtml(_('Expand All')) ?></a> <?php endif; ?> </div> - <?php if ($block->getRoot()): ?> + <?php if ($block->getRoot()) :?> <div class="tree-holder"> <div id="tree-div" class="tree-wrapper"></div> </div> @@ -32,7 +31,7 @@ <div data-id="information-dialog-tree" class="messages" style="display: none;"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('This operation can take a long time') ?></div> + <div><?= $block->escapeHtml(__('This operation can take a long time')) ?></div> </div> </div> <script> @@ -172,7 +171,7 @@ if (!this.collapsed) { this.collapsed = true; - this.loader.dataUrl = '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl(false) ?>'; + this.loader.dataUrl = '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl(false))) ?>'; this.request(this.loader.dataUrl, false); } }, @@ -181,7 +180,7 @@ this.expandAll(); if (this.collapsed) { this.collapsed = false; - this.loader.dataUrl = '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl(true) ?>'; + this.loader.dataUrl = '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl(true))) ?>'; this.request(this.loader.dataUrl, false); } }, @@ -216,7 +215,7 @@ if (tree && switcherParams) { var url; if (switcherParams.useConfirm) { - if (!confirm("<?= /* @escapeNotVerified */ __('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")) { + if (!confirm("<?= $block->escapeJs(__('Please confirm site switching. All data that hasn\'t been saved will be lost.')) ?>")) { return false; } } @@ -259,7 +258,7 @@ } }); } else { - var baseUrl = '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>'; + var baseUrl = '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>'; var urlExt = switcherParams.scopeParams + 'id/' + tree.currentNodeId + '/'; url = parseSidUrl(baseUrl, urlExt); setLocation(url); @@ -296,7 +295,7 @@ if (scopeParams) { url = url + scopeParams; } - <?php if ($block->isClearEdit()): ?> + <?php if ($block->isClearEdit()) :?> if (selectedNode) { url = url + 'id/' + config.parameters.category_id; } @@ -307,7 +306,7 @@ jQuery(function () { categoryLoader = new Ext.tree.TreeLoader({ - dataUrl: '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl() ?>' + dataUrl: '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl())) ?>' }); categoryLoader.processResponse = function (response, parent, callback) { @@ -389,26 +388,26 @@ enableDD: true, containerScroll: true, selModel: new Ext.tree.CheckNodeMultiSelectionModel(), - rootVisible: '<?= /* @escapeNotVerified */ $block->getRoot()->getIsVisible() ?>', - useAjax: <?= /* @escapeNotVerified */ $block->getUseAjax() ?>, - switchTreeUrl: '<?= /* @escapeNotVerified */ $block->getSwitchTreeUrl() ?>', - editUrl: '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>', - currentNodeId: <?= /* @escapeNotVerified */ (int)$block->getCategoryId() ?>, - baseUrl: '<?= /* @escapeNotVerified */ $block->getEditUrl() ?>' + rootVisible: '<?= (bool)$block->getRoot()->getIsVisible() ?>', + useAjax: <?= $block->escapeJs($block->getUseAjax()) ?>, + switchTreeUrl: '<?= $block->escapeJs($block->escapeUrl($block->getSwitchTreeUrl())) ?>', + editUrl: '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>', + currentNodeId: <?= (int)$block->getCategoryId() ?>, + baseUrl: '<?= $block->escapeJs($block->escapeUrl($block->getEditUrl())) ?>' }; defaultLoadTreeParams = { parameters: { - text: <?= /* @escapeNotVerified */ json_encode(htmlentities($block->getRoot()->getName())) ?>, + text: <?= /* @noEscape */ json_encode(htmlentities($block->getRoot()->getName())) ?>, draggable: false, - allowDrop: <?php if ($block->getRoot()->getIsVisible()): ?>true<?php else : ?>false<?php endif; ?>, + allowDrop: <?php if ($block->getRoot()->getIsVisible()) :?>true<?php else :?>false<?php endif; ?>, id: <?= (int)$block->getRoot()->getId() ?>, expanded: <?= (int)$block->getIsWasExpanded() ?>, store_id: <?= (int)$block->getStore()->getId() ?>, category_id: <?= (int)$block->getCategoryId() ?>, parent: <?= (int)$block->getRequest()->getParam('parent') ?> }, - data: <?= /* @escapeNotVerified */ $block->getTreeJson() ?> + data: <?= /* @noEscape */ $block->getTreeJson() ?> }; reRenderTree(); @@ -486,7 +485,7 @@ click: function () { (function ($) { $.ajax({ - url: '<?= /* @escapeNotVerified */ $block->getMoveUrl() ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getMoveUrl())) ?>', method: 'POST', data: registry.get('pd'), showLoader: true diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml index 69737b8a37c1c..e24d676974b01 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml @@ -3,24 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_divId = 'tree' . $block->getId() ?> -<div id="<?= /* @escapeNotVerified */ $_divId ?>" class="tree"></div> +<div id="<?= $block->escapeHtmlAttr($_divId) ?>" class="tree"></div> <!--[if IE]> <script id="ie-deferred-loader" defer="defer" src="//:"></script> <![endif]--> <script> require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){ -var tree<?= /* @escapeNotVerified */ $block->getId() ?>; +var tree<?= $block->escapeJs($block->getId()) ?>; -var useMassaction = <?= /* @escapeNotVerified */ $block->getUseMassaction() ? 1 : 0 ?>; +var useMassaction = <?= $block->getUseMassaction() ? 1 : 0 ?>; -var isAnchorOnly = <?= /* @escapeNotVerified */ $block->getIsAnchorOnly() ? 1 : 0 ?>; +var isAnchorOnly = <?= $block->getIsAnchorOnly() ? 1 : 0 ?>; Ext.tree.TreePanel.Enhanced = function(el, config) { @@ -44,8 +41,8 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { this.setRootNode(root); if (firstLoad) { - <?php if ($block->getNodeClickListener()): ?> - this.addListener('click', <?= /* @escapeNotVerified */ $block->getNodeClickListener() ?>.createDelegate(this)); + <?php if ($block->getNodeClickListener()) :?> + this.addListener('click', <?= /* @noEscape */ $block->getNodeClickListener() ?>.createDelegate(this)); <?php endif; ?> } @@ -58,10 +55,10 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { jQuery(function() { - var emptyNodeAdded = <?= /* @escapeNotVerified */ ($block->getWithEmptyNode() ? 'false' : 'true') ?>; + var emptyNodeAdded = <?= ($block->getWithEmptyNode() ? 'false' : 'true') ?>; var categoryLoader = new Ext.tree.TreeLoader({ - dataUrl: '<?= /* @escapeNotVerified */ $block->getLoadTreeUrl() ?>' + dataUrl: '<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl())) ?>' }); categoryLoader.buildCategoryTree = function(parent, config) @@ -80,7 +77,7 @@ jQuery(function() // Add empty node to reset category filter if(!emptyNodeAdded) { var empty = Object.clone(_node); - empty.text = '<?= /* @escapeNotVerified */ __('None') ?>'; + empty.text = '<?= $block->escapeJs(__('None')) ?>'; empty.children = []; empty.id = 'none'; empty.path = '1/none'; @@ -151,11 +148,11 @@ jQuery(function() }; categoryLoader.on("beforeload", function(treeLoader, node) { - $('<?= /* @escapeNotVerified */ $_divId ?>').fire('category:beforeLoad', {treeLoader:treeLoader}); + $('<?= $block->escapeJs($_divId) ?>').fire('category:beforeLoad', {treeLoader:treeLoader}); treeLoader.baseParams.id = node.attributes.id; }); - tree<?= /* @escapeNotVerified */ $block->getId() ?> = new Ext.tree.TreePanel.Enhanced('<?= /* @escapeNotVerified */ $_divId ?>', { + tree<?= $block->escapeJs($block->getId()) ?> = new Ext.tree.TreePanel.Enhanced('<?= $block->escapeJs($_divId) ?>', { animate: false, loader: categoryLoader, enableDD: false, @@ -167,9 +164,9 @@ jQuery(function() }); if (useMassaction) { - tree<?= /* @escapeNotVerified */ $block->getId() ?>.on('check', function(node) { - $('<?= /* @escapeNotVerified */ $_divId ?>').fire('node:changed', {node:node}); - }, tree<?= /* @escapeNotVerified */ $block->getId() ?>); + tree<?= $block->escapeJs($block->getId()) ?>.on('check', function(node) { + $('<?= $block->escapeJs($_divId) ?>').fire('node:changed', {node:node}); + }, tree<?= $block->escapeJs($block->getId()) ?>); } // set the root node @@ -181,7 +178,7 @@ jQuery(function() category_id: <?= (int) $block->getCategoryId() ?> }; - tree<?= /* @escapeNotVerified */ $block->getId() ?>.loadTree({parameters:parameters, data:<?= /* @escapeNotVerified */ $block->getTreeJson() ?>},true); + tree<?= $block->escapeJs($block->getId()) ?>.loadTree({parameters:parameters, data:<?= /* @noEscape */ $block->getTreeJson() ?>},true); }); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml index 680361eae448e..cbda491a64740 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/form/renderer/fieldset/element.phtml @@ -3,19 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php -/** - * @see \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element - */ +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + +/** @var $block \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element */ ?> <?php /* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */ $element = $block->getElement(); -$note = $element->getNote() ? '<div class="note admin__field-note">' . $element->getNote() . '</div>' : ''; +$note = $element->getNote() ? '<div class="note admin__field-note">' . $block->escapeHtml($element->getNote()) . '</div>' : ''; $elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio'; $addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml(); $fieldId = ($element->getHtmlId()) ? ' id="attribute-' . $element->getHtmlId() . '-container"' : ''; @@ -27,8 +24,8 @@ $fieldClass .= ($element->getRequired()) ? ' required' : ''; $fieldClass .= ($note) ? ' with-note' : ''; $fieldClass .= ($entity && $entity->getIsUserDefined()) ? ' user-defined type-' . $entity->getFrontendInput() : ''; -$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' - . $block->getUiId('form-field', $element->getId()); +$fieldAttributes = $fieldId . ' class="' . $block->escapeHtmlAttr($fieldClass) . '" ' + . $block->getUiId('form-field', $block->escapeHtmlAttr($element->getId())); ?> <?php $block->checkFieldDisable() ?> @@ -36,38 +33,38 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' $elementToggleCode = $element->getToggleCode() ? $element->getToggleCode() : 'toggleValueElements(this, this.parentNode.parentNode.parentNode)'; ?> -<?php if (!$element->getNoDisplay()): ?> - <?php if ($element->getType() == 'hidden'): ?> +<?php if (!$element->getNoDisplay()) :?> + <?php if ($element->getType() == 'hidden') :?> <?= $element->getElementHtml() ?> - <?php else: ?> - <div<?= /* @escapeNotVerified */ $fieldAttributes ?> data-attribute-code="<?= $element->getHtmlId() ?>" - data-apply-to="<?= $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + <?php else :?> + <div<?= /* @noEscape */ $fieldAttributes ?> data-attribute-code="<?= $element->getHtmlId() ?>" + data-apply-to="<?= $block->escapeHtmlAttr($this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : [] ))?>" > - <?php if ($elementBeforeLabel): ?> + <?php if ($elementBeforeLabel) :?> <?= $block->getElementHtml() ?> <?= $element->getLabelHtml('', $block->getScopeLabel()) ?> - <?= /* @escapeNotVerified */ $note ?> - <?php else: ?> + <?= /* @noEscape */ $note ?> + <?php else :?> <?= $element->getLabelHtml('', $block->getScopeLabel()) ?> <div class="admin__field-control control"> - <?= /* @escapeNotVerified */ ($addOn) ? '<div class="addon">' . $block->getElementHtml() . '</div>' : $block->getElementHtml() ?> - <?= /* @escapeNotVerified */ $note ?> + <?= ($addOn) ? '<div class="addon">' . $block->getElementHtml() . '</div>' : $block->getElementHtml() ?> + <?= /* @noEscape */ $note ?> </div> <?php endif; ?> <div class="field-service"> - <?php if ($block->canDisplayUseDefault()): ?> + <?php if ($block->canDisplayUseDefault()) :?> <label for="<?= $element->getHtmlId() ?>_default" class="choice use-default"> - <input <?php if ($element->getReadonly()):?> disabled="disabled"<?php endif; ?> + <input <?php if ($element->getReadonly()) :?> disabled="disabled"<?php endif; ?> type="checkbox" name="use_default[]" class="use-default-control" id="<?= $element->getHtmlId() ?>_default" - <?php if ($block->usedDefault()): ?> checked="checked"<?php endif; ?> - onclick="<?= /* @escapeNotVerified */ $elementToggleCode ?>" - value="<?= /* @escapeNotVerified */ $block->getAttributeCode() ?>"/> - <span class="use-default-label"><?= /* @escapeNotVerified */ __('Use Default Value') ?></span> + <?php if ($block->usedDefault()) :?> checked="checked"<?php endif; ?> + onclick="<?= $block->escapeHtmlAttr($elementToggleCode) ?>" + value="<?= $block->escapeHtmlAttr($block->getAttributeCode()) ?>"/> + <span class="use-default-label"><?= $block->escapeHtml(__('Use Default Value')) ?></span> </label> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml index ce4d8450f5e63..9b9fff2cfc344 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml index 124194519b978..e30b981ff36a6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml @@ -4,16 +4,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** * @var $block \Magento\Backend\Block\Widget\Form\Container */ ?> -<?= /* @escapeNotVerified */ $block->getFormInitScripts() ?> -<div data-mage-init='{"floatingHeader": {}}' class="page-actions attribute-popup-actions" <?= /* @escapeNotVerified */ $block->getUiId('content-header') ?>> +<?= /* @noEscape */ $block->getFormInitScripts() ?> +<div data-mage-init='{"floatingHeader": {}}' class="page-actions attribute-popup-actions" <?= /* @noEscape */ $block->getUiId('content-header') ?>> <?= $block->getButtonsHtml('header') ?> </div> @@ -25,9 +23,9 @@ { "#edit_form": { "Magento_Catalog/catalog/product/edit/attribute": { - "validationUrl": "<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>" + "validationUrl": "<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>" } } } </script> -<?= /* @escapeNotVerified */ $block->getFormScripts() ?> +<?= /* @noEscape */ $block->getFormScripts() ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml index ddcec99f2108c..2dc39b97c3d95 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <script> require([ @@ -197,22 +196,22 @@ function switchDefaultValueField() setRowVisibility('frontend_class', false); break; - <?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?> - case '<?= /* @escapeNotVerified */ $type ?>': + <?php foreach ($this->helper(Magento\Catalog\Helper\Data::class)->getAttributeHiddenFields() as $type => $fields) :?> + case '<?= $block->escapeJs($type) ?>': var isFrontTabHidden = false; - <?php foreach ($fields as $one): ?> - <?php if ($one == '_front_fieldset'): ?> + <?php foreach ($fields as $one) :?> + <?php if ($one == '_front_fieldset') :?> getFrontTab().hide(); isFrontTabHidden = true; - <?php elseif ($one == '_default_value'): ?> + <?php elseif ($one == '_default_value') :?> defaultValueTextVisibility = defaultValueTextareaVisibility = defaultValueDateVisibility = defaultValueYesnoVisibility = false; - <?php elseif ($one == '_scope'): ?> + <?php elseif ($one == '_scope') :?> scopeVisibility = false; - <?php else: ?> - setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false); + <?php else :?> + setRowVisibility('<?= $block->escapeJs($one) ?>', false); <?php endif; ?> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml index f3d39257c266c..1d5d251f00de9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Labels */ ?> <div class="fieldset-wrapper admin__collapsible-block-wrapper opened" id="manage-titles-wrapper"> <div class="fieldset-wrapper-title"> <strong class="admin__collapsible-title" data-toggle="collapse" data-target="#manage-titles-content"> - <span><?= /* @escapeNotVerified */ __('Manage Titles (Size, Color, etc.)') ?></span> + <span><?= $block->escapeHtml(__('Manage Titles (Size, Color, etc.)')) ?></span> </strong> </div> <div class="fieldset-wrapper-content in collapse" id="manage-titles-content"> @@ -21,17 +19,23 @@ <table class="admin__control-table" id="attribute-labels-table"> <thead> <tr> - <?php foreach ($block->getStores() as $_store): ?> - <th class="col-store-view"><?= /* @escapeNotVerified */ $_store->getName() ?></th> + <?php foreach ($block->getStores() as $_store) :?> + <th class="col-store-view"><?= $block->escapeHtml($_store->getName()) ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <tr> <?php $_labels = $block->getLabelValues() ?> - <?php foreach ($block->getStores() as $_store): ?> + <?php foreach ($block->getStores() as $_store) :?> <td class="col-store-view"> - <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?= /* @escapeNotVerified */ $_store->getId() ?>]" value="<?= $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/> + <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option<?php endif; ?>" + type="text" + name="frontend_label[<?= $block->escapeHtmlAttr($_store->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($_labels[$_store->getId()]) ?>" + <?php if ($block->getReadOnly()) :?> + disabled="disabled" + <?php endif;?>/> </td> <?php endforeach; ?> </tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index f812a27f87ad9..e5f8a360c334c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options */ $stores = $block->getStoresSortedBySortOrder(); @@ -23,8 +21,8 @@ $stores = $block->getStoresSortedBySortOrder(); <span><?= $block->escapeHtml(__('Is Default')) ?></span> </th> <?php - foreach ($stores as $_store): ?> - <th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>> + foreach ($stores as $_store) :?> + <th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> class="_required"<?php endif; ?>> <span><?= $block->escapeHtml(__($_store->getName())) ?></span> </th> <?php endforeach; @@ -43,7 +41,7 @@ $stores = $block->getStoresSortedBySortOrder(); </tr> <tr> <th colspan="<?= (int) $storetotal ?>" class="col-actions-add"> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <button id="add_new_option_button" data-action="add_new_row" title="<?= $block->escapeHtml(__('Add Option')) ?>" type="button" class="action- scalable add"> @@ -59,22 +57,22 @@ $stores = $block->getStoresSortedBySortOrder(); <script id="row-template" type="text/x-magento-template"> <tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>> <td class="col-draggable"> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <div data-role="draggable-handle" class="draggable-handle" title="<?= $block->escapeHtml(__('Sort Option')) ?>"> </div> <?php endif; ?> - <input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/> + <input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif; ?>/> </td> <td class="col-default control-table-actions-cell"> - <input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/> + <input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()) :?>disabled="disabled"<?php endif;?>/> </td> - <?php foreach ($stores as $_store): ?> - <td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> + <?php foreach ($stores as $_store) :?> + <td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif;?>/></td> <?php endforeach; ?> <td id="delete_button_container_<%- data.id %>" class="col-delete"> <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" /> - <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?> + <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?> <button id="delete_button_<%- data.id %>" title="<?= $block->escapeHtml(__('Delete')) ?>" type="button" class="action- scalable delete delete-option" > @@ -86,9 +84,9 @@ $stores = $block->getStoresSortedBySortOrder(); </script> <?php $values = []; - foreach($block->getOptionValues() as $value) { + foreach ($block->getOptionValues() as $value) { $value = $value->getData(); - $values[] = is_array($value) ? array_map(function($str) { + $values[] = is_array($value) ? array_map(function ($str) { return htmlspecialchars_decode($str, ENT_QUOTES); }, $value) : $value; } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 9621b9a57168c..dd1009cc5e033 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main */ ?> <div class="attribute-set"> @@ -31,11 +30,11 @@ </div> <div class="attribute-set-col fieldset-wrapper"> <div class="fieldset-wrapper-title"> - <span class="title"><?= /* @escapeNotVerified */ __('Groups') ?></span> + <span class="title"><?= $block->escapeHtml(__('Groups')) ?></span> </div> - <?php if (!$block->getIsReadOnly()): ?> - <?= /* @escapeNotVerified */ $block->getAddGroupButton() ?> <?= /* @escapeNotVerified */ $block->getDeleteGroupButton() ?> - <p class="note-block"><?= /* @escapeNotVerified */ __('Double click on a group to rename it.') ?></p> + <?php if (!$block->getIsReadOnly()) :?> + <?= /* @noEscape */ $block->getAddGroupButton() ?> <?= /* @noEscape */ $block->getDeleteGroupButton() ?> + <p class="note-block"><?= $block->escapeHtml(__('Double click on a group to rename it.')) ?></p> <?php endif; ?> <?= $block->getSetsFilterHtml() ?> @@ -43,7 +42,7 @@ </div> <div class="attribute-set-col fieldset-wrapper"> <div class="fieldset-wrapper-title"> - <span class="title"><?= /* @escapeNotVerified */ __('Unassigned Attributes') ?></span> + <span class="title"><?= $block->escapeHtml(__('Unassigned Attributes')) ?></span> </div> <div id="tree-div2" class="attribute-set-tree"></div> <script id="ie-deferred-loader" defer="defer" src="//:"></script> @@ -58,8 +57,8 @@ ], function(jQuery, prompt, alert){ //<![CDATA[ - var allowDragAndDrop = <?= /* @escapeNotVerified */ ($block->getIsReadOnly() ? 'false' : 'true') ?>; - var canEditGroups = <?= /* @escapeNotVerified */ ($block->getIsReadOnly() ? 'false' : 'true') ?>; + var allowDragAndDrop = <?= ($block->getIsReadOnly() ? 'false' : 'true') ?>; + var canEditGroups = <?= ($block->getIsReadOnly() ? 'false' : 'true') ?>; var TreePanels = function() { // shorthand @@ -86,7 +85,7 @@ }); tree.setRootNode(this.root); - buildCategoryTree(this.root, <?= /* @escapeNotVerified */ $block->getGroupTreeJson() ?>); + buildCategoryTree(this.root, <?= /* @noEscape */ $block->getGroupTreeJson() ?>); // render the tree tree.render(); this.root.expand(false, false); @@ -94,7 +93,7 @@ this.ge = new Ext.tree.TreeEditor(tree, { allowBlank:false, - blankText:'<?= /* @escapeNotVerified */ __('A name is required.') ?>', + blankText:'<?= $block->escapeJs(__('A name is required.')) ?>', selectOnFocus:true, cls:'folder' }); @@ -125,7 +124,7 @@ id:'free' }); tree2.setRootNode(this.root2); - buildCategoryTree(this.root2, <?= /* @escapeNotVerified */ $block->getAttributeTreeJson() ?>); + buildCategoryTree(this.root2, <?= /* @noEscape */ $block->getAttributeTreeJson() ?>); this.root2.addListener('beforeinsert', editSet.rightBeforeInsert); this.root2.addListener('beforeappend', editSet.rightBeforeAppend); @@ -196,14 +195,14 @@ } } } - } - node.appendChild(newNode); - newNode.addListener('click', editSet.unregister); } + node.appendChild(newNode); + newNode.addListener('click', editSet.unregister); } } } } + } editSet = function () { @@ -280,8 +279,8 @@ addGroup : function() { prompt({ - title: "<?= /* @escapeNotVerified */ __('Add New Group') ?>", - content: "<?= /* @escapeNotVerified */ __('Please enter a new group name.') ?>", + title: "<?= $block->escapeJs($block->escapeHtml(__('Add New Group'))) ?>", + content: "<?= $block->escapeJs($block->escapeHtml(__('Please enter a new group name.'))) ?>", value: "", validation: true, validationRules: ['required-entry'], @@ -346,7 +345,7 @@ } for (var i=0; i < TreePanels.root.childNodes.length; i++) { if (TreePanels.root.childNodes[i].text.toLowerCase() == name.toLowerCase() && TreePanels.root.childNodes[i].id != exceptNodeId) { - errorText = '<?= /* @escapeNotVerified */ __('An attribute group named "/name/" already exists.') ?>'; + errorText = '<?= $block->escapeJs(__('An attribute group named "/name/" already exists.')) ?>'; alert({ content: errorText.replace("/name/",name) }); @@ -374,7 +373,7 @@ editSet.req.form_key = FORM_KEY; } var req = {data : Ext.util.JSON.encode(editSet.req)}; - var con = new Ext.lib.Ajax.request('POST', '<?= /* @escapeNotVerified */ $block->getMoveUrl() ?>', {success:editSet.success,failure:editSet.failure}, req); + var con = new Ext.lib.Ajax.request('POST', '<?= $block->escapeJs($block->escapeUrl($block->getMoveUrl())) ?>', {success:editSet.success,failure:editSet.failure}, req); }, success : function(o) { @@ -449,7 +448,7 @@ rightRemove : function(tree, nodeThis, node) { if( nodeThis.firstChild == null && node.id != 'empty' ) { var newNode = new Ext.tree.TreeNode({ - text : '<?= /* @escapeNotVerified */ __('Empty') ?>', + text : '<?= $block->escapeJs(__('Empty')) ?>', id : 'empty', cls : 'folder', is_user_defined : 1, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml index c1af14389fe59..227ed4be81fae 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml @@ -8,7 +8,7 @@ <script> require(['jquery', "mage/mage"], function(jQuery){ - jQuery('#<?= /* @escapeNotVerified */ $block->getFormId() ?>').mage('form').mage('validation'); + jQuery('#<?= $block->escapeJs($block->getFormId()) ?>').mage('form').mage('validation'); }); </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml index 902c6932f0ae1..c0928f4723b50 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml('grid') ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml index 75027d5e043fb..32466a1dfa965 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml @@ -3,10 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - - ?> +?> <div id="product_composite_configure" class="product-configure-popup" style="display:none;"> <iframe name="product_composite_configure_iframe" id="product_composite_configure_iframe" style="width:0; height:0; border:0px solid #fff; position:absolute; top:-1000px; left:-1000px" onload="window.productConfigure && productConfigure.onLoadIFrame()"></iframe> <form action="" method="post" id="product_composite_configure_form" enctype="multipart/form-data" onsubmit="productConfigure.onConfirmBtn(); return false;" target="product_composite_configure_iframe"> @@ -19,7 +16,7 @@ <div id="product_composite_configure_form_confirmed" style="display:none;"></div> </div> <input type="hidden" name="as_js_varname" value="iFrameResponse" /> - <input type="hidden" name="form_key" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /> + <input type="hidden" name="form_key" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /> </form> <div id="product_composite_configure_confirmed" style="display:none;"></div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml index acc80fa6ea6b0..6a83ece330441 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml @@ -3,24 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Options */ ?> <?php $options = $block->decorateArray($block->getOptions()); ?> -<?php if (count($options)): ?> +<?php if (count($options)) :?> -<?= $block->getChildHtml('options_js') ?> + <?= $block->getChildHtml('options_js') ?> -<fieldset id="product_composite_configure_fields_options" class="fieldset admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> - <legend class="legend admin__legend"> - <span><?= /* @escapeNotVerified */ __('Custom Options') ?></span> - </legend><br> - <?php foreach ($options as $option): ?> - <?= $block->getOptionHtml($option) ?> - <?php endforeach;?> -</fieldset> + <fieldset id="product_composite_configure_fields_options" + class="fieldset admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> + <legend class="legend admin__legend"> + <span><?= $block->escapeHtml(__('Custom Options')) ?></span> + </legend><br> + <?php foreach ($options as $option) :?> + <?= $block->getOptionHtml($option) ?> + <?php endforeach;?> + </fieldset> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml index 30c05c2ec689b..8adffb752187b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml @@ -3,82 +3,82 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?> <?php $_option = $block->getOption(); ?> -<?php $_optionId = $_option->getId(); ?> -<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> - <label class="label admin__field-label"> - <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> - </label> - <div class="admin__field-control control"> +<?php $_optionId = (int)$_option->getId(); ?> +<div class="admin__field field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> + <label class="label admin__field-label"> + <?= $block->escapeHtml($_option->getTitle()) ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> + </label> + <div class="admin__field-control control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE): ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE) :?> - <?= $block->getDateHtml() ?> + <?= $block->getDateHtml() ?> - <?php if (!$block->useCalendar()): ?> - <script> -require([ - "prototype", - "Magento_Catalog/catalog/product/composite/configure" -], function(){ + <?php if (!$block->useCalendar()) :?> + <script> + require([ + "prototype", + "Magento_Catalog/catalog/product/composite/configure" + ], function(){ - window.dateOption = productConfigure.opConfig.dateOption; - Event.observe('options_<?= /* @escapeNotVerified */ $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption)); - Event.observe('options_<?= /* @escapeNotVerified */ $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption)); -}); -</script> - <?php endif; ?> + window.dateOption = productConfigure.opConfig.dateOption; + Event.observe('options_<?= /* @noEscape */ $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption)); + Event.observe('options_<?= /* @noEscape */ $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption)); + }); + </script> + <?php endif; ?> - <?php endif; ?> + <?php endif; ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME): ?> - <span class="time-picker"><?= $block->getTimeHtml() ?></span> - <?php endif; ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME) :?> + <span class="time-picker"><?= $block->getTimeHtml() ?></span> + <?php endif; ?> - <input type="hidden" name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" value="" /> - <script> -require([ - "jquery", - "mage/backend/validation" -], function(jQuery){ + <input type="hidden" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" + value="" /> + <script> + require([ + "jquery", + "mage/backend/validation" + ], function(jQuery){ - //<![CDATA[ -<?php if ($_option->getIsRequire()): ?> - jQuery.validator.addMethod('validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>', function(v) { - var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @escapeNotVerified */ $_optionId ?>"]'); - for (var i=0; i < dateTimeParts.length; i++) { - if (dateTimeParts[i].value == "") return false; - } - return true; - }, '<?= $block->escapeJs(__('This is a required option.')) ?>'); -<?php else: ?> - jQuery.validator.addMethod('validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>', function(v) { - var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @escapeNotVerified */ $_optionId ?>"]'); - var hasWithValue = false, hasWithNoValue = false; - var pattern = /day_part$/i; - for (var i=0; i < dateTimeParts.length; i++) { - if (! pattern.test(dateTimeParts[i].id)) { - if (dateTimeParts[i].value === "") { - hasWithValue = true; - } else { - hasWithNoValue = true; + //<![CDATA[ + <?php if ($_option->getIsRequire()) :?> + jQuery.validator.addMethod('validate-datetime-<?= /* @noEscape */ $_optionId ?>', function(v) { + var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @noEscape */ $_optionId ?>"]'); + for (var i=0; i < dateTimeParts.length; i++) { + if (dateTimeParts[i].value == "") return false; } - } - } - return hasWithValue ^ hasWithNoValue; - }, '<?= $block->escapeJs(__('The field isn\'t complete.')) ?>'); -<?php endif; ?> - //]]> - -}); -</script> - </div> + return true; + }, '<?= $block->escapeJs(__('This is a required option.')) ?>'); + <?php else :?> + jQuery.validator.addMethod('validate-datetime-<?= /* @noEscape */ $_optionId ?>', function(v) { + var dateTimeParts = jQuery('.datetime-picker[id^="options_<?= /* @noEscape */ $_optionId ?>"]'); + var hasWithValue = false, hasWithNoValue = false; + var pattern = /day_part$/i; + for (var i=0; i < dateTimeParts.length; i++) { + if (! pattern.test(dateTimeParts[i].id)) { + if (dateTimeParts[i].value === "") { + hasWithValue = true; + } else { + hasWithNoValue = true; + } + } + } + return hasWithValue ^ hasWithNoValue; + }, '<?= $block->escapeJs(__('The field isn\'t complete.')) ?>'); + <?php endif; ?> + //]]> + + }); + </script> + </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml index 4ad7a95c91980..da0b3b36d561e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?> <?php $_option = $block->getOption(); ?> <?php $_fileInfo = $block->getFileInfo(); ?> <?php $_fileExists = $_fileInfo->hasData() ? true : false; ?> -<?php $_fileName = 'options_' . $_option->getId() . '_file'; ?> +<?php $_fileName = 'options_' . (int)$_option->getId() . '_file'; ?> <?php $_fieldNameAction = $_fileName . '_action'; ?> <?php $_fieldValueAction = $_fileExists ? 'save_old' : 'save_new'; ?> <?php $_fileNamed = $_fileName . '_name'; ?> @@ -21,11 +18,11 @@ require(['prototype'], function(){ //<![CDATA[ - opFile<?= /* @escapeNotVerified */ $_rand ?> = { + opFile<?= /* @noEscape */ $_rand ?> = { initializeFile: function(inputBox) { - this.inputFile = inputBox.select('input[name="<?= /* @escapeNotVerified */ $_fileName ?>"]')[0]; - this.inputFileAction = inputBox.select('input[name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>"]')[0]; - this.fileNameBox = inputBox.up('dd').select('.<?= /* @escapeNotVerified */ $_fileNamed ?>')[0]; + this.inputFile = inputBox.select('input[name="<?= /* @noEscape */ $_fileName ?>"]')[0]; + this.inputFileAction = inputBox.select('input[name="<?= /* @noEscape */ $_fieldNameAction ?>"]')[0]; + this.fileNameBox = inputBox.up('dd').select('.<?= /* @noEscape */ $_fileNamed ?>')[0]; }, toggleFileChange: function(inputBox) { @@ -62,42 +59,42 @@ require(['prototype'], function(){ }); </script> -<div class="admin__field <?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="admin__field <?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="admin__field-label label"> <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="admin__field-control control"> - <?php if ($_fileExists): ?> + <?php if ($_fileExists) :?> <span class="<?= /* @noEscape */ $_fileNamed ?>"><?= $block->escapeHtml($_fileInfo->getTitle()) ?></span> - <a href="javascript:void(0)" class="label" onclick="opFile<?= /* @escapeNotVerified */ $_rand ?>.toggleFileChange($(this).next('.input-box'))"> - <?= /* @escapeNotVerified */ __('Change') ?> + <a href="javascript:void(0)" class="label" onclick="opFile<?= /* @noEscape */ $_rand ?>.toggleFileChange($(this).next('.input-box'))"> + <?= $block->escapeHtml(__('Change')) ?> </a>  - <?php if (!$_option->getIsRequire()): ?> - <input type="checkbox" onclick="opFile<?= /* @escapeNotVerified */ $_rand ?>.toggleFileDelete($(this), $(this).next('.input-box'))" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>"/> - <span class="label"><?= /* @escapeNotVerified */ __('Delete') ?></span> + <?php if (!$_option->getIsRequire()) :?> + <input type="checkbox" onclick="opFile<?= /* @noEscape */ $_rand ?>.toggleFileDelete($(this), $(this).next('.input-box'))" price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>"/> + <span class="label"><?= $block->escapeHtml(__('Delete')) ?></span> <?php endif; ?> <?php endif; ?> <div class="input-box" <?= $_fileExists ? 'style="display:none"' : '' ?>> <!-- ToDo UI: add appropriate file class when z-index issue in ui dialog will be resolved --> - <input type="file" name="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required-entry' : '' ?>" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>" <?= $_fileExists ? 'disabled="disabled"' : '' ?>/> - <input type="hidden" name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>" value="<?= /* @escapeNotVerified */ $_fieldValueAction ?>" /> + <input type="file" name="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required-entry' : '' ?>" price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>" <?= $_fileExists ? 'disabled="disabled"' : '' ?>/> + <input type="hidden" name="<?= /* @noEscape */ $_fieldNameAction ?>" value="<?= /* @noEscape */ $_fieldValueAction ?>" /> - <?php if ($_option->getFileExtension()): ?> + <?php if ($_option->getFileExtension()) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Compatible file extensions to upload') ?>: <strong><?= /* @escapeNotVerified */ $_option->getFileExtension() ?></strong></span> + <span><?= $block->escapeHtml(__('Compatible file extensions to upload')) ?>: <strong><?= $block->escapeHtml($_option->getFileExtension()) ?></strong></span> </div> <?php endif; ?> - <?php if ($_option->getImageSizeX() > 0): ?> + <?php if ($_option->getImageSizeX() > 0) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Maximum image width') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeX() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong></span> + <span><?= $block->escapeHtml(__('Maximum image width')) ?>: <strong><?= (int)$_option->getImageSizeX() ?> <?= $block->escapeHtml(__('px.')) ?></strong></span> </div> <?php endif; ?> - <?php if ($_option->getImageSizeY() > 0): ?> + <?php if ($_option->getImageSizeY() > 0) :?> <div class="admin__field-note"> - <span><?= /* @escapeNotVerified */ __('Maximum image height') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeY() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong></span> + <span><?= $block->escapeHtml(__('Maximum image height')) ?>: <strong><?= (int)$_option->getImageSizeY() ?> <?= $block->escapeHtml(__('px.')) ?></strong></span> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml index af09bbe0acd9d..2218ce5d29671 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml @@ -3,21 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?> <?php $_option = $block->getOption(); ?> -<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="admin__field field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="label admin__field-label"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control admin__field-control"> <?= $block->getValuesHtml() ?> - <?php if ($_option->getIsRequire()): ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX): ?> - <span id="options-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></span> + <?php if ($_option->getIsRequire()) :?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX) :?> + <span id="options-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></span> <?php endif; ?> <?php endif;?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml index 11fba22ea8139..d1a019911d581 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml @@ -3,26 +3,33 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?> <?php $_option = $block->getOption(); ?> -<div class="field admin__field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> +<div class="field admin__field<?= $_option->getIsRequire() ? ' required _required' : '' ?>"> <label class="admin__field-label label"> <?= $block->escapeHtml($_option->getTitle()) ?> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="control admin__field-control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?> - <input type="text" id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" class="input-text admin__control-text <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= /* @escapeNotVerified */ $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" value="<?= $block->escapeHtml($block->getDefaultValue()) ?>" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>" /> - <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA): ?> - <textarea id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" class="admin__control-textarea <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= /* @escapeNotVerified */ $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" rows="5" cols="25" price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_option->getPrice(true)) ?>"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD) :?> + <input type="text" + id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" + class="input-text admin__control-text <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= $_option->getMaxCharacters() ? ' validate-length maximum-length-' . (int) $_option->getMaxCharacters() : '' ?> product-custom-option" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + value="<?= $block->escapeHtmlAttr($block->getDefaultValue()) ?>" + price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>" /> + <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) :?> + <textarea id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" + class="admin__control-textarea <?= $_option->getIsRequire() ? ' required-entry' : '' ?> <?= $_option->getMaxCharacters() ? ' validate-length maximum-length-' . (int) $_option->getMaxCharacters() : '' ?> product-custom-option" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + rows="5" + cols="25" + price="<?= $block->escapeHtmlAttr($block->getCurrencyPrice($_option->getPrice(true))) ?>"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> <?php endif;?> - <?php if ($_option->getMaxCharacters()): ?> - <p class="note"><?= /* @escapeNotVerified */ __('Maximum number of characters:') ?> <strong><?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?></strong></p> + <?php if ($_option->getMaxCharacters()) :?> + <p class="note"><?= $block->escapeHtml(__('Maximum number of characters:')) ?> <strong><?= (int) $_option->getMaxCharacters() ?></strong></p> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml index 487c9b8e8f2b7..4726bdc0930fd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Qty */ ?> @@ -13,9 +10,9 @@ <fieldset id="product_composite_configure_fields_qty" class="fieldset product-composite-qty-block admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> <div class="field admin__field"> - <label class="label admin__field-label"><span><?= /* @escapeNotVerified */ __('Quantity') ?></span></label> + <label class="label admin__field-label"><span><?= $block->escapeHtml(__('Quantity')) ?></span></label> <div class="control admin__field-control"> - <input id="product_composite_configure_input_qty" class="input-text admin__control-text qty" type="text" name="qty" value="<?= /* @escapeNotVerified */ $block->getQtyValue() * 1 ?>"> + <input id="product_composite_configure_input_qty" class="input-text admin__control-text qty" type="text" name="qty" value="<?= $block->getQtyValue() * 1 ?>"> </div> </div> </fieldset> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml index 7c25c3686eadc..66df098a194ae 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml @@ -3,11 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit */ @@ -17,11 +16,11 @@ <div id="product-template-suggest-container" class="suggest-expandable"> <div class="action-dropdown"> <button type="button" class="action-toggle" data-mage-init='{"dropdown":{}}' data-toggle="dropdown"> - <span><?= /* @escapeNotVerified */ $block->getAttributeSetName() ?></span> + <span><?= $block->escapeHtml($block->getAttributeSetName()) ?></span> </button> <ul class="dropdown-menu"> <li><input type="text" id="product-template-suggest" class="search" - placeholder="<?= /* @noEscape */ __('start typing to search template') ?>"/></li> + placeholder="<?= $block->escapeHtmlAttr(__('start typing to search template')) ?>"/></li> </ul> </div> </div> @@ -30,32 +29,32 @@ <input type="checkbox" id="product-online-switcher" name="product-online-switcher" /> <label class="switcher-label" for="product-online-switcher" - data-text-on="<?= /* @escapeNotVerified */ __('Product online') ?>" - data-text-off="<?= /* @escapeNotVerified */ __('Product offline') ?>" - title="<?= /* @escapeNotVerified */ __('Product online status') ?>"></label> + data-text-on="<?= $block->escapeHtmlAttr(__('Product online')) ?>" + data-text-off="<?= $block->escapeHtmlAttr(__('Product offline')) ?>" + title="<?= $block->escapeHtmlAttr(__('Product online status')) ?>"></label> </div> - <?php if ($block->getProductId()): ?> + <?php if ($block->getProductId()) :?> <?= $block->getDeleteButtonHtml() ?> <?php endif; ?> - <?php if ($block->getProductSetId()): ?> + <?php if ($block->getProductSetId()) :?> <?= $block->getChangeAttributeSetButtonHtml() ?> <?= $block->getSaveSplitButtonHtml() ?> <?php endif; ?> <?= $block->getBackButtonHtml() ?> </div> </div> -<?php if ($block->getUseContainer()): ?> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" enctype="multipart/form-data" - data-form="edit-product" data-product-id="<?= /* @escapeNotVerified */ $block->getProduct()->getId() ?>"> +<?php if ($block->getUseContainer()) :?> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" method="post" enctype="multipart/form-data" + data-form="edit-product" data-product-id="<?= $block->escapeHtmlAttr($block->getProduct()->getId()) ?>"> <?php endif; ?> <?= $block->getBlockHtml('formkey') ?> <div data-role="tabs" id="product-edit-form-tabs"></div> <?php /* @TODO: remove id after elimination of setDestElementId('product-edit-form-tabs') */?> <?= $block->getChildHtml('product-type-tabs') ?> - <input type="hidden" id="product_type_id" value="<?= /* @escapeNotVerified */ $block->getProduct()->getTypeId() ?>"/> - <input type="hidden" id="attribute_set_id" value="<?= /* @escapeNotVerified */ $block->getProduct()->getAttributeSetId() ?>"/> + <input type="hidden" id="product_type_id" value="<?= $block->escapeHtmlAttr($block->getProduct()->getTypeId()) ?>"/> + <input type="hidden" id="attribute_set_id" value="<?= $block->escapeHtmlAttr($block->getProduct()->getAttributeSetId()) ?>"/> <button type="submit" class="hidden"></button> -<?php if ($block->getUseContainer()): ?> +<?php if ($block->getUseContainer()) :?> </form> <?php endif; ?> <script> @@ -130,10 +129,10 @@ require([ } } }); - $form.mage('validation', {validationUrl: '<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>'}); + $form.mage('validation', {validationUrl: '<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>'}); - var masks = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getFieldsAutogenerationMasks()) ?>; - var availablePlaceholders = <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getAttributesAllowedForAutogeneration()) ?>; + var masks = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getFieldsAutogenerationMasks()) ?>; + var availablePlaceholders = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getAttributesAllowedForAutogeneration()) ?>; var Autogenerator = function(masks) { this._masks = masks || {}; this._fieldReverseIndex = this._buildReverseIndex(this._masks); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml index a3b0b32e4c29a..056cf014f769a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml @@ -4,18 +4,21 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute */ ?> -<form action="<?= /* @escapeNotVerified */ $block->getSaveUrl() ?>" method="post" id="attributes-edit-form" class="attributes-edit-form" enctype="multipart/form-data"> +<form action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" + method="post" + id="attributes-edit-form" + class="attributes-edit-form" + enctype="multipart/form-data"> <?= $block->getBlockHtml('formkey') ?> </form> <script type="text/x-magento-init"> { "#attributes-edit-form": { "Magento_Catalog/catalog/product/edit/attribute": { - "validationUrl": "<?= /* @escapeNotVerified */ $block->getValidationUrl() ?>" + "validationUrl": "<?= $block->escapeJs($block->escapeUrl($block->getValidationUrl())) ?>" } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml index 64c8ba7dcf49f..792af12494af6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory $block */ ?> <script> @@ -40,326 +39,363 @@ if (!is_numeric($defaultMinSaleQty)) { <div class="fieldset-wrapper form-inline advanced-inventory-edit"> <div class="fieldset-wrapper-title"> <strong class="title"> - <span><?= /* @escapeNotVerified */ __('Advanced Inventory') ?></span> + <span><?= $block->escapeHtml(__('Advanced Inventory')) ?></span> </strong> </div> <div class="fieldset-wrapper-content"> <fieldset class="fieldset" id="table_cataloginventory"> <div class="field"> <label class="label" for="inventory_manage_stock"> - <span><?= /* @escapeNotVerified */ __('Manage Stock') ?></span> + <span><?= $block->escapeHtml(__('Manage Stock')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> - <select id="inventory_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[manage_stock]" + <select id="inventory_manage_stock" name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[manage_stock]" class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option - value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0" + <?php if ($block->getFieldValue('manage_stock') == 0) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> </select> </div> <div class="field choice"> - <input name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox" + <input name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox" id="inventory_use_config_manage_stock" data-role="toggle-editability" value="1" checked="checked" disabled="disabled"/> <label for="inventory_use_config_manage_stock" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_manage_stock_checkbox" data-role="toggle-editability-all"/> <label for="inventory_manage_stock_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field required"> <label class="label" for="inventory_qty"> - <span><?= /* @escapeNotVerified */ __('Qty') ?></span> + <span><?= $block->escapeHtml(__('Qty')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text required-entry validate-number" id="inventory_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('qty') * 1 ?>" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty]" + value="<?= $block->getDefaultConfigValue('qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field with-addon"> <label class="label" for="inventory_min_qty"> - <span><?= /* @escapeNotVerified */ __('Out-of-Stock Threshold') ?></span> + <span><?= $block->escapeHtml(__('Out-of-Stock Threshold')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_min_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_qty]" + value="<?= $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_min_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_min_qty]" value="1" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> <label for="inventory_use_config_min_qty" class="label"> - <span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span> + <span><?= $block->escapeHtml(__('Use Config Settings')) ?></span> </label> </div> <div class="field choice"> <input type="checkbox" id="inventory_min_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_min_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_min_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Minimum Qty Allowed in Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Minimum Qty Allowed in Shopping Cart')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_sale_qty]" - value="<?= /* @escapeNotVerified */ $defaultMinSaleQty ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_sale_qty]" + value="<?= $defaultMinSaleQty * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_min_sale_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_sale_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_min_sale_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_min_sale_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_min_sale_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_max_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Maximum Qty Allowed in Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Maximum Qty Allowed in Shopping Cart')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_max_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[max_sale_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('max_sale_qty') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[max_sale_qty]" + value="<?= $block->getDefaultConfigValue('max_sale_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_max_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_max_sale_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_max_sale_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_max_sale_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_max_sale_checkbox" data-role="toggle-editability-all"/> <label for="inventory_max_sale_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_is_qty_decimal"> - <span><?= /* @escapeNotVerified */ __('Qty Uses Decimals') ?></span> + <span><?= $block->escapeHtml(__('Qty Uses Decimals')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_is_qty_decimal" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[is_qty_decimal]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_qty_decimal]" + class="select" disabled="disabled"> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option - value="1"<?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1" + <?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_is_qty_decimal_checkbox" data-role="toggle-editability-all"/> <label for="inventory_is_qty_decimal_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_backorders"> - <span><?= /* @escapeNotVerified */ __('Backorders') ?></span> + <span><?= $block->escapeHtml(__('Backorders')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> - <select id="inventory_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[backorders]" - class="select" disabled="disabled"> - <?php foreach ($block->getBackordersOption() as $option): ?> + <select id="inventory_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[backorders]" + class="select" + disabled="disabled"> + <?php foreach ($block->getBackordersOption() as $option) :?> <?php $_selected = ($option['value'] == $block->getDefaultConfigValue('backorders')) ? ' selected="selected"' : '' ?> <option - value="<?= /* @escapeNotVerified */ $option['value'] ?>"<?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> + value="<?= $block->escapeHtmlAttr($option['value']) ?>"<?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> <?php endforeach; ?> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_backorders" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_backorders]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_backorders]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_backorders" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_backorders_checkbox" data-role="toggle-editability-all"/> - <label for="inventory_backorders_checkbox" class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + <label for="inventory_backorders_checkbox" + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_notify_stock_qty"> - <span><?= /* @escapeNotVerified */ __('Notify for Quantity Below') ?></span> + <span><?= $block->escapeHtml(__('Notify for Quantity Below')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[notify_stock_qty]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('notify_stock_qty') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[notify_stock_qty]" + value="<?= $block->getDefaultConfigValue('notify_stock_qty') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_notify_stock_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_notify_stock_qty]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_notify_stock_qty]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_notify_stock_qty" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_notify_stock_qty_checkbox" data-role="toggle-editability-all"/> <label for="inventory_notify_stock_qty_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_enable_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Enable Qty Increments') ?></span> + <span><?= $block->escapeHtml(__('Enable Qty Increments')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_enable_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[enable_qty_increments]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[enable_qty_increments]" + class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option - value="0"<?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0" + <?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0) :?> + selected="selected" + <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_use_config_enable_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_enable_qty_increments" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_enable_qty_increments_checkbox" data-role="toggle-editability-all"/> <label for="inventory_enable_qty_increments_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Qty Increments') ?></span> + <span><?= $block->escapeHtml(__('Qty Increments')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <input type="text" class="input-text validate-number" id="inventory_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[qty_increments]" - value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('qty_increments') * 1 ?>" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty_increments]" + value="<?= $block->getDefaultConfigValue('qty_increments') * 1 ?>" disabled="disabled"/> </div> <div class="field choice"> - <input type="checkbox" id="inventory_use_config_qty_increments" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[use_config_qty_increments]" value="1" data-role="toggle-editability" checked="checked" disabled="disabled"/> + <input type="checkbox" + id="inventory_use_config_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_qty_increments]" + value="1" + data-role="toggle-editability" + checked="checked" + disabled="disabled"/> <label for="inventory_use_config_qty_increments" - class="label"><span><?= /* @escapeNotVerified */ __('Use Config Settings') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label> </div> <div class="field choice"> <input type="checkbox" id="inventory_qty_increments_checkbox" data-role="toggle-editability-all"/> <label for="inventory_qty_increments_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> <div class="field"> <label class="label" for="inventory_stock_availability"> - <span><?= /* @escapeNotVerified */ __('Stock Availability') ?></span> + <span><?= $block->escapeHtml(__('Stock Availability')) ?></span> </label> <div class="control"> <div class="fields-group-2"> <div class="field"> <select id="inventory_stock_availability" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[is_in_stock]" class="select" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_in_stock]" class="select" disabled="disabled"> - <option value="1"><?= /* @escapeNotVerified */ __('In Stock') ?></option> - <option - value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0): ?> selected<?php endif; ?>><?= /* @escapeNotVerified */ __('Out of Stock') ?></option> + <option value="1"><?= $block->escapeHtml(__('In Stock')) ?></option> + <option value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0) :?> selected<?php endif; ?>><?= $block->escapeHtml(__('Out of Stock')) ?></option> </select> </div> <div class="field choice"> <input type="checkbox" id="inventory_stock_availability_checkbox" data-role="toggle-editability-all"/> <label for="inventory_stock_availability_checkbox" - class="label"><span><?= /* @escapeNotVerified */ __('Change') ?></span></label> + class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label> </div> </div> </div> - <div class="field-service" value-scope="<?= /* @escapeNotVerified */ __('[GLOBAL]') ?>"></div> + <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div> </div> </fieldset> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml index cd297a7bbf27b..98b06050e0d1d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml @@ -4,29 +4,35 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Websites */ ?> <div class="fieldset-wrapper" id="add-products-to-website-wrapper"> <fieldset class="fieldset" id="grop_fields"> <legend class="legend"> - <span><?= /* @escapeNotVerified */ __('Add Product To Websites') ?></span> + <span><?= $block->escapeHtml(__('Add Product To Websites')) ?></span> </legend> <br> <div class="store-scope"> <div class="store-tree" id="add-products-to-website-content"> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) :?> <div class="website-name"> - <input name="add_website_ids[]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->getWebsitesReadonly()): ?>disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox" /> - <label for="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="add_website_ids[]" + value="<?= $block->escapeHtmlAttr($_website->getId()) ?>" + <?php if ($block->getWebsitesReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>" + type="checkbox" /> + <label for="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="add_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" id="add_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd class="group-stores"> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> </li> @@ -44,27 +50,35 @@ <div class="fieldset-wrapper" id="remove-products-to-website-wrapper"> <fieldset class="fieldset" id="grop_fields"> <legend class="legend"> - <span><?= /* @escapeNotVerified */ __('Remove Product From Websites') ?></span> + <span><?= $block->escapeHtml(__('Remove Product From Websites')) ?></span> </legend> <br> <div class="messages"> <div class="message message-notice"> - <div><?= /* @escapeNotVerified */ __('To hide an item in catalog or search results, set the status to "Disabled".') ?></div> + <div><?= $block->escapeHtml(__('To hide an item in catalog or search results, set the status to "Disabled".')) ?></div> </div> </div> <div class="store-scope"> <div class="store-tree" id="remove-products-to-website-content"> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php foreach ($block->getWebsiteCollection() as $_website) :?> <div class="website-name"> - <input name="remove_website_ids[]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->getWebsitesReadonly()): ?>disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox" /> - <label for="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="remove_website_ids[]" + value="<?= $block->escapeHtmlAttr($_website->getId()) ?>" + <?php if ($block->getWebsitesReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>" + type="checkbox" /> + <label for="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="remove_product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" + id="remove_product_website_<?= $block->escapeHtmlAttr($_website->getId()) ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd class="group-stores"> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml index a7e8564e7a1d8..d073053e2f854 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis - /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\AttributeSet */ +/* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\AttributeSet */ ?> <script id="product-template-selector-template" type="text/x-magento-template"> <% if (!data.term && data.items.length && !data.allShown()) { %> @@ -32,7 +32,7 @@ } }); $suggest - .mage('suggest',<?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSelectorOptions()) ?>) + .mage('suggest',<?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSelectorOptions()) ?>) .on('suggestselect', function (e, ui) { if (ui.item.id) { $('[data-form=edit-product]').trigger('changeAttributeSet', ui.item); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml index 84c3257840259..f12a99e6c7843 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/category/new/form.phtml @@ -5,7 +5,7 @@ */ /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\NewCategory */ ?> -<div id="<?= /* @escapeNotVerified */ $block->getNameInLayout() ?>" style="display:none"> +<div id="<?= $block->escapeHtmlAttr($block->getNameInLayout()) ?>" style="display:none"> <?= $block->getFormHtml() ?> <?= $block->getAfterElementHtml() ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml index 2570a5d712675..ad38d250a3345 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml @@ -3,16 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options */ ?> <div class="fieldset-wrapper" id="product-custom-options-wrapper" data-block="product-custom-options"> <div class="fieldset-wrapper-title"> <strong class="title"> - <span><?= /* @escapeNotVerified */ __('Custom Options') ?></span> + <span><?= $block->escapeHtml(__('Custom Options')) ?></span> </strong> </div> <div class="fieldset-wrapper-content" id="product-custom-options-content" data-role="product-custom-options-content"> @@ -20,7 +17,7 @@ <div class="messages"> <div class="message message-error" id="dynamic-price-warning" style="display: none;"> <div class="message-inner"> - <div class="message-content"><?= /* @escapeNotVerified */ __('We can\'t save custom-defined options for bundles with dynamic pricing.') ?></div> + <div class="message-content"><?= $block->escapeHtml(__('We can\'t save custom-defined options for bundles with dynamic pricing.')) ?></div> </div> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml index d2bca5ce17321..713366e73aba5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Option */ ?> <?= $block->getTemplatesHtml() ?> @@ -19,30 +18,52 @@ <span id="option_<%- data.id %>_header_title"><%- data.title %></span> </strong> <div class="actions"> - <button type="button" title="<?= /* @escapeNotVerified */ __('Delete Custom Option') ?>" class="action-delete" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_delete"> - <span><?= /* @escapeNotVerified */ __('Delete Custom Option') ?></span> + <button type="button" + title="<?= $block->escapeHtmlAttr(__('Delete Custom Option')) ?>" + class="action-delete" + id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_delete"> + <span><?= $block->escapeHtml(__('Delete Custom Option')) ?></span> </button> </div> - <div id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_move" data-role="draggable-handle" class="draggable-handle" - title="<?= /* @escapeNotVerified */ __('Sort Custom Options') ?>"></div> + <div id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_move" + data-role="draggable-handle" + class="draggable-handle" + title="<?= $block->escapeHtmlAttr(__('Sort Custom Options')) ?>"></div> </div> <div class="fieldset-wrapper-content in collapse" id="<%- data.id %>-content"> <fieldset class="fieldset"> - <fieldset class="fieldset-alt" id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_is_delete" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][is_delete]" type="hidden" value=""/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_previous_type" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][previous_type]" type="hidden" value="<%- data.type %>"/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_previous_group" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][previous_group]" type="hidden" value=""/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_id" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][id]" type="hidden" value="<%- data.id %>"/> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_option_id" name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][option_id]" type="hidden" value="<%- data.option_id %>"/> - <input name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"/> + <fieldset class="fieldset-alt" id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>"> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_is_delete" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][is_delete]" + type="hidden" + value=""/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_previous_type" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][previous_type]" + type="hidden" + value="<%- data.type %>"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_previous_group" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][previous_group]" + type="hidden" + value=""/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_id" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][id]" + type="hidden" + value="<%- data.id %>"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_option_id" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][option_id]" + type="hidden" + value="<%- data.option_id %>"/> + <input name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][sort_order]" + type="hidden" + value="<%- data.sort_order %>"/> <div class="field field-option-title required"> - <label class="label" for="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title"> - <?= /* @escapeNotVerified */ __('Option Title') ?> + <label class="label" for="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title"> + <?= $block->escapeHtml(__('Option Title')) ?> </label> <div class="control"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title" - name="<?= /* @escapeNotVerified */ $block->getFieldName() ?>[<%- data.id %>][title]" + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title" + name="<?= /* @noEscape */ $block->getFieldName() ?>[<%- data.id %>][title]" class="required-entry input-text" type="text" value="<%- data.title %>" @@ -54,8 +75,8 @@ </div> <div class="field field-option-input-type required"> - <label class="label" for="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_title"> - <?= /* @escapeNotVerified */ __('Input Type') ?> + <label class="label" for="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_title"> + <?= $block->escapeHtml(__('Input Type')) ?> </label> <div class="control opt-type"> <?= $block->getTypeSelectHtml() ?> @@ -64,9 +85,12 @@ <div class="field field-option-req"> <div class="control"> - <input id="<?= /* @escapeNotVerified */ $block->getFieldId() ?>_<%- data.id %>_required" class="is-required" type="checkbox" checked="checked"/> + <input id="<?= /* @noEscape */ $block->getFieldId() ?>_<%- data.id %>_required" + class="is-required" + type="checkbox" + checked="checked"/> <label for="field-option-req"> - <?= /* @escapeNotVerified */ __('Required') ?> + <?= $block->escapeHtml(__('Required')) ?> </label> <span style="display:none"><?= $block->getRequireSelectHtml() ?></span> </div> @@ -78,7 +102,7 @@ </script> <div id="import-container" style="display: none;"></div> -<?php if (!$block->isReadonly()): ?> +<?php if (!$block->isReadonly()) :?> <div><input type="hidden" name="affect_product_custom_options" value="1"/></div> <?php endif; ?> <script> @@ -89,21 +113,21 @@ require([ jQuery(function ($) { var fieldSet = $('[data-block=product-custom-options]'); - fieldSet.customOptions(<?php /* @escapeNotVerified */ echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + fieldSet.customOptions(<?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( [ 'fieldId' => $block->getFieldId(), - 'productGridUrl' => $block->getProductGridUrl(), + 'productGridUrl' => $block->escapeUrl($block->getProductGridUrl()), 'formKey' => $block->getFormKey(), - 'customOptionsUrl' => $block->getCustomOptionsUrl(), - 'isReadonly' => $block->isReadonly(), - 'itemCount' => $block->getItemCount(), - 'currentProductId' => $block->getCurrentProductId(), + 'customOptionsUrl' => $block->escapeUrl($block->getCustomOptionsUrl()), + 'isReadonly' => (bool) $block->isReadonly(), + 'itemCount' => (int) $block->getItemCount(), + 'currentProductId' => (int) $block->getCurrentProductId(), ] )?>); //adding data to templates <?php /** @var $_value \Magento\Framework\DataObject */ ?> - <?php foreach ($block->getOptionValues() as $_value): ?> - fieldSet.customOptions('addOption', <?= /* @escapeNotVerified */ $_value->toJson() ?>); + <?php foreach ($block->getOptionValues() as $_value) :?> + fieldSet.customOptions('addOption', <?= /* @noEscape */ $_value->toJson() ?>); <?php endforeach; ?> }); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml index 07ce6e5d86256..2063609bf0568 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Date */ ?> <script id="custom-option-date-type-template" type="text/x-magento-template"> @@ -14,10 +12,10 @@ <thead> <tr class="headings"> <?php if ($block->getCanReadPrice() !== false) : ?> - <th><?= /* @escapeNotVerified */ __('Price') ?></th> - <th><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th><?= $block->escapeHtml(__('Price')) ?></th> + <th><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th><?= /* @escapeNotVerified */ __('SKU') ?></th> + <th><?= $block->escapeHtml(__('SKU')) ?></th> </tr> </thead> <tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml index 693c98fc02cab..c0e61c5de9988 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\File */ ?> <script id="custom-option-file-type-template" type="text/x-magento-template"> @@ -14,27 +12,27 @@ <thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <th><?= /* @escapeNotVerified */ __('Price') ?></th> - <th><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th><?= $block->escapeHtml(__('Price')) ?></th> + <th><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th><?= /* @escapeNotVerified */ __('SKU') ?></th> - <th><?= /* @escapeNotVerified */ __('Compatible File Extensions') ?></th> - <th><?= /* @escapeNotVerified */ __('Maximum Image Size') ?></th> + <th><?= $block->escapeHtml(__('SKU')) ?></th> + <th><?= $block->escapeHtml(__('Compatible File Extensions')) ?></th> + <th><?= $block->escapeHtml(__('Maximum Image Size')) ?></th> </tr> </thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <td class="opt-price"> - <input name="product[options][<%- data.option_id %>][price]" data-store-label="<%- data.price %>" - class="input-text validate-zero-or-greater" type="text" value="<%- data.price %>" - <?php if ($block->getCanEditPrice() === false) : ?> - disabled="disabled" - <?php endif; ?>> - </td> - <td class="opt-price-type"><?= $block->getPriceTypeSelectHtml('data-attr="price-type"') ?><%- data.checkboxScopePrice %></td> + <td class="opt-price"> + <input name="product[options][<%- data.option_id %>][price]" data-store-label="<%- data.price %>" + class="input-text validate-zero-or-greater" type="text" value="<%- data.price %>" + <?php if ($block->getCanEditPrice() === false) : ?> + disabled="disabled" + <?php endif; ?>> + </td> + <td class="opt-price-type"><?= $block->getPriceTypeSelectHtml('data-attr="price-type"') ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input name="product[options][<%- data.option_id %>][price]" type="hidden"> - <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> + <input name="product[options][<%- data.option_id %>][price]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> <?php endif; ?> <td> <input name="product[options][<%- data.option_id %>][sku]" class="input-text" type="text" value="<%- data.sku %>"> @@ -42,10 +40,15 @@ <td> <input name="product[options][<%- data.option_id %>][file_extension]" class="input-text" type="text" value="<%- data.file_extension %>"> </td> - <td class="col-file"><?php /* @escapeNotVerified */ echo __('%1 <span>x</span> %2 <span>px.</span>', - '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_x]" value="<%- data.image_size_x %>">', - '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_y]" value="<%- data.image_size_y %>">') ?> - <div class="note"><?= /* @escapeNotVerified */ __('Please leave blank if it is not an image.') ?></div> + <td class="col-file"><?= $block->escapeHtml( + __( + '%1 <span>x</span> %2 <span>px.</span>', + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_x]" value="<%- data.image_size_x %>">', + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_y]" value="<%- data.image_size_y %>">' + ), + ['span', 'input'] + ) ?> + <div class="note"><?= $block->escapeHtml(__('Please leave blank if it is not an image.')) ?></div> </td> </tr> </table> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml index e8c398228a469..c7ff03a08d954 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select */ ?> <script id="custom-option-select-type-template" type="text/x-magento-template"> @@ -14,12 +12,12 @@ <thead> <tr> <th class="col-draggable"> </th> - <th class="col-name required"><?= /* @escapeNotVerified */ __('Title') ?><span class="required">*</span></th> + <th class="col-name required"><?= $block->escapeHtml(__('Title')) ?><span class="required">*</span></th> <?php if ($block->getCanReadPrice() !== false) : ?> - <th class="col-price"><?= /* @escapeNotVerified */ __('Price') ?></th> - <th class="col-price-type"><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th class="col-price"><?= $block->escapeHtml(__('Price')) ?></th> + <th class="col-price-type"><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th class="col-sku"><?= /* @escapeNotVerified */ __('SKU') ?></th> + <th class="col-sku"><?= $block->escapeHtml(__('SKU')) ?></th> <th class="col-actions"> </th> </tr> </thead> @@ -38,7 +36,7 @@ <tr id="product_option_<%- data.id %>_select_<%- data.select_id %>"> <td class="col-draggable"> <div data-role="draggable-handle" class="draggable-handle" - title="<?= /* @escapeNotVerified */ __('Sort Custom Option') ?>"></div> + title="<?= $block->escapeHtmlAttr(__('Sort Custom Option')) ?>"></div> <input name="product[options][<%- data.id %>][values][<%- data.select_id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"> </td> <td class="col-name select-opt-title"> @@ -58,7 +56,7 @@ <?php endif; ?>> </td> <td class="col-price-type select-opt-price-type"> - <?= /* @escapeNotVerified */ $block->getPriceTypeSelectHtml('data-attr="price-type" <% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%- data.checkboxScopePrice %> + <?= /* @noEscape */ $block->getPriceTypeSelectHtml('data-attr="price-type" <% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%- data.checkboxScopePrice %> </td> <?php else : ?> <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_price" name="product[options][<%- data.id %>][values][<%- data.select_id %>][price]" type="hidden"> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml index c9d7190589ff5..89da5d633ef4d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Text */ ?> <script id="custom-option-text-type-template" type="text/x-magento-template"> @@ -14,11 +12,11 @@ <thead> <tr> <?php if ($block->getCanReadPrice() !== false) : ?> - <th class="type-price"><?= /* @escapeNotVerified */ __('Price') ?></th> - <th class="type-type"><?= /* @escapeNotVerified */ __('Price Type') ?></th> + <th class="type-price"><?= $block->escapeHtml(__('Price')) ?></th> + <th class="type-type"><?= $block->escapeHtml(__('Price Type')) ?></th> <?php endif; ?> - <th class="type-sku"><?= /* @escapeNotVerified */ __('SKU') ?></th> - <th class="type-last last"><?= /* @escapeNotVerified */ __('Max Characters') ?></th> + <th class="type-sku"><?= $block->escapeHtml(__('SKU')) ?></th> + <th class="type-last last"><?= $block->escapeHtml(__('Max Characters')) ?></th> </tr> </thead> <tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml index 57715744823d6..e66a18c677cc3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Tier */ $element = $block->getElement(); @@ -20,28 +20,28 @@ $element = $block->getElement(); <?php $_showWebsite = $block->isShowWebsiteColumn(); ?> <?php $_showWebsite = $block->isMultiWebsites(); ?> -<div class="field" id="attribute-<?= /* @escapeNotVerified */ $_htmlId ?>-container" data-attribute-code="<?= /* @escapeNotVerified */ $_htmlId ?>" +<div class="field" id="attribute-<?= /* @noEscape */ $_htmlId ?>-container" data-attribute-code="<?= /* @noEscape */ $_htmlId ?>" data-apply-to="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode( + $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode( $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : [] ) )?>"> - <label class="label"><span><?= /* @escapeNotVerified */ $block->getElement()->getLabel() ?></span></label> + <label class="label"><span><?= $block->escapeHtml($block->getElement()->getLabel()) ?></span></label> <div class="control"> <table class="admin__control-table tiers_table" id="tiers_table"> <thead> <tr> - <th class="col-websites" <?php if (!$_showWebsite): ?>style="display:none"<?php endif; ?>><?= /* @escapeNotVerified */ __('Web Site') ?></th> - <th class="col-customer-group"><?= /* @escapeNotVerified */ __('Customer Group') ?></th> - <th class="col-qty required"><?= /* @escapeNotVerified */ __('Quantity') ?></th> - <th class="col-price required"><?= /* @escapeNotVerified */ $block->getPriceColumnHeader(__('Item Price')) ?></th> - <th class="col-delete"><?= /* @escapeNotVerified */ __('Action') ?></th> + <th class="col-websites" <?php if (!$_showWebsite) :?>style="display:none"<?php endif; ?>><?= $block->escapeHtml(__('Web Site')) ?></th> + <th class="col-customer-group"><?= $block->escapeHtml(__('Customer Group')) ?></th> + <th class="col-qty required"><?= $block->escapeHtml(__('Quantity')) ?></th> + <th class="col-price required"><?= $block->escapeHtml($block->getPriceColumnHeader(__('Item Price'))) ?></th> + <th class="col-delete"><?= $block->escapeHtml(__('Action')) ?></th> </tr> </thead> - <tbody id="<?= /* @escapeNotVerified */ $_htmlId ?>_container"></tbody> + <tbody id="<?= /* @noEscape */ $_htmlId ?>_container"></tbody> <tfoot> <tr> - <td colspan="<?php if (!$_showWebsite): ?>4<?php else: ?>5<?php endif; ?>" class="col-actions-add"><?= $block->getAddButtonHtml() ?></td> + <td colspan="<?php if (!$_showWebsite) :?>4<?php else :?>5<?php endif; ?>" class="col-actions-add"><?= $block->getAddButtonHtml() ?></td> </tr> </tfoot> </table> @@ -55,39 +55,39 @@ require([ //<![CDATA[ var tierPriceRowTemplate = '<tr>' - + '<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' - + '<select class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' - <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> - + '<option value="<?= /* @escapeNotVerified */ $_websiteId ?>"><?= $block->escapeJs($_info['name']) ?><?php if (!empty($_info['currency'])): ?> [<?= $block->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' + + '<td class="col-websites"<?php if (!$_showWebsite) :?> style="display:none"<?php endif; ?>>' + + '<select class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' + <?php foreach ($block->getWebsites() as $_websiteId => $_info) :?> + + '<option value="<?= $block->escapeHtmlAttr($_websiteId) ?>"><?= $block->escapeHtml($_info['name']) ?><?php if (!empty($_info['currency'])) :?> [<?= $block->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' <?php endforeach ?> + '</select></td>' - + '<td class="col-customer-group"><select class="<?= /* @escapeNotVerified */ $_htmlClass ?> custgroup required-entry" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' - <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName): ?> - + '<option value="<?= /* @escapeNotVerified */ $_groupId ?>"><?= $block->escapeJs($_groupName) ?></option>' + + '<td class="col-customer-group"><select class="<?= $block->escapeHtmlAttr($_htmlClass) ?> custgroup required-entry" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' + <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName) :?> + + '<option value="<?= $block->escapeHtmlAttr($_groupId) ?>"><?= $block->escapeHtml($_groupName) ?></option>' <?php endforeach ?> + '</select></td>' + '<td class="col-qty">' - + '<input class="<?= /* @escapeNotVerified */ $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' - + '<span><?= /* @escapeNotVerified */ __("and above") ?></span>' + + '<input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> qty required-entry validate-greater-than-zero" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' + + '<span><?= $block->escapeHtml(__("and above")) ?></span>' + '</td>' - + '<td class="col-price"><input class="<?= /* @escapeNotVerified */ $_htmlClass ?> required-entry <?= /* @escapeNotVerified */ $_priceValueValidation ?>" type="text" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' - + '<td class="col-delete"><input type="hidden" name="<?= /* @escapeNotVerified */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' - + '<button title="<?= /* @escapeNotVerified */ $block->escapeHtml(__('Delete Tier')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' - + '<span><?= /* @escapeNotVerified */ __("Delete") ?></span></button></td>' + + '<td class="col-price"><input class="<?= $block->escapeHtmlAttr($_htmlClass) ?> required-entry <?= $block->escapeHtmlAttr($_priceValueValidation) ?>" type="text" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' + + '<td class="col-delete"><input type="hidden" name="<?= /* @noEscape */ $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' + + '<button title="<?= $block->escapeHtml(__('Delete Tier')) ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' + + '<span><?= $block->escapeHtml(__("Delete")) ?></span></button></td>' + '</tr>'; var tierPriceControl = { template: mageTemplate(tierPriceRowTemplate), itemsCount: 0, addItem : function () { - <?php if ($_readonly): ?> + <?php if ($_readonly) :?> if (arguments.length < 4) { return; } <?php endif; ?> var data = { - website_id: '<?= /* @escapeNotVerified */ $block->getDefaultWebsite() ?>', - group: '<?= /* @escapeNotVerified */ $block->getDefaultCustomerGroup() ?>', + website_id: '<?= (int) $block->getDefaultWebsite() ?>', + group: '<?= (int) $block->getDefaultCustomerGroup() ?>', qty: '', price: '', readOnly: false, @@ -104,7 +104,7 @@ var tierPriceControl = { data.readOnly = arguments[4]; } - Element.insert($('<?= /* @escapeNotVerified */ $_htmlId ?>_container'), { + Element.insert($('<?= $block->escapeJs($_htmlId) ?>_container'), { bottom : this.template({ data: data }) @@ -113,7 +113,7 @@ var tierPriceControl = { $('tier_price_row_' + data.index + '_cust_group').value = data.group; $('tier_price_row_' + data.index + '_website').value = data.website_id; - <?php if ($block->isShowWebsiteColumn() && !$block->isAllowChangeWebsite()):?> + <?php if ($block->isShowWebsiteColumn() && !$block->isAllowChangeWebsite()) :?> var wss = $('tier_price_row_' + data.index + '_website'); var txt = wss.options[wss.selectedIndex].text; @@ -128,11 +128,11 @@ var tierPriceControl = { $('tier_price_row_'+data.index+'_delete_button').hide(); } - <?php if ($_readonly): ?> - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').select('input', 'select').each(this.disableElement); - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').up('table').select('button').each(this.disableElement); - <?php else: ?> - $('<?= /* @escapeNotVerified */ $_htmlId ?>_container').select('input', 'select').each(function(el){ Event.observe(el, 'change', el.setHasChanges.bind(el)); }); + <?php if ($_readonly) :?> + $('<?= $block->escapeJs($_htmlId) ?>_container').select('input', 'select').each(this.disableElement); + $('<?= $block->escapeJs($_htmlId) ?>_container').up('table').select('button').each(this.disableElement); + <?php else :?> + $('<?= $block->escapeJs($_htmlId) ?>_container').select('input', 'select').each(function(el){ Event.observe(el, 'change', el.setHasChanges.bind(el)); }); <?php endif; ?> }, disableElement: function(el) { @@ -150,11 +150,11 @@ var tierPriceControl = { return false; } }; -<?php foreach ($block->getValues() as $_item): ?> -tierPriceControl.addItem('<?= /* @escapeNotVerified */ $_item['website_id'] ?>', '<?= /* @escapeNotVerified */ $_item['cust_group'] ?>', '<?= /* @escapeNotVerified */ $_item['price_qty']*1 ?>', '<?= /* @escapeNotVerified */ $_item['price'] ?>', <?= (int)!empty($_item['readonly']) ?>); +<?php foreach ($block->getValues() as $_item) :?> +tierPriceControl.addItem('<?= $block->escapeJs($_item['website_id']) ?>', '<?= $block->escapeJs($_item['cust_group']) ?>', '<?= $_item['price_qty']*1 ?>', '<?= $block->escapeJs($_item['price']) ?>', <?= (int)!empty($_item['readonly']) ?>); <?php endforeach; ?> -<?php if ($_readonly): ?> -$('<?= /* @escapeNotVerified */ $_htmlId ?>_container').up('table').select('button') +<?php if ($_readonly) :?> +$('<?= $block->escapeJs($_htmlId) ?>_container').up('table').select('button') .each(tierPriceControl.disableElement); <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml index 44fdb75cdac21..0c1da98c7d85a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/serializer.phtml @@ -4,9 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer */ ?> +// phpcs:disable Magento2.Security.InsecureFunction.DiscouragedWithAlternative <?php $_id = 'id_' . md5(microtime()) ?> -<input type="hidden" name="<?= /* @escapeNotVerified */ $block->getInputElementName() ?>" value="" id="<?= /* @escapeNotVerified */ $_id ?>" /> +<input type="hidden" + name="<?= $block->escapeHtmlAttr($block->getInputElementName()) ?>" + value="" + id="<?= /* @noEscape */ $_id ?>" /> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml index 8f7f20f32d982..0193d7764cbb5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml @@ -4,16 +4,15 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Websites */ ?> <fieldset id="grop_fields" class="fieldset"> - <legend class="legend"><span><?= /* @escapeNotVerified */ __('Product In Websites') ?></span></legend> + <legend class="legend"><span><?= $block->escapeHtml(__('Product In Websites')) ?></span></legend> <br> - <?php if ($block->getProductId()): ?> + <?php if ($block->getProductId()) :?> <div class="messages"> <div class="message message-notice"> - <?= /* @escapeNotVerified */ __('To hide an item in catalog or search results, set the status to "Disabled".') ?> + <?= $block->escapeHtml(__('To hide an item in catalog or search results, set the status to "Disabled".')) ?> </div> </div> <?php endif; ?> @@ -21,22 +20,36 @@ <?= $block->getHintHtml() ?> <div class="store-tree"> <?php $_websites = $block->getWebsiteCollection() ?> - <?php foreach ($_websites as $_website): ?> + <?php foreach ($_websites as $_website) :?> <div class="website-name"> - <input name="product[website_ids][]" value="<?= /* @escapeNotVerified */ $_website->getId() ?>" <?php if ($block->isReadonly()): ?> disabled="disabled"<?php endif;?> class="checkbox website-checkbox" id="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>" type="checkbox"<?php if ($block->hasWebsite($_website->getId()) || !$block->getProductId() && count($_websites) === 1): ?> checked="checked"<?php endif; ?> /> - <label for="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> + <input name="product[website_ids][]" + value="<?= (int) $_website->getId() ?>" + <?php if ($block->isReadonly()) :?> + disabled="disabled" + <?php endif;?> + class="checkbox website-checkbox" + id="product_website_<?= (int) $_website->getId() ?>" + type="checkbox" + <?php if ($block->hasWebsite($_website->getId()) || !$block->getProductId() && count($_websites) === 1) :?> + checked="checked" + <?php endif; ?> + /> + <label for="product_website_<?= (int) $_website->getId() ?>"><?= $block->escapeHtml($_website->getName()) ?></label> </div> - <dl class="webiste-groups" id="product_website_<?= /* @escapeNotVerified */ $_website->getId() ?>_data"> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <dl class="webiste-groups" id="product_website_<?= (int) $_website->getId() ?>_data"> + <?php foreach ($block->getGroupCollection($_website) as $_group) :?> <dt><?= $block->escapeHtml($_group->getName()) ?></dt> <dd> <ul> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php foreach ($block->getStoreCollection($_group) as $_store) :?> <li> <?= $block->escapeHtml($_store->getName()) ?> - <?php if ($block->getWebsites() && !$block->hasWebsite($_website->getId())): ?> - <span class="website-<?= /* @escapeNotVerified */ $_website->getId() ?>-select" style="display:none"> - <?= __('(Copy data from: %1)', $block->getChooseFromStoreHtml($_store)) ?> + <?php if ($block->getWebsites() && !$block->hasWebsite($_website->getId())) :?> + <span class="website-<?= (int) $_website->getId() ?>-select" style="display:none"> + <?= $block->escapeHtml( + __('(Copy data from: %1)', $block->getChooseFromStoreHtml($_store)), + ['select', 'option', 'optgroup'] + ) ?> </span> <?php endif; ?> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml index 574c9ee81af7d..befdce30fc8f0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content */ $elementName = $block->getElement()->getName() . '[images]'; @@ -16,61 +16,60 @@ $formName = $block->getFormName(); data-parent-component="<?= $block->escapeHtml($block->getData('config/parentComponent')) ?>" data-images="<?= $block->escapeHtml($block->getImagesJson()) ?>" data-types="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getImageTypes()) + $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getImageTypes()) ) ?>" - > +> <?php if (!$block->getElement()->getReadonly()) {?> <div class="image image-placeholder"> <?= $block->getUploaderHtml() ?> <div class="product-image-wrapper"> <p class="image-placeholder-text"> - <?= /* @escapeNotVerified */ __('Browse to find or drag image here') ?> + <?= $block->escapeHtml(__('Browse to find or drag image here')) ?> </p> </div> </div> <?php } ?> <?php foreach ($block->getImageTypes() as $typeData) { - ?> - <input name="<?= $block->escapeHtml($typeData['name']) ?>" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - class="image-<?= $block->escapeHtml($typeData['code']) ?>" + ?> + <input name="<?= $block->escapeHtmlAttr($typeData['name']) ?>" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + class="image-<?= $block->escapeHtmlAttr($typeData['code']) ?>" type="hidden" - value="<?= $block->escapeHtml($typeData['value']) ?>"/> - <?php - + value="<?= $block->escapeHtmlAttr($typeData['value']) ?>"/> + <?php } ?> <script id="<?= $block->getHtmlId() ?>-template" type="text/x-magento-template"> <div class="image item<% if (data.disabled == 1) { %> hidden-for-front<% } %>" data-role="image"> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][position]" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][position]" value="<%- data.position %>" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" class="position"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][file]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][file]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.file %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][value_id]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][value_id]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.value_id %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][label]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][label]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="<%- data.label %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][disabled]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][disabled]" + data-form-part="<?= $block->escapeHtmlAttr(formName) ?>" value="<%- data.disabled %>"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][media_type]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][media_type]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="image"/> <input type="hidden" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][removed]" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][removed]" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" value="" class="is-removed"/> @@ -84,21 +83,21 @@ $formName = $block->getFormName(); <button type="button" class="action-remove" data-role="delete-button" - title="<?= /* @escapeNotVerified */ __('Delete image') ?>"> + title="<?= $block->escapeHtmlAttr(__('Delete image')) ?>"> <span> - <?= /* @escapeNotVerified */ __('Delete image') ?> + <?= $block->escapeHtml(__('Delete image')) ?> </span> </button> <div class="draggable-handle"></div> </div> - <div class="image-fade"><span><?= /* @escapeNotVerified */ __('Hidden') ?></span></div> + <div class="image-fade"><span><?= $block->escapeHtml(__('Hidden')) ?></span></div> </div> <div class="item-description"> <div class="item-title" data-role="img-title"><%- data.label %></div> <div class="item-size"> - <span data-role="image-dimens"></span>, <span data-role="image-size"><%- data.sizeLabel %></span> + <span data-role="image-dimens"></span>, <span data-role="image-size"><%- data.sizeLabel %></span> </div> </div> @@ -106,12 +105,9 @@ $formName = $block->getFormName(); <?php foreach ($block->getImageTypes() as $typeData) { ?> - <li data-role-code="<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $typeData['code'] - ) ?>" class="item-role item-role-<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $typeData['code'] - ) ?>"> - <?= /* @escapeNotVerified */ $block->escapeHtml($typeData['label']) ?> + <li data-role-code="<?= $block->escapeHtmlAttr($typeData['code']) ?>" + class="item-role item-role-<?= $block->escapeHtmlAttr($typeData['code']) ?>"> + <?= $block->escapeHtml($typeData['label']) ?> </li> <?php } @@ -121,98 +117,94 @@ $formName = $block->getFormName(); </script> <script data-role="img-dialog-container-tmpl" type="text/x-magento-template"> - <div class="image-panel" data-role="dialog"> - </div> + <div class="image-panel" data-role="dialog"> + </div> </script> <script data-role="img-dialog-tmpl" type="text/x-magento-template"> - <div class="image-panel-preview"> - <img src="<%- data.url %>" alt="<%- data.label %>" /> - </div> - <div class="image-panel-controls"> - <strong class="image-name"><%- data.label %></strong> + <div class="image-panel-preview"> + <img src="<%- data.url %>" alt="<%- data.label %>" /> + </div> + <div class="image-panel-controls"> + <strong class="image-name"><%- data.label %></strong> - <fieldset class="admin__fieldset fieldset-image-panel"> - <div class="admin__field field-image-description"> - <label class="admin__field-label" for="image-description"> - <span><?= /* @escapeNotVerified */ __('Alt Text') ?></span> - </label> + <fieldset class="admin__fieldset fieldset-image-panel"> + <div class="admin__field field-image-description"> + <label class="admin__field-label" for="image-description"> + <span><?= $block->escapeHtml(__('Alt Text')) ?></span> + </label> - <div class="admin__field-control"> + <div class="admin__field-control"> <textarea data-role="image-description" rows="3" class="admin__control-textarea" - name="<?php /* @escapeNotVerified */ - echo $elementName - ?>[<%- data.file_id %>][label]"><%- data.label %></textarea> - </div> - </div> + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][label]"><%- data.label %></textarea> + </div> + </div> - <div class="admin__field field-image-role"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Role') ?></span> - </label> - <div class="admin__field-control"> - <ul class="multiselect-alt"> - <?php - foreach ($block->getMediaAttributes() as $attribute) : - ?> - <li class="item"> - <label> - <input class="image-type" - data-role="type-selector" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - type="checkbox" - value="<?php /* @escapeNotVerified */ echo $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" - /> - <?php /* @escapeNotVerified */ echo $block->escapeHtml( - $attribute->getFrontendLabel() - ) ?> - </label> - </li> + <div class="admin__field field-image-role"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Role')) ?></span> + </label> + <div class="admin__field-control"> + <ul class="multiselect-alt"> + <?php + foreach ($block->getMediaAttributes() as $attribute) : + ?> + <li class="item"> + <label> + <input class="image-type" + data-role="type-selector" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + type="checkbox" + value="<?= $block->escapeHtmlAttr($attribute->getAttributeCode()) ?>" + /> + <?= $block->escapeHtml( + $attribute->getFrontendLabel() + ) ?> + </label> + </li> <?php endforeach; - ?> - </ul> - </div> + ?> + </ul> </div> + </div> - <div class="admin__field admin__field-inline field-image-size" data-role="size"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Image Size') ?></span> - </label> - <div class="admin__field-value" data-message="<?= /* @escapeNotVerified */ __('{size}') ?>"></div> - </div> + <div class="admin__field admin__field-inline field-image-size" data-role="size"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Image Size')) ?></span> + </label> + <div class="admin__field-value" data-message="<?= $block->escapeHtmlAttr(_('{size}')) ?>"></div> + </div> - <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> - <label class="admin__field-label"> - <span><?= /* @escapeNotVerified */ __('Image Resolution') ?></span> - </label> - <div class="admin__field-value" data-message="<?= /* @escapeNotVerified */ __('{width}^{height} px') ?>"></div> - </div> + <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> + <label class="admin__field-label"> + <span><?= $block->escapeHtml(__('Image Resolution')) ?></span> + </label> + <div class="admin__field-value" data-message="<?= $block->escapeHtmlAttr(__('{width}^{height} px')) ?>"></div> + </div> - <div class="admin__field field-image-hide"> - <div class="admin__field-control"> - <div class="admin__field admin__field-option"> - <input type="checkbox" - id="hide-from-product-page" - data-role="visibility-trigger" - data-form-part="<?= /* @escapeNotVerified */ $formName ?>" - value="1" - class="admin__control-checkbox" - name="<?= /* @escapeNotVerified */ $elementName ?>[<%- data.file_id %>][disabled]" - <% if (data.disabled == 1) { %>checked="checked"<% } %> /> - - <label for="hide-from-product-page" class="admin__field-label"> - <?= /* @escapeNotVerified */ __('Hide from Product Page') ?> - </label> - </div> + <div class="admin__field field-image-hide"> + <div class="admin__field-control"> + <div class="admin__field admin__field-option"> + <input type="checkbox" + id="hide-from-product-page" + data-role="visibility-trigger" + data-form-part="<?= $block->escapeHtmlAttr($formName) ?>" + value="1" + class="admin__control-checkbox" + name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][disabled]" + <% if (data.disabled == 1) { %>checked="checked"<% } %> /> + + <label for="hide-from-product-page" class="admin__field-label"> + <?= $block->escapeHtml(__('Hide from Product Page')) ?> + </label> </div> </div> - </fieldset> - </div> + </div> + </fieldset> + </div> </script> <?= $block->getChildHtml('new-video') ?> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml index 4134392c0f52b..0a13aee5930ad 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var \Magento\Catalog\Block\Adminhtml\Product\Edit\Js $block */ ?> @@ -30,8 +30,8 @@ function registerTaxRecalcs() { Event.observe($('tax_class_id'), 'change', recalculateTax); } -var priceFormat = <?= /* @escapeNotVerified */ $this->helper('Magento\Tax\Helper\Data')->getPriceFormat($block->getStore()) ?>; -var taxRates = <?= /* @escapeNotVerified */ $block->getAllRatesByProductClassJson() ?>; +var priceFormat = <?= /* @noEscape */ $this->helper(Magento\Tax\Helper\Data::class)->getPriceFormat($block->getStore()) ?>; +var taxRates = <?= /* @noEscape */ $block->getAllRatesByProductClassJson() ?>; function recalculateTax() { if (typeof dynamicTaxes == 'undefined') { @@ -75,10 +75,10 @@ function bindActiveProductTab(event, ui) { jQuery(document).on('tabsactivate', bindActiveProductTab); // bind active tab -<?php if ($tabsBlock = $block->getLayout()->getBlock('product_tabs')): ?> +<?php if ($tabsBlock = $block->getLayout()->getBlock('product_tabs')) :?> jQuery(function () { - if (jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').length && jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').is(':mage-tabs')) { - var activeAnchor = jQuery('#<?= /* @escapeNotVerified */ $tabsBlock->getId() ?>').tabs('activeAnchor'); + if (jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').length && jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').is(':mage-tabs')) { + var activeAnchor = jQuery('#<?= $block->escapeJs($tabsBlock->getId()) ?>').tabs('activeAnchor'); if (activeAnchor && $('store_switcher')) { $('store_switcher').switchParams = 'active_tab/' + activeAnchor.prop('name') + '/'; } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml index 5b07121de49dc..7c3bee3d4d2fc 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/alert.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,7 +12,7 @@ ?> <div id="alert_messages_block"><?= $block->getMessageHtml() ?></div> <div> - <h4 class="icon-head head-edit-form"><?= /* @escapeNotVerified */ __('Product Alerts') ?></h4> + <h4 class="icon-head head-edit-form"><?= $block->escapeHtml(__('Product Alerts')) ?></h4> </div> <div class="clear"></div> <?= $block->getAccordionHtml() ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml index 2c62bbf8db3e9..5028d3c1e83d0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml @@ -4,382 +4,448 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory */ ?> -<?php if ($block->isReadonly()): ?> -<?php $_readonly = ' disabled="disabled" '; ?> -<?php else: ?> -<?php $_readonly = ''; ?> +<?php if ($block->isReadonly()) :?> + <?php $_readonly = ' disabled="disabled" '; ?> +<?php else :?> + <?php $_readonly = ''; ?> <?php endif; ?> <fieldset class="fieldset form-inline"> -<legend class="legend"><span><?= /* @escapeNotVerified */ __('Advanced Inventory') ?></span></legend> -<br> -<div id="table_cataloginventory"> -<div class="field"> - <label class="label" for="inventory_manage_stock"> - <span><?= /* @escapeNotVerified */ __('Manage Stock') ?></span> - </label> - <div class="control"> - <select id="inventory_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][manage_stock]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="1"><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> - </select> - <input type="hidden" id="inventory_manage_stock_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('manage_stock') ?>"> - <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_manage_stock"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <legend class="legend"><span><?= $block->escapeHtml(__('Advanced Inventory')) ?></span></legend> + <br> + <div id="table_cataloginventory"> + <div class="field"> + <label class="label" for="inventory_manage_stock"> + <span><?= $block->escapeHtml(__('Manage Stock')) ?></span> + </label> + <div class="control"> + <select id="inventory_manage_stock" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][manage_stock]" <?= /* @noEscape */ $_readonly ?>> + <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0"<?php if ($block->getFieldValue('manage_stock') == 0) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> + </select> + <input type="hidden" + id="inventory_manage_stock_default" + value="<?= $block->escapeHtmlAttr($block->getDefaultConfigValue('manage_stock')) ?>"> + <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_manage_stock" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_manage_stock"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<?php if (!$block->getProduct()->isComposite()): ?> -<div class="field"> - <label class="label" for="inventory_qty"> - <span><?= /* @escapeNotVerified */ __('Qty') ?></span> - </label> - <div class="control"> - <?php if (!$_readonly): ?> - <input type="hidden" id="original_inventory_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][original_inventory_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty') * 1 ?>"> - <?php endif;?> - <input type="text" class="input-text validate-number" id="inventory_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <?php if (!$block->getProduct()->isComposite()) :?> + <div class="field"> + <label class="label" for="inventory_qty"> + <span><?= $block->escapeHtml(__('Qty')) ?></span> + </label> + <div class="control"> + <?php if (!$_readonly) :?> + <input type="hidden" + id="original_inventory_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][original_inventory_qty]" + value="<?= $block->getFieldValue('qty') * 1 ?>"> + <?php endif;?> + <input type="text" + class="input-text validate-number" + id="inventory_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][qty]" + value="<?= $block->getFieldValue('qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_min_qty"> - <span><?= /* @escapeNotVerified */ __('Out-of-Stock Threshold') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> + <div class="field"> + <label class="label" for="inventory_min_qty"> + <span><?= $block->escapeHtml(__('Out-of-Stock Threshold')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_min_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][min_qty]" + value="<?= $block->getFieldValue('min_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_min_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_min_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_min_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_min_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(["prototype"], function(){ -toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <?php if (!$block->isReadonly()) :?> + <script> + require(["prototype"], function(){ + toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_min_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Minimum Qty Allowed in Shopping Cart') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" - name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_sale_qty]" - value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_min_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_min_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="field"> + <label class="label" for="inventory_min_sale_qty"> + <span><?= $block->escapeHtml(__('Minimum Qty Allowed in Shopping Cart')) ?></span> + </label> + <div class="control"> + <input type="text" class="input-text validate-number" id="inventory_min_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][min_sale_qty]" + value="<?= $block->getFieldValue('min_sale_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_min_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" + class="checkbox" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_min_sale_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_max_sale_qty"> - <span><?= /* @escapeNotVerified */ __('Maximum Qty Allowed in Shopping Cart') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][max_sale_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('max_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <div class="control-inner-wrap"> - <input type="checkbox" id="inventory_use_config_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_max_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="field"> + <label class="label" for="inventory_max_sale_qty"> + <span><?= $block->escapeHtml(__('Maximum Qty Allowed in Shopping Cart')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][max_sale_qty]" + value="<?= $block->getFieldValue('max_sale_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <div class="control-inner-wrap"> + <input type="checkbox" + id="inventory_use_config_max_sale_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" + class="checkbox" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_max_sale_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php if ($block->canUseQtyDecimals()): ?> - <div class="field"> - <label class="label" for="inventory_is_qty_decimal"> - <span><?= /* @escapeNotVerified */ __('Qty Uses Decimals') ?></span> - </label> - <div class="control"> - <select id="inventory_is_qty_decimal" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_qty_decimal]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option value="1"<?php if ($block->getFieldValue('is_qty_decimal') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - </select> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> - </div> + <?php if ($block->canUseQtyDecimals()) :?> + <div class="field"> + <label class="label" for="inventory_is_qty_decimal"> + <span><?= $block->escapeHtml(__('Qty Uses Decimals')) ?></span> + </label> + <div class="control"> + <select id="inventory_is_qty_decimal" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_qty_decimal]" <?= /* @noEscape */ $_readonly ?>> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1"<?php if ($block->getFieldValue('is_qty_decimal') == 1) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php if (!$block->isVirtual()) : ?> - <div class="field"> - <label class="label" for="inventory_is_decimal_divided"> - <span><?= /* @escapeNotVerified */ __('Allow Multiple Boxes for Shipping') ?></span> - </label> - <div class="control"> - <select id="inventory_is_decimal_divided" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_decimal_divided]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="0"><?= /* @escapeNotVerified */ __('No') ?></option> - <option value="1"<?php if ($block->getFieldValue('is_decimal_divided') == 1): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - </select> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> + <?php if (!$block->isVirtual()) :?> + <div class="field"> + <label class="label" for="inventory_is_decimal_divided"> + <span><?= $block->escapeHtml(__('Allow Multiple Boxes for Shipping')) ?></span> + </label> + <div class="control"> + <select id="inventory_is_decimal_divided" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_decimal_divided]" <?= /* @noEscape */ $_readonly ?>> + <option value="0"><?= $block->escapeHtml(__('No')) ?></option> + <option value="1"<?php if ($block->getFieldValue('is_decimal_divided') == 1) :?> + selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> + <?php endif; ?> <?php endif; ?> - </div> - <?php endif; ?> - <?php endif; ?> -<div class="field"> - <label class="label" for="inventory_backorders"> - <span><?= /* @escapeNotVerified */ __('Backorders') ?></span> - </label> - <div class="control"> - <select id="inventory_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][backorders]" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php foreach ($block->getBackordersOption() as $option): ?> - <?php $_selected = ($option['value'] == $block->getFieldValue('backorders')) ? 'selected="selected"' : '' ?> - <option value="<?= /* @escapeNotVerified */ $option['value'] ?>" <?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> - <?php endforeach; ?> - </select> + <div class="field"> + <label class="label" for="inventory_backorders"> + <span><?= $block->escapeHtml(__('Backorders')) ?></span> + </label> + <div class="control"> + <select id="inventory_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][backorders]" <?= /* @noEscape */ $_readonly ?>> + <?php foreach ($block->getBackordersOption() as $option) :?> + <?php $_selected = ($option['value'] == $block->getFieldValue('backorders')) ? 'selected="selected"' : '' ?> + <option value="<?= $block->escapeHtmlAttr($option['value']) ?>" <?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> + <?php endforeach; ?> + </select> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_backorders]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_backorders"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_backorders" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_backorders]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_backorders"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> -<div class="field"> - <label class="label" for="inventory_notify_stock_qty"> - <span><?= /* @escapeNotVerified */ __('Notify for Quantity Below') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][notify_stock_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('notify_stock_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> + <div class="field"> + <label class="label" for="inventory_notify_stock_qty"> + <span><?= $block->escapeHtml(__('Notify for Quantity Below')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-number" + id="inventory_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][notify_stock_qty]" + value="<?= $block->getFieldValue('notify_stock_qty') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_notify_stock_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> - </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_notify_stock_qty" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_notify_stock_qty"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> - <?php endif; ?> -<div class="field"> - <label class="label" for="inventory_enable_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Enable Qty Increments') ?></span> - </label> - <div class="control"> - <?php $qtyIncrementsEnabled = $block->getFieldValue('enable_qty_increments'); ?> - <select id="inventory_enable_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][enable_qty_increments]" <?= /* @escapeNotVerified */ $_readonly ?>> - <option value="1"<?php if ($qtyIncrementsEnabled): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('Yes') ?></option> - <option value="0"<?php if (!$qtyIncrementsEnabled): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> - </select> - <input type="hidden" id="inventory_enable_qty_increments_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('enable_qty_increments') ?>"> + <?php endif; ?> + <div class="field"> + <label class="label" for="inventory_enable_qty_increments"> + <span><?= $block->escapeHtml(__('Enable Qty Increments')) ?></span> + </label> + <div class="control"> + <?php $qtyIncrementsEnabled = $block->getFieldValue('enable_qty_increments'); ?> + <select id="inventory_enable_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][enable_qty_increments]" <?= /* @noEscape */ $_readonly ?>> + <option value="1"<?php if ($qtyIncrementsEnabled) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option> + <option value="0"<?php if (!$qtyIncrementsEnabled) :?> selected="selected"<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option> + </select> + <input type="hidden" + id="inventory_enable_qty_increments_default" + value="<?= $block->escapeHtmlAttr($block->getDefaultConfigValue('enable_qty_increments')) ?>"> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_enable_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_enable_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_enable_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_enable_qty_increments"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -<div class="field"> - <label class="label" for="inventory_qty_increments"> - <span><?= /* @escapeNotVerified */ __('Qty Increments') ?></span> - </label> - <div class="control"> - <input type="text" class="input-text validate-digits" id="inventory_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][qty_increments]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty_increments') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->isNew()) ? 'checked="checked"' : '' ?> - <input type="checkbox" id="inventory_use_config_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> - <label for="inventory_use_config_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> + <div class="field"> + <label class="label" for="inventory_qty_increments"> + <span><?= $block->escapeHtml(__('Qty Increments')) ?></span> + </label> + <div class="control"> + <input type="text" + class="input-text validate-digits" + id="inventory_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][qty_increments]" + value="<?= $block->getFieldValue('qty_increments') * 1 ?>" <?= /* @noEscape */ $_readonly ?>> + <div class="control-inner-wrap"> + <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->isNew()) ? 'checked="checked"' : '' ?> + <input type="checkbox" + id="inventory_use_config_qty_increments" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" + value="1" <?= /* @noEscape */ $_checked ?> + onclick="toggleValueElements(this, this.parentNode);" <?= /* @noEscape */ $_readonly ?>> + <label for="inventory_use_config_qty_increments"><?= $block->escapeHtml(__('Use Config Settings')) ?></label> + </div> + <?php if (!$block->isReadonly()) :?> + <script> + require(['prototype'], function(){ + toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode); + }); + </script> + <?php endif; ?> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> </div> - <?php if (!$block->isReadonly()): ?> - <script> -require(['prototype'], function(){ -toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode); -}); -</script> - <?php endif; ?> - </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -<div class="field"> - <label class="label" for="inventory_stock_availability"> - <span><?= /* @escapeNotVerified */ __('Stock Availability') ?></span> - </label> - <div class="control"> - <select id="inventory_stock_availability" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][is_in_stock]" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php foreach ($block->getStockOption() as $option): ?> - <?php $_selected = ($block->getFieldValue('is_in_stock') !== null && $option['value'] == $block->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?> - <option value="<?= /* @escapeNotVerified */ $option['value'] ?>" <?= /* @escapeNotVerified */ $_selected ?>><?= /* @escapeNotVerified */ $option['label'] ?></option> - <?php endforeach; ?> - </select> + <div class="field"> + <label class="label" for="inventory_stock_availability"> + <span><?= $block->escapeHtml(__('Stock Availability')) ?></span> + </label> + <div class="control"> + <select id="inventory_stock_availability" + name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[stock_data][is_in_stock]" <?= /* @noEscape */ $_readonly ?>> + <?php foreach ($block->getStockOption() as $option) :?> + <?php $_selected = ($block->getFieldValue('is_in_stock') !== null && $option['value'] == $block->getFieldValue('is_in_stock')) ? 'selected="selected"' : '' ?> + <option value="<?= $block->escapeHtmlAttr($option['value']) ?>" <?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option> + <?php endforeach; ?> + </select> + </div> + <?php if (!$block->isSingleStoreMode()) :?> + <div class="field-service"><?= $block->escapeHtml(__('[GLOBAL]')) ?></div> + <?php endif; ?> + </div> </div> - <?php if (!$block->isSingleStoreMode()): ?> - <div class="field-service"><?= /* @escapeNotVerified */ __('[GLOBAL]') ?></div> - <?php endif; ?> -</div> -</div> </fieldset> <script> -require(["jquery","prototype"], function(jQuery){ + require(["jquery","prototype"], function(jQuery){ - //<![CDATA[ - function changeManageStockOption() - { - var manageStock = $('inventory_use_config_manage_stock').checked + //<![CDATA[ + function changeManageStockOption() + { + var manageStock = $('inventory_use_config_manage_stock').checked ? $('inventory_manage_stock_default').value : $('inventory_manage_stock').value; - var catalogInventoryNotManageStockFields = { - inventory_min_sale_qty: true, - inventory_max_sale_qty: true, - inventory_enable_qty_increments : true, - inventory_qty_increments: true - }; - - $$('#table_cataloginventory > div').each(function(el) { - if (el == $('inventory_manage_stock').up(1)) { - return; - } + var catalogInventoryNotManageStockFields = { + inventory_min_sale_qty: true, + inventory_max_sale_qty: true, + inventory_enable_qty_increments : true, + inventory_qty_increments: true + }; - for (field in catalogInventoryNotManageStockFields) { - if ($(field) && ($(field).up(1) == el)) { + $$('#table_cataloginventory > div').each(function(el) { + if (el == $('inventory_manage_stock').up(1)) { return; } - } - el[manageStock == 1 ? 'show' : 'hide'](); - }); + for (field in catalogInventoryNotManageStockFields) { + if ($(field) && ($(field).up(1) == el)) { + return; + } + } - return true; - } + el[manageStock == 1 ? 'show' : 'hide'](); + }); - function applyEnableQtyIncrements() { - var enableQtyIncrements = $('inventory_use_config_enable_qty_increments').checked - ? $('inventory_enable_qty_increments_default').value - : $('inventory_enable_qty_increments').value; + return true; + } - $('inventory_qty_increments').up('.field')[enableQtyIncrements == 1 ? 'show' : 'hide'](); - } + function applyEnableQtyIncrements() { + var enableQtyIncrements = $('inventory_use_config_enable_qty_increments').checked + ? $('inventory_enable_qty_increments_default').value + : $('inventory_enable_qty_increments').value; - function applyEnableDecimalDivided() { - <?php if (!$block->isVirtual()) : ?> - $('inventory_is_decimal_divided').up('.field').hide(); - <?php endif; ?> - $('inventory_qty_increments').removeClassName('validate-digits').removeClassName('validate-number'); - $('inventory_min_sale_qty').removeClassName('validate-digits').removeClassName('validate-number'); - if ($('inventory_is_qty_decimal').value == 1) { - <?php if (!$block->isVirtual()) : ?> - $('inventory_is_decimal_divided').up('.field').show(); - <?php endif; ?> - $('inventory_qty_increments').addClassName('validate-number'); - $('inventory_min_sale_qty').addClassName('validate-number'); - } else { - $('inventory_qty_increments').addClassName('validate-digits'); - $('inventory_min_sale_qty').addClassName('validate-digits'); + $('inventory_qty_increments').up('.field')[enableQtyIncrements == 1 ? 'show' : 'hide'](); } - } - Event.observe(window, 'load', function() { - if ($('inventory_manage_stock') && $('inventory_use_config_manage_stock')) { - Event.observe($('inventory_manage_stock'), 'change', changeManageStockOption); - Event.observe($('inventory_use_config_manage_stock'), 'change', changeManageStockOption); - changeManageStockOption(); + function applyEnableDecimalDivided() { + <?php if (!$block->isVirtual()) :?> + $('inventory_is_decimal_divided').up('.field').hide(); + <?php endif; ?> + $('inventory_qty_increments').removeClassName('validate-digits').removeClassName('validate-number'); + $('inventory_min_sale_qty').removeClassName('validate-digits').removeClassName('validate-number'); + if ($('inventory_is_qty_decimal').value == 1) { + <?php if (!$block->isVirtual()) :?> + $('inventory_is_decimal_divided').up('.field').show(); + <?php endif; ?> + $('inventory_qty_increments').addClassName('validate-number'); + $('inventory_min_sale_qty').addClassName('validate-number'); + } else { + $('inventory_qty_increments').addClassName('validate-digits'); + $('inventory_min_sale_qty').addClassName('validate-digits'); + } } - if ($('inventory_enable_qty_increments') && $('inventory_use_config_enable_qty_increments')) { - //Delegation is used because of events, which are not firing while the input is disabled - jQuery('#inventory_enable_qty_increments').parent() + + Event.observe(window, 'load', function() { + if ($('inventory_manage_stock') && $('inventory_use_config_manage_stock')) { + Event.observe($('inventory_manage_stock'), 'change', changeManageStockOption); + Event.observe($('inventory_use_config_manage_stock'), 'change', changeManageStockOption); + changeManageStockOption(); + } + if ($('inventory_enable_qty_increments') && $('inventory_use_config_enable_qty_increments')) { + //Delegation is used because of events, which are not firing while the input is disabled + jQuery('#inventory_enable_qty_increments').parent() .on('change', '#inventory_enable_qty_increments', applyEnableQtyIncrements); - Event.observe($('inventory_use_config_enable_qty_increments'), 'change', applyEnableQtyIncrements); - applyEnableQtyIncrements(); - } - if ($('inventory_is_qty_decimal') && $('inventory_qty_increments') && $('inventory_min_sale_qty')) { - Event.observe($('inventory_is_qty_decimal'), 'change', applyEnableDecimalDivided); - applyEnableDecimalDivided(); - } - }); + Event.observe($('inventory_use_config_enable_qty_increments'), 'change', applyEnableQtyIncrements); + applyEnableQtyIncrements(); + } + if ($('inventory_is_qty_decimal') && $('inventory_qty_increments') && $('inventory_min_sale_qty')) { + Event.observe($('inventory_is_qty_decimal'), 'change', applyEnableDecimalDivided); + applyEnableDecimalDivided(); + } + }); - window.applyEnableDecimalDivided = applyEnableDecimalDivided; - window.applyEnableQtyIncrements = applyEnableQtyIncrements; - window.changeManageStockOption = changeManageStockOption; - //]]> + window.applyEnableDecimalDivided = applyEnableDecimalDivided; + window.applyEnableQtyIncrements = applyEnableQtyIncrements; + window.changeManageStockOption = changeManageStockOption; + //]]> -}); + }); </script> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml index 04ccfb5aee8d0..17fb517b32547 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml @@ -4,24 +4,24 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Search */ ?> <div id="product-attribute-search-container" class="suggest-expandable attribute-selector"> <div class="action-dropdown"> <button type="button" class="action-toggle action-choose" data-mage-init='{"dropdown":{}}' data-toggle="dropdown"> - <span><?= /* @escapeNotVerified */ __('Add Attribute') ?></span> + <span><?= $block->escapeHtml(__('Add Attribute')) ?></span> </button> <div class="dropdown-menu"> <input data-role="product-attribute-search" - data-group="<?= $block->escapeHtml($block->getGroupCode()) ?>" + data-group="<?= $block->escapeHtmlAttr($block->getGroupCode()) ?>" class="search" type="text" - placeholder="<?= /* @noEscape */ __('start typing to search attribute') ?>" /> + placeholder="<?= $block->escapeHtmlAttr(__('start typing to search attribute')) ?>" /> </div> </div> -<script data-template-for="product-attribute-search-<?= /* @escapeNotVerified */ $block->getGroupId() ?>" type="text/x-magento-template"> +<script data-template-for="product-attribute-search-<?= $block->escapeHtmlAttr($block->getGroupId()) ?>" type="text/x-magento-template"> <ul data-mage-init='{"menu":[]}'> <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> @@ -29,7 +29,7 @@ <% }); %> <% } else { %><span class="mage-suggest-no-records"><%- data.noRecordsText %></span><% } %> </ul> - <div class="actions"><?= /* @escapeNotVerified */ $block->getAttributeCreate() ?></div> + <div class="actions"><?= $block->escapeHtml($block->getAttributeCreate()) ?></div> </script> <script> @@ -51,13 +51,13 @@ }); }); - $suggest.mage('suggest', <?= /* @escapeNotVerified */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSelectorOptions()) ?>) + $suggest.mage('suggest', <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSelectorOptions()) ?>) .on('suggestselect', function (e, ui) { $(this).val(''); var templateId = $('#attribute_set_id').val(); if (ui.item.id) { $.ajax({ - url: '<?= /* @escapeNotVerified */ $block->getAddAttributeUrl() ?>', + url: '<?= $block->escapeJs($block->escapeUrl($block->getAddAttributeUrl())) ?>', type: 'POST', dataType: 'json', data: {attribute_id: ui.item.id, template_id: templateId, group: $(this).data('group')}, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml index 6a62f01f97b65..360694fceb241 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs.phtml @@ -4,40 +4,38 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs */ ?> -<?php if (!empty($tabs)): ?> +<?php if (!empty($tabs)) :?> <?php $tabGroups = [ \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::BASIC_TAB_GROUP_CODE, \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::ADVANCED_TAB_GROUP_CODE, ];?> - <div id="<?= /* @escapeNotVerified */ $block->getId() ?>" + <div id="<?= $block->escapeHtmlAttr($block->getId()) ?>" data-mage-init='{"tabs":{ - "active": "<?= /* @escapeNotVerified */ $block->getActiveTabId() ?>", - "destination": "#<?= /* @escapeNotVerified */ $block->getDestElementId() ?>", - "shadowTabs": "<?= /* @escapeNotVerified */ $block->getAllShadowTabs() ?>", - "tabsBlockPrefix": "<?= /* @escapeNotVerified */ $block->getId() ?>_", + "active": "<?= $block->escapeHtmlAttr($block->getActiveTabId()) ?>", + "destination": "#<?= $block->escapeHtmlAttr($block->getDestElementId()) ?>", + "shadowTabs": "<?= /* @noEscape */ $block->getAllShadowTabs() ?>", + "tabsBlockPrefix": "<?= $block->escapeHtmlAttr($block->getId()) ?>_", "tabIdArgument": "active_tab", - "tabPanelClass": "<?= /* @escapeNotVerified */ $block->getPanelsClass() ?>", - "excludedPanel": "<?= /* @escapeNotVerified */ $block->getExcludedPanel() ?>", + "tabPanelClass": "<?= $block->escapeHtmlAttr($block->getPanelsClass()) ?>", + "excludedPanel": "<?= $block->escapeHtmlAttr($block->getExcludedPanel()) ?>", "groups": "ul.tabs" }}'> - <?php foreach ($tabGroups as $tabGroupCode): ?> + <?php foreach ($tabGroups as $tabGroupCode) :?> <?php $tabGroupId = $block->getId() . '-' . $tabGroupCode; $isBasic = $tabGroupCode == \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::BASIC_TAB_GROUP_CODE; $activeCollapsible = $block->isAdvancedTabGroupActive() ? true : false; ?> - <div class="admin__page-nav <?php if (!$isBasic): ?> <?= '_collapsed' ?> <?php endif;?>" + <div class="admin__page-nav <?php if (!$isBasic) :?> <?= '_collapsed' ?> <?php endif;?>" data-role="container" - id="<?= /* @escapeNotVerified */ $tabGroupId ?>" - <?php if (!$isBasic): ?> + id="<?= $block->escapeHtmlAttr($tabGroupId) ?>" + <?php if (!$isBasic) :?> data-mage-init='{"collapsible":{ - "active": "<?= /* @escapeNotVerified */ $activeCollapsible ?>", + "active": "<?= /* @noEscape */ $activeCollapsible ?>", "openedState": "_show", "closedState": "_hide", "animate": 200, @@ -45,44 +43,45 @@ }}' <?php endif;?>> - <div class="admin__page-nav-title-wrap" <?= /* @escapeNotVerified */ $block->getUiId('title') ?> data-role="title"> - <div class="admin__page-nav-title <?php if (!$isBasic): ?> <?= '_collapsible' ?><?php endif;?>" + <div class="admin__page-nav-title-wrap" <?= /* @noEscape */ $block->getUiId('title') ?> data-role="title"> + <div class="admin__page-nav-title <?php if (!$isBasic) :?> <?= '_collapsible' ?><?php endif;?>" data-role="trigger"> <strong> - <?= /* @escapeNotVerified */ $isBasic ? __('Basic Settings') : __('Advanced Settings') ?> + <?= $block->escapeHtml($isBasic ? __('Basic Settings') : __('Advanced Settings')) ?> </strong> <span data-role="title-messages" class="admin__page-nav-title-messages"></span> </div> </div> - <ul <?= /* @escapeNotVerified */ $block->getUiId('tab', $tabGroupId) ?> class="tabs admin__page-nav-items" data-role="content"> - <?php foreach ($tabs as $_tab): ?> + <ul <?= /* @noEscape */ $block->getUiId('tab', $tabGroupId) ?> class="tabs admin__page-nav-items" data-role="content"> + <?php foreach ($tabs as $_tab) :?> <?php /** @var $_tab \Magento\Backend\Block\Widget\Tab\TabInterface */ ?> <?php if (!$block->canShowTab($_tab) || $_tab->getParentTab() || ($_tab->getGroupCode() && $_tab->getGroupCode() != $tabGroupCode) - || (!$_tab->getGroupCode() && $isBasic)): continue; endif;?> + || (!$_tab->getGroupCode() && $isBasic)) : continue; + endif;?> <?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' . (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?> <?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?> <?php $_tabHref = $block->getTabUrl($_tab) == '#' ? '#' . $block->getTabId($_tab) . '_content' : $block->getTabUrl($_tab) ?> - <li class="admin__page-nav-item <?php if ($block->getTabIsHidden($_tab)): ?> <?= "no-display" ?> <?php endif; ?> " <?= /* @escapeNotVerified */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> - <a href="<?= /* @escapeNotVerified */ $_tabHref ?>" id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>" - name="<?= /* @escapeNotVerified */ $block->getTabId($_tab, false) ?>" - title="<?= /* @escapeNotVerified */ $block->getTabTitle($_tab) ?>" - class="admin__page-nav-link <?= /* @escapeNotVerified */ $_tabClass ?>" - data-tab-type="<?= /* @escapeNotVerified */ $_tabType ?>" <?= /* @escapeNotVerified */ $block->getUiId('tab', 'link', $_tab->getId()) ?> + <li class="admin__page-nav-item <?php if ($block->getTabIsHidden($_tab)) :?> <?= "no-display" ?> <?php endif; ?> " <?= /* @noEscape */ $block->getUiId('tab', 'item', $_tab->getId()) ?>> + <a href="<?= $block->escapeUrl($_tabHref) ?>" id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>" + name="<?= $block->escapeHtmlAttr($block->getTabId($_tab, false)) ?>" + title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>" + class="admin__page-nav-link <?= $block->escapeHtmlAttr($_tabClass) ?>" + data-tab-type="<?= /* @noEscape */ $_tabType ?>" <?= /* @noEscape */ $block->getUiId('tab', 'link', $_tab->getId()) ?> > <span><?= $block->escapeHtml($block->getTabLabel($_tab)) ?></span> <span class="admin__page-nav-item-messages" data-role="item-messages"> <span class="admin__page-nav-item-message _changed"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('Changes have been made to this section that have not been saved.') ?> + <?= $block->escapeHtml(__('Changes have been made to this section that have not been saved.')) ?> </span> </span> <span class="admin__page-nav-item-message _error"> <span class="admin__page-nav-item-message-icon"></span> <span class="admin__page-nav-item-message-tooltip"> - <?= /* @escapeNotVerified */ __('This tab contains invalid data. Please resolve this before saving.') ?> + <?= $block->escapeHtml(__('This tab contains invalid data. Please resolve this before saving.')) ?> </span> </span> <span class="admin__page-nav-item-message-loader"> @@ -93,11 +92,11 @@ </span> </span> </a> - <div id="<?= /* @escapeNotVerified */ $block->getTabId($_tab) ?>_content" class="no-display" - data-tab-panel="<?= /* @escapeNotVerified */ $_tab->getTabId() ?>" - <?= /* @escapeNotVerified */ $block->getUiId('tab', 'content', $_tab->getId()) ?> + <div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content" class="no-display" + data-tab-panel="<?= $block->escapeHtmlAttr($_tab->getTabId()) ?>" + <?= /* @noEscape */ $block->getUiId('tab', 'content', $_tab->getId()) ?> > - <?= /* @escapeNotVerified */ $block->getTabContent($_tab) ?> + <?= /* @noEscape */ $block->getTabContent($_tab) ?> <?= /* @noEscape */ $block->getAccordion($_tab) ?> </div> </li> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml index 842ed17375f77..c4dc1ddc0b02b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/tabs/child_tab.phtml @@ -4,13 +4,11 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\ChildTab */ ?> <div class="fieldset-wrapper admin__collapsible-block-wrapper" data-tab="<?= /* @noEscape */ $block->getTabId() ?>" id="<?= /* @noEscape */ $block->getTabId() ?>-wrapper" data-mage-init='{"collapsible":{ - "active": <?= /* @noEscape */ $block->isTabOpened() ? 'true' : 'false' ?>, + "active": <?= $block->isTabOpened() ? 'true' : 'false' ?>, "openedState": "_show", "closedState": "_hide", "animate": 200, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml index 8df3e32b0a2c3..c814298d1dbc5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Adminhtml\Product\Grid */ ?> <div id="<?= $block->getHtmlId() ?>" class="admin__grid-massaction"> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) :?> <form action="" id="<?= $block->getHtmlId() ?>-form" method="post"> <?php endif ?> <div class="admin__grid-massaction-form"> @@ -16,43 +15,43 @@ <select id="<?= $block->getHtmlId() ?>-select" class="local-validation admin__control-select"> - <option class="admin__control-select-placeholder" value="" selected><?= /* @escapeNotVerified */ __('Actions') ?></option> - <?php foreach ($block->getItems() as $_item): ?> - <option value="<?= /* @escapeNotVerified */ $_item->getId() ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= /* @escapeNotVerified */ $_item->getLabel() ?></option> + <option class="admin__control-select-placeholder" value="" selected><?= $block->escapeHtml(__('Actions')) ?></option> + <?php foreach ($block->getItems() as $_item) :?> + <option value="<?= $block->escapeHtmlAttr($_item->getId()) ?>"<?= ($_item->getSelected() ? ' selected="selected"' : '') ?>><?= $block->escapeHtml($_item->getLabel()) ?></option> <?php endforeach; ?> </select> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-hiddens"></span> <span class="outer-span" id="<?= $block->getHtmlId() ?>-form-additional"></span> <?= $block->getApplyButtonHtml() ?> </div> - <?php if ($block->getHideFormElement() !== true):?> + <?php if ($block->getHideFormElement() !== true) :?> </form> <?php endif ?> <div class="no-display"> - <?php foreach ($block->getItems() as $_item): ?> - <div id="<?= $block->getHtmlId() ?>-item-<?= /* @escapeNotVerified */ $_item->getId() ?>-block"> + <?php foreach ($block->getItems() as $_item) :?> + <div id="<?= $block->getHtmlId() ?>-item-<?= $block->escapeHtmlAttr($_item->getId()) ?>-block"> <?= $_item->getAdditionalActionBlockHtml() ?> </div> <?php endforeach; ?> </div> <div class="mass-select-wrap"> - <select id="<?= $block->getHtmlId() ?>-mass-select" data-menu="grid-mass-select"> - <optgroup label="<?= /* @escapeNotVerified */ __('Mass Actions') ?>"> + <select id="<?= $block->escapeHtmlAttr($block->getHtmlId()) ?>-mass-select" data-menu="grid-mass-select"> + <optgroup label="<?= $block->escapeHtmlAttr(__('Mass Actions')) ?>"> <option disabled selected></option> - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) :?> <option value="selectAll"> - <?= /* @escapeNotVerified */ __('Select All') ?> + <?= $block->escapeHtml(__('Select All')) ?> </option> <option value="unselectAll"> - <?= /* @escapeNotVerified */ __('Unselect All') ?> + <?= $block->escapeHtml(__('Unselect All')) ?> </option> <?php endif; ?> <option value="selectVisible"> - <?= /* @escapeNotVerified */ __('Select Visible') ?> + <?= $block->escapeHtml(__('Select Visible')) ?> </option> <option value="unselectVisible"> - <?= /* @escapeNotVerified */ __('Unselect Visible') ?> + <?= $block->escapeHtml(__('Unselect Visible')) ?> </option> </optgroup> </select> @@ -65,19 +64,19 @@ $('#<?= $block->getHtmlId() ?>-mass-select').change(function () { var massAction = $('option:selected', this).val(); switch (massAction) { - <?php if ($block->getUseSelectAll()):?> + <?php if ($block->getUseSelectAll()) :?> case 'selectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectAll(); break case 'unselectAll': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectAll(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectAll(); break <?php endif; ?> case 'selectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.selectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.selectVisible(); break case 'unselectVisible': - return <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.unselectVisible(); + return <?= $block->escapeJs($block->getJsObjectName()) ?>.unselectVisible(); break } this.blur(); @@ -85,8 +84,8 @@ }); - <?php if (!$block->getParentBlock()->canDisplayContainer()): ?> - <?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.setGridIds('<?= /* @escapeNotVerified */ $block->getGridIdsJson() ?>'); + <?php if (!$block->getParentBlock()->canDisplayContainer()) :?> + <?= $block->escapeJs($block->getJsObjectName()) ?>.setGridIds('<?= /* @noEscape */ $block->getGridIdsJson() ?>'); <?php endif; ?> </script> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml index fb450d19312fa..668dc4a28a6d9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/rss/grid/link.phtml @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Adminhtml\Rss\Grid\Link */ ?> -<?php if ($block->isRssAllowed() && $block->getLink()): ?> -<a href="<?= /* @escapeNotVerified */ $block->getLink() ?>" class="link-feed"><?= /* @escapeNotVerified */ $block->getLabel() ?></a> +<?php if ($block->isRssAllowed() && $block->getLink()) :?> +<a href="<?= $block->escapeUrl($block->getLink()) ?>" class="link-feed"><?= $block->escapeHtml($block->getLabel()) ?></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/js/components.phtml b/app/code/Magento/Catalog/view/base/templates/js/components.phtml index bad5acc209b5f..5902a9f25cc4b 100644 --- a/app/code/Magento/Catalog/view/base/templates/js/components.phtml +++ b/app/code/Magento/Catalog/view/base/templates/js/components.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml() ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml index 0f3b4f481a288..dbc064665d3fe 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/composite/fieldset/options/view/checkable.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile use Magento\Catalog\Model\Product\Option; /** - * @var \Magento\Catalog\Block\Product\View\Options\View\Checkable $block + * @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select\Checkable */ $option = $block->getOption(); if ($option) : ?> @@ -19,27 +18,21 @@ if ($option) : ?> $count = 1; ?> -<div class="options-list nested" id="options-<?php echo /* @noEscape */ -$option->getId() ?>-list"> - <?php if ($optionType === Option::OPTION_TYPE_RADIO && !$option->getIsRequire()): ?> +<div class="options-list nested" id="options-<?= $block->escapeHtmlAttr($option->getId()) ?>-list"> + <?php if ($optionType === Option::OPTION_TYPE_RADIO && !$option->getIsRequire()) :?> <div class="field choice admin__field admin__field-option"> <input type="radio" - id="options_<?php echo /* @noEscape */ - $option->getId() ?>" + id="options_<?= $block->escapeHtmlAttr($option->getId()) ?>" class="radio admin__control-radio product-custom-option" - name="options[<?php echo /* @noEscape */ - $option->getId() ?>]" - data-selector="options[<?php echo /* @noEscape */ - $option->getId() ?>]" - onclick="<?php echo $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" + name="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]" + onclick="<?= $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" value="" checked="checked" /> - <label class="label admin__field-label" for="options_<?php echo /* @noEscape */ - $option->getId() ?>"> + <label class="label admin__field-label" for="options_<?= $block->escapeHtmlAttr($option->getId()) ?>"> <span> - <?php echo /* @noEscape */ - __('None') ?> + <?= $block->escapeHtml(__('None')) ?> </span> </label> </div> @@ -60,41 +53,29 @@ $option->getId() ?>-list"> } ?> - <div class="field choice admin__field admin__field-option <?php echo /* @noEscape */ - $option->getIsRequire() ? 'required': '' ?>"> - <input type="<?php echo /* @noEscape */ - $optionType ?>" - class="<?php /** @noinspection DisconnectedForeachInstructionInspection */ - echo /* @noEscape */ - $optionType === Option::OPTION_TYPE_RADIO ? - 'radio admin__control-radio' : - 'checkbox admin__control-checkbox' ?> <?php echo /* @noEscape */ - $option->getIsRequire() ? 'required': '' ?> + <div class="field choice admin__field admin__field-option <?= /* @noEscape */ $option->getIsRequire() ? 'required': '' ?>"> + <input type="<?= $block->escapeHtmlAttr($optionType) ?>" + class="<?= $optionType === Option::OPTION_TYPE_RADIO + ? 'radio admin__control-radio' + : 'checkbox admin__control-checkbox' ?> <?= $option->getIsRequire() + ? 'required': '' ?> product-custom-option - <?php echo $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" - name="options[<?php echo $option->getId() ?>]<?php echo /* @noEscape */ - $arraySign ?>" - id="options_<?php echo /* @noEscape */ - $option->getId() . '_' . $count ?>" - value="<?php echo /* @noEscape */ - $value->getOptionTypeId() ?>" - <?php echo /* @noEscape */ - $checked ?> - data-selector="<?php echo /* @noEscape */ - $dataSelector ?>" - price="<?php echo /* @noEscape */ - $block->getCurrencyByStore($value) ?>" + <?= $block->getSkipJsReloadPrice() ? '' : 'opConfig.reloadPrice()' ?>" + name="options[<?= $block->escapeHtmlAttr($option->getId()) ?>]<?= /* @noEscape */ $arraySign ?>" + id="options_<?= $block->escapeHtmlAttr($option->getId() . '_' . $count) ?>" + value="<?= $block->escapeHtmlAttr($value->getOptionTypeId()) ?>" + <?= $block->escapeHtml($checked) ?> + data-selector="<?= $block->escapeHtmlAttr($dataSelector) ?>" + price="<?= $block->escapeHtmlAttr($block->getCurrencyByStore($value)) ?>" /> <label class="label admin__field-label" - for="options_<?php echo /* @noEscape */ - $option->getId() . '_' . $count ?>"> + for="options_<?= $block->escapeHtmlAttr($option->getId() . '_' . $count) ?>"> <span> - <?php echo $block->escapeHtml($value->getTitle()) ?> + <?= $block->escapeHtml($value->getTitle()) ?> </span> - <?php echo /* @noEscape */ - $block->formatPrice($value) ?> + <?= /* @noEscape */ $block->formatPrice($value) ?> </label> </div> <?php endforeach; ?> </div> -<?php endif; ?> \ No newline at end of file +<?php endif; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml index ce1561e382eed..b2c2acb7419bd 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml @@ -3,29 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?php /** @var \Magento\Framework\Pricing\Render\Amount $block */ ?> +<?php /** @var $block \Magento\Framework\Pricing\Render\Amount */ ?> -<span class="price-container <?= /* @escapeNotVerified */ $block->getAdjustmentCssClasses() ?>" +<span class="price-container <?= $block->escapeHtmlAttr($block->getAdjustmentCssClasses()) ?>" <?= $block->getSchema() ? ' itemprop="offers" itemscope itemtype="http://schema.org/Offer"' : '' ?>> - <?php if ($block->getDisplayLabel()): ?> - <span class="price-label"><?= /* @escapeNotVerified */ $block->getDisplayLabel() ?></span> + <?php if ($block->getDisplayLabel()) :?> + <span class="price-label"><?= $block->escapeHtml($block->getDisplayLabel()) ?></span> <?php endif; ?> - <span <?php if ($block->getPriceId()): ?> id="<?= /* @escapeNotVerified */ $block->getPriceId() ?>"<?php endif;?> - <?= ($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?> - data-price-amount="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>" - data-price-type="<?= /* @escapeNotVerified */ $block->getPriceType() ?>" - class="price-wrapper <?= /* @escapeNotVerified */ $block->getPriceWrapperCss() ?>" - ><?= /* @escapeNotVerified */ $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?></span> - <?php if ($block->hasAdjustmentsHtml()): ?> + <span <?php if ($block->getPriceId()) :?> id="<?= $block->escapeHtmlAttr($block->getPriceId()) ?>"<?php endif;?> + <?= ($block->getPriceDisplayLabel()) ? 'data-label="' . $block->escapeHtmlAttr($block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes()) . '"' : '' ?> + data-price-amount="<?= $block->escapeHtmlAttr($block->getDisplayValue()) ?>" + data-price-type="<?= $block->escapeHtmlAttr($block->getPriceType()) ?>" + class="price-wrapper <?= $block->escapeHtmlAttr($block->getPriceWrapperCss()) ?>" + ><?= $block->escapeHtml($block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()), ['span']) ?></span> + <?php if ($block->hasAdjustmentsHtml()) :?> <?= $block->getAdjustmentsHtml() ?> <?php endif; ?> - <?php if ($block->getSchema()): ?> - <meta itemprop="price" content="<?= /* @escapeNotVerified */ $block->getDisplayValue() ?>" /> - <meta itemprop="priceCurrency" content="<?= /* @escapeNotVerified */ $block->getDisplayCurrencyCode() ?>" /> + <?php if ($block->getSchema()) :?> + <meta itemprop="price" content="<?= $block->escapeHtmlAttr($block->getDisplayValue()) ?>" /> + <meta itemprop="priceCurrency" content="<?= $block->escapeHtmlAttr($block->getDisplayCurrencyCode()) ?>" /> <?php endif; ?> </span> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml index b414f02a3d6fb..7005e65bcca80 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -15,7 +12,7 @@ /** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */ $priceModel = $block->getPriceType('regular_price'); -/* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [ +/* @noEscape */ echo $block->renderAmount($priceModel->getAmount(), [ 'price_id' => $block->getPriceId('product-price-'), 'include_container' => true ]); diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml index 6e281bdef7afb..e56804a06de22 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -21,9 +18,9 @@ $finalPriceModel = $block->getPriceType('final_price'); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $schema = ($block->getZone() == 'item_view') ? true : false; ?> -<?php if ($block->hasSpecialPrice()): ?> +<?php if ($block->hasSpecialPrice()) :?> <span class="special-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [ + <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'display_label' => __('Special Price'), 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', @@ -32,7 +29,7 @@ $schema = ($block->getZone() == 'item_view') ? true : false; ]); ?> </span> <span class="old-price"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [ + <?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [ 'display_label' => __('Regular Price'), 'price_id' => $block->getPriceId('old-price-' . $idSuffix), 'price_type' => 'oldPrice', @@ -40,8 +37,8 @@ $schema = ($block->getZone() == 'item_view') ? true : false; 'skip_adjustments' => true ]); ?> </span> -<?php else: ?> - <?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [ +<?php else :?> + <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', 'include_container' => true, @@ -49,14 +46,14 @@ $schema = ($block->getZone() == 'item_view') ? true : false; ]); ?> <?php endif; ?> -<?php if ($block->showMinimalPrice()): ?> - <?php if ($block->getUseLinkForAsLowAs()):?> - <a href="<?= /* @escapeNotVerified */ $block->getSaleableItem()->getProductUrl() ?>" class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> +<?php if ($block->showMinimalPrice()) :?> + <?php if ($block->getUseLinkForAsLowAs()) :?> + <a href="<?= $block->escapeUrl($block->getSaleableItem()->getProductUrl()) ?>" class="minimal-price-link"> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </a> - <?php else:?> + <?php else :?> <span class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </span> <?php endif?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml index c2b7fb4e60855..5949b54268a62 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml @@ -3,12 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate +// phpcs:disable Generic.WhiteSpace.ScopeIndent + /** @var \Magento\Catalog\Pricing\Render\PriceBox $block */ /** @var \Magento\Catalog\Pricing\Price\TierPrice $tierPriceModel */ @@ -18,17 +18,17 @@ $msrpShowOnGesture = $block->getPriceType('msrp_price')->isShowPriceOnGesture(); $product = $block->getSaleableItem(); ?> <?php if (count($tierPrices)) : ?> - <ul class="<?= /* @escapeNotVerified */ ($block->hasListClass() ? $block->getListClass() : 'prices-tier items') ?>"> - <?php foreach ($tierPrices as $index => $price) : ?> - <li class="item"> - <?php + <ul class="<?= $block->escapeHtmlAttr(($block->hasListClass() ? $block->getListClass() : 'prices-tier items')) ?>"> + <?php foreach ($tierPrices as $index => $price) : ?> + <li class="item"> + <?php $productId = $product->getId(); $isSaleable = $product->isSaleable(); $popupId = 'msrp-popup-' . $productId . $block->getRandomString(20); - if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()): + if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()) : $addToCartUrl = ''; if ($isSaleable) { - $addToCartUrl = $this->helper('\Magento\Checkout\Helper\Cart') + $addToCartUrl = $this->helper(\Magento\Checkout\Helper\Cart::class) ->getAddUrl($product, ['qty' => $price['price_qty']]); } $tierPriceData = [ @@ -54,13 +54,13 @@ $product = $block->getSaleableItem(); if ($block->getCanDisplayQty($product)) { $tierPriceData['qty'] = $price['price_qty']; } - ?> - <?= /* @escapeNotVerified */ __('Buy %1 for: ', $price['price_qty']) ?> - <a href="javascript:void(0);" - id="<?= /* @escapeNotVerified */ ($popupId) ?>" - data-tier-price="<?= $block->escapeHtml($block->jsonEncode($tierPriceData)) ?>"> - <?= /* @escapeNotVerified */ __('Click for price') ?></a> - <?php else: + ?> + <?= $block->escapeHtml(__('Buy %1 for: ', $price['price_qty'])) ?> + <a href="javascript:void(0);" + id="<?= $block->escapeHtmlAttr($popupId) ?>" + data-tier-price="<?= $block->escapeHtml($block->jsonEncode($tierPriceData)) ?>"> + <?= $block->escapeHtml(__('Click for price')) ?></a> + <?php else : $priceAmountBlock = $block->renderAmount( $price['price'], [ @@ -70,22 +70,22 @@ $product = $block->getSaleableItem(); 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION ] ); - ?> - <?php /* @escapeNotVerified */ echo ($block->getShowDetailedPrice() !== false) - ? __( - 'Buy %1 for %2 each and <strong class="benefit">save<span class="percent tier-%3"> %4</span>%</strong>', - $price['price_qty'], - $priceAmountBlock, - $index, - $block->formatPercent($price['percentage_value'] ?? $tierPriceModel->getSavePercent($price['price'])) - ) - : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock); - ?> - <?php endif; ?> - </li> - <?php endforeach; ?> + ?> + <?= /* @noEscape */ ($block->getShowDetailedPrice() !== false) + ? __( + 'Buy %1 for %2 each and <strong class="benefit">save<span class="percent tier-%3"> %4</span>%</strong>', + $price['price_qty'], + $priceAmountBlock, + $index, + $block->formatPercent($price['percentage_value'] ?? $tierPriceModel->getSavePercent($price['price'])) + ) + : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock); + ?> + <?php endif; ?> + </li> + <?php endforeach; ?> </ul> - <?php if ($msrpShowOnGesture):?> + <?php if ($msrpShowOnGesture) :?> <script type="text/x-magento-init"> { ".product-info-main": { @@ -95,9 +95,9 @@ $product = $block->getSaleableItem(); "inputQty": "#qty", "attr": "[data-tier-price]", "productForm": "#product_addtocart_form", - "productId": "<?= /* @escapeNotVerified */ $productId ?>", + "productId": "<?= (int) $productId ?>", "productIdInput": "input[type=hidden][name=product]", - "isSaleable": "<?= /* @escapeNotVerified */ $isSaleable ?>" + "isSaleable": "<?= (bool) $isSaleable ?>" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml index 3619ce94031c2..b50095e91d999 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,7 +11,7 @@ * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if ($block->isContentMode() || $block->isMixedMode()): ?> +<?php if ($block->isContentMode() || $block->isMixedMode()) :?> <div class="category-cms"> <?= $block->getCmsBlockHtml() ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml index 0efce1014f9c2..2f5b852575c78 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/description.phtml @@ -3,19 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * Category view template * * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if ($_description = $block->getCurrentCategory()->getDescription()): ?> +<?php if ($_description = $block->getCurrentCategory()->getDescription()) :?> <div class="category-description"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($block->getCurrentCategory(), $_description, 'description') ?> + <?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->categoryAttribute( + $block->getCurrentCategory(), + $_description, + 'description' + ) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml index edff2147ad14b..02593d3b541a1 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/image.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,14 +10,24 @@ * * @var $block \Magento\Catalog\Block\Category\View */ + +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput ?> <?php - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_category = $block->getCurrentCategory(); $_imgHtml = ''; if ($_imgUrl = $_category->getImageUrl()) { - $_imgHtml = '<div class="category-image"><img src="' . $_imgUrl . '" alt="' . $block->escapeHtml($_category->getName()) . '" title="' . $block->escapeHtml($_category->getName()) . '" class="image" /></div>'; + $_imgHtml = '<div class="category-image"><img src="' + . $block->escapeUrl($_imgUrl) + . '" alt="' + . $block->escapeHtmlAttr($_category->getName()) + . '" title="' + . $block->escapeHtmlAttr($_category->getName()) + . '" class="image" /></div>'; $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); - /* @escapeNotVerified */ echo $_imgHtml; + /* @noEscape */ echo $_imgHtml; } ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml index c521cf03ad156..80a9ae0a03e66 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/products.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,6 +11,6 @@ * @var $block \Magento\Catalog\Block\Category\View */ ?> -<?php if (!$block->isContentMode() || $block->isMixedMode()): ?> +<?php if (!$block->isContentMode() || $block->isMixedMode()) :?> <?= $block->getProductListHtml() ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml index 774aa8d839e87..65ee7ea789e46 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/rss.phtml @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Category\Rss\Link */ ?> -<?php if ($block->isRssAllowed() && $block->getLink() && $block->isTopCategory()): ?> - <a href="<?= /* @escapeNotVerified */ $block->getLink() ?>" class="action link rss"><span><?= /* @escapeNotVerified */ $block->getLabel() ?></span></a> +<?php if ($block->isRssAllowed() && $block->getLink() && $block->isTopCategory()) :?> + <a href="<?= $block->escapeUrl($block->getLink()) ?>" + class="action link rss"><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml index 2b0098be6545b..15fdd30c2d93f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_block.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <div class="widget block block-category-link"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml index 91ab70b03769f..18ffee4b5f701 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_href.phtml @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var Magento\Catalog\Block\Widget\Link $block */ ?> <?= $block->escapeHtml($block->getHref()) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml index f53c1c1ed90d7..8f3b2ae613731 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/widget/link/link_inline.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <span class="widget block block-category-link-inline"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml b/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml index 4c103b40ba28c..52bec7858a919 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/frontend_storage_manager.phtml @@ -3,7 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + +/** @var $block Magento\Catalog\Block\FrontendStorageManager */ ?> <script type="text/x-magento-init"> { @@ -12,9 +13,8 @@ "components": { "storage-manager": { "component": "Magento_Catalog/js/storage-manager", - "appendTo": "<?= /* @escapeNotVerified */ $block->getParentComponentName() ?>", - "storagesConfiguration" : - <?= /* @escapeNotVerified */ $block->getConfigurationJson() ?> + "appendTo": "<?= $block->escapeJs($block->getParentComponentName()) ?>", + "storagesConfiguration" : <?= /* @noEscape */ $block->getConfigurationJson() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml b/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml index 5f44c42e17c57..f5dca566abfed 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/messages/addCompareSuccessMessage.phtml @@ -3,12 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + /** @var \Magento\Framework\View\Element\Template $block */ ?> -<?= $block->escapeHtml(__( - 'You added product %1 to the <a href="%2">comparison list</a>.', - $block->getData('product_name'), - $block->getData('compare_list_url')), +<?= $block->escapeHtml( + __( + 'You added product %1 to the <a href="%2">comparison list</a>.', + $block->getData('product_name'), + $block->getData('compare_list_url') + ), ['a'] ); diff --git a/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml b/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml index 01820361744e0..6d5ddb95ab178 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/navigation/left.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Category left navigation * @@ -15,25 +13,29 @@ <?php if (!$block->getCategory()) { return; } ?> -<?php $_categories = $block->getCurrentChildCategories(); ?> +<?php $_categories = $block->getCurrentChildCategories() ;?> <?php $_count = is_array($_categories) ? count($_categories) : $_categories->count(); ?> -<?php if ($_count): ?> +<?php if ($_count) :?> <div class="block filter"> <div class="title"> - <strong><?= /* @escapeNotVerified */ __('Shop By') ?></strong> + <strong><?= $block->escapeHtml(__('Shop By')) ?></strong> </div> <div class="content"> - <strong class="subtitle"><?= /* @escapeNotVerified */ __('Shopping Options') ?></strong> + <strong class="subtitle"><?= $block->escapeHtml(__('Shopping Options')) ?></strong> <dl class="options" id="narrow-by-list2"> - <dt><?= /* @escapeNotVerified */ __('Category') ?></dt> + <dt><?= $block->escapeHtml(__('Category')) ?></dt> <dd> <ol class="items"> <?php /** @var \Magento\Catalog\Model\Category $_category */ ?> - <?php foreach ($_categories as $_category): ?> - <?php if ($_category->getIsActive()): ?> + <?php foreach ($_categories as $_category) :?> + <?php if ($_category->getIsActive()) :?> <li class="item"> - <a href="<?= /* @escapeNotVerified */ $block->getCategoryUrl($_category) ?>"<?php if ($block->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?= $block->escapeHtml($_category->getName()) ?></a> - <span class="count"><?= /* @escapeNotVerified */ $_category->getProductCount() ?></span> + <a href="<?= $block->escapeUrl($block->getCategoryUrl($_category)) ?>" + <?php if ($block->isCategoryActive($_category)) :?> + class="current" + <?php endif; ?> + ><?= $block->escapeHtml($_category->getName()) ?></a> + <span class="count"><?= $block->escapeHtml($_category->getProductCount()) ?></span> </li> <?php endif; ?> <?php endforeach ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml index b8595aae9d993..05a5649135ef5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/link.phtml @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $block Magento\Framework\View\Element\Template */ ?> <li class="item link compare" data-bind="scope: 'compareProducts'" data-role="compare-products-link"> - <a class="action compare no-display" title="<?= /* @escapeNotVerified */ __('Compare Products') ?>" + <a class="action compare no-display" title="<?= $block->escapeHtmlAttr(__('Compare Products')) ?>" data-bind="attr: {'href': compareProducts().listUrl}, css: {'no-display': !compareProducts().count}" > - <?= /* @escapeNotVerified */ __('Compare Products') ?> + <?= $block->escapeHtml(__('Compare Products')) ?> <span class="counter qty" data-bind="text: compareProducts().countCaption"></span> </a> </li> <script type="text/x-magento-init"> -{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}} +{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>}} </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index 7daf049980362..55772388d44bf 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -4,14 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable PSR2.ControlStructures.SwitchDeclaration +// phpcs:disable Generic.WhiteSpace.ScopeIndent /* @var $block \Magento\Catalog\Block\Product\Compare\ListCompare */ ?> <?php $total = $block->getItems()->getSize() ?> -<?php if ($total): ?> - <a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>"> - <span><?= /* @escapeNotVerified */ __('Print This Page') ?></span> +<?php if ($total) :?> + <a href="#" class="action print hidden-print" title="<?= $block->escapeHtmlAttr(__('Print This Page')) ?>"> + <span><?= $block->escapeHtml(__('Print This Page')) ?></span> </a> <div class="table-wrapper comparison"> <table class="data table table-comparison" id="product-comparison" @@ -21,19 +23,19 @@ "selectors":{ "productAddToCartSelector":"button.action.tocart"} }}'> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('Compare Products') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('Compare Products')) ?></caption> <thead> <tr> <?php $index = 0 ?> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> - <th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> + <th scope="row" class="cell label remove"><span><?= $block->escapeHtml(__('Remove Product')) ?></span></th> <?php endif; ?> <td class="cell remove product hidden-print"> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> - <a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($item) ?>' - class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>"> - <span><?= /* @escapeNotVerified */ __('Remove Product') ?></span> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class);?> + <a href="#" data-post='<?= /* @noEscape */ $compareHelper->getPostDataRemove($item) ?>' + class="action delete" title="<?= $block->escapeHtmlAttr(__('Remove Product')) ?>"> + <span><?= $block->escapeHtml(__('Remove Product')) ?></span> </a> </td> <?php endforeach; ?> @@ -42,44 +44,54 @@ <tbody> <tr> <?php $index = 0; ?> - <?php $helper = $this->helper('Magento\Catalog\Helper\Output'); ?> + <?php $helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> <?php /** @var $item \Magento\Catalog\Model\Product */ ?> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> - <th scope="row" class="cell label product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> + <th scope="row" class="cell label product"> + <span><?= $block->escapeHtml(__('Product')) ?></span> + </th> <?php endif; ?> - <td data-th="<?= $block->escapeHtml(__('Product')) ?>" class="cell product info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> + <td data-th="<?= $block->escapeHtmlAttr(__('Product')) ?>" class="cell product info"> + <a class="product-item-photo" + href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" + title="<?= /* @noEscape */ $block->stripTags($item->getName(), null, true) ?>"> <?= $block->getImage($item, 'product_comparison_list')->toHtml() ?> </a> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> - <?= /* @escapeNotVerified */ $helper->productAttribute($item, $item->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" + title="<?= /* @noEscape */ $block->stripTags($item->getName(), null, true) ?>"> + <?= /* @noEscape */ $helper->productAttribute($item, $item->getName(), 'name') ?> </a> </strong> <?= $block->getReviewsSummaryHtml($item, 'short') ?> - <?= /* @escapeNotVerified */ $block->getProductPrice($item, '-compare-list-top') ?> + <?= /* @noEscape */ $block->getProductPrice($item, '-compare-list-top') ?> <div class="product-item-actions hidden-print"> <div class="actions-primary"> - <?php if ($item->isSaleable()): ?> - <form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($item) ?>" method="post"> + <?php if ($item->isSaleable()) :?> + <form data-role="tocart-form" + action="<?= $block->escapeUrl($this->helper(Magento\Catalog\Helper\Product\Compare::class)->getAddToCartUrl($item)) ?>" + method="post"> <?= $block->getBlockHtml('formkey') ?> <button type="submit" class="action tocart primary"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> </form> - <?php else: ?> - <?php if ($item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow()) :?> <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> - <a href="#" data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($item) ?>' class="action towishlist" data-action="add-to-wishlist"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + <a href="#" + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($item) ?>' + class="action towishlist" + data-action="add-to-wishlist"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> </div> <?php endif; ?> @@ -89,12 +101,12 @@ </tr> </tbody> <tbody> - <?php foreach ($block->getAttributes() as $attribute): ?> + <?php foreach ($block->getAttributes() as $attribute) :?> <?php $index = 0; ?> - <?php if ($block->hasAttributeValueForProducts($attribute)): ?> + <?php if ($block->hasAttributeValueForProducts($attribute)) :?> <tr> - <?php foreach ($block->getItems() as $item): ?> - <?php if ($index++ == 0): ?> + <?php foreach ($block->getItems() as $item) :?> + <?php if ($index++ == 0) :?> <th scope="row" class="cell label"> <span class="attribute label"> <?= $block->escapeHtml($attribute->getStoreLabel() ? $attribute->getStoreLabel() : __($attribute->getFrontendLabel())) ?> @@ -105,21 +117,21 @@ <div class="attribute value"> <?php switch ($attribute->getAttributeCode()) { case "price": ?> - <?php - /* @escapeNotVerified */ echo $block->getProductPrice( - $item, - '-compare-list-' . $attribute->getCode() - ) + <?= + /* @noEscape */ $block->getProductPrice( + $item, + '-compare-list-' . $attribute->getCode() + ) ?> <?php break; case "small_image": ?> <?php $block->getImage($item, 'product_small_image')->toHtml(); ?> <?php break; - default: ?> - <?php if (is_string($block->getProductAttributeValue($item, $attribute))): ?> - <?= /* @escapeNotVerified */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?> + default :?> + <?php if (is_string($block->getProductAttributeValue($item, $attribute))) :?> + <?= /* @noEscape */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?> <?php endif; ?> - <?php break; + <?php break; } ?> </div> </td> @@ -130,7 +142,7 @@ </tbody> </table> </div> - <?php if (!$block->isRedirectToCartEnabled()) : ?> + <?php if (!$block->isRedirectToCartEnabled()) :?> <script type="text/x-magento-init"> { "[data-role=tocart-form]": { @@ -139,6 +151,6 @@ } </script> <?php endif; ?> -<?php else: ?> - <div class="message info empty"><div><?= /* @escapeNotVerified */ __('You have no items to compare.') ?></div></div> +<?php else :?> + <div class="message info empty"><div><?= $block->escapeHtml(__('You have no items to compare.')) ?></div></div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml index 8daa342454445..809ddc5c61701 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/sidebar.phtml @@ -4,12 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /* @var $block \Magento\Framework\View\Element\Template */ ?> <div class="block block-compare" data-bind="scope: 'compareProducts'" data-role="compare-products-sidebar"> <div class="block-title"> - <strong id="block-compare-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ __('Compare Products') ?></strong> + <strong id="block-compare-heading" role="heading" aria-level="2"><?= $block->escapeHtml(__('Compare Products')) ?></strong> <span class="counter qty no-display" data-bind="text: compareProducts().countCaption, css: {'no-display': !compareProducts().count}"></span> </div> <!-- ko if: compareProducts().count --> @@ -20,29 +21,32 @@ <strong class="product-item-name"> <a data-bind="attr: {href: product_url}, html: name" class="product-item-link"></a> </strong> - <a href="#" data-bind="attr: {'data-post': remove_url}" title="<?= /* @escapeNotVerified */ __('Remove This Item') ?>" class="action delete"> - <span><?= /* @escapeNotVerified */ __('Remove This Item') ?></span> + <a href="#" + data-bind="attr: {'data-post': remove_url}" + title="<?= $block->escapeHtmlAttr(__('Remove This Item')) ?>" + class="action delete"> + <span><?= $block->escapeHtml(__('Remove This Item')) ?></span> </a> </li> </ol> <div class="actions-toolbar"> <div class="primary"> - <a data-bind="attr: {'href': compareProducts().listUrl}" class="action compare primary"><span><?= /* @escapeNotVerified */ __('Compare') ?></span></a> + <a data-bind="attr: {'href': compareProducts().listUrl}" class="action compare primary"><span><?= $block->escapeHtml(__('Compare')) ?></span></a> </div> <div class="secondary"> <a id="compare-clear-all" href="#" class="action clear" data-post="<?=$block->escapeHtml( - $this->helper('Magento\Catalog\Helper\Product\Compare')->getPostDataClearList() + $this->helper(Magento\Catalog\Helper\Product\Compare::class)->getPostDataClearList() ) ?>"> - <span><?= /* @escapeNotVerified */ __('Clear All') ?></span> + <span><?= $block->escapeHtml(__('Clear All')) ?></span> </a> </div> </div> </div> <!-- /ko --> <!-- ko ifnot: compareProducts().count --> - <div class="empty"><?= /* @escapeNotVerified */ __('You have no items to compare.') ?></div> + <div class="empty"><?= $block->escapeHtml(__('You have no items to compare.')) ?></div> <!-- /ko --> </div> <script type="text/x-magento-init"> -{"[data-role=compare-products-sidebar]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}} +{"[data-role=compare-products-sidebar]": {"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>}} </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml index c7abb0525b302..e9551793c86f5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml @@ -4,39 +4,45 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Catalog\Block\Product\Gallery $block */ ?> <?php $_width = $block->getImageWidth(); ?> -<div class="product-image-popup" style="width:<?= /* @escapeNotVerified */ $_width ?>px;"> - <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @escapeNotVerified */ __('Close Window') ?></span></a></div> - <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()): ?> +<div class="product-image-popup" style="width:<?= /* @noEscape */ $_width ?>px;"> + <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= $block->escapeHtml(__('Close Window')) ?></span></a></div> + <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()) :?> <div class="nav"> - <?php if ($_prevUrl = $block->getPreviousImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_prevUrl ?>" class="prev">« <?= /* @escapeNotVerified */ __('Prev') ?></a> - <?php endif; ?> - <?php if ($_nextUrl = $block->getNextImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_nextUrl ?>" class="next"><?= /* @escapeNotVerified */ __('Next') ?> »</a> - <?php endif; ?> + <?php if ($_prevUrl = $block->getPreviousImageUrl()) :?> + <a href="<?= $block->escapeUrl($_prevUrl) ?>" class="prev">« <?= $block->escapeHtml(__('Prev')) ?></a> + <?php endif; ?> + <?php if ($_nextUrl = $block->getNextImageUrl()) :?> + <a href="<?= $block->escapeUrl($_nextUrl) ?>" class="next"><?= $block->escapeHtml(__('Next')) ?> »</a> + <?php endif; ?> </div> <?php endif; ?> - <?php if ($_imageTitle = $block->escapeHtml($block->getCurrentImage()->getLabel())): ?> - <h1 class="image-label"><?= /* @escapeNotVerified */ $_imageTitle ?></h1> + <?php if ($_imageTitle = $block->escapeHtml($block->getCurrentImage()->getLabel())) :?> + <h1 class="image-label"><?= /* @noEscape */ $_imageTitle ?></h1> <?php endif; ?> <?php - $imageUrl = $block->getImageUrl(); + $imageUrl = $block->getImageUrl(); ?> - <img src="<?= /* @escapeNotVerified */ $imageUrl ?>"<?php if ($_width): ?> width="<?= /* @escapeNotVerified */ $_width ?>"<?php endif; ?> alt="<?= $block->escapeHtml($block->getCurrentImage()->getLabel()) ?>" title="<?= $block->escapeHtml($block->getCurrentImage()->getLabel()) ?>" id="product-gallery-image" class="image" data-mage-init='{"catalogGallery":{}}'/> - <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @escapeNotVerified */ __('Close Window') ?></span></a></div> - <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()): ?> + <img src="<?= $block->escapeUrl($imageUrl) ?>" + <?php if ($_width) :?> + width="<?= /* @noEscape */ $_width ?>" + <?php endif; ?> + alt="<?= $block->escapeHtmlAttr($block->getCurrentImage()->getLabel()) ?>" + title="<?= $block->escapeHtmlAttr($block->getCurrentImage()->getLabel()) ?>" + id="product-gallery-image" + class="image" + data-mage-init='{"catalogGallery":{}}'/> + <div class="buttons-set"><a href="#" class="button" role="close-window"><span><?= /* @noEscape */ __('Close Window') ?></span></a></div> + <?php if ($block->getPreviousImageUrl() || $block->getNextImageUrl()) :?> <div class="nav"> - <?php if ($_prevUrl = $block->getPreviousImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_prevUrl ?>" class="prev">« <?= /* @escapeNotVerified */ __('Prev') ?></a> - <?php endif; ?> - <?php if ($_nextUrl = $block->getNextImageUrl()): ?> - <a href="<?= /* @escapeNotVerified */ $_nextUrl ?>" class="next"><?= /* @escapeNotVerified */ __('Next') ?> »</a> - <?php endif; ?> + <?php if ($_prevUrl = $block->getPreviousImageUrl()) :?> + <a href="<?= $block->escapeUrl($_prevUrl) ?>" class="prev">« <?= $block->escapeHtml(__('Prev')) ?></a> + <?php endif; ?> + <?php if ($_nextUrl = $block->getNextImageUrl()) :?> + <a href="<?= $block->escapeUrl($_nextUrl) ?>" class="next"><?= $block->escapeHtml(__('Next')) ?> »</a> + <?php endif; ?> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml index 94b829eb92137..5a1b102ff6362 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml @@ -7,8 +7,8 @@ <?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> <img class="photo image" - <?= /* @escapeNotVerified */ $block->getCustomAttributes() ?> - src="<?= /* @escapeNotVerified */ $block->getImageUrl() ?>" - width="<?= /* @escapeNotVerified */ $block->getWidth() ?>" - height="<?= /* @escapeNotVerified */ $block->getHeight() ?>" - alt="<?= /* @escapeNotVerified */ $block->stripTags($block->getLabel(), null, true) ?>" /> + <?= $block->escapeHtml($block->getCustomAttributes()) ?> + src="<?= $block->escapeUrl($block->getImageUrl()) ?>" + width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" + height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>" /> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml index 8a907bd54aa6a..33f7620f1a1f5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml @@ -7,13 +7,13 @@ <?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> <span class="product-image-container" - style="width:<?= /* @escapeNotVerified */ $block->getWidth() ?>px;"> + style="width:<?= $block->escapeHtmlAttr($block->getWidth()) ?>px;"> <span class="product-image-wrapper" - style="padding-bottom: <?= /* @escapeNotVerified */ ($block->getRatio() * 100) ?>%;"> - <img class="<?= /* @escapeNotVerified */ $block->getClass() ?>" - <?= /* @escapeNotVerified */ $block->getCustomAttributes() ?> - src="<?= /* @escapeNotVerified */ $block->getImageUrl() ?>" - max-width="<?= /* @escapeNotVerified */ $block->getWidth() ?>" - max-height="<?= /* @escapeNotVerified */ $block->getHeight() ?>" - alt="<?= /* @escapeNotVerified */ $block->stripTags($block->getLabel(), null, true) ?>"/></span> + style="padding-bottom: <?= ($block->getRatio() * 100) ?>%;"> + <img class="<?= $block->escapeHtmlAttr($block->getClass()) ?>" + <?= $block->escapeHtmlAttr($block->getCustomAttributes()) ?> + src="<?= $block->escapeUrl($block->getImageUrl()) ?>" + max-width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" + max-height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>"/></span> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index e970ade6cee96..ce44884a575b8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -5,10 +5,10 @@ */ use Magento\Framework\App\Action\Action; -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + /** * Product list template * @@ -17,11 +17,11 @@ use Magento\Framework\App\Action\Action; ?> <?php $_productCollection = $block->getLoadedProductCollection(); -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> -<?php if (!$_productCollection->count()): ?> - <div class="message info empty"><div><?= /* @escapeNotVerified */ __('We can\'t find products matching the selection.') ?></div></div> -<?php else: ?> +<?php if (!$_productCollection->count()) :?> + <div class="message info empty"><div><?= $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></div></div> +<?php else :?> <?= $block->getToolbarHtml() ?> <?= $block->getAdditionalHtml() ?> <?php @@ -41,12 +41,12 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); */ $pos = $block->getPositioned(); ?> - <div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?> products-<?= /* @escapeNotVerified */ $viewMode ?>"> + <div class="products wrapper <?= /* @noEscape */ $viewMode ?> products-<?= /* @noEscape */ $viewMode ?>"> <ol class="products list items product-items"> <?php /** @var $_product \Magento\Catalog\Model\Product */ ?> - <?php foreach ($_productCollection as $_product): ?> + <?php foreach ($_productCollection as $_product) :?> <li class="item product product-item"> - <div class="product-item-info" data-container="product-<?= /* @escapeNotVerified */ $viewMode ?>"> + <div class="product-item-info" data-container="product-<?= /* @noEscape */ $viewMode ?>"> <?php $productImage = $block->getImage($_product, $imageDisplayArea); if ($pos != null) { @@ -55,7 +55,9 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); } ?> <?php // Product Image ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1"> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + class="product photo product-item-photo" + tabindex="-1"> <?= $productImage->toHtml() ?> </a> <div class="product details product-item-details"> @@ -64,48 +66,55 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> <strong class="product name product-item-name"> <a class="product-item-link" - href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?> + href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"> + <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> <?= $block->getReviewsSummaryHtml($_product, $templateType) ?> - <?= /* @escapeNotVerified */ $block->getProductPrice($_product) ?> + <?= /* @noEscape */ $block->getProductPrice($_product) ?> <?= $block->getProductDetailsHtml($_product) ?> <div class="product-item-inner"> - <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $position : '' ?>> - <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>> - <?php if ($_product->isSaleable()): ?> + <div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>> + <div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $block->escapeHtmlAttr($position) : '' ?>> + <?php if ($_product->isSaleable()) :?> <?php $postParams = $block->getAddToCartPostParams($_product); ?> - <form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post"> - <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $postParams['data']['product'] ?>"> - <input type="hidden" name="<?= /* @escapeNotVerified */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @escapeNotVerified */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>"> + <form data-role="tocart-form" + data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" + action="<?= $block->escapeUrl($postParams['action']) ?>" + method="post"> + <input type="hidden" + name="product" + value="<?= /* @noEscape */ $postParams['data']['product'] ?>"> + <input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?>" + value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>"> <?= $block->getBlockHtml('formkey') ?> <button type="submit" - title="<?= $block->escapeHtml(__('Add to Cart')) ?>" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> </form> - <?php else: ?> - <?php if ($_product->isAvailable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_product->isAvailable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> - <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>> - <?php if ($addToBlock = $block->getChildBlock('addto')): ?> + <div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $block->escapeHtmlAttr($position) : '' ?>> + <?php if ($addToBlock = $block->getChildBlock('addto')) :?> <?= $addToBlock->setProduct($_product)->getChildHtml() ?> <?php endif; ?> </div> </div> - <?php if ($showDescription):?> + <?php if ($showDescription) :?> <div class="product description product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" title="<?= /* @escapeNotVerified */ $_productNameStripped ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + <?= /* @noEscape */ $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $_productNameStripped ?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> @@ -116,12 +125,12 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); </ol> </div> <?= $block->getToolbarHtml() ?> - <?php if (!$block->isRedirectToCartEnabled()) : ?> + <?php if (!$block->isRedirectToCartEnabled()) :?> <script type="text/x-magento-init"> { "[data-role=tocart-form], .form.map.checkout": { "catalogAddToCart": { - "product_sku": "<?= /* @NoEscape */ $_product->getSku() ?>" + "product_sku": "<?= $block->escapeJs($_product->getSku()) ?>" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml index 8798170e8c0b0..c23ee021ca3a8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/addto/compare.phtml @@ -4,14 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile /** @var $block Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare */ ?> <a href="#" class="action tocompare" title="<?= $block->escapeHtml(__('Add to Compare')) ?>" aria-label="<?= $block->escapeHtml(__('Add to Compare')) ?>" - data-post='<?= /* @escapeNotVerified */ $block->getCompareHelper()->getPostDataParams($block->getProduct()) ?>' + data-post='<?= /* @noEscape */ $block->getCompareHelper()->getPostDataParams($block->getProduct()) ?>' role="button"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index ecc9700802d27..91e261900aef2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -4,7 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect /* @var $block \Magento\Catalog\Block\Product\AbstractProduct */ ?> @@ -29,7 +30,7 @@ switch ($type = $block->getType()) { $templateType = null; $description = false; } - break; + break; case 'related': /** @var \Magento\Catalog\Block\Product\ProductList\Related $block */ @@ -49,7 +50,7 @@ switch ($type = $block->getType()) { $templateType = null; $description = false; } - break; + break; case 'upsell-rule': if ($exist = $block->hasItems()) { @@ -68,7 +69,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'upsell': /** @var \Magento\Catalog\Block\Product\ProductList\Upsell $block */ @@ -88,7 +89,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'crosssell-rule': /** @var \Magento\Catalog\Block\Product\ProductList\Crosssell $block */ @@ -106,7 +107,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'crosssell': /** @var \Magento\Catalog\Block\Product\ProductList\Crosssell $block */ @@ -124,7 +125,7 @@ switch ($type = $block->getType()) { $description = false; $canItemsAddToCart = false; } - break; + break; case 'new': if ($exist = $block->getProductCollection()) { @@ -144,117 +145,117 @@ switch ($type = $block->getType()) { $description = ($mode == 'list') ? true : false; $canItemsAddToCart = false; } - break; + break; default: $exist = null; } ?> -<?php if ($exist):?> +<?php if ($exist) :?> - <?php if ($type == 'related' || $type == 'upsell'): ?> - <?php if ($type == 'related'): ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= /* @escapeNotVerified */ $limit ?>" data-shuffle="<?= /* @escapeNotVerified */ $shuffle ?>"> - <?php else: ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= /* @escapeNotVerified */ $limit ?>" data-shuffle="<?= /* @escapeNotVerified */ $shuffle ?>"> +<?php if ($type == 'related' || $type == 'upsell') :?> +<?php if ($type == 'related') :?> +<div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"relatedProducts":{"relatedCheckbox":".related.checkbox"}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> + <?php else :?> + <div class="block <?= $block->escapeHtmlAttr($class) ?>" data-mage-init='{"upsellProducts":{}}' data-limit="<?= $block->escapeHtmlAttr($limit) ?>" data-shuffle="<?= /* @noEscape */ $shuffle ?>"> <?php endif; ?> - <?php else: ?> - <div class="block <?= /* @escapeNotVerified */ $class ?>"> - <?php endif; ?> - <div class="block-title title"> - <strong id="block-<?= /* @escapeNotVerified */ $class ?>-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> - </div> - <div class="block-content content" aria-labelledby="block-<?= /* @escapeNotVerified */ $class ?>-heading"> - <?php if ($type == 'related' && $canItemsAddToCart): ?> - <div class="block-actions"> - <?= /* @escapeNotVerified */ __('Check items to add to the cart or') ?> - <button type="button" class="action select" role="button"><span><?= /* @escapeNotVerified */ __('select all') ?></span></button> - </div> - <?php endif; ?> - <div class="products wrapper grid products-grid products-<?= /* @escapeNotVerified */ $type ?>"> - <ol class="products list items product-items"> - <?php foreach ($items as $_item): ?> - <?php $available = ''; ?> - <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> - <?php if (!$_item->getRequiredOptions()): ?> - <?php $available = 'related-available'; ?> - <?php endif; ?> - <?php endif; ?> - <?php if ($type == 'related' || $type == 'upsell'): ?> - <li class="item product product-item" style="display: none;"> - <?php else: ?> - <li class="item product product-item"> + <?php else :?> + <div class="block <?= $block->escapeHtmlAttr($class) ?>"> + <?php endif; ?> + <div class="block-title title"> + <strong id="block-<?= $block->escapeHtmlAttr($class) ?>-heading" role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> + </div> + <div class="block-content content" aria-labelledby="block-<?= $block->escapeHtmlAttr($class) ?>-heading"> + <?php if ($type == 'related' && $canItemsAddToCart) :?> + <div class="block-actions"> + <?= $block->escapeHtml(__('Check items to add to the cart or')) ?> + <button type="button" class="action select" role="button"><span><?= $block->escapeHtml(__('select all')) ?></span></button> + </div> <?php endif; ?> - <div class="product-item-info <?= /* @escapeNotVerified */ $available ?>"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product photo product-item-photo"> - <?= $block->getImage($_item, $image)->toHtml() ?> - </a> - <div class="product details product-item-details"> - <strong class="product name product-item-name"><a class="product-item-link" title="<?= $block->escapeHtml($_item->getName()) ?>" href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>"> - <?= $block->escapeHtml($_item->getName()) ?></a> - </strong> - - <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?> - - <?php if ($templateType): ?> - <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> - <?php endif; ?> - - <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> - <?php if (!$_item->getRequiredOptions()): ?> - <div class="field choice related"> - <input type="checkbox" class="checkbox related" id="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>" name="related_products[]" value="<?= /* @escapeNotVerified */ $_item->getId() ?>" /> - <label class="label" for="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>"><span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span></label> - </div> + <div class="products wrapper grid products-grid products-<?= $block->escapeHtmlAttr($type) ?>"> + <ol class="products list items product-items"> + <?php foreach ($items as $_item) :?> + <?php $available = ''; ?> + <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> + <?php if (!$_item->getRequiredOptions()) :?> + <?php $available = 'related-available'; ?> <?php endif; ?> <?php endif; ?> + <?php if ($type == 'related' || $type == 'upsell') :?> + <li class="item product product-item" style="display: none;"> + <?php else :?> + <li class="item product product-item"> + <?php endif; ?> + <div class="product-item-info <?= /* @noEscape */ $available ?>"> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product photo product-item-photo"> + <?= $block->getImage($_item, $image)->toHtml() ?> + </a> + <div class="product details product-item-details"> + <strong class="product name product-item-name"><a class="product-item-link" title="<?= $block->escapeHtml($_item->getName()) ?>" href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"> + <?= $block->escapeHtml($_item->getName()) ?></a> + </strong> + + <?= /* @noEscape */ $block->getProductPrice($_item) ?> + + <?php if ($templateType) :?> + <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> + <?php endif; ?> - <?php if ($showAddTo || $showCart): ?> - <div class="product actions product-item-actions"> - <?php if ($showCart): ?> - <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> - <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> - </button> - <?php else: ?> - <?php $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> - </button> - <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> - <?php endif; ?> - <?php endif; ?> - </div> + <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related') :?> + <?php if (!$_item->getRequiredOptions()) :?> + <div class="field choice related"> + <input type="checkbox" class="checkbox related" id="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>" name="related_products[]" value="<?= $block->escapeHtmlAttr($_item->getId()) ?>" /> + <label class="label" for="related-checkbox<?= $block->escapeHtmlAttr($_item->getId()) ?>"><span><?= $block->escapeHtml(__('Add to Cart')) ?></span></label> + </div> + <?php endif; ?> <?php endif; ?> - <?php if ($showAddTo): ?> - <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> - <?php if ($addToBlock = $block->getChildBlock('addto')): ?> - <?= $addToBlock->setProduct($_item)->getChildHtml() ?> + <?php if ($showAddTo || $showCart) :?> + <div class="product actions product-item-actions"> + <?php if ($showCart) :?> + <div class="actions-primary"> + <?php if ($_item->isSaleable()) :?> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) :?> + <button class="action tocart primary" data-mage-init='{"redirectUrl": {"url": "<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> + </button> + <?php else :?> + <?php $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_item)), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart primary" + data-post='<?= /* @noEscape */ $postData ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> + </button> + <?php endif; ?> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> + <?php endif; ?> + <?php endif; ?> + </div> + <?php endif; ?> + + <?php if ($showAddTo) :?> + <div class="secondary-addto-links actions-secondary" data-role="add-to-links"> + <?php if ($addToBlock = $block->getChildBlock('addto')) :?> + <?= $addToBlock->setProduct($_item)->getChildHtml() ?> + <?php endif; ?> + </div> <?php endif; ?> </div> <?php endif; ?> </div> - <?php endif; ?> - </div> - </div> - </li> - <?php endforeach ?> - </ol> + </div> + </li> + <?php endforeach ?> + </ol> + </div> + </div> </div> - </div> -</div> -<?php endif;?> + <?php endif;?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml index 02a6e999ad51f..b2ae8b9f7ab13 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,11 +10,13 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; + +// phpcs:disable Magento2.Security.IncludeFile.FoundIncludeFile +// phpcs:disable PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket ?> -<?php if ($block->getCollection()->getSize()): ?> - <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'> - <?php if ($block->isExpanded()): ?> +<?php if ($block->getCollection()->getSize()) :?> + <div class="toolbar toolbar-products" data-mage-init='<?= /* @noEscape */ $block->getWidgetOptionsJson() ?>'> + <?php if ($block->isExpanded()) :?> <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?> <?php endif; ?> @@ -27,7 +26,7 @@ use Magento\Catalog\Model\Product\ProductList\Toolbar; <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?> - <?php if ($block->isExpanded()): ?> + <?php if ($block->isExpanded()) :?> <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml index b4ff1afa1c606..a8f504d6a4f17 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/amount.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,19 +10,27 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <p class="toolbar-amount" id="toolbar-amount"> - <?php if ($block->getLastPageNum() > 1): ?> - <?php /* @escapeNotVerified */ echo __('Items %1-%2 of %3', - '<span class="toolbar-number">' . $block->getFirstNum() . '</span>', - '<span class="toolbar-number">' . $block->getLastNum() . '</span>', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> - <?php elseif ($block->getTotalNum() == 1): ?> - <?php /* @escapeNotVerified */ echo __('%1 Item', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> - <?php else: ?> - <?php /* @escapeNotVerified */ echo __('%1 Items', - '<span class="toolbar-number">' . $block->getTotalNum() . '</span>') ?> + <?php if ($block->getLastPageNum() > 1) :?> + <?= $block->escapeHtml( + __( + 'Items %1-%2 of %3', + '<span class="toolbar-number">' . $block->getFirstNum() . '</span>', + '<span class="toolbar-number">' . $block->getLastNum() . '</span>', + '<span class="toolbar-number">' . $block->getTotalNum() . '</span>' + ), + ['span'] + ) ?> + <?php elseif ($block->getTotalNum() == 1) :?> + <?= $block->escapeHtml( + __('%1 Item', '<span class="toolbar-number">' . $block->getTotalNum() . '</span>'), + ['span'] + ) ?> + <?php else :?> + <?= $block->escapeHtml( + __('%1 Items', '<span class="toolbar-number">' . $block->getTotalNum() . '</span>'), + ['span'] + ) ?> <?php endif; ?> </p> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml index ec4541bde5ca6..4ded219748c64 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,21 +10,22 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <div class="field limiter"> <label class="label" for="limiter"> - <span><?= /* @escapeNotVerified */ __('Show') ?></span> + <span><?= $block->escapeHtml(__('Show')) ?></span> </label> <div class="control"> <select id="limiter" data-role="limiter" class="limiter-options"> - <?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?> - <option value="<?= /* @escapeNotVerified */ $_key ?>"<?php if ($block->isLimitCurrent($_key)): ?> - selected="selected"<?php endif ?>> - <?= /* @escapeNotVerified */ $_limit ?> + <?php foreach ($block->getAvailableLimit() as $_key => $_limit) :?> + <option value="<?= $block->escapeHtmlAttr($_key) ?>" + <?php if ($block->isLimitCurrent($_key)) :?> + selected="selected" + <?php endif ?>> + <?= $block->escapeHtml($_limit) ?> </option> <?php endforeach; ?> </select> </div> - <span class="limiter-text"><?= /* @escapeNotVerified */ __('per page') ?></span> + <span class="limiter-text"><?= $block->escapeHtml(__('per page')) ?></span> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml index 92514c5b8ea50..58dde199998bc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/sorter.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,14 +10,13 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> <div class="toolbar-sorter sorter"> - <label class="sorter-label" for="sorter"><?= /* @escapeNotVerified */ __('Sort By') ?></label> + <label class="sorter-label" for="sorter"><?= $block->escapeHtml(__('Sort By')) ?></label> <select id="sorter" data-role="sorter" class="sorter-options"> - <?php foreach ($block->getAvailableOrders() as $_key => $_order): ?> - <option value="<?= /* @escapeNotVerified */ $_key ?>" - <?php if ($block->isOrderCurrent($_key)): ?> + <?php foreach ($block->getAvailableOrders() as $_key => $_order) :?> + <option value="<?= $block->escapeHtmlAttr($_key) ?>" + <?php if ($block->isOrderCurrent($_key)) :?> selected="selected" <?php endif; ?> > @@ -28,13 +24,21 @@ use Magento\Catalog\Model\Product\ProductList\Toolbar; </option> <?php endforeach; ?> </select> - <?php if ($block->getCurrentDirection() == 'desc'): ?> - <a title="<?= /* @escapeNotVerified */ __('Set Ascending Direction') ?>" href="#" class="action sorter-action sort-desc" data-role="direction-switcher" data-value="asc"> - <span><?= /* @escapeNotVerified */ __('Set Ascending Direction') ?></span> + <?php if ($block->getCurrentDirection() == 'desc') :?> + <a title="<?= $block->escapeHtmlAttr(__('Set Ascending Direction')) ?>" + href="#" + class="action sorter-action sort-desc" + data-role="direction-switcher" + data-value="asc"> + <span><?= $block->escapeHtml(__('Set Ascending Direction')) ?></span> </a> - <?php else: ?> - <a title="<?= /* @escapeNotVerified */ __('Set Descending Direction') ?>" href="#" class="action sorter-action sort-asc" data-role="direction-switcher" data-value="desc"> - <span><?= /* @escapeNotVerified */ __('Set Descending Direction') ?></span> + <?php else :?> + <a title="<?= $block->escapeHtmlAttr(__('Set Descending Direction')) ?>" + href="#" + class="action sorter-action sort-asc" + data-role="direction-switcher" + data-value="desc"> + <span><?= $block->escapeHtml(__('Set Descending Direction')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml index 366dfba71b0d1..955897f315d6f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,32 +10,31 @@ * * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ -use Magento\Catalog\Model\Product\ProductList\Toolbar; ?> -<?php if ($block->isEnabledViewSwitcher()): ?> -<div class="modes"> - <?php $_modes = $block->getModes(); ?> - <?php if ($_modes && count($_modes) > 1): ?> - <strong class="modes-label" id="modes-label"><?= /* @escapeNotVerified */ __('View as') ?></strong> - <?php foreach ($block->getModes() as $_code => $_label): ?> - <?php if ($block->isModeActive($_code)): ?> - <strong title="<?= /* @escapeNotVerified */ $_label ?>" - class="modes-mode active mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - data-value="<?= /* @escapeNotVerified */ strtolower($_code) ?>"> - <span><?= /* @escapeNotVerified */ $_label ?></span> - </strong> - <?php else: ?> - <a class="modes-mode mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - title="<?= /* @escapeNotVerified */ $_label ?>" - href="#" - data-role="mode-switcher" - data-value="<?= /* @escapeNotVerified */ strtolower($_code) ?>" - id="mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>" - aria-labelledby="modes-label mode-<?= /* @escapeNotVerified */ strtolower($_code) ?>"> - <span><?= /* @escapeNotVerified */ $_label ?></span> - </a> - <?php endif; ?> - <?php endforeach; ?> - <?php endif; ?> -</div> +<?php if ($block->isEnabledViewSwitcher()) :?> + <div class="modes"> + <?php $_modes = $block->getModes(); ?> + <?php if ($_modes && count($_modes) > 1) :?> + <strong class="modes-label" id="modes-label"><?= $block->escapeHtml(__('View as')) ?></strong> + <?php foreach ($block->getModes() as $_code => $_label) :?> + <?php if ($block->isModeActive($_code)) :?> + <strong title="<?= $block->escapeHtmlAttr($_label) ?>" + class="modes-mode active mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"> + <span><?= $block->escapeHtml($_label) ?></span> + </strong> + <?php else :?> + <a class="modes-mode mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + title="<?= $block->escapeHtmlAttr($_label) ?>" + href="#" + data-role="mode-switcher" + data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + id="mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>" + aria-labelledby="modes-label mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"> + <span><?= $block->escapeHtml($_label) ?></span> + </a> + <?php endif; ?> + <?php endforeach; ?> + <?php endif; ?> + </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml index f2d5e40cca4e5..b776fd4f7e193 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml @@ -3,28 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput + /** * Product list template * - * @see \Magento\Catalog\Block\Product\ListProduct + * @var $block \Magento\Catalog\Block\Product\ListProduct */ ?> <?php $start = microtime(true); $_productCollection = $block->getLoadedProductCollection(); -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> -<?php if (!$_productCollection->count()): ?> -<p class="message note"><?= /* @escapeNotVerified */ __('We can\'t find products matching the selection.') ?></p> -<?php else: ?> -<?= $block->getToolbarHtml() ?> -<?= $block->getAdditionalHtml() ?> -<?php +<?php if (!$_productCollection->count()) :?> + <p class="message note"><?= $block->escapeHtml(__('We can\'t find products matching the selection.')) ?></p> +<?php else :?> + <?= $block->getToolbarHtml() ?> + <?= $block->getAdditionalHtml() ?> + <?php if ($block->getMode() == 'grid') { $viewMode = 'grid'; $image = 'category_page_grid'; @@ -36,65 +37,65 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); $showDescription = true; $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW; } -?> -<div class="products wrapper <?= /* @escapeNotVerified */ $viewMode ?>"> - <ol class="products list items"> - <?php foreach ($_productCollection as $_product): ?> - <li class="item product"> - <div class="product"> - <?php // Product Image ?> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product photo"> - <?= $block->getImage($_product, $image)->toHtml() ?> - </a> - <div class="product details"> - <?php + ?> + <div class="products wrapper <?= /* @noEscape */ $viewMode ?>"> + <ol class="products list items"> + <?php foreach ($_productCollection as $_product) :?> + <li class="item product"> + <div class="product"> + <?php // Product Image ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" class="product photo"> + <?= $block->getImage($_product, $image)->toHtml() ?> + </a> + <div class="product details"> + <?php - $info = []; - $info['name'] = '<strong class="product name">' - . ' <a href="' . $_product->getProductUrl() . '" title="' - . $block->stripTags($_product->getName(), null, true) . '">' - . $_helper->productAttribute($_product, $_product->getName(), 'name') - . '</a></strong>'; - $info['price'] = $block->getProductPrice($_product); - $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); + $info = []; + $info['name'] = '<strong class="product name">' + . ' <a href="' . $block->escapeUrl($_product->getProductUrl()) . '" title="' + . $block->stripTags($_product->getName(), null, true) . '">' + . $_helper->productAttribute($_product, $_product->getName(), 'name') + . '</a></strong>'; + $info['price'] = $block->getProductPrice($_product); + $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); - if ($_product->isSaleable()) { - $info['button'] = '<button type="button" title="' . __('Add to Cart') . '" class="action tocart"' - . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->getAddToCartUrl($_product) . '"} }\'>' - . '<span>' . __('Add to Cart') . '</span></button>'; - } else { - $info['button'] = $_product->getIsSalable() ? '<div class="stock available"><span>' . __('In stock') . '</span></div>' : - '<div class="stock unavailable"><span>' . __('Out of stock') . '</span></div>'; - } + if ($_product->isSaleable()) { + $info['button'] = '<button type="button" title="' . $block->escapeHtmlAttr(__('Add to Cart')) . '" class="action tocart"' + . ' data-mage-init=\'{ "redirectUrl": { "event": "click", url: "' . $block->escapeUrl($block->getAddToCartUrl($_product)) . '"} }\'>' + . '<span>' . $block->escapeHtml(__('Add to Cart')) . '</span></button>'; + } else { + $info['button'] = $_product->getIsSalable() ? '<div class="stock available"><span>' . $block->escapeHtml(__('In stock')) . '</span></div>' : + '<div class="stock unavailable"><span>' . $block->escapeHtml(__('Out of stock')) . '</span></div>'; + } - $info['links'] = '<div class="product links" data-role="add-to-links">' - . '<a href="#" data-post=\'' . $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) . '\' class="action towishlist" data-action="add-to-wishlist">' - . '<span>' . __('Add to Wish List') . '</span></a>' - . '<a href="' . $block->getAddToCompareUrl($_product) . '" class="action tocompare">' - . '<span>' . __('Add to Compare') . '</span></a></div>'; - $info['actions'] = '<div class="product action">' . $info['button'] . $info['links'] . '</div>'; + $info['links'] = '<div class="product links" data-role="add-to-links">' + . '<a href="#" data-post=\'' . $this->helper(Magento\Wishlist\Helper\Data::class)->getAddParams($_product) . '\' class="action towishlist" data-action="add-to-wishlist">' + . '<span>' . $block->escapeHtml(__('Add to Wish List')) . '</span></a>' + . '<a href="' . $block->escapeUrl($block->getAddToCompareUrl($_product)) . '" class="action tocompare">' + . '<span>' . $block->escapeHtml(__('Add to Compare')) . '</span></a></div>'; + $info['actions'] = '<div class="product action">' . $info['button'] . $info['links'] . '</div>'; - if ($showDescription) { - $info['description'] = '<div class="product description">' - . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') - . ' <a href="' . $_product->getProductUrl() . '" class="action more">' - . __('Learn More') . '</a></div>'; - } else { - $info['description'] = ''; - } + if ($showDescription) { + $info['description'] = '<div class="product description">' + . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') + . ' <a href="' . $block->escapeUrl($_product->getProductUrl()) . '" class="action more">' + . $block->escapeHtml(__('Learn More')) . '</a></div>'; + } else { + $info['description'] = ''; + } - $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; - foreach ($details as $detail) { - /* @escapeNotVerified */ echo $info[$detail]; - } - ?> + $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; + foreach ($details as $detail) { + /* @noEscape */ echo $info[$detail]; + } + ?> + </div> </div> - </div> - </li> - <?php endforeach; ?> - </ol> -</div> -<?= $block->getToolbarHtml() ?> + </li> + <?php endforeach; ?> + </ol> + </div> + <?= $block->getToolbarHtml() ?> <?php endif; ?> -<?= /* @escapeNotVerified */ $time_taken = microtime(true) - $start ?> +<?= $time_taken = microtime(true) - $start ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml index 2d89e24cc7aac..316fdb06592e2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/additional.phtml @@ -4,9 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Catalog\Block\Product\View\Additional */ ?> -<?php foreach ($block->getChildHtmlList() as $_html): ?> - <?= /* @escapeNotVerified */ $_html ?> +<?php foreach ($block->getChildHtmlList() as $_html) :?> + <?= /* @noEscape */ $_html ?> <?php endforeach; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml index 0893cfab0bbf8..1924175764555 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View*/ ?> <div class="product-addto-links" data-role="add-to-links"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml index 194a472d81d58..9183e65181c48 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto/compare.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View\Addto\Compare */ ?> <?php $viewModel = $block->getData('addToCompareViewModel'); ?> -<?php if ($viewModel->isAvailableForCompare($block->getProduct())): ?> -<a href="#" data-post='<?= /* @escapeNotVerified */ $block->getPostDataParams() ?>' +<?php if ($viewModel->isAvailableForCompare($block->getProduct())) :?> +<a href="#" data-post='<?= /* @noEscape */ $block->getPostDataParams() ?>' data-role="add-to-links" - class="action tocompare"><span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span></a> + class="action tocompare"><span><?= $block->escapeHtml(__('Add to Compare')) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml index 71452a2d65e97..f15824595f0ba 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml @@ -4,25 +4,23 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php $buttonTitle = __('Add to Cart'); ?> -<?php if ($_product->isSaleable()): ?> +<?php if ($_product->isSaleable()) :?> <div class="box-tocart"> <div class="fieldset"> - <?php if ($block->shouldRenderQuantity()): ?> + <?php if ($block->shouldRenderQuantity()) :?> <div class="field qty"> - <label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label> + <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label> <div class="control"> <input type="number" name="qty" id="qty" min="0" - value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>" - title="<?= /* @escapeNotVerified */ __('Qty') ?>" + value="<?= $block->getProductDefaultQty() * 1 ?>" + title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="input-text qty" data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" /> @@ -31,10 +29,10 @@ <?php endif; ?> <div class="actions"> <button type="submit" - title="<?= /* @escapeNotVerified */ $buttonTitle ?>" + title="<?= $block->escapeHtmlAttr($buttonTitle) ?>" class="action primary tocart" id="product-addtocart-button" disabled> - <span><?= /* @escapeNotVerified */ $buttonTitle ?></span> + <span><?= $block->escapeHtml($buttonTitle) ?></span> </button> <?= $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml index 86f97cf6f6aaf..2e022a5df14ed 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml @@ -4,16 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product view template * - * @see \Magento\Catalog\Block\Product\View\Description + * @var $block \Magento\Catalog\Block\Product\View\Description */ ?> <?php -$_helper = $this->helper('Magento\Catalog\Helper\Output'); +$_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_product = $block->getProduct(); $_call = $block->getAtCall(); $_code = $block->getAtCode(); @@ -32,15 +32,19 @@ if ($_attributeLabel && $_attributeLabel == 'default') { $_attributeLabel = $_product->getResource()->getAttribute($_code)->getStoreLabel(); } if ($_attributeType && $_attributeType == 'text') { - $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : ''; + $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) + ? $_product->getAttributeText($_code) + : ''; } else { $_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code); } ?> -<?php if ($_attributeValue): ?> -<div class="product attribute <?= /* @escapeNotVerified */ $_className ?>"> - <?php if ($renderLabel): ?><strong class="type"><?= /* @escapeNotVerified */ $_attributeLabel ?></strong><?php endif; ?> - <div class="value" <?= /* @escapeNotVerified */ $_attributeAddAttribute ?>><?= /* @escapeNotVerified */ $_attributeValue ?></div> +<?php if ($_attributeValue) :?> +<div class="product attribute <?= $block->escapeHtmlAttr($_className) ?>"> + <?php if ($renderLabel) :?> + <strong class="type"><?= $block->escapeHtml($_attributeLabel) ?></strong> + <?php endif; ?> + <div class="value" <?= /* @noEscape */ $_attributeAddAttribute ?>><?= /* @noEscape */ $_attributeValue ?></div> </div> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml index 1c4a37fedebe3..a4f0fb3efab9e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/attributes.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product additional attributes template @@ -13,18 +13,18 @@ */ ?> <?php - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $_product = $block->getProduct(); ?> -<?php if ($_additional = $block->getAdditionalData()): ?> +<?php if ($_additional = $block->getAdditionalData()) :?> <div class="additional-attributes-wrapper table-wrapper"> <table class="data table additional-attributes" id="product-attribute-specs-table"> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('More Information') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('More Information')) ?></caption> <tbody> - <?php foreach ($_additional as $_data): ?> + <?php foreach ($_additional as $_data) :?> <tr> <th class="col label" scope="row"><?= $block->escapeHtml($_data['label']) ?></th> - <td class="col data" data-th="<?= $block->escapeHtml($_data['label']) ?>"><?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> + <td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> </tr> <?php endforeach; ?> </tbody> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml index 4414214f99a6e..a4aa675b2c346 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/counter.phtml @@ -13,7 +13,7 @@ { "*": { "Magento_Catalog/js/product/view/provider": { - "data": <?= /* @escapeNotVerified */ $block->getCurrentProductData() ?> + "data": <?= /* @noEscape */ $block->getCurrentProductData() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml index b5cdd1a2a31ba..c08c4d771b34a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/description.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product description template @@ -12,4 +12,8 @@ * @var $block \Magento\Catalog\Block\Product\View\Description */ ?> -<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description') ?> +<?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute( + $block->getProduct(), + $block->getProduct()->getDescription(), + 'description' +) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml index 57eabbf1d8c8a..d25b19ee217f0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml @@ -4,36 +4,34 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Catalog\Block\Product\View\Details $block */ ?> -<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')):?> +<?php if ($detailedInfoGroup = $block->getGroupSortedChildNames('detailed_info', 'getChildHtml')) :?> <div class="product info detailed"> <?php $layout = $block->getLayout(); ?> <div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'> - <?php foreach ($detailedInfoGroup as $name):?> + <?php foreach ($detailedInfoGroup as $name) :?> <?php - $html = $layout->renderElement($name); - if (!trim($html)) { - continue; - } - $alias = $layout->getElementAlias($name); - $label = $block->getChildData($alias, 'title'); + $html = $layout->renderElement($name); + if (!trim($html)) { + continue; + } + $alias = $layout->getElementAlias($name); + $label = $block->getChildData($alias, 'title'); ?> <div class="data item title" - data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>"> + data-role="collapsible" id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>"> <a class="data switch" tabindex="-1" data-toggle="trigger" - href="#<?= /* @escapeNotVerified */ $alias ?>" - id="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"> - <?= /* @escapeNotVerified */ $label ?> + href="#<?= $block->escapeUrl($alias) ?>" + id="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title"> + <?= $block->escapeHtml($label) ?> </a> </div> - <div class="data item content" - aria-labelledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title" id="<?= /* @escapeNotVerified */ $alias ?>" data-role="content"> - <?= /* @escapeNotVerified */ $html ?> + <div class="data item content" + aria-labelledby="tab-label-<?= $block->escapeHtmlAttr($alias) ?>-title" id="<?= $block->escapeHtmlAttr($alias) ?>" data-role="content"> + <?= /* @noEscape */ $html ?> </div> <?php endforeach;?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml index 9c5cce7865532..8d298aec9f1cb 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** * Product view template @@ -12,28 +12,28 @@ * @var $block \Magento\Catalog\Block\Product\View */ ?> -<?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> +<?php $_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?> <?php $_product = $block->getProduct(); ?> <div class="product-add-form"> <form data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" - action="<?= /* @NoEscape */ $block->getSubmitUrl($_product) ?>" method="post" - id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> - <input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $_product->getId() ?>" /> + action="<?= $block->escapeUrl($block->getSubmitUrl($_product)) ?>" method="post" + id="product_addtocart_form"<?php if ($_product->getOptions()) :?> enctype="multipart/form-data"<?php endif; ?>> + <input type="hidden" name="product" value="<?= (int)$_product->getId() ?>" /> <input type="hidden" name="selected_configurable_option" value="" /> <input type="hidden" name="related_product" id="related-products-field" value="" /> - <input type="hidden" name="item" value="<?= /* @noEscape */ $block->getRequest()->getParam('id') ?>" /> + <input type="hidden" name="item" value="<?= $block->escapeHtmlAttr($block->getRequest()->getParam('id')) ?>" /> <?= $block->getBlockHtml('formkey') ?> <?= $block->getChildHtml('form_top') ?> - <?php if (!$block->hasOptions()):?> + <?php if (!$block->hasOptions()) :?> <?= $block->getChildHtml('product_info_form_content') ?> - <?php else:?> - <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?> + <?php else :?> + <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1') :?> <?= $block->getChildChildHtml('options_container') ?> <?php endif;?> <?php endif; ?> - <?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'):?> + <?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2') :?> <?= $block->getChildChildHtml('options_container') ?> <?php endif;?> <?= $block->getChildHtml('form_bottom') ?> @@ -52,6 +52,6 @@ return !$(elem).find('.price-from').length; }); - priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>}); + priceBoxes.priceBox({'priceConfig': <?= /* @noEscape */ $block->getJsonConfig() ?>}); }); </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml index 1f06b90758d0b..4b33864aef47a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Product media data template * @@ -14,19 +12,19 @@ ?> <?php - $images = $block->getGalleryImages()->getItems(); - $mainImage = current(array_filter($images, function ($img) use ($block) { - return $block->isMainImage($img); - })); +$images = $block->getGalleryImages()->getItems(); +$mainImage = current(array_filter($images, function ($img) use ($block) { + return $block->isMainImage($img); +})); - if (!empty($images) && empty($mainImage)) { - $mainImage = $block->getGalleryImages()->getFirstItem(); - } +if (!empty($images) && empty($mainImage)) { + $mainImage = $block->getGalleryImages()->getFirstItem(); +} - $helper = $block->getData('imageHelper'); - $mainImageData = $mainImage ? - $mainImage->getData('medium_image_url') : - $helper->getDefaultPlaceholderUrl('image'); +$helper = $block->getData('imageHelper'); +$mainImageData = $mainImage ? + $mainImage->getData('medium_image_url') : + $helper->getDefaultPlaceholderUrl('image'); ?> @@ -43,11 +41,11 @@ "[data-gallery-role=gallery-placeholder]": { "mage/gallery/gallery": { "mixins":["magnifier/magnify"], - "magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>, - "data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>, + "magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>, + "data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>, "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>, "fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>, - "breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?> + "breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?> } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml index d52b594ededdf..f57c9b68ddbd2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/mailto.phtml @@ -4,11 +4,10 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php $_product = $block->getProduct() ?> -<?php if ($block->canEmailToFriend()): ?> - <a href="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product')->getEmailToFriendUrl($_product) ?>" - class="action mailto friend"><span><?= /* @escapeNotVerified */ __('Email') ?></span></a> +<?php if ($block->canEmailToFriend()) :?> + <a href="<?= $block->escapeUrl($this->helper(Magento\Catalog\Helper\Product::class)->getEmailToFriendUrl($_product)) ?>" + class="action mailto friend"><span><?= $block->escapeHtml(__('Email')) ?></span></a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml index 87655797f40e5..7f14b71a60c7a 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/currency.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Directory\Block\Currency */ ?> -<meta property="product:price:currency" content="<?= /* @escapeNotVerified */ $block->stripTags($block->getCurrentCurrencyCode()) ?>"/> +<meta property="product:price:currency" + content="<?= /* @noEscape */ $block->stripTags($block->getCurrentCurrencyCode()) ?>"/> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml index 40f86c7e68d6c..eb2bde647f9b1 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml @@ -4,17 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View */ ?> <meta property="og:type" content="product" /> -<meta property="og:title" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" /> -<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> -<meta property="og:description" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" /> +<meta property="og:title" + content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getName()) ?>" /> +<meta property="og:image" + content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> +<meta property="og:description" + content="<?= /* @noEscape */ $block->stripTags($block->getProduct()->getShortDescription()) ?>" /> <meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" /> -<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()):?> - <meta property="product:price:amount" content="<?= /* @escapeNotVerified */ $priceAmount ?>"/> +<?php if ($priceAmount = $block->getProduct()->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)->getAmount()) :?> + <meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/> <?= $block->getChildHtml('meta.currency') ?> <?php endif;?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml index 3ebfa76860950..d9a0c845b9f83 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml @@ -4,26 +4,24 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Catalog\Block\Product\View\Options */ ?> <?php $_options = $block->decorateArray($block->getOptions()) ?> <?php $_productId = $block->getProduct()->getId() ?> -<?php if (count($_options)):?> +<?php if (count($_options)) :?> <script type="text/x-magento-init"> { "#product_addtocart_form": { "priceOptions": { - "optionConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>, + "optionConfig": <?= /* @noEscape */ $block->getJsonConfig() ?>, "controlContainer": ".field", "priceHolderSelector": "[data-product-id='<?= $block->escapeHtml($_productId) ?>'][data-role=priceBox]" } } } </script> - <?php foreach ($_options as $_option): ?> + <?php foreach ($_options as $_option) :?> <?= $block->getOptionHtml($_option) ?> <?php endforeach; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml index 66895fa1eabf9..b7cd64277fe40 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml @@ -3,46 +3,43 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?> <?php $_option = $block->getOption() ?> -<?php $_optionId = $_option->getId() ?> +<?php $_optionId = $block->escapeHtmlAttr($_option->getId()) ?> <?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field date<?= /* @escapeNotVerified */ $class ?>" +<div class="field date<?= /* @noEscape */ $class ?>" data-mage-init='{"priceOptionDate":{"fromSelector":"#product_addtocart_form"}}'> - <fieldset class="fieldset fieldset-product-options-inner<?= /* @escapeNotVerified */ $class ?>"> + <fieldset class="fieldset fieldset-product-options-inner<?= /* @noEscape */ $class ?>"> <legend class="legend"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </legend> <div class="control"> <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE): ?> + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE) :?> <?= $block->getDateHtml() ?> <?php endif; ?> <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME - || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME): ?> + || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_TIME) :?> <?= $block->getTimeHtml() ?> <?php endif; ?> - <?php if ($_option->getIsRequire()): ?> + <?php if ($_option->getIsRequire()) :?> <input type="hidden" - name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" - class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" value="" - data-validate="{'validate-required-datetime':<?= /* @escapeNotVerified */ $_optionId ?>}"/> - <?php else: ?> + data-validate="{'validate-required-datetime':<?= /* @noEscape */ $_optionId ?>}"/> + <?php else :?> <input type="hidden" - name="validate_datetime_<?= /* @escapeNotVerified */ $_optionId ?>" - class="validate-datetime-<?= /* @escapeNotVerified */ $_optionId ?>" + name="validate_datetime_<?= /* @noEscape */ $_optionId ?>" + class="validate-datetime-<?= /* @noEscape */ $_optionId ?>" value="" - data-validate="{'validate-optional-datetime':<?= /* @escapeNotVerified */ $_optionId ?>}"/> + data-validate="{'validate-optional-datetime':<?= /* @noEscape */ $_optionId ?>}"/> <?php endif; ?> <script type="text/x-magento-init"> { diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml index 2006bf6e9f414..c25dab8b70a5c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/default.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php $_option = $block->getOption() ?> <div class="field"> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml index adb729c6d86ec..e83e55ad2a03c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/file.phtml @@ -3,65 +3,62 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?> <?php $_option = $block->getOption(); ?> <?php $_fileInfo = $block->getFileInfo(); ?> <?php $_fileExists = $_fileInfo->hasData(); ?> -<?php $_fileName = 'options_' . $_option->getId() . '_file'; ?> +<?php $_fileName = 'options_' . $block->escapeHtmlAttr($_option->getId()) . '_file'; ?> <?php $_fieldNameAction = $_fileName . '_action'; ?> <?php $_fieldValueAction = $_fileExists ? 'save_old' : 'save_new'; ?> <?php $_fileNamed = $_fileName . '_name'; ?> <?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field file<?= /* @escapeNotVerified */ $class ?>"> +<div class="field file<?= /* @noEscape */ $class ?>"> <label class="label" for="<?= /* @noEscape */ $_fileName ?>" id="<?= /* @noEscape */ $_fileName ?>-label"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> - <?php if ($_fileExists): ?> + <?php if ($_fileExists) :?> <div class="control"> <span class="<?= /* @noEscape */ $_fileNamed ?>"><?= $block->escapeHtml($_fileInfo->getTitle()) ?></span> <a href="javascript:void(0)" class="label" id="change-<?= /* @noEscape */ $_fileName ?>" > - <?= /* @escapeNotVerified */ __('Change') ?> + <?= $block->escapeHtml(__('Change')) ?> </a> - <?php if (!$_option->getIsRequire()): ?> - <input type="checkbox" id="delete-<?= /* @escapeNotVerified */ $_fileName ?>" /> - <span class="label"><?= /* @escapeNotVerified */ __('Delete') ?></span> + <?php if (!$_option->getIsRequire()) :?> + <input type="checkbox" id="delete-<?= /* @noEscape */ $_fileName ?>" /> + <span class="label"><?= $block->escapeHtml(__('Delete')) ?></span> <?php endif; ?> </div> <?php endif; ?> - <div class="control" id="input-box-<?= /* @escapeNotVerified */ $_fileName ?>" + <div class="control" id="input-box-<?= /* @noEscape */ $_fileName ?>" data-mage-init='{"priceOptionFile":{ "fileName":"<?= /* @noEscape */ $_fileName ?>", "fileNamed":"<?= /* @noEscape */ $_fileNamed ?>", - "fieldNameAction":"<?= /* @escapeNotVerified */ $_fieldNameAction ?>", - "changeFileSelector":"#change-<?= /* @escapeNotVerified */ $_fileName ?>", - "deleteFileSelector":"#delete-<?= /* @escapeNotVerified */ $_fileName ?>"} + "fieldNameAction":"<?= /* @noEscape */ $_fieldNameAction ?>", + "changeFileSelector":"#change-<?= /* @noEscape */ $_fileName ?>", + "deleteFileSelector":"#delete-<?= /* @noEscape */ $_fileName ?>"} }' <?= $_fileExists ? 'style="display:none"' : '' ?>> <input type="file" - name="<?= /* @escapeNotVerified */ $_fileName ?>" - id="<?= /* @escapeNotVerified */ $_fileName ?>" + name="<?= /* @noEscape */ $_fileName ?>" + id="<?= /* @noEscape */ $_fileName ?>" class="product-custom-option<?= $_option->getIsRequire() ? ' required' : '' ?>" - <?= $_fileExists ? 'disabled="disabled"' : '' ?> /> - <input type="hidden" name="<?= /* @escapeNotVerified */ $_fieldNameAction ?>" value="<?= /* @escapeNotVerified */ $_fieldValueAction ?>" /> - <?php if ($_option->getFileExtension()): ?> + <?= $_fileExists ? 'disabled="disabled"' : '' ?> /> + <input type="hidden" name="<?= /* @noEscape */ $_fieldNameAction ?>" value="<?= /* @noEscape */ $_fieldValueAction ?>" /> + <?php if ($_option->getFileExtension()) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Compatible file extensions to upload') ?>: <strong><?= /* @escapeNotVerified */ $_option->getFileExtension() ?></strong> + <?= $block->escapeHtml(__('Compatible file extensions to upload')) ?>: <strong><?= $block->escapeHtml($_option->getFileExtension()) ?></strong> </p> <?php endif; ?> - <?php if ($_option->getImageSizeX() > 0): ?> + <?php if ($_option->getImageSizeX() > 0) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Maximum image width') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeX() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong> + <?= $block->escapeHtml(__('Maximum image width')) ?>: <strong><?= (int)$_option->getImageSizeX() ?> <?= $block->escapeHtml(__('px.')) ?></strong> </p> <?php endif; ?> - <?php if ($_option->getImageSizeY() > 0): ?> + <?php if ($_option->getImageSizeY() > 0) :?> <p class="note"> - <?= /* @escapeNotVerified */ __('Maximum image height') ?>: <strong><?= /* @escapeNotVerified */ $_option->getImageSizeY() ?> <?= /* @escapeNotVerified */ __('px.') ?></strong> + <?= $block->escapeHtml(__('Maximum image height')) ?>: <strong><?= (int)$_option->getImageSizeY() ?> <?= $block->escapeHtml(__('px.')) ?></strong> </p> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml index 980b78f917cf2..c4c1d24423bb0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/select.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?> @@ -13,15 +10,15 @@ $_option = $block->getOption(); $class = ($_option->getIsRequire()) ? ' required' : ''; ?> -<div class="field<?= /* @escapeNotVerified */ $class ?>"> - <label class="label" for="select_<?= /* @escapeNotVerified */ $_option->getId() ?>"> +<div class="field<?= /* @noEscape */ $class ?>"> + <label class="label" for="select_<?= $block->escapeHtmlAttr($_option->getId()) ?>"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> </label> <div class="control"> <?= $block->getValuesHtml() ?> - <?php if ($_option->getIsRequire()): ?> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX): ?> - <span id="options-<?= /* @escapeNotVerified */ $_option->getId() ?>-container"></span> + <?php if ($_option->getIsRequire()) :?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_CHECKBOX) :?> + <span id="options-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></span> <?php endif; ?> <?php endif;?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml index a04e366a43a2d..dd4c000d1f338 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?> <?php @@ -15,14 +12,14 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; <div class="field<?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) { echo ' textarea'; -} ?><?= /* @escapeNotVerified */ $class ?>"> - <label class="label" for="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text"> +} ?><?= /* @noEscape */ $class ?>"> + <label class="label" for="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text"> <span><?= $block->escapeHtml($_option->getTitle()) ?></span> - <?= /* @escapeNotVerified */ $block->getFormattedPrice() ?> + <?= /* @noEscape */ $block->getFormattedPrice() ?> </label> <div class="control"> - <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD): ?> + <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_FIELD) :?> <?php $_textValidate = null; if ($_option->getIsRequire()) { $_textValidate['required'] = true; @@ -33,15 +30,15 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; $_textValidate['validate-no-utf8mb4-characters'] = true; ?> <input type="text" - id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" + id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" class="input-text product-custom-option" - <?php if (!empty($_textValidate)) {?> - data-validate="<?= $block->escapeHtml(json_encode($_textValidate)) ?>" - <?php } ?> - name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" + <?php if (!empty($_textValidate)) {?> + data-validate="<?= $block->escapeHtml(json_encode($_textValidate)) ?>" + <?php } ?> + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" value="<?= $block->escapeHtml($block->getDefaultValue()) ?>"/> - <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA): ?> + <?php elseif ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_AREA) :?> <?php $_textAreaValidate = null; if ($_option->getIsRequire()) { $_textAreaValidate['required'] = true; @@ -51,31 +48,31 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; } $_textAreaValidate['validate-no-utf8mb4-characters'] = true; ?> - <textarea id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" + <textarea id="options_<?= $block->escapeHtmlAttr($_option->getId()) ?>_text" class="product-custom-option" <?php if (!empty($_textAreaValidate)) {?> data-validate="<?= $block->escapeHtml(json_encode($_textAreaValidate)) ?>" <?php } ?> - name="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" - data-selector="options[<?= /* @escapeNotVerified */ $_option->getId() ?>]" + name="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" + data-selector="options[<?= $block->escapeHtmlAttr($_option->getId()) ?>]" rows="5" cols="25"><?= $block->escapeHtml($block->getDefaultValue()) ?></textarea> <?php endif; ?> - <?php if ($_option->getMaxCharacters()): ?> - <p class="note note_<?= /* @escapeNotVerified */ $_option->getId() ?>"> - <?= /* @escapeNotVerified */ __('Maximum %1 characters', $_option->getMaxCharacters()) ?> + <?php if ($_option->getMaxCharacters()) :?> + <p class="note note_<?= $block->escapeHtmlAttr($_option->getId()) ?>"> + <?= $block->escapeHtml(__('Maximum %1 characters', $_option->getMaxCharacters())) ?> <span class="character-counter no-display"></span> </p> <?php endif; ?> </div> - <?php if ($_option->getMaxCharacters()): ?> + <?php if ($_option->getMaxCharacters()) :?> <script type="text/x-magento-init"> { - "[data-selector='options[<?= /* @escapeNotVerified */ $_option->getId() ?>]']": { + "[data-selector='options[<?= $block->escapeJs($_option->getId()) ?>]']": { "Magento_Catalog/js/product/remaining-characters": { - "maxLength": "<?= /* @escapeNotVerified */ $_option->getMaxCharacters() ?>", - "noteSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?>", - "counterSelector": ".note_<?= /* @escapeNotVerified */ $_option->getId() ?> .character-counter" + "maxLength": "<?= (int)$_option->getMaxCharacters() ?>", + "noteSelector": ".note_<?= $block->escapeJs($_option->getId()) ?>", + "counterSelector": ".note_<?= $block->escapeJs($_option->getId()) ?> .character-counter" } } } diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml index ca6960a215a7a..88ee45bafe731 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper.phtml @@ -3,14 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** @var $block Magento\Catalog\Block\Product\View */ ?> <?php $required = ''; if ($block->hasRequiredOptions()) { - $required = ' data-hasrequired="' . __('* Required Fields') . '"'; + $required = ' data-hasrequired="' . $block->escapeHtmlAttr(__('* Required Fields')) . '"'; } ?> -<div class="product-options-wrapper" id="product-options-wrapper"<?= /* @escapeNotVerified */ $required ?>> +<div class="product-options-wrapper" id="product-options-wrapper"<?= /* @noEscape */ $required ?>> <div class="fieldset" tabindex="0"> <?= $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml index e8c0b32fd7692..979bab167c344 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var \Magento\Catalog\Block\Product\AbstractProduct $block */ ?> <?php $_product = $block->getProduct() ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml index 5575d00df7457..5250673436648 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/review.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Catalog\Block\Product\AbstractProduct */ ?> <?= $block->getReviewsSummaryHtml($block->getProduct(), false, true) ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml index 7e522b4f88306..30edb2df03754 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/type/default.phtml @@ -3,21 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\AbstractView */?> <?php $_product = $block->getProduct() ?> -<?php if ($block->displayProductStockStatus()): ?> - <?php if ($_product->isAvailable()): ?> - <div class="stock available" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> +<?php if ($block->displayProductStockStatus()) :?> + <?php if ($_product->isAvailable()) :?> + <div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </div> - <?php else: ?> - <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else :?> + <div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml index e0550cc7d4414..a2187b685ca0e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/grid.phtml @@ -1,18 +1,16 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml index 3a4f81d946bfd..5c5f6493c3163 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/list.phtml @@ -3,16 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'widget_columns' => [ 'displayMode' => 'list' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml index 2d2c91aadd473..8db3cc80368e2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/compared/sidebar.phtml @@ -3,16 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml index 2ec671b8de3ab..69f0319134ea0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_block.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <div class="widget block block-product-link"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml index 373eda1117455..8d9f6500894b4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?> <span class="widget block block-product-link-inline"> - <a <?= /* @escapeNotVerified */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> + <a <?= /* @noEscape */ $block->getLinkAttributes() ?>><span><?= $block->escapeHtml($block->getLabel()) ?></span></a> </span> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml index 45a206f3f92bf..53a0682311b1f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml @@ -4,60 +4,61 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-list"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol class="product-items" id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol class="product-items" id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> <div class="product-item-info"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>"> <?= $block->getImage($_product, 'side_column_widget_product_thumbnail')->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)" + class="product-item-link"> + <?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> - <?= /* @escapeNotVerified */ $block->getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> + <?= $block->getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> <div class="product-item-actions"> <div class="actions-primary"> - <?php if ($_product->isSaleable()): ?> - <?php if (!$_product->getTypeInstance()->isPossibleBuyFromList($_product)): ?> - <button type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" + <?php if ($_product->isSaleable()) :?> + <?php if (!$_product->getTypeInstance()->isPossibleBuyFromList($_product)) :?> + <button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_product) ?>"}}'> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}'> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - <button type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_product)), ['product' => $_product->getEntityId()]); + ?> + <button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>'> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>'> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_product->getIsSalable()): ?> - <div class="stock available" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('In stock') ?></span> + <?php else :?> + <?php if ($_product->getIsSalable()) :?> + <div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> </div> - <?php else: ?> - <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>"> - <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span> + <?php else :?> + <div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> </div> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml index 2c40f9f7d63dc..8a776adc95018 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_images_list.phtml @@ -3,22 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-images"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-images"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>" + class="product-items product-items-images"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>"> + <a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>"> <?php /* new_products_images_only_widget */ ?> <?= $block->getImage($_product, 'new_products_images_only_widget')->toHtml() ?> </a> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml index c0fb12df91137..371d4df7c0206 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_names_list.phtml @@ -4,24 +4,26 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> -<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) :?> <div class="block widget block-new-products-names"> <div class="block-title"> - <strong><?= /* @escapeNotVerified */ __('New Products') ?></strong> + <strong><?= $block->escapeHtml(__('New Products')) ?></strong> </div> <div class="block-content"> <?php $suffix = $block->getNameInLayout(); ?> - <ol id="widget-new-products-<?= /* @escapeNotVerified */ $suffix ?>" class="product-items product-items-names"> - <?php foreach ($_products->getItems() as $_product): ?> + <ol id="widget-new-products-<?= $block->escapeHtmlAttr($suffix) ?>" + class="product-items product-items-names"> + <?php foreach ($_products->getItems() as $_product) :?> <li class="product-item"> <strong class="product-item-name"> - <a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" - title="<?= /* @escapeNotVerified */ $block->stripTags($_product->getName(), null, true) ?>)" + <a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>" + title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)" class="product-item-link"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + <?= /* @noEscape */ $this->helper( + Magento\Catalog\Helper\Output::class + )->productAttribute($_product, $_product->getName(), 'name') ?> </a> </strong> </li> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml index 93542c4c9095c..5108c488aec19 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -13,6 +10,10 @@ * * @var $block \Magento\Catalog\Block\Product\Widget\NewWidget */ + +// phpcs:disable Magento2.Files.LineLength.MaxExceeded +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())) { $type = 'widget-new-grid'; @@ -30,84 +31,93 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> } ?> -<?php if ($exist):?> - <div class="block widget block-new-products <?= /* @escapeNotVerified */ $mode ?>"> +<?php if ($exist) :?> + <div class="block widget block-new-products <?= /* @noEscape */ $mode ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> - <?php foreach ($items as $_item): ?> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>"> + <ol class="product-items <?= /* @noEscape */ $type ?>"> + <?php foreach ($items as $_item) :?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" + class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> - <?php - echo $block->getProductPriceHtml($_item, $type); - ?> + <?= $block->getProductPriceHtml($_item, $type); ?> - <?php if ($templateType): ?> + <?php if ($templateType) :?> <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) :?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) :?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?> + <?php if ($_item->isSaleable()) :?> + <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); + $postData = $postDataHelper->getPostData( + $block->escapeUrl($block->getAddToCartUrl($_item)), + ['product' => (int) $_item->getEntityId()] + ) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"> + <span><?= $block->escapeHtml(__('In stock')) ?></span> + </div> + <?php else :?> + <div class="stock unavailable"> + <span><?= $block->escapeHtml(__('Out of stock')) ?></span> + </div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) :?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist) :?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' - class="action towishlist" data-action="add-to-wishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' + class="action towishlist" + data-action="add-to-wishlist" + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <?php if ($block->getAddToCompareUrl() && $showCompare) :?> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class);?> <a href="#" class="action tocompare" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>' - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml index ad75a3a6f0743..378cd49493a6e 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml @@ -3,11 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php + +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +// phpcs:disable Magento2.Files.LineLength.MaxExceeded + /** * Template for displaying new products widget * @@ -21,7 +22,8 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> $image = 'new_products_content_widget_list'; $title = __('New Products'); $items = $block->getProductCollection()->getItems(); - $_helper = $this->helper('Magento\Catalog\Helper\Output'); + /** @var Magento\Catalog\Helper\Output $_helper */ + $_helper = $this->helper(Magento\Catalog\Helper\Output::class); $showWishlist = true; $showCompare = true; @@ -31,94 +33,102 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> } ?> -<?php if ($exist):?> - <div class="block widget block-new-products <?= /* @escapeNotVerified */ $mode ?>"> +<?php if ($exist) :?> + <div class="block widget block-new-products <?= /* @noEscape */ $mode ?>"> <div class="block-title"> - <strong role="heading" aria-level="2"><?= /* @escapeNotVerified */ $title ?></strong> + <strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong> </div> <div class="block-content"> - <?= /* @escapeNotVerified */ '<!-- ' . $image . '-->' ?> - <div class="products-<?= /* @escapeNotVerified */ $mode ?> <?= /* @escapeNotVerified */ $mode ?>"> - <ol class="product-items <?= /* @escapeNotVerified */ $type ?>"> - <?php foreach ($items as $_item): ?> + <?= /* @noEscape */ '<!-- ' . $image . '-->' ?> + <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>"> + <ol class="product-items <?= /* @noEscape */ $type ?>"> + <?php foreach ($items as $_item) :?> <li class="product-item"> <div class="product-item-info"> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" class="product-item-photo"> + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" + class="product-item-photo"> <?= $block->getImage($_item, $image)->toHtml() ?> </a> <div class="product-item-details"> <strong class="product-item-name"> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-link"> <?= $block->escapeHtml($_item->getName()) ?> </a> </strong> <?= $block->getProductPriceHtml($_item, $type) ?> - <?php if ($templateType): ?> + <?php if ($templateType) :?> <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if ($showWishlist || $showCompare || $showCart): ?> + <?php if ($showWishlist || $showCompare || $showCart) :?> <div class="product-item-actions"> - <?php if ($showCart): ?> + <?php if ($showCart) :?> <div class="actions-primary"> - <?php if ($_item->isSaleable()): ?> - <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?> + <?php if ($_item->isSaleable()) :?> + <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item) + ) :?> <button class="action tocart primary" - data-mage-init='{"redirectUrl":{"url":"<?= /* @escapeNotVerified */ $block->getAddToCartUrl($_item) ?>"}}' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' + type="button" + title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> - <?php else: ?> + <?php else :?> <?php - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); + $postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> <button class="action tocart primary" - data-post='<?= /* @escapeNotVerified */ $postData ?>' - type="button" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> + data-post='<?= /* @noEscape */ $postData ?>' + type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> </button> <?php endif; ?> - <?php else: ?> - <?php if ($_item->getIsSalable()): ?> - <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div> - <?php else: ?> - <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div> + <?php else :?> + <?php if ($_item->getIsSalable()) :?> + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> + <?php else :?> + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> - <?php if ($showWishlist || $showCompare): ?> + <?php if ($showWishlist || $showCompare) :?> <div class="actions-secondary" data-role="add-to-links"> - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + <?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist) :?> <a href="#" - data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" - title="<?= /* @escapeNotVerified */ __('Add to Wish List') ?>"> - <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span> + title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> </a> <?php endif; ?> - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> + <?php if ($block->getAddToCompareUrl() && $showCompare) :?> + <?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class); ?> <a href="#" class="action tocompare" - title="<?= /* @escapeNotVerified */ __('Add to Compare') ?>" - data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataParams($_item) ?>'> - <span><?= /* @escapeNotVerified */ __('Add to Compare') ?></span> + title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>" + data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' + > + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> </a> <?php endif; ?> </div> <?php endif; ?> </div> <?php endif; ?> - <?php if ($description):?> + <?php if ($description) :?> <div class="product-item-description"> - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - <a title="<?= $block->escapeHtml($_item->getName()) ?>" - href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" - class="action more"><?= /* @escapeNotVerified */ __('Learn More') ?></a> + <?= /* @noEscape */ $_helper->productAttribute( + $_item, + $_item->getShortDescription(), + 'short_description' + ) ?> + <a title="<?= $block->escapeHtmlAttr($_item->getName()) ?>" + href="<?= $block->escapeUrl($block->getProductUrl($_item))?>" + class="action more"><?= $block->escapeHtml(__('Learn More')) ?></a> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml index 578630a11e930..d4db174dbe5e7 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/grid.phtml @@ -5,12 +5,13 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @escapeNotVerified */ $block->renderApp([ +<?php /* @noEscape */ echo $block->renderApp([ 'widget_columns' => [ 'displayMode' => 'grid' ], diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml index 3770c330ad73e..e03ac9ca692cc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/list.phtml @@ -5,12 +5,13 @@ */ ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.Security.LanguageConstruct.DirectOutput +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?= /* @escapeNotVerified */ $block->renderApp([ +<?php /* @noEscape */ echo $block->renderApp([ 'widget_columns' => [ 'displayMode' => 'list' ], diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml index 1c4ad3105a2b5..a42b46a5238f9 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml @@ -3,16 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - - //@codingStandardsIgnoreFile ?> <?php -/** - * @var $block \Magento\Ui\Block\Wrapper - */ +// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag + +/** @var $block \Magento\Ui\Block\Wrapper */ ?> -<?php /* @escapeNotVerified */ echo $block->renderApp( +<?php /* @noEscape */ echo $block->renderApp( [ 'listing' => [ 'displayMode' => 'grid' diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index edeb955b19c9b..0b7fbaf86826b 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -9,6 +9,7 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Config as CatalogConfig; use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ResourceModel\Product\Link; use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor; use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface; @@ -999,10 +1000,12 @@ public function setParameters(array $params) */ public function deleteProductsForReplacement() { - $this->setParameters(array_merge( - $this->getParameters(), - ['behavior' => Import::BEHAVIOR_DELETE] - )); + $this->setParameters( + array_merge( + $this->getParameters(), + ['behavior' => Import::BEHAVIOR_DELETE] + ) + ); $this->_deleteProducts(); return $this; @@ -1091,10 +1094,12 @@ protected function _replaceProducts() $this->deleteProductsForReplacement(); $this->_oldSku = $this->skuProcessor->reloadOldSkus()->getOldSkus(); $this->_validatedRows = null; - $this->setParameters(array_merge( - $this->getParameters(), - ['behavior' => Import::BEHAVIOR_APPEND] - )); + $this->setParameters( + array_merge( + $this->getParameters(), + ['behavior' => Import::BEHAVIOR_APPEND] + ) + ); $this->_saveProductsData(); return $this; @@ -1244,13 +1249,10 @@ protected function _prepareRowForDb(array $rowData) * Must be called after ALL products saving done. * * @return $this - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - * phpcs:disable Generic.Metrics.NestingLevel */ protected function _saveLinks() { + /** @var Link $resource */ $resource = $this->_linkFactory->create(); $mainTable = $resource->getMainTable(); $positionAttrId = []; @@ -1268,114 +1270,10 @@ protected function _saveLinks() $positionAttrId[$linkId] = $this->_connection->fetchOne($select, $bind); } while ($bunch = $this->_dataSourceModel->getNextBunch()) { - $productIds = []; - $linkRows = []; - $positionRows = []; - - foreach ($bunch as $rowNum => $rowData) { - if (!$this->isRowAllowedToImport($rowData, $rowNum)) { - continue; - } - - $sku = $rowData[self::COL_SKU]; - - $productId = $this->skuProcessor->getNewSku($sku)[$this->getProductEntityLinkField()]; - $productLinkKeys = []; - $select = $this->_connection->select()->from( - $resource->getTable('catalog_product_link'), - ['id' => 'link_id', 'linked_id' => 'linked_product_id', 'link_type_id' => 'link_type_id'] - )->where( - 'product_id = :product_id' - ); - $bind = [':product_id' => $productId]; - foreach ($this->_connection->fetchAll($select, $bind) as $linkData) { - $linkKey = "{$productId}-{$linkData['linked_id']}-{$linkData['link_type_id']}"; - $productLinkKeys[$linkKey] = $linkData['id']; - } - foreach ($this->_linkNameToId as $linkName => $linkId) { - $productIds[] = $productId; - if (isset($rowData[$linkName . 'sku'])) { - $linkSkus = explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'sku']); - $linkPositions = !empty($rowData[$linkName . 'position']) - ? explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'position']) - : []; - foreach ($linkSkus as $linkedKey => $linkedSku) { - $linkedSku = trim($linkedSku); - if (($this->skuProcessor->getNewSku($linkedSku) !== null || $this->isSkuExist($linkedSku)) - && strcasecmp($linkedSku, $sku) !== 0 - ) { - $newSku = $this->skuProcessor->getNewSku($linkedSku); - if (!empty($newSku)) { - $linkedId = $newSku['entity_id']; - } else { - $linkedId = $this->getExistingSku($linkedSku)['entity_id']; - } - - if ($linkedId == null) { - // Import file links to a SKU which is skipped for some reason, - // which leads to a "NULL" - // link causing fatal errors. - $this->_logger->critical( - new \Exception( - sprintf( - 'WARNING: Orphaned link skipped: From SKU %s (ID %d) to SKU %s, ' . - 'Link type id: %d', - $sku, - $productId, - $linkedSku, - $linkId - ) - ) - ); - continue; - } - - $linkKey = "{$productId}-{$linkedId}-{$linkId}"; - if (empty($productLinkKeys[$linkKey])) { - $productLinkKeys[$linkKey] = $nextLinkId; - } - if (!isset($linkRows[$linkKey])) { - $linkRows[$linkKey] = [ - 'link_id' => $productLinkKeys[$linkKey], - 'product_id' => $productId, - 'linked_product_id' => $linkedId, - 'link_type_id' => $linkId, - ]; - } - if (!empty($linkPositions[$linkedKey])) { - $positionRows[] = [ - 'link_id' => $productLinkKeys[$linkKey], - 'product_link_attribute_id' => $positionAttrId[$linkId], - 'value' => $linkPositions[$linkedKey], - ]; - } - $nextLinkId++; - } - } - } - } - } - if (Import::BEHAVIOR_APPEND != $this->getBehavior() && $productIds) { - $this->_connection->delete( - $mainTable, - $this->_connection->quoteInto('product_id IN (?)', array_unique($productIds)) - ); - } - if ($linkRows) { - $this->_connection->insertOnDuplicate($mainTable, $linkRows, ['link_id']); - } - if ($positionRows) { - // process linked product positions - $this->_connection->insertOnDuplicate( - $resource->getAttributeTypeTable('int'), - $positionRows, - ['value'] - ); - } + $this->processLinkBunches($bunch, $resource, $nextLinkId, $positionAttrId); } return $this; } - // phpcs:enable /** * Save product attributes. @@ -1610,7 +1508,6 @@ public function getImagesFromRow(array $rowData) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.UnusedLocalVariable) * @throws LocalizedException - * phpcs:disable Generic.Metrics.NestingLevel */ protected function _saveProducts() { @@ -1817,42 +1714,44 @@ protected function _saveProducts() $rowData[$column] = $uploadedFile; } - if ($uploadedFile && !isset($mediaGallery[$storeId][$rowSku][$uploadedFile])) { - if (isset($existingImages[$rowSku][$uploadedFile])) { - $currentFileData = $existingImages[$rowSku][$uploadedFile]; - if (isset($rowLabels[$column][$columnImageKey]) - && $rowLabels[$column][$columnImageKey] != - $currentFileData['label'] - ) { - $labelsForUpdate[] = [ - 'label' => $rowLabels[$column][$columnImageKey], - 'imageData' => $currentFileData - ]; - } - - if (array_key_exists($uploadedFile, $imageHiddenStates) - && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile] - ) { - $imagesForChangeVisibility[] = [ - 'disabled' => $imageHiddenStates[$uploadedFile], - 'imageData' => $currentFileData - ]; - } - } else { - if ($column == self::COL_MEDIA_IMAGE) { - $rowData[$column][] = $uploadedFile; - } - $mediaGallery[$storeId][$rowSku][$uploadedFile] = [ - 'attribute_id' => $this->getMediaGalleryAttributeId(), - 'label' => isset($rowLabels[$column][$columnImageKey]) - ? $rowLabels[$column][$columnImageKey] - : '', - 'position' => ++$position, - 'disabled' => isset($imageHiddenStates[$columnImage]) - ? $imageHiddenStates[$columnImage] : '0', - 'value' => $uploadedFile, + if (!$uploadedFile || isset($mediaGallery[$storeId][$rowSku][$uploadedFile])) { + continue; + } + + if (isset($existingImages[$rowSku][$uploadedFile])) { + $currentFileData = $existingImages[$rowSku][$uploadedFile]; + if (isset($rowLabels[$column][$columnImageKey]) + && $rowLabels[$column][$columnImageKey] != + $currentFileData['label'] + ) { + $labelsForUpdate[] = [ + 'label' => $rowLabels[$column][$columnImageKey], + 'imageData' => $currentFileData + ]; + } + + if (array_key_exists($uploadedFile, $imageHiddenStates) + && $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile] + ) { + $imagesForChangeVisibility[] = [ + 'disabled' => $imageHiddenStates[$uploadedFile], + 'imageData' => $currentFileData ]; } + } else { + if ($column == self::COL_MEDIA_IMAGE) { + $rowData[$column][] = $uploadedFile; + } + $mediaGallery[$storeId][$rowSku][$uploadedFile] = [ + 'attribute_id' => $this->getMediaGalleryAttributeId(), + 'label' => isset($rowLabels[$column][$columnImageKey]) + ? $rowLabels[$column][$columnImageKey] + : '', + 'position' => ++$position, + 'disabled' => isset($imageHiddenStates[$columnImage]) + ? $imageHiddenStates[$columnImage] : '0', + 'value' => $uploadedFile, + ]; } } } @@ -1983,7 +1882,6 @@ protected function _saveProducts() return $this; } - // phpcs:enable /** * Prepare array with image states (visible or hidden from product page) @@ -2732,9 +2630,12 @@ public function parseMultiselectValues($values, $delimiter = self::PSEUDO_MULTI_ return explode($delimiter, $values); } if (preg_match_all('~"((?:[^"]|"")*)"~', $values, $matches)) { - return $values = array_map(function ($value) { - return str_replace('""', '"', $value); - }, $matches[1]); + return $values = array_map( + function ($value) { + return str_replace('""', '"', $value); + }, + $matches[1] + ); } return [$values]; } @@ -2905,7 +2806,8 @@ protected function getProductUrlSuffix($storeId = null) protected function getUrlKey($rowData) { if (!empty($rowData[self::URL_KEY])) { - return $this->productUrl->formatUrlKey($rowData[self::URL_KEY]); + $urlKey = (string) $rowData[self::URL_KEY]; + return trim(strtolower($urlKey)); } if (!empty($rowData[self::COL_NAME])) { @@ -3132,4 +3034,167 @@ private function getValidationErrorLevel($sku): string ? ProcessingError::ERROR_LEVEL_CRITICAL : ProcessingError::ERROR_LEVEL_NOT_CRITICAL; } + + /** + * Processes link bunches + * + * @param array $bunch + * @param Link $resource + * @param int $nextLinkId + * @param array $positionAttrId + * @return void + */ + private function processLinkBunches( + array $bunch, + Link $resource, + int $nextLinkId, + array $positionAttrId + ): void { + $productIds = []; + $linkRows = []; + $positionRows = []; + + $bunch = array_filter($bunch, [$this, 'isRowAllowedToImport'], ARRAY_FILTER_USE_BOTH); + foreach ($bunch as $rowData) { + $sku = $rowData[self::COL_SKU]; + $productId = $this->skuProcessor->getNewSku($sku)[$this->getProductEntityLinkField()]; + $productIds[] = $productId; + $productLinkKeys = $this->fetchProductLinks($resource, $productId); + $linkNameToId = array_filter( + $this->_linkNameToId, + function ($linkName) use ($rowData) { + return isset($rowData[$linkName . 'sku']); + }, + ARRAY_FILTER_USE_KEY + ); + foreach ($linkNameToId as $linkName => $linkId) { + $linkSkus = explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'sku']); + $linkPositions = !empty($rowData[$linkName . 'position']) + ? explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'position']) + : []; + + $linkSkus = array_filter( + $linkSkus, + function ($linkedSku) use ($sku) { + $linkedSku = trim($linkedSku); + return ($this->skuProcessor->getNewSku($linkedSku) !== null || $this->isSkuExist($linkedSku)) + && strcasecmp($linkedSku, $sku) !== 0; + } + ); + foreach ($linkSkus as $linkedKey => $linkedSku) { + $linkedId = $this->getProductLinkedId($linkedSku); + if ($linkedId == null) { + // Import file links to a SKU which is skipped for some reason, which leads to a "NULL" + // link causing fatal errors. + $formatStr = 'WARNING: Orphaned link skipped: From SKU %s (ID %d) to SKU %s, Link type id: %d'; + $exception = new \Exception(sprintf($formatStr, $sku, $productId, $linkedSku, $linkId)); + $this->_logger->critical($exception); + continue; + } + $linkKey = $this->composeLinkKey($productId, $linkedId, $linkId); + $productLinkKeys[$linkKey] = $productLinkKeys[$linkKey] ?? $nextLinkId; + + $linkRows[$linkKey] = $linkRows[$linkKey] ?? [ + 'link_id' => $productLinkKeys[$linkKey], + 'product_id' => $productId, + 'linked_product_id' => $linkedId, + 'link_type_id' => $linkId, + ]; + + if (!empty($linkPositions[$linkedKey])) { + $positionRows[] = [ + 'link_id' => $productLinkKeys[$linkKey], + 'product_link_attribute_id' => $positionAttrId[$linkId], + 'value' => $linkPositions[$linkedKey], + ]; + } + $nextLinkId++; + } + } + } + $this->saveLinksData($resource, $productIds, $linkRows, $positionRows); + } + + /** + * Fetches Product Links + * + * @param Link $resource + * @param int $productId + * @return array + */ + private function fetchProductLinks(Link $resource, int $productId) : array + { + $productLinkKeys = []; + $select = $this->_connection->select()->from( + $resource->getTable('catalog_product_link'), + ['id' => 'link_id', 'linked_id' => 'linked_product_id', 'link_type_id' => 'link_type_id'] + )->where( + 'product_id = :product_id' + ); + $bind = [':product_id' => $productId]; + foreach ($this->_connection->fetchAll($select, $bind) as $linkData) { + $linkKey = $this->composeLinkKey($productId, $linkData['linked_id'], $linkData['link_type_id']); + $productLinkKeys[$linkKey] = $linkData['id']; + } + + return $productLinkKeys; + } + + /** + * Gets the Id of the Sku + * + * @param string $linkedSku + * @return int|null + */ + private function getProductLinkedId(string $linkedSku) : ?int + { + $linkedSku = trim($linkedSku); + $newSku = $this->skuProcessor->getNewSku($linkedSku); + $linkedId = !empty($newSku) ? $newSku['entity_id'] : $this->getExistingSku($linkedSku)['entity_id']; + return $linkedId; + } + + /** + * Saves information about product links + * + * @param Link $resource + * @param array $productIds + * @param array $linkRows + * @param array $positionRows + * @throws LocalizedException + */ + private function saveLinksData(Link $resource, array $productIds, array $linkRows, array $positionRows) + { + $mainTable = $resource->getMainTable(); + if (Import::BEHAVIOR_APPEND != $this->getBehavior() && $productIds) { + $this->_connection->delete( + $mainTable, + $this->_connection->quoteInto('product_id IN (?)', array_unique($productIds)) + ); + } + if ($linkRows) { + $this->_connection->insertOnDuplicate($mainTable, $linkRows, ['link_id']); + } + if ($positionRows) { + // process linked product positions + $this->_connection->insertOnDuplicate( + $resource->getAttributeTypeTable('int'), + $positionRows, + ['value'] + ); + } + } + + /** + * Composes the link key + * + * @param int $productId + * @param int $linkedId + * @param int $linkTypeId + * @return string + */ + private function composeLinkKey(int $productId, int $linkedId, int $linkTypeId) : string + { + return "{$productId}-{$linkedId}-{$linkTypeId}"; + } } diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml index f720cf30b8cc5..74345e64a7c9a 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml @@ -117,6 +117,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml index b350ea2cbdaca..b0ac6a4bc95ac 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml @@ -82,6 +82,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml index 8adbf566b65ec..1870cb21bd55b 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml @@ -109,6 +109,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml index 87552c5977545..00bf647886ef5 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml @@ -125,6 +125,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml index 496abfb3b94ef..271b4621d1a96 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml @@ -107,6 +107,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml index 5d6554d89aef6..238a3286dc40d 100644 --- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml +++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml @@ -59,6 +59,7 @@ <!-- Run cron --> <magentoCLI command="cron:run" stepKey="runCron3"/> + <magentoCLI command="cron:run" stepKey="runCron4"/> <!-- Download product --> <actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts"> diff --git a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml index 8e0dbf1278ed2..8b63d29be8154 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml +++ b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml @@ -4,14 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\CatalogInventory\Block\Qtyincrements */ ?> <?php if ($block->getProductQtyIncrements()) : ?> <div class="product pricing"> - <?= /* @escapeNotVerified */ __('%1 is available to buy in increments of %2', $block->getProductName(), $block->getProductQtyIncrements()) ?> + <?= $block->escapeHtml(__('%1 is available to buy in increments of %2', $block->getProductName(), $block->getProductQtyIncrements())) ?> </div> <?php endif ?> diff --git a/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/composite.phtml b/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/composite.phtml index 481ed1297a801..de667d19fadb0 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/composite.phtml +++ b/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/composite.phtml @@ -4,30 +4,28 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\CatalogInventory\Block\Stockqty\Composite */ ?> -<?php if ($block->isMsgVisible()): ?> +<?php if ($block->isMsgVisible()) : ?> <div class="availability only"> <a href="#" - data-mage-init='{"toggleAdvanced": {"selectorsToggleClass": "active", "baseToggleClass": "expanded", "toggleContainers": "#<?= /* @escapeNotVerified */ $block->getDetailsPlaceholderId() ?>"}}' - id="<?= /* @escapeNotVerified */ $block->getPlaceholderId() ?>" - title="<?= /* @escapeNotVerified */ __('Only %1 left', ($block->getStockQtyLeft())) ?>" + data-mage-init='{"toggleAdvanced": {"selectorsToggleClass": "active", "baseToggleClass": "expanded", "toggleContainers": "#<?= $block->escapeHtmlAttr($block->getDetailsPlaceholderId()) ?>"}}' + id="<?= $block->escapeHtmlAttr($block->getPlaceholderId()) ?>" + title="<?= $block->escapeHtmlAttr(__('Only %1 left', ($block->getStockQtyLeft()))) ?>" class="action show"> - <?= /* @escapeNotVerified */ __('Only %1 left', "<strong>{$block->getStockQtyLeft()}</strong>") ?> + <?= /* @noEscape */ __('Only %1 left', "<strong>{$block->escapeHtml($block->getStockQtyLeft())}</strong>") ?> </a> </div> - <div class="availability only detailed" id="<?= /* @escapeNotVerified */ $block->getDetailsPlaceholderId() ?>"> + <div class="availability only detailed" id="<?= $block->escapeHtmlAttr($block->getDetailsPlaceholderId()) ?>"> <div class="table-wrapper"> <table class="data table"> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('Product availability') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('Product availability')) ?></caption> <thead> <tr> - <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th> - <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th> + <th class="col item" scope="col"><?= $block->escapeHtml(__('Product Name')) ?></th> + <th class="col qty" scope="col"><?= $block->escapeHtml(__('Qty')) ?></th> </tr> </thead> <tbody> @@ -35,8 +33,8 @@ <?php $childProductStockQty = $block->getProductStockQty($childProduct); ?> <?php if ($childProductStockQty > 0) : ?> <tr> - <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item"><?= /* @escapeNotVerified */ $childProduct->getName() ?></td> - <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty"><?= /* @escapeNotVerified */ $childProductStockQty ?></td> + <td data-th="<?= $block->escapeHtmlAttr(__('Product Name')) ?>" class="col item"><?= $block->escapeHtml($childProduct->getName()) ?></td> + <td data-th="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="col qty"><?= $block->escapeHtml($childProductStockQty) ?></td> </tr> <?php endif ?> <?php endforeach ?> diff --git a/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/default.phtml b/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/default.phtml index 43fb697de2621..c32cb9dd6ecda 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/default.phtml +++ b/app/code/Magento/CatalogInventory/view/frontend/templates/stockqty/default.phtml @@ -4,14 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\CatalogInventory\Block\Stockqty\DefaultStockqty */ ?> -<?php if ($block->isMsgVisible()): ?> - <div class="availability only" title="<?= /* @escapeNotVerified */ __('Only %1 left', ($block->getStockQtyLeft())) ?>"> - <?= /* @escapeNotVerified */ __('Only %1 left', "<strong>{$block->getStockQtyLeft()}</strong>") ?> +<?php if ($block->isMsgVisible()) : ?> + <div class="availability only" title="<?= $block->escapeHtmlAttr(__('Only %1 left', ($block->getStockQtyLeft()))) ?>"> + <?= /* @noEscape */ __('Only %1 left', "<strong>{$block->escapeHtml($block->getStockQtyLeft())}</strong>") ?> </div> <?php endif ?> diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php index 1f62200fc6b1b..e12eabba76401 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -7,6 +7,7 @@ namespace Magento\CatalogRule\Model\Indexer; use Magento\Catalog\Model\Product; +use Magento\CatalogRule\Model\ResourceModel\Rule\Collection as RuleCollection; use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory as RuleCollectionFactory; use Magento\CatalogRule\Model\Rule; use Magento\Framework\App\ObjectManager; @@ -15,6 +16,8 @@ use Magento\CatalogRule\Model\Indexer\IndexerTableSwapperInterface as TableSwapper; /** + * Catalog rule index builder + * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -270,14 +273,14 @@ public function reindexByIds(array $ids) */ protected function doReindexByIds($ids) { - $this->cleanByIds($ids); + $this->cleanProductIndex($ids); $products = $this->productLoader->getProducts($ids); - foreach ($this->getActiveRules() as $rule) { - foreach ($products as $product) { - $this->applyRule($rule, $product); - } + $activeRules = $this->getActiveRules(); + foreach ($products as $product) { + $this->applyRules($activeRules, $product); } + $this->reindexRuleGroupWebsite->execute(); } /** @@ -322,6 +325,30 @@ protected function doReindexFull() ); } + /** + * Clean product index + * + * @param array $productIds + * @return void + */ + private function cleanProductIndex(array $productIds): void + { + $where = ['product_id IN (?)' => $productIds]; + $this->connection->delete($this->getTable('catalogrule_product'), $where); + } + + /** + * Clean product price index + * + * @param array $productIds + * @return void + */ + private function cleanProductPriceIndex(array $productIds): void + { + $where = ['product_id IN (?)' => $productIds]; + $this->connection->delete($this->getTable('catalogrule_product_price'), $where); + } + /** * Clean by product ids * @@ -330,51 +357,35 @@ protected function doReindexFull() */ protected function cleanByIds($productIds) { - $query = $this->connection->deleteFromSelect( - $this->connection - ->select() - ->from($this->resource->getTableName('catalogrule_product'), 'product_id') - ->distinct() - ->where('product_id IN (?)', $productIds), - $this->resource->getTableName('catalogrule_product') - ); - $this->connection->query($query); - - $query = $this->connection->deleteFromSelect( - $this->connection->select() - ->from($this->resource->getTableName('catalogrule_product_price'), 'product_id') - ->distinct() - ->where('product_id IN (?)', $productIds), - $this->resource->getTableName('catalogrule_product_price') - ); - $this->connection->query($query); + $this->cleanProductIndex($productIds); + $this->cleanProductPriceIndex($productIds); } /** + * Assign product to rule + * * @param Rule $rule * @param Product $product - * @return $this - * @throws \Exception - * @SuppressWarnings(PHPMD.NPathComplexity) + * @return void */ - protected function applyRule(Rule $rule, $product) + private function assignProductToRule(Rule $rule, Product $product): void { - $ruleId = $rule->getId(); - $productEntityId = $product->getId(); - $websiteIds = array_intersect($product->getWebsiteIds(), $rule->getWebsiteIds()); - if (!$rule->validate($product)) { - return $this; + return; } + $ruleId = (int) $rule->getId(); + $productEntityId = (int) $product->getId(); + $ruleProductTable = $this->getTable('catalogrule_product'); $this->connection->delete( - $this->resource->getTableName('catalogrule_product'), + $ruleProductTable, [ - $this->connection->quoteInto('rule_id = ?', $ruleId), - $this->connection->quoteInto('product_id = ?', $productEntityId) + 'rule_id = ?' => $ruleId, + 'product_id = ?' => $productEntityId, ] ); + $websiteIds = array_intersect($product->getWebsiteIds(), $rule->getWebsiteIds()); $customerGroupIds = $rule->getCustomerGroupIds(); $fromTime = strtotime($rule->getFromDate()); $toTime = strtotime($rule->getToDate()); @@ -385,36 +396,44 @@ protected function applyRule(Rule $rule, $product) $actionStop = $rule->getStopRulesProcessing(); $rows = []; - try { - foreach ($websiteIds as $websiteId) { - foreach ($customerGroupIds as $customerGroupId) { - $rows[] = [ - 'rule_id' => $ruleId, - 'from_time' => $fromTime, - 'to_time' => $toTime, - 'website_id' => $websiteId, - 'customer_group_id' => $customerGroupId, - 'product_id' => $productEntityId, - 'action_operator' => $actionOperator, - 'action_amount' => $actionAmount, - 'action_stop' => $actionStop, - 'sort_order' => $sortOrder, - ]; - - if (count($rows) == $this->batchCount) { - $this->connection->insertMultiple($this->getTable('catalogrule_product'), $rows); - $rows = []; - } + foreach ($websiteIds as $websiteId) { + foreach ($customerGroupIds as $customerGroupId) { + $rows[] = [ + 'rule_id' => $ruleId, + 'from_time' => $fromTime, + 'to_time' => $toTime, + 'website_id' => $websiteId, + 'customer_group_id' => $customerGroupId, + 'product_id' => $productEntityId, + 'action_operator' => $actionOperator, + 'action_amount' => $actionAmount, + 'action_stop' => $actionStop, + 'sort_order' => $sortOrder, + ]; + + if (count($rows) == $this->batchCount) { + $this->connection->insertMultiple($ruleProductTable, $rows); + $rows = []; } } - - if (!empty($rows)) { - $this->connection->insertMultiple($this->resource->getTableName('catalogrule_product'), $rows); - } - } catch (\Exception $e) { - throw $e; } + if ($rows) { + $this->connection->insertMultiple($ruleProductTable, $rows); + } + } + /** + * Apply rule + * + * @param Rule $rule + * @param Product $product + * @return $this + * @throws \Exception + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + protected function applyRule(Rule $rule, $product) + { + $this->assignProductToRule($rule, $product); $this->reindexRuleProductPrice->execute($this->batchCount, $product); $this->reindexRuleGroupWebsite->execute(); @@ -422,6 +441,25 @@ protected function applyRule(Rule $rule, $product) } /** + * Apply rules + * + * @param RuleCollection $ruleCollection + * @param Product $product + * @return void + */ + private function applyRules(RuleCollection $ruleCollection, Product $product): void + { + foreach ($ruleCollection as $rule) { + $this->assignProductToRule($rule, $product); + } + + $this->cleanProductPriceIndex([$product->getId()]); + $this->reindexRuleProductPrice->execute($this->batchCount, $product); + } + + /** + * Retrieve table name + * * @param string $tableName * @return string */ @@ -431,6 +469,8 @@ protected function getTable($tableName) } /** + * Update rule product data + * * @param Rule $rule * @return $this * @deprecated 100.2.0 @@ -456,6 +496,8 @@ protected function updateRuleProductData(Rule $rule) } /** + * Apply all rules + * * @param Product|null $product * @throws \Exception * @return $this @@ -495,8 +537,10 @@ protected function deleteOldData() } /** + * Calculate rule product price + * * @param array $ruleData - * @param null $productData + * @param array $productData * @return float * @deprecated 100.2.0 * @see ProductPriceCalculator::calculate @@ -507,6 +551,8 @@ protected function calcRuleProductPrice($ruleData, $productData = null) } /** + * Get rule products statement + * * @param int $websiteId * @param Product|null $product * @return \Zend_Db_Statement_Interface @@ -520,6 +566,8 @@ protected function getRuleProductsStmt($websiteId, Product $product = null) } /** + * Save rule product prices + * * @param array $arrData * @return $this * @throws \Exception @@ -535,7 +583,7 @@ protected function saveRuleProductPrices($arrData) /** * Get active rules * - * @return array + * @return RuleCollection */ protected function getActiveRules() { @@ -545,7 +593,7 @@ protected function getActiveRules() /** * Get active rules * - * @return array + * @return RuleCollection */ protected function getAllRules() { @@ -553,6 +601,8 @@ protected function getAllRules() } /** + * Get product + * * @param int $productId * @return Product */ @@ -565,6 +615,8 @@ protected function getProduct($productId) } /** + * Log critical exception + * * @param \Exception $e * @return void */ diff --git a/app/code/Magento/CatalogRule/Model/Indexer/RuleProductPricesPersistor.php b/app/code/Magento/CatalogRule/Model/Indexer/RuleProductPricesPersistor.php index 0b1264a216257..25bcfb8f20e5f 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/RuleProductPricesPersistor.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/RuleProductPricesPersistor.php @@ -76,25 +76,19 @@ public function execute(array $priceData, $useAdditionalTable = false) ); } - $productIds = []; - - try { - foreach ($priceData as $key => $data) { - $productIds['product_id'] = $data['product_id']; - $priceData[$key]['rule_date'] = $this->dateFormat->formatDate($data['rule_date'], false); - $priceData[$key]['latest_start_date'] = $this->dateFormat->formatDate( - $data['latest_start_date'], - false - ); - $priceData[$key]['earliest_end_date'] = $this->dateFormat->formatDate( - $data['earliest_end_date'], - false - ); - } - $connection->insertOnDuplicate($indexTable, $priceData); - } catch (\Exception $e) { - throw $e; + foreach ($priceData as $key => $data) { + $priceData[$key]['rule_date'] = $this->dateFormat->formatDate($data['rule_date'], false); + $priceData[$key]['latest_start_date'] = $this->dateFormat->formatDate( + $data['latest_start_date'], + false + ); + $priceData[$key]['earliest_end_date'] = $this->dateFormat->formatDate( + $data['earliest_end_date'], + false + ); } + $connection->insertOnDuplicate($indexTable, $priceData); + return true; } } diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml new file mode 100644 index 0000000000000..ef498b95a5dca --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCatalogPriceRuleFormActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnCatalogPriceRuleForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminNewCatalogRulePage.url}}" stepKey="amOnCatalogPriceRuleCreatePage"/> + <waitForElementVisible selector="{{AdminNewCatalogPriceRule.customerGroups}}" stepKey="waitForElementVisible"/> + <see selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresentOnCatalogPriceRuleForm"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml index 072e8b24b0336..8651a17cb969e 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/AdminOpenNewCatalogPriceRuleFormPageActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOpenNewCatalogPriceRuleFormPageActionGroup"> - <amOnPage url="{{CatalogRuleNewPage.url}}" stepKey="openNewCatalogPriceRulePage" /> + <amOnPage url="{{AdminNewCatalogRulePage.url}}" stepKey="openNewCatalogPriceRulePage" /> <waitForPageLoad stepKey="waitForPageLoad" /> </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index d744065fabc10..de0d2baee2dd1 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -136,4 +136,25 @@ <actionGroup name="selectNotLoggedInCustomerGroupActionGroup"> <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> </actionGroup> + + <!-- Open rule for Edit --> + <actionGroup name="OpenCatalogPriceRule"> + <arguments> + <argument name="ruleName" type="string" defaultValue="CustomCatalogRule.name"/> + </arguments> + <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <fillField selector="{{AdminCatalogPriceRuleGridSection.filterByRuleName}}" userInput="{{ruleName}}" stepKey="filterByRuleName"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearch"/> + <click selector="{{AdminGridTableSection.row('1')}}" stepKey="clickEdit"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> + + <actionGroup name="RemoveCatalogPriceRule" extends="OpenCatalogPriceRule"> + <click selector="{{AdminMainActionsSection.delete}}" after="waitForPageLoad" stepKey="clickToDelete"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" after="clickToDelete" stepKey="waitForElementVisible"/> + <click selector="{{AdminConfirmationModalSection.ok}}" after="waitForElementVisible" stepKey="clickToConfirm"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" after="clickToConfirm" stepKey="waitForSuccessMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You deleted the rule." after="waitForSuccessMessage" stepKey="verifyRuleIsDeleted"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml new file mode 100644 index 0000000000000..24e4b27604f0d --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminCatalogPriceRuleGridPage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminCatalogPriceRuleGridPage" url="catalog_rule/promo_catalog/" module="Magento_CatalogRule" area="admin"> + <section name="AdminCatalogPriceRuleGridSection"/> + </page> +</pages> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml similarity index 65% rename from app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml rename to app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml index ad3e40b37c5b0..c5307bf4e22f9 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Page/CatalogRuleNewPage.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Page/AdminNewCatalogRulePage.xml @@ -8,7 +8,6 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> - <page name="CatalogRuleNewPage" url="catalog_rule/promo_catalog/new/" module="Magento_CatalogRule" area="admin"> - <section name="AdminNewCatalogPriceRule"/> + <page name="AdminNewCatalogRulePage" url="catalog_rule/promo_catalog/new/" module="Magento_CatalogRule" area="admin"> </page> </pages> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml new file mode 100644 index 0000000000000..21f1401b624c9 --- /dev/null +++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminCatalogPriceRuleGridSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCatalogPriceRuleGridSection"> + <element name="filterByRuleName" type="input" selector="#promo_catalog_grid_filter_name"/> + <element name="attribute" type="text" selector="//*[@id='promo_catalog_grid_table']//td[contains(text(), '{{attributeValue}}')]" parameterized="true"/> + <element name="applyRulesButton" type="button" selector="#apply_rules" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php index 521e4e1d59897..920dcb8e1ede5 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php @@ -144,14 +144,12 @@ protected function setUp() ); $this->ruleCollectionFactory = $this->createPartialMock( \Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory::class, - ['create', 'addFieldToFilter'] + ['create'] ); $this->backend = $this->createMock(\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend::class); $this->select = $this->createMock(\Magento\Framework\DB\Select::class); $this->metadataPool = $this->createMock(\Magento\Framework\EntityManager\MetadataPool::class); - $metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadata::class) - ->disableOriginalConstructor() - ->getMock(); + $metadata = $this->createMock(\Magento\Framework\EntityManager\EntityMetadata::class); $this->metadataPool->expects($this->any())->method('getMetadata')->willReturn($metadata); $this->connection = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class); $this->db = $this->createMock(\Zend_Db_Statement_Interface::class); @@ -181,10 +179,16 @@ protected function setUp() $this->rules->expects($this->any())->method('getWebsiteIds')->will($this->returnValue([1])); $this->rules->expects($this->any())->method('getCustomerGroupIds')->will($this->returnValue([1])); - $this->ruleCollectionFactory->expects($this->any())->method('create')->will($this->returnSelf()); - $this->ruleCollectionFactory->expects($this->any())->method('addFieldToFilter')->will( - $this->returnValue([$this->rules]) - ); + $ruleCollection = $this->createMock(\Magento\CatalogRule\Model\ResourceModel\Rule\Collection::class); + $this->ruleCollectionFactory->expects($this->once()) + ->method('create') + ->willReturn($ruleCollection); + $ruleCollection->expects($this->once()) + ->method('addFieldToFilter') + ->willReturnSelf(); + $ruleIterator = new \ArrayIterator([$this->rules]); + $ruleCollection->method('getIterator') + ->willReturn($ruleIterator); $this->product->expects($this->any())->method('load')->will($this->returnSelf()); $this->product->expects($this->any())->method('getId')->will($this->returnValue(1)); @@ -213,19 +217,20 @@ protected function setUp() ] ); - $this->reindexRuleProductPrice = - $this->getMockBuilder(\Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice::class) - ->disableOriginalConstructor() - ->getMock(); - $this->reindexRuleGroupWebsite = - $this->getMockBuilder(\Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite::class) - ->disableOriginalConstructor() - ->getMock(); - $this->setProperties($this->indexBuilder, [ - 'metadataPool' => $this->metadataPool, - 'reindexRuleProductPrice' => $this->reindexRuleProductPrice, - 'reindexRuleGroupWebsite' => $this->reindexRuleGroupWebsite - ]); + $this->reindexRuleProductPrice = $this->createMock( + \Magento\CatalogRule\Model\Indexer\ReindexRuleProductPrice::class + ); + $this->reindexRuleGroupWebsite = $this->createMock( + \Magento\CatalogRule\Model\Indexer\ReindexRuleGroupWebsite::class + ); + $this->setProperties( + $this->indexBuilder, + [ + 'metadataPool' => $this->metadataPool, + 'reindexRuleProductPrice' => $this->reindexRuleProductPrice, + 'reindexRuleGroupWebsite' => $this->reindexRuleGroupWebsite, + ] + ); } /** diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php index 39cb95747c2cf..cd2529a8fd725 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php @@ -573,11 +573,10 @@ public function prepareProductIndex($indexData, $productData, $storeId) foreach ($attributeData as $attributeId => $attributeValues) { $value = $this->getAttributeValue($attributeId, $attributeValues, $storeId); if (!empty($value)) { - if (isset($index[$attributeId])) { - $index[$attributeId][$entityId] = $value; - } else { - $index[$attributeId] = [$entityId => $value]; + if (!isset($index[$attributeId])) { + $index[$attributeId] = []; } + $index[$attributeId][$entityId] = $value; } } } @@ -645,9 +644,12 @@ private function getAttributeOptionValue($attributeId, $valueIds, $storeId) $attribute->setStoreId($storeId); $options = $attribute->getSource()->toOptionArray(); $this->attributeOptions[$optionKey] = array_column($options, 'label', 'value'); - $this->attributeOptions[$optionKey] = array_map(function ($value) { - return $this->filterAttributeValue($value); - }, $this->attributeOptions[$optionKey]); + $this->attributeOptions[$optionKey] = array_map( + function ($value) { + return $this->filterAttributeValue($value); + }, + $this->attributeOptions[$optionKey] + ); } else { $this->attributeOptions[$optionKey] = null; } diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml index 95ea7fcef3a1a..3712f221233ee 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?> <?php /** @@ -14,108 +13,120 @@ * @var $block \Magento\CatalogSearch\Block\Advanced\Form */ ?> -<?php $maxQueryLength = $this->helper('Magento\CatalogSearch\Helper\Data')->getMaxQueryLength();?> -<form class="form search advanced" action="<?= /* @escapeNotVerified */ $block->getSearchPostUrl() ?>" method="get" id="form-validate"> +<?php $maxQueryLength = $this->helper(\Magento\CatalogSearch\Helper\Data::class)->getMaxQueryLength();?> +<form class="form search advanced" action="<?= $block->escapeUrl($block->getSearchPostUrl()) ?>" method="get" id="form-validate"> <fieldset class="fieldset"> - <legend class="legend"><span><?= /* @escapeNotVerified */ __('Search Settings') ?></span></legend><br /> - <?php foreach ($block->getSearchableAttributes() as $_attribute): ?> - <?php $_code = $_attribute->getAttributeCode() ?> - <div class="field <?= /* @escapeNotVerified */ $_code ?>"> - <label class="label" for="<?= /* @escapeNotVerified */ $_code ?>"> + <legend class="legend"><span><?= $block->escapeHtml(__('Search Settings')) ?></span></legend><br /> + <?php foreach ($block->getSearchableAttributes() as $_attribute) : ?> + <?php $_code = $_attribute->getAttributeCode() ?> + <div class="field <?= $block->escapeHtmlAttr($_code) ?>"> + <label class="label" for="<?= $block->escapeHtmlAttr($_code) ?>"> <span><?= $block->escapeHtml(__($block->getAttributeLabel($_attribute))) ?></span> </label> <div class="control"> - <?php switch ($block->getAttributeInputType($_attribute)): - case 'number': ?> + <?php + switch ($block->getAttributeInputType($_attribute)) : + case 'number': + ?> <div class="range fields group group-2"> <div class="field no-label"> <div class="control"> <input type="text" - name="<?= /* @escapeNotVerified */ $_code ?>[from]" + name="<?= $block->escapeHtmlAttr($_code) ?>[from]" value="<?= $block->escapeHtml($block->getAttributeValue($_attribute, 'from')) ?>" - id="<?= /* @escapeNotVerified */ $_code ?>" + id="<?= $block->escapeHtmlAttr($_code) ?>" title="<?= $block->escapeHtml($block->getAttributeLabel($_attribute)) ?>" class="input-text" - maxlength="<?= /* @escapeNotVerified */ $maxQueryLength ?>" - data-validate="{number:true, 'less-than-equals-to':'#<?= /* @escapeNotVerified */ $_code ?>_to'}" /> + maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>" + data-validate="{number:true, 'less-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>_to'}" /> </div> </div> <div class="field no-label"> <div class="control"> <input type="text" - name="<?= /* @escapeNotVerified */ $_code ?>[to]" + name="<?= $block->escapeHtmlAttr($_code) ?>[to]" value="<?= $block->escapeHtml($block->getAttributeValue($_attribute, 'to')) ?>" - id="<?= /* @escapeNotVerified */ $_code ?>_to" + id="<?= $block->escapeHtmlAttr($_code) ?>_to" title="<?= $block->escapeHtml($block->getAttributeLabel($_attribute)) ?>" class="input-text" - maxlength="<?= /* @escapeNotVerified */ $maxQueryLength ?>" - data-validate="{number:true, 'greater-than-equals-to':'#<?= /* @escapeNotVerified */ $_code ?>'}" /> + maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>" + data-validate="{number:true, 'greater-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>'}" /> </div> </div> </div> - <?php break; - case 'price': ?> + <?php + break; + case 'price': + ?> <div class="range price fields group group-2"> <div class="field no-label"> <div class="control"> - <input name="<?= /* @escapeNotVerified */ $_code ?>[from]" + <input name="<?= $block->escapeHtmlAttr($_code) ?>[from]" value="<?= $block->escapeHtml($block->getAttributeValue($_attribute, 'from')) ?>" - id="<?= /* @escapeNotVerified */ $_code ?>" + id="<?= $block->escapeHtmlAttr($_code) ?>" title="<?= $block->escapeHtml($block->getAttributeLabel($_attribute)) ?>" class="input-text" type="text" - maxlength="<?= /* @escapeNotVerified */ $maxQueryLength ?>" - data-validate="{number:true, 'less-than-equals-to':'#<?= /* @escapeNotVerified */ $_code ?>_to'}" /> + maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>" + data-validate="{number:true, 'less-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>_to'}" /> </div> </div> <div class="field with-addon no-label"> <div class="control"> <div class="addon"> - <input name="<?= /* @escapeNotVerified */ $_code ?>[to]" + <input name="<?= $block->escapeHtmlAttr($_code) ?>[to]" value="<?= $block->escapeHtml($block->getAttributeValue($_attribute, 'to')) ?>" - id="<?= /* @escapeNotVerified */ $_code ?>_to" + id="<?= $block->escapeHtmlAttr($_code) ?>_to" title="<?= $block->escapeHtml($block->getAttributeLabel($_attribute)) ?>" class="input-text" type="text" - maxlength="<?= /* @escapeNotVerified */ $maxQueryLength ?>" - data-validate="{number:true, 'greater-than-equals-to':'#<?= /* @escapeNotVerified */ $_code ?>'}" /> + maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>" + data-validate="{number:true, 'greater-than-equals-to':'#<?= $block->escapeHtmlAttr($_code) ?>'}" /> <label class="addafter" - for="<?= /* @escapeNotVerified */ $_code ?>_to"> - <?= /* @escapeNotVerified */ $block->getCurrency($_attribute) ?> + for="<?= $block->escapeHtmlAttr($_code) ?>_to"> + <?= $block->escapeHtml($block->getCurrency($_attribute)) ?> </label> </div> </div> </div> </div> - <?php break; - case 'select': ?> - <?= /* @escapeNotVerified */ $block->getAttributeSelectElement($_attribute) ?> - <?php break; - case 'yesno': ?> - <?= /* @escapeNotVerified */ $block->getAttributeYesNoElement($_attribute) ?> - <?php break; - case 'date': ?> + <?php + break; + case 'select': + ?> + <?= /* @noEscape */ $block->getAttributeSelectElement($_attribute) ?> + <?php + break; + case 'yesno': + ?> + <?= /* @noEscape */ $block->getAttributeYesNoElement($_attribute) ?> + <?php + break; + case 'date': + ?> <div class="range dates fields group group-2"> <div class="field date no-label"> <div class="control"> - <?= /* @escapeNotVerified */ $block->getDateInput($_attribute, 'from') ?> + <?= /* @noEscape */ $block->getDateInput($_attribute, 'from') ?> </div> </div> <div class="field date no-label"> <div class="control"> - <?= /* @escapeNotVerified */ $block->getDateInput($_attribute, 'to') ?> + <?= /* @noEscape */ $block->getDateInput($_attribute, 'to') ?> </div> </div> </div> - <?php break; - default: ?> + <?php + break; + default: + ?> <input type="text" - name="<?= /* @escapeNotVerified */ $_code ?>" - id="<?= /* @escapeNotVerified */ $_code ?>" + name="<?= $block->escapeHtmlAttr($_code) ?>" + id="<?= $block->escapeHtmlAttr($_code) ?>" value="<?= $block->escapeHtml($block->getAttributeValue($_attribute)) ?>" title="<?= $block->escapeHtml($block->getAttributeLabel($_attribute)) ?>" - class="input-text <?= /* @escapeNotVerified */ $block->getAttributeValidationClass($_attribute) ?>" - maxlength="<?= /* @escapeNotVerified */ $maxQueryLength ?>" /> + class="input-text <?= $block->escapeHtmlAttr($block->getAttributeValidationClass($_attribute)) ?>" + maxlength="<?= $block->escapeHtmlAttr($maxQueryLength) ?>" /> <?php endswitch; ?> </div> </div> @@ -126,7 +137,7 @@ <button type="submit" class="action search primary" title="<?= $block->escapeHtml(__('Search')) ?>"> - <span><?= /* @escapeNotVerified */ __('Search') ?></span> + <span><?= $block->escapeHtml(__('Search')) ?></span> </button> </div> </div> @@ -147,8 +158,8 @@ require([ } }, messages: { - 'price[to]': {'greater-than-equals-to': '<?= /* @escapeNotVerified */ __('Please enter a valid price range.') ?>'}, - 'price[from]': {'less-than-equals-to': '<?= /* @escapeNotVerified */ __('Please enter a valid price range.') ?>'} + 'price[to]': {'greater-than-equals-to': '<?= $block->escapeJs(__('Please enter a valid price range.')) ?>'}, + 'price[from]': {'less-than-equals-to': '<?= $block->escapeJs(__('Please enter a valid price range.')) ?>'} } }); }); diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml index 09098b1ccd003..2e183291da778 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var \Magento\CatalogSearch\Helper\Data $helper */ -$helper = $this->helper('Magento\CatalogSearch\Helper\Data'); +$helper = $this->helper(\Magento\CatalogSearch\Helper\Data::class); ?> <div class="nested"> - <a class="action advanced" href="<?= /* @escapeNotVerified */ $helper->getAdvancedSearchUrl() ?>" data-action="advanced-search"> - <?= /* @escapeNotVerified */ __('Advanced Search') ?> + <a class="action advanced" href="<?= $block->escapeUrl($helper->getAdvancedSearchUrl()) ?>" data-action="advanced-search"> + <?= $block->escapeHtml(__('Advanced Search')) ?> </a> </div> diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml index 3f616ab791dfe..e21b031d69521 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @@ -14,43 +11,43 @@ /** this changes need for valid apply filters and configuration before search process is started */ $productList = $block->getProductListHtml(); ?> -<?php if ($results = $block->getResultCount()): ?> +<?php if ($results = $block->getResultCount()) : ?> <div class="search found"> <?php if ($results == 1) : ?> - <?= /* @escapeNotVerified */ __('<strong>%1 item</strong> were found using the following search criteria', $results) ?> - <?php else: ?> - <?= /* @escapeNotVerified */ __('<strong>%1 items</strong> were found using the following search criteria', $results) ?> + <?= /* @noEscape */ __('<strong>%1 item</strong> were found using the following search criteria', $results) ?> + <?php else : ?> + <?= /* @noEscape */ __('<strong>%1 items</strong> were found using the following search criteria', $results) ?> <?php endif; ?> </div> -<?php else: ?> +<?php else : ?> <div role="alert" class="message error"> <div> - <?= /* @escapeNotVerified */ __('We can\'t find any items matching these search criteria.') ?> <a href="<?= /* @escapeNotVerified */ $block->getFormUrl() ?>"><?= /* @escapeNotVerified */ __('Modify your search.') ?></a> + <?= $block->escapeHtml(__('We can\'t find any items matching these search criteria.')) ?> <a href="<?= $block->escapeUrl($block->getFormUrl()) ?>"><?= $block->escapeHtml(__('Modify your search.')) ?></a> </div> </div> <?php endif; ?> <?php $searchCriterias = $block->getSearchCriterias(); ?> <div class="search summary"> - <?php foreach (['left', 'right'] as $side): ?> - <?php if (@$searchCriterias[$side]): ?> + <?php foreach (['left', 'right'] as $side) : ?> + <?php if (!empty($searchCriterias[$side])) : ?> <ul class="items"> - <?php foreach ($searchCriterias[$side] as $criteria): ?> + <?php foreach ($searchCriterias[$side] as $criteria) : ?> <li class="item"><strong><?= $block->escapeHtml(__($criteria['name'])) ?>:</strong> <?= $block->escapeHtml($criteria['value']) ?></li> <?php endforeach; ?> </ul> <?php endif; ?> <?php endforeach; ?> </div> -<?php if ($block->getResultCount()): ?> +<?php if ($block->getResultCount()) : ?> <div class="message notice"> <div> - <?= /* @escapeNotVerified */ __("Don't see what you're looking for?") ?> - <a href="<?= /* @escapeNotVerified */ $block->getFormUrl() ?>"><?= /* @escapeNotVerified */ __('Modify your search.') ?></a> + <?= $block->escapeHtml(__("Don't see what you're looking for?")) ?> + <a href="<?= $block->escapeUrl($block->getFormUrl()) ?>"><?= $block->escapeHtml(__('Modify your search.')) ?></a> </div> </div> <?php endif; ?> -<?php if ($block->getResultCount()): ?> - <div class="search results"><?= /* @escapeNotVerified */ $productList ?></div> +<?php if ($block->getResultCount()) : ?> + <div class="search results"><?= /* @noEscape */ $productList ?></div> <?php endif; ?> <?php $block->getSearchCriterias(); ?> diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/result.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/result.phtml index 2757ae3b5f7ed..c63e6ff4abe0f 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/result.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/result.phtml @@ -3,34 +3,31 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -<?php if ($block->getResultCount()): ?> -<?= $block->getChildHtml('tagged_product_list_rss_link') ?> +<?php if ($block->getResultCount()) : ?> + <?= /* @noEscape */ $block->getChildHtml('tagged_product_list_rss_link') ?> <div class="search results"> - <?php if ($messages = $block->getNoteMessages()):?> + <?php if ($messages = $block->getNoteMessages()) : ?> <div class="message notice"> <div> - <?php foreach ($messages as $message):?> - <?= /* @escapeNotVerified */ $message ?><br /> - <?php endforeach;?> + <?php foreach ($messages as $message) : ?> + <?= /* @noEscape */ $message ?><br /> + <?php endforeach; ?> </div> </div> <?php endif; ?> <?= $block->getProductListHtml() ?> </div> -<?php else: ?> +<?php else : ?> <div class="message notice"> <div> - <?= /* @escapeNotVerified */ ($block->getNoResultText()) ? $block->getNoResultText() : __('Your search returned no results.') ?> - <?= $block->getAdditionalHtml() ?> - <?php if ($messages = $block->getNoteMessages()):?> - <?php foreach ($messages as $message):?> - <br /><?= /* @escapeNotVerified */ $message ?> - <?php endforeach;?> + <?= $block->escapeHtml($block->getNoResultText() ? $block->getNoResultText() : __('Your search returned no results.')) ?> + <?= /* @noEscape */ $block->getAdditionalHtml() ?> + <?php if ($messages = $block->getNoteMessages()) : ?> + <?php foreach ($messages as $message) : ?> + <br /><?= /* @noEscape */ $message ?> + <?php endforeach; ?> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/search_terms_log.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/search_terms_log.phtml index 61609bdf66bda..38ef11933a46f 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/search_terms_log.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/search_terms_log.phtml @@ -3,14 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile ?> -<?php if ($block->getSearchTermsLog()->isPageCacheable()): ?> +<?php if ($block->getSearchTermsLog()->isPageCacheable()) : ?> <script type="text/x-magento-init"> { "*": { "Magento_CatalogSearch/js/search-terms-log": { - "url": "<?= /* @escapeNotVerified */ $block->getUrl('catalogsearch/searchTermsLog/save') ?>" + "url": "<?= $block->escapeUrl($block->getUrl('catalogsearch/searchTermsLog/save')) ?>" } } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php index 4fdb9a3e2138d..ac3a5092bb3bf 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlPathGenerator.php @@ -3,8 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogUrlRewrite\Model; +use Magento\Store\Model\Store; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\Product; +use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; + +/** + * Class ProductUrlPathGenerator + */ class ProductUrlPathGenerator { const XML_PATH_PRODUCT_URL_SUFFIX = 'catalog/seo/product_url_suffix'; @@ -17,36 +30,36 @@ class ProductUrlPathGenerator protected $productUrlSuffix = []; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $storeManager; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $scopeConfig; /** - * @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator + * @var CategoryUrlPathGenerator */ protected $categoryUrlPathGenerator; /** - * @var \Magento\Catalog\Api\ProductRepositoryInterface + * @var ProductRepositoryInterface */ protected $productRepository; /** - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param StoreManagerInterface $storeManager + * @param ScopeConfigInterface $scopeConfig * @param CategoryUrlPathGenerator $categoryUrlPathGenerator - * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + * @param ProductRepositoryInterface $productRepository */ public function __construct( - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator, - \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + StoreManagerInterface $storeManager, + ScopeConfigInterface $scopeConfig, + CategoryUrlPathGenerator $categoryUrlPathGenerator, + ProductRepositoryInterface $productRepository ) { $this->storeManager = $storeManager; $this->scopeConfig = $scopeConfig; @@ -57,8 +70,8 @@ public function __construct( /** * Retrieve Product Url path (with category if exists) * - * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Catalog\Model\Category $category + * @param Product $product + * @param Category $category * * @return string */ @@ -78,10 +91,10 @@ public function getUrlPath($product, $category = null) /** * Prepare URL Key with stored product data (fallback for "Use Default Value" logic) * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return string */ - protected function prepareProductDefaultUrlKey(\Magento\Catalog\Model\Product $product) + protected function prepareProductDefaultUrlKey(Product $product) { $storedProduct = $this->productRepository->getById($product->getId()); $storedUrlKey = $storedProduct->getUrlKey(); @@ -91,9 +104,9 @@ protected function prepareProductDefaultUrlKey(\Magento\Catalog\Model\Product $p /** * Retrieve Product Url path with suffix * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @param int $storeId - * @param \Magento\Catalog\Model\Category $category + * @param Category $category * @return string */ public function getUrlPathWithSuffix($product, $storeId, $category = null) @@ -104,8 +117,8 @@ public function getUrlPathWithSuffix($product, $storeId, $category = null) /** * Get canonical product url path * - * @param \Magento\Catalog\Model\Product $product - * @param \Magento\Catalog\Model\Category|null $category + * @param Product $product + * @param Category|null $category * @return string */ public function getCanonicalUrlPath($product, $category = null) @@ -117,7 +130,7 @@ public function getCanonicalUrlPath($product, $category = null) /** * Generate product url key based on url_key entered by merchant or product name * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return string|null */ public function getUrlKey($product) @@ -129,13 +142,15 @@ public function getUrlKey($product) /** * Prepare url key for product * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return string */ - protected function prepareProductUrlKey(\Magento\Catalog\Model\Product $product) + protected function prepareProductUrlKey(Product $product) { - $urlKey = $product->getUrlKey(); - return $product->formatUrlKey($urlKey === '' || $urlKey === null ? $product->getName() : $urlKey); + $urlKey = (string)$product->getUrlKey(); + $urlKey = trim(strtolower($urlKey)); + + return $urlKey ?: $product->formatUrlKey($product->getName()); } /** @@ -153,7 +168,7 @@ protected function getProductUrlSuffix($storeId = null) if (!isset($this->productUrlSuffix[$storeId])) { $this->productUrlSuffix[$storeId] = $this->scopeConfig->getValue( self::XML_PATH_PRODUCT_URL_SUFFIX, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php index 7435096642de2..5076577447af3 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlPathGeneratorTest.php @@ -11,6 +11,9 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Store\Model\ScopeInterface; +/** + * Class ProductUrlPathGeneratorTest + */ class ProductUrlPathGeneratorTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator */ @@ -77,10 +80,11 @@ protected function setUp(): void public function getUrlPathDataProvider(): array { return [ - 'path based on url key' => ['url-key', null, 'url-key'], - 'path based on product name 1' => ['', 'product-name', 'product-name'], - 'path based on product name 2' => [null, 'product-name', 'product-name'], - 'path based on product name 3' => [false, 'product-name', 'product-name'] + 'path based on url key uppercase' => ['Url-Key', null, 0, 'url-key'], + 'path based on url key' => ['url-key', null, 0, 'url-key'], + 'path based on product name 1' => ['', 'product-name', 1, 'product-name'], + 'path based on product name 2' => [null, 'product-name', 1, 'product-name'], + 'path based on product name 3' => [false, 'product-name', 1, 'product-name'] ]; } @@ -88,16 +92,18 @@ public function getUrlPathDataProvider(): array * @dataProvider getUrlPathDataProvider * @param string|null|bool $urlKey * @param string|null|bool $productName + * @param int $formatterCalled * @param string $result * @return void */ - public function testGetUrlPath($urlKey, $productName, $result): void + public function testGetUrlPath($urlKey, $productName, $formatterCalled, $result): void { $this->product->expects($this->once())->method('getData')->with('url_path') ->will($this->returnValue(null)); $this->product->expects($this->any())->method('getUrlKey')->will($this->returnValue($urlKey)); $this->product->expects($this->any())->method('getName')->will($this->returnValue($productName)); - $this->product->expects($this->once())->method('formatUrlKey')->will($this->returnArgument(0)); + $this->product->expects($this->exactly($formatterCalled)) + ->method('formatUrlKey')->will($this->returnArgument(0)); $this->assertEquals($result, $this->productUrlPathGenerator->getUrlPath($this->product, null)); } diff --git a/app/code/Magento/Checkout/Model/Layout/AbstractTotalsProcessor.php b/app/code/Magento/Checkout/Model/Layout/AbstractTotalsProcessor.php index 12a8838a7e9ed..ca577ed714a6e 100644 --- a/app/code/Magento/Checkout/Model/Layout/AbstractTotalsProcessor.php +++ b/app/code/Magento/Checkout/Model/Layout/AbstractTotalsProcessor.php @@ -3,9 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Model\Layout; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; /** * Abstract totals processor. @@ -13,6 +15,7 @@ * Can be used to process totals information that will be rendered during checkout. * Abstract class provides sorting routing to sort total information based on configuration settings. * + * phpcs:disable Magento2.Classes.AbstractApi * @api */ abstract class AbstractTotalsProcessor @@ -35,12 +38,14 @@ public function __construct( } /** + * Sort total information based on configuration settings. + * * @param array $totals * @return array */ public function sortTotals($totals) { - $configData = $this->scopeConfig->getValue('sales/totals_sort'); + $configData = $this->scopeConfig->getValue('sales/totals_sort', ScopeInterface::SCOPE_STORES); foreach ($totals as $code => &$total) { //convert JS naming style to config naming style $code = str_replace('-', '_', $code); diff --git a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php index e0de45a3f0dea..2eced5c642261 100644 --- a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php +++ b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php @@ -112,6 +112,12 @@ public function savePaymentInformation( $quoteRepository = $this->getCartRepository(); /** @var \Magento\Quote\Model\Quote $quote */ $quote = $quoteRepository->getActive($cartId); + $customerId = $quote->getBillingAddress() + ->getCustomerId(); + if (!$billingAddress->getCustomerId() && $customerId) { + //It's necessary to verify the price rules with the customer data + $billingAddress->setCustomerId($customerId); + } $quote->removeAddress($quote->getBillingAddress()->getId()); $quote->setBillingAddress($billingAddress); $quote->setDataChanges(true); diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml index 49425b5cc5e55..7d8406adc9039 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml @@ -11,8 +11,7 @@ <arguments> <argument name="shipping" type="string"/> </arguments> - <waitForElementVisible selector="{{CheckoutCartSummarySection.shipping}}" time="30" after="assertSubtotal" stepKey="waitForShippingPriceToBeVisible"/> - <waitForElementVisible selector="{{CheckoutCartSummarySection.shippingAmount(shipping)}}" time="30" after="waitForShippingPriceToBeVisible" stepKey="waitForShippingPriceAmountVisible"/> - <see userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" after="waitForShippingPriceAmountVisible" stepKey="assertShipping"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.shipping}}" stepKey="waitForElementToBeVisible" after="assertSubtotal"/> + <waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="30" stepKey="assertShipping" after="waitForElementToBeVisible"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 34f2cfe7f7fff..59e997eccecc0 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -70,6 +70,6 @@ <argument name="paymentMethod" type="string"/> </arguments> <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="waitForLoading3" stepKey="waitForPaymentSectionLoaded"/> - <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" parametrized="true" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> + <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml index 88dd1d01c5f8f..06a49b856b5e2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoginAsCustomerOnCheckoutPageActionGroup.xml @@ -22,6 +22,6 @@ <doubleClick selector="{{CheckoutShippingSection.loginButton}}" stepKey="clickLoginBtn"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear3"/> <waitForPageLoad stepKey="waitToBeLoggedIn"/> - <waitForElementNotVisible selector="{{CheckoutShippingSection.email}}" userInput="{{customer.email}}" stepKey="waitForEmailInvisible" time ="60"/> + <waitForElementNotVisible selector="{{CheckoutShippingSection.email}}" stepKey="waitForEmailInvisible" time ="60"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml new file mode 100644 index 0000000000000..cea9d968b58e1 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/OpenStoreFrontCheckoutShippingPageActionGroup.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenStoreFrontCheckoutShippingPageActionGroup"> + <amOnPage url="{{CheckoutShippingPage.url}}" stepKey="amOnCheckoutShippingPage"/> + <waitForPageLoad stepKey="waitForCheckoutShippingPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCustomerSignInActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCustomerSignInActionGroup.xml deleted file mode 100644 index b6c45dd6145ab..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCustomerSignInActionGroup.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontCheckoutCustomerSignInActionGroup"> - <arguments> - <argument name="customerEmail" type="string" defaultValue="$$createCustomer.email$$"/> - <argument name="password" type="string" defaultValue="$$createCustomer.password$$"/> - </arguments> - <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customerEmail}}" stepKey="fillEmailAddress"/> - <waitForElementVisible selector="{{CheckoutShippingSection.password}}" stepKey="waitForPasswordFieldToBeVisible"/> - <fillField selector="{{CheckoutShippingSection.password}}" userInput="{{password}}" stepKey="fillPassword"/> - <click selector="{{CheckoutShippingSection.loginButton}}" stepKey="clickLoginButton"/> - <waitForPageLoad stepKey="waitForLoginPageToLoad"/> - </actionGroup> -</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml new file mode 100644 index 0000000000000..12974617d55ae --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <!-- Free shipping --> + <entity name="EnableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToSpecificCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFreeShippingToAfghanistanConfigData"> + <data key="path">carriers/freeshipping/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFreeShippingToAllAllowedCountriesConfigData"> + <data key="path">carriers/freeshipping/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFreeShippingConfigData"> + <data key="path">carriers/freeshipping/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> + + <!-- Flat Rate shipping --> + <entity name="EnableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Yes</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToSpecificCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Specific Countries</data> + <data key="value">1</data> + </entity> + <entity name="EnableFlatRateToAfghanistanConfigData"> + <data key="path">carriers/flatrate/specificcountry</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">Afghanistan</data> + <data key="value">AF</data> + </entity> + <entity name="EnableFlatRateToAllAllowedCountriesConfigData"> + <data key="path">carriers/flatrate/sallowspecific</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">All Allowed Countries</data> + <data key="value">0</data> + </entity> + <entity name="DisableFlatRateConfigData"> + <data key="path">carriers/flatrate/active</data> + <data key="scope">carriers</data> + <data key="scope_id">1</data> + <data key="label">No</data> + <data key="value">0</data> + </entity> +</entities> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml index 977f559f0071e..2024d249418ac 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml @@ -30,7 +30,7 @@ <element name="ProductPriceByOption" type="text" selector="//*[contains(@class, 'item-options')]/dd[normalize-space(.)='{{var1}}']/ancestor::tr//td[contains(@class, 'price')]//span[@class='price']" parameterized="true"/> <element name="RemoveItem" type="button" selector="//table[@id='shopping-cart-table']//tbody//tr[contains(@class,'item-actions')]//a[contains(@class,'action-delete')]"/> - <element name="removeProductByName" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/> + <element name="removeProductByName" type="text" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/> <element name="productName" type="text" selector="//tbody[@class='cart item']//strong[@class='product-item-name']"/> <element name="nthItemOption" type="block" selector=".item:nth-of-type({{numElement}}) .item-options" parameterized="true"/> <element name="nthEditButton" type="block" selector=".item:nth-of-type({{numElement}}) .action-edit" parameterized="true"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml index 5c8060d508179..5b546e6d37c0a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml @@ -19,5 +19,6 @@ <element name="shipHereButton" type="button" selector="//div/following-sibling::div/button[contains(@class, 'action-select-shipping-item')]"/> <element name="shippingMethodLoader" type="button" selector="//div[contains(@class, 'checkout-shipping-method')]/following-sibling::div[contains(@class, 'loading-mask')]"/> <element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/> + <element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml new file mode 100644 index 0000000000000..31a9d011a91c7 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckConfigsChangesAreNotAffectedStartedCheckoutProcessTest"> + <annotations> + <features value="Checkout"/> + <stories value="Changes in configs are not affecting checkout process"/> + <title value="Admin check configs changes are not affected started checkout process test"/> + <description value="Changes in admin for shipping rates are not affecting checkout process that has been started"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-12599"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + + <!-- Enable free shipping method --> + <magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/> + + <!-- Disable flat rate method --> + <magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/> + </before> + <after> + <!-- Roll back configuration --> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> + <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> + + <!-- Delete simple product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + + <!-- Log out --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Add product to cart --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Proceed to Checkout from mini shopping cart --> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/> + + <!-- Fill all required fields --> + <actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="fillNewShippingAddress"> + <argument name="customer" value="Simple_Customer_Without_Address" /> + <argument name="address" value="US_Address_TX"/> + </actionGroup> + + <!-- Assert Free Shipping checkbox --> + <seeCheckboxIsChecked selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShipping}}" stepKey="freeShippingMethodCheckboxIsChecked"/> + + <!-- Click Next button --> + <click selector="{{CheckoutShippingGuestInfoSection.next}}" stepKey="clickNext"/> + <waitForPageLoad stepKey="waitForShipmentPageLoad"/> + + <!-- Payment step is opened --> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/> + + <!-- Order Summary block contains information about shipping --> + <actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckShippingMethod"> + <argument name="shippingMethod" value="freeTitleDefault.value"/> + </actionGroup> + + <!-- Open new browser's window and login as Admin --> + <openNewTab stepKey="openNewTab"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Go to Store > Configuration > Sales > Shipping Methods --> + <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> + + <!-- Enable "Flat Rate" --> + <actionGroup ref="AdminChangeFlatRateShippingMethodStatusActionGroup" stepKey="enableFlatRateShippingStatus"/> + + <!-- Flush cache --> + <magentoCLI command="cache:flush" stepKey="cacheFlush"/> + + <!-- Back to the Checkout and refresh the page --> + <switchToPreviousTab stepKey="switchToPreviousTab"/> + <reloadPage stepKey="refreshPage"/> + <waitForPageLoad stepKey="waitPageReload"/> + + <!-- Payment step is opened after refreshing --> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSection"/> + + <!-- Order Summary block contains information about free shipping --> + <actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckFreeShippingMethod"> + <argument name="shippingMethod" value="freeTitleDefault.value"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml index a4c357141b9e2..bafad6f28a680 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout as customer using new address test"/> <description value="Checkout as customer using new address"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14740"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml index 7651e1dad8388..2c341a5c4c1ab 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout as customer using non default address test"/> <description value="Checkout as customer using non default address"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14739"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml index 24f6646ba2ff4..990459d7c81b7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout using sign in link test"/> <description value="Checkout using 'Sign In' link"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14738"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index b48475604868b..3ec73aec580d5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -14,7 +14,7 @@ <stories value="OnePageCheckout within Offline Payment Methods"/> <title value="OnePageCheckout with all product types test"/> <description value="Checkout with all product types"/> - <severity value="CRITICAl"/> + <severity value="CRITICAL"/> <testCaseId value="MC-14742"/> <group value="checkout"/> <group value="mtf_migrated"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml index cb34e1b3810b8..4d9b90f5713c2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml @@ -15,13 +15,10 @@ <testCaseId value="MC-14715"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml index b9b88f0c6dfbd..3dae3b3ae58d5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml @@ -15,14 +15,11 @@ <testCaseId value="MC-14719"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> <magentoCLI stepKey="disableShoppingCartSidebar" command="config:set checkout/sidebar/display 0"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple products--> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml index 90dc47ca9c215..d1196d9abec46 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml @@ -15,12 +15,10 @@ <testCaseId value="MC-14716"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!-- Create Default Category --> <createData entity="_defaultCategory" stepKey="createCategory"/> @@ -112,9 +110,9 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> - <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> - <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml index 7a4655bb19ce3..982c5fb339bf2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> <createData entity="downloadableLink1" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createDownloadableProduct"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml index 03cc0a29435d5..604c3a07e01ae 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml @@ -15,12 +15,10 @@ <testCaseId value="MC-14718"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create Grouped product with three simple product --> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"> <field key="price">100.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml index c852a1050fc38..d69f14ba12c7d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml @@ -15,13 +15,10 @@ <testCaseId value="MC-14727"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml index 7137804f12898..a6b7fd80e1d68 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml @@ -15,13 +15,10 @@ <testCaseId value="MC-14728"/> <severity value="CRITICAL"/> <group value="mtf_migrated"/> - <skip> - <issueId value="MC-16684"/> - </skip> </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml index 92c612b75f07a..1f39cc67218a2 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartAndSummaryBlockItemDisplayWithDefaultDisplayLimitationTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml index fec5bb9fadb6e..f77fa96c5d017 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCartItemDisplayWhenMoreItemsAddedToTheCartThanDefaultDisplayLimitTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml index bca14c8379ca3..c05469b282426 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckSimpleProductCartItemDisplayWithDefaultLimitationTest.xml @@ -18,7 +18,7 @@ </annotations> <before> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> <field key="price">10.00</field> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 374812a38704c..f77e3df11713d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -252,7 +252,7 @@ <click stepKey="clickNextButton" selector="{{CheckoutShippingMethodsSection.next}}" /> <waitForPageLoad stepKey="waitBillingForm"/> <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <dontsee selector="{{CheckoutPaymentSection.paymentMethodByName('Check / Money order')}}" stepKey="paymentMethodDoesNotAvailable"/> + <dontSee selector="{{CheckoutPaymentSection.paymentMethodByName('Check / Money order')}}" stepKey="paymentMethodDoesNotAvailable"/> <!-- Fill UK Address and verify that payment available and checkout successful --> <uncheckOption selector="{{StorefrontCheckoutPaymentMethodSection.billingAddressSameAsShippingShared}}" stepKey="uncheckBillingAddressSameAsShippingCheckCheckBox"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml index 05bbc49dd3484..e8843ed841b49 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml @@ -20,7 +20,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="SimpleSubCategory" stepKey="createSubCategory"/> <!--Create simple product--> <createData entity="SimpleProduct2" stepKey="simpleProduct1"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml index 461139b6d4b3f..be74a080317ea 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml @@ -20,7 +20,7 @@ <before> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> <createData entity="downloadableLink1" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createDownloadableProduct"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml new file mode 100644 index 0000000000000..f6a332a529dc9 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutForSpecificCountriesTest.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontGuestCheckoutForSpecificCountriesTest"> + <annotations> + <features value="One Page Checkout"/> + <stories value="Checkout for Specific Countries"/> + <title value="Storefront guest checkout for specific countries test"/> + <description value="Checkout flow if shipping rates are not available"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-13414"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + + <!-- Enable free shipping to specific country - Afghanistan --> + <magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/> + <magentoCLI command="config:set {{EnableFreeShippingToSpecificCountriesConfigData.path}} {{EnableFreeShippingToSpecificCountriesConfigData.value}}" stepKey="allowFreeShippingSpecificCountries"/> + <magentoCLI command="config:set {{EnableFreeShippingToAfghanistanConfigData.path}} {{EnableFreeShippingToAfghanistanConfigData.value}}" stepKey="enableFreeShippingToAfghanistan"/> + + <!-- Enable flat rate shipping to specific country - Afghanistan --> + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> + <magentoCLI command="config:set {{EnableFlatRateToSpecificCountriesConfigData.path}} {{EnableFlatRateToSpecificCountriesConfigData.value}}" stepKey="allowFlatRateSpecificCountries"/> + <magentoCLI command="config:set {{EnableFlatRateToAfghanistanConfigData.path}} {{EnableFlatRateToAfghanistanConfigData.value}}" stepKey="enableFlatRateToAfghanistan"/> + </before> + <after> + <!-- Rollback all configurations --> + <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> + <magentoCLI command="config:set {{EnableFreeShippingToAllAllowedCountriesConfigData.path}} {{EnableFreeShippingToAllAllowedCountriesConfigData.value}}" stepKey="allowFreeShippingToAllCountries"/> + <magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/> + + <!-- Delete product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + </after> + + <!-- Add product to cart --> + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage"> + <argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Go to checkout page --> + <actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/> + + <!-- Assert shipping methods are unavailable --> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMethod"> + <argument name="shippingMethodName" value="Flat Rate"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMethod"/> + + <!-- Assert no quotes message --> + <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMessage"/> + + <!-- Assert Next button --> + <dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextButton"/> + + <!-- Fill form with valid data for US > California --> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{US_Address_CA.country}}" stepKey="selectCountry"/> + <selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{US_Address_CA.state}}" stepKey="selectState"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="fillPostcode"/> + + <!-- Assert shipping methods are unavailable for US > California --> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontSeeFlatRateShippingMtd"> + <argument name="shippingMethodName" value="Flat Rate"/> + </actionGroup> + <actionGroup ref="AssertStoreFrontShippingMethodUnavailableActionGroup" stepKey="dontFreeShippingMtd"/> + + <!-- Assert no quotes message for US > California --> + <actionGroup ref="AssertStoreFrontNoQuotesMessageActionGroup" stepKey="assertNoQuotesMsg"/> + + <!-- Assert Next button for US > California --> + <dontSeeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="dontSeeNextBtn"/> + + <!-- Fill form for specific country - Afghanistan --> + <selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="selectSpecificCountry"/> + + <!-- Assert shipping methods are available --> + <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFlatRateShippingMethod"/> + <actionGroup ref="AssertStoreFrontShippingMethodAvailableActionGroup" stepKey="seeFreeShippingMethod"> + <argument name="shippingMethodName" value="Free Shipping"/> + </actionGroup> + + <!-- Assert Next button is available --> + <seeElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="seeNextButton"/> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml new file mode 100644 index 0000000000000..1db460de44996 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontRefreshPageDuringGuestCheckoutTest"> + <annotations> + <features value="Checkout"/> + <stories value="Guest checkout"/> + <title value="Storefront refresh page during guest checkout test"/> + <description value="Address is not lost for guest checkout if guest refresh page during checkout"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-12084"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Create simple product --> + <createData entity="SimpleProduct2" stepKey="createProduct"/> + </before> + <after> + <!-- Delete simple product --> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + + <!-- Logout admin --> + <actionGroup ref="logout" stepKey="logoutAsAdmin"/> + </after> + <!-- Add simple product to cart as Guest --> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddSimpleProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + + <!-- Go to Checkout page --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/> + <waitForPageLoad stepKey="waitForProceedToCheckout"/> + + <!-- Fill email field and addresses form and go next --> + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"> + <argument name="shippingMethod" value="Flat Rate"/> + </actionGroup> + + <!-- Refresh page --> + <reloadPage stepKey="refreshPage"/> + + <!-- Click Place Order and assert order is placed --> + <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <!-- Order review page has address that was created during checkout --> + <amOnPage url="{{AdminOrderPage.url({$grabOrderNumber})}}" stepKey="navigateToOrderPage"/> + <waitForPageLoad stepKey="waitForCreatedOrderPage"/> + <see selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}} {{CustomerAddressSimple.city}}, {{CustomerAddressSimple.state}}, {{CustomerAddressSimple.postcode}}" stepKey="checkShippingAddress"/> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php index ea841e86586ba..df5c255398ebd 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php @@ -163,6 +163,31 @@ public function testSavePaymentInformationAndPlaceOrderWithLocolizedException() $this->model->savePaymentInformationAndPlaceOrder($cartId, $paymentMock, $billingAddressMock); } + /** + * Test for save payment and place order with new billing address + * + * @return void + */ + public function testSavePaymentInformationAndPlaceOrderWithNewBillingAddress(): void + { + $cartId = 100; + $quoteBillingAddressId = 1; + $customerId = 1; + $quoteMock = $this->createMock(\Magento\Quote\Model\Quote::class); + $quoteBillingAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class); + $billingAddressMock = $this->createMock(\Magento\Quote\Api\Data\AddressInterface::class); + $paymentMock = $this->createMock(\Magento\Quote\Api\Data\PaymentInterface::class); + + $quoteBillingAddress->method('getCustomerId')->willReturn($customerId); + $quoteMock->method('getBillingAddress')->willReturn($quoteBillingAddress); + $quoteBillingAddress->method('getId')->willReturn($quoteBillingAddressId); + $this->cartRepositoryMock->method('getActive')->with($cartId)->willReturn($quoteMock); + + $this->paymentMethodManagementMock->expects($this->once())->method('set')->with($cartId, $paymentMock); + $billingAddressMock->expects($this->once())->method('setCustomerId')->with($customerId); + $this->assertTrue($this->model->savePaymentInformation($cartId, $paymentMock, $billingAddressMock)); + } + /** * @param int $cartId * @param \PHPUnit_Framework_MockObject_MockObject $billingAddressMock @@ -179,9 +204,10 @@ private function getMockForAssignBillingAddress($cartId, $billingAddressMock) ['setLimitCarrier', 'getShippingMethod', 'getShippingRateByCode'] ); $this->cartRepositoryMock->expects($this->any())->method('getActive')->with($cartId)->willReturn($quoteMock); - $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($quoteBillingAddress); + $quoteMock->method('getBillingAddress')->willReturn($quoteBillingAddress); $quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($quoteShippingAddress); $quoteBillingAddress->expects($this->once())->method('getId')->willReturn($billingAddressId); + $quoteBillingAddress->expects($this->once())->method('getId')->willReturn($billingAddressId); $quoteMock->expects($this->once())->method('removeAddress')->with($billingAddressId); $quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddressMock); $quoteMock->expects($this->once())->method('setDataChanges')->willReturnSelf(); diff --git a/app/code/Magento/Checkout/view/frontend/templates/button.phtml b/app/code/Magento/Checkout/view/frontend/templates/button.phtml index c3edfe30f8bdd..b0087794ea850 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/button.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/button.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?> <?php if ($block->getCanViewOrder() && $block->getCanPrintOrder()) :?> - <a href="<?= /* @escapeNotVerified */ $block->getPrintUrl() ?>" target="_blank" class="print"> - <?= /* @escapeNotVerified */ __('Print receipt') ?> + <a href="<?= $block->escapeUrl($block->getPrintUrl()) ?>" target="_blank" class="print"> + <?= $block->escapeHtml(__('Print receipt')) ?> </a> <?= $block->getChildHtml() ?> <?php endif;?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart.phtml index 929f053febfc7..e71ea8c66288c 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart.phtml @@ -12,7 +12,9 @@ */ if ($block->getItemsCount()) { + // phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput echo $block->getChildHtml('with-items'); } else { + // phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput echo $block->getChildHtml('no-items'); } diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml index cb92e62f1f0c8..b807a6db019b5 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @@ -16,6 +14,7 @@ <?php $name = $block->getNameInLayout(); foreach ($block->getChildNames($name) as $childName) { + // phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput echo $block->getChildBlock($childName)->setItem($block->getItem())->toHtml(); } ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml index 1d67b325e01c5..4522500d395b6 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml @@ -4,16 +4,17 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> -<div class="block discount" id="block-discount" data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'> +<div class="block discount" + id="block-discount" + data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}' +> <div class="title" data-role="title"> - <strong id="block-discount-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ __('Apply Discount Code') ?></strong> + <strong id="block-discount-heading" role="heading" aria-level="2"><?= $block->escapeHtml(__('Apply Discount Code')) ?></strong> </div> <div class="content" data-role="content" aria-labelledby="block-discount-heading"> <form id="discount-coupon-form" - action="<?= /* @escapeNotVerified */ $block->getUrl('checkout/cart/couponPost') ?>" + action="<?= $block->escapeUrl($block->getUrl('checkout/cart/couponPost')) ?>" method="post" data-mage-init='{"discountCode":{"couponCodeSelector": "#coupon_code", "removeCouponSelector": "#remove-coupon", @@ -22,21 +23,30 @@ <div class="fieldset coupon<?= strlen($block->getCouponCode()) ? ' applied' : '' ?>"> <input type="hidden" name="remove" id="remove-coupon" value="0" /> <div class="field"> - <label for="coupon_code" class="label"><span><?= /* @escapeNotVerified */ __('Enter discount code') ?></span></label> + <label for="coupon_code" class="label"><span><?= $block->escapeHtml(__('Enter discount code')) ?></span></label> <div class="control"> - <input type="text" class="input-text" id="coupon_code" name="coupon_code" value="<?= $block->escapeHtml($block->getCouponCode()) ?>" placeholder="<?= $block->escapeHtml(__('Enter discount code')) ?>" <?php if (strlen($block->getCouponCode())): ?> disabled="disabled" <?php endif; ?> /> + <input type="text" + class="input-text" + id="coupon_code" + name="coupon_code" + value="<?= $block->escapeHtmlAttr($block->getCouponCode()) ?>" + placeholder="<?= $block->escapeHtmlAttr(__('Enter discount code')) ?>" + <?php if (strlen($block->getCouponCode())) :?> + disabled="disabled" + <?php endif; ?> + /> </div> </div> <div class="actions-toolbar"> - <?php if (!strlen($block->getCouponCode())): ?> + <?php if (!strlen($block->getCouponCode())) :?> <div class="primary"> - <button class="action apply primary" type="button" value="<?= /* @escapeNotVerified */ __('Apply Discount') ?>"> - <span><?= /* @escapeNotVerified */ __('Apply Discount') ?></span> + <button class="action apply primary" type="button" value="<?= $block->escapeHtmlAttr(__('Apply Discount')) ?>"> + <span><?= $block->escapeHtml(__('Apply Discount')) ?></span> </button> </div> - <?php else: ?> + <?php else :?> <div class="primary"> - <button type="button" class="action cancel primary" value="<?= /* @escapeNotVerified */ __('Cancel Coupon') ?>"><span><?= /* @escapeNotVerified */ __('Cancel Coupon') ?></span></button> + <button type="button" class="action cancel primary" value="<?= $block->escapeHtmlAttr(__('Cancel Coupon')) ?>"><span><?= $block->escapeHtml(__('Cancel Coupon')) ?></span></button> </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml index 814a569d0946c..e1ab036c7d889 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml @@ -4,52 +4,56 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Cart\Grid */ ?> -<?php $mergedCells = ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?> +<?php $mergedCells = ($this->helper(Magento\Tax\Helper\Data::class)->displayCartBothPrices() ? 2 : 1); ?> <?= $block->getChildHtml('form_before') ?> -<form action="<?= /* @escapeNotVerified */ $block->getUrl('checkout/cart/updatePost') ?>" +<form action="<?= $block->escapeUrl($block->getUrl('checkout/cart/updatePost')) ?>" method="post" id="form-validate" data-mage-init='{"Magento_Checkout/js/action/update-shopping-cart": - {"validationURL" : "<?= /* @escapeNotVerified */ $block->getUrl('checkout/cart/updateItemQty') ?>", + {"validationURL" : "<?= $block->escapeUrl($block->getUrl('checkout/cart/updateItemQty')) ?>", "updateCartActionContainer": "#update_cart_action_container"} }' class="form form-cart"> <?= $block->getBlockHtml('formkey') ?> <div class="cart table-wrapper<?= $mergedCells == 2 ? ' detailed' : '' ?>"> - <?php if ($block->getPagerHtml()): ?> - <div class="cart-products-toolbar cart-products-toolbar-top toolbar" data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?></div> + <?php if ($block->getPagerHtml()) :?> + <div class="cart-products-toolbar cart-products-toolbar-top toolbar" + data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?> + </div> <?php endif ?> <table id="shopping-cart-table" class="cart items data table" data-mage-init='{"shoppingCart":{"emptyCartButton": ".action.clear", "updateCartActionContainer": "#update_cart_action_container"}}'> - <caption class="table-caption"><?= /* @escapeNotVerified */ __('Shopping Cart Items') ?></caption> + <caption class="table-caption"><?= $block->escapeHtml(__('Shopping Cart Items')) ?></caption> <thead> <tr> - <th class="col item" scope="col"><span><?= /* @escapeNotVerified */ __('Item') ?></span></th> - <th class="col price" scope="col"><span><?= /* @escapeNotVerified */ __('Price') ?></span></th> - <th class="col qty" scope="col"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th> - <th class="col subtotal" scope="col"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th> + <th class="col item" scope="col"><span><?= $block->escapeHtml(__('Item')) ?></span></th> + <th class="col price" scope="col"><span><?= $block->escapeHtml(__('Price')) ?></span></th> + <th class="col qty" scope="col"><span><?= $block->escapeHtml(__('Qty')) ?></span></th> + <th class="col subtotal" scope="col"><span><?= $block->escapeHtml(__('Subtotal')) ?></span></th> </tr> </thead> - <?php foreach ($block->getItems() as $_item): ?> + <?php foreach ($block->getItems() as $_item) :?> <?= $block->getItemHtml($_item) ?> <?php endforeach ?> </table> - <?php if ($block->getPagerHtml()): ?> - <div class="cart-products-toolbar cart-products-toolbar-bottom toolbar" data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?></div> + <?php if ($block->getPagerHtml()) :?> + <div class="cart-products-toolbar cart-products-toolbar-bottom toolbar" + data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?> + </div> <?php endif ?> </div> <div class="cart main actions"> - <?php if ($block->getContinueShoppingUrl()): ?> + <?php if ($block->getContinueShoppingUrl()) :?> <a class="action continue" href="<?= $block->escapeUrl($block->getContinueShoppingUrl()) ?>" title="<?= $block->escapeHtml(__('Continue Shopping')) ?>"> - <span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span> + <span><?= $block->escapeHtml(__('Continue Shopping')) ?></span> </a> <?php endif; ?> <button type="submit" @@ -58,7 +62,7 @@ value="empty_cart" title="<?= $block->escapeHtml(__('Clear Shopping Cart')) ?>" class="action clear" id="empty_cart_button"> - <span><?= /* @escapeNotVerified */ __('Clear Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Clear Shopping Cart')) ?></span> </button> <button type="submit" name="update_cart_action" @@ -66,7 +70,7 @@ value="update_qty" title="<?= $block->escapeHtml(__('Update Shopping Cart')) ?>" class="action update"> - <span><?= /* @escapeNotVerified */ __('Update Shopping Cart') ?></span> + <span><?= $block->escapeHtml(__('Update Shopping Cart')) ?></span> </button> <input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml index bfb7ddc55cda6..3b09512eb505b 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml @@ -4,25 +4,23 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php $buttonTitle = __('Update Cart'); ?> -<?php if ($_product->isSaleable()): ?> +<?php if ($_product->isSaleable()) :?> <div class="box-tocart update"> <fieldset class="fieldset"> - <?php if ($block->shouldRenderQuantity()): ?> + <?php if ($block->shouldRenderQuantity()) :?> <div class="field qty"> - <label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label> + <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label> <div class="control"> <input type="number" name="qty" id="qty" min="0" value="" - title="<?= /* @escapeNotVerified */ __('Qty') ?>" + title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="input-text qty" data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/> </div> @@ -30,10 +28,10 @@ <?php endif; ?> <div class="actions"> <button type="submit" - title="<?= /* @escapeNotVerified */ $buttonTitle ?>" + title="<?= $block->escapeHtmlAttr($buttonTitle) ?>" class="action primary tocart" id="product-updatecart-button"> - <span><?= /* @escapeNotVerified */ $buttonTitle ?></span> + <span><?= $block->escapeHtml($buttonTitle) ?></span> </button> <?= $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml index d15794fb761bb..77dde1eab482a 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml @@ -4,7 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate +// phpcs:disable Magento2.Files.LineLength.MaxExceeded /** @var $block \Magento\Checkout\Block\Cart\Item\Renderer */ @@ -12,72 +13,82 @@ $_item = $block->getItem(); $product = $_item->getProduct(); $isVisibleProduct = $product->isVisibleInSiteVisibility(); /** @var \Magento\Msrp\Helper\Data $helper */ -$helper = $this->helper('Magento\Msrp\Helper\Data'); +$helper = $this->helper(Magento\Msrp\Helper\Data::class); $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product); ?> <tbody class="cart item"> <tr class="item-info"> <td data-th="<?= $block->escapeHtml(__('Item')) ?>" class="col item"> - <?php if ($block->hasProductUrl()):?> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl() ?>" + <?php if ($block->hasProductUrl()) :?> + <a href="<?= $block->escapeUrl($block->getProductUrl()) ?>" title="<?= $block->escapeHtml($block->getProductName()) ?>" tabindex="-1" class="product-item-photo"> - <?php else:?> + <?php else :?> <span class="product-item-photo"> <?php endif;?> <?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?> - <?php if ($block->hasProductUrl()):?> + <?php if ($block->hasProductUrl()) :?> </a> - <?php else: ?> + <?php else :?> </span> <?php endif; ?> <div class="product-item-details"> <strong class="product-item-name"> - <?php if ($block->hasProductUrl()):?> - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl() ?>"><?= $block->escapeHtml($block->getProductName()) ?></a> - <?php else: ?> + <?php if ($block->hasProductUrl()) :?> + <a href="<?= $block->escapeUrl($block->getProductUrl()) ?>"><?= $block->escapeHtml($block->getProductName()) ?></a> + <?php else :?> <?= $block->escapeHtml($block->getProductName()) ?> <?php endif; ?> </strong> - <?php if ($_options = $block->getOptionList()):?> + <?php if ($_options = $block->getOptionList()) :?> <dl class="item-options"> - <?php foreach ($_options as $_option) : ?> + <?php foreach ($_options as $_option) :?> <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> <dt><?= $block->escapeHtml($_option['label']) ?></dt> <dd> - <?php if (isset($_formatedOptionValue['full_view'])): ?> - <?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?> - <?php else: ?> + <?php if (isset($_formatedOptionValue['full_view'])) :?> + <?= $block->escapeHtml($_formatedOptionValue['full_view']) ?> + <?php else :?> <?= $block->escapeHtml($_formatedOptionValue['value'], ['span']) ?> <?php endif; ?> </dd> <?php endforeach; ?> </dl> <?php endif;?> - <?php if ($messages = $block->getMessages()): ?> - <?php foreach ($messages as $message): ?> - <div class="cart item message <?= /* @escapeNotVerified */ $message['type'] ?>"><div><?= $block->escapeHtml($message['text']) ?></div></div> + <?php if ($messages = $block->getMessages()) :?> + <?php foreach ($messages as $message) :?> + <div class= "cart item message <?= $block->escapeHtmlAttr($message['type']) ?>"> + <div><?= $block->escapeHtml($message['text']) ?></div> + </div> <?php endforeach; ?> <?php endif; ?> <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?> - <?php if ($addInfoBlock): ?> + <?php if ($addInfoBlock) :?> <?= $addInfoBlock->setItem($_item)->toHtml() ?> <?php endif;?> </div> </td> - <?php if ($canApplyMsrp): ?> + <?php if ($canApplyMsrp) :?> <td class="col msrp" data-th="<?= $block->escapeHtml(__('Price')) ?>"> <span class="pricing msrp"> - <span class="msrp notice"><?= /* @escapeNotVerified */ __('See price before order confirmation.') ?></span> + <span class="msrp notice"><?= $block->escapeHtml(__('See price before order confirmation.')) ?></span> <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?> - <a href="#" class="action help map" id="<?= /* @escapeNotVerified */ ($helpLinkId) ?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?= /* @escapeNotVerified */ $helpLinkId ?>","productName": "<?= /* @escapeNotVerified */ $product->getName() ?>","showAddToCart": false}}'> - <span><?= /* @escapeNotVerified */ __("What's this?") ?></span> + <a href="#" class="action help map" + id="<?= ($block->escapeHtmlAttr($helpLinkId)) ?>" + data-mage-init='{"addToCart":{ + "helpLinkId": "#<?= $block->escapeJs($block->escapeHtml($helpLinkId)) ?>", + "productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>", + "showAddToCart": false + } + }' + > + <span><?= $block->escapeHtml(__("What's this?")) ?></span> </a> </span> </td> - <?php else: ?> + <?php else :?> <td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>"> <?= $block->getUnitPriceHtml($_item) ?> </td> @@ -85,15 +96,15 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima <td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>"> <div class="field qty"> <div class="control qty"> - <label for="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty"> - <span class="label"><?= /* @escapeNotVerified */ __('Qty') ?></span> - <input id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty" - name="cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]" - data-cart-item-id="<?= $block->escapeHtml($_item->getSku()) ?>" - value="<?= /* @escapeNotVerified */ $block->getQty() ?>" + <label for="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty"> + <span class="label"><?= $block->escapeHtml(__('Qty')) ?></span> + <input id="cart-<?= $block->escapeHtmlAttr($_item->getId()) ?>-qty" + name="cart[<?= $block->escapeHtmlAttr($_item->getId()) ?>][qty]" + data-cart-item-id="<?= $block->escapeHtmlAttr($_item->getSku()) ?>" + value="<?= $block->escapeHtmlAttr($block->getQty()) ?>" type="number" size="4" - title="<?= $block->escapeHtml(__('Qty')) ?>" + title="<?= $block->escapeHtmlAttr(__('Qty')) ?>" class="input-text qty" data-validate="{required:true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/> @@ -103,9 +114,9 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima </td> <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>"> - <?php if ($canApplyMsrp): ?> + <?php if ($canApplyMsrp) :?> <span class="cart msrp subtotal">--</span> - <?php else: ?> + <?php else :?> <?= $block->getRowTotalHtml($_item) ?> <?php endif; ?> </td> @@ -113,7 +124,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima <tr class="item-actions"> <td colspan="4"> <div class="actions-toolbar"> - <?= /* @escapeNotVerified */ $block->getActions($_item) ?> + <?= /* @noEscape */ $block->getActions($_item) ?> </div> </td> </tr> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml index d7a625695b476..f8e692fc6f71c 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/price/sidebar.phtml @@ -4,12 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ ?> <?php $_item = $block->getItem() ?> <div class="price-container"> - <span class="price-label"><?= /* @escapeNotVerified */ __('Price') ?></span> - <span class="price-wrapper"><?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?></span> + <span class="price-label"><?= $block->escapeHtml(__('Price')) ?></span> + <span class="price-wrapper"> + <?= $block->escapeHtml( + $this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()) + ) ?> + </span> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/edit.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/edit.phtml index da0a83f05ef60..357bbf27772b5 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/edit.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/edit.phtml @@ -4,14 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit */ ?> -<?php if ($block->isProductVisibleInSiteVisibility()): ?> +<?php if ($block->isProductVisibleInSiteVisibility()) :?> <a class="action action-edit" - href="<?= /* @escapeNotVerified */ $block->getConfigureUrl() ?>" - title="<?= $block->escapeHtml(__('Edit item parameters')) ?>"> - <span><?= /* @escapeNotVerified */ __('Edit') ?></span> + href="<?= $block->escapeUrl($block->getConfigureUrl()) ?>" + title="<?= $block->escapeHtmlAttr(__('Edit item parameters')) ?>"> + <span><?= $block->escapeHtml(__('Edit')) ?></span> </a> <?php endif ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/remove.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/remove.phtml index 445721ca5d0c2..8b72b6c55e821 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/remove.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/renderer/actions/remove.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove */ ?> <a href="#" title="<?= $block->escapeHtml(__('Remove item')) ?>" class="action action-delete" - data-post='<?= /* @escapeNotVerified */ $block->getDeletePostJson() ?>'> + data-post='<?= /* @noEscape */ $block->getDeletePostJson() ?>'> <span> - <?= /* @escapeNotVerified */ __('Remove item') ?> + <?= $block->escapeHtml(__('Remove item')) ?> </span> </a> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/methods.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/methods.phtml index d329e2e8c1770..b045f4ec98ff7 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/methods.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/methods.phtml @@ -4,20 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Checkout\Block\Cart */ ?> -<?php if (!$block->hasError()): ?> -<?php $methods = $block->getMethods('methods') ?: $block->getMethods('top_methods') ?> -<ul class="checkout methods items checkout-methods-items"> -<?php foreach ($methods as $method): ?> - <?php $methodHtml = $block->getMethodHtml($method); ?> - <?php if (trim($methodHtml) !== ''): ?> - <li class="item"><?= /* @escapeNotVerified */ $methodHtml ?></li> - <?php endif; ?> -<?php endforeach; ?> -</ul> +<?php if (!$block->hasError()) :?> + <?php $methods = $block->getMethods('methods') ?: $block->getMethods('top_methods') ?> + <ul class="checkout methods items checkout-methods-items"> + <?php foreach ($methods as $method) :?> + <?php $methodHtml = $block->getMethodHtml($method); ?> + <?php if (trim($methodHtml) !== '') :?> + <li class="item"><?= /* @noEscape */ $methodHtml ?></li> + <?php endif; ?> + <?php endforeach; ?> + </ul> <?php endif; ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml index 20be9cd010c64..8928bbabcb718 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml @@ -4,15 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\Checkout\Block\Cart\Sidebar */ ?> <div data-block="minicart" class="minicart-wrapper"> - <a class="action showcart" href="<?= /* @escapeNotVerified */ $block->getShoppingCartUrl() ?>" + <a class="action showcart" href="<?= $block->escapeUrl($block->getShoppingCartUrl()) ?>" data-bind="scope: 'minicart_content'"> - <span class="text"><?= /* @escapeNotVerified */ __('My Cart') ?></span> + <span class="text"><?= $block->escapeHtml(__('My Cart')) ?></span> <span class="counter qty empty" data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading"> <span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span> @@ -24,7 +22,7 @@ </span> </span> </a> - <?php if ($block->getIsNeedToDisplaySideBar()): ?> + <?php if ($block->getIsNeedToDisplaySideBar()) :?> <div class="block block-minicart" data-role="dropdownDialog" data-mage-init='{"dropdownDialog":{ @@ -41,7 +39,7 @@ </div> <?= $block->getChildHtml('minicart.addons') ?> </div> - <?php else: ?> + <?php else :?> <script> require(['jquery'], function ($) { $('a.action.showcart').click(function() { @@ -51,15 +49,17 @@ </script> <?php endif ?> <script> - window.checkout = <?= /* @escapeNotVerified */ $block->getSerializedConfig() ?>; + window.checkout = <?= /* @noEscape */ $block->getSerializedConfig() ?>; </script> <script type="text/x-magento-init"> { "[data-block='minicart']": { - "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?> + "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> }, "*": { - "Magento_Ui/js/block-loader": "<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>" + "Magento_Ui/js/block-loader": "<?= $block->escapeJs( + $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) + ) ?>" } } </script> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml index 67ac4a9335565..ac150b2aa98b9 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml @@ -3,14 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + /** @var $block \Magento\Checkout\Block\Cart */ ?> <div class="cart-empty"> <?= $block->getChildHtml('checkout_cart_empty_widget') ?> - <p><?= /* @escapeNotVerified */ __('You have no items in your shopping cart.') ?></p> - <p><?php /* @escapeNotVerified */ echo __('Click <a href="%1">here</a> to continue shopping.', - $block->escapeUrl($block->getContinueShoppingUrl())) ?></p> + <p><?= $block->escapeHtml(__('You have no items in your shopping cart.')) ?></p> + <p><?= $block->escapeHtml( + __( + 'Click <a href="%1">here</a> to continue shopping.', + $block->escapeUrl($block->getContinueShoppingUrl()) + ), + ['a'] + ) ?> + </p> <?= $block->getChildHtml('shopping.cart.table.after') ?> </div> <script type="text/x-magento-init"> @@ -19,4 +25,4 @@ "Magento_Checkout/js/empty-cart": {} } } -</script> \ No newline at end of file +</script> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml index b5ddb8446ba05..a44d37dccfdc5 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml @@ -4,36 +4,47 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Checkout\Block\Cart\Shipping */ ?> -<div id="block-shipping" class="block shipping" data-mage-init='{"collapsible":{"openedState": "active", "saveState": true}}'> +<div id="block-shipping" + class="block shipping" + data-mage-init='{"collapsible":{"openedState": "active", "saveState": true}}' +> <div class="title" data-role="title"> <strong id="block-shipping-heading" role="heading" aria-level="2"> - <?= /* @escapeNotVerified */ $block->getQuote()->isVirtual() ? __('Estimate Tax') : __('Estimate Shipping and Tax') ?> + <?= $block->getQuote()->isVirtual() + ? $block->escapeHtml(__('Estimate Tax')) + : $block->escapeHtml(__('Estimate Shipping and Tax')) + ?> </strong> </div> - <div id="block-summary" data-bind="scope:'block-summary'" class="content" data-role="content" aria-labelledby="block-shipping-heading"> + <div id="block-summary" + data-bind="scope:'block-summary'" + class="content" + data-role="content" + aria-labelledby="block-shipping-heading" + > <!-- ko template: getTemplate() --><!-- /ko --> <script type="text/x-magento-init"> { "#block-summary": { - "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?> + "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> <script> - window.checkoutConfig = <?= /* @escapeNotVerified */ $block->getSerializedCheckoutConfig() ?>; + window.checkoutConfig = <?= /* @noEscape */ $block->getSerializedCheckoutConfig() ?>; window.customerData = window.checkoutConfig.customerData; window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn; require([ 'mage/url', 'Magento_Ui/js/block-loader' ], function(url, blockLoader) { - blockLoader("<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>"); - return url.setBaseUrl('<?= /* @escapeNotVerified */ $block->getBaseUrl() ?>'); + blockLoader( + "<?= $block->escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))) ?>" + ); + return url.setBaseUrl('<?= $block->escapeJs($block->escapeUrl($block->getBaseUrl())) ?>'); }) </script> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml index f39b70df98424..784c4c39076e6 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/totals.phtml @@ -15,7 +15,7 @@ <script type="text/x-magento-init"> { "#cart-totals": { - "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?> + "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml index 37a945b238d30..25124d91b6ea7 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ @@ -12,6 +12,8 @@ $_item = $block->getItem(); ?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> + <?= $block->escapeHtml( + $this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getRowTotal()) + ) ?> </span> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml index 45a6ef48e36d6..c6ee4beb00c5a 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/unit.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ @@ -12,6 +12,8 @@ $_item = $block->getItem(); ?> <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + <?= $block->escapeHtml( + $this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()) + ) ?> </span> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml b/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml index bad5acc209b5f..6cf15f4770150 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml @@ -4,7 +4,5 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml() ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml b/app/code/Magento/Checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml index e835037b5fcb4..a6686444d2ed5 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile + /** @var \Magento\Framework\View\Element\Template $block */ ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml index 47a56e8f333bc..55f7039f33344 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $block \Magento\Checkout\Block\Onepage */ ?> <div id="checkout" data-bind="scope:'checkout'" class="checkout-container"> <div id="checkout-loader" data-role="checkout-loader" class="loading-mask" data-mage-init='{"checkoutLoader": {}}'> <div class="loader"> - <img src="<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>" - alt="<?= /* @escapeNotVerified */ __('Loading...') ?>" + <img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) ?>" + alt="<?= $block->escapeHtmlAttr(__('Loading...')) ?>" style="position: absolute;"> </div> </div> @@ -18,12 +18,12 @@ <script type="text/x-magento-init"> { "#checkout": { - "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?> + "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> <script> - window.checkoutConfig = <?= /* @escapeNotVerified */ $block->getSerializedCheckoutConfig() ?>; + window.checkoutConfig = <?= /* @noEscape */ $block->getSerializedCheckoutConfig() ?>; // Create aliases for customer.js model from customer module window.isCustomerLoggedIn = window.checkoutConfig.isCustomerLoggedIn; window.customerData = window.checkoutConfig.customerData; @@ -33,8 +33,8 @@ 'mage/url', 'Magento_Ui/js/block-loader' ], function(url, blockLoader) { - blockLoader("<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>"); - return url.setBaseUrl('<?= /* @escapeNotVerified */ $block->getBaseUrl() ?>'); + blockLoader("<?= $block->escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))) ?>"); + return url.setBaseUrl('<?= $block->escapeJs($block->escapeUrl($block->getBaseUrl())) ?>'); }) </script> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/failure.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/failure.phtml index 43791ef496745..3888ec6504982 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/failure.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/failure.phtml @@ -4,9 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** @var $block \Magento\Checkout\Block\Onepage\Failure */ ?> -<?php if ($block->getRealOrderId()) : ?><p><?= /* @escapeNotVerified */ __('Order #') . $block->getRealOrderId() ?></p><?php endif ?> -<?php if ($error = $block->getErrorMessage()) : ?><p><?= /* @escapeNotVerified */ $error ?></p><?php endif ?> -<p><?= /* @escapeNotVerified */ __('Click <a href="%1">here</a> to continue shopping.', $block->escapeUrl($block->getContinueShoppingUrl())) ?></p> +<?php if ($block->getRealOrderId()) :?> + <p><?= $block->escapeHtml(__('Order #') . $block->getRealOrderId()) ?></p> +<?php endif ?> +<?php if ($error = $block->getErrorMessage()) :?> + <p><?= $block->escapeHtml($error) ?></p> +<?php endif ?> +<p><?= $block->escapeHtml( + _('Click <a href="%1">here</a> to continue shopping.', $block->escapeUrl($block->getContinueShoppingUrl())), + ['a'] +) ?> +</p> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml index 53a1fe8783509..b667764ac7bba 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml @@ -4,15 +4,21 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $block \Magento\Checkout\Block\Onepage\Link */ ?> -<?php if ($block->isPossibleOnepageCheckout()):?> +<?php if ($block->isPossibleOnepageCheckout()) :?> <button type="button" data-role="proceed-to-checkout" - title="<?= /* @escapeNotVerified */ __('Proceed to Checkout') ?>" - data-mage-init='{"Magento_Checkout/js/proceed-to-checkout":{"checkoutUrl":"<?= /* @escapeNotVerified */ $block->getCheckoutUrl() ?>"}}' + title="<?= $block->escapeHtmlAttr(__('Proceed to Checkout')) ?>" + data-mage-init='{ + "Magento_Checkout/js/proceed-to-checkout":{ + "checkoutUrl":"<?= $block->escapeJs($block->escapeUrl($block->getCheckoutUrl())) ?>" + } + }' class="action primary checkout<?= ($block->isDisabled()) ? ' disabled' : '' ?>" - <?php if ($block->isDisabled()):?>disabled="disabled"<?php endif; ?>> - <span><?= /* @escapeNotVerified */ __('Proceed to Checkout') ?></span> + <?php if ($block->isDisabled()) :?> + disabled="disabled" + <?php endif; ?>> + <span><?= $block->escapeHtml(__('Proceed to Checkout')) ?></span> </button> <?php endif?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml index 2428cc010779d..2a7ccc38e9d83 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml @@ -4,11 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block Magento\Checkout\Block\Cart\Item\Renderer */ $_item = $block->getItem(); +$taxDataHelper = $this->helper(Magento\Tax\Helper\Data::class); ?> <tbody class="cart item"> <tr> @@ -17,47 +18,53 @@ $_item = $block->getItem(); <?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?> </span> <div class="product-item-details"> - <strong class="product name product-item-name"><?= $block->escapeHtml($block->getProductName()) ?></strong> - <?php if ($_options = $block->getOptionList()):?> - <dl class="item-options"> - <?php foreach ($_options as $_option) : ?> - <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> - <dt><?= $block->escapeHtml($_option['label']) ?></dt> - <dd> - <?php if (isset($_formatedOptionValue['full_view'])): ?> - <?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?> - <?php else: ?> - <?= /* @escapeNotVerified */ $_formatedOptionValue['value'] ?> - <?php endif; ?> - </dd> - <?php endforeach; ?> - </dl> + <strong class="product name product-item-name"> + <?= $block->escapeHtml($block->getProductName()) ?> + </strong> + <?php if ($_options = $block->getOptionList()) :?> + <dl class="item-options"> + <?php foreach ($_options as $_option) :?> + <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?> + <dt><?= $block->escapeHtml($_option['label']) ?></dt> + <dd> + <?php if (isset($_formatedOptionValue['full_view'])) :?> + <?= $block->escapeHtml($_formatedOptionValue['full_view']) ?> + <?php else :?> + <?= $block->escapeHtml($_formatedOptionValue['value']) ?> + <?php endif; ?> + </dd> + <?php endforeach; ?> + </dl> <?php endif;?> - <?php if ($addtInfoBlock = $block->getProductAdditionalInformationBlock()):?> + <?php if ($addtInfoBlock = $block->getProductAdditionalInformationBlock()) :?> <?= $addtInfoBlock->setItem($_item)->toHtml() ?> <?php endif;?> </div> </td> <td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + <?php if ($taxDataHelper->displayCartPriceInclTax() || $taxDataHelper->displayCartBothPrices()) :?> <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?= $block->getUnitPriceInclTaxHtml($_item) ?> </span> <?php endif; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + <?php if ($taxDataHelper->displayCartPriceExclTax() || $taxDataHelper->displayCartBothPrices()) :?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?= $block->getUnitPriceExclTaxHtml($_item) ?> </span> <?php endif; ?> </td> - <td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>"><span class="qty"><?= /* @escapeNotVerified */ $_item->getQty() ?></span></td> + <td class="col qty" + data-th="<?= $block->escapeHtml(__('Qty')) ?>" + > + <span class="qty"><?= $block->escapeHtml($_item->getQty()) ?></span> + </td> <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>"> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceInclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + <?php if ($taxDataHelper->displayCartPriceInclTax() || $taxDataHelper->displayCartBothPrices()) :?> <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>"> <?= $block->getRowTotalInclTaxHtml($_item) ?> </span> <?php endif; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax() || $this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): ?> + <?php if ($taxDataHelper->displayCartPriceExclTax() || $taxDataHelper->displayCartBothPrices()) :?> <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"> <?= $block->getRowTotalExclTaxHtml($_item) ?> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml index 7ee3e416b9ade..909631d06e68a 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml @@ -4,12 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getRowTotal()) ?> + <?= $block->escapeHtml($this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getRowTotal())) ?> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml index 2f364aafbbcc0..9f87ab7ef2ded 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> -<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> +<?php $_incl = $this->helper(Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> + <?= $block->escapeHtml($this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_incl)) ?> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml index a1ec004c2a886..9da1cfe85e56b 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml @@ -4,12 +4,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_item->getCalculationPrice()) ?> + <?= $block->escapeHtml( + $this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_item->getCalculationPrice()) + ) ?> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml index 0ed3c05ee6d1f..8de3176e0b963 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */ $_item = $block->getItem(); ?> -<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?> +<?php $_incl = $this->helper(Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?> <span class="cart-price"> - <?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($_incl) ?> + <?= $block->escapeHtml($this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($_incl)) ?> </span> diff --git a/app/code/Magento/Checkout/view/frontend/templates/registration.phtml b/app/code/Magento/Checkout/view/frontend/templates/registration.phtml index f239fbd47dec2..da36b4b61d656 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/registration.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/registration.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +/** @var $block \Magento\Checkout\Block\Registration */ ?> <div id="registration" data-bind="scope:'registration'"> <br /> @@ -17,8 +17,9 @@ "registration": { "component": "Magento_Checkout/js/view/registration", "config": { - "registrationUrl": "<?= /* @escapeNotVerified */ $block->getCreateAccountUrl() ?>", - "email": "<?= /* @escapeNotVerified */ $block->getEmailAddress() ?>" + "registrationUrl": + "<?= $block->escapeJs($block->escapeUrl($block->getCreateAccountUrl())) ?>", + "email": "<?= $block->escapeJs($block->getEmailAddress()) ?>" }, "children": { "errors": { diff --git a/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml b/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml index 892b7926525f3..ba1a7a20376b3 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/shipping/price.phtml @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Checkout\Block\Shipping\Price */ ?> <?php $shippingPrice = $block->getShippingPrice(); ?> -<?= /* @escapeNotVerified */ $shippingPrice ?> +<?= $block->escapeHtml($shippingPrice) ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/success.phtml b/app/code/Magento/Checkout/view/frontend/templates/success.phtml index b3517eab8a5d3..828b4eb86c330 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/success.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/success.phtml @@ -4,25 +4,23 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?> <div class="checkout-success"> - <?php if ($block->getOrderId()):?> + <?php if ($block->getOrderId()) :?> <?php if ($block->getCanViewOrder()) :?> - <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p> + <p><?= $block->escapeHtml(__('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeUrl($block->getViewOrderUrl()), $block->getOrderId())), ['a', 'strong']) ?></p> <?php else :?> - <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p> + <p><?= $block->escapeHtml(__('Your order # is: <span>%1</span>.', $block->getOrderId()), ['span']) ?></p> <?php endif;?> - <p><?= /* @escapeNotVerified */ __('We\'ll email you an order confirmation with details and tracking info.') ?></p> + <p><?= $block->escapeHtml(__('We\'ll email you an order confirmation with details and tracking info.')) ?></p> <?php endif;?> <?= $block->getAdditionalInfoHtml() ?> <div class="actions-toolbar"> <div class="primary"> - <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a> + <a class="action primary continue" href="<?= $block->escapeUrl($block->getContinueUrl()) ?>"><span><?= $block->escapeHtml(__('Continue Shopping')) ?></span></a> </div> </div> </div> diff --git a/app/code/Magento/Checkout/view/frontend/templates/total/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/total/default.phtml index 2ea1cdd7f53f5..eeee3e4bf0be9 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/total/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/total/default.phtml @@ -4,18 +4,39 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate +/** @var $block \Magento\Checkout\Block\Total\DefaultTotal */ ?> <tr class="totals"> - <th colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>" style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="mark" scope="row"> - <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?><strong><?php endif; ?> - <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> - <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?></strong><?php endif; ?> + <th + colspan="<?= $block->escapeHtmlAttr($block->getColspan()) ?>" + style="<?= $block->escapeHtmlAttr($block->getTotal()->getStyle()) ?>" + class="mark" scope="row" + > + <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()) :?> + <strong> + <?php endif; ?> + <?= $block->escapeHtml($block->getTotal()->getTitle()) ?> + <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()) :?> + </strong> + <?php endif; ?> </th> - <td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="amount" data-th="<?= $block->escapeHtml($block->getTotal()->getTitle()) ?>"> - <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?><strong><?php endif; ?> - <span><?= /* @escapeNotVerified */ $this->helper('Magento\Checkout\Helper\Data')->formatPrice($block->getTotal()->getValue()) ?></span> - <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?></strong><?php endif; ?> + <td + style="<?= $block->escapeHtmlAttr($block->getTotal()->getStyle()) ?>" + class="amount" + data-th="<?= $block->escapeHtmlAttr($block->getTotal()->getTitle()) ?>" + > + <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()) :?> + <strong> + <?php endif; ?> + <span> + <?= $block->escapeHtml( + $this->helper(Magento\Checkout\Helper\Data::class)->formatPrice($block->getTotal()->getValue()) + ) ?> + </span> + <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()) :?> + </strong> + <?php endif; ?> </td> </tr> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js index 7b200860c4d55..1b5463c0770a3 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js @@ -133,15 +133,14 @@ define([ event.preventDefault(); } - if (this.validate() && additionalValidators.validate()) { + if (this.validate() && + additionalValidators.validate() && + this.isPlaceOrderActionAllowed() === true + ) { this.isPlaceOrderActionAllowed(false); this.getPlaceOrderDeferredObject() - .fail( - function () { - self.isPlaceOrderActionAllowed(true); - } - ).done( + .done( function () { self.afterPlaceOrder(); @@ -149,6 +148,10 @@ define([ redirectOnSuccessAction.execute(); } } + ).always( + function () { + self.isPlaceOrderActionAllowed(true); + } ); return true; diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml index 28a6e998d8d4e..9013a39f8e6f6 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml +++ b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * @var $block \Magento\CheckoutAgreements\Block\Agreements */ diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/templates/agreements.phtml b/app/code/Magento/CheckoutAgreements/view/frontend/templates/agreements.phtml index b0c6384bcc9fe..5cb256090c196 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/templates/agreements.phtml +++ b/app/code/Magento/CheckoutAgreements/view/frontend/templates/agreements.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Files.LineLength ?> <?php @@ -17,30 +17,42 @@ } ?> <ol id="checkout-agreements" class="agreements checkout items"> <?php /** @var \Magento\CheckoutAgreements\Api\Data\AgreementInterface $agreement */ ?> - <?php foreach ($block->getAgreements() as $agreement): ?> + <?php foreach ($block->getAgreements() as $agreement) :?> <li class="item"> - <div class="checkout-agreement-item-content"<?= ($agreement->getContentHeight() ? ' style="height:' . $agreement->getContentHeight() . '"' : '') ?>> - <?php if ($agreement->getIsHtml()):?> - <?= /* @escapeNotVerified */ $agreement->getContent() ?> - <?php else:?> - <?= nl2br($block->escapeHtml($agreement->getContent())) ?> + <div class="checkout-agreement-item-content"<?= $block->escapeHtmlAttr($agreement->getContentHeight() ? ' style="height:' . $agreement->getContentHeight() . '"' : '') ?>> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getContent() ?> + <?php else :?> + <?= $block->escapeHtml(nl2br($agreement->getContent())) ?> <?php endif; ?> </div> - <form id="checkout-agreements-form-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" class="field choice agree required"> - <?php if($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_MANUAL): ?> + <form id="checkout-agreements-form-<?= (int) $agreement->getAgreementId() ?>" class="field choice agree required"> + <?php if ($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_MANUAL) :?> <input type="checkbox" - id="agreement-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" - name="agreement[<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>]" + id="agreement-<?= (int) $agreement->getAgreementId() ?>" + name="agreement[<?= (int) $agreement->getAgreementId() ?>]" value="1" title="<?= $block->escapeHtml($agreement->getCheckboxText()) ?>" class="checkbox" data-validate="{required:true}"/> - <label class="label" for="agreement-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>"> - <span><?= $agreement->getIsHtml() ? $agreement->getCheckboxText() : $block->escapeHtml($agreement->getCheckboxText()) ?></span> + <label class="label" for="agreement-<?= (int) $agreement->getAgreementId() ?>"> + <span> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getCheckboxText() ?> + <?php else :?> + <?= $block->escapeHtml($agreement->getCheckboxText()) ?> + <?php endif; ?> + </span> </label> - <?php elseif($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_AUTO): ?> - <div id="checkout-agreements-form-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" class="field choice agree"> - <span><?= $agreement->getIsHtml() ? $agreement->getCheckboxText() : $block->escapeHtml($agreement->getCheckboxText()) ?></span> + <?php elseif ($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_AUTO) :?> + <div id="checkout-agreements-form-<?= (int) $agreement->getAgreementId() ?>" class="field choice agree"> + <span> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getCheckboxText() ?> + <?php else :?> + <?= $block->escapeHtml($agreement->getCheckboxText()) ?> + <?php endif; ?> + </span> </div> <?php endif; ?> </form> diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/templates/multishipping_agreements.phtml b/app/code/Magento/CheckoutAgreements/view/frontend/templates/multishipping_agreements.phtml index 33227f0cdce3c..fb2d5168d21de 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/templates/multishipping_agreements.phtml +++ b/app/code/Magento/CheckoutAgreements/view/frontend/templates/multishipping_agreements.phtml @@ -5,7 +5,7 @@ */ // @deprecated -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Files.LineLength ?> <?php @@ -18,31 +18,43 @@ } ?> <ol id="checkout-agreements" class="agreements checkout items"> <?php /** @var \Magento\CheckoutAgreements\Api\Data\AgreementInterface $agreement */ ?> - <?php foreach ($block->getAgreements() as $agreement): ?> + <?php foreach ($block->getAgreements() as $agreement) :?> <li class="item"> - <div class="checkout-agreement-item-content"<?= ($agreement->getContentHeight() ? ' style="height:' . $agreement->getContentHeight() . '"' : '') ?>> - <?php if ($agreement->getIsHtml()):?> - <?= /* @escapeNotVerified */ $agreement->getContent() ?> - <?php else:?> - <?= nl2br($block->escapeHtml($agreement->getContent())) ?> + <div class="checkout-agreement-item-content"<?= $block->escapeHtmlAttr($agreement->getContentHeight() ? ' style="height:' . $agreement->getContentHeight() . '"' : '') ?>> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getContent() ?> + <?php else :?> + <?= $block->escapeHtml(nl2br($agreement->getContent())) ?> <?php endif; ?> </div> - <?php if($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_MANUAL): ?> - <div id="checkout-agreements-form-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" class="field choice agree required"> + <?php if ($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_MANUAL) :?> + <div id="checkout-agreements-form-<?= (int) $agreement->getAgreementId() ?>" class="field choice agree required"> <input type="checkbox" - id="agreement-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" - name="agreement[<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>]" + id="agreement-<?= (int) $agreement->getAgreementId() ?>" + name="agreement[<?= (int) $agreement->getAgreementId() ?>]" value="1" title="<?= $block->escapeHtml($agreement->getCheckboxText()) ?>" class="checkbox" data-validate="{required:true}"/> - <label class="label" for="agreement-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>"> - <span><?= $agreement->getIsHtml() ? $agreement->getCheckboxText() : $block->escapeHtml($agreement->getCheckboxText()) ?></span> + <label class="label" for="agreement-<?= (int) $agreement->getAgreementId() ?>"> + <span> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getCheckboxText() ?> + <?php else :?> + <?= $block->escapeHtml($agreement->getCheckboxText()) ?> + <?php endif; ?> + </span> </label> </div> - <?php elseif($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_AUTO): ?> - <div id="checkout-agreements-form-<?= /* @escapeNotVerified */ $agreement->getAgreementId() ?>" class="field choice agree"> - <span><?= $agreement->getIsHtml() ? $agreement->getCheckboxText() : $block->escapeHtml($agreement->getCheckboxText()) ?></span> + <?php elseif ($agreement->getMode() == \Magento\CheckoutAgreements\Model\AgreementModeOptions::MODE_AUTO) :?> + <div id="checkout-agreements-form-<?= (int) $agreement->getAgreementId() ?>" class="field choice agree"> + <span> + <?php if ($agreement->getIsHtml()) :?> + <?= /* @noEscape */ $agreement->getCheckboxText() ?> + <?php else :?> + <?= $block->escapeHtml($agreement->getCheckboxText()) ?> + <?php endif; ?> + </span> </div> <?php endif; ?> </li> diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Page/Index.php b/app/code/Magento/Cms/Controller/Adminhtml/Page/Index.php index 04557ddaeec78..d0ee1453eda10 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Page/Index.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page/Index.php @@ -7,6 +7,8 @@ use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Backend\App\Action\Context; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\Request\DataPersistorInterface; use Magento\Framework\View\Result\PageFactory; /** @@ -26,16 +28,24 @@ class Index extends \Magento\Backend\App\Action implements HttpGetActionInterfac */ protected $resultPageFactory; + /** + * @var DataPersistorInterface + */ + private $dataPersistor; + /** * @param Context $context * @param PageFactory $resultPageFactory + * @param DataPersistorInterface $dataPersistor */ public function __construct( Context $context, - PageFactory $resultPageFactory + PageFactory $resultPageFactory, + DataPersistorInterface $dataPersistor = null ) { parent::__construct($context); $this->resultPageFactory = $resultPageFactory; + $this->dataPersistor = $dataPersistor ?: ObjectManager::getInstance()->get(DataPersistorInterface::class); } /** @@ -52,8 +62,7 @@ public function execute() $resultPage->addBreadcrumb(__('Manage Pages'), __('Manage Pages')); $resultPage->getConfig()->getTitle()->prepend(__('Pages')); - $dataPersistor = $this->_objectManager->get(\Magento\Framework\App\Request\DataPersistorInterface::class); - $dataPersistor->clear('cms_page'); + $this->dataPersistor->clear('cms_page'); return $resultPage; } diff --git a/app/code/Magento/Cms/Model/Block.php b/app/code/Magento/Cms/Model/Block.php index e65675ceee9ec..0261ef46a4942 100644 --- a/app/code/Magento/Cms/Model/Block.php +++ b/app/code/Magento/Cms/Model/Block.php @@ -12,8 +12,8 @@ /** * CMS block model * - * @method Block setStoreId(array $storeId) - * @method array getStoreId() + * @method Block setStoreId(int $storeId) + * @method int getStoreId() */ class Block extends AbstractModel implements BlockInterface, IdentityInterface { @@ -41,6 +41,8 @@ class Block extends AbstractModel implements BlockInterface, IdentityInterface protected $_eventPrefix = 'cms_block'; /** + * Construct. + * * @return void */ protected function _construct() diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php index d950f484cd1d9..8eefe26236ba5 100644 --- a/app/code/Magento/Cms/Model/Page.php +++ b/app/code/Magento/Cms/Model/Page.php @@ -16,8 +16,8 @@ * Cms Page Model * * @api - * @method Page setStoreId(array $storeId) - * @method array getStoreId() + * @method Page setStoreId(int $storeId) + * @method int getStoreId() * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @since 100.0.2 */ @@ -103,8 +103,7 @@ public function getStores() } /** - * Check if page identifier exist for specific store - * return page id if page exists + * Check if page identifier exist for specific store return page id if page exists * * @param string $identifier * @param int $storeId @@ -116,8 +115,7 @@ public function checkIdentifier($identifier, $storeId) } /** - * Prepare page's statuses. - * Available event cms_page_get_available_statuses to customize statuses. + * Prepare page's statuses, available event cms_page_get_available_statuses to customize statuses. * * @return array */ @@ -538,7 +536,7 @@ public function setIsActive($isActive) } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function beforeSave() @@ -571,6 +569,8 @@ public function beforeSave() } /** + * Returns scope config. + * * @return ScopeConfigInterface */ private function getScopeConfig() diff --git a/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml b/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml new file mode 100644 index 0000000000000..46a968959407f --- /dev/null +++ b/app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="WysiwygEnabledByDefault"> + <data key="path">cms/wysiwyg/enabled</data> + <data key="scope_id">0</data> + <data key="value">enabled</data> + </entity> + <entity name="WysiwygDisabledByDefault"> + <data key="path">cms/wysiwyg/enabled</data> + <data key="scope_id">0</data> + <data key="value">hidden</data> + </entity> + <entity name="WysiwygTinyMCE3Enable"> + <data key="path">cms/wysiwyg/editor</data> + <data key="scope_id">0</data> + <data key="value">Magento_Tinymce3/tinymce3Adapter</data> + </entity> + <entity name="WysiwygTinyMCE4Enable"> + <data key="path">cms/wysiwyg/editor</data> + <data key="scope_id">0</data> + <data key="value">mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter</data> + </entity> +</entities> diff --git a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml b/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml index f05cf5be3448e..14eca30d0f730 100644 --- a/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml +++ b/app/code/Magento/Config/Test/Mftf/ActionGroup/GeneralConfigurationActionGroup.xml @@ -22,7 +22,7 @@ <actionGroup name="SelectTopDestinationsCountry"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <selectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/> <click selector="#save" stepKey="saveConfig"/> @@ -31,7 +31,7 @@ <actionGroup name="UnSelectTopDestinationsCountry"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <unselectOption selector="{{CountryOptionsSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/> <click selector="#save" stepKey="saveConfig"/> @@ -40,7 +40,7 @@ <actionGroup name="SelectCountriesWithRequiredRegion"> <arguments> - <argument name="countries" type="countryArray"/> + <argument name="countries" type="entity"/> </arguments> <amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminConfigGeneralPage"/> <conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab" /> diff --git a/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml b/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml index c3fa13f59697e..d38035cd5e02e 100644 --- a/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml +++ b/app/code/Magento/Config/Test/Mftf/Page/AdminCatalogSearchConfigurationPage.xml @@ -8,5 +8,6 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="AdminCatalogSearchConfigurationPage" url="admin/system_config/edit/section/catalog/" area="admin" module="Magento_Config"> <section name="AdminCatalogSearchConfigurationSection"/> + <section name="AdminCatalogSearchEngineConfigurationSection"/> </page> </pages> diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml new file mode 100644 index 0000000000000..570d831ce5807 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminCatalogSearchEngineConfigurationSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCatalogSearchEngineConfigurationSection"> + <element name="searchEngineOptimization" type="button" selector="#catalog_seo-head"/> + <element name="openedEngineOptimization" type="button" selector="#catalog_seo-head.open"/> + <element name="systemValueUseCategoriesPath" type="checkbox" selector="#catalog_seo_product_use_categories_inherit"/> + <element name="selectUseCategoriesPatForProductUrls" type="select" selector="#catalog_seo_product_use_categories"/> + </section> +</sections> \ No newline at end of file diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml new file mode 100644 index 0000000000000..1c8fdf26735e8 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminOrderConfigurableProductActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOrderConfigureConfigurableProduct"> + <arguments> + <argument name="optionName" type="string" defaultValue="option1"/> + <argument name="productQty" type="string" defaultValue="1"/> + </arguments> + <click selector="{{AdminOrderFormItemsOrderedSection.configureButtonBySku}}" stepKey="clickConfigure"/> + <waitForPageLoad stepKey="waitForConfigurePageLoad"/> + <selectOption selector="{{AdminOrderFormConfigureProductSection.selectOption}}" userInput="{{optionName}}" stepKey="selectOption"/> + <fillField selector="{{AdminOrderFormConfigureProductSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/> + <click selector="{{AdminOrderFormConfigureProductSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml index 658e7a5fec9b3..573f1265931aa 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminNewAttributePanelSection.xml @@ -16,8 +16,8 @@ <element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/> <element name="useInProductListing" type="select" selector="#used_in_product_listing"/> <element name="usedForStoringInProductListing" type="select" selector="#used_for_sort_by"/> - <element name="storefrontPropertiesTab" selector="#front_fieldset-wrapper"/> - <element name="storefrontPropertiesTitle" selector="//span[text()='Storefront Properties']"/> + <element name="storefrontPropertiesTab" type="button" selector="#front_fieldset-wrapper"/> + <element name="storefrontPropertiesTitle" type="text" selector="//span[text()='Storefront Properties']"/> <element name="container" type="text" selector="#create_new_attribute"/> <element name="saveAttribute" type="button" selector="#save"/> <element name="newAttributeIFrame" type="iframe" selector="create_new_attribute_container"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml index 232dfe8391468..a71f51526c8ab 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml @@ -207,6 +207,6 @@ <click userInput="$$createCategory.name$$" stepKey="clickOnCategoryName"/> <waitForPageLoad stepKey="waitForPageLoad4"/> <see userInput="$$createConfigProduct.name$$" stepKey="assertProductPresent"/> - <See userInput="$$createConfigChildProduct1.price$$" stepKey="assertProductPricePresent"/> + <see userInput="$$createConfigChildProduct1.price$$" stepKey="assertProductPricePresent"/> </test> </tests> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml index 110defd5248b9..9307da21e6659 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml @@ -8,7 +8,7 @@ <script> (function ($) { - var data = <?= /* @escapeNotVerified */ $block->getAttributesBlockJson() ?>; + var data = <?= /* @noEscape */ $block->getAttributesBlockJson() ?>; var set = data.set || {id: $('#attribute_set_id').val()}; if (data.tab == 'variations') { $('[data-role=product-variations-matrix]').trigger('add', data.attribute); diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml index 9c4612c972d96..5f49d5eb47442 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> <script> require([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml index ecc95cbe3d48f..1166adca97255 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml @@ -3,34 +3,32 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - - ?> +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis +?> <?php /* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Composite\Fieldset\Configurable */ ?> <?php $_product = $block->getProduct(); ?> <?php $_attributes = $block->decorateArray($block->getAllowAttributes()); ?> -<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> -<?php if (($_product->isSaleable() || $_skipSaleableCheck) && count($_attributes)):?> +<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> +<?php if (($_product->isSaleable() || $_skipSaleableCheck) && count($_attributes)) :?> <fieldset id="catalog_product_composite_configure_fields_configurable" class="fieldset admin__fieldset"> <legend class="legend admin__legend"> - <span><?= /* @escapeNotVerified */ __('Associated Products') ?></span> + <span><?= $block->escapeHtml(__('Associated Products')) ?></span> </legend> <div class="product-options fieldset admin__fieldset"> - <?php foreach ($_attributes as $_attribute): ?> + <?php foreach ($_attributes as $_attribute) : ?> <div class="field admin__field _required required"> <label class="label admin__field-label"><?= $block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel($_product->getStoreId())); - ?></label> + ?></label> <div class="control admin__field-control <?php - if ($_attribute->getDecoratedIsLast()): - ?> last<?php + if ($_attribute->getDecoratedIsLast()) : + ?> last<?php endif; ?>"> - <select name="super_attribute[<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>]" - id="attribute<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>" + <select name="super_attribute[<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>]" + id="attribute<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>" class="admin__control-select required-entry super-attribute-select"> - <option><?= /* @escapeNotVerified */ __('Choose an Option...') ?></option> + <option><?= $block->escapeHtml(__('Choose an Option...')) ?></option> </select> </div> </div> @@ -43,7 +41,7 @@ require([ "Magento_Catalog/catalog/product/composite/configure" ], function(){ - var config = <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>; + var config = <?= /* @noEscape */ $block->getJsonConfig() ?>; if (window.productConfigure) { config.containerId = window.productConfigure.blockFormFields.id; if (window.productConfigure.restorePhase) { diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml index cc25474049190..44413c67ed5ba 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml @@ -4,18 +4,16 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues */ ?> <div data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'"> <h2 class="steps-wizard-title"><?= $block->escapeHtml( - __('Step 2: Attribute Values') - ); ?></h2> + __('Step 2: Attribute Values') + ); ?></h2> <div class="steps-wizard-info"> <span><?= $block->escapeHtml( - __('Select values from each attribute to include in this product. Each unique combination of values creates a unique product SKU.') - );?></span> + __('Select values from each attribute to include in this product. Each unique combination of values creates a unique product SKU.') + );?></span> </div> <div data-bind="foreach: attributes, sortableList: attributes"> @@ -41,24 +39,24 @@ data-bind="click: $parent.selectAllAttributes" title="<?= $block->escapeHtml(__('Select All')) ?>"> <span><?= $block->escapeHtml( - __('Select All') - ); ?></span> + __('Select All') + ); ?></span> </button> <button type="button" class="action-deselect-all action-tertiary" data-bind="click: $parent.deSelectAllAttributes" title="<?= $block->escapeHtml(__('Deselect All')) ?>"> <span><?= $block->escapeHtml( - __('Deselect All') - ); ?></span> + __('Deselect All') + ); ?></span> </button> <button type="button" class="action-remove-all action-tertiary" data-bind="click: $parent.removeAttribute.bind($parent)" title="<?= $block->escapeHtml(__('Remove Attribute')) ?>"> <span><?= $block->escapeHtml( - __('Remove Attribute') - ); ?></span> + __('Remove Attribute') + ); ?></span> </button> </div> </div> @@ -87,8 +85,8 @@ data-action="save" data-bind="click: $parents[1].saveOption.bind($parent)"> <span><?= $block->escapeHtml( - __('Save Option') - ); ?></span> + __('Save Option') + ); ?></span> </button> <button type="button" class="action-remove" @@ -96,8 +94,8 @@ data-action="remove" data-bind="click: $parents[1].removeOption.bind($parent)"> <span><?= $block->escapeHtml( - __('Remove Option') - ); ?></span> + __('Remove Option') + ); ?></span> </button> </div> </li> @@ -108,8 +106,8 @@ data-action="addOption" data-bind="click: $parent.createOption, visible: canCreateOption"> <span><?= $block->escapeHtml( - __('Create New Value') - ); ?></span> + __('Create New Value') + ); ?></span> </button> </div> </div> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml index 9d144b0f569e0..a792a35da8051 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml @@ -3,24 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\Bulk */ ?> <div data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'" data-role="bulk-step"> <h2 class="steps-wizard-title"><?= $block->escapeHtml(__('Step 3: Bulk Images, Price and Quantity')) ?></h2> <div class="steps-wizard-info"> - <?= /* @escapeNotVerified */ __('Based on your selections %1 new products will be created. Use this step to customize images and price for your new products.', '<span class="new-products-count" data-bind="text:countVariations"></span>') ?> + <?= /* @noEscape */ __('Based on your selections %1 new products will be created. Use this step to customize images and price for your new products.', '<span class="new-products-count" data-bind="text:countVariations"></span>') ?> </div> <div data-bind="with: sections().images" class="steps-wizard-section"> <div data-role="section"> <div class="steps-wizard-section-title"> - <span><?= $block->escapeHtml( - __('Images') - ); ?></span> + <span><?= $block->escapeHtml(__('Images')); ?></span> </div> <ul class="steps-wizard-section-list"> @@ -32,9 +28,7 @@ value="single" data-bind="checked:type"> <label for="apply-single-set-radio" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Apply single set of images to all SKUs') - ); ?></span> + <span><?= $block->escapeHtml(__('Apply single set of images to all SKUs')); ?></span> </label> </div> </li> @@ -71,10 +65,7 @@ <div data-role="gallery" class="gallery" data-images="[]" - data-types="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getImageTypes()) - ) ?>" - > + data-types="<?= $block->escapeHtml($this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getImageTypes())) ?>"> <div class="image image-placeholder"> <div data-role="uploader" class="uploader"> <div class="image-browse"> @@ -92,15 +83,12 @@ </div> </div> - <?php foreach ($block->getImageTypes() as $typeData): - ?> + <?php foreach ($block->getImageTypes() as $typeData) : ?> <input name="<?= $block->escapeHtml($typeData['name']) ?>" class="image-<?= $block->escapeHtml($typeData['code']) ?>" type="hidden" value="<?= $block->escapeHtml($typeData['value']) ?>"/> - <?php - endforeach; - ?> + <?php endforeach; ?> <script data-template="uploader" type="text/x-magento-template"> <div id="<%- data.id %>" class="file-row"> @@ -155,19 +143,12 @@ </div> </div> <ul class="item-roles" data-role="roles-labels"> - <?php - foreach ($block->getMediaAttributes() as $attribute): - ?> - <li data-role-code="<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" class="item-role item-role-<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>"> + <?php foreach ($block->getMediaAttributes() as $attribute) :?> + <li data-role-code="<?= $block->escapeHtml($attribute->getAttributeCode()) ?>" + class="item-role item-role-<?= $block->escapeHtml($attribute->getAttributeCode()) ?>"> <?= /* @noEscape */ $attribute->getFrontendLabel() ?> </li> - <?php - endforeach; - ?> + <?php endforeach; ?> </ul> </div> </script> @@ -229,9 +210,7 @@ <div class="admin__field field-image-role"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Role') - ); ?></span> + <span><?= $block->escapeHtml(__('Role')); ?></span> </label> <div class="admin__field-control"> <ul class="multiselect-alt"> @@ -243,42 +222,28 @@ <input class="image-type" data-role="type-selector" type="checkbox" - value="<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" + value="<?= $block->escapeHtml($attribute->getAttributeCode()) ?>" /> - <?= $block->escapeHtml( - $attribute->getFrontendLabel() - ); ?> + <?= $block->escapeHtml($attribute->getFrontendLabel()); ?> </label> </li> - <?php - endforeach; - ?> + <?php endforeach; ?> </ul> </div> </div> <div class="admin__field admin__field-inline field-image-size" data-role="size"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Image Size') - ); ?></span> + <span><?= $block->escapeHtml(__('Image Size')); ?></span> </label> - <div class="admin__field-value" data-message="<?= $block->escapeHtml( - __('{size}') - );?>"></div> + <div class="admin__field-value" data-message="<?= $block->escapeHtml(__('{size}'));?>"></div> </div> <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Image Resolution') - ); ?></span> + <span><?= $block->escapeHtml(__('Image Resolution')); ?></span> </label> - <div class="admin__field-value" data-message="<?= $block->escapeHtml( - __('{width}^{height} px') - );?>"></div> + <div class="admin__field-value" data-message="<?= $block->escapeHtml(__('{width}^{height} px'));?>"></div> </div> <div class="admin__field field-image-hide"> @@ -293,9 +258,7 @@ <% if (data.disabled == 1) { %>checked="checked"<% } %> /> <label for="hide-from-product-page" class="admin__field-label"> - <?= $block->escapeHtml( - __('Hide from Product Page') - ); ?> + <?= $block->escapeHtml(__('Hide from Product Page')); ?> </label> </div> </div> @@ -310,9 +273,7 @@ <fieldset class="admin__fieldset bulk-attribute-values"> <div class="admin__field _required"> <label class="admin__field-label" for="apply-images-attributes"> - <span><?= $block->escapeHtml( - __('Select attribute') - ); ?></span> + <span><?= $block->escapeHtml(__('Select attribute')); ?></span> </label> <div class="admin__field-control"> <select @@ -322,9 +283,7 @@ options: $parent.attributes, optionsText: 'label', value: attribute, - optionsCaption: '<?= $block->escapeHtml( - __("Select") - ); ?>' + optionsCaption: '<?= $block->escapeHtml(__("Select")); ?>' "> </select> </div> @@ -341,24 +300,17 @@ <div data-role="gallery" class="gallery" data-images="[]" - data-types="<?= $block->escapeHtml( - $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getImageTypes()) - ) ?>" - > + data-types="<?= $block->escapeHtml($this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getImageTypes())) ?>"> <div class="image image-placeholder"> <div data-role="uploader" class="uploader"> <div class="image-browse"> - <span><?= $block->escapeHtml( - __('Browse Files...') - ); ?></span> + <span><?= $block->escapeHtml(__('Browse Files...')); ?></span> <input type="file" name="image" multiple="multiple" data-url="<?= /* @noEscape */ $block->getUrl('catalog/product_gallery/upload') ?>" /> </div> </div> <div class="product-image-wrapper"> - <p class="image-placeholder-text"><?= $block->escapeHtml( - __('Browse to find or drag image here') - ); ?></p> + <p class="image-placeholder-text"><?= $block->escapeHtml(__('Browse to find or drag image here')); ?></p> </div> <div class="spinner"> <span></span><span></span><span></span><span></span> @@ -366,15 +318,12 @@ </div> </div> - <?php foreach ($block->getImageTypes() as $typeData): - ?> + <?php foreach ($block->getImageTypes() as $typeData) :?> <input name="<?= $block->escapeHtml($typeData['name']) ?>" class="image-<?= $block->escapeHtml($typeData['code']) ?>" type="hidden" value="<?= $block->escapeHtml($typeData['value']) ?>"/> - <?php - endforeach; - ?> + <?php endforeach; ?> <script data-template="uploader" type="text/x-magento-template"> <div id="<%- data.id %>" class="file-row"> @@ -418,15 +367,11 @@ class="action-remove" data-role="delete-button" title="<?= $block->escapeHtml(__('Remove image')) ?>"> - <span><?= $block->escapeHtml( - __('Remove image') - ); ?></span> + <span><?= $block->escapeHtml(__('Remove image')); ?></span> </button> <div class="draggable-handle"></div> </div> - <div class="image-fade"><span><?= $block->escapeHtml( - __('Hidden') - ); ?></span></div> + <div class="image-fade"><span><?= $block->escapeHtml(__('Hidden')); ?></span></div> </div> <div class="item-description"> <div class="item-title" data-role="img-title"><%- data.label %></div> @@ -435,19 +380,12 @@ </div> </div> <ul class="item-roles" data-role="roles-labels"> - <?php - foreach ($block->getMediaAttributes() as $attribute): - ?> - <li data-role-code="<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" class="item-role item-role-<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>"> + <?php foreach ($block->getMediaAttributes() as $attribute) :?> + <li data-role-code="<?= $block->escapeHtml($attribute->getAttributeCode()) ?>" + class="item-role item-role-<?= $block->escapeHtml($attribute->getAttributeCode()) ?>"> <?= $block->escapeHtml($attribute->getFrontendLabel()) ?> </li> - <?php - endforeach; - ?> + <?php endforeach; ?> </ul> </div> </script> @@ -492,9 +430,7 @@ <fieldset class="admin__fieldset fieldset-image-panel"> <div class="admin__field field-image-description"> <label class="admin__field-label" for="image-description"> - <span><?= $block->escapeHtml( - __('Alt Text') - );?></span> + <span><?= $block->escapeHtml(__('Alt Text'));?></span> </label> <div class="admin__field-control"> @@ -508,56 +444,38 @@ <div class="admin__field field-image-role"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Role') - );?></span> + <span><?= $block->escapeHtml(__('Role'));?></span> </label> <div class="admin__field-control"> <ul class="multiselect-alt"> - <?php - foreach ($block->getMediaAttributes() as $attribute) : - ?> + <?php foreach ($block->getMediaAttributes() as $attribute) :?> <li class="item"> <label> <input class="image-type" data-role="type-selector" type="checkbox" - value="<?= $block->escapeHtml( - $attribute->getAttributeCode() - ) ?>" + value="<?= $block->escapeHtml($attribute->getAttributeCode()) ?>" /> - <?= $block->escapeHtml( - $attribute->getFrontendLabel() - ) ?> + <?= $block->escapeHtml($attribute->getFrontendLabel()) ?> </label> </li> - <?php - endforeach; - ?> + <?php endforeach; ?> </ul> </div> </div> <div class="admin__field admin__field-inline field-image-size" data-role="size"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Image Size') - ); ?></span> + <span><?= $block->escapeHtml(__('Image Size')); ?></span> </label> - <div class="admin__field-value" data-message="<?= $block->escapeHtml( - __('{size}') - ); ?>"></div> + <div class="admin__field-value" data-message="<?= $block->escapeHtml(__('{size}')); ?>"></div> </div> <div class="admin__field admin__field-inline field-image-resolution" data-role="resolution"> <label class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Image Resolution') - ); ?></span> + <span><?= $block->escapeHtml(__('Image Resolution')); ?></span> </label> - <div class="admin__field-value" data-message="<?= $block->escapeHtml( - __('{width}^{height} px') - ); ?>"></div> + <div class="admin__field-value" data-message="<?= $block->escapeHtml(__('{width}^{height} px')); ?>"></div> </div> <div class="admin__field field-image-hide"> @@ -572,9 +490,7 @@ <% if (data.disabled == 1) { %>checked="checked"<% } %> /> <label for="hide-from-product-page" class="admin__field-label"> - <?= $block->escapeHtml( - __('Hide from Product Page') - ); ?> + <?= $block->escapeHtml(__('Hide from Product Page')); ?> </label> </div> </div> @@ -593,9 +509,7 @@ <div data-bind="with: sections().price" class="steps-wizard-section"> <div data-role="section"> <div class="steps-wizard-section-title"> - <span><?= $block->escapeHtml( - __('Price') - ); ?></span> + <span><?= $block->escapeHtml(__('Price')); ?></span> </div> <ul class="steps-wizard-section-list"> <li> @@ -607,9 +521,7 @@ data-bind="checked:type" /> <label for="apply-single-price-radio" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Apply single price to all SKUs') - ); ?></span> + <span><?= $block->escapeHtml(__('Apply single price to all SKUs')); ?></span> </label> </div> </li> @@ -622,9 +534,7 @@ data-bind="checked:type" /> <label for="apply-unique-prices-radio" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Apply unique prices by attribute to each SKU') - ); ?></span> + <span><?= $block->escapeHtml(__('Apply unique prices by attribute to each SKU')); ?></span> </label> </div> </li> @@ -637,9 +547,7 @@ checked data-bind="checked:type" /> <label for="skip-pricing-radio" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Skip price at this time') - ); ?></span> + <span><?= $block->escapeHtml(__('Skip price at this time')); ?></span> </label> </div> </li> @@ -648,9 +556,7 @@ <fieldset class="admin__fieldset bulk-attribute-values" data-bind="visible: type() == 'single'"> <div class="admin__field _required"> <label for="apply-single-price-input" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Price') - ); ?></span> + <span><?= $block->escapeHtml(__('Price')); ?></span> </label> <div class="admin__field-control"> <div class="currency-addon"> @@ -667,9 +573,7 @@ <fieldset class="admin__fieldset bulk-attribute-values"> <div class="admin__field _required"> <label for="select-each-price" class="admin__field-label"> - <span><?= $block->escapeHtml( - __('Select attribute') - ); ?></span> + <span><?= $block->escapeHtml(__('Select attribute')); ?></span> </label> <div class="admin__field-control"> <select id="select-each-price" class="admin__control-select" data-bind=" diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/select_attributes.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/select_attributes.phtml index cfb742e80f719..c3dc614232201 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/select_attributes.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/select_attributes.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\SelectAttributes */ ?> <div class="select-attributes-block <?= /* @noEscape */ $block->getData('config/dataScope') ?>" data-role="select-attributes-step"> @@ -13,8 +11,8 @@ <?= /* @noEscape */ $block->getAddNewAttributeButton() ?> </div> <h2 class="steps-wizard-title"><?= $block->escapeHtml( - __('Step 1: Select Attributes') - ); ?></h2> + __('Step 1: Select Attributes') + ); ?></h2> <div class="selected-attributes" data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'"> <?= $block->escapeHtml( __('Selected Attributes:') 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 2ded3aa1079a9..379e129b68c7e 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 @@ -4,14 +4,12 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\Summary */ ?> <div data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'"> <h2 class="steps-wizard-title"><?= $block->escapeHtml( - __('Step 4: Summary') - ); ?></h2> + __('Step 4: Summary') + ); ?></h2> <div class="admin__data-grid-wrap admin__data-grid-wrap-static"> <!-- ko if: gridNew().length --> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml index 07f4e39e43de6..c11a1adc19896 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml @@ -4,34 +4,32 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - - /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config */ +/** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config */ ?> -<div class="entry-edit form-inline" id="<?= /* @escapeNotVerified */ $block->getId() ?>" data-panel="product-variations"> +<div class="entry-edit form-inline" id="<?= $block->escapeHtmlAttr($block->getId()) ?>" data-panel="product-variations"> <div data-bind="scope: 'variation-steps-wizard'" class="product-create-configuration"> <div class="product-create-configuration-info"> <div class="note" data-role="product-create-configuration-info"> - <?= /* @escapeNotVerified */ __('Configurable products allow customers to choose options (Ex: shirt color). - You need to create a simple product for each configuration (Ex: a product for each color).');?> + <?= $block->escapeHtml(__('Configurable products allow customers to choose options (Ex: shirt color). + You need to create a simple product for each configuration (Ex: a product for each color).'));?> </div> </div> <div class="product-create-configuration-actions" data-action="product-create-configuration-buttons"> <div class="product-create-configuration-action"> <button type="button" data-action="open-steps-wizard" title="Create Product Configurations" class="action-secondary" data-bind="click: open"> - <span data-role="button-label" data-edit-label="<?= /* @escapeNotVerified */ __('Edit Configurations') ?>"> - <?= /* @escapeNotVerified */ $block->isHasVariations() + <span data-role="button-label" data-edit-label="<?= $block->escapeHtmlAttr(__('Edit Configurations')) ?>"> + <?= $block->escapeHtml($block->isHasVariations() ? __('Edit Configurations') - : __('Create Configurations') - ?> + : __('Create Configurations')) +?> </span> </button> </div> <div class="product-create-configuration-action" data-bind="scope: 'configurableProductGrid'"> <button class="action-tertiary action-menu-item" type="button" data-action="choose" data-bind="click: showManuallyGrid, visible: button"> - <?= /* @noEscape */ __('Add Products Manually') ?> + <?= $block->escapeHtml(__('Add Products Manually')) ?> </button> </div> </div> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml index 230e0fd14ccb6..22ff1992c94a7 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config\Matrix */ ?> <?php @@ -17,7 +15,7 @@ $currencySymbol = $block->getCurrencySymbol(); <div id="product-variations-matrix" data-role="product-variations-matrix"> <div data-bind="scope: 'configurableVariations'"> <h3 class="hidden" data-bind="css: {hidden: !showVariations() }" class="title"> - <?= /* @escapeNotVerified */ __('Current Variations') ?> + <?= $block->escapeHtml(__('Current Variations')) ?> </h3> <script data-template-for="variation-image" type="text/x-magento-template"> @@ -47,22 +45,22 @@ $currencySymbol = $block->getCurrencySymbol(); <thead> <tr> <th class="data-grid-th data-grid-thumbnail-cell col-image" data-column="image"> - <?= /* @escapeNotVerified */ __('Image') ?> + <?= $block->escapeHtml(__('Image')) ?> </th> <th class="data-grid-th col-name" data-column="name"> - <?= /* @escapeNotVerified */ __('Name') ?> + <?= $block->escapeHtml(__('Name')) ?> </th> <th class="data-grid-th col-sku" data-column="sku"> - <?= /* @escapeNotVerified */ __('SKU') ?> + <?= $block->escapeHtml(__('SKU')) ?> </th> <th class="data-grid-th col-price" data-column="price"> - <?= /* @escapeNotVerified */ __('Price') ?> + <?= $block->escapeHtml(__('Price')) ?> </th> <th class="data-grid-th col-qty" data-column="qty"> - <?= /* @escapeNotVerified */ __('Quantity') ?> + <?= $block->escapeHtml(__('Quantity')) ?> </th> <th class="data-grid-th col-weight" data-column="weight"> - <?= /* @escapeNotVerified */ __('Weight') ?> + <?= $block->escapeHtml(__('Weight')) ?> </th> <!-- ko foreach: getAttributesOptions() --> <th data-bind="attr: {class:'data-grid-th col-' + $data.attribute_code}, @@ -70,7 +68,7 @@ $currencySymbol = $block->getCurrencySymbol(); </th> <!-- /ko --> <th class="data-grid-th"> - <?= /* @escapeNotVerified */ __('Actions') ?> + <?= $block->escapeHtml(__('Actions')) ?> </th> </tr> </thead> @@ -88,7 +86,7 @@ $currencySymbol = $block->getCurrencySymbol(); <input type="hidden" data-bind=" attr: {id: $parent.getRowId(variation, 'image'), name: $parent.getVariationRowName(variation, 'image')}"/> - <span><?= /* @escapeNotVerified */ __('Upload Image') ?></span> + <span><?= $block->escapeHtml(__('Upload Image')) ?></span> <input name="image" type="file" data-url="<?= $block->escapeHtml($block->getImageUploadUrl()) ?>" title="<?= $block->escapeHtml(__('Upload image')) ?>"/> @@ -102,11 +100,11 @@ $currencySymbol = $block->getCurrencySymbol(); <!-- /ko --> <button type="button" class="action toggle no-display" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> - <span><?= /* @escapeNotVerified */ __('Select') ?></span> + <span><?= $block->escapeHtml(__('Select')) ?></span> </button> <ul class="dropdown"> <li> - <a class="item" data-action="no-image"><?= /* @escapeNotVerified */ __('No Image') ?></a> + <a class="item" data-action="no-image"><?= $block->escapeHtml(__('No Image')) ?></a> </li> </ul> </div> @@ -208,7 +206,7 @@ $currencySymbol = $block->getCurrencySymbol(); " data-action="choose" href="#"> - <?= /* @escapeNotVerified */ __('Choose a different Product') ?> + <?= $block->escapeHtml(__('Choose a different Product')) ?> </a> </li> <li> @@ -219,7 +217,7 @@ $currencySymbol = $block->getCurrencySymbol(); </li> <li> <a class="action-menu-item" data-bind="click: $parent.removeProduct.bind($parent, $index())"> - <?= /* @escapeNotVerified */ __('Remove Product') ?> + <?= $block->escapeHtml(__('Remove Product')) ?> </a> </li> </ul> @@ -233,15 +231,14 @@ $currencySymbol = $block->getCurrencySymbol(); <!-- /ko --> </div> <div data-role="step-wizard-dialog" - data-mage-init='{"Magento_Ui/js/modal/modal":{"type":"slide","title":"<?= /* @escapeNotVerified */ __('Create Product Configurations') ?>", + data-mage-init='{"Magento_Ui/js/modal/modal":{"type":"slide","title":"<?= $block->escapeJs(__('Create Product Configurations')) ?>", "buttons":[]}}' class="no-display"> - <?php - /* @escapeNotVerified */ echo $block->getVariationWizard([ + <?= /* @noEscape */ $block->getVariationWizard([ 'attributes' => $attributes, 'configurations' => $productMatrix ]); - ?> +?> </div> </div> @@ -252,8 +249,8 @@ $currencySymbol = $block->getCurrencySymbol(); "components": { "configurableVariations": { "component": "Magento_ConfigurableProduct/js/variations/variations", - "variations": <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($productMatrix) ?>, - "productAttributes": <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($attributes) ?>, + "variations": <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($productMatrix) ?>, + "productAttributes": <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($attributes) ?>, "productUrl": "<?= /* @noEscape */ $block->getUrl('catalog/product/edit', ['id' => '%id%']) ?>", "currencySymbol": "<?= /* @noEscape */ $currencySymbol ?>", "configurableProductGrid": "configurableProductGrid" diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard-ajax.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard-ajax.phtml index 2e38633218652..7b85efdbb73aa 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard-ajax.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard-ajax.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config\Matrix */ $productMatrix = $block->getProductMatrix(); diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml index 3a23257cbbf9b..f009962bb97ff 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config\Matrix */ ?> <?php @@ -48,9 +46,9 @@ $currencySymbol = $block->getCurrencySymbol(); "attributeSetHandler": "<?= /* @noEscape */ $block->getForm() ?>.configurable_attribute_set_handler_modal", "wizardModalButtonName": "<?= /* @noEscape */ $block->getForm() ?>.configurable.configurable_products_button_set.create_configurable_products_button", "wizardModalButtonTitle": "<?= $block->escapeHtml(__('Edit Configurations')) ?>", - "productAttributes": <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($attributes) ?>, + "productAttributes": <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($attributes) ?>, "productUrl": "<?= /* @noEscape */ $block->getUrl('catalog/product/edit', ['id' => '%id%']) ?>", - "variations": <?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($productMatrix) ?>, + "variations": <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($productMatrix) ?>, "currencySymbol": "<?= /* @noEscape */ $currencySymbol ?>", "attributeSetCreationUrl": "<?= /* @noEscape */ $block->getUrl('*/product_set/save') ?>" } diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/form.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/form.phtml index 6c993b243da23..6b30b3eba33b4 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/form.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/form.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Framework\View\Element\Template */ ?> <div data-role="affected-attribute-set-selector" class="no-display affected-attribute-set"> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml index 0e0eb3464eaa6..cdb12b54e5e67 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */ ?> <script> @@ -48,12 +46,12 @@ $form .modal({ - title: '<?= /* @escapeNotVerified */ __('Choose Affected Attribute Set') ?>', + title: '<?= $block->escapeJs(__('Choose Affected Attribute Set')) ?>', closed: function () { resetValidation(); }, buttons: [{ - text: '<?= /* @escapeNotVerified */ __('Confirm') ?>', + text: '<?= $block->escapeJs(__('Confirm')) ?>', attr: { 'data-action': 'confirm' }, @@ -77,12 +75,12 @@ $.ajax({ type: 'POST', - url: '<?= /* @escapeNotVerified */ $block->getAttributeSetCreationUrl() ?>', + url: '<?= $block->escapeUrl($block->getAttributeSetCreationUrl()) ?>', data: { gotoEdit: 1, attribute_set_name: $form.find('input[name=new-attribute-set-name]').val(), skeleton_set: $('#attribute_set_id').val(), - form_key: '<?= /* @escapeNotVerified */ $block->getFormKey() ?>', + form_key: '<?= $block->escapeJs($block->getFormKey()) ?>', return_session_messages_only: 1 }, dataType: 'json', @@ -101,8 +99,8 @@ return false; } },{ - text: '<?= /* @escapeNotVerified */ __('Cancel') ?>', - id: '<?= /* @escapeNotVerified */ $block->getJsId('close-button') ?>', + text: '<?= $block->escapeJs(__('Cancel')) ?>', + id: '<?= $block->escapeJs($block->getJsId('close-button')) ?>', 'class': 'action-close', click: function() { $form.modal('closeModal'); diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml index 4246d8f53a79c..e6cf1e9c6870d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml @@ -3,16 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis /** @var $block \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */ ?> <script> require(["jquery","mage/mage","mage/backend/suggest"], function($){ - var options = <?php - /* @escapeNotVerified */ echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getSuggestWidgetOptions()) - ?>; + var options = <?= /* @noEscape */ $this->helper(Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSuggestWidgetOptions()) ?>; $('#configurable-attribute-selector') .mage('suggest', options) .on('suggestselect', function (event, ui) { diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml index f020e4c2c9495..a6dc6c819989e 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml @@ -4,37 +4,28 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - -?> - -<?php /** @var \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox$block */ - /** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */ $priceModel = $block->getPriceType('regular_price'); - /** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */ $finalPriceModel = $block->getPriceType('final_price'); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $schema = ($block->getZone() == 'item_view') ? true : false; ?> <span class="normal-price"> - <?php - $arguments = [ + <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'display_label' => __('As low as'), 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, - ]; - /* @noEscape */ echo $block->renderAmount($finalPriceModel->getAmount(), $arguments); - ?> + ]); +?> </span> -<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?> +<?php if (!$block->isProductList() && $block->hasSpecialPrice()) : ?> <span class="old-price sly-old-price no-display"> - <?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [ + <?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [ 'display_label' => __('Regular Price'), 'price_id' => $block->getPriceId('old-price-' . $idSuffix), 'price_type' => 'oldPrice', @@ -44,14 +35,14 @@ $schema = ($block->getZone() == 'item_view') ? true : false; </span> <?php endif; ?> -<?php if ($block->showMinimalPrice()): ?> - <?php if ($block->getUseLinkForAsLowAs()):?> - <a href="<?= /* @escapeNotVerified */ $block->getSaleableItem()->getProductUrl() ?>" class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> +<?php if ($block->showMinimalPrice()) : ?> + <?php if ($block->getUseLinkForAsLowAs()) :?> + <a href="<?= $block->escapeUrl($block->getSaleableItem()->getProductUrl()) ?>" class="minimal-price-link"> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </a> - <?php else:?> + <?php else :?> <span class="minimal-price-link"> - <?= /* @escapeNotVerified */ $block->renderAmountMinimal() ?> + <?= /* @noEscape */ $block->renderAmountMinimal() ?> </span> <?php endif?> <?php endif; ?> diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml index 325ee1d5d79b3..c68419b955e6d 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - ?> <script type="text/x-magento-template" id="tier-prices-template"> <ul class="prices-tier items"> diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml index bad5acc209b5f..5902a9f25cc4b 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml @@ -3,8 +3,5 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?= $block->getChildHtml() ?> diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml index f5ed067967547..f7db41225c970 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> <?php @@ -13,19 +10,19 @@ $_product = $block->getProduct(); $_attributes = $block->decorateArray($block->getAllowAttributes()); ?> -<?php if ($_product->isSaleable() && count($_attributes)):?> - <?php foreach ($_attributes as $_attribute): ?> +<?php if ($_product->isSaleable() && count($_attributes)) :?> + <?php foreach ($_attributes as $_attribute) : ?> <div class="field configurable required"> - <label class="label" for="attribute<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>"> + <label class="label" for="attribute<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>"> <span><?= $block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel()) ?></span> </label> <div class="control"> - <select name="super_attribute[<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>]" - data-selector="super_attribute[<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>]" + <select name="super_attribute[<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>]" + data-selector="super_attribute[<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>]" data-validate="{required:true}" - id="attribute<?= /* @escapeNotVerified */ $_attribute->getAttributeId() ?>" + id="attribute<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>" class="super-attribute-select"> - <option value=""><?= /* @escapeNotVerified */ __('Choose an Option...') ?></option> + <option value=""><?= $block->escapeHtml(__('Choose an Option...')) ?></option> </select> </div> </div> @@ -34,9 +31,11 @@ $_attributes = $block->decorateArray($block->getAllowAttributes()); { "#product_addtocart_form": { "configurable": { - "spConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>, - "gallerySwitchStrategy": "<?php /* @escapeNotVerified */ echo $block->getVar('gallery_switch_strategy', - 'Magento_ConfigurableProduct') ?: 'replace'; ?>" + "spConfig": <?= /* @noEscape */ $block->getJsonConfig() ?>, + "gallerySwitchStrategy": "<?= $block->escapeJs($block->getVar( + 'gallery_switch_strategy', + 'Magento_ConfigurableProduct' + ) ?: 'replace'); ?>" } }, "*" : { diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index 79a575add7347..4c9c25b5f33d9 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Controller\Account; +use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository; use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Customer\Model\Account\Redirect as AccountRedirect; use Magento\Customer\Api\Data\AddressInterface; @@ -38,6 +39,8 @@ use Magento\Customer\Controller\AbstractAccount; /** + * Post create customer action + * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -133,6 +136,11 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht */ private $formKeyValidator; + /** + * @var CustomerRepository + */ + private $customerRepository; + /** * @param Context $context * @param Session $customerSession @@ -152,6 +160,7 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht * @param CustomerExtractor $customerExtractor * @param DataObjectHelper $dataObjectHelper * @param AccountRedirect $accountRedirect + * @param CustomerRepository $customerRepository * @param Validator $formKeyValidator * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -175,6 +184,7 @@ public function __construct( CustomerExtractor $customerExtractor, DataObjectHelper $dataObjectHelper, AccountRedirect $accountRedirect, + CustomerRepository $customerRepository, Validator $formKeyValidator = null ) { $this->session = $customerSession; @@ -195,6 +205,7 @@ public function __construct( $this->dataObjectHelper = $dataObjectHelper; $this->accountRedirect = $accountRedirect; $this->formKeyValidator = $formKeyValidator ?: ObjectManager::getInstance()->get(Validator::class); + $this->customerRepository = $customerRepository; parent::__construct($context); } @@ -328,34 +339,29 @@ public function execute() return $this->resultRedirectFactory->create() ->setUrl($this->_redirect->error($url)); } - $this->session->regenerateId(); - try { $address = $this->extractAddress(); $addresses = $address === null ? [] : [$address]; - $customer = $this->customerExtractor->extract('customer_account_create', $this->_request); $customer->setAddresses($addresses); - $password = $this->getRequest()->getParam('password'); $confirmation = $this->getRequest()->getParam('password_confirmation'); $redirectUrl = $this->session->getBeforeAuthUrl(); - $this->checkPasswordConfirmation($password, $confirmation); - $customer = $this->accountManagement ->createAccount($customer, $password, $redirectUrl); if ($this->getRequest()->getParam('is_subscribed', false)) { - $this->subscriberFactory->create()->subscribeCustomerById($customer->getId()); + $extensionAttributes = $customer->getExtensionAttributes(); + $extensionAttributes->setIsSubscribed(true); + $customer->setExtensionAttributes($extensionAttributes); + $this->customerRepository->save($customer); } - $this->_eventManager->dispatch( 'customer_register_success', ['account_controller' => $this, 'customer' => $customer] ); - $confirmationStatus = $this->accountManagement->getConfirmationStatus($customer->getId()); if ($confirmationStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED) { $email = $this->customerUrl->getEmailConfirmationUrl($customer->getEmail()); diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml new file mode 100644 index 0000000000000..3112f2b3efee0 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnCustomerFormActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnCustomerForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="amOnCustomerCreatePage"/> + <waitForElementVisible selector="{{AdminCustomerAccountInformationSection.group}}" stepKey="waitForElementVisible"/> + <see selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml new file mode 100644 index 0000000000000..0f6d6a5fcfd98 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupOnProductFormActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupOnProductForm"> + <arguments> + <argument name="customerGroupName" type="string"/> + </arguments> + <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="amOnProductCreatePage"/> + <waitForElementVisible selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="waitForAdvancedPricingLinkVisible"/> + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForAddButtonVisible"/> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="clickAddButton"/> + <see selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{customerGroupName}}" stepKey="assertCustomerGroupPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml new file mode 100644 index 0000000000000..248c93a16def8 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertCustomerGroupPresentInGridActionGroup.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertCustomerGroupPresentInGrid" extends="AdminFilterCustomerGroupByNameActionGroup"> + <!--- Assume we are on admin customer group page. --> + <see selector="{{AdminDataGridTableSection.column('Group')}}" userInput="{{customerGroupName}}" after="clickApplyFiltersButton" stepKey="seeCustomerGroupNameInGrid"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml new file mode 100644 index 0000000000000..5eb52630d906b --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAssertErrorMessageCustomerGroupAlreadyExistsActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertErrorMessageCustomerGroupAlreadyExists" extends="AdminCreateCustomerGroupActionGroup"> + <remove keyForRemoval="seeCustomerGroupSaveMessage"/> + <waitForElementVisible selector="{{AdminMessagesSection.errorMessage}}" stepKey="waitForElementVisible"/> + <see selector="{{AdminMessagesSection.errorMessage}}" userInput="Customer Group already exists." stepKey="seeErrorMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml index d9da950fe7115..d2d4d86d7f964 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertCustomerLoggedInActionGroup.xml @@ -12,6 +12,7 @@ <arguments> <argument name="customerFullName" type="string" /> </arguments> + <waitForPageLoad stepKey="waitForPageLoad"/> <see userInput="Welcome, {{customerFullName}}!" selector="{{StorefrontPanelHeaderSection.welcomeMessage}}" stepKey="verifyMessage" /> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml new file mode 100644 index 0000000000000..d76277d2e5e45 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAssertRegistrationPageFieldsActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAssertRegistrationPageFields"> + <seeInCurrentUrl url="{{StorefrontCustomerCreatePage.url}}" stepKey="seeCreateNewCustomerAccountPage"/> + <seeElement selector="{{StorefrontCustomerCreateFormSection.firstnameField}}" stepKey="seeFirstNameField"/> + <seeElement selector="{{StorefrontCustomerCreateFormSection.lastnameField}}" stepKey="seeFLastNameField"/> + <seeElement selector="{{StorefrontCustomerCreateFormSection.emailField}}" stepKey="seeEmailField"/> + <seeElement selector="{{StorefrontCustomerCreateFormSection.passwordField}}" stepKey="seePasswordField"/> + <seeElement selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}" stepKey="seeConfirmPasswordField"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 6b3ef96196263..ddc58ff6b250d 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -284,4 +284,14 @@ <data key="website_id">0</data> <requiredEntity type="address">US_Address_CA</requiredEntity> </entity> + <entity name="John_Smith_Customer" type="customer"> + <data key="group_id">1</data> + <data key="email" unique="prefix">john.smith@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Smith</data> + <data key="fullname">John Smith</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml index 5a4aff383b996..b2c583e008acc 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml @@ -13,6 +13,7 @@ <element name="passwordField" type="input" selector="#pass"/> <element name="signInAccountButton" type="button" selector="#send2" timeout="30"/> <element name="forgotPasswordLink" type="button" selector=".action.remind" timeout="10"/> + <element name="customerLoginBlock" type="text" selector=".login-container .block.block-customer-login"/> </section> <section name="StorefrontCustomerSignInPopupFormSection"> <element name="errorMessage" type="input" selector="[data-ui-id='checkout-cart-validationmessages-message-error']"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml new file mode 100644 index 0000000000000..6b1c1f29f97fc --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCustomerGroupAlreadyExistsTest"> + <annotations> + <features value="Create customer group already exists"/> + <stories value="Create customer group"/> + <title value="Create customer group already exists"/> + <description value="Create customer group already exists"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5302"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set: Group Name "General", Tax Class "Retail customer" + 5. Click "Save Customer Group" button. --> + <!-- Assert "Customer Group already exists." error message displayed --> + <actionGroup ref="AdminAssertErrorMessageCustomerGroupAlreadyExists" stepKey="seeErrorMessageCustomerGroupAlreadyExists"> + <argument name="groupName" value="{{GeneralCustomerGroup.code}}"/> + <argument name="taxClass" value="{{GeneralCustomerGroup.tax_class_name}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml new file mode 100644 index 0000000000000..4f1d88ffe99f5 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateRetailCustomerGroupTest"> + <annotations> + <features value="Create retail customer group"/> + <stories value="Create customer group"/> + <title value="Create retail customer group"/> + <description value="Create retail customer group"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5301"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set. Tax Class - "Retail customer" + 5. Click "Save Customer Group" button. --> + <!-- Assert "You saved the customer group." success message displayed --> + <!-- Assert created Customer Group displayed In Grid --> + <actionGroup ref="AdminCreateCustomerGroupActionGroup" stepKey="createCustomerGroup"> + <argument name="groupName" value="{{CustomCustomerGroup.code}}"/> + <argument name="taxClass" value="{{CustomCustomerGroup.tax_class_name}}"/> + </actionGroup> + <actionGroup ref="AdminAssertCustomerGroupPresentInGrid" stepKey="assertCustomerGroupDisplayedInGrid"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 6. Go to Catalog -> Products -> click "Add Product" button -> click "Advanced Pricing" link -> Customer Group Price -> click "Add" button --> + <!-- Assert: Customer Group Displayed On Product Form --> + <actionGroup ref="AdminAssertCustomerGroupOnProductForm" stepKey="assertCustomerGroupDisplayedOnProductForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 7. Go to Customers -> All Customers -> click "Add New Customer" button --> + <!-- Assert created Customer Group displayed On Customer Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCustomerForm" stepKey="assertCustomerGroupDisplayedOnCustomerForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 8. Go to Marketing - Catalog Price Rule - click "Add New Rule" button --> + <!-- Assert created Customer Group displayed On Catalog Price Rule Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCatalogPriceRuleForm" stepKey="assertCustomerGroupDisplayedOnCatalogPriceRuleForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + + <!-- 9. Go to Marketing - Cart Price Rule - click "Add New Rule" button --> + <!-- Assert created Customer Group displayed On Cart Price Rule Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCartPriceRuleForm" stepKey="assertCustomerGroupDisplayedOnCartPriceRuleForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml new file mode 100644 index 0000000000000..7d54ede7c1612 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxClassCustomerGroupTest"> + <annotations> + <features value="Create tax class customer group"/> + <stories value="Create customer group"/> + <title value="Create tax class customer group"/> + <description value="Create tax class customer group"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5303"/> + <group value="customer"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <!-- Create Tax Class "Customer tax class"--> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClassData"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteCustomerGroupActionGroup" stepKey="deleteCustomerGroup"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/> + <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Steps: 1. Log in to backend as admin user. + 2. Navigate to Stores > Other Settings > Customer Groups. + 3. Start to create new Customer Group. + 4. Fill in all data according to data set: Tax Class "Customer tax class" + 5. Click "Save Customer Group" button. --> + <!-- Assert "You saved the customer group." success message displayed --> + <!-- Assert created Customer Group displayed In Grid --> + <actionGroup ref="AdminCreateCustomerGroupActionGroup" stepKey="createNewCustomerGroup"> + <argument name="groupName" value="{{CustomCustomerGroup.code}}"/> + <argument name="taxClass" value="$$customerTaxClassData.class_name$$"/> + </actionGroup> + <actionGroup ref="AdminAssertCustomerGroupPresentInGrid" stepKey="assertCustomerGroupDisplayedInGrid"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + <!-- 6. Go to Customers -> All Customers -> click "Add New Customer" button --> + <!-- Assert created Customer Group displayed On Customer Form --> + <actionGroup ref="AdminAssertCustomerGroupOnCustomerForm" stepKey="assertCustomerGroupDisplayedOnCustomerForm"> + <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml new file mode 100644 index 0000000000000..6a7aeab78bcde --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminExactMatchSearchInCustomerGridTest"> + <annotations> + <features value="Customer"/> + <stories value="Customer Search"/> + <title value="Admin customer grid exact match searching"/> + <description value="Admin customer grid exact match searching with quotes in keyword"/> + <severity value="MAJOR"/> + <testCaseId value="MC-16335"/> + <useCaseId value="MAGETWO-99605"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/> + <createData entity="Simple_US_Customer" stepKey="createSecondCustomer"> + <field key="firstname">"Jane Doe"</field> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/> + <deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="AdminResetFilterInCustomerAddressGrid" stepKey="clearCustomerGridFilter"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Step 1: Go to Customers > All Customers--> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <!--Step 2: On Customers grid page search customer by keyword with quotes--> + <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchCustomer"> + <argument name="keyword" value="$$createSecondCustomer.firstname$$"/> + </actionGroup> + <!--Step 3: Check if customer is placed in a first row and clear grid filter--> + <actionGroup ref="AdminAssertCustomerInCustomersGrid" stepKey="checkCustomerInGrid"> + <argument name="text" value="$$createSecondCustomer.fullname$$"/> + <argument name="row" value="1"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 6d2dc223b1c44..6de03e225ae08 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -114,6 +114,6 @@ <waitForPageLoad stepKey="waitForCustomersGrid"/> <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomersGrid"/> <executeJS function="var len = document.querySelectorAll('{{AdminCustomerFiltersSection.countryOptions}}').length; return len-1;" stepKey="countriesAmount2"/> - <assertEquals expected='($countriesAmount)' expectedType="integer" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> + <assertEquals expected="($countriesAmount)" actual="($countriesAmount2)" stepKey="assertCountryAmounts"/> </test> </tests> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml index 9a701c14a0307..24cede5f0232a 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml @@ -7,7 +7,7 @@ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> - <title>Forgot Your Password + Forgot Your Password? diff --git a/app/code/Magento/Deploy/Service/DeployPackage.php b/app/code/Magento/Deploy/Service/DeployPackage.php index 3b7b5b77a0793..52cb6c6075749 100644 --- a/app/code/Magento/Deploy/Service/DeployPackage.php +++ b/app/code/Magento/Deploy/Service/DeployPackage.php @@ -107,6 +107,8 @@ function () use ($package, $options, $skipLogging) { } /** + * Execute package deploy procedure when area already emulated + * * @param Package $package * @param array $options * @param bool $skipLogging @@ -136,7 +138,9 @@ public function deployEmulated(Package $package, array $options, $skipLogging = $this->errorsCount++; $this->logger->critical($errorMessage); } catch (\Exception $exception) { - $this->logger->critical($exception->getTraceAsString()); + $this->logger->critical( + 'Compilation from source ' . $file->getSourcePath() . ' failed' . PHP_EOL . (string)$exception + ); $this->errorsCount++; } } @@ -219,7 +223,9 @@ private function checkIfCanCopy(PackageFile $file, Package $package, Package $pa private function checkFileSkip($filePath, array $options) { if ($filePath !== '.') { + // phpcs:ignore Magento2.Functions.DiscouragedFunction $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $basename = pathinfo($filePath, PATHINFO_BASENAME); if ($ext === 'less' && strpos($basename, '_') === 0) { return true; diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php index 4ec34a3842fa2..d84b11fc6cece 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php @@ -126,24 +126,6 @@ public function __construct( */ protected $_foregroundCountries = []; - /** - * Add top destinition countries to head of option array - * - * @param string $emptyLabel - * @param array $options - * @return array - */ - private function addForegroundCountriesToOptionArray($emptyLabel, $options) - { - if ($emptyLabel !== false && count($this->_foregroundCountries) !== 0 && - count($options) === count($this->_foregroundCountries) - ) { - $options[] = ['value' => '', 'label' => $emptyLabel]; - return $options; - } - return $options; - } - /** * Define main table * @@ -269,24 +251,20 @@ public function addCountryIdFilter($countryId) public function toOptionArray($emptyLabel = ' ') { $options = $this->_toOptionArray('country_id', 'name', ['title' => 'iso2_code']); - $sort = []; - foreach ($options as $data) { - $name = (string)$this->_localeLists->getCountryTranslation($data['value']); - if (!empty($name)) { - $sort[$name] = $data['value']; - } - } + $sort = $this->getSort($options); + $this->_arrayUtils->ksortMultibyte($sort, $this->_localeResolver->getLocale()); foreach (array_reverse($this->_foregroundCountries) as $foregroundCountry) { $name = array_search($foregroundCountry, $sort); - unset($sort[$name]); - $sort = [$name => $foregroundCountry] + $sort; + if ($name) { + unset($sort[$name]); + $sort = [$name => $foregroundCountry] + $sort; + } } $isRegionVisible = (bool)$this->helperData->isShowNonRequiredState(); $options = []; foreach ($sort as $label => $value) { - $options = $this->addForegroundCountriesToOptionArray($emptyLabel, $options); $option = ['value' => $value, 'label' => $label]; if ($this->helperData->isRegionRequired($value)) { $option['is_region_required'] = true; @@ -366,4 +344,23 @@ public function getCountriesWithRequiredStates() } return $countries; } + + /** + * Get sort + * + * @param array $options + * @return array + */ + private function getSort(array $options): array + { + $sort = []; + foreach ($options as $data) { + $name = (string)$this->_localeLists->getCountryTranslation($data['value']); + if (!empty($name)) { + $sort[$name] = $data['value']; + } + } + + return $sort; + } } diff --git a/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Country/CollectionTest.php b/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Country/CollectionTest.php index 8eb4ad78fbe5c..f5c6c5eeb53a6 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Country/CollectionTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Country/CollectionTest.php @@ -99,8 +99,7 @@ public function testToOptionArray($optionsArray, $emptyLabel, $foregroundCountri $this->_model->setForegroundCountries($foregroundCountries); $result = $this->_model->toOptionArray($emptyLabel); - $this->assertCount(count($optionsArray) + (int)(!empty($emptyLabel) && !empty($foregroundCountries)) + - (int)(!empty($emptyLabel)), $result); + $this->assertCount(count($optionsArray) + (int)(!empty($emptyLabel)), $result); foreach ($expectedResults as $index => $expectedResult) { $this->assertEquals($expectedResult, $result[$index]['label']); } @@ -121,8 +120,10 @@ public function toOptionArrayDataProvider() [$optionsArray, false, [], ['AD', 'US', 'ES', 'BZ']], [$optionsArray, false, 'US', ['US', 'AD', 'ES', 'BZ']], [$optionsArray, false, ['US', 'BZ'], ['US', 'BZ', 'AD', 'ES']], - [$optionsArray, ' ', 'US', [' ', 'US', ' ', 'AD', 'ES', 'BZ']], - [$optionsArray, ' ', [], [' ', 'AD', 'US', 'ES', 'BZ']] + [$optionsArray, ' ', 'US', [' ', 'US', 'AD', 'ES', 'BZ']], + [$optionsArray, ' ', [], [' ', 'AD', 'US', 'ES', 'BZ']], + [$optionsArray, ' ', 'UA', [' ', 'AD', 'US', 'ES', 'BZ']], + [$optionsArray, ' ', ['AF', 'UA'], [' ', 'AD', 'US', 'ES', 'BZ']], ]; } } diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml index c2338e30ecd3b..8d471a1e49e7f 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml @@ -3,59 +3,63 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis // @deprecated -// @codingStandardsIgnoreFile - ?> getLinksPurchasedSeparately(); ?> -helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> -getProduct()->isSaleable() || $_skipSaleableCheck) && $block->hasLinks()):?> +helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?> +getProduct()->isSaleable() || $_skipSaleableCheck) && $block->hasLinks()) :?>
-
+ + escapeHtml(__('Downloadable Information')) ?> +
getLinks(); ?> getLinkSelectionRequired(); ?> -
- +
@@ -65,21 +66,21 @@ isItemsAvailable()): ?> -
+
getItemsHasMesssages()): ?> checked="checked" class="checkbox" /> - +
    getItems() as $_index => $_item): ?> - getProduct() ?> + getProduct() ?>
  1. - Item %1 of %2', $_index+1, $block->countItems()) ?> + escapeHtml(__('Item %1 of %2', $_index+1, $block->countItems()), ['span']) ?>
    getImage($_product, 'gift_messages_checkout_thumbnail')->toHtml() ?> @@ -87,36 +88,36 @@ escapeHtml($_product->getName()) ?>
    -
    +
    isItemMessagesAvailable($_item)): ?> -
  2. @@ -124,13 +125,13 @@
-
+
- + +
+ escapeHtml(__('Do you have any gift items in your order?')) ?>
- -
-
- -
- getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" /> - +
+ getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" /> +
-
+
isMessagesOrderAvailable() || $block->isMessagesAvailable()): ?> -
+
- getEntityHasMessage()): ?> checked="checked" class="checkbox" /> - + getEntityHasMessage()): ?> checked="checked" class="checkbox" /> +
-
-
+
+
isMessagesAvailable()): ?> -
isItemsAvailable()): ?> -
+
- getItemsHasMesssages()): ?> checked="checked" class="checkbox" /> - + getItemsHasMesssages()): ?> checked="checked" class="checkbox" /> +
-
-
    - getItems() as $_index => $_item): ?> - getProduct() ?> -
  1. -
    -
    Item %1 of %2', $_index+1, $block->countItems()) ?>
    -
    - getImage($_product, 'gift_messages_checkout_thumbnail')->toHtml() ?> -
    - escapeHtml($_product->getName()) ?> -
    -
    -
    - - - isItemMessagesAvailable($_item)): ?> - - - + +
    +
  2. + +
-
+
diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml new file mode 100644 index 0000000000000..a8aa089a389e6 --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchAllIndexerToActionModeActionGroup.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml new file mode 100644 index 0000000000000..7b77af08614cf --- /dev/null +++ b/app/code/Magento/Indexer/Test/Mftf/ActionGroup/AdminSwitchIndexerToActionModeActionGroup.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml index 860b600de2b53..8e7df86d01329 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml @@ -16,5 +16,6 @@ + diff --git a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml index 7b666b322d7c1..ef0a667d2de47 100644 --- a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml +++ b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml @@ -69,4 +69,4 @@ }); - \ No newline at end of file + diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml index fab89973d908b..cd04b346b16a6 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml @@ -4,8 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis ?>
    - +
  1. - getCount() > 0): ?> + getCount() > 0) : ?> - getLabel() ?> - helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?> - getCount() ?> - getCount() == 1):?> + getLabel() ?> + helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?> + getCount() ?> + getCount() == 1) : + ?> escapeHtml(__('item')) ?> escapeHtml(__('item')) ?> - - getLabel() ?> - helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?> - getCount() ?> - getCount() == 1):?> + + getLabel() ?> + helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?> + getCount() ?> + getCount() == 1) : + ?>escapeHtml(__('items')) ?>escapeHtml(__('items')) ?>
  2. diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml index 603f2f93ff754..ebdb6f4d56547 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> getActiveFilters() ?> - +
    + data-count="">escapeHtml(__('Now Shopping by')) ?>
      - +
    1. escapeHtml(__($_filter->getName())) ?> - stripTags($_filter->getLabel()) ?> + escapeHtml($block->stripTags($_filter->getLabel())) ?> getClearLinkUrl(); - $currentFilterName = $block->escapeHtml(__($_filter->getName())) . " " . $block->stripTags($_filter->getLabel()); - if ($clearLinkUrl): + $currentFilterName = $block->escapeHtmlAttr(__($_filter->getName()) . " " . $block->stripTags($_filter->getLabel())); + if ($clearLinkUrl) : ?> - + title="escapeHtmlAttr($_filter->getFilter()->getClearLinkText()) ?>" + href="escapeUrl($clearLinkUrl) ?>"> escapeHtml($_filter->getFilter()->getClearLinkText()) ?> - - "> - + + "> + escapeHtml(__('Remove This Item')) ?>
    2. diff --git a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml index b2159d2ff08d4..9d915956ea694 100644 --- a/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml +++ b/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -canShowBlock()): ?> +canShowBlock()) : ?>
      - + escapeHtml(__('Shop By')) ?>
      getChildHtml('state') ?> - getLayer()->getState()->getFilters()): ?> + getLayer()->getState()->getFilters()) : ?> - getFilters() as $filter): ?> - - + getFilters() as $filter) : ?> + + escapeHtml(__('Shopping Options')) ?>
      - - getItemsCount()): ?> + + getItemsCount()) : ?>
      escapeHtml(__($filter->getName())) ?>
      -
      getChildBlock('renderer')->render($filter) ?>
      +
      getChildBlock('renderer')->render($filter) ?>
      - +
      diff --git a/app/code/Magento/MediaStorage/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml b/app/code/Magento/MediaStorage/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml index f3c301b490282..fd437161dfbb0 100644 --- a/app/code/Magento/MediaStorage/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml +++ b/app/code/Magento/MediaStorage/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> @@ -35,7 +32,7 @@ require([ ); getSyncStorageParams() ?> - addAllowedStorage(, ''); + addAllowedStorage(escapeJs($syncStorageParams['storage_type']) ?>, 'escapeJs($syncStorageParams['connection_name']) ?>'); defaultValues = []; defaultValues['system_media_storage_configuration_media_storage'] = $('system_media_storage_configuration_media_storage').value; @@ -93,7 +90,7 @@ require([ } var checkStatus = function() { - u = new Ajax.PeriodicalUpdater('', 'getAjaxStatusUpdateUrl() ?>', { + u = new Ajax.PeriodicalUpdater('', 'escapeUrl($block->getAjaxStatusUpdateUrl()) ?>', { method: 'get', frequency: 5, loaderArea: false, @@ -103,7 +100,7 @@ require([ try { response = JSON.parse(transport.responseText); - if (response.state == '' + if (response.state == '' && response.message ) { if ($('sync_span').hasClassName('no-display')) { @@ -115,12 +112,12 @@ require([ enableStorageSelection(); $('sync_span').addClassName('no-display'); - if (response.state == '') { + if (response.state == '') { addAllowedStorage( $('system_media_storage_configuration_media_storage').value, $('system_media_storage_configuration_media_database').value ); - } else if (response.state == '') { + } else if (response.state == '') { if (response.has_errors) { enableSyncButton(); } else { @@ -155,7 +152,7 @@ require([ connection: $('system_media_storage_configuration_media_database').value }; - new Ajax.Request('getAjaxSyncUrl() ?>', { + new Ajax.Request('escapeUrl($block->getAjaxSyncUrl()) ?>', { parameters: params, loaderArea: false, asynchronous: true @@ -179,7 +176,7 @@ require([ getButtonHtml() ?> - Synchronize + Synchronize diff --git a/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php b/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php index 0bf36e7ce5d6b..6eb840e0c7140 100644 --- a/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php +++ b/app/code/Magento/Msrp/Pricing/Price/MsrpPrice.php @@ -93,6 +93,8 @@ public function canApplyMsrp(Product $product) } /** + * Check if is minimal price is less than the msrp. + * * @param Product $product * @return bool|float */ diff --git a/app/code/Magento/Msrp/Pricing/Render/PriceBox.php b/app/code/Magento/Msrp/Pricing/Render/PriceBox.php index 892c0bcb51244..709d8da871722 100644 --- a/app/code/Magento/Msrp/Pricing/Render/PriceBox.php +++ b/app/code/Magento/Msrp/Pricing/Render/PriceBox.php @@ -59,4 +59,16 @@ public function getMsrpPriceCalculator(): MsrpPriceCalculatorInterface { return $this->msrpPriceCalculator; } + + /** + * @inheritDoc + */ + public function getCacheKey() + { + return sprintf( + '%s-%s', + parent::getCacheKey(), + $this->getZone() + ); + } } diff --git a/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml index a428df57ab113..a77fe0fff91e3 100644 --- a/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml +++ b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml @@ -105,4 +105,4 @@ $priceElementIdPrefix = $block->getPriceElementIdPrefix() ? $block->getPriceElem "productName": "escapeJs($block->escapeHtml($product->getName())) ?>", "closeButtonId": "#map-popup-close"}}'> - \ No newline at end of file + diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml index ab49788d8dc1b..598cbf37d8c4d 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml @@ -4,21 +4,19 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var \Magento\Multishipping\Block\Checkout\Address\Select $block */ ?>
      - getAddress() as $address): ?> + getAddress() as $address) : ?>
      getAddressAsHtml($address) ?> - isAddressDefaultBilling($address)): ?> + isAddressDefaultBilling($address)) : ?>
      escapeHtml(__('Default Billing')); ?> - isAddressDefaultShipping($address)): ?> + isAddressDefaultShipping($address)) : ?>
      escapeHtml(__('Default Shipping')); ?>
      diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/addresses.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/addresses.phtml index a29013cc71722..faf08f77c02f3 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/addresses.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/addresses.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Files.LineLength ?> - getItems() as $_index => $_item): ?> + getItems() as $_index => $_item) : ?> getQuoteItem()) : ?> @@ -68,11 +68,11 @@
      - getProduct()->getIsVirtual()): ?> + getProduct()->getIsVirtual()) : ?>
      escapeHtml(__('A shipping selection is not applicable.')) ?>
      - +
      -
      +