diff --git a/README.md b/README.md
index 9e3cf448f99fb..af1d3d4c80404 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
## Magento System Requirements
-[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
+[Magento System Requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements.html).
## Install Magento
diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewed.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewed.php
index 0de1111ffa722..a42a44814cb0c 100644
--- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewed.php
+++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewed.php
@@ -6,12 +6,12 @@
*/
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
-use Magento\Framework\App\Action\HttpGetActionInterface;
+use Magento\Framework\App\Action\HttpPostActionInterface;
/**
* Get most viewed products controller.
*/
-class ProductsViewed extends AjaxBlock implements HttpGetActionInterface
+class ProductsViewed extends AjaxBlock implements HttpPostActionInterface
{
/**
* Gets most viewed products list
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SetWebsiteCountryOptionsToDefaultActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SetWebsiteCountryOptionsToDefaultActionGroup.xml
new file mode 100644
index 0000000000000..4519648eb1d1b
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SetWebsiteCountryOptionsToDefaultActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/CountryOptionsSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/CountryOptionsSection.xml
new file mode 100644
index 0000000000000..2e2e5aec35ecd
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/Section/CountryOptionsSection.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php b/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php
new file mode 100644
index 0000000000000..a6c1b088400a7
--- /dev/null
+++ b/app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php
@@ -0,0 +1,177 @@
+orderManagement = $orderManagement;
+ $this->paymentExtensionFactory = $paymentExtensionFactory;
+ $this->getPaymentNonceCommand = $getPaymentNonceCommand;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function place(array $orderList): array
+ {
+ if (empty($orderList)) {
+ return [];
+ }
+
+ $errorList = [];
+ $firstOrder = $this->orderManagement->place(array_shift($orderList));
+ // get payment token from first placed order
+ $paymentToken = $this->getPaymentToken($firstOrder);
+
+ foreach ($orderList as $order) {
+ try {
+ /** @var OrderInterface $order */
+ $orderPayment = $order->getPayment();
+ $this->setVaultPayment($orderPayment, $paymentToken);
+ $this->orderManagement->place($order);
+ } catch (\Exception $e) {
+ $incrementId = $order->getIncrementId();
+ $errorList[$incrementId] = $e;
+ }
+ }
+
+ return $errorList;
+ }
+
+ /**
+ * Sets vault payment method.
+ *
+ * @param OrderPaymentInterface $orderPayment
+ * @param PaymentTokenInterface $paymentToken
+ * @return void
+ */
+ private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTokenInterface $paymentToken): void
+ {
+ $vaultMethod = $this->getVaultPaymentMethod(
+ $orderPayment->getMethod()
+ );
+ $orderPayment->setMethod($vaultMethod);
+
+ $publicHash = $paymentToken->getPublicHash();
+ $customerId = $paymentToken->getCustomerId();
+ $result = $this->getPaymentNonceCommand->execute(
+ ['public_hash' => $publicHash, 'customer_id' => $customerId]
+ )
+ ->get();
+
+ $orderPayment->setAdditionalInformation(
+ DataAssignObserver::PAYMENT_METHOD_NONCE,
+ $result['paymentMethodNonce']
+ );
+ $orderPayment->setAdditionalInformation(
+ PaymentTokenInterface::PUBLIC_HASH,
+ $publicHash
+ );
+ $orderPayment->setAdditionalInformation(
+ PaymentTokenInterface::CUSTOMER_ID,
+ $customerId
+ );
+ }
+
+ /**
+ * Returns vault payment method.
+ *
+ * For placing sequence of orders, we need to replace the original method on the vault method.
+ *
+ * @param string $method
+ * @return string
+ */
+ private function getVaultPaymentMethod(string $method): string
+ {
+ $vaultPaymentMap = [
+ ConfigProvider::CODE => ConfigProvider::CC_VAULT_CODE,
+ PaypalConfigProvider::PAYPAL_CODE => PaypalConfigProvider::PAYPAL_VAULT_CODE
+ ];
+
+ return $vaultPaymentMap[$method] ?? $method;
+ }
+
+ /**
+ * Returns payment token.
+ *
+ * @param OrderInterface $order
+ * @return PaymentTokenInterface
+ * @throws \BadMethodCallException
+ */
+ private function getPaymentToken(OrderInterface $order): PaymentTokenInterface
+ {
+ $orderPayment = $order->getPayment();
+ $extensionAttributes = $this->getExtensionAttributes($orderPayment);
+ $paymentToken = $extensionAttributes->getVaultPaymentToken();
+
+ if ($paymentToken === null) {
+ throw new \BadMethodCallException('Vault Payment Token should be defined for placed order payment.');
+ }
+
+ return $paymentToken;
+ }
+
+ /**
+ * Gets payment extension attributes.
+ *
+ * @param OrderPaymentInterface $payment
+ * @return OrderPaymentExtensionInterface
+ */
+ private function getExtensionAttributes(OrderPaymentInterface $payment): OrderPaymentExtensionInterface
+ {
+ $extensionAttributes = $payment->getExtensionAttributes();
+ if (null === $extensionAttributes) {
+ $extensionAttributes = $this->paymentExtensionFactory->create();
+ $payment->setExtensionAttributes($extensionAttributes);
+ }
+
+ return $extensionAttributes;
+ }
+}
diff --git a/app/code/Magento/Braintree/composer.json b/app/code/Magento/Braintree/composer.json
index 5af56a2afd3fe..2f956076f3846 100644
--- a/app/code/Magento/Braintree/composer.json
+++ b/app/code/Magento/Braintree/composer.json
@@ -21,7 +21,8 @@
"magento/module-quote": "*",
"magento/module-sales": "*",
"magento/module-ui": "*",
- "magento/module-vault": "*"
+ "magento/module-vault": "*",
+ "magento/module-multishipping": "*"
},
"suggest": {
"magento/module-checkout-agreements": "*",
diff --git a/app/code/Magento/Braintree/etc/config.xml b/app/code/Magento/Braintree/etc/config.xml
index 9de4773af023a..fe4cfab9c0e30 100644
--- a/app/code/Magento/Braintree/etc/config.xml
+++ b/app/code/Magento/Braintree/etc/config.xml
@@ -42,7 +42,7 @@
cc_type,cc_number,avsPostalCodeResponseCode,avsStreetAddressResponseCode,cvvResponseCode,processorAuthorizationCode,processorResponseCode,processorResponseText,liabilityShifted,liabilityShiftPossible,riskDataId,riskDataDecision
Magento\Braintree\Model\AvsEmsCodeMapper
Magento\Braintree\Model\CvvEmsCodeMapper
- braintree
+ braintree_group
BraintreePayPalFacade
@@ -68,7 +68,7 @@
processorResponseCode,processorResponseText,paymentId
processorResponseCode,processorResponseText,paymentId,payerEmail
en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,nl_NL,no_NO,pl_PL,es_ES,sv_SE,tr_TR,pt_BR,ja_JP,id_ID,ko_KR,pt_PT,ru_RU,th_TH,zh_CN,zh_TW
- braintree
+ braintree_group
BraintreeCreditCardVaultFacade
@@ -78,7 +78,7 @@
Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter
Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider
- braintree
+ braintree_group
BraintreePayPalVaultFacade
@@ -88,7 +88,7 @@
Magento\Braintree\Model\InstantPurchase\PayPal\TokenFormatter
Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider
- braintree
+ braintree_group
diff --git a/app/code/Magento/Braintree/etc/frontend/di.xml b/app/code/Magento/Braintree/etc/frontend/di.xml
index ea417c407dffd..d8d3a93b71dc3 100644
--- a/app/code/Magento/Braintree/etc/frontend/di.xml
+++ b/app/code/Magento/Braintree/etc/frontend/di.xml
@@ -61,4 +61,12 @@
Magento\Braintree\Model\LocaleResolver
+
+
+
+ - Magento\Braintree\Model\Multishipping\PlaceOrder
+ - Magento\Braintree\Model\Multishipping\PlaceOrder
+
+
+
diff --git a/app/code/Magento/Braintree/etc/payment.xml b/app/code/Magento/Braintree/etc/payment.xml
index dbabd91151022..4cae049aaf5a9 100644
--- a/app/code/Magento/Braintree/etc/payment.xml
+++ b/app/code/Magento/Braintree/etc/payment.xml
@@ -8,8 +8,16 @@
-
+
Braintree
+
+
+ 1
+
+
+ 1
+
+
diff --git a/app/code/Magento/Braintree/view/frontend/layout/multishipping_checkout_billing.xml b/app/code/Magento/Braintree/view/frontend/layout/multishipping_checkout_billing.xml
new file mode 100644
index 0000000000000..06390d403e63d
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/layout/multishipping_checkout_billing.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+ - Magento_Braintree::multishipping/form.phtml
+ - Magento_Braintree::multishipping/form_paypal.phtml
+
+
+
+
+
diff --git a/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml
new file mode 100644
index 0000000000000..bf8aa8dd09c2c
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form.phtml
@@ -0,0 +1,29 @@
+
+
+
diff --git a/app/code/Magento/Braintree/view/frontend/templates/multishipping/form_paypal.phtml b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form_paypal.phtml
new file mode 100644
index 0000000000000..ea3eb2214c2d8
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/templates/multishipping/form_paypal.phtml
@@ -0,0 +1,29 @@
+
+
+
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/hosted-fields.js
new file mode 100644
index 0000000000000..1ceebc8e66282
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/hosted-fields.js
@@ -0,0 +1,102 @@
+/**
+ * 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/hosted-fields',
+ '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'
+], function (
+ $,
+ Component,
+ validator,
+ messageList,
+ $t,
+ fullScreenLoader,
+ setPaymentInformationAction,
+ additionalValidators
+) {
+ 'use strict';
+
+ return Component.extend({
+ defaults: {
+ 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 () {
+ return self.setPaymentInformation();
+ });
+ },
+
+ /**
+ * @override
+ */
+ setPaymentInformation: function () {
+ if (additionalValidators.validate()) {
+
+ fullScreenLoader.startLoader();
+
+ $.when(
+ setPaymentInformationAction(
+ this.messageContainer,
+ this.getData()
+ )
+ ).done(this.done.bind(this))
+ .fail(this.fail.bind(this));
+ }
+ },
+
+ /**
+ * {Function}
+ */
+ fail: function () {
+ fullScreenLoader.stopLoader();
+
+ return this;
+ },
+
+ /**
+ * {Function}
+ */
+ done: function () {
+ fullScreenLoader.stopLoader();
+ $('#multishipping-billing-form').submit();
+
+ return this;
+ }
+ });
+});
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
new file mode 100644
index 0000000000000..6702e58d1214b
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js
@@ -0,0 +1,143 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+/*browser:true*/
+/*global define*/
+define([
+ 'jquery',
+ 'underscore',
+ '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'
+], function (
+ $,
+ _,
+ Component,
+ setPaymentInformationAction,
+ additionalValidators,
+ fullScreenLoader,
+ $t
+) {
+ 'use strict';
+
+ return Component.extend({
+ defaults: {
+ template: 'Magento_Braintree/payment/multishipping/paypal',
+ submitButtonSelector: '#payment-continue span'
+ },
+
+ /**
+ * @override
+ */
+ onActiveChange: function (isActive) {
+ this.updateSubmitButtonTitle(isActive);
+
+ this._super(isActive);
+ },
+
+ /**
+ * @override
+ */
+ beforePlaceOrder: function (data) {
+ this._super(data);
+
+ this.updateSubmitButtonTitle(true);
+ },
+
+ /**
+ * @override
+ */
+ getShippingAddress: function () {
+ return {};
+ },
+
+ /**
+ * @override
+ */
+ getData: function () {
+ var data = this._super();
+
+ data['additional_data']['is_active_payment_token_enabler'] = true;
+
+ return data;
+ },
+
+ /**
+ * @override
+ */
+ isActiveVault: function () {
+ return true;
+ },
+
+ /**
+ * Skipping order review step on checkout with multiple addresses is not allowed.
+ *
+ * @returns {Boolean}
+ */
+ isSkipOrderReview: function () {
+ return false;
+ },
+
+ /**
+ * Checks if payment method nonce is already received.
+ *
+ * @returns {Boolean}
+ */
+ isPaymentMethodNonceReceived: function () {
+ return this.paymentMethodNonce !== null;
+ },
+
+ /**
+ * Updates submit button title 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);
+ },
+
+ /**
+ * @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));
+ }
+ },
+
+ /**
+ * {Function}
+ */
+ fail: function () {
+ fullScreenLoader.stopLoader();
+
+ return this;
+ },
+
+ /**
+ * {Function}
+ */
+ done: function () {
+ fullScreenLoader.stopLoader();
+ $('#multishipping-billing-form').submit();
+
+ return this;
+ }
+ });
+});
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
new file mode 100644
index 0000000000000..964e15df166d3
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/form.html
@@ -0,0 +1,106 @@
+
+
+
\ No newline at end of file
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
new file mode 100644
index 0000000000000..722989e41f98f
--- /dev/null
+++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/multishipping/paypal.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php
index 706d9b83b9711..8b98fbdc8f7ef 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php
@@ -207,8 +207,8 @@ public function isMainImage($image)
*/
public function getImageAttribute($imageId, $attributeName, $default = null)
{
- $attributes =
- $this->getConfigView()->getMediaAttributes('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE, $imageId);
+ $attributes = $this->getConfigView()
+ ->getMediaAttributes('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE, $imageId);
return $attributes[$attributeName] ?? $default;
}
diff --git a/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php b/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php
new file mode 100644
index 0000000000000..0384c9cd9acce
--- /dev/null
+++ b/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php
@@ -0,0 +1,156 @@
+gallery = $gallery;
+ $this->jsonSerializer = $jsonSerializer;
+ parent::__construct($context, $arrayUtils, $data);
+ }
+
+ /**
+ * Retrieve gallery options in JSON format
+ *
+ * @return string
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @SuppressWarnings(PHPMD.NPathComplexity)
+ * @SuppressWarnings(PHPMD.ElseExpression)
+ */
+ public function getOptionsJson()
+ {
+ $optionItems = null;
+
+ //Special case for gallery/nav which can be the string "thumbs/false/dots"
+ if (is_bool($this->getVar("gallery/nav"))) {
+ $optionItems['nav'] = $this->getVar("gallery/nav") ? 'true' : 'false';
+ } else {
+ $optionItems['nav'] = $this->escapeHtml($this->getVar("gallery/nav"));
+ }
+
+ $optionItems['loop'] = $this->getVar("gallery/loop");
+ $optionItems['keyboard'] = $this->getVar("gallery/keyboard");
+ $optionItems['arrows'] = $this->getVar("gallery/arrows");
+ $optionItems['allowfullscreen'] = $this->getVar("gallery/allowfullscreen");
+ $optionItems['showCaption'] = $this->getVar("gallery/caption");
+ $optionItems['width'] = (int)$this->escapeHtml(
+ $this->gallery->getImageAttribute('product_page_image_medium', 'width')
+ );
+ $optionItems['thumbwidth'] = (int)$this->escapeHtml(
+ $this->gallery->getImageAttribute('product_page_image_small', 'width')
+ );
+
+ if ($this->gallery->getImageAttribute('product_page_image_small', 'height') ||
+ $this->gallery->getImageAttribute('product_page_image_small', 'width')) {
+ $optionItems['thumbheight'] = (int)$this->escapeHtml(
+ $this->gallery->getImageAttribute('product_page_image_small', 'height') ?:
+ $this->gallery->getImageAttribute('product_page_image_small', 'width')
+ );
+ }
+
+ if ($this->gallery->getImageAttribute('product_page_image_medium', 'height') ||
+ $this->gallery->getImageAttribute('product_page_image_medium', 'width')) {
+ $optionItems['height'] = (int)$this->escapeHtml(
+ $this->gallery->getImageAttribute('product_page_image_medium', 'height') ?:
+ $this->gallery->getImageAttribute('product_page_image_medium', 'width')
+ );
+ }
+
+ if ($this->getVar("gallery/transition/duration")) {
+ $optionItems['transitionduration'] =
+ (int)$this->escapeHtml($this->getVar("gallery/transition/duration"));
+ }
+
+ $optionItems['transition'] = $this->escapeHtml($this->getVar("gallery/transition/effect"));
+ $optionItems['navarrows'] = $this->getVar("gallery/navarrows");
+ $optionItems['navtype'] = $this->escapeHtml($this->getVar("gallery/navtype"));
+ $optionItems['navdir'] = $this->escapeHtml($this->getVar("gallery/navdir"));
+
+ if ($this->getVar("gallery/thumbmargin")) {
+ $optionItems['thumbmargin'] = (int)$this->escapeHtml($this->getVar("gallery/thumbmargin"));
+ }
+
+ return $this->jsonSerializer->serialize($optionItems);
+ }
+
+ /**
+ * Retrieve gallery fullscreen options in JSON format
+ *
+ * @return string
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @SuppressWarnings(PHPMD.NPathComplexity)
+ * @SuppressWarnings(PHPMD.ElseExpression)
+ */
+ public function getFSOptionsJson()
+ {
+ $fsOptionItems = null;
+
+ //Special case for gallery/nav which can be the string "thumbs/false/dots"
+ if (is_bool($this->getVar("gallery/fullscreen/nav"))) {
+ $fsOptionItems['nav'] = $this->getVar("gallery/fullscreen/nav") ? 'true' : 'false';
+ } else {
+ $fsOptionItems['nav'] = $this->escapeHtml($this->getVar("gallery/fullscreen/nav"));
+ }
+
+ $fsOptionItems['loop'] = $this->getVar("gallery/fullscreen/loop");
+ $fsOptionItems['navdir'] = $this->escapeHtml($this->getVar("gallery/fullscreen/navdir"));
+ $fsOptionItems['navarrows'] = $this->getVar("gallery/fullscreen/navarrows");
+ $fsOptionItems['navtype'] = $this->escapeHtml($this->getVar("gallery/fullscreen/navtype"));
+ $fsOptionItems['arrows'] = $this->getVar("gallery/fullscreen/arrows");
+ $fsOptionItems['showCaption'] = $this->getVar("gallery/fullscreen/caption");
+
+ if ($this->getVar("gallery/fullscreen/transition/duration")) {
+ $fsOptionItems['transitionduration'] = (int)$this->escapeHtml(
+ $this->getVar("gallery/fullscreen/transition/duration")
+ );
+ }
+
+ $fsOptionItems['transition'] = $this->escapeHtml($this->getVar("gallery/fullscreen/transition/effect"));
+
+ if ($this->getVar("gallery/fullscreen/keyboard")) {
+ $fsOptionItems['keyboard'] = $this->getVar("gallery/fullscreen/keyboard");
+ }
+
+ if ($this->getVar("gallery/fullscreen/thumbmargin")) {
+ $fsOptionItems['thumbmargin'] =
+ (int)$this->escapeHtml($this->getVar("gallery/fullscreen/thumbmargin"));
+ }
+
+ return $this->jsonSerializer->serialize($fsOptionItems);
+ }
+}
diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php
index 170f1209ad9e6..9b8d0ad75a8c9 100644
--- a/app/code/Magento/Catalog/Helper/Image.php
+++ b/app/code/Magento/Catalog/Helper/Image.php
@@ -6,6 +6,7 @@
namespace Magento\Catalog\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
+use Magento\Framework\View\Element\Block\ArgumentInterface;
/**
* Catalog image helper
@@ -14,7 +15,7 @@
* @SuppressWarnings(PHPMD.TooManyFields)
* @since 100.0.2
*/
-class Image extends AbstractHelper
+class Image extends AbstractHelper implements ArgumentInterface
{
/**
* Media config node
@@ -764,7 +765,7 @@ protected function getImageFile()
protected function parseSize($string)
{
$size = explode('x', strtolower($string));
- if (sizeof($size) == 2) {
+ if (count($size) == 2) {
return ['width' => $size[0] > 0 ? $size[0] : null, 'height' => $size[1] > 0 ? $size[1] : null];
}
return false;
diff --git a/app/code/Magento/Catalog/Model/Product/Type/FrontSpecialPrice.php b/app/code/Magento/Catalog/Model/Product/Type/FrontSpecialPrice.php
index f6893a41113e6..dabfdb74f0118 100644
--- a/app/code/Magento/Catalog/Model/Product/Type/FrontSpecialPrice.php
+++ b/app/code/Magento/Catalog/Model/Product/Type/FrontSpecialPrice.php
@@ -17,6 +17,9 @@
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ *
+ * @deprecated
+ * @see \Magento\Catalog\Model\Product\Type\Price
*/
class FrontSpecialPrice extends Price
{
@@ -66,6 +69,8 @@ public function __construct(
/**
* @inheritdoc
+ *
+ * @deprecated
*/
protected function _applySpecialPrice($product, $finalPrice)
{
diff --git a/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php b/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php
index a597b8fddda9f..ed9f89efc6891 100644
--- a/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php
+++ b/app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php
@@ -3,9 +3,12 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Catalog\Observer;
use Magento\Framework\Event\ObserverInterface;
+use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
/**
* Set value for Special Price start date
@@ -13,21 +16,20 @@
class SetSpecialPriceStartDate implements ObserverInterface
{
/**
- * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
+ * @var TimezoneInterface
*/
private $localeDate;
/**
- * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
- * @codeCoverageIgnore
+ * @param TimezoneInterface $localeDate
*/
- public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
+ public function __construct(TimezoneInterface $localeDate)
{
$this->localeDate = $localeDate;
}
/**
- * Set the current date to Special Price From attribute if it empty
+ * Set the current date to Special Price From attribute if it's empty.
*
* @param \Magento\Framework\Event\Observer $observer
* @return $this
@@ -36,8 +38,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var $product \Magento\Catalog\Model\Product */
$product = $observer->getEvent()->getProduct();
- if ($product->getSpecialPrice() && !$product->getSpecialFromDate()) {
- $product->setData('special_from_date', $this->localeDate->date());
+ if ($product->getSpecialPrice() && ! $product->getSpecialFromDate()) {
+ $product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0));
}
return $this;
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml
index cbdabe6a2d218..ad32b8edbd243 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml
@@ -289,4 +289,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductGridData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductGridData.xml
index ea0bcafe56c48..71c8af318e9b4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductGridData.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductGridData.xml
@@ -12,4 +12,7 @@
10
100
+
+ 1
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
index 3027416ee520b..bcfab6ccfdf1f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml
new file mode 100644
index 0000000000000..b24ed7f9c9a81
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
new file mode 100644
index 0000000000000..7ed8b13fce750
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
@@ -0,0 +1,223 @@
+escaper = $objectManager->getObject(Escaper::class);
+ $this->configView = $this->createMock(View::class);
+
+ $this->viewConfig = $this->createConfiguredMock(
+ Config::class,
+ [
+ 'getViewConfig' => $this->configView
+ ]
+ );
+
+ $this->context = $this->createConfiguredMock(
+ Context::class,
+ [
+ 'getEscaper' => $this->escaper,
+ 'getViewConfig' => $this->viewConfig
+ ]
+ );
+
+ $this->gallery = $this->createMock(Gallery::class);
+
+ $this->jsonSerializer = $objectManager->getObject(
+ Json::class
+ );
+
+ $this->model = $objectManager->getObject(GalleryOptions::class, [
+ 'context' => $this->context,
+ 'jsonSerializer' => $this->jsonSerializer,
+ 'gallery' => $this->gallery
+ ]);
+ }
+
+ public function testGetOptionsJson()
+ {
+ $configMap = [
+ ['Magento_Catalog', 'gallery/nav', 'thumbs'],
+ ['Magento_Catalog', 'gallery/loop', false],
+ ['Magento_Catalog', 'gallery/keyboard', true],
+ ['Magento_Catalog', 'gallery/arrows', true],
+ ['Magento_Catalog', 'gallery/caption', false],
+ ['Magento_Catalog', 'gallery/allowfullscreen', true],
+ ['Magento_Catalog', 'gallery/navdir', 'horizontal'],
+ ['Magento_Catalog', 'gallery/navarrows', true],
+ ['Magento_Catalog', 'gallery/navtype', 'slides'],
+ ['Magento_Catalog', 'gallery/thumbmargin', '5'],
+ ['Magento_Catalog', 'gallery/transition/effect', 'slide'],
+ ['Magento_Catalog', 'gallery/transition/duration', '500'],
+ ];
+
+ $imageAttributesMap = [
+ ['product_page_image_medium','height',null, 100],
+ ['product_page_image_medium','width',null, 200],
+ ['product_page_image_small','height',null, 300],
+ ['product_page_image_small','width',null, 400]
+ ];
+
+ $this->configView->expects($this->any())
+ ->method('getVarValue')
+ ->will($this->returnValueMap($configMap));
+ $this->gallery->expects($this->any())
+ ->method('getImageAttribute')
+ ->will($this->returnValueMap($imageAttributesMap));
+
+ $json = $this->model->getOptionsJson();
+
+ $decodedJson = $this->jsonSerializer->unserialize($json);
+
+ $this->assertSame('thumbs', $decodedJson['nav']);
+ $this->assertSame(false, $decodedJson['loop']);
+ $this->assertSame(true, $decodedJson['keyboard']);
+ $this->assertSame(true, $decodedJson['arrows']);
+ $this->assertSame(false, $decodedJson['showCaption']);
+ $this->assertSame(true, $decodedJson['allowfullscreen']);
+ $this->assertSame('horizontal', $decodedJson['navdir']);
+ $this->assertSame(true, $decodedJson['navarrows']);
+ $this->assertSame('slides', $decodedJson['navtype']);
+ $this->assertSame(5, $decodedJson['thumbmargin']);
+ $this->assertSame('slide', $decodedJson['transition']);
+ $this->assertSame(500, $decodedJson['transitionduration']);
+ $this->assertSame(100, $decodedJson['height']);
+ $this->assertSame(200, $decodedJson['width']);
+ $this->assertSame(300, $decodedJson['thumbheight']);
+ $this->assertSame(400, $decodedJson['thumbwidth']);
+ }
+
+ public function testGetFSOptionsJson()
+ {
+ $configMap = [
+ ['Magento_Catalog', 'gallery/fullscreen/nav', false],
+ ['Magento_Catalog', 'gallery/fullscreen/loop', true],
+ ['Magento_Catalog', 'gallery/fullscreen/keyboard', true],
+ ['Magento_Catalog', 'gallery/fullscreen/arrows', false],
+ ['Magento_Catalog', 'gallery/fullscreen/caption', true],
+ ['Magento_Catalog', 'gallery/fullscreen/navdir', 'vertical'],
+ ['Magento_Catalog', 'gallery/fullscreen/navarrows', false],
+ ['Magento_Catalog', 'gallery/fullscreen/navtype', 'thumbs'],
+ ['Magento_Catalog', 'gallery/fullscreen/thumbmargin', '10'],
+ ['Magento_Catalog', 'gallery/fullscreen/transition/effect', 'dissolve'],
+ ['Magento_Catalog', 'gallery/fullscreen/transition/duration', '300']
+ ];
+
+ $this->configView->expects($this->any())
+ ->method('getVarValue')
+ ->will($this->returnValueMap($configMap));
+
+ $json = $this->model->getFSOptionsJson();
+
+ $decodedJson = $this->jsonSerializer->unserialize($json);
+
+ //Note, this tests the special case for nav variable set to false. It
+ //Should not be converted to boolean.
+ $this->assertSame('false', $decodedJson['nav']);
+ $this->assertSame(true, $decodedJson['loop']);
+ $this->assertSame(false, $decodedJson['arrows']);
+ $this->assertSame(true, $decodedJson['keyboard']);
+ $this->assertSame(true, $decodedJson['showCaption']);
+ $this->assertSame('vertical', $decodedJson['navdir']);
+ $this->assertSame(false, $decodedJson['navarrows']);
+ $this->assertSame(10, $decodedJson['thumbmargin']);
+ $this->assertSame('thumbs', $decodedJson['navtype']);
+ $this->assertSame('dissolve', $decodedJson['transition']);
+ $this->assertSame(300, $decodedJson['transitionduration']);
+ }
+
+ public function testGetOptionsJsonOptionals()
+ {
+ $configMap = [
+ ['Magento_Catalog', 'gallery/fullscreen/thumbmargin', false],
+ ['Magento_Catalog', 'gallery/fullscreen/transition/duration', false]
+ ];
+
+ $this->configView->expects($this->any())
+ ->method('getVarValue')
+ ->will($this->returnValueMap($configMap));
+
+ $json = $this->model->getOptionsJson();
+
+ $decodedJson = $this->jsonSerializer->unserialize($json);
+
+ $this->assertArrayNotHasKey('thumbmargin', $decodedJson);
+ $this->assertArrayNotHasKey('transitionduration', $decodedJson);
+ }
+
+ public function testGetFSOptionsJsonOptionals()
+ {
+ $configMap = [
+ ['Magento_Catalog', 'gallery/fullscreen/keyboard', false],
+ ['Magento_Catalog', 'gallery/fullscreen/thumbmargin', false],
+ ['Magento_Catalog', 'gallery/fullscreen/transition/duration', false]
+ ];
+
+ $this->configView->expects($this->any())
+ ->method('getVarValue')
+ ->will($this->returnValueMap($configMap));
+
+ $json = $this->model->getFSOptionsJson();
+
+ $decodedJson = $this->jsonSerializer->unserialize($json);
+
+ $this->assertArrayNotHasKey('thumbmargin', $decodedJson);
+ $this->assertArrayNotHasKey('keyboard', $decodedJson);
+ $this->assertArrayNotHasKey('transitionduration', $decodedJson);
+ }
+}
diff --git a/app/code/Magento/Catalog/etc/frontend/di.xml b/app/code/Magento/Catalog/etc/frontend/di.xml
index 793a2291f599c..ee9c5b29da894 100644
--- a/app/code/Magento/Catalog/etc/frontend/di.xml
+++ b/app/code/Magento/Catalog/etc/frontend/di.xml
@@ -120,5 +120,4 @@
-
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
index 8d3248896b434..41a2a6142d506 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
@@ -121,7 +121,12 @@
-
+
+
+ Magento\Catalog\Block\Product\View\GalleryOptions
+ Magento\Catalog\Helper\Image
+
+
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 1bfa30478df8a..1f06b90758d0b 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
@@ -12,32 +12,32 @@
* @var $block \Magento\Catalog\Block\Product\View\Gallery
*/
?>
-
-
-
-
-
-
-
-
-
+ $helper = $block->getData('imageHelper');
+ $mainImageData = $mainImage ?
+ $mainImage->getData('medium_image_url') :
+ $helper->getDefaultPlaceholderUrl('image');
+
+?>
+
+
+
+
+
diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl
index 8068447e5ca99..c73c4e39170e6 100644
--- a/app/code/Magento/PageCache/etc/varnish4.vcl
+++ b/app/code/Magento/PageCache/etc/varnish4.vcl
@@ -91,10 +91,11 @@ sub vcl_recv {
}
}
- # Remove Google gclid parameters to minimize the cache objects
- set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
- set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
- set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
+ # Remove all marketing get parameters to minimize the cache objects
+ if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|mc_[a-z]+|utm_[a-z]+)=") {
+ set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|mc_[a-z]+|utm_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
+ set req.url = regsub(req.url, "[?|&]+$", "");
+ }
# Static files caching
if (req.url ~ "^/(pub/)?(media|static)/") {
diff --git a/app/code/Magento/PageCache/etc/varnish5.vcl b/app/code/Magento/PageCache/etc/varnish5.vcl
index 6c8414a5cb641..ea586858eff75 100644
--- a/app/code/Magento/PageCache/etc/varnish5.vcl
+++ b/app/code/Magento/PageCache/etc/varnish5.vcl
@@ -92,10 +92,11 @@ sub vcl_recv {
}
}
- # Remove Google gclid parameters to minimize the cache objects
- set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
- set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
- set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
+ # Remove all marketing get parameters to minimize the cache objects
+ if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|mc_[a-z]+|utm_[a-z]+)=") {
+ set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|mc_[a-z]+|utm_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
+ set req.url = regsub(req.url, "[?|&]+$", "");
+ }
# Static files caching
if (req.url ~ "^/(pub/)?(media|static)/") {
diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml
index 425e4cffb666c..694e517816b22 100644
--- a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml
+++ b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
Payflow Pro
0
@@ -30,7 +30,7 @@
-
+
Enable PayPal Credit
See Details.
"
+"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit® - at no additional cost to you.
+ You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit®.
+ Learn More ","PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit® - at no additional cost to you.
+ You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit®.
+ Learn More "
"Customize Smart Buttons","Customize Smart Buttons"
"Checkout Page","Checkout Page"
"Label","Label"
@@ -731,4 +736,4 @@ User,User
"PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD.","PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD."
"PayPal Credit","PayPal Credit"
"PayPal Guest Checkout Credit Card Icons","PayPal Guest Checkout Credit Card Icons"
-"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"
\ No newline at end of file
+"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
index 145e9c01980a5..3506ffc8c8792 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
@@ -13,6 +13,7 @@
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
use Magento\Quote\Model\Quote;
+use Magento\Store\Model\StoreManagerInterface;
/**
* Get cart
@@ -29,16 +30,24 @@ class GetCartForUser
*/
private $cartRepository;
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
/**
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
* @param CartRepositoryInterface $cartRepository
+ * @param StoreManagerInterface $storeManager
*/
public function __construct(
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
- CartRepositoryInterface $cartRepository
+ CartRepositoryInterface $cartRepository,
+ StoreManagerInterface $storeManager
) {
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
$this->cartRepository = $cartRepository;
+ $this->storeManager = $storeManager;
}
/**
@@ -75,6 +84,15 @@ public function execute(string $cartHash, ?int $customerId): Quote
);
}
+ if ((int)$cart->getStoreId() !== (int)$this->storeManager->getStore()->getId()) {
+ throw new GraphQlNoSuchEntityException(
+ __(
+ 'Wrong store code specified for cart "%masked_cart_id"',
+ ['masked_cart_id' => $cartHash]
+ )
+ );
+ }
+
$cartCustomerId = (int)$cart->getCustomerId();
/* Guest cart, allow operations */
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php b/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
index 582055bc6e13d..13d6a1d3dce70 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
@@ -7,6 +7,7 @@
namespace Magento\QuoteGraphQl\Model\Cart;
+use Magento\Customer\Helper\Address as AddressHelper;
use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
@@ -30,16 +31,24 @@ class QuoteAddressFactory
*/
private $getCustomerAddress;
+ /**
+ * @var AddressHelper
+ */
+ private $addressHelper;
+
/**
* @param BaseQuoteAddressFactory $quoteAddressFactory
* @param GetCustomerAddress $getCustomerAddress
+ * @param AddressHelper $addressHelper
*/
public function __construct(
BaseQuoteAddressFactory $quoteAddressFactory,
- GetCustomerAddress $getCustomerAddress
+ GetCustomerAddress $getCustomerAddress,
+ AddressHelper $addressHelper
) {
$this->quoteAddressFactory = $quoteAddressFactory;
$this->getCustomerAddress = $getCustomerAddress;
+ $this->addressHelper = $addressHelper;
}
/**
@@ -47,11 +56,19 @@ public function __construct(
*
* @param array $addressInput
* @return QuoteAddress
+ * @throws GraphQlInputException
*/
public function createBasedOnInputData(array $addressInput): QuoteAddress
{
$addressInput['country_id'] = $addressInput['country_code'] ?? '';
+ $maxAllowedLineCount = $this->addressHelper->getStreetLines();
+ if (is_array($addressInput['street']) && count($addressInput['street']) > $maxAllowedLineCount) {
+ throw new GraphQlInputException(
+ __('"Street Address" cannot contain more than %1 lines.', $maxAllowedLineCount)
+ );
+ }
+
$quoteAddress = $this->quoteAddressFactory->create();
$quoteAddress->addData($addressInput);
return $quoteAddress;
diff --git a/app/code/Magento/ReleaseNotification/etc/di.xml b/app/code/Magento/ReleaseNotification/etc/di.xml
index 1404a6adb0a10..a4c434ff7f623 100644
--- a/app/code/Magento/ReleaseNotification/etc/di.xml
+++ b/app/code/Magento/ReleaseNotification/etc/di.xml
@@ -6,7 +6,6 @@
*/
-->
-
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php
index 4bd2227d4bb1e..9a271f741edda 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php
@@ -5,12 +5,17 @@
*/
namespace Magento\Sales\Block\Adminhtml\Order\Create\Search;
+use Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider\ProductCollection
+ as ProductCollectionDataProvider;
+use Magento\Framework\App\ObjectManager;
+
/**
* Adminhtml sales order create search products block
*
* @api
* @author Magento Core Team
* @since 100.0.2
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
{
@@ -42,6 +47,11 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
*/
protected $_productFactory;
+ /**
+ * @var ProductCollectionDataProvider $productCollectionProvider
+ */
+ private $productCollectionProvider;
+
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Helper\Data $backendHelper
@@ -50,6 +60,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
* @param \Magento\Backend\Model\Session\Quote $sessionQuote
* @param \Magento\Sales\Model\Config $salesConfig
* @param array $data
+ * @param ProductCollectionDataProvider|null $productCollectionProvider
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
@@ -58,12 +69,15 @@ public function __construct(
\Magento\Catalog\Model\Config $catalogConfig,
\Magento\Backend\Model\Session\Quote $sessionQuote,
\Magento\Sales\Model\Config $salesConfig,
- array $data = []
+ array $data = [],
+ ProductCollectionDataProvider $productCollectionProvider = null
) {
$this->_productFactory = $productFactory;
$this->_catalogConfig = $catalogConfig;
$this->_sessionQuote = $sessionQuote;
$this->_salesConfig = $salesConfig;
+ $this->productCollectionProvider = $productCollectionProvider
+ ?: ObjectManager::getInstance()->get(ProductCollectionDataProvider::class);
parent::__construct($context, $backendHelper, $data);
}
@@ -140,20 +154,18 @@ protected function _addColumnFilterToCollection($column)
*/
protected function _prepareCollection()
{
+
$attributes = $this->_catalogConfig->getProductAttributes();
+ $store = $this->getStore();
+
/* @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
- $collection = $this->_productFactory->create()->getCollection();
- $collection->setStore(
- $this->getStore()
- )->addAttributeToSelect(
+ $collection = $this->productCollectionProvider->getCollectionForStore($store);
+ $collection->addAttributeToSelect(
$attributes
- )->addAttributeToSelect(
- 'sku'
- )->addStoreFilter()->addAttributeToFilter(
+ );
+ $collection->addAttributeToFilter(
'type_id',
$this->_salesConfig->getAvailableProductTypes()
- )->addAttributeToSelect(
- 'gift_message_available'
);
$this->setCollection($collection);
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/DataProvider/ProductCollection.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/DataProvider/ProductCollection.php
new file mode 100644
index 0000000000000..733791a2f9549
--- /dev/null
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/DataProvider/ProductCollection.php
@@ -0,0 +1,55 @@
+collectionFactory = $collectionFactory;
+ }
+
+ /**
+ * Provide products collection filtered with store
+ *
+ * @param Store $store
+ * @return Collection
+ */
+ public function getCollectionForStore(Store $store):Collection
+ {
+ /** @var Collection $collection */
+ $collection = $this->collectionFactory->create();
+
+ $collection->setStore($store);
+ $collection->addAttributeToSelect(
+ 'gift_message_available'
+ );
+ $collection->addAttributeToSelect(
+ 'sku'
+ );
+ $collection->addStoreFilter();
+
+ return $collection;
+ }
+}
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 b0a88b8fa37dc..d1a90783c68c7 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
@@ -89,11 +89,8 @@ endif; ?>
= $block->getForm()->toHtml() ?>
- getDontSaveInAddressBook() && $block->getAddress()->getSaveInAddressBook()): ?> checked="checked"
- class="admin__control-checkbox"/>
+ getDontSaveInAddressBook()): ?> checked="checked" class="admin__control-checkbox"/>
= /* @escapeNotVerified */ __('Save in address book') ?>
diff --git a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchResultsSection.xml b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchResultsSection.xml
index 81b025c9554e2..ff9fce57c4524 100644
--- a/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchResultsSection.xml
+++ b/app/code/Magento/Search/Test/Mftf/Section/StorefrontQuickSearchResultsSection.xml
@@ -12,6 +12,7 @@
+
diff --git a/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php b/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
index 9304d25cc8a98..d16b1eaad7f37 100644
--- a/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
+++ b/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php
@@ -115,7 +115,7 @@ public function __toString()
$this->compiler->compile($templateRootElement, $this->component, $this->component);
$this->appendLayoutConfiguration();
$result = $this->compiler->postprocessing($this->template->__toString());
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$this->logger->critical($e->getMessage());
$result = $e->getMessage();
}
diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml
index 9148c22976c19..fbb543a6cab92 100644
--- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml
+++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminDataGridPaginationActionGroup.xml
@@ -23,8 +23,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridPaginationSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridPaginationSection.xml
index 0f54f51549e7a..133836761174d 100644
--- a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridPaginationSection.xml
+++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridPaginationSection.xml
@@ -11,11 +11,15 @@
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js b/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js
index abd79e797e413..8e6f1496495c7 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js
@@ -19,7 +19,9 @@ define([
defaults: {
template: 'ui/grid/paging/paging',
totalTmpl: 'ui/grid/paging-total',
+ totalRecords: 0,
pageSize: 20,
+ pages: 1,
current: 1,
selectProvider: 'ns = ${ $.ns }, index = ids',
@@ -35,7 +37,8 @@ define([
imports: {
pageSize: '${ $.sizesConfig.name }:value',
totalSelected: '${ $.selectProvider }:totalSelected',
- totalRecords: '${ $.provider }:data.totalRecords'
+ totalRecords: '${ $.provider }:data.totalRecords',
+ filters: '${ $.provider }:params.filters'
},
exports: {
@@ -43,6 +46,11 @@ define([
current: '${ $.provider }:params.paging.current'
},
+ statefull: {
+ pageSize: true,
+ current: true
+ },
+
listens: {
'pages': 'onPagesChange',
'pageSize': 'onPageSizeChange',
@@ -173,7 +181,9 @@ define([
* @returns {Paging} Chainable.
*/
goFirst: function () {
- this.current = 1;
+ if (!_.isUndefined(this.filters)) {
+ this.current = 1;
+ }
return this;
},
@@ -219,13 +229,11 @@ define([
/**
* Calculates new page cursor based on the
* previous and current page size values.
- *
- * @returns {Number} Updated cursor value.
*/
updateCursor: function () {
var cursor = this.current - 1,
size = this.pageSize,
- oldSize = this.previousSize,
+ oldSize = _.isUndefined(this.previousSize) ? this.pageSize : this.previousSize,
delta = cursor * (oldSize - size) / size;
delta = size > oldSize ?
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/MetaData/url_rewrite-meta.xml b/app/code/Magento/UrlRewrite/Test/Mftf/MetaData/url_rewrite-meta.xml
deleted file mode 100644
index 0738b17d6e0f0..0000000000000
--- a/app/code/Magento/UrlRewrite/Test/Mftf/MetaData/url_rewrite-meta.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
- integer
- integer
- string
- string
- string
-
-
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml
index 7453b7b5a43f3..7e1b9acbc47ab 100644
--- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
index cc2af4996d562..32bae10c801c8 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
@@ -91,7 +91,7 @@ public function getMainFieldset()
if ($this->_getData('main_fieldset') instanceof \Magento\Framework\Data\Form\Element\Fieldset) {
return $this->_getData('main_fieldset');
}
- $mainFieldsetHtmlId = 'options_fieldset' . md5($this->getWidgetType());
+ $mainFieldsetHtmlId = 'options_fieldset' . hash('sha256', $this->getWidgetType());
$this->setMainFieldsetHtmlId($mainFieldsetHtmlId);
$fieldset = $this->getForm()->addFieldset(
$mainFieldsetHtmlId,
@@ -141,7 +141,6 @@ protected function _addField($parameter)
{
$form = $this->getForm();
$fieldset = $this->getMainFieldset();
- //$form->getElement('options_fieldset');
// prepare element data with values (either from request of from default values)
$fieldName = $parameter->getKey();
@@ -166,9 +165,13 @@ protected function _addField($parameter)
if (is_array($data['value'])) {
foreach ($data['value'] as &$value) {
- $value = html_entity_decode($value);
+ if (is_string($value)) {
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ $value = html_entity_decode($value);
+ }
}
} else {
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
$data['value'] = html_entity_decode($data['value']);
}
diff --git a/app/code/Magento/Widget/Model/Widget.php b/app/code/Magento/Widget/Model/Widget.php
index 52dc8e7837a3c..d07e84186b2c9 100644
--- a/app/code/Magento/Widget/Model/Widget.php
+++ b/app/code/Magento/Widget/Model/Widget.php
@@ -248,17 +248,13 @@ public function getWidgets($filters = [])
$result = $widgets;
// filter widgets by params
- if (is_array($filters) && count($filters) > 0) {
+ if (is_array($filters) && !empty($filters)) {
foreach ($widgets as $code => $widget) {
- try {
- foreach ($filters as $field => $value) {
- if (!isset($widget[$field]) || (string)$widget[$field] != $value) {
- throw new \Exception();
- }
+ foreach ($filters as $field => $value) {
+ if (!isset($widget[$field]) || (string)$widget[$field] != $value) {
+ unset($result[$code]);
+ break;
}
- } catch (\Exception $e) {
- unset($result[$code]);
- continue;
}
}
}
@@ -323,8 +319,6 @@ public function getWidgetDeclaration($type, $params = [], $asIs = true)
$directive .= $this->getWidgetPageVarName($params);
- $directive .= sprintf(' type_name="%s"', $widget['name']);
-
$directive .= '}}';
if ($asIs) {
diff --git a/app/code/Magento/Widget/Model/Widget/Config.php b/app/code/Magento/Widget/Model/Widget/Config.php
index 4f81ef33f47f7..00b055b35a69d 100644
--- a/app/code/Magento/Widget/Model/Widget/Config.php
+++ b/app/code/Magento/Widget/Model/Widget/Config.php
@@ -120,6 +120,7 @@ public function getWidgetPlaceholderImageUrls()
/**
* Return url to error image
+ *
* @return string
*/
public function getErrorImageUrl()
@@ -129,6 +130,7 @@ public function getErrorImageUrl()
/**
* Return url to wysiwyg plugin
+ *
* @return string
*/
public function getWysiwygJsPluginSrc()
@@ -157,7 +159,7 @@ public function getWidgetWindowUrl($config)
}
}
- if (count($skipped) > 0) {
+ if (!empty($skipped)) {
$params['skip_widgets'] = $this->encodeWidgetsToQuery($skipped);
}
return $this->_backendUrl->getUrl('adminhtml/widget/index', $params);
@@ -189,6 +191,8 @@ public function decodeWidgetsFromQuery($queryParam)
}
/**
+ * Get available widgets.
+ *
* @param \Magento\Framework\DataObject $config Editor element config
* @return array
*/
@@ -202,7 +206,7 @@ public function getAvailableWidgets($config)
if (is_array($skipped) && in_array($widget['type'], $skipped)) {
continue;
}
- $result[] = $widget['name']->getText();
+ $result[$widget['type']] = $widget['name']->getText();
}
}
diff --git a/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php b/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php
index 5c546d7e2435c..850a3fbe83211 100644
--- a/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php
+++ b/app/code/Magento/Widget/Test/Unit/Model/WidgetTest.php
@@ -224,7 +224,6 @@ public function testGetWidgetDeclaration()
$this->assertContains('title="my "widget""', $result);
$this->assertContains('conditions_encoded="encoded-conditions-string"', $result);
$this->assertContains('page_var_name="pasdf"', $result);
- $this->assertContains('type_name=""}}', $result);
}
/**
@@ -275,7 +274,6 @@ public function testGetWidgetDeclarationWithZeroValueParam()
);
$this->assertContains('{{widget type="Magento\CatalogWidget\Block\Product\ProductsList"', $result);
$this->assertContains('page_var_name="pasdf"', $result);
- $this->assertContains('type_name=""}}', $result);
$this->assertContains('products_count=""', $result);
}
}
diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less
index e5915969c91b9..77fb53a2ab02a 100644
--- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less
+++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less
@@ -34,12 +34,12 @@
.product {
&-items {
- font-size: 0;
+ .lib-inline-block-space-container();
&:extend(.abs-reset-list all);
}
&-item {
- font-size: 1.4rem;
+ .lib-inline-block-space-item();
vertical-align: top;
.products-grid & {
diff --git a/app/etc/di.xml b/app/etc/di.xml
index d0b45ea16c855..47e7e419e3b50 100755
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -210,6 +210,7 @@
+
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php
index add0510c6b40c..e18a8c8e97c79 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php
@@ -51,7 +51,7 @@ public function __construct(
* @return array|string|int|float|bool
* @throws \Exception
*/
- public function postQuery(string $query, array $variables = [], string $operationName = '', array $headers = [])
+ public function post(string $query, array $variables = [], string $operationName = '', array $headers = [])
{
$url = $this->getEndpointUrl();
$headers = array_merge($headers, ['Accept: application/json', 'Content-Type: application/json']);
@@ -63,19 +63,57 @@ public function postQuery(string $query, array $variables = [], string $operatio
$postData = $this->json->jsonEncode($requestArray);
$responseBody = $this->curlClient->post($url, $postData, $headers);
- $responseBodyArray = $this->json->jsonDecode($responseBody);
+ return $this->processResponse($responseBody);
+ }
+
+ /**
+ * Perform HTTP GET request for query
+ *
+ * @param string $query
+ * @param array $variables
+ * @param string $operationName
+ * @param array $headers
+ * @return mixed
+ * @throws \Exception
+ */
+ public function get(string $query, array $variables = [], string $operationName = '', array $headers = [])
+ {
+ $url = $this->getEndpointUrl();
+ $requestArray = [
+ 'query' => $query,
+ 'variables' => $variables ? $this->json->jsonEncode($variables) : null,
+ 'operationName' => $operationName ?? null
+ ];
+ array_filter($requestArray);
+
+ $responseBody = $this->curlClient->get($url, $requestArray, $headers);
+ return $this->processResponse($responseBody);
+ }
+
+ /**
+ * Process response from GraphQl server
+ *
+ * @param string $response
+ * @return mixed
+ * @throws \Exception
+ */
+ private function processResponse(string $response)
+ {
+ $responseArray = $this->json->jsonDecode($response);
- if (!is_array($responseBodyArray)) {
- throw new \Exception('Unknown GraphQL response body: ' . json_encode($responseBodyArray));
+ if (!is_array($responseArray)) {
+ //phpcs:ignore Magento2.Exceptions.DirectThrow
+ throw new \Exception('Unknown GraphQL response body: ' . $response);
}
- $this->processErrors($responseBodyArray);
+ $this->processErrors($responseArray);
- if (!isset($responseBodyArray['data'])) {
- throw new \Exception('Unknown GraphQL response body: ' . json_encode($responseBodyArray));
- } else {
- return $responseBodyArray['data'];
+ if (!isset($responseArray['data'])) {
+ //phpcs:ignore Magento2.Exceptions.DirectThrow
+ throw new \Exception('Unknown GraphQL response body: ' . $response);
}
+
+ return $responseArray['data'];
}
/**
@@ -107,6 +145,7 @@ private function processErrors($responseBodyArray)
$responseBodyArray
);
}
+ //phpcs:ignore Magento2.Exceptions.DirectThrow
throw new \Exception('GraphQL responded with an unknown error: ' . json_encode($responseBodyArray));
}
}
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQlAbstract.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQlAbstract.php
index 790581c476da1..8abd97b4b744d 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQlAbstract.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQlAbstract.php
@@ -6,6 +6,7 @@
namespace Magento\TestFramework\TestCase;
use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Framework\App\Request\Http;
/**
* Test case for Web API functional tests for Graphql.
@@ -27,7 +28,7 @@ abstract class GraphQlAbstract extends WebapiAbstract
private $appCache;
/**
- * Perform GraphQL call to the system under test.
+ * Perform GraphQL query call via GET to the system under test.
*
* @see \Magento\TestFramework\TestCase\GraphQl\Client::call()
* @param string $query
@@ -43,7 +44,32 @@ public function graphQlQuery(
string $operationName = '',
array $headers = []
) {
- return $this->getGraphQlClient()->postQuery(
+ return $this->getGraphQlClient()->get(
+ $query,
+ $variables,
+ $operationName,
+ $this->composeHeaders($headers)
+ );
+ }
+
+ /**
+ * Perform GraphQL mutations call via POST to the system under test.
+ *
+ * @see \Magento\TestFramework\TestCase\GraphQl\Client::call()
+ * @param string $query
+ * @param array $variables
+ * @param string $operationName
+ * @param array $headers
+ * @return array|int|string|float|bool GraphQL call results
+ * @throws \Exception
+ */
+ public function graphQlMutation(
+ string $query,
+ array $variables = [],
+ string $operationName = '',
+ array $headers = []
+ ) {
+ return $this->getGraphQlClient()->post(
$query,
$variables,
$operationName,
diff --git a/dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php b/dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php
index 6fd7551676660..4bf1335f20667 100644
--- a/dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php
@@ -95,6 +95,6 @@ public function testGetAll()
*/
private function isTestBaseUrlSecure()
{
- return strpos('https://', TESTS_BASE_URL) !== false;
+ return strpos(TESTS_BASE_URL, 'https://') !== false;
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
index 17c2af8dc59d0..6616b40257f7d 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
@@ -13,6 +13,9 @@
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
+/**
+ * Test for adding products to cart
+ */
class AddProductToCartTest extends GraphQlAbstract
{
/**
@@ -54,7 +57,7 @@ public function testAddProductIfQuantityIsNotAvailable()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
self::fail('Should be "The requested qty is not available" error message.');
}
@@ -74,7 +77,7 @@ public function testAddMoreProductsThatAllowed()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
self::fail('Should be "The most you may purchase is 5." error message.');
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
index 84c111bd25fd4..ab6a1d4b464dd 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
@@ -14,6 +14,9 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
+/**
+ * Test change customer password
+ */
class ChangeCustomerPasswordTest extends GraphQlAbstract
{
/**
@@ -50,7 +53,7 @@ public function testChangePassword()
$query = $this->getChangePassQuery($oldCustomerPassword, $newCustomerPassword);
$headerMap = $this->getCustomerAuthHeaders($customerEmail, $oldCustomerPassword);
- $response = $this->graphQlQuery($query, [], '', $headerMap);
+ $response = $this->graphQlMutation($query, [], '', $headerMap);
$this->assertEquals($customerEmail, $response['changeCustomerPassword']['email']);
try {
@@ -69,7 +72,7 @@ public function testChangePassword()
public function testChangePasswordIfUserIsNotAuthorizedTest()
{
$query = $this->getChangePassQuery('currentpassword', 'newpassword');
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -87,7 +90,7 @@ public function testChangeWeakPassword()
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/Minimum of different classes of characters in password is.*/');
- $this->graphQlQuery($query, [], '', $headerMap);
+ $this->graphQlMutation($query, [], '', $headerMap);
}
/**
@@ -105,7 +108,7 @@ public function testChangePasswordIfPasswordIsInvalid()
$query = $this->getChangePassQuery($incorrectPassword, $newCustomerPassword);
$headerMap = $this->getCustomerAuthHeaders($customerEmail, $oldCustomerPassword);
- $this->graphQlQuery($query, [], '', $headerMap);
+ $this->graphQlMutation($query, [], '', $headerMap);
}
private function getChangePassQuery($currentPassword, $newPassword)
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php
index 602d969924fbd..891c74ca3c1e2 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php
@@ -13,6 +13,9 @@
use Magento\TestFramework\TestCase\GraphQlAbstract;
use Magento\Integration\Api\CustomerTokenServiceInterface;
+/**
+ * Create customer address tests
+ */
class CreateCustomerAddressTest extends GraphQlAbstract
{
/**
@@ -117,7 +120,7 @@ public function testCreateCustomerAddress()
$userName = 'customer@example.com';
$password = 'password';
- $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $response = $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
$this->assertArrayHasKey('createCustomerAddress', $response);
$this->assertArrayHasKey('customer_id', $response['createCustomerAddress']);
$this->assertEquals($customerId, $response['createCustomerAddress']['customer_id']);
@@ -158,7 +161,7 @@ public function testCreateCustomerAddressIfUserIsNotAuthorized()
}
}
MUTATION;
- $this->graphQlQuery($mutation);
+ $this->graphQlMutation($mutation);
}
/**
@@ -195,7 +198,73 @@ public function testCreateCustomerAddressWithMissingAttribute()
$userName = 'customer@example.com';
$password = 'password';
- $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer_without_addresses.php
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function testCreateCustomerAddressWithRedundantStreetLine()
+ {
+ $newAddress = [
+ 'region' => [
+ 'region' => 'Arizona',
+ 'region_id' => 4,
+ 'region_code' => 'AZ'
+ ],
+ 'country_id' => 'US',
+ 'street' => ['Line 1 Street', 'Line 2', 'Line 3'],
+ 'company' => 'Company name',
+ 'telephone' => '123456789',
+ 'fax' => '123123123',
+ 'postcode' => '7777',
+ 'city' => 'City Name',
+ 'firstname' => 'Adam',
+ 'lastname' => 'Phillis',
+ 'middlename' => 'A',
+ 'prefix' => 'Mr.',
+ 'suffix' => 'Jr.',
+ 'vat_id' => '1',
+ 'default_shipping' => true,
+ 'default_billing' => false
+ ];
+
+ $mutation
+ = <<graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php
index 388028c4ca750..fc51f57a83a76 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php
@@ -66,7 +66,7 @@ public function testCreateCustomerAccountWithPassword()
}
}
QUERY;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$this->assertEquals($newFirstname, $response['createCustomer']['customer']['firstname']);
$this->assertEquals($newLastname, $response['createCustomer']['customer']['lastname']);
@@ -103,7 +103,7 @@ public function testCreateCustomerAccountWithoutPassword()
}
}
QUERY;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$this->assertEquals($newFirstname, $response['createCustomer']['customer']['firstname']);
$this->assertEquals($newLastname, $response['createCustomer']['customer']['lastname']);
@@ -134,7 +134,7 @@ public function testCreateCustomerIfInputDataIsEmpty()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -167,7 +167,7 @@ public function testCreateCustomerIfEmailMissed()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -202,7 +202,7 @@ public function testCreateCustomerIfEmailIsNotValid()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -238,7 +238,7 @@ public function testCreateCustomerIfPassedAttributeDosNotExistsInCustomerInput()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
public function tearDown()
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php
index 1153b9662b41a..bdfd428a78c20 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php
@@ -13,6 +13,9 @@
use Magento\TestFramework\TestCase\GraphQlAbstract;
use Magento\Integration\Api\CustomerTokenServiceInterface;
+/**
+ * Delete customer address tests
+ */
class DeleteCustomerAddressTest extends GraphQlAbstract
{
/**
@@ -55,7 +58,7 @@ public function testDeleteCustomerAddress()
deleteCustomerAddress(id: {$addressId})
}
MUTATION;
- $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $response = $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
$this->assertArrayHasKey('deleteCustomerAddress', $response);
$this->assertEquals(true, $response['deleteCustomerAddress']);
}
@@ -73,7 +76,7 @@ public function testDeleteCustomerAddressIfUserIsNotAuthorized()
deleteCustomerAddress(id: {$addressId})
}
MUTATION;
- $this->graphQlQuery($mutation);
+ $this->graphQlMutation($mutation);
}
/**
@@ -99,7 +102,7 @@ public function testDeleteDefaultShippingCustomerAddress()
deleteCustomerAddress(id: {$addressId})
}
MUTATION;
- $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
}
/**
@@ -125,7 +128,7 @@ public function testDeleteDefaultBillingCustomerAddress()
deleteCustomerAddress(id: {$addressId})
}
MUTATION;
- $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
}
/**
@@ -144,7 +147,7 @@ public function testDeleteNonExistCustomerAddress()
deleteCustomerAddress(id: 9999)
}
MUTATION;
- $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
}
/**
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 ae28e23a28bf1..88eaeaa8f9dd5 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php
@@ -38,7 +38,7 @@ public function testGenerateCustomerValidToken()
}
MUTATION;
- $response = $this->graphQlQuery($mutation);
+ $response = $this->graphQlMutation($mutation);
$this->assertArrayHasKey('generateCustomerToken', $response);
$this->assertInternalType('array', $response['generateCustomerToken']);
}
@@ -66,6 +66,6 @@ public function testGenerateCustomerTokenWithInvalidCredentials()
$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->graphQlQuery($mutation);
+ $this->graphQlMutation($mutation);
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RevokeCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RevokeCustomerTokenTest.php
index 9bdbf3059eeaf..fc0c02bae5508 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RevokeCustomerTokenTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RevokeCustomerTokenTest.php
@@ -36,7 +36,7 @@ public function testRevokeCustomerTokenValidCredentials()
$customerToken = $customerTokenService->createCustomerAccessToken($userName, $password);
$headerMap = ['Authorization' => 'Bearer ' . $customerToken];
- $response = $this->graphQlQuery($query, [], '', $headerMap);
+ $response = $this->graphQlMutation($query, [], '', $headerMap);
$this->assertTrue($response['revokeCustomerToken']['result']);
}
@@ -53,6 +53,6 @@ public function testRevokeCustomerTokenForGuestCustomer()
}
}
QUERY;
- $this->graphQlQuery($query, [], '');
+ $this->graphQlMutation($query, [], '');
}
}
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 191ea1ae6b877..2b54c97cd1e97 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/SubscriptionStatusTest.php
@@ -12,6 +12,9 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
+/**
+ * Tests for subscription status
+ */
class SubscriptionStatusTest extends GraphQlAbstract
{
/**
@@ -88,7 +91,12 @@ public function testChangeSubscriptionStatusTest()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $response = $this->graphQlMutation(
+ $query,
+ [],
+ '',
+ $this->getCustomerAuthHeaders($currentEmail, $currentPassword)
+ );
$this->assertTrue($response['updateCustomer']['customer']['is_subscribed']);
}
@@ -111,7 +119,7 @@ public function testChangeSubscriptionStatuIfUserIsNotAuthorizedTest()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php
index 6a9708b4f86a2..e7a7eda2897b2 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php
@@ -14,6 +14,9 @@
use Magento\TestFramework\TestCase\GraphQlAbstract;
use Magento\Integration\Api\CustomerTokenServiceInterface;
+/**
+ * Update customer address tests
+ */
class UpdateCustomerAddressTest extends GraphQlAbstract
{
/**
@@ -128,7 +131,7 @@ public function testUpdateCustomerAddress()
}
MUTATION;
- $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $response = $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
$this->assertArrayHasKey('updateCustomerAddress', $response);
$this->assertArrayHasKey('customer_id', $response['updateCustomerAddress']);
$this->assertEquals($customerId, $response['updateCustomerAddress']['customer_id']);
@@ -158,7 +161,7 @@ public function testUpdateCustomerAddressIfUserIsNotAuthorized()
}
}
MUTATION;
- $this->graphQlQuery($mutation);
+ $this->graphQlMutation($mutation);
}
/**
@@ -187,7 +190,7 @@ public function testUpdateCustomerAddressWithMissingAttribute()
}
}
MUTATION;
- $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
+ $this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
index df45e1de771d9..08933f47191b9 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
@@ -13,6 +13,9 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
+/**
+ * Tests for update customer
+ */
class UpdateCustomerTest extends GraphQlAbstract
{
/**
@@ -87,7 +90,12 @@ public function testUpdateCustomer()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $response = $this->graphQlMutation(
+ $query,
+ [],
+ '',
+ $this->getCustomerAuthHeaders($currentEmail, $currentPassword)
+ );
$this->assertEquals($newPrefix, $response['updateCustomer']['customer']['prefix']);
$this->assertEquals($newFirstname, $response['updateCustomer']['customer']['firstname']);
@@ -123,7 +131,7 @@ public function testUpdateCustomerIfInputDataIsEmpty()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
@@ -147,7 +155,7 @@ public function testUpdateCustomerIfUserIsNotAuthorized()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -176,7 +184,7 @@ public function testUpdateCustomerIfAccountIsLocked()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
@@ -203,7 +211,7 @@ public function testUpdateEmailIfPasswordIsMissed()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
@@ -232,7 +240,7 @@ public function testUpdateEmailIfPasswordIsInvalid()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
@@ -260,7 +268,7 @@ public function testUpdateEmailIfEmailAlreadyExists()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php
index 352947714360a..e784061d5562f 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php
@@ -393,7 +393,8 @@ public function testQueryComplexityIsLimited()
QUERY;
self::expectExceptionMessageRegExp('/Max query complexity should be 300 but got 302/');
- $this->graphQlQuery($query);
+ //Use POST request because request uri is too large for some servers
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddConfigurableProductToCartTest.php
index b3f16c8734203..f585469177bcd 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddConfigurableProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddConfigurableProductToCartTest.php
@@ -13,6 +13,9 @@
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
+/**
+ * Add configurable product to cart tests
+ */
class AddConfigurableProductToCartTest extends GraphQlAbstract
{
/**
@@ -54,7 +57,7 @@ public function testAddConfigurableProductToCart()
$query = $this->getAddConfigurableProductMutationQuery($maskedQuoteId, $variantSku, $qty);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$cartItems = $response['addConfigurableProductsToCart']['cart']['items'];
self::assertEquals($qty, $cartItems[0]['qty']);
self::assertEquals($variantSku, $cartItems[0]['product']['sku']);
@@ -74,7 +77,7 @@ public function testAddProductIfQuantityIsNotAvailable()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddConfigurableProductMutationQuery($maskedQuoteId, $variantSku, $qty);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -90,7 +93,7 @@ public function testAddOutOfStockProduct()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddConfigurableProductMutationQuery($maskedQuoteId, $variantSku, $qty);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php
index d9ab8db62a195..65ed38ae90f5b 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php
@@ -13,6 +13,9 @@
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
+/**
+ * Add simple product to cart tests
+ */
class AddSimpleProductToCartTest extends GraphQlAbstract
{
/**
@@ -52,7 +55,7 @@ public function testAddSimpleProductToCart()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']);
self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['qty']);
@@ -72,7 +75,7 @@ public function testAddSimpleProductToCartWithNegativeQty()
$maskedQuoteId = $this->getMaskedQuoteId();
$query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -158,6 +161,6 @@ public function testAddProductWithWrongCartHash()
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php
deleted file mode 100644
index 316fe157993b9..0000000000000
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php
+++ /dev/null
@@ -1,148 +0,0 @@
-quoteResource = $objectManager->create(QuoteResource::class);
- $this->quote = $objectManager->create(Quote::class);
- $this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class);
- }
-
- /**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
- * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
- */
- public function testApplyCouponToGuestCartWithItems()
- {
- $couponCode = '2?ds5!2d';
-
- $this->quoteResource->load(
- $this->quote,
- 'test_order_with_simple_product_without_address',
- 'reserved_order_id'
- );
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
- $query = $this->prepareAddCouponRequestQuery($maskedQuoteId, $couponCode);
- $response = $this->graphQlQuery($query);
-
- self::assertArrayHasKey('applyCouponToCart', $response);
- self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
- }
-
- /**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
- * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
- */
- public function testApplyCouponTwice()
- {
- $couponCode = '2?ds5!2d';
-
- $this->quoteResource->load(
- $this->quote,
- 'test_order_with_simple_product_without_address',
- 'reserved_order_id'
- );
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
- $query = $this->prepareAddCouponRequestQuery($maskedQuoteId, $couponCode);
- $response = $this->graphQlQuery($query);
-
- self::assertArrayHasKey("applyCouponToCart", $response);
- self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
-
- self::expectExceptionMessage('A coupon is already applied to the cart. Please remove it to apply another');
- $this->graphQlQuery($query);
- }
-
- /**
- * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
- * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
- * @expectedException \Exception
- * @expectedExceptionMessage Cart does not contain products.
- */
- public function testApplyCouponToCartWithNoItems()
- {
- $couponCode = '2?ds5!2d';
-
- $this->quoteResource->load($this->quote, 'test_order_1', 'reserved_order_id');
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
- $query = $this->prepareAddCouponRequestQuery($maskedQuoteId, $couponCode);
-
- $this->graphQlQuery($query);
- }
-
- /**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
- * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
- * @magentoApiDataFixture Magento/Customer/_files/customer.php
- */
- public function testGuestCustomerAttemptToChangeCustomerCart()
- {
- $couponCode = '2?ds5!2d';
-
- $this->quoteResource->load(
- $this->quote,
- 'test_order_with_simple_product_without_address',
- 'reserved_order_id'
- );
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
- $this->quote->setCustomerId(1);
- $this->quoteResource->save($this->quote);
- $query = $this->prepareAddCouponRequestQuery($maskedQuoteId, $couponCode);
-
- self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
- $this->graphQlQuery($query);
- }
-
- /**
- * @param string $maskedQuoteId
- * @param string $couponCode
- * @return string
- */
- private function prepareAddCouponRequestQuery(string $maskedQuoteId, string $couponCode): string
- {
- return <<customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ $this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @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 testApplyCouponToCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+
+ self::assertArrayHasKey('applyCouponToCart', $response);
+ self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @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
+ * @expectedException \Exception
+ * @expectedExceptionMessage A coupon is already applied to the cart. Please remove it to apply another
+ */
+ public function testApplyCouponTwice()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+
+ self::assertArrayHasKey("applyCouponToCart", $response);
+ self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
+
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage Cart does not contain products.
+ */
+ public function testApplyCouponToCartWithoutItems()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
+ * @expectedException \Exception
+ */
+ public function testApplyCouponToGuestCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @magentoApiDataFixture Magento/Customer/_files/two_customers.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
+ * @expectedException \Exception
+ */
+ public function testApplyCouponToAnotherCustomerCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer_two@example.com'));
+ }
+
+ /**
+ * @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
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyNonExistentCouponToCart()
+ {
+ $couponCode = 'non_existent_coupon_code';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $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/SalesRule/_files/coupon_code_with_wildcard.php
+ * @expectedException \Exception
+ */
+ public function testApplyCouponToNonExistentCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ self::expectExceptionMessage('Could not find a cart with ID "' . $maskedQuoteId . '"');
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @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/make_coupon_expired.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyExpiredCoupon()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/574');
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * Products in cart don't fit to the coupon
+ *
+ * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent_generalusers.php
+ * @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/restrict_coupon_usage_for_simple_product.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyCouponWhichIsNotApplicable()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @param string $input
+ * @param string $message
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @expectedException \Exception
+ */
+ public function testApplyCouponWithMissedRequiredParameters(string $input, string $message)
+ {
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_id' => [
+ 'coupon_code: "test"',
+ 'Required parameter "cart_id" is missing'
+ ],
+ 'missed_coupon_code' => [
+ 'cart_id: "test"',
+ 'Required parameter "coupon_code" is missing'
+ ],
+ ];
+ }
+
+ /**
+ * Retrieve customer authorization headers
+ *
+ * @param string $username
+ * @param string $password
+ * @return array
+ * @throws AuthenticationException
+ */
+ private function getHeaderMap(string $username = 'customer@example.com', string $password = 'password'): array
+ {
+ $customerToken = $this->customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $couponCode
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, string $couponCode): string
+ {
+ return <<guestCartRepository = $objectManager->get(GuestCartRepositoryInterface::class);
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ $this->quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->maskedQuoteIdToQuoteId = $objectManager->get(MaskedQuoteIdToQuoteIdInterface::class);
+ $this->quoteIdMaskFactory = $objectManager->get(QuoteIdMaskFactory::class);
}
/**
@@ -39,23 +72,83 @@ protected function setUp()
*/
public function testCreateEmptyCart()
{
- $query = <<getQuery();
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMapWithCustomerToken());
+
+ self::assertArrayHasKey('createEmptyCart', $response);
+ self::assertNotEmpty($response['createEmptyCart']);
+
+ $guestCart = $this->guestCartRepository->get($response['createEmptyCart']);
+ $this->maskedQuoteId = $response['createEmptyCart'];
+
+ self::assertNotNull($guestCart->getId());
+ self::assertEquals(1, $guestCart->getCustomer()->getId());
+ self::assertEquals('default', $guestCart->getStore()->getCode());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Store/_files/second_store.php
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testCreateEmptyCartWithNotDefaultStore()
+ {
+ $query = $this->getQuery();
+
+ $headerMap = $this->getHeaderMapWithCustomerToken();
+ $headerMap['Store'] = 'fixture_second_store';
+ $response = $this->graphQlMutation($query, [], '', $headerMap);
+
+ self::assertArrayHasKey('createEmptyCart', $response);
+ self::assertNotEmpty($response['createEmptyCart']);
+
+ /* guestCartRepository is used for registered customer to get the cart hash */
+ $guestCart = $this->guestCartRepository->get($response['createEmptyCart']);
+ $this->maskedQuoteId = $response['createEmptyCart'];
+
+ self::assertNotNull($guestCart->getId());
+ self::assertEquals(1, $guestCart->getCustomer()->getId());
+ self::assertEquals('fixture_second_store', $guestCart->getStore()->getCode());
+ }
+
+ /**
+ * @return string
+ */
+ private function getQuery(): string
+ {
+ return <<customerTokenService->createCustomerAccessToken('customer@example.com', 'password');
+ /**
+ * @param string $username
+ * @param string $password
+ * @return array
+ */
+ private function getHeaderMapWithCustomerToken(
+ string $username = 'customer@example.com',
+ string $password = 'password'
+ ): array {
+ $customerToken = $this->customerTokenService->createCustomerAccessToken($username, $password);
$headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
- $response = $this->graphQlQuery($query, [], '', $headerMap);
-
- self::assertArrayHasKey('createEmptyCart', $response);
+ public function tearDown()
+ {
+ if (null !== $this->maskedQuoteId) {
+ $quoteId = $this->maskedQuoteIdToQuoteId->execute($this->maskedQuoteId);
- $maskedCartId = $response['createEmptyCart'];
- $guestCart = $this->guestCartRepository->get($maskedCartId);
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, $quoteId);
+ $this->quoteResource->delete($quote);
- self::assertNotNull($guestCart->getId());
- self::assertEquals(1, $guestCart->getCustomer()->getId());
+ $quoteIdMask = $this->quoteIdMaskFactory->create();
+ $quoteIdMask->setQuoteId($quoteId)
+ ->delete();
+ }
+ parent::tearDown();
}
}
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 2cac1f8c4fbf0..19b72b9e3ca4c 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
@@ -124,6 +124,58 @@ public function testGetInactiveCart()
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote_customer_not_default_store.php
+ */
+ public function testGetCartWithNotDefaultStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $headerMap = $this->getHeaderMap();
+ $headerMap['Store'] = 'fixture_second_store';
+
+ $response = $this->graphQlQuery($query, [], '', $headerMap);
+
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('items', $response['cart']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
+ * @magentoApiDataFixture Magento/Store/_files/second_store.php
+ *
+ * @expectedException \Exception
+ * @expectedExceptionMessage Wrong store code specified for cart
+ */
+ public function testGetCartWithWrongStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $headerMap = $this->getHeaderMap();
+ $headerMap['Store'] = 'fixture_second_store';
+
+ $this->graphQlQuery($query, [], '', $headerMap);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote_customer_not_default_store.php
+ *
+ * @expectedException \Exception
+ * @expectedExceptionMessage Store code not_existing_store does not exist
+ */
+ public function testGetCartWithNotExistingStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $headerMap = $this->getHeaderMap();
+ $headerMap['Store'] = 'not_existing_store';
+
+ $this->graphQlQuery($query, [], '', $headerMap);
+ }
+
/**
* @param string $maskedQuoteId
* @return string
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 4220f8932caa1..b7d3b546ba194 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
@@ -77,7 +77,7 @@ public function testPlaceOrder()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
$query = $this->getQuery($maskedQuoteId);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('placeOrder', $response);
self::assertArrayHasKey('order_id', $response['placeOrder']['order']);
@@ -98,7 +98,7 @@ public function testPlaceOrderWithNoItemsInCart()
'Unable to place order: A server error stopped your order from being placed. ' .
'Please try to place your order again'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -116,7 +116,7 @@ public function testPlaceOrderWithNoShippingAddress()
self::expectExceptionMessage(
'Unable to place order: Some addresses can\'t be used due to the configurations for specific countries'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -135,7 +135,7 @@ public function testPlaceOrderWithNoShippingMethod()
self::expectExceptionMessage(
'Unable to place order: The shipping method is missing. Select the shipping method and try again'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -156,7 +156,7 @@ public function testPlaceOrderWithNoBillingAddress()
self::expectExceptionMessageRegExp(
'/Unable to place order: Please check the billing address information*/'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -176,7 +176,7 @@ public function testPlaceOrderWithNoPaymentMethod()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessage('Unable to place order: Enter a valid payment method and try again');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -197,7 +197,7 @@ public function testPlaceOrderWithOutOfStockProduct()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessage('Unable to place order: Some of the products are out of stock');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -220,7 +220,7 @@ public function testPlaceOrderOfGuestCart()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessageRegExp('/The current user cannot perform operations on cart*/');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -243,7 +243,7 @@ public function testPlaceOrderOfAnotherCustomerCart()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessageRegExp('/The current user cannot perform operations on cart*/');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer3@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer3@search.example.com'));
}
/**
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 feba8c5c64259..ce1c85417b165 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
@@ -50,7 +50,7 @@ public function testRemoveCouponFromCart()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('removeCouponFromCart', $response);
self::assertNull($response['removeCouponFromCart']['cart']['applied_coupon']['code']);
@@ -66,7 +66,7 @@ public function testRemoveCouponFromNonExistentCart()
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getQuery($maskedQuoteId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -80,7 +80,7 @@ public function testRemoveCouponFromEmptyCart()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -94,7 +94,7 @@ public function testRemoveCouponFromCartIfCouponWasNotSet()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('removeCouponFromCart', $response);
self::assertNull($response['removeCouponFromCart']['cart']['applied_coupon']['code']);
@@ -115,7 +115,7 @@ public function testRemoveCouponFromGuestCart()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -132,7 +132,7 @@ public function testRemoveCouponFromAnotherCustomerCart()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer3@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer3@search.example.com'));
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
index e80a2127ad420..39803f8d58447 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
@@ -7,11 +7,9 @@
namespace Magento\GraphQl\Quote\Customer;
-use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
+use Magento\GraphQl\Quote\GetQuoteItemIdByReservedQuoteIdAndSku;
use Magento\Integration\Api\CustomerTokenServiceInterface;
-use Magento\Quote\Model\QuoteFactory;
-use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
-use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
@@ -26,47 +24,38 @@ class RemoveItemFromCartTest extends GraphQlAbstract
private $customerTokenService;
/**
- * @var QuoteResource
+ * @var GetMaskedQuoteIdByReservedOrderId
*/
- private $quoteResource;
+ private $getMaskedQuoteIdByReservedOrderId;
/**
- * @var QuoteFactory
+ * @var GetQuoteItemIdByReservedQuoteIdAndSku
*/
- private $quoteFactory;
-
- /**
- * @var QuoteIdToMaskedQuoteIdInterface
- */
- private $quoteIdToMaskedId;
-
- /**
- * @var ProductRepositoryInterface
- */
- private $productRepository;
+ private $getQuoteItemIdByReservedQuoteIdAndSku;
protected function setUp()
{
$objectManager = Bootstrap::getObjectManager();
- $this->quoteResource = $objectManager->get(QuoteResource::class);
- $this->quoteFactory = $objectManager->get(QuoteFactory::class);
- $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
- $this->productRepository = $objectManager->get(ProductRepositoryInterface::class);
+ $this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->getQuoteItemIdByReservedQuoteIdAndSku = $objectManager->get(
+ GetQuoteItemIdByReservedQuoteIdAndSku::class
+ );
}
/**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ * @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 testRemoveItemFromCart()
{
- $quote = $this->quoteFactory->create();
- $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
- $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
- $query = $this->prepareMutationQuery($maskedQuoteId, $itemId);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $query = $this->getQuery($maskedQuoteId, $itemId);
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
$this->assertArrayHasKey('removeItemFromCart', $response);
$this->assertArrayHasKey('cart', $response['removeItemFromCart']);
@@ -80,106 +69,25 @@ public function testRemoveItemFromCart()
*/
public function testRemoveItemFromNonExistentCart()
{
- $query = $this->prepareMutationQuery('non_existent_masked_id', 1);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $query = $this->getQuery('non_existent_masked_id', 1);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ * @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 testRemoveNonExistentItem()
{
- $quote = $this->quoteFactory->create();
- $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$notExistentItemId = 999;
$this->expectExceptionMessage("Cart doesn't contain the {$notExistentItemId} item.");
- $query = $this->prepareMutationQuery($maskedQuoteId, $notExistentItemId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
- }
-
- /**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
- */
- public function testRemoveItemIfItemIsNotBelongToCart()
- {
- $firstQuote = $this->quoteFactory->create();
- $this->quoteResource->load($firstQuote, 'test_order_1', 'reserved_order_id');
- $firstQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$firstQuote->getId());
-
- $secondQuote = $this->quoteFactory->create();
- $this->quoteResource->load(
- $secondQuote,
- 'test_order_with_virtual_product_without_address',
- 'reserved_order_id'
- );
- $secondQuote->setCustomerId(1);
- $this->quoteResource->save($secondQuote);
- $secondQuoteItemId = (int)$secondQuote
- ->getItemByProduct($this->productRepository->get('virtual-product'))
- ->getId();
-
- $this->expectExceptionMessage("Cart doesn't contain the {$secondQuoteItemId} item.");
-
- $query = $this->prepareMutationQuery($firstQuoteMaskedId, $secondQuoteItemId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
- }
-
- /**
- * @magentoApiDataFixture Magento/Customer/_files/customer.php
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
- */
- public function testRemoveItemFromGuestCart()
- {
- $guestQuote = $this->quoteFactory->create();
- $this->quoteResource->load(
- $guestQuote,
- 'test_order_with_virtual_product_without_address',
- 'reserved_order_id'
- );
- $guestQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$guestQuote->getId());
- $guestQuoteItemId = (int)$guestQuote
- ->getItemByProduct($this->productRepository->get('virtual-product'))
- ->getId();
-
- $this->expectExceptionMessage(
- "The current user cannot perform operations on cart \"$guestQuoteMaskedId\""
- );
-
- $query = $this->prepareMutationQuery($guestQuoteMaskedId, $guestQuoteItemId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
- }
-
- /**
- * @magentoApiDataFixture Magento/Customer/_files/three_customers.php
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
- */
- public function testRemoveItemFromAnotherCustomerCart()
- {
- $anotherCustomerQuote = $this->quoteFactory->create();
- $this->quoteResource->load(
- $anotherCustomerQuote,
- 'test_order_with_virtual_product_without_address',
- 'reserved_order_id'
- );
- $anotherCustomerQuote->setCustomerId(2);
- $this->quoteResource->save($anotherCustomerQuote);
-
- $anotherCustomerQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$anotherCustomerQuote->getId());
- $anotherCustomerQuoteItemId = (int)$anotherCustomerQuote
- ->getItemByProduct($this->productRepository->get('virtual-product'))
- ->getId();
-
- $this->expectExceptionMessage(
- "The current user cannot perform operations on cart \"$anotherCustomerQuoteMaskedId\""
- );
-
- $query = $this->prepareMutationQuery($anotherCustomerQuoteMaskedId, $anotherCustomerQuoteItemId);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $query = $this->getQuery($maskedQuoteId, $notExistentItemId);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -206,7 +114,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -226,12 +134,77 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array
];
}
+ /**
+ * _security
+ * @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/Checkout/_files/quote_with_virtual_product_and_address.php
+ */
+ public function testRemoveItemIfItemIsNotBelongToCart()
+ {
+ $firstQuoteMaskedId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $secondQuoteItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute(
+ 'test_order_with_virtual_product',
+ 'virtual-product'
+ );
+
+ $this->expectExceptionMessage("Cart doesn't contain the {$secondQuoteItemId} item.");
+
+ $query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.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 testRemoveItemFromGuestCart()
+ {
+ $guestQuoteMaskedId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $guestQuoteItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$guestQuoteMaskedId\""
+ );
+
+ $query = $this->getQuery($guestQuoteMaskedId, $guestQuoteItemId);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/three_customers.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 testRemoveItemFromAnotherCustomerCart()
+ {
+ $anotherCustomerQuoteMaskedId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $anotherCustomerQuoteItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute(
+ 'test_quote',
+ 'simple_product'
+ );
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$anotherCustomerQuoteMaskedId\""
+ );
+
+ $query = $this->getQuery($anotherCustomerQuoteMaskedId, $anotherCustomerQuoteItemId);
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ }
+
/**
* @param string $maskedQuoteId
* @param int $itemId
* @return string
*/
- private function prepareMutationQuery(string $maskedQuoteId, int $itemId): string
+ private function getQuery(string $maskedQuoteId, int $itemId): string
{
return <<graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']);
$cartResponse = $response['setBillingAddressOnCart']['cart'];
@@ -179,7 +179,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']);
$cartResponse = $response['setBillingAddressOnCart']['cart'];
@@ -230,7 +230,7 @@ public function testSetBillingAddressFromAddressBook()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']);
$cartResponse = $response['setBillingAddressOnCart']['cart'];
@@ -270,7 +270,7 @@ public function testSetNotExistedBillingAddressFromAddressBook()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -318,7 +318,7 @@ public function testSetNewBillingAddressAndFromAddressBookAtSameTime()
self::expectExceptionMessage(
'The billing address cannot contain "customer_address_id" and "address" at the same time.'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -355,7 +355,7 @@ public function testSetBillingAddressToGuestCart()
"The current user cannot perform operations on cart \"{$maskedQuoteId}\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -390,7 +390,7 @@ public function testSetBillingAddressToAnotherCustomerCart()
"The current user cannot perform operations on cart \"{$maskedQuoteId}\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer@search.example.com'));
}
/**
@@ -424,7 +424,7 @@ public function testSetBillingAddressIfCustomerIsNotOwnerOfAddress()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
}
/**
@@ -454,7 +454,7 @@ public function testSetBillingAddressOnNonExistentCart()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -490,7 +490,50 @@ public function testSetBillingAddressWithoutRequiredParameters(string $input, st
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @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 testSetNewBillingAddressWithRedundantStreetLine()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = <<graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflineShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflineShippingMethodsOnCartTest.php
index b7b7823263106..20462220ff6f7 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflineShippingMethodsOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflineShippingMethodsOnCartTest.php
@@ -72,7 +72,7 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php
index 73feefe2b094b..0f6f371177f92 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetPaymentMethodOnCartTest.php
@@ -52,7 +52,7 @@ public function testSetPaymentOnCartWithSimpleProduct()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
@@ -75,7 +75,7 @@ public function testSetPaymentOnCartWithSimpleProductAndWithoutAddress()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -90,7 +90,7 @@ public function testSetPaymentOnCartWithVirtualProduct()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
@@ -114,7 +114,7 @@ public function testSetNonExistentPaymentMethod()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -129,7 +129,7 @@ public function testSetPaymentOnNonExistentCart()
$methodCode = Checkmo::PAYMENT_METHOD_CHECKMO_CODE;
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -149,7 +149,7 @@ public function testSetPaymentMethodToGuestCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -169,7 +169,7 @@ public function testSetPaymentMethodToAnotherCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
}
/**
@@ -201,7 +201,7 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -240,7 +240,7 @@ public function testReSetPayment()
$methodCode = Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE;
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
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 fe8c90d651879..6b097e028ffe5 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
@@ -107,7 +107,7 @@ public function testSetNewShippingAddressOnCartWithSimpleProduct()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']);
$cartResponse = $response['setShippingAddressesOnCart']['cart'];
@@ -160,7 +160,7 @@ public function testSetNewShippingAddressOnCartWithVirtualProduct()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -200,7 +200,7 @@ public function testSetShippingAddressFromAddressBook()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']);
$cartResponse = $response['setShippingAddressesOnCart']['cart'];
@@ -242,7 +242,7 @@ public function testSetNonExistentShippingAddressFromAddressBook()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -291,7 +291,7 @@ public function testSetNewShippingAddressAndFromAddressBookAtSameTime()
self::expectExceptionMessage(
'The shipping address cannot contain "customer_address_id" and "address" at the same time.'
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -328,7 +328,7 @@ public function testSetShippingAddressIfCustomerIsNotOwnerOfAddress()
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
}
/**
@@ -366,7 +366,7 @@ public function testSetShippingAddressToAnotherCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
}
/**
@@ -405,7 +405,7 @@ public function testSetNewShippingAddressWithMissedRequiredParameters(string $in
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -483,7 +483,53 @@ public function testSetMultipleNewShippingAddresses()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $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 testSetNewShippingAddressOnCartWithRedundantStreetLine()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = <<graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php
index 9219b5a67022c..ecad31a8bd123 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php
@@ -66,7 +66,7 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
@@ -105,7 +105,7 @@ public function testReSetShippingMethod()
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
@@ -156,7 +156,7 @@ public function testSetShippingMethodWithWrongParameters(string $input, string $
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -296,7 +296,7 @@ public function testSetMultipleShippingMethods()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -325,7 +325,7 @@ public function testSetShippingMethodToGuestCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -354,7 +354,7 @@ public function testSetShippingMethodToAnotherCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap('customer2@search.example.com'));
}
/**
@@ -382,7 +382,7 @@ public function testSetShippingMethodIfCustomerIsNotOwnerOfAddress()
$this->expectExceptionMessage(
"Cart does not contain address with ID \"{$anotherQuoteAddressId}\""
);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php
index 74e7aa8b5d0a4..35e2d62214fb2 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php
@@ -67,7 +67,7 @@ public function testUpdateCartItemQty()
$qty = 2;
$query = $this->getQuery($maskedQuoteId, $itemId, $qty);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
$this->assertArrayHasKey('updateCartItems', $response);
$this->assertArrayHasKey('cart', $response['updateCartItems']);
@@ -91,7 +91,7 @@ public function testRemoveCartItemIfQuantityIsZero()
$qty = 0;
$query = $this->getQuery($maskedQuoteId, $itemId, $qty);
- $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
$this->assertArrayHasKey('updateCartItems', $response);
$this->assertArrayHasKey('cart', $response['updateCartItems']);
@@ -108,7 +108,7 @@ public function testRemoveCartItemIfQuantityIsZero()
public function testUpdateItemInNonExistentCart()
{
$query = $this->getQuery('non_existent_masked_id', 1, 2);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -124,7 +124,7 @@ public function testUpdateNonExistentItem()
$this->expectExceptionMessage("Could not find cart item with id: {$notExistentItemId}.");
$query = $this->getQuery($maskedQuoteId, $notExistentItemId, 2);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -152,7 +152,7 @@ public function testUpdateItemIfItemIsNotBelongToCart()
$this->expectExceptionMessage("Could not find cart item with id: {$secondQuoteItemId}.");
$query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId, 2);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -177,7 +177,7 @@ public function testUpdateItemInGuestCart()
);
$query = $this->getQuery($guestQuoteMaskedId, $guestQuoteItemId, 2);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -206,7 +206,7 @@ public function testUpdateItemInAnotherCustomerCart()
);
$query = $this->getQuery($anotherCustomerQuoteMaskedId, $anotherCustomerQuoteItemId, 2);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -235,7 +235,7 @@ public function testUpdateWithMissedCartItemId()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
@@ -266,7 +266,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetQuoteItemIdByReservedQuoteIdAndSku.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetQuoteItemIdByReservedQuoteIdAndSku.php
new file mode 100644
index 0000000000000..6f027babc0e27
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetQuoteItemIdByReservedQuoteIdAndSku.php
@@ -0,0 +1,66 @@
+quoteFactory = $quoteFactory;
+ $this->quoteResource = $quoteResource;
+ $this->productRepository = $productRepository;
+ }
+
+ /**
+ * Get quote item id by reserved order id and product sku
+ *
+ * @param string $reservedOrderId
+ * @param string $sku
+ * @return int
+ * @throws NoSuchEntityException
+ */
+ public function execute(string $reservedOrderId, string $sku): int
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, $reservedOrderId, 'reserved_order_id');
+ $product = $this->productRepository->get($sku);
+
+ return (int)$quote->getItemByProduct($product)->getId();
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php
new file mode 100644
index 0000000000000..affe36ea8617d
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/ApplyCouponToCartTest.php
@@ -0,0 +1,232 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ }
+
+ /**
+ * @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/SalesRule/_files/coupon_code_with_wildcard.php
+ */
+ public function testApplyCouponToCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+ $response = $this->graphQlMutation($query);
+
+ self::assertArrayHasKey('applyCouponToCart', $response);
+ self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
+ }
+
+ /**
+ * @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/SalesRule/_files/coupon_code_with_wildcard.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage A coupon is already applied to the cart. Please remove it to apply another
+ */
+ public function testApplyCouponTwice()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+ $response = $this->graphQlMutation($query);
+
+ self::assertArrayHasKey("applyCouponToCart", $response);
+ self::assertEquals($couponCode, $response['applyCouponToCart']['cart']['applied_coupon']['code']);
+
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage Cart does not contain products.
+ */
+ public function testApplyCouponToCartWithoutItems()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @expectedException \Exception
+ */
+ public function testApplyCouponToCustomerCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
+ $this->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
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyNonExistentCouponToCart()
+ {
+ $couponCode = 'non_existent_coupon_code';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
+ * @expectedException \Exception
+ */
+ public function testApplyCouponToNonExistentCart()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ self::expectExceptionMessage('Could not find a cart with ID "' . $maskedQuoteId . '"');
+ $this->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/SalesRule/_files/coupon_code_with_wildcard.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/make_coupon_expired.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyExpiredCoupon()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/574');
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * Products in cart don't fit to the coupon
+ *
+ * @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/SalesRule/_files/coupon_code_with_wildcard.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again.
+ */
+ public function testApplyCouponWhichIsNotApplicable()
+ {
+ $couponCode = '2?ds5!2d';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId, $couponCode);
+
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @param string $input
+ * @param string $message
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ * @expectedException \Exception
+ */
+ public function testApplyCouponWithMissedRequiredParameters(string $input, string $message)
+ {
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_id' => [
+ 'coupon_code: "test"',
+ 'Required parameter "cart_id" is missing'
+ ],
+ 'missed_coupon_code' => [
+ 'cart_id: "test"',
+ 'Required parameter "coupon_code" is missing'
+ ],
+ ];
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $couponCode
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, string $couponCode): string
+ {
+ return <<guestCartRepository = $objectManager->get(GuestCartRepositoryInterface::class);
+ $this->quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->maskedQuoteIdToQuoteId = $objectManager->get(MaskedQuoteIdToQuoteIdInterface::class);
+ $this->quoteIdMaskFactory = $objectManager->get(QuoteIdMaskFactory::class);
}
public function testCreateEmptyCart()
{
- $query = <<getQuery();
+ $response = $this->graphQlMutation($query);
+
+ self::assertArrayHasKey('createEmptyCart', $response);
+ self::assertNotEmpty($response['createEmptyCart']);
+
+ $guestCart = $this->guestCartRepository->get($response['createEmptyCart']);
+ $this->maskedQuoteId = $response['createEmptyCart'];
+
+ self::assertNotNull($guestCart->getId());
+ self::assertNull($guestCart->getCustomer()->getId());
+ self::assertEquals('default', $guestCart->getStore()->getCode());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Store/_files/second_store.php
+ */
+ public function testCreateEmptyCartWithNotDefaultStore()
+ {
+ $query = $this->getQuery();
+ $headerMap = ['Store' => 'fixture_second_store'];
+ $response = $this->graphQlMutation($query, [], '', $headerMap);
+
+ self::assertArrayHasKey('createEmptyCart', $response);
+ self::assertNotEmpty($response['createEmptyCart']);
+
+ $guestCart = $this->guestCartRepository->get($response['createEmptyCart']);
+ $this->maskedQuoteId = $response['createEmptyCart'];
+
+ self::assertNotNull($guestCart->getId());
+ self::assertNull($guestCart->getCustomer()->getId());
+ self::assertSame('fixture_second_store', $guestCart->getStore()->getCode());
+ }
+
+ /**
+ * @return string
+ */
+ private function getQuery(): string
+ {
+ return <<graphQlQuery($query);
+ }
- self::assertArrayHasKey('createEmptyCart', $response);
+ public function tearDown()
+ {
+ if (null !== $this->maskedQuoteId) {
+ $quoteId = $this->maskedQuoteIdToQuoteId->execute($this->maskedQuoteId);
- $maskedCartId = $response['createEmptyCart'];
- $guestCart = $this->guestCartRepository->get($maskedCartId);
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, $quoteId);
+ $this->quoteResource->delete($quote);
- self::assertNotNull($guestCart->getId());
- self::assertNull($guestCart->getCustomer()->getId());
+ $quoteIdMask = $this->quoteIdMaskFactory->create();
+ $quoteIdMask->setQuoteId($quoteId)
+ ->delete();
+ }
+ parent::tearDown();
}
}
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 654b0b963af15..832e15058a4ee 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
@@ -97,6 +97,54 @@ public function testGetInactiveCart()
$this->graphQlQuery($query);
}
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote_guest_not_default_store.php
+ */
+ public function testGetCartWithNotDefaultStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store_guest');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $headerMap = ['Store' => 'fixture_second_store'];
+ $response = $this->graphQlQuery($query, [], '', $headerMap);
+
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('items', $response['cart']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
+ * @magentoApiDataFixture Magento/Store/_files/second_store.php
+ *
+ * @expectedException \Exception
+ * @expectedExceptionMessage Wrong store code specified for cart
+ */
+ public function testGetCartWithWrongStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $headerMap = ['Store' => 'fixture_second_store'];
+ $this->graphQlQuery($query, [], '', $headerMap);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote_guest_not_default_store.php
+ *
+ * @expectedException \Exception
+ * @expectedExceptionMessage Store code not_existing_store does not exist
+ */
+ public function testGetCartWithNotExistingStore()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1_not_default_store_guest');
+
+ $headerMap['Store'] = 'not_existing_store';
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->graphQlQuery($query, [], '', $headerMap);
+ }
+
/**
* @param string $maskedQuoteId
* @return string
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 edb5f9cbf267c..5adb6ce65db6f 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
@@ -42,7 +42,7 @@ public function testRemoveCouponFromCart()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('removeCouponFromCart', $response);
self::assertNull($response['removeCouponFromCart']['cart']['applied_coupon']['code']);
@@ -57,7 +57,7 @@ public function testRemoveCouponFromNonExistentCart()
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getQuery($maskedQuoteId);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -70,7 +70,7 @@ public function testRemoveCouponFromEmptyCart()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -83,7 +83,7 @@ public function testRemoveCouponFromCartIfCouponWasNotSet()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('removeCouponFromCart', $response);
self::assertNull($response['removeCouponFromCart']['cart']['applied_coupon']['code']);
@@ -104,7 +104,7 @@ public function testRemoveCouponFromCustomerCart()
$query = $this->getQuery($maskedQuoteId);
self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
index a306b29e51197..27f3f6367f662 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
@@ -7,10 +7,8 @@
namespace Magento\GraphQl\Quote\Guest;
-use Magento\Quote\Model\QuoteFactory;
-use Magento\Catalog\Api\ProductRepositoryInterface;
-use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface;
-use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
+use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
+use Magento\GraphQl\Quote\GetQuoteItemIdByReservedQuoteIdAndSku;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
@@ -20,46 +18,36 @@
class RemoveItemFromCartTest extends GraphQlAbstract
{
/**
- * @var QuoteResource
+ * @var GetMaskedQuoteIdByReservedOrderId
*/
- private $quoteResource;
+ private $getMaskedQuoteIdByReservedOrderId;
/**
- * @var QuoteFactory
+ * @var GetQuoteItemIdByReservedQuoteIdAndSku
*/
- private $quoteFactory;
-
- /**
- * @var QuoteIdToMaskedQuoteIdInterface
- */
- private $quoteIdToMaskedId;
-
- /**
- * @var ProductRepositoryInterface
- */
- private $productRepository;
+ private $getQuoteItemIdByReservedQuoteIdAndSku;
protected function setUp()
{
$objectManager = Bootstrap::getObjectManager();
- $this->quoteResource = $objectManager->get(QuoteResource::class);
- $this->quoteFactory = $objectManager->get(QuoteFactory::class);
- $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
- $this->productRepository = $objectManager->get(ProductRepositoryInterface::class);
+ $this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->getQuoteItemIdByReservedQuoteIdAndSku = $objectManager->get(
+ GetQuoteItemIdByReservedQuoteIdAndSku::class
+ );
}
/**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.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 testRemoveItemFromCart()
{
- $quote = $this->quoteFactory->create();
- $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
- $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
- $query = $this->prepareMutationQuery($maskedQuoteId, $itemId);
- $response = $this->graphQlQuery($query);
+ $query = $this->getQuery($maskedQuoteId, $itemId);
+ $response = $this->graphQlMutation($query);
$this->assertArrayHasKey('removeItemFromCart', $response);
$this->assertArrayHasKey('cart', $response['removeItemFromCart']);
@@ -72,70 +60,24 @@ public function testRemoveItemFromCart()
*/
public function testRemoveItemFromNonExistentCart()
{
- $query = $this->prepareMutationQuery('non_existent_masked_id', 1);
- $this->graphQlQuery($query);
+ $query = $this->getQuery('non_existent_masked_id', 1);
+ $this->graphQlMutation($query);
}
/**
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.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 testRemoveNonExistentItem()
{
- $quote = $this->quoteFactory->create();
- $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$notExistentItemId = 999;
$this->expectExceptionMessage("Cart doesn't contain the {$notExistentItemId} item.");
- $query = $this->prepareMutationQuery($maskedQuoteId, $notExistentItemId);
- $this->graphQlQuery($query);
- }
-
- /**
- * Test mutation is only able to remove quote item belonging to the requested cart
- *
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
- */
- public function testRemoveItemIfItemIsNotBelongToCart()
- {
- $firstQuote = $this->quoteFactory->create();
- $this->quoteResource->load($firstQuote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
- $firstQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$firstQuote->getId());
-
- $secondQuote = $this->quoteFactory->create();
- $this->quoteResource->load(
- $secondQuote,
- 'test_order_with_virtual_product_without_address',
- 'reserved_order_id'
- );
- $secondQuoteItemId = (int)$secondQuote
- ->getItemByProduct($this->productRepository->get('virtual-product'))
- ->getId();
-
- $this->expectExceptionMessage("Cart doesn't contain the {$secondQuoteItemId} item.");
-
- $query = $this->prepareMutationQuery($firstQuoteMaskedId, $secondQuoteItemId);
- $this->graphQlQuery($query);
- }
-
- /**
- * Test mutation is only able to remove quote item belonging to the requested cart
- *
- * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
- */
- public function testRemoveItemFromCustomerCart()
- {
- $customerQuote = $this->quoteFactory->create();
- $this->quoteResource->load($customerQuote, 'test_order_1', 'reserved_order_id');
- $customerQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$customerQuote->getId());
- $customerQuoteItemId = (int)$customerQuote->getItemByProduct($this->productRepository->get('simple'))->getId();
-
- $this->expectExceptionMessage("The current user cannot perform operations on cart \"$customerQuoteMaskedId\"");
-
- $query = $this->prepareMutationQuery($customerQuoteMaskedId, $customerQuoteItemId);
- $this->graphQlQuery($query);
+ $query = $this->getQuery($maskedQuoteId, $notExistentItemId);
+ $this->graphQlMutation($query);
}
/**
@@ -161,7 +103,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -181,12 +123,51 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array
];
}
+ /**
+ * _security
+ * @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/Checkout/_files/quote_with_virtual_product_saved.php
+ */
+ public function testRemoveItemIfItemIsNotBelongToCart()
+ {
+ $firstQuoteMaskedId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $secondQuoteItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute(
+ 'test_order_with_virtual_product_without_address',
+ 'virtual-product'
+ );
+
+ $this->expectExceptionMessage("Cart doesn't contain the {$secondQuoteItemId} item.");
+
+ $query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId);
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * _security
+ * @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 testRemoveItemFromCustomerCart()
+ {
+ $customerQuoteMaskedId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $customerQuoteItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
+
+ $this->expectExceptionMessage("The current user cannot perform operations on cart \"$customerQuoteMaskedId\"");
+
+ $query = $this->getQuery($customerQuoteMaskedId, $customerQuoteItemId);
+ $this->graphQlMutation($query);
+ }
+
/**
* @param string $maskedQuoteId
* @param int $itemId
* @return string
*/
- private function prepareMutationQuery(string $maskedQuoteId, int $itemId): string
+ private function getQuery(string $maskedQuoteId, int $itemId): string
{
return <<graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']);
$cartResponse = $response['setBillingAddressOnCart']['cart'];
@@ -149,7 +149,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
}
}
QUERY;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']);
$cartResponse = $response['setBillingAddressOnCart']['cart'];
@@ -203,7 +203,7 @@ public function testSetBillingAddressToCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -237,7 +237,7 @@ public function testSetBillingAddressFromAddressBook()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -276,7 +276,7 @@ public function testSetBillingAddressOnNonExistentCart()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -310,7 +310,50 @@ public function testSetBillingAddressWithoutRequiredParameters(string $input, st
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->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
+ */
+ public function testSetNewBillingAddressRedundantStreetLine()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = <<graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflineShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflineShippingMethodsOnCartTest.php
index 477c93efd31d0..2c1333aa77326 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflineShippingMethodsOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflineShippingMethodsOnCartTest.php
@@ -64,7 +64,7 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php
index 879d0fd917291..7f9aaf4296c30 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetPaymentMethodOnCartTest.php
@@ -44,7 +44,7 @@ public function testSetPaymentOnCartWithSimpleProduct()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
@@ -66,7 +66,7 @@ public function testSetPaymentOnCartWithSimpleProductAndWithoutAddress()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -80,7 +80,7 @@ public function testSetPaymentOnCartWithVirtualProduct()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
@@ -103,7 +103,7 @@ public function testSetNonExistentPaymentMethod()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -116,7 +116,7 @@ public function testSetPaymentOnNonExistentCart()
$methodCode = Checkmo::PAYMENT_METHOD_CHECKMO_CODE;
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -137,7 +137,7 @@ public function testSetPaymentMethodToCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -169,7 +169,7 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -207,7 +207,7 @@ public function testReSetPayment()
$methodCode = Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE;
$query = $this->getQuery($maskedQuoteId, $methodCode);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
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 18523feb261b9..888b0e87734b6 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
@@ -78,7 +78,7 @@ public function testSetNewShippingAddressOnCartWithSimpleProduct()
}
}
QUERY;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']);
$cartResponse = $response['setShippingAddressesOnCart']['cart'];
@@ -130,7 +130,7 @@ public function testSetNewShippingAddressOnCartWithVirtualProduct()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -166,7 +166,7 @@ public function testSetShippingAddressFromAddressBook()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -205,7 +205,7 @@ public function testSetShippingAddressToCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -243,7 +243,51 @@ public function testSetNewShippingAddressWithMissedRequiredParameters(string $in
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->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
+ */
+ public function testSetNewShippingAddressOnCartWithRedundantStreetLine()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = <<graphQlMutation($query);
}
/**
@@ -320,7 +364,7 @@ public function testSetMultipleNewShippingAddresses()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php
index 2eac002253ff0..2f3c109b99523 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php
@@ -58,7 +58,7 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
@@ -101,7 +101,7 @@ public function testSetShippingMethodOnCartWithSimpleProductAndWithoutAddress()
$carrierCode,
$quoteAddressId
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -125,7 +125,7 @@ public function testReSetShippingMethod()
$carrierCode,
$quoteAddressId
);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertArrayHasKey('setShippingMethodsOnCart', $response);
self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']);
@@ -175,7 +175,7 @@ public function testSetShippingMethodWithWrongParameters(string $input, string $
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -314,7 +314,7 @@ public function testSetMultipleShippingMethods()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -343,7 +343,7 @@ public function testSetShippingMethodToCustomerCart()
$this->expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -370,7 +370,7 @@ public function testSetShippingMethodIfGuestIsNotOwnerOfAddress()
$this->expectExceptionMessage(
"Cart does not contain address with ID \"{$anotherQuoteAddressId}\""
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php
index fca7a4287620b..1b8cf2e1c57f7 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php
@@ -60,7 +60,7 @@ public function testUpdateCartItemQty()
$qty = 2;
$query = $this->getQuery($maskedQuoteId, $itemId, $qty);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$this->assertArrayHasKey('updateCartItems', $response);
$this->assertArrayHasKey('cart', $response['updateCartItems']);
@@ -84,7 +84,7 @@ public function testRemoveCartItemIfQuantityIsZero()
$qty = 0;
$query = $this->getQuery($maskedQuoteId, $itemId, $qty);
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$this->assertArrayHasKey('updateCartItems', $response);
$this->assertArrayHasKey('cart', $response['updateCartItems']);
@@ -100,7 +100,7 @@ public function testRemoveCartItemIfQuantityIsZero()
public function testUpdateItemInNonExistentCart()
{
$query = $this->getQuery('non_existent_masked_id', 1, 2);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -116,7 +116,7 @@ public function testUpdateNonExistentItem()
$this->expectExceptionMessage("Could not find cart item with id: {$notExistentItemId}.");
$query = $this->getQuery($maskedQuoteId, $notExistentItemId, 2);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -142,7 +142,7 @@ public function testUpdateItemIfItemIsNotBelongToCart()
$this->expectExceptionMessage("Could not find cart item with id: {$secondQuoteItemId}.");
$query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId, 2);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -158,7 +158,7 @@ public function testUpdateItemFromCustomerCart()
$this->expectExceptionMessage("The current user cannot perform operations on cart \"$customerQuoteMaskedId\"");
$query = $this->getQuery($customerQuoteMaskedId, $customerQuoteItemId, 2);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -186,7 +186,7 @@ public function testUpdateWithMissedCartItemId()
}
}
QUERY;
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -217,7 +217,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string
}
QUERY;
$this->expectExceptionMessage($message);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php
index 05e3e608c5e52..ae6faae7650b9 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/SendFriend/SendFriendTest.php
@@ -12,6 +12,9 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
+/**
+ * Tests for send email to friend
+ */
class SendFriendTest extends GraphQlAbstract
{
@@ -66,7 +69,7 @@ public function testSendFriend()
}
QUERY;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
self::assertEquals('Name', $response['sendEmailToFriend']['sender']['name']);
self::assertEquals('e@mail.com', $response['sendEmailToFriend']['sender']['email']);
self::assertEquals('Lorem Ipsum', $response['sendEmailToFriend']['sender']['message']);
@@ -117,7 +120,7 @@ public function testSendWithoutExistProduct()
$this->expectExceptionMessage(
'The product that was requested doesn\'t exist. Verify the product and try again.'
);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -181,7 +184,7 @@ public function testMaxSendEmailToFriend()
QUERY;
$this->expectException(\Exception::class);
$this->expectExceptionMessage("No more than {$sendFriend->getMaxRecipients()} emails can be sent at a time.");
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -214,7 +217,7 @@ public function testErrors(string $input, string $errorMessage)
QUERY;
$this->expectException(\Exception::class);
$this->expectExceptionMessage($errorMessage);
- $this->graphQlQuery($query);
+ $this->graphQlMutation($query);
}
/**
@@ -269,8 +272,9 @@ public function testLimitMessagesPerHour()
"You can't send messages more than {$sendFriend->getMaxSendsToFriend()} times an hour."
);
- for ($i = 0; $i <= $sendFriend->getMaxSendsToFriend() + 1; $i++) {
- $this->graphQlQuery($query);
+ $maxSendToFriends = $sendFriend->getMaxSendsToFriend();
+ for ($i = 0; $i <= $maxSendToFriends + 1; $i++) {
+ $this->graphQlMutation($query);
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php
index b6e1a61f0357c..c85f63c083700 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php
@@ -28,10 +28,31 @@ public function testMutation()
}
MUTATION;
- $response = $this->graphQlQuery($query);
+ $response = $this->graphQlMutation($query);
$this->assertArrayHasKey('testItem', $response);
$testItem = $response['testItem'];
$this->assertArrayHasKey('integer_list', $testItem);
$this->assertEquals([4, 5, 6], $testItem['integer_list']);
}
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Mutation requests allowed only for POST requests
+ */
+ public function testMutationIsNotAllowedViaGetRequest()
+ {
+ $id = 3;
+
+ $query = <<graphQlQuery($query, [], '', []);
+ }
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php
index d59e255daa109..2db06e383758f 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php
@@ -58,4 +58,46 @@ public function testQueryTestModuleExtensionAttribute()
$this->assertArrayHasKey('integer_list', $testItem);
$this->assertEquals([3, 4, 5], $testItem['integer_list']);
}
+
+ public function testQueryViaGetRequestReturnsResults()
+ {
+ $id = 1;
+
+ $query = <<graphQlQuery($query, [], '', []);
+
+ $this->assertArrayHasKey('testItem', $response);
+ }
+
+ public function testQueryViaGetRequestWithVariablesReturnsResults()
+ {
+ $id = 1;
+
+ $query = << $id
+ ];
+
+ $response = $this->graphQlQuery($query, $variables, '', []);
+
+ $this->assertArrayHasKey('testItem', $response);
+ }
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php
index 463f2c4af101f..6861bb8dbb240 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php
@@ -142,6 +142,6 @@ private function sendRequestWithToken(string $query): array
$customerToken = $this->customerTokenService->createCustomerAccessToken('customer@example.com', 'password');
$headerMap = ['Authorization' => 'Bearer ' . $customerToken];
- return $this->graphQlQuery($query, [], '', $headerMap);
+ return $this->graphQlMutation($query, [], '', $headerMap);
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php
index 89fbbb9c49ed3..45c82906d255d 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Vault/CustomerPaymentTokensTest.php
@@ -14,6 +14,9 @@
use Magento\Vault\Model\ResourceModel\PaymentToken as TokenResource;
use Magento\Vault\Model\ResourceModel\PaymentToken\CollectionFactory;
+/**
+ * Tests for customer payment tokens
+ */
class CustomerPaymentTokensTest extends GraphQlAbstract
{
/**
@@ -139,7 +142,12 @@ public function testDeletePaymentToken()
}
}
QUERY;
- $response = $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $response = $this->graphQlMutation(
+ $query,
+ [],
+ '',
+ $this->getCustomerAuthHeaders($currentEmail, $currentPassword)
+ );
$this->assertTrue($response['deletePaymentToken']['result']);
$this->assertEquals(1, count($response['deletePaymentToken']['customerPaymentTokens']['items']));
@@ -168,7 +176,7 @@ public function testDeletePaymentTokenIfUserIsNotAuthorized()
}
}
QUERY;
- $this->graphQlQuery($query, [], '');
+ $this->graphQlMutation($query, [], '');
}
/**
@@ -190,7 +198,7 @@ public function testDeletePaymentTokenInvalidPublicHash()
}
}
QUERY;
- $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->graphQlMutation($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
}
/**
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml
index 9a6a66091d427..dc91608f361c2 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml
@@ -57,11 +57,9 @@
catalogProductSimple::default::name
2
-
-
+
- MAGETWO-65509: [FT] Magento\CatalogSearch\Test\TestCase\SearchEntityResultsTest fails on Jenkins
stable:no
catalogProductSimple::default::name
3
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewedTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewedTest.php
index 595a33344c7e8..bd4dd0c8daf0c 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewedTest.php
@@ -4,8 +4,12 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
+/**
+ * Test product viewed backend controller.
+ */
class ProductsViewedTest extends \Magento\TestFramework\TestCase\AbstractBackendController
{
/**
@@ -14,6 +18,7 @@ class ProductsViewedTest extends \Magento\TestFramework\TestCase\AbstractBackend
*/
public function testExecute()
{
+ $this->getRequest()->setMethod("POST");
$this->dispatch('backend/admin/dashboard/productsViewed/');
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/assign_items_per_address.php b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/assign_items_per_address.php
new file mode 100644
index 0000000000000..91cea7dc96602
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/assign_items_per_address.php
@@ -0,0 +1,40 @@
+getStore();
+$quote->setReservedOrderId('multishipping_quote_id_braintree')
+ ->setStoreId($store->getId())
+ ->setCustomerEmail('customer001@test.com');
+
+/** @var CartRepositoryInterface $quoteRepository */
+$quoteRepository = $objectManager->get(CartRepositoryInterface::class);
+$quote->collectTotals();
+$quoteRepository->save($quote);
+
+$items = $quote->getAllItems();
+$addressList = $quote->getAllShippingAddresses();
+
+foreach ($addressList as $key => $address) {
+ $item = $items[$key];
+ // set correct quantity per shipping address
+ $item->setQty(1);
+ $address->setTotalQty(1);
+ $address->addItem($item);
+}
+
+// assign virtual product to the billing address
+$billingAddress = $quote->getBillingAddress();
+$virtualItem = $items[sizeof($items) - 1];
+$billingAddress->setTotalQty(1);
+$billingAddress->addItem($virtualItem);
+
+// need to recollect totals
+$quote->setTotalsCollectedFlag(false);
+$quote->collectTotals();
+$quoteRepository->save($quote);
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree.php b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree.php
new file mode 100644
index 0000000000000..3e1db90f1f2c8
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree.php
@@ -0,0 +1,28 @@
+create(Payment::class);
+$payment->setMethod(ConfigProvider::CODE);
+$quote->setPayment($payment);
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree_paypal.php b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree_paypal.php
new file mode 100644
index 0000000000000..e4bba222078b0
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/payment_braintree_paypal.php
@@ -0,0 +1,28 @@
+create(Payment::class);
+$payment->setMethod(ConfigProvider::PAYPAL_CODE);
+$quote->setPayment($payment);
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree.php b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree.php
new file mode 100644
index 0000000000000..1c56e611dd6db
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree.php
@@ -0,0 +1,26 @@
+get(StoreManagerInterface::class);
+
+/** @var Quote $quote */
+$quote = $objectManager->create(Quote::class);
+
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/shipping_address_list.php';
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/billing_address.php';
+require __DIR__ . '/payment_braintree.php';
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/items.php';
+require __DIR__ . '/assign_items_per_address.php';
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree_paypal.php b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree_paypal.php
new file mode 100644
index 0000000000000..4bd8e926abb76
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Fixtures/quote_with_split_items_braintree_paypal.php
@@ -0,0 +1,26 @@
+get(StoreManagerInterface::class);
+
+/** @var Quote $quote */
+$quote = $objectManager->create(Quote::class);
+
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/shipping_address_list.php';
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/billing_address.php';
+require __DIR__ . '/payment_braintree_paypal.php';
+require __DIR__ . '/../../../Magento/Multishipping/Fixtures/items.php';
+require __DIR__ . '/assign_items_per_address.php';
diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Model/MultishippingTest.php b/dev/tests/integration/testsuite/Magento/Braintree/Model/MultishippingTest.php
new file mode 100644
index 0000000000000..91bc0388d8551
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Braintree/Model/MultishippingTest.php
@@ -0,0 +1,254 @@
+objectManager = Bootstrap::getObjectManager();
+
+ $orderSender = $this->getMockBuilder(OrderSender::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $adapterFactory = $this->getMockBuilder(BraintreeAdapterFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->adapter = $this->getMockBuilder(BraintreeAdapter::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $adapterFactory->method('create')
+ ->willReturn($this->adapter);
+
+ $this->objectManager->addSharedInstance($adapterFactory, BraintreeAdapterFactory::class);
+ $this->objectManager->addSharedInstance($this->getPaymentNonceMock(), GetPaymentNonceCommand::class);
+
+ $this->model = $this->objectManager->create(
+ Multishipping::class,
+ ['orderSender' => $orderSender]
+ );
+ }
+
+ /**
+ * Checks a case when multiple orders are created successfully using Braintree payment method.
+ *
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Braintree/Fixtures/quote_with_split_items_braintree.php
+ * @magentoConfigFixture current_store payment/braintree/active 1
+ * @return void
+ */
+ public function testCreateOrdersWithBraintree()
+ {
+ $this->adapter->method('sale')
+ ->willReturn(
+ $this->getTransactionStub()
+ );
+ $this->createOrders();
+ }
+
+ /**
+ * Checks a case when multiple orders are created successfully using Braintree PayPal payment method.
+ *
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Braintree/Fixtures/quote_with_split_items_braintree_paypal.php
+ * @magentoConfigFixture current_store payment/braintree_paypal/active 1
+ * @return void
+ */
+ public function testCreateOrdersWithBraintreePaypal()
+ {
+ $this->adapter->method('sale')
+ ->willReturn(
+ $this->getTransactionPaypalStub()
+ );
+ $this->createOrders();
+ }
+
+ /**
+ * Creates orders for multishipping checkout flow.
+ *
+ * @return void
+ */
+ private function createOrders()
+ {
+ $expectedPlacedOrdersNumber = 3;
+ $quote = $this->getQuote('multishipping_quote_id_braintree');
+
+ /** @var CheckoutSession $session */
+ $session = $this->objectManager->get(CheckoutSession::class);
+ $session->replaceQuote($quote);
+
+ $this->model->createOrders();
+
+ $orderList = $this->getOrderList((int)$quote->getId());
+ self::assertCount(
+ $expectedPlacedOrdersNumber,
+ $orderList,
+ 'Total successfully placed orders number mismatch'
+ );
+ }
+
+ /**
+ * Creates stub for Braintree capture Transaction.
+ *
+ * @return Successful
+ */
+ private function getTransactionStub(): Successful
+ {
+ $transaction = $this->getMockBuilder(Transaction::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $transaction->status = 'submitted_for_settlement';
+ $transaction->creditCard = [
+ 'last4' => '1111',
+ 'cardType' => 'Visa',
+ 'expirationMonth' => '12',
+ 'expirationYear' => '2021'
+ ];
+
+ $creditCardDetails = new \stdClass();
+ $creditCardDetails->token = '4fdg';
+ $creditCardDetails->expirationMonth = '12';
+ $creditCardDetails->expirationYear = '2021';
+ $creditCardDetails->cardType = 'Visa';
+ $creditCardDetails->last4 = '1111';
+ $creditCardDetails->expirationDate = '12/2021';
+ $transaction->creditCardDetails = $creditCardDetails;
+
+ $response = new Successful();
+ $response->success = true;
+ $response->transaction = $transaction;
+
+ return $response;
+ }
+
+ /**
+ * Creates stub for BraintreePaypal capture Transaction.
+ *
+ * @return Successful
+ */
+ private function getTransactionPaypalStub(): Successful
+ {
+ $transaction = $this->getMockBuilder(Transaction::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $transaction->status = 'submitted_for_settlement';
+ $transaction->paypal = [
+ 'token' => 'fchxqx',
+ 'payerEmail' => 'payer@example.com',
+ 'paymentId' => 'PAY-33ac47a28e7f54791f6cda45',
+ ];
+ $paypalDetails = new \stdClass();
+ $paypalDetails->token = 'fchxqx';
+ $paypalDetails->payerEmail = 'payer@example.com';
+ $paypalDetails->paymentId = '33ac47a28e7f54791f6cda45';
+ $transaction->paypalDetails = $paypalDetails;
+
+ $response = new Successful();
+ $response->success = true;
+ $response->transaction = $transaction;
+
+ return $response;
+ }
+
+ /**
+ * Retrieves quote by reserved order id.
+ *
+ * @param string $reservedOrderId
+ * @return Quote
+ */
+ private function getQuote(string $reservedOrderId): Quote
+ {
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId)
+ ->create();
+
+ /** @var CartRepositoryInterface $quoteRepository */
+ $quoteRepository = $this->objectManager->get(CartRepositoryInterface::class);
+ $items = $quoteRepository->getList($searchCriteria)->getItems();
+
+ return array_pop($items);
+ }
+
+ /**
+ * Get list of orders by quote id.
+ *
+ * @param int $quoteId
+ * @return array
+ */
+ private function getOrderList(int $quoteId): array
+ {
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilter('quote_id', $quoteId)
+ ->create();
+
+ /** @var OrderRepositoryInterface $orderRepository */
+ $orderRepository = $this->objectManager->get(OrderRepositoryInterface::class);
+ return $orderRepository->getList($searchCriteria)->getItems();
+ }
+
+ /**
+ * Returns GetPaymentNonceCommand command mock.
+ *
+ * @return MockObject
+ */
+ private function getPaymentNonceMock(): MockObject
+ {
+ $commandResult = $this->createMock(CommandResultInterface::class);
+ $commandResult->method('get')
+ ->willReturn(['paymentMethodNonce' => 'testNonce']);
+ $paymentNonce = $this->createMock(GetPaymentNonceCommand::class);
+ $paymentNonce->method('execute')
+ ->willReturn($commandResult);
+
+ return $paymentNonce;
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store.php
new file mode 100644
index 0000000000000..6448a570424e2
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store.php
@@ -0,0 +1,23 @@
+create(\Magento\Quote\Model\Quote::class);
+$quote->setStoreId($store->getId())
+ ->setIsActive(true)
+ ->setIsMultiShipping(false)
+ ->setReservedOrderId('test_order_1_not_default_store')
+ ->setCustomerId($customer->getId())
+ ->save();
+
+/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
+$quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
+ ->create();
+$quoteIdMask->setQuoteId($quote->getId());
+$quoteIdMask->setDataChanges(true);
+$quoteIdMask->save();
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store_rollback.php
new file mode 100644
index 0000000000000..e3e1513cb6144
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_customer_not_default_store_rollback.php
@@ -0,0 +1,8 @@
+create(\Magento\Quote\Model\Quote::class);
+$quote->load('test_order_1_not_default_store', 'reserved_order_id')->delete();
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store.php
new file mode 100644
index 0000000000000..bbd3d5efbe8c8
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store.php
@@ -0,0 +1,21 @@
+create(\Magento\Quote\Model\Quote::class);
+$quote->setStoreId($store->getId())
+ ->setIsActive(true)
+ ->setIsMultiShipping(false)
+ ->setReservedOrderId('test_order_1_not_default_store_guest')
+ ->save();
+
+/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
+$quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
+ ->create();
+$quoteIdMask->setQuoteId($quote->getId());
+$quoteIdMask->setDataChanges(true);
+$quoteIdMask->save();
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store_rollback.php
new file mode 100644
index 0000000000000..f511133280e7f
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/active_quote_guest_not_default_store_rollback.php
@@ -0,0 +1,8 @@
+create(\Magento\Quote\Model\Quote::class);
+$quote->load('test_order_1_not_default_store_guest', 'reserved_order_id')->delete();
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ConverterStub.php b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ConverterStub.php
similarity index 63%
rename from dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ConverterStub.php
rename to dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ConverterStub.php
index 223ef35c0dcd3..7493d31f02b31 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ConverterStub.php
+++ b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ConverterStub.php
@@ -3,14 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-namespace Magento\Paypal\Model\Config\Structure\Reader;
+declare(strict_types=1);
+
+namespace Magento\Config\Model\Config\Structure\Reader;
+
+use Magento\Config\Model\Config\Structure\Converter;
/**
- * Class ConverterStub
+ * Class ConverterStub used for ReaderTest.
*/
-class ConverterStub extends \Magento\Config\Model\Config\Structure\Converter
+class ConverterStub extends Converter
{
/**
+ * Convert dom document wrapper.
+ *
* @param \DOMDocument $document
* @return array|null
*/
@@ -20,7 +26,7 @@ public function getArrayData(\DOMDocument $document)
}
/**
- * Convert dom document
+ * Convert dom document.
*
* @param \DOMNode $source
* @return array
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderStub.php b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderStub.php
similarity index 53%
rename from dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderStub.php
rename to dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderStub.php
index ed1366ad737f9..866ff91678ec4 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderStub.php
+++ b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderStub.php
@@ -3,14 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-namespace Magento\Paypal\Model\Config\Structure\Reader;
+declare(strict_types=1);
+
+namespace Magento\Config\Model\Config\Structure\Reader;
+
+use Magento\Config\Model\Config\Structure\Reader;
/**
- * Class ReaderStub
+ * Class ReaderStub used for testing protected Reader::_readFiles() method.
*/
-class ReaderStub extends \Magento\Config\Model\Config\Structure\Reader
+class ReaderStub extends Reader
{
/**
+ * Wrapper for protected Reader::_readFiles() method.
+ *
* @param array $fileList
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderTest.php
new file mode 100644
index 0000000000000..eef8e68458d91
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/ReaderTest.php
@@ -0,0 +1,146 @@
+objectManager = Bootstrap::getObjectManager();
+ $this->fileUtility = Files::init();
+
+ $this->validationStateMock = $this->getMockBuilder(ValidationStateInterface::class)
+ ->setMethods(['isValidationRequired'])
+ ->getMockForAbstractClass();
+ $this->schemaLocatorMock = $this->getMockBuilder(SchemaLocator::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getPerFileSchema'])
+ ->getMock();
+ $this->fileResolverMock = $this->getMockBuilder(FileResolverInterface::class)
+ ->getMockForAbstractClass();
+
+ $this->validationStateMock->expects($this->atLeastOnce())
+ ->method('isValidationRequired')
+ ->willReturn(false);
+ $this->schemaLocatorMock->expects($this->atLeastOnce())
+ ->method('getPerFileSchema')
+ ->willReturn(false);
+
+ $this->converter = $this->objectManager->create(ConverterStub::class);
+
+ //Isolate test from actual configuration, and leave only sample data.
+ $this->compiler = $this->getMockBuilder(CompilerInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['compile'])
+ ->getMockForAbstractClass();
+
+ $this->reader = $this->objectManager->create(
+ ReaderStub::class,
+ [
+ 'fileResolver' => $this->fileResolverMock,
+ 'converter' => $this->converter,
+ 'schemaLocator' => $this->schemaLocatorMock,
+ 'validationState' => $this->validationStateMock,
+ 'fileName' => 'no_existing_file.xml',
+ 'compiler' => $this->compiler,
+ 'domDocumentClass' => Dom::class
+ ]
+ );
+ }
+
+ /**
+ * The test checks the file structure after processing the nodes responsible for inserting content.
+ *
+ * @return void
+ */
+ public function testXmlConvertedConfigurationAndCompereStructure()
+ {
+ $actual = $this->reader->readFiles(['actual' => $this->getContent()]);
+
+ $document = new \DOMDocument();
+ $document->loadXML($this->getContent());
+
+ $expected = $this->converter->getArrayData($document);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Get config sample data for test.
+ *
+ * @return string
+ */
+ protected function getContent()
+ {
+ $files = $this->fileUtility->getFiles([BP . static::CONFIG], 'config.xml');
+
+ return file_get_contents(reset($files));
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml
similarity index 100%
rename from dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml
rename to dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml
diff --git a/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php
index 7f8996daa6e97..10a6b9d8caae4 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php
@@ -8,6 +8,7 @@
namespace Magento\Framework\GraphQl\Config;
use Magento\Framework\App\Cache;
+use Magento\Framework\App\Request\Http;
use Magento\Framework\GraphQl\Config;
use Magento\Framework\GraphQl\Schema\SchemaGenerator;
use Magento\Framework\ObjectManagerInterface;
@@ -175,8 +176,9 @@ enumValues(includeDeprecated: true) {
'operationName' => 'IntrospectionQuery'
];
/** @var Http $request */
- $request = $this->objectManager->get(\Magento\Framework\App\Request\Http::class);
+ $request = $this->objectManager->get(Http::class);
$request->setPathInfo('/graphql');
+ $request->setMethod('POST');
$request->setContent(json_encode($postData));
$headers = $this->objectManager->create(\Zend\Http\Headers::class)
->addHeaders(['Content-Type' => 'application/json']);
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
index 384892d6fd5d2..d0d746812ec44 100644
--- a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
@@ -38,6 +38,9 @@ class GraphQlControllerTest extends \Magento\TestFramework\Indexer\TestCase
/** @var MetadataPool */
private $metadataPool;
+ /** @var Http */
+ private $request;
+
public static function setUpBeforeClass()
{
$db = Bootstrap::getInstance()->getBootstrap()
@@ -57,6 +60,7 @@ protected function setUp() : void
$this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class);
$this->jsonSerializer = $this->objectManager->get(SerializerInterface::class);
$this->metadataPool = $this->objectManager->get(MetadataPool::class);
+ $this->request = $this->objectManager->get(Http::class);
}
/**
@@ -86,27 +90,120 @@ public function testDispatch() : void
}
QUERY;
$postData = [
- 'query' => $query,
- 'variables' => null,
+ 'query' => $query,
+ 'variables' => null,
'operationName' => null
];
- /** @var Http $request */
- $request = $this->objectManager->get(\Magento\Framework\App\Request\Http::class);
- $request->setPathInfo('/graphql');
- $request->setContent(json_encode($postData));
+
+ $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']);
- $request->setHeaders($headers);
- $response = $this->graphql->dispatch($request);
+ $this->request->setHeaders($headers);
+ $response = $this->graphql->dispatch($this->request);
$output = $this->jsonSerializer->unserialize($response->getContent());
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
$this->assertArrayNotHasKey('errors', $output, 'Response has errors');
- $this->assertTrue(!empty($output['data']['products']['items']), 'Products array has items');
- $this->assertTrue(!empty($output['data']['products']['items'][0]), 'Products array has items');
- $this->assertEquals($output['data']['products']['items'][0]['id'], $product->getData($linkField));
- $this->assertEquals($output['data']['products']['items'][0]['sku'], $product->getSku());
- $this->assertEquals($output['data']['products']['items'][0]['name'], $product->getName());
+ $this->assertNotEmpty($output['data']['products']['items'], 'Products array has items');
+ $this->assertNotEmpty($output['data']['products']['items'][0], 'Products array has items');
+ $this->assertEquals($product->getData($linkField), $output['data']['products']['items'][0]['id']);
+ $this->assertEquals($product->getSku(), $output['data']['products']['items'][0]['sku']);
+ $this->assertEquals($product->getName(), $output['data']['products']['items'][0]['name']);
+ }
+
+ /**
+ * Test request is dispatched and response generated when using GET request with query string
+ *
+ * @return void
+ */
+ public function testDispatchWithGet() : void
+ {
+ /** @var ProductRepositoryInterface $productRepository */
+ $productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
+
+ /** @var ProductInterface $product */
+ $product = $productRepository->get('simple1');
+
+ $query
+ = <<request->setPathInfo('/graphql');
+ $this->request->setMethod('GET');
+ $this->request->setQueryValue('query', $query);
+ $response = $this->graphql->dispatch($this->request);
+ $output = $this->jsonSerializer->unserialize($response->getContent());
+ $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
+
+ $this->assertArrayNotHasKey('errors', $output, 'Response has errors');
+ $this->assertNotEmpty($output['data']['products']['items'], 'Products array has items');
+ $this->assertNotEmpty($output['data']['products']['items'][0], 'Products array has items');
+ $this->assertEquals($product->getData($linkField), $output['data']['products']['items'][0]['id']);
+ $this->assertEquals($product->getSku(), $output['data']['products']['items'][0]['sku']);
+ $this->assertEquals($product->getName(), $output['data']['products']['items'][0]['name']);
+ }
+
+ /** Test request is dispatched and response generated when using GET request with parameterized query string
+ *
+ * @return void
+ */
+ public function testDispatchGetWithParameterizedVariables() : void
+ {
+ /** @var ProductRepositoryInterface $productRepository */
+ $productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
+
+ /** @var ProductInterface $product */
+ $product = $productRepository->get('simple1');
+ $query = << [
+ 'sku' => ['eq' => 'simple1']
+ ]
+ ];
+ $queryParams = [
+ 'query' => $query,
+ 'variables' => json_encode($variables),
+ 'operationName' => 'GetProducts'
+ ];
+
+ $this->request->setPathInfo('/graphql');
+ $this->request->setMethod('GET');
+ $this->request->setParams($queryParams);
+ $response = $this->graphql->dispatch($this->request);
+ $output = $this->jsonSerializer->unserialize($response->getContent());
+ $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
+
+ $this->assertArrayNotHasKey('errors', $output, 'Response has errors');
+ $this->assertNotEmpty($output['data']['products']['items'], 'Products array has items');
+ $this->assertNotEmpty($output['data']['products']['items'][0], 'Products array has items');
+ $this->assertEquals($product->getData($linkField), $output['data']['products']['items'][0]['id']);
+ $this->assertEquals($product->getSku(), $output['data']['products']['items'][0]['sku']);
+ $this->assertEquals($product->getName(), $output['data']['products']['items'][0]['name']);
}
/**
@@ -136,25 +233,25 @@ public function testError() : void
QUERY;
$postData = [
- 'query' => $query,
- 'variables' => null,
+ 'query' => $query,
+ 'variables' => null,
'operationName' => null
];
- /** @var Http $request */
- $request = $this->objectManager->get(\Magento\Framework\App\Request\Http::class);
- $request->setPathInfo('/graphql');
- $request->setContent(json_encode($postData));
+
+ $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']);
- $request->setHeaders($headers);
- $response = $this->graphql->dispatch($request);
+ $this->request->setHeaders($headers);
+ $response = $this->graphql->dispatch($this->request);
$outputResponse = $this->jsonSerializer->unserialize($response->getContent());
if (isset($outputResponse['errors'][0])) {
if (is_array($outputResponse['errors'][0])) {
foreach ($outputResponse['errors'] as $error) {
$this->assertEquals(
- $error['category'],
- \Magento\Framework\GraphQl\Exception\GraphQlInputException::EXCEPTION_CATEGORY
+ \Magento\Framework\GraphQl\Exception\GraphQlInputException::EXCEPTION_CATEGORY,
+ $error['category']
);
if (isset($error['message'])) {
$this->assertEquals($error['message'], 'Invalid entity_type specified: invalid');
@@ -168,12 +265,4 @@ public function testError() : void
}
}
}
-
- /**
- * teardown
- */
- public function tearDown()
- {
- parent::tearDown();
- }
}
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired.php
new file mode 100644
index 0000000000000..5316b184ecd15
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired.php
@@ -0,0 +1,22 @@
+get(CouponResourceInterface::class);
+/** @var CouponFactory $couponFactory */
+$couponFactory = Bootstrap::getObjectManager()->get(CouponFactory::class);
+
+$coupon = $couponFactory->create();
+$coupon->loadByCode('2?ds5!2d');
+$yesterday = new \DateTime();
+$yesterday->add(\DateInterval::createFromDateString('-1 day'));
+$coupon->setExpirationDate($yesterday->format('Y-m-d'));
+$couponResource->save($coupon);
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired_rollback.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired_rollback.php
new file mode 100644
index 0000000000000..32c3d78bafd09
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired_rollback.php
@@ -0,0 +1,23 @@
+get(CouponResourceInterface::class);
+/** @var CouponFactory $couponFactory */
+$couponFactory = Bootstrap::getObjectManager()->get(CouponFactory::class);
+
+$coupon = $couponFactory->create();
+$coupon->loadByCode('2?ds5!2d');
+
+if ($coupon->getId()) {
+ $coupon->setExpirationDate(null);
+ $couponResource->save($coupon);
+}
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product.php
new file mode 100644
index 0000000000000..e58c6b21d8d23
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product.php
@@ -0,0 +1,52 @@
+get(CouponFactory::class);
+/** @var ConditionInterfaceFactory $conditionFactory */
+$conditionFactory = Bootstrap::getObjectManager()->get(ConditionInterfaceFactory::class);
+/** @var RuleRepositoryInterface $ruleRepository */
+$ruleRepository = Bootstrap::getObjectManager()->get(RuleRepositoryInterface::class);
+
+$couponCode = '2?ds5!2d';
+$sku = 'simple_product';
+
+$coupon = $couponFactory->create();
+$coupon->loadByCode($couponCode);
+$ruleId = $coupon->getRuleId();
+$salesRule = $ruleRepository->getById($ruleId);
+
+/** @var ConditionInterface $conditionProductSku */
+$conditionProductSku = $conditionFactory->create();
+$conditionProductSku->setConditionType(\Magento\SalesRule\Model\Rule\Condition\Product::class);
+$conditionProductSku->setAttributeName('sku');
+$conditionProductSku->setValue('1');
+$conditionProductSku->setOperator('!=');
+$conditionProductSku->setValue($sku);
+
+/** @var ConditionInterface $conditionProductFound */
+$conditionProductFound = $conditionFactory->create();
+$conditionProductFound->setConditionType(\Magento\SalesRule\Model\Rule\Condition\Product\Found::class);
+$conditionProductFound->setValue('1');
+$conditionProductFound->setAggregatorType('all');
+$conditionProductFound->setConditions([$conditionProductSku]);
+
+/** @var ConditionInterface $conditionCombine */
+$conditionCombine = $conditionFactory->create();
+$conditionCombine->setConditionType(\Magento\SalesRule\Model\Rule\Condition\Combine::class);
+$conditionCombine->setValue('1');
+$conditionCombine->setAggregatorType('all');
+$conditionCombine->setConditions([$conditionProductFound]);
+
+$salesRule->setCondition($conditionCombine);
+$ruleRepository->save($salesRule);
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product_rollback.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product_rollback.php
new file mode 100644
index 0000000000000..86ab253f1d3c0
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/restrict_coupon_usage_for_simple_product_rollback.php
@@ -0,0 +1,37 @@
+get(CouponFactory::class);
+/** @var ConditionInterfaceFactory $conditionFactory */
+$conditionFactory = Bootstrap::getObjectManager()->get(ConditionInterfaceFactory::class);
+/** @var RuleRepositoryInterface $ruleRepository */
+$ruleRepository = Bootstrap::getObjectManager()->get(RuleRepositoryInterface::class);
+
+$couponCode = '2?ds5!2d';
+$sku = 'simple_product';
+
+$coupon = $couponFactory->create();
+$coupon->loadByCode($couponCode);
+
+if ($coupon->getId()) {
+ $ruleId = $coupon->getRuleId();
+ $salesRule = $ruleRepository->getById($ruleId);
+
+ /** @var ConditionInterface $conditionCombine */
+ $conditionCombine = $conditionFactory->create();
+ $conditionCombine->setConditions([]);
+
+ $salesRule->setCondition($conditionCombine);
+ $ruleRepository->save($salesRule);
+}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php
deleted file mode 100644
index 6b966a045c982..0000000000000
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/ReaderTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
-objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $this->fileUtility = \Magento\Framework\App\Utility\Files::init();
-
- $this->validationStateMock = $this->getMockBuilder(\Magento\Framework\Config\ValidationStateInterface::class)
- ->setMethods(['isValidationRequired'])
- ->getMockForAbstractClass();
- $this->schemaLocatorMock = $this->getMockBuilder(\Magento\Config\Model\Config\SchemaLocator::class)
- ->disableOriginalConstructor()
- ->setMethods(['getPerFileSchema'])
- ->getMock();
- $this->fileResolverMock = $this->getMockBuilder(\Magento\Framework\Config\FileResolverInterface::class)
- ->getMockForAbstractClass();
-
- $this->validationStateMock->expects($this->atLeastOnce())
- ->method('isValidationRequired')
- ->willReturn(false);
- $this->schemaLocatorMock->expects($this->atLeastOnce())
- ->method('getPerFileSchema')
- ->willReturn(false);
-
- /** @var \Magento\Paypal\Model\Config\Structure\Reader\ConverterStub $converter */
- $this->converter = $this->objectManager->create(
- \Magento\Paypal\Model\Config\Structure\Reader\ConverterStub::class
- );
-
- $this->reader = $this->objectManager->create(
- \Magento\Paypal\Model\Config\Structure\Reader\ReaderStub::class,
- [
- 'fileResolver' => $this->fileResolverMock,
- 'converter' => $this->converter,
- 'schemaLocator' => $this->schemaLocatorMock,
- 'validationState' => $this->validationStateMock,
- 'fileName' => 'no_existing_file.xml',
- 'domDocumentClass' => \Magento\Framework\Config\Dom::class
- ]
- );
- }
-
- /**
- * The test checks the file structure after processing the nodes responsible for inserting content
- *
- * @return void
- */
- public function testXmlConvertedConfigurationAndCompereStructure()
- {
- $actual = $this->reader->readFiles(['actual' => $this->getActualContent()]);
-
- $document = new \DOMDocument();
- $document->loadXML($this->getExpectedContent());
-
- $expected = $this->converter->getArrayData($document);
-
- $this->assertEquals($expected, $actual);
- }
-
- /**
- * @return string
- */
- protected function getActualContent()
- {
- $files = $this->fileUtility->getFiles([BP . static::ACTUAL], 'config.xml');
-
- return file_get_contents(reset($files));
- }
-
- /**
- * @return string
- */
- protected function getExpectedContent()
- {
- $files = $this->fileUtility->getFiles([BP . static::EXPECTED], 'config.xml');
-
- return file_get_contents(reset($files));
- }
-}
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml
deleted file mode 100644
index 222b9974177de..0000000000000
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml
+++ /dev/null
@@ -1,2626 +0,0 @@
-
-
-
-
-
-
- Merchant Location
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Merchant Country
- If not specified, Default Country from General Config will be used
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Country
- Magento\Paypal\Model\System\Config\Source\MerchantCountry
- Magento\Paypal\Model\System\Config\Backend\MerchantCountry
- paypal/general/merchant_country
-
-
-
- Recommended Solutions:
- paypal-top-section paypal-recommended-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
-
- Other PayPal Payment Solutions:
- paypal-top-section paypal-other-header
- \Magento\Config\Block\System\Config\Form\Fieldset
-
-
- Other Payment Methods:
- paypal-top-section payments-other-header
- \Magento\Config\Block\System\Config\Form\Fieldset
-
-
-
-
- Payflow Pro
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- paypal-other-section
- Includes Express Checkout)]]>
- payment/payflowpro/active
- 1
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-pro.html
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint
-
-
- Required PayPal Settings
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Payflow Pro
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Partner
- payment/payflowpro/partner
- 1
-
-
- User
- payment/payflowpro/user
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Vendor
- payment/payflowpro/vendor
- 1
-
-
- Password
- payment/payflowpro/pwd
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Test Mode
- payment/payflowpro/sandbox_flag
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Use Proxy
- payment/payflowpro/use_proxy
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Proxy Host
- payment/payflowpro/proxy_host
-
- 1
-
- 1
-
-
- Proxy Port
- payment/payflowpro/proxy_port
-
- 1
-
- 1
-
-
-
- Enable this Solution
- payment/payflowpro/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
-
-
- Vault Enabled
- Magento\Config\Model\Config\Source\Yesno
- payment/payflowpro_cc_vault/active
- 1
-
-
-
-
-
-
- Basic Settings - PayPal Payflow Pro
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- It is recommended to set this value to "Debit or Credit Card" per store views.
- payment/payflowpro/title
- 1
-
-
- Vault Title
- payment/payflowpro_cc_vault/title
-
-
- Sort Order
- payment/payflowpro/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/payflowpro/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
- 1
-
-
- Credit Card Settings
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- Allowed Credit Card Types
-
- http://www.paypal.com/amexupdate.]]>
-
- payment/payflowpro/cctypes
- Magento\Paypal\Model\Config::getPayflowproCcTypesAsOptionArray
- 1
-
-
- Advanced Settings
- config-advanced
-
- Payment Applicable From
- payment/payflowpro/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/payflowpro/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
-
- 1
-
- 1
-
-
- Debug Mode
- payment/payflowpro/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/payflowpro/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Require CVV Entry
- payment/payflowpro/useccv
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- CVV and AVS Settings
-
- Reject Transaction if:
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- AVS Street Does Not Match
- payment/payflowpro/avs_street
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- AVS Zip Does Not Match
- payment/payflowpro/avs_zip
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Card Issuer Is Outside The United States
- payment/payflowpro/avs_international
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Card Security Code Does Not Match
- payment/payflowpro/avs_security_code
- Magento\Config\Model\Config\Source\Yesno
- 0
-
-
-
- Settlement Report Settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Payflow Link
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- paypal-other-section
- Includes Express Checkout)]]>
- payment/payflow_link/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-link.html
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint
-
-
- Required PayPal Settings
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Payflow Link and Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- not-required
- Email Associated with PayPal Merchant Account (Optional)
- 1
-
-
- Partner
- payment/payflow_link/partner
- 1
-
-
- Vendor
- payment/payflow_link/vendor
- 1
-
-
- User
- If you do not have multiple users set up on your account, please re-enter your Vendor/Merchant Login here.
- payment/payflow_link/user
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Password
- payment/payflow_link/pwd
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Test Mode
- payment/payflow_link/sandbox_flag
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Use Proxy
- payment/payflow_link/use_proxy
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Proxy Host
- payment/payflow_link/proxy_host
-
- 1
-
- 1
-
-
- Proxy Port
- payment/payflow_link/proxy_port
-
- 1
-
- 1
-
-
- Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Info
- 1
-
-
-
-
-
-
- Enable Payflow Link
- payment/payflow_link/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
-
-
- Enable Express Checkout
- payment/payflow_express/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Express
-
-
-
-
-
-
-
- Learn More]]>
-
- payment/payflow_express_bml/active
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Bml
-
-
-
-
-
- payment/payflow_express_bml/sort_order
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\BmlSortOrder
-
- 1
-
-
-
-
-
-
- Advertise PayPal Credit
-
- Why Advertise Financing?
- Give your sales a boost when you advertise financing. PayPal helps turn browsers into buyers with financing
- from PayPal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you.
- Use PayPal’s free banner ads that let you advertise PayPal Credit® financing as a payment option when your customers check out with PayPal.
- The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
- or more. See Details .]]>
-
-
-
-
- Home Page
-
-
-
- Size
- payment/paypal_express_bml/homepage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPH
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPS
-
- 1
-
-
-
-
- Catalog Category Page
-
-
-
- Size
- payment/paypal_express_bml/categorypage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPS
-
- 1
-
-
-
-
- Catalog Product Page
-
-
-
- Size
- payment/paypal_express_bml/productpage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPN
-
- 1
-
-
-
-
- Checkout Cart Page
-
-
-
- Size
- payment/paypal_express_bml/checkout_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutN
- 1
-
- 1
-
-
-
-
-
-
- Basic Settings - PayPal Payflow Link
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- It is recommended to set this value to "Debit or Credit Card" per store views.
- payment/payflow_link/title
- 1
-
-
- Sort Order
- payment/payflow_link/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/payflow_link/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
- 1
-
-
- Advanced Settings
- config-advanced
-
- Payment Applicable From
- payment/payflow_link/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/payflow_link/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
-
- 1
-
- 1
-
-
- Debug Mode
- payment/payflow_link/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/payflow_link/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- CVV Entry is Editable
- payment/payflow_link/csc_editable
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Require CVV Entry
- payment/payflow_link/csc_required
- Magento\Config\Model\Config\Source\Yesno
-
- 1
-
- 1
-
-
- Send Email Confirmation
- payment/payflow_link/email_confirmation
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- URL method for Cancel URL and Return URL
- payment/payflow_link/url_method
- Magento\Paypal\Model\System\Config\Source\UrlMethod
- 1
-
-
- Settlement Report Settings
-
-
-
-
-
-
-
-
-
-
-
-
- Frontend Experience Settings
-
-
-
-
-
-
-
-
-
-
-
- Basic Settings - PayPal Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
-
-
-
-
-
-
-
- Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- paypal-other-section
- Add PayPal as an additional payment method to your checkout page.
- payment/paypal_express/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-express-checkout.html
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint
-
-
- Required PayPal Settings
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Email Associated with PayPal Merchant Account (Optional)
- not-required
-
- Start accepting payments via PayPal!]]>
-
- Don't have a PayPal account? Simply enter your email address.
- paypal/general/business_account
- validate-email
- 1
-
-
- API Authentication Methods
- paypal/wpp/api_authentication
- Magento\Paypal\Model\Config::getApiAuthenticationMethods
- 1
-
-
- API Username
- paypal/wpp/api_username
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- API Password
- paypal/wpp/api_password
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- API Signature
- paypal/wpp/api_signature
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
- 0
-
-
-
- API Certificate
- paypal/wpp/api_cert
- Magento\Paypal\Model\System\Config\Backend\Cert
- 1
-
- 1
-
-
-
-
- Get Credentials from PayPal
-
-
-
-
- Sandbox Credentials
-
-
-
-
-
- NB9WWHYEMVUMS
-
- Magento_Backend/web/images/logo-magento.png
-
- FALSE
-
- FALSE
-
- embedded
-
- pp_express
-
- Magento\Paypal\Block\Adminhtml\System\Config\ApiWizard
- 1
-
-
- Sandbox Mode
- paypal/wpp/sandbox_flag
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- API Uses Proxy
- paypal/wpp/use_proxy
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Proxy Host
- paypal/wpp/proxy_host
- 1
-
- 1
-
-
-
- Proxy Port
- paypal/wpp/proxy_port
- 1
-
- 1
-
-
-
-
- Enable this Solution
- payment/paypal_express/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
-
-
- Enable In-Context Checkout Experience
-
- here.]]>
-
- payment/paypal_express/in_context
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\InContextApi
-
-
-
-
-
- Merchant Account ID
- You can look up your merchant ID by logging into https://www.paypal.com/. Click the profile icon on the top right side of the page and then select Profile and settings in the Business Profile menu. (If you do not see the profile icon at the top of the page, click Profile, which appears in the top menu when the My Account tab is selected.) Click My business info on the left, and the Merchant account ID is displayed in the list of profile items on the right.
- payment/paypal_express/merchant_id
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\MerchantId
-
- 1
-
- required-entry
-
-
- Enable PayPal Credit
- Learn More]]>
-
- payment/paypal_express_bml/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\BmlApi
-
-
-
-
-
- Sort Order PayPal Credit
- payment/paypal_express_bml/sort_order
- validate-number
- 1
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\BmlApiSortOrder
-
- 1
-
-
-
- Advertise PayPal Credit
-
- Why Advertise Financing?
- Give your sales a boost when you advertise financing. PayPal helps turn browsers into buyers with financing
- from PayPal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you.
- Use PayPal’s free banner ads that let you advertise PayPal Credit® financing as a payment option when your customers check out with PayPal.
- The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
- or more. See Details .]]>
-
-
- Publisher ID
-
- payment/paypal_express_bml/publisher_id
- 1
-
-
- Get Publisher ID from PayPal
-
- Magento\Paypal\Block\Adminhtml\System\Config\BmlApiWizard
-
-
- Home Page
-
- Display
- payment/paypal_express_bml/homepage_display
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Position
- payment/paypal_express_bml/homepage_position
- Magento\Paypal\Model\System\Config\Source\BmlPosition::getBmlPositionsHP
- 1
-
-
- Size
- payment/paypal_express_bml/homepage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPH
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPS
-
- 1
-
-
-
-
- Catalog Category Page
-
- Display
- payment/paypal_express_bml/categorypage_display
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Position
- payment/paypal_express_bml/categorypage_position
- Magento\Paypal\Model\System\Config\Source\BmlPosition::getBmlPositionsCCP
- 1
-
-
- Size
- payment/paypal_express_bml/categorypage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPC
- 1
- 0
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPS
- 1
-
-
-
- Catalog Product Page
-
- Display
- payment/paypal_express_bml/productpage_display
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Position
- payment/paypal_express_bml/productpage_position
- Magento\Paypal\Model\System\Config\Source\BmlPosition::getBmlPositionsCPP
- 1
-
-
- Size
- payment/paypal_express_bml/productpage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPC
- 1
- 0
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPN
- 1
-
-
-
- Checkout Cart Page
-
- Display
- payment/paypal_express_bml/checkout_display
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Position
- payment/paypal_express_bml/checkout_position
- Magento\Paypal\Model\System\Config\Source\BmlPosition::getBmlPositionsCheckout
- 1
-
-
- Size
- payment/paypal_express_bml/checkout_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutC
- 1
- 0
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutN
- 1
- 1
-
-
-
-
-
- Basic Settings - PayPal Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- It is recommended to set this value to "PayPal" per store views.
- payment/paypal_express/title
- 1
-
-
- Sort Order
- payment/paypal_express/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/paypal_express/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions\Express
- 1
-
-
- Display on Product Details Page
- payment/paypal_express/visible_on_product
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Authorization Honor Period (days)
- Specifies what the Authorization Honor Period is on the merchant’s PayPal account. It must mirror the setting in PayPal.
- payment/paypal_express/authorization_honor_period
- 1
-
- Order
-
-
-
- Order Valid Period (days)
- Specifies what the Order Valid Period is on the merchant’s PayPal account. It must mirror the setting in PayPal.
- payment/paypal_express/order_valid_period
- 1
-
- Order
-
-
-
- Number of Child Authorizations
- The default number of child authorizations in your PayPal account is 1. To do multiple authorizations please contact PayPal to request an increase.
- payment/paypal_express/child_authorization_number
- 1
-
- Order
-
-
-
- Advanced Settings
- config-advanced
-
- Display on Shopping Cart
- payment/paypal_express/visible_on_cart
- Also affects mini-shopping cart.
- Magento\Paypal\Model\System\Config\Source\Yesnoshortcut
- 1
-
-
- Payment Applicable From
- payment/paypal_express/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/paypal_express/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
- 1
-
- 1
-
-
-
- Debug Mode
- payment/paypal_express/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/paypal_express/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Transfer Cart Line Items
- payment/paypal_express/line_items_enabled
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Transfer Shipping Options
- payment/paypal_express/transfer_shipping_options
- If this option is enabled, customer can change shipping address and shipping method on PayPal website. In live mode works via HTTPS protocol only.
- Notice that PayPal can handle up to 10 shipping options. That is why Magento will transfer only first 10 cheapest shipping options if there are more than 10 available.
- Magento\Config\Model\Config\Source\Yesno
- 1
-
- 1
-
-
-
- Shortcut Buttons Flavor
- paypal/wpp/button_flavor
- Magento\Paypal\Model\Config::getExpressCheckoutButtonFlavors
- 1
-
-
- Enable PayPal Guest Checkout
- Ability for buyer to purchase without PayPal account.
- payment/paypal_express/solution_type
- Magento\Paypal\Model\Config::getExpressCheckoutSolutionTypes
- 1
-
-
- Require Customer's Billing Address
- This feature needs be enabled first for the merchant account through PayPal technical support.
- payment/paypal_express/require_billing_address
- Magento\Paypal\Model\System\Config\Source\RequireBillingAddress
- 1
-
-
- Billing Agreement Signup
- Whether to create a billing agreement, if there are no active billing agreements available.
-
-
-
- payment/paypal_express/allow_ba_signup
- Magento\Paypal\Model\Config::getExpressCheckoutBASignupOptions
- 1
-
-
- Skip Order Review Step
- payment/paypal_express/skip_order_review_step
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- PayPal Billing Agreement Settings
-
- Enabled
-
-
-
- payment/paypal_billing_agreement/active
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Title
- payment/paypal_billing_agreement/title
- 1
-
-
- Sort Order
- payment/paypal_billing_agreement/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/paypal_billing_agreement/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
- 1
-
-
- Payment Applicable From
- payment/paypal_billing_agreement/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/paypal_billing_agreement/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
- 1
-
- 1
-
-
-
- Debug Mode
- payment/paypal_billing_agreement/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/paypal_billing_agreement/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Transfer Cart Line Items
- payment/paypal_billing_agreement/line_items_enabled
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Allow in Billing Agreement Wizard
- payment/paypal_billing_agreement/allow_billing_agreement_wizard
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Settlement Report Settings
-
- SFTP Credentials
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- Login
- paypal/fetch_reports/ftp_login
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Password
- paypal/fetch_reports/ftp_password
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Sandbox Mode
- paypal/fetch_reports/ftp_sandbox
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Custom Endpoint Hostname or IP-Address
- By default it is "reports.paypal.com".
- Use colon to specify port. For example: "test.example.com:5224".
- paypal/fetch_reports/ftp_ip
- 1
-
- 0
-
-
-
- Custom Path
- By default it is "/ppreports/outgoing".
- paypal/fetch_reports/ftp_path
- 1
-
- 0
-
-
-
- Scheduled Fetching
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- Enable Automatic Fetching
- paypal/fetch_reports/active
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Schedule
- PayPal retains reports for 45 days.
- paypal/fetch_reports/schedule
- Magento\Paypal\Model\System\Config\Source\FetchingSchedule
- 1
-
-
- Time of Day
- paypal/fetch_reports/time
- 1
-
-
-
- Frontend Experience Settings
-
- PayPal Product Logo
- Displays on catalog pages and homepage.
- paypal/style/logo
- Magento\Paypal\Model\System\Config\Source\Logo
- 1
-
-
- PayPal Merchant Pages Style
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- Page Style
- paypal/style/page_style
-
-
-
- 1
-
-
- Header Image URL
- paypal/style/paypal_hdrimg
-
- https is highly encouraged.]]>
-
- 1
-
-
- Header Background Color
- paypal/style/paypal_hdrbackcolor
-
-
-
- 1
-
-
- Header Border Color
- paypal/style/paypal_hdrbordercolor
- 2-pixel perimeter around the header space.
- 1
-
-
- Page Background Color
- paypal/style/paypal_payflowcolor
-
-
-
- 1
-
-
- Customize Smart Buttons
- Magento\Config\Block\System\Config\Form\Field\Heading
- 1
-
-
- Checkout Page
-
- Customize Button
- paypal/style/checkout_page_button_customize
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Label
-
- paypal/style/checkout_page_button_label
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\ButtonStylesLabel
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getLabel
-
- 1
-
- 1
-
-
- Mexico Installment Period
- paypal/style/checkout_page_button_mx_installment_period
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getMxInstallmentPeriod
-
- 1
- installment
-
- 1
-
-
- Brazil Installment Period
- paypal/style/checkout_page_button_br_installment_period
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getBrInstallmentPeriod
-
- 1
- installment
-
- 1
-
-
- Layout
- paypal/style/checkout_page_button_layout
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getLayout
-
- 1
- credit
-
- 1
-
-
- Size
- paypal/style/checkout_page_button_size
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getSize
- Select Responsive to ensure the PayPal button renders correctly on mobile devices.
-
- 1
-
- 1
-
-
- Shape
- paypal/style/checkout_page_button_shape
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getShape
-
- 1
-
- 1
-
-
- Color
- paypal/style/checkout_page_button_color
- Magento\Paypal\Model\System\Config\Source\ButtonStyles::getColor
-
- 1
- credit
-
- 1
-
-
-
- Product Pages
-
- paypal/style/product_page_button_customize
-
-
- paypal/style/product_page_button_label
-
- 1
-
-
-
- paypal/style/product_page_button_mx_installment_period
-
- 1
- installment
-
-
-
- paypal/style/product_page_button_br_installment_period
-
- 1
- installment
-
-
-
- paypal/style/product_page_button_layout
-
- 1
- credit
-
-
-
- paypal/style/product_page_button_size
-
- 1
-
-
-
- paypal/style/product_page_button_shape
-
- 1
-
-
-
- paypal/style/product_page_button_color
-
- 1
- credit
-
-
-
-
- Cart Page
-
- paypal/style/cart_page_button_customize
-
-
- paypal/style/cart_page_button_label
-
- 1
-
-
-
- paypal/style/cart_page_button_mx_installment_period
-
- 1
- installment
-
-
-
- paypal/style/cart_page_button_br_installment_period
-
- 1
- installment
-
-
-
- paypal/style/cart_page_button_layout
-
- 1
- credit
-
-
-
- paypal/style/cart_page_button_size
-
- 1
-
-
-
- paypal/style/cart_page_button_shape
-
- 1
-
-
-
- paypal/style/cart_page_button_color
-
- 1
- credit
-
-
-
-
- Mini Cart
-
- paypal/style/mini_cart_page_button_customize
-
-
- paypal/style/mini_cart_page_button_label
-
- 1
-
-
-
- paypal/style/mini_cart_page_button_mx_installment_period
-
- 1
- installment
-
-
-
- paypal/style/mini_cart_page_button_br_installment_period
-
- 1
- installment
-
-
-
- paypal/style/mini_cart_page_button_layout
-
- 1
- credit
-
-
-
- paypal/style/mini_cart_page_button_size
-
- 1
-
-
-
- paypal/style/mini_cart_page_button_shape
-
- 1
-
-
-
- paypal/style/mini_cart_page_button_color
-
- 1
- credit
-
-
-
-
- Features
-
- Disable Funding Options
-
-
-
- paypal/style/disable_funding_options
- Magento\Paypal\Block\Adminhtml\System\Config\MultiSelect\DisabledFundingOptions
- Magento\Paypal\Model\System\Config\Source\DisableFundingOptions
- 1
- 1
-
-
-
-
-
-
-
- Website Payments Pro Hosted Solution
- paypal-other-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- payment/hosted_pro/active
- Includes Express Checkout)]]>
- 1
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint
-
-
- Required PayPal Settings
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Payments Pro Hosted Solution
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
-
-
-
-
-
-
-
-
-
-
-
-
- Enable this Solution
- payment/hosted_pro/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
- paypal-enabler paypal-ec-separate
-
-
-
- Learn More]]>
-
-
-
-
-
-
- Advertise PayPal Credit
-
- Why Advertise Financing?
- Give your sales a boost when you advertise financing. PayPal helps turn browsers into buyers with financing
- from PayPal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you.
- Use PayPal’s free banner ads that let you advertise PayPal Credit® financing as a payment option when your customers check out with PayPal.
- The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
- or more. See Details .]]>
-
-
-
-
- Home Page
-
-
-
- Size
- payment/paypal_express_bml/homepage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPH
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPS
-
- 1
-
-
-
-
- Catalog Category Page
-
-
-
- Size
- payment/paypal_express_bml/categorypage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPS
-
- 1
-
-
-
-
- Catalog Product Page
-
-
-
- Size
- payment/paypal_express_bml/productpage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPN
-
- 1
-
-
-
-
- Checkout Cart Page
-
-
-
- Size
- payment/paypal_express_bml/checkout_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutN
- 1
-
- 1
-
-
-
-
-
-
- Basic Settings - PayPal Payments Pro Hosted Solution
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- It is recommended to set this value to "PayPal" per store views.
- payment/hosted_pro/title
-
-
- Sort Order
- payment/hosted_pro/sort_order
- validate-number
-
-
- Payment Action
- payment/hosted_pro/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
-
-
- Display Express Checkout in the Payment Information step
- payment/hosted_pro/display_ec
- Magento\Config\Model\Config\Source\Yesno
-
-
- Advanced Settings
- config-advanced
-
- Payment Applicable From
- payment/hosted_pro/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
-
-
- Countries Payment Applicable From
- payment/hosted_pro/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
-
- 1
-
-
-
- Debug Mode
- payment/hosted_pro/debug
- Magento\Config\Model\Config\Source\Yesno
-
-
- Enable SSL verification
- payment/hosted_pro/verify_peer
- Magento\Config\Model\Config\Source\Yesno
-
-
- Settlement Report Settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Accept and process credit cards and PayPal payments.]]>
- complex paypal-other-section paypal-all-in-one-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- Choose a secure bundled payment solution for your business.
- other_paypal_payment_solutions
-
- Payments Advanced
- paypal-other-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Includes Express Checkout)]]>
- payment/payflow_advanced/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-advanced.html
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint
-
-
- Required PayPal Settings
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Payments Advanced and Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Email Associated with PayPal Merchant Account (Optional)
-
-
- Partner
- payment/payflow_advanced/partner
- 1
-
-
- Vendor
- payment/payflow_advanced/vendor
- 1
-
-
- User
- PayPal recommends that you set up an additional User on your account at manager.paypal.com
- PayPal recommends you set up an additional User on your account at manager.paypal.com, instead of entering your admin username and password here. This will enhance your security and prevent service interruptions if you later change your password. If you do not want to set up an additional User, you can re-enter your Merchant Login here.
- payment/payflow_advanced/user
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Password
- payment/payflow_advanced/pwd
- Magento\Config\Model\Config\Backend\Encrypted
- 1
-
-
- Test Mode
- payment/payflow_advanced/sandbox_flag
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Use Proxy
- payment/payflow_advanced/use_proxy
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Proxy Host
- payment/payflow_advanced/proxy_host
-
- 1
-
- 1
-
-
- Proxy Port
- payment/payflow_advanced/proxy_port
-
- 1
-
- 1
-
-
- Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Advanced
- 1
-
-
-
- Enable this Solution
- payment/payflow_advanced/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
-
-
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Hidden
-
-
-
-
-
- Learn More]]>
-
- payment/payflow_express_bml/active
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Bml
-
-
-
-
-
- payment/payflow_express_bml/sort_order
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\BmlSortOrder
-
- 1
-
-
-
- Advertise PayPal Credit
-
- Why Advertise Financing?
- Give your sales a boost when you advertise financing. PayPal helps turn browsers into buyers with financing
- from PayPal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you.
- Use PayPal’s free banner ads that let you advertise PayPal Credit® financing as a payment option when your customers check out with PayPal.
- The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
- or more. See Details .]]>
-
-
-
-
- Home Page
-
-
-
- Size
- payment/paypal_express_bml/homepage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPH
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPS
-
- 1
-
-
-
-
- Catalog Category Page
-
-
-
- Size
- payment/paypal_express_bml/categorypage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPS
-
- 1
-
-
-
-
- Catalog Product Page
-
-
-
- Size
- payment/paypal_express_bml/productpage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPN
-
- 1
-
-
-
-
-
- Checkout Cart Page
-
-
-
- Size
- payment/paypal_express_bml/checkout_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutN
- 1
-
- 1
-
-
-
-
-
-
- Basic Settings - PayPal Payments Advanced
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- It is recommended to set this value to "Debit or Credit Card" per store views.
- payment/payflow_advanced/title
- 1
-
-
- Sort Order
- payment/payflow_advanced/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/payflow_advanced/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
- 1
-
-
- Advanced Settings
- config-advanced
-
- Payment Applicable From
- payment/payflow_advanced/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/payflow_advanced/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
-
- 1
-
- 1
-
-
- Debug Mode
- payment/payflow_advanced/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/payflow_advanced/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- CVV Entry is Editable
- payment/payflow_advanced/csc_editable
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Require CVV Entry
- payment/payflow_advanced/csc_required
- Magento\Config\Model\Config\Source\Yesno
-
- 1
-
- 1
-
-
- Send Email Confirmation
- payment/payflow_advanced/email_confirmation
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- URL method for Cancel URL and Return URL
- payment/payflow_advanced/url_method
- Magento\Paypal\Model\System\Config\Source\UrlMethod
- 1
-
-
- Settlement Report Settings
-
-
-
-
-
-
-
-
-
-
-
-
- Frontend Experience Settings
-
-
-
-
-
-
-
-
-
-
-
- Basic Settings - PayPal Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
-
-
-
-
-
-
-
- Payments Pro
- payment/paypal_payment_pro/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html
-
-
-
- 0
- payment/paypal_payment_pro/active
-
-
- Payments Pro and Express Checkout
-
-
-
- Basic Settings - PayPal Payments Pro
-
-
-
- Payments Standard
- Accept credit card and PayPal payments securely.
- payment/wps_express/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html
-
-
-
-
-
- Payments Standard
-
-
- payment/wps_express/active
-
-
- payment/wps_express_bml/active
-
-
-
- Basic Settings - PayPal Website Payments Standard
-
-
-
-
- Process payments using your own internet merchant account.]]>
- complex paypal-other-section paypal-gateways-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- other_paypal_payment_solutions
-
- Payflow Pro
- 0
-
- Required PayPal Settings
-
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
-
- Payflow Pro and Express Checkout
-
- not-required
- Email Associated with PayPal Merchant Account (Optional)
- 1
-
-
-
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Hidden
-
-
-
-
-
- Enable PayPal Credit
- Learn More]]>
-
- payment/payflow_express_bml/active
- Magento\Config\Model\Config\Source\Yesno
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Bml
-
-
-
-
-
- payment/payflow_express_bml/sort_order
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Depends\BmlSortOrder
-
- 1
-
-
-
- Advertise PayPal Credit
-
- Why Advertise Financing?
- Give your sales a boost when you advertise financing. PayPal helps turn browsers into buyers with financing
- from PayPal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you.
- Use PayPal’s free banner ads that let you advertise PayPal Credit® financing as a payment option when your customers check out with PayPal.
- The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
- or more. See Details .]]>
-
-
-
-
- Home Page
-
-
-
- Size
- payment/paypal_express_bml/homepage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPH
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeHPS
-
- 1
-
-
-
-
- Catalog Category Page
-
-
-
- Size
- payment/paypal_express_bml/categorypage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCCPS
-
- 1
-
-
-
-
- Catalog Product Page
-
-
-
- Size
- payment/paypal_express_bml/productpage_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCPPN
-
- 1
-
-
-
-
- Checkout Cart Page
-
-
-
- Size
- payment/paypal_express_bml/checkout_size
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutC
- 1
-
- 0
-
-
-
- Magento\Paypal\Model\System\Config\Source\BmlSize::getBmlSizeCheckoutN
- 1
-
- 1
-
-
-
-
-
-
-
-
- Frontend Experience Settings
-
-
-
-
-
-
-
-
-
-
-
- Basic Settings - PayPal Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
- Title
- payment/payflow_express/title
- 1
-
-
- Sort Order
- payment/payflow_express/sort_order
- validate-number
- 1
-
-
- Payment Action
- payment/payflow_express/payment_action
- Magento\Paypal\Model\System\Config\Source\PaymentActions
- 1
-
-
- Display on Product Details Page
- payment/payflow_express/visible_on_product
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Advanced Settings
- config-advanced
-
- Display on Shopping Cart
- Also affects mini-shopping cart.
- payment/payflow_express/visible_on_cart
- Magento\Paypal\Model\System\Config\Source\Yesnoshortcut
- 1
-
-
- Payment Applicable From
- payment/payflow_express/allowspecific
- Magento\Payment\Model\Config\Source\Allspecificcountries
- 1
-
-
- Countries Payment Applicable From
- payment/payflow_express/specificcountry
- Magento\Paypal\Model\System\Config\Source\BuyerCountry
-
- 1
-
- 1
-
-
- Debug Mode
- payment/payflow_express/debug
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Enable SSL verification
- payment/payflow_express/verify_peer
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
- Transfer Cart Line Items
- payment/payflow_express/line_items_enabled
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
-
-
-
-
-
-
- PayPal Express Checkout
- complex paypal-express-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Add another payment method to your existing solution or as a stand-alone option.
- https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content
- 0
- payment/paypal_express/active
- payment/payflow_express/active
- recommended_solutions
-
-
-
-
-
- Accept and process credit cards and PayPal payments.]]>
- complex paypal-other-section paypal-all-in-one-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- Choose a secure bundled payment solution for your business.
- https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup
- other_paypal_payment_solutions
-
- pp-general-uk
- http://www.youtube.com/watch?v=LBe-TW87eGI&list=PLF18B1094ABCD7CE8&index=1&feature=plpp_video
- Accept payments with a completely customizable checkout page.
-
-
-
-
-
-
-
- Website Payments Pro Hosted Solution
- 0
-
-
- Website Payments Pro Hosted Solution and Express Checkout
-
-
-
-
-
- paypal-enabler
-
-
-
- Basic Settings - PayPal Website Payments Pro Hosted Solution
-
-
- PayPal Billing Agreement Settings
-
-
-
-
-
-
-
-
-
-
-
-
- Frontend Experience Settings
-
-
-
-
-
-
-
-
-
-
-
- Basic Settings - PayPal Express Checkout
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
-
-
-
-
-
-
-
-
- Advanced Settings
- config-advanced
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Website Payments Standard
- Accept credit card and PayPal payments securely.
- payment/wps_express/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html
-
-
-
- Website Payments Standard
-
-
- payment/wps_express/active
-
-
-
-
-
-
-
-
- Basic Settings - PayPal Website Payments Standard
-
-
-
-
-
- PayPal Express Checkout
- complex paypal-express-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Add another payment method to your existing solution or as a stand-alone option.
- https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content
- recommended_solutions
-
-
-
-
-
-
-
-
-
-
-
- PayPal Express Checkout
- complex paypal-express-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Add another payment method to your existing solution or as a stand-alone option.
- https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup
- recommended_solutions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PayPal Express Checkout
- complex paypal-express-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Add another payment method to your existing solution or as a stand-alone option.
- https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup
- recommended_solutions
-
-
-
-
-
-
-
- Accept and process credit cards and PayPal payments.]]>
- complex paypal-other-section paypal-all-in-one-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- Choose a secure bundled payment solution for your business.
- https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup
- other_paypal_payment_solutions
-
- Website Payments Standard
- complex
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
- Accept credit card and PayPal payments securely.
- payment/wps_express/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html
-
-
-
- Website Payments Standard
-
-
-
-
- payment/wps_express/active
-
-
-
-
-
-
- Basic Settings - PayPal Website Payments Standard
-
-
-
-
- Process payments using your own internet merchant account.]]>
- complex paypal-other-section paypal-gateways-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- Process payments using your own internet merchant account.
- https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content
- other_paypal_payment_solutions
-
-
-
-
- payment/paypal_express/active
- payment/payflow_express/active
-
-
-
-
-
- complex paypal-other-section paypal-gateways-section
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
- Process payments using your own internet merchant account.]]>
-
- Website Payments Pro
- payment/paypal_payment_pro/active
-
- http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html
-
-
-
- Payments Pro
-
-
-
-
- paypal-enabler paypal-ec-pe
- 0
- payment/paypal_payment_pro/active
- Magento\Paypal\Block\Adminhtml\System\Config\Field\Enable\Payment
-
-
-
- Basic Settings - PayPal Payments Pro
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Website Payments Plus
-
-
-
-
-
-
-
-
- Integral Evolution
-
-
-
-
-
-
-
-
-
- Pasarela integral
-
-
-
-
-
-
-
diff --git a/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php b/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php
index 49acd039a0960..3f477f7ce5033 100644
--- a/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php
+++ b/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php
@@ -301,8 +301,8 @@ public function validateDescriptionFormatStructure(
$this->validateShortDescriptionFormat(
$phpcsFile,
(int) $shortPtr,
- $commentStartPtr,
- $commentEndPtr,
+ (int)$commentStartPtr,
+ (int)$commentEndPtr,
$emptyTypeTokens
);
}
diff --git a/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php b/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php
index 01834ff81e81b..c37f0b500fe39 100644
--- a/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php
+++ b/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php
@@ -97,8 +97,8 @@ public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$previousCommentClosePtr = $phpcsFile->findPrevious(T_DOC_COMMENT_CLOSE_TAG, $stackPtr - 1, 0);
- $this->validateAnnotationBlockExists($phpcsFile, $previousCommentClosePtr, $stackPtr);
- $commentStartPtr = $phpcsFile->findPrevious(T_DOC_COMMENT_OPEN_TAG, $stackPtr - 1, 0);
+ $this->validateAnnotationBlockExists($phpcsFile, (int)$previousCommentClosePtr, (int)$stackPtr);
+ $commentStartPtr = (int)$phpcsFile->findPrevious(T_DOC_COMMENT_OPEN_TAG, $stackPtr - 1, 0);
$commentCloserPtr = $tokens[$commentStartPtr]['comment_closer'];
$emptyTypeTokens = [
T_DOC_COMMENT_WHITESPACE,
@@ -111,7 +111,7 @@ public function process(File $phpcsFile, $stackPtr)
} else {
$this->annotationFormatValidator->validateDescriptionFormatStructure(
$phpcsFile,
- $commentStartPtr,
+ (int)$commentStartPtr,
(int) $shortPtr,
$previousCommentClosePtr,
$emptyTypeTokens
diff --git a/lib/internal/Magento/Framework/Crontab/CrontabManager.php b/lib/internal/Magento/Framework/Crontab/CrontabManager.php
index 6049b7fba6d44..da81540faf477 100644
--- a/lib/internal/Magento/Framework/Crontab/CrontabManager.php
+++ b/lib/internal/Magento/Framework/Crontab/CrontabManager.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
+
namespace Magento\Framework\Crontab;
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -40,31 +41,35 @@ public function __construct(
}
/**
+ * Build tasks block start text.
+ *
* @return string
*/
private function getTasksBlockStart()
{
$tasksBlockStart = self::TASKS_BLOCK_START;
if (defined('BP')) {
- $tasksBlockStart .= ' ' . md5(BP);
+ $tasksBlockStart .= ' ' . hash("sha256", BP);
}
return $tasksBlockStart;
}
/**
+ * Build tasks block end text.
+ *
* @return string
*/
private function getTasksBlockEnd()
{
$tasksBlockEnd = self::TASKS_BLOCK_END;
if (defined('BP')) {
- $tasksBlockEnd .= ' ' . md5(BP);
+ $tasksBlockEnd .= ' ' . hash("sha256", BP);
}
return $tasksBlockEnd;
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getTasks()
{
@@ -82,7 +87,7 @@ public function getTasks()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function saveTasks(array $tasks)
{
@@ -118,8 +123,7 @@ public function saveTasks(array $tasks)
}
/**
- * {@inheritdoc}
- * @throws LocalizedException
+ * @inheritdoc
*/
public function removeTasks()
{
@@ -182,7 +186,7 @@ private function cleanMagentoSection($content)
private function getCrontabContent()
{
try {
- $content = (string)$this->shell->execute('crontab -l');
+ $content = (string)$this->shell->execute('crontab -l 2>/dev/null');
} catch (LocalizedException $e) {
return '';
}
@@ -203,6 +207,7 @@ private function save($content)
try {
$this->shell->execute('echo "' . $content . '" | crontab -');
+ // phpcs:disable Magento2.Exceptions.ThrowCatch
} catch (LocalizedException $e) {
throw new LocalizedException(
new Phrase('Error during saving of crontab: %1', [$e->getPrevious()->getMessage()]),
diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
index b160eb0a7f95e..f6c863d9d9fad 100644
--- a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
+++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
+
namespace Magento\Framework\Crontab\Test\Unit;
use Magento\Framework\Crontab\CrontabManager;
@@ -16,6 +17,9 @@
use Magento\Framework\Filesystem\Directory\ReadInterface;
use Magento\Framework\Filesystem\DriverPool;
+/**
+ * Tests crontab manager functionality.
+ */
class CrontabManagerTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -58,7 +62,7 @@ public function testGetTasksNoCrontab()
$this->shellMock->expects($this->once())
->method('execute')
- ->with('crontab -l', [])
+ ->with('crontab -l 2>/dev/null', [])
->willThrowException($localizedException);
$this->assertEquals([], $this->crontabManager->getTasks());
@@ -74,7 +78,7 @@ public function testGetTasks($content, $tasks)
{
$this->shellMock->expects($this->once())
->method('execute')
- ->with('crontab -l', [])
+ ->with('crontab -l 2>/dev/null', [])
->willReturn($content);
$this->assertEquals($tasks, $this->crontabManager->getTasks());
@@ -88,17 +92,17 @@ public function getTasksDataProvider()
return [
[
'content' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento cron:run' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
'tasks' => ['* * * * * /bin/php /var/www/magento/bin/magento cron:run'],
],
[
'content' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento cron:run' . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento setup:cron:run' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
'tasks' => [
'* * * * * /bin/php /var/www/magento/bin/magento cron:run',
'* * * * * /bin/php /var/www/magento/bin/magento setup:cron:run',
@@ -127,7 +131,7 @@ public function testRemoveTasksWithException()
$this->shellMock->expects($this->at(0))
->method('execute')
- ->with('crontab -l', [])
+ ->with('crontab -l 2>/dev/null', [])
->willReturn('');
$this->shellMock->expects($this->at(1))
@@ -148,7 +152,7 @@ public function testRemoveTasks($contentBefore, $contentAfter)
{
$this->shellMock->expects($this->at(0))
->method('execute')
- ->with('crontab -l', [])
+ ->with('crontab -l 2>/dev/null', [])
->willReturn($contentBefore);
$this->shellMock->expects($this->at(1))
@@ -166,17 +170,17 @@ public function removeTasksDataProvider()
return [
[
'contentBefore' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento cron:run' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
'contentAfter' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
],
[
'contentBefore' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento cron:run' . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento setup:cron:run' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
'contentAfter' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
],
[
@@ -276,7 +280,7 @@ public function testSaveTasks($tasks, $content, $contentToSave)
$this->shellMock->expects($this->at(0))
->method('execute')
- ->with('crontab -l', [])
+ ->with('crontab -l 2>/dev/null', [])
->willReturn($content);
$this->shellMock->expects($this->at(1))
@@ -292,9 +296,9 @@ public function testSaveTasks($tasks, $content, $contentToSave)
public function saveTasksDataProvider()
{
$content = '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * /bin/php /var/www/magento/bin/magento cron:run' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL;
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL;
return [
[
@@ -303,9 +307,9 @@ public function saveTasksDataProvider()
],
'content' => $content,
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' run.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
],
[
'tasks' => [
@@ -313,9 +317,9 @@ public function saveTasksDataProvider()
],
'content' => $content,
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '1 2 3 4 5 ' . PHP_BINARY . ' run.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
],
[
'tasks' => [
@@ -323,10 +327,10 @@ public function saveTasksDataProvider()
],
'content' => $content,
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php >>'
. ' /var/www/magento2/var/log/cron.log' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
],
[
'tasks' => [
@@ -334,10 +338,10 @@ public function saveTasksDataProvider()
],
'content' => $content,
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php'
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
],
[
'tasks' => [
@@ -345,10 +349,10 @@ public function saveTasksDataProvider()
],
'content' => '* * * * * /bin/php /var/www/cron.php',
'contentToSave' => '* * * * * /bin/php /var/www/cron.php' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . md5(BP) . PHP_EOL
+ . CrontabManagerInterface::TASKS_BLOCK_START . ' ' . hash("sha256", BP) . PHP_EOL
. '* * * * * ' . PHP_BINARY . ' /var/www/magento2/run.php'
. ' %% cron:run | grep -v \"Ran \'jobs\' by schedule\"' . PHP_EOL
- . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . md5(BP) . PHP_EOL,
+ . CrontabManagerInterface::TASKS_BLOCK_END . ' ' . hash("sha256", BP) . PHP_EOL,
],
];
}
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Label.php b/lib/internal/Magento/Framework/Data/Form/Element/Label.php
index 901dcb5289e8d..70b7885e7a0d0 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Label.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Label.php
@@ -4,13 +4,13 @@
* See COPYING.txt for license details.
*/
-/**
- * Data form abstract class
- *
- * @author Magento Core Team
- */
namespace Magento\Framework\Data\Form\Element;
+use Magento\Framework\Phrase;
+
+/**
+ * Label form element.
+ */
class Label extends \Magento\Framework\Data\Form\Element\AbstractElement
{
/**
@@ -37,8 +37,13 @@ public function __construct(
public function getElementHtml()
{
$html = $this->getBold() ? '' : '
';
- $html .= $this->getEscapedValue() . '
';
+ if (is_string($this->getValue()) || $this->getValue() instanceof Phrase) {
+ $html .= $this->getEscapedValue();
+ }
+
+ $html .= '
';
$html .= $this->getAfterElementHtml();
+
return $html;
}
}
diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php
index 51e7ea9be0c24..d4c98cda17e12 100644
--- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php
+++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Query/Builder/Match.php
@@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Framework\Search\Adapter\Mysql\Query\Builder;
use Magento\Framework\DB\Helper\Mysql\Fulltext;
@@ -28,7 +30,7 @@ class Match implements QueryInterface
*/
const SPECIAL_CHARACTERS = '-+~/\\<>\'":*$#@()!,.?`=%&^';
- const MINIMAL_CHARACTER_LENGTH = 3;
+ const MINIMAL_CHARACTER_LENGTH = 1;
/**
* @var string[]
diff --git a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd
index 39cdec05a65ea..6486b39070788 100755
--- a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd
+++ b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd
@@ -313,6 +313,7 @@
+
diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js
index 18d71aad2071a..cfcdef0b701c9 100644
--- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js
+++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js
@@ -132,7 +132,7 @@ define([
attributes.type = attributes.type.replace(/\\\\/g, '\\');
imageSrc = config.placeholders[attributes.type];
- if (config.types.indexOf(attributes['type_name']) > -1) {
+ if (imageSrc) {
imageHtml += '';
} else {
@@ -147,8 +147,8 @@ define([
imageHtml += ' src="' + imageSrc + '"';
imageHtml += ' />';
- if (attributes['type_name']) {
- imageHtml += attributes['type_name'];
+ if (config.types[attributes.type]) {
+ imageHtml += config.types[attributes.type];
}
imageHtml += ' ';
diff --git a/lib/web/mage/gallery/gallery.js b/lib/web/mage/gallery/gallery.js
index 2ed3f8b0d620c..be78856b21fcd 100644
--- a/lib/web/mage/gallery/gallery.js
+++ b/lib/web/mage/gallery/gallery.js
@@ -141,7 +141,7 @@ define([
this.setupBreakpoints();
this.initFullscreenSettings();
- this.settings.$element.on('mousedown', '.fotorama__stage__frame', function () {
+ this.settings.$element.on('click', '.fotorama__stage__frame', function () {
if (
!$(this).parents('.fotorama__shadows--left, .fotorama__shadows--right').length &&
!$(this).hasClass('fotorama-video-container')
diff --git a/lib/web/mage/gallery/gallery.less b/lib/web/mage/gallery/gallery.less
index 373708ac35a00..2c3476732caad 100644
--- a/lib/web/mage/gallery/gallery.less
+++ b/lib/web/mage/gallery/gallery.less
@@ -977,12 +977,9 @@
// While first time init
.gallery-placeholder {
- .loading-mask {
- padding: 0 0 50%;
- position: static;
- }
- .loader img {
- position: absolute;
+ &__image {
+ display: block;
+ margin: auto;
}
}
@@ -1003,6 +1000,7 @@
display: block;
}
}
+
.fotorama__product-video--loaded {
.fotorama__img, .fotorama__img--full {
display: none !important;
diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx
index 2035da9d58265..cfabe613a0ea1 100644
--- a/setup/performance-toolkit/benchmark.jmx
+++ b/setup/performance-toolkit/benchmark.jmx
@@ -409,9 +409,9 @@
${__P(graphqlGetNavigationMenuByCategoryIdPercentage,0)}
=
-
- graphqlGetProductSearchByProductNamePercentage
- ${__P(graphqlGetProductSearchByProductNamePercentage,0)}
+
+ graphqlGetProductDetailByProductNamePercentage
+ ${__P(graphqlGetProductDetailByProductNamePercentage,0)}
=
@@ -39803,11 +39803,11 @@ vars.put("product_sku", product.get("sku"));
-
+
1
false
1
- ${graphqlGetProductSearchByProductNamePercentage}
+ ${graphqlGetProductDetailByProductNamePercentage}
mpaf/tool/fragments/_system/scenario_controller_tmpl.jmx
@@ -39828,7 +39828,7 @@ if (testLabel
- vars.put("testLabel", "Get Product Search by product_name");
+ vars.put("testLabel", "Get Product Detail by product_name");
true
@@ -39866,13 +39866,13 @@ vars.putObject("randomIntGenerator", random);
-
+
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);
+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"));
@@ -39883,10 +39883,10 @@ vars.put("product_sku", product.get("sku"));
true
- mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/simple_products_setup.jmx
+ mpaf/tool/fragments/ce/product_browsing_and_adding_items_to_the_cart/configurable_products_setup.jmx
-
+
true
@@ -39911,7 +39911,7 @@ vars.put("product_sku", product.get("sku"));
false
false
- mpaf/tool/fragments/ce/graphql/get_product_search_by_product_name.jmx
+ mpaf/tool/fragments/ce/graphql/get_product_detail_by_product_name.jmx
@@ -40782,6 +40782,239 @@ vars.put("product_sku", product.get("sku"));
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n updateCartItems(input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n cart_item_id: ${item_id}\n quantity: 5\n }\n ]\n }) {\n cart {\n items {\n id\n qty\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/update_simple_product_qty_in_cart.jmx
+
+
+
+
+ {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","qty":5}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setBillingAddressOnCart(\n input: {\n cart_id: \"${quote_id}\"\n billing_address: {\n address: {\n firstname: \"test firstname\"\n lastname: \"test lastname\"\n company: \"test company\"\n street: [\"test street 1\", \"test street 2\"]\n city: \"test city\"\n region: \"test region\"\n postcode: \"887766\"\n country_code: \"US\"\n telephone: \"88776655\"\n save_in_address_book: false\n }\n }\n }\n ) {\n cart {\n billing_address {\n firstname\n lastname\n company\n street\n city\n postcode\n telephone\n country {\n code\n label\n }\n address_type\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_billing_address_on_cart.jmx
+
+
+
+
+ {"data":{"setBillingAddressOnCart":{"cart":{"billing_address":{"firstname":"test firstname","lastname":"test lastname","company":"test company","street":["test street 1","test street 2"],"city":"test city","postcode":"887766","telephone":"88776655","country":{"code":"US","label":"US"},"address_type":"BILLING"}}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setShippingAddressesOnCart(\n input: {\n cart_id: \"${quote_id}\"\n shipping_addresses: [\n {\n address: {\n firstname: \"test firstname\"\n lastname: \"test lastname\"\n company: \"test company\"\n street: [\"test street 1\", \"test street 2\"]\n city: \"test city\"\n region: \"test region\"\n postcode: \"887766\"\n country_code: \"US\"\n telephone: \"88776655\"\n save_in_address_book: false\n }\n }\n ]\n }\n ) {\n cart {\n shipping_addresses {\n firstname\n lastname\n company\n street\n city\n postcode\n telephone\n country {\n code\n label\n }\n address_type\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_shipping_address_on_cart.jmx
+
+
+
+
+ {"data":{"setShippingAddressesOnCart":{"cart":{"shipping_addresses":[{"firstname":"test firstname","lastname":"test lastname","company":"test company","street":["test street 1","test street 2"],"city":"test city","postcode":"887766","telephone":"88776655","country":{"code":"US","label":"US"},"address_type":"SHIPPING"}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setPaymentMethodOnCart(input: {\n cart_id: \"${quote_id}\", \n payment_method: {\n code: \"checkmo\"\n }\n }) {\n cart {\n selected_payment_method {\n code\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_payment_method_on_cart.jmx
+
+
+
+
+ {"data":{"setPaymentMethodOnCart":{"cart":{"selected_payment_method":{"code":"checkmo"}}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"{\n cart(cart_id: \"${quote_id}\") {\n shipping_addresses {\n address_id\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/get_current_shipping_address.jmx
+
+
+
+ address_id
+ $.data.cart.shipping_addresses[0].address_id
+
+
+ BODY
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setShippingMethodsOnCart(input: \n {\n cart_id: \"${quote_id}\", \n shipping_methods: [{\n cart_address_id: ${address_id}\n carrier_code: \"flatrate\"\n method_code: \"flatrate\"\n }]\n }) {\n cart {\n shipping_addresses {\n selected_shipping_method {\n carrier_code\n method_code\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_shipping_method_on_cart.jmx
+
+
+
+
+ {"data":{"setShippingMethodsOnCart":{"cart":{"shipping_addresses":[{"selected_shipping_method":{"carrier_code":"flatrate","method_code":"flatrate"}}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
true
@@ -41070,6 +41303,239 @@ vars.put("product_sku", product.get("sku"));
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n updateCartItems(input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n cart_item_id: ${item_id}\n quantity: 5\n }\n ]\n }) {\n cart {\n items {\n id\n qty\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/update_configurable_product_qty_in_cart.jmx
+
+
+
+
+ {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","qty":5}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setBillingAddressOnCart(\n input: {\n cart_id: \"${quote_id}\"\n billing_address: {\n address: {\n firstname: \"test firstname\"\n lastname: \"test lastname\"\n company: \"test company\"\n street: [\"test street 1\", \"test street 2\"]\n city: \"test city\"\n region: \"test region\"\n postcode: \"887766\"\n country_code: \"US\"\n telephone: \"88776655\"\n save_in_address_book: false\n }\n }\n }\n ) {\n cart {\n billing_address {\n firstname\n lastname\n company\n street\n city\n postcode\n telephone\n country {\n code\n label\n }\n address_type\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_billing_address_on_cart.jmx
+
+
+
+
+ {"data":{"setBillingAddressOnCart":{"cart":{"billing_address":{"firstname":"test firstname","lastname":"test lastname","company":"test company","street":["test street 1","test street 2"],"city":"test city","postcode":"887766","telephone":"88776655","country":{"code":"US","label":"US"},"address_type":"BILLING"}}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setShippingAddressesOnCart(\n input: {\n cart_id: \"${quote_id}\"\n shipping_addresses: [\n {\n address: {\n firstname: \"test firstname\"\n lastname: \"test lastname\"\n company: \"test company\"\n street: [\"test street 1\", \"test street 2\"]\n city: \"test city\"\n region: \"test region\"\n postcode: \"887766\"\n country_code: \"US\"\n telephone: \"88776655\"\n save_in_address_book: false\n }\n }\n ]\n }\n ) {\n cart {\n shipping_addresses {\n firstname\n lastname\n company\n street\n city\n postcode\n telephone\n country {\n code\n label\n }\n address_type\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_shipping_address_on_cart.jmx
+
+
+
+
+ {"data":{"setShippingAddressesOnCart":{"cart":{"shipping_addresses":[{"firstname":"test firstname","lastname":"test lastname","company":"test company","street":["test street 1","test street 2"],"city":"test city","postcode":"887766","telephone":"88776655","country":{"code":"US","label":"US"},"address_type":"SHIPPING"}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setPaymentMethodOnCart(input: {\n cart_id: \"${quote_id}\", \n payment_method: {\n code: \"checkmo\"\n }\n }) {\n cart {\n selected_payment_method {\n code\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_payment_method_on_cart.jmx
+
+
+
+
+ {"data":{"setPaymentMethodOnCart":{"cart":{"selected_payment_method":{"code":"checkmo"}}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"{\n cart(cart_id: \"${quote_id}\") {\n shipping_addresses {\n address_id\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/get_current_shipping_address.jmx
+
+
+
+ address_id
+ $.data.cart.shipping_addresses[0].address_id
+
+
+ BODY
+
+
+
+
+
+ true
+
+
+
+ false
+ {"query":"mutation {\n setShippingMethodsOnCart(input: \n {\n cart_id: \"${quote_id}\", \n shipping_methods: [{\n cart_address_id: ${address_id}\n carrier_code: \"flatrate\"\n method_code: \"flatrate\"\n }]\n }) {\n cart {\n shipping_addresses {\n selected_shipping_method {\n carrier_code\n method_code\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ =
+
+
+
+
+ ${graphql_port_number}
+ 60000
+ 200000
+ ${request_protocol}
+
+ ${base_path}graphql
+ POST
+ true
+ false
+ true
+ false
+ false
+
+ mpaf/tool/fragments/ce/graphql/set_shipping_method_on_cart.jmx
+
+
+
+
+ {"data":{"setShippingMethodsOnCart":{"cart":{"shipping_addresses":[{"selected_shipping_method":{"carrier_code":"flatrate","method_code":"flatrate"}}]}}}}
+
+ Assertion.response_data
+ false
+ 8
+
+
+
+
true