From 9a7f3e6c567b1b83d920655be75176daaa66b4c8 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Thu, 11 Oct 2018 22:47:36 +0200 Subject: [PATCH 001/318] allows to define argument shareable state --- .../layout/adminhtml_notification_block.xml | 2 +- .../adminhtml/layout/catalog_search_block.xml | 2 +- .../layout/adminhtml_cache_block.xml | 2 +- .../adminhtml_system_design_grid_block.xml | 2 +- .../adminhtml_system_store_grid_block.xml | 2 +- .../adminhtml/layout/backup_index_block.xml | 2 +- .../layout/catalog_product_set_block.xml | 2 +- .../catalog_rule_promo_catalog_block.xml | 2 +- .../adminhtml_email_template_grid_block.xml | 2 +- .../layout/groupedproduct_popup_grid.xml | 2 +- .../layout/adminhtml_history_grid_block.xml | 2 +- .../layout/indexer_indexer_list_grid.xml | 2 +- .../adminhtml_integration_grid_block.xml | 2 +- .../layout/newsletter_problem_block.xml | 2 +- .../layout/newsletter_queue_grid_block.xml | 2 +- .../layout/newsletter_subscriber_block.xml | 2 +- .../layout/adminhtml_paypal_reports_block.xml | 2 +- .../paypal_billing_agreement_ordersgrid.xml | 2 +- .../layout/paypal_billing_agreement_view.xml | 2 +- .../reports_report_customer_accounts_grid.xml | 2 +- .../reports_report_customer_orders_grid.xml | 2 +- .../reports_report_customer_totals_grid.xml | 2 +- .../adminhtml/layout/reports_report_grid.xml | 2 +- .../reports_report_product_lowstock_grid.xml | 2 +- .../reports_report_product_sold_grid.xml | 2 +- .../reports_report_review_customer_grid.xml | 2 +- .../reports_report_review_product_grid.xml | 2 +- .../reports_report_statistics_index.xml | 2 +- .../view/adminhtml/layout/rating_block.xml | 2 +- .../sales_order_create_customer_block.xml | 2 +- .../sales_order_creditmemo_grid_block.xml | 2 +- .../layout/sales_order_invoice_grid_block.xml | 2 +- .../sales_order_shipment_grid_block.xml | 2 +- .../layout/sales_order_status_index.xml | 2 +- .../sales_order_transactions_grid_block.xml | 2 +- .../layout/sales_transaction_child_block.xml | 2 +- .../layout/sales_transactions_grid_block.xml | 2 +- .../layout/sales_rule_promo_quote_index.xml | 2 +- .../adminhtml/layout/search_term_block.xml | 2 +- .../layout/search_term_grid_block.xml | 2 +- .../layout/search_term_report_block.xml | 2 +- .../adminhtml_sitemap_index_grid_block.xml | 2 +- .../view/adminhtml/layout/tax_rate_block.xml | 2 +- .../view/adminhtml/layout/tax_rule_block.xml | 2 +- .../adminhtml_system_design_theme_block.xml | 2 +- .../layout/adminhtml_url_rewrite_index.xml | 2 +- .../layout/adminhtml_locks_block.xml | 2 +- .../layout/adminhtml_user_grid_block.xml | 2 +- .../layout/adminhtml_user_role_grid_block.xml | 2 +- .../adminhtml_system_variable_grid_block.xml | 2 +- .../adminhtml_widget_instance_block.xml | 2 +- .../layout/customer_index_wishlist.xml | 2 +- .../Argument/Interpreter/DataObject.php | 30 +++++-- .../Framework/View/Layout/etc/elements.xsd | 1 + .../Argument/Interpreter/ObjectTest.php | 86 ++++++++++++++++++- 55 files changed, 160 insertions(+), 61 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/adminhtml_notification_block.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/adminhtml_notification_block.xml index c68313211c2e6..06fd380cb2a44 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/layout/adminhtml_notification_block.xml +++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/adminhtml_notification_block.xml @@ -11,7 +11,7 @@ notificationGrid - Magento\AdminNotification\Model\ResourceModel\Grid\Collection + Magento\AdminNotification\Model\ResourceModel\Grid\Collection DESC date_added 1 diff --git a/app/code/Magento/AdvancedSearch/view/adminhtml/layout/catalog_search_block.xml b/app/code/Magento/AdvancedSearch/view/adminhtml/layout/catalog_search_block.xml index b6ef596281e51..f3544863348ec 100644 --- a/app/code/Magento/AdvancedSearch/view/adminhtml/layout/catalog_search_block.xml +++ b/app/code/Magento/AdvancedSearch/view/adminhtml/layout/catalog_search_block.xml @@ -11,7 +11,7 @@ catalog_search_grid - Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection + Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection name ASC 1 diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml index 50d210f71025b..6d2ecd8d36a99 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml @@ -11,7 +11,7 @@ cache_grid - Magento\Backend\Model\Cache\ResourceModel\Grid\Collection + Magento\Backend\Model\Cache\ResourceModel\Grid\Collection 0 diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml index b96614f4bd8db..41bfe6e78a2ad 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml @@ -11,7 +11,7 @@ designGrid - Magento\Theme\Model\ResourceModel\Design\Collection + Magento\Theme\Model\ResourceModel\Design\Collection 1 1 diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml index 126de5eb4084f..d0c0d8fcbf69b 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml @@ -12,7 +12,7 @@ storeGrid 1 - Magento\Store\Model\ResourceModel\Website\Grid\Collection + Magento\Store\Model\ResourceModel\Website\Grid\Collection diff --git a/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml b/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml index e17618b97e21f..e3e984d933f25 100644 --- a/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml +++ b/app/code/Magento/Backup/view/adminhtml/layout/backup_index_block.xml @@ -11,7 +11,7 @@ backupsGrid - Magento\Backup\Model\Fs\Collection + Magento\Backup\Model\Fs\Collection time desc diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml index 44884897461a8..4e7396608826b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml @@ -11,7 +11,7 @@ setGrid - Magento\Eav\Model\ResourceModel\Entity\Attribute\Grid\Collection + Magento\Eav\Model\ResourceModel\Entity\Attribute\Grid\Collection set_name ASC 1 diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml index 99d64ed7a635f..f38f6e0fcd850 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml @@ -11,7 +11,7 @@ promo_catalog_grid - Magento\CatalogRule\Model\ResourceModel\Grid\Collection + Magento\CatalogRule\Model\ResourceModel\Grid\Collection name ASC 1 diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml index fa15560817dd9..87da146d8ce56 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml @@ -11,7 +11,7 @@ systemEmailTemplateGrid - Magento\Email\Model\ResourceModel\Template\Collection + Magento\Email\Model\ResourceModel\Template\Collection 1 1 diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml index 503404c6cb3cf..fab7851df5bc4 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml @@ -11,7 +11,7 @@ grouped_grid_popup - Magento\GroupedProduct\Model\ResourceModel\Product\Type\Grouped\AssociatedProductsCollection + Magento\GroupedProduct\Model\ResourceModel\Product\Type\Grouped\AssociatedProductsCollection 1 id ASC diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml index 02fc198cb0ada..51e5827c8ab98 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml @@ -11,7 +11,7 @@ importHistoryGrid - Magento\ImportExport\Model\ResourceModel\History\Collection + Magento\ImportExport\Model\ResourceModel\History\Collection history_id desc diff --git a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml index bf6b2351f75f1..f1099c4133bca 100644 --- a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml +++ b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml @@ -13,7 +13,7 @@ 0 0 gridIndexer - Magento\Indexer\Ui\DataProvider\Indexer\DataCollection + Magento\Indexer\Ui\DataProvider\Indexer\DataCollection diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml index 506f836f99514..43b67d6904f1a 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml @@ -13,7 +13,7 @@ integrationGrid - Magento\Integration\Model\ResourceModel\Integration\Collection + Magento\Integration\Model\ResourceModel\Integration\Collection 1 integration_id asc diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_problem_block.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_problem_block.xml index 3eb7de194d242..008cb9c003e5f 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_problem_block.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_problem_block.xml @@ -11,7 +11,7 @@ problemGrid - Magento\Newsletter\Model\ResourceModel\Grid\Collection + Magento\Newsletter\Model\ResourceModel\Grid\Collection true true 1 diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_grid_block.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_grid_block.xml index 3bfb52157bb99..8a2c891c68f81 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_grid_block.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_grid_block.xml @@ -11,7 +11,7 @@ queueGrid - Magento\Newsletter\Model\ResourceModel\Queue\Grid\Collection + Magento\Newsletter\Model\ResourceModel\Queue\Grid\Collection start_at DESC 1 diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_subscriber_block.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_subscriber_block.xml index 9de1807af18ec..e8600c2d49d7b 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_subscriber_block.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_subscriber_block.xml @@ -11,7 +11,7 @@ subscriberGrid - Magento\Newsletter\Model\ResourceModel\Subscriber\Grid\Collection + Magento\Newsletter\Model\ResourceModel\Subscriber\Grid\Collection subscriber_id desc 1 diff --git a/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_paypal_reports_block.xml b/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_paypal_reports_block.xml index 12dcc46e3ecee..596381a4b1143 100644 --- a/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_paypal_reports_block.xml +++ b/app/code/Magento/Paypal/view/adminhtml/layout/adminhtml_paypal_reports_block.xml @@ -11,7 +11,7 @@ settlementGrid - Magento\Paypal\Model\ResourceModel\Report\Settlement\Row\Collection + Magento\Paypal\Model\ResourceModel\Report\Settlement\Row\Collection row_id DESC 1 diff --git a/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_ordersgrid.xml b/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_ordersgrid.xml index 76a105f5abcdf..0510011a6a559 100644 --- a/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_ordersgrid.xml +++ b/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_ordersgrid.xml @@ -9,7 +9,7 @@ - + Magento\Paypal\Model\Billing\Agreement\OrdersUpdater diff --git a/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_view.xml b/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_view.xml index c76539f5cb206..d9c376701db33 100644 --- a/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_view.xml +++ b/app/code/Magento/Paypal/view/adminhtml/layout/paypal_billing_agreement_view.xml @@ -12,7 +12,7 @@ - + Magento\Paypal\Model\Billing\Agreement\OrdersUpdater diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_accounts_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_accounts_grid.xml index 900dc08d571da..55ca286ad3d47 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_accounts_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_accounts_grid.xml @@ -11,7 +11,7 @@ gridAccounts - Magento\Reports\Model\ResourceModel\Accounts\Collection\Initial + Magento\Reports\Model\ResourceModel\Accounts\Collection\Initial diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_orders_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_orders_grid.xml index d886e5724cb0b..f97bec3c15253 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_orders_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_orders_grid.xml @@ -11,7 +11,7 @@ gridOrdersCustomer - Magento\Reports\Model\ResourceModel\Customer\Orders\Collection\Initial + Magento\Reports\Model\ResourceModel\Customer\Orders\Collection\Initial diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_totals_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_totals_grid.xml index 4914829cf6ebc..e1df04237c2a6 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_totals_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_customer_totals_grid.xml @@ -11,7 +11,7 @@ gridTotalsCustomer - Magento\Reports\Model\ResourceModel\Customer\Totals\Collection\Initial + Magento\Reports\Model\ResourceModel\Customer\Totals\Collection\Initial diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml index 82aa475807a25..0f6fbabb6a55c 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml @@ -24,7 +24,7 @@ 0 0 gridReport - Magento\Reports\Model\ResourceModel\Report\Collection + Magento\Reports\Model\ResourceModel\Report\Collection diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml index 070c39259aabd..62916fe1c1d78 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock_grid.xml @@ -12,7 +12,7 @@ gridLowstock 0 - Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection + Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml index a1b01aeeb526f..22c66352b32e4 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml @@ -11,7 +11,7 @@ gridProductsSold - Magento\Reports\Model\ResourceModel\Product\Sold\Collection\Initial + Magento\Reports\Model\ResourceModel\Product\Sold\Collection\Initial diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml index f941ca52eef59..a728f471e4def 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml @@ -13,7 +13,7 @@ customers_grid review_cnt desc - Magento\Reports\Model\ResourceModel\Review\Customer\Collection + Magento\Reports\Model\ResourceModel\Review\Customer\Collection diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml index 1275e761ade3c..26d0e8b13659d 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml @@ -13,7 +13,7 @@ gridProducts review_cnt desc - Magento\Reports\Model\ResourceModel\Review\Product\Collection + Magento\Reports\Model\ResourceModel\Review\Product\Collection diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_statistics_index.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_statistics_index.xml index 4ec984ef9fc11..649dc7ceeb065 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_statistics_index.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_statistics_index.xml @@ -15,7 +15,7 @@ 0 0 0 - Magento\Reports\Model\ResourceModel\Refresh\Collection + Magento\Reports\Model\ResourceModel\Refresh\Collection diff --git a/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml b/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml index b439bcb1c2710..414cec14c3bec 100644 --- a/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml @@ -11,7 +11,7 @@ ratingsGrid - Magento\Review\Model\ResourceModel\Rating\Grid\Collection + Magento\Review\Model\ResourceModel\Rating\Grid\Collection rating_code ASC 1 diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_customer_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_customer_block.xml index c321bee460e46..e11a5887beb61 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_customer_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_customer_block.xml @@ -13,7 +13,7 @@ sales_order_create_customer_grid 1 entity_id - Magento\Sales\Model\ResourceModel\Order\Customer\Collection + Magento\Sales\Model\ResourceModel\Order\Customer\Collection 1 customer_grid diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_creditmemo_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_creditmemo_grid_block.xml index 7f14ff3728a47..318416a777f3f 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_creditmemo_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_creditmemo_grid_block.xml @@ -11,7 +11,7 @@ order_creditmemos - Magento\Sales\Model\ResourceModel\Order\Creditmemo\Order\Grid\Collection + Magento\Sales\Model\ResourceModel\Order\Creditmemo\Order\Grid\Collection true created_at DESC diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml index 941696f0ce898..d69ed42677109 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml @@ -11,7 +11,7 @@ order_invoices - Magento\Sales\Model\ResourceModel\Order\Invoice\Orders\Grid\Collection + Magento\Sales\Model\ResourceModel\Order\Invoice\Orders\Grid\Collection true created_at DESC diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_grid_block.xml index 0180efd29d2fc..21b5d3b06c167 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_grid_block.xml @@ -11,7 +11,7 @@ order_shipments - Magento\Sales\Model\ResourceModel\Order\Shipment\Order\Grid\Collection + Magento\Sales\Model\ResourceModel\Order\Shipment\Order\Grid\Collection true created_at DESC diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml index 87d7644a4b00f..6854d3bb7bc38 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml @@ -12,7 +12,7 @@ sales_order_status_grid - Magento\Sales\Model\ResourceModel\Status\Collection + Magento\Sales\Model\ResourceModel\Status\Collection state desc 1 diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_transactions_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_transactions_grid_block.xml index c2f5532857202..adb722f6d0f54 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_transactions_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_transactions_grid_block.xml @@ -13,7 +13,7 @@ order_transactions - + Magento\Sales\Model\Grid\CollectionUpdater true diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_transaction_child_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_transaction_child_block.xml index aa8672a68bc6c..5bdad85ebc160 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_transaction_child_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_transaction_child_block.xml @@ -11,7 +11,7 @@ transactionChildGrid - + Magento\Sales\Model\Grid\Child\CollectionUpdater false diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_transactions_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_transactions_grid_block.xml index 9f3b7f23ba20f..37b319b94352d 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_transactions_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_transactions_grid_block.xml @@ -11,7 +11,7 @@ sales_transactions_grid - Magento\Sales\Model\ResourceModel\Transaction\Grid\Collection + Magento\Sales\Model\ResourceModel\Transaction\Grid\Collection true created_at DESC diff --git a/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml index 21ce8bfc3eaac..7796f280efcbc 100644 --- a/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml +++ b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml @@ -12,7 +12,7 @@ promo_quote_grid - Magento\SalesRule\Model\ResourceModel\Rule\Quote\Collection + Magento\SalesRule\Model\ResourceModel\Rule\Quote\Collection sort_order ASC 1 diff --git a/app/code/Magento/Search/view/adminhtml/layout/search_term_block.xml b/app/code/Magento/Search/view/adminhtml/layout/search_term_block.xml index cc2e1509e4412..9dc60bde11315 100644 --- a/app/code/Magento/Search/view/adminhtml/layout/search_term_block.xml +++ b/app/code/Magento/Search/view/adminhtml/layout/search_term_block.xml @@ -11,7 +11,7 @@ searchReportGrid - Magento\Search\Model\ResourceModel\Query\Collection + Magento\Search\Model\ResourceModel\Query\Collection query_id DESC diff --git a/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml b/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml index 7330ac1f92712..38c6fa52455b9 100644 --- a/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml +++ b/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml @@ -11,7 +11,7 @@ search_term_grid - Magento\Search\Model\ResourceModel\Query\Collection + Magento\Search\Model\ResourceModel\Query\Collection name ASC 1 diff --git a/app/code/Magento/Search/view/adminhtml/layout/search_term_report_block.xml b/app/code/Magento/Search/view/adminhtml/layout/search_term_report_block.xml index b6b1455cf27ca..f4c5d1ab85a0a 100644 --- a/app/code/Magento/Search/view/adminhtml/layout/search_term_report_block.xml +++ b/app/code/Magento/Search/view/adminhtml/layout/search_term_report_block.xml @@ -12,7 +12,7 @@ searchReportGrid - Magento\Search\Model\ResourceModel\Query\Collection + Magento\Search\Model\ResourceModel\Query\Collection query_id DESC diff --git a/app/code/Magento/Sitemap/view/adminhtml/layout/adminhtml_sitemap_index_grid_block.xml b/app/code/Magento/Sitemap/view/adminhtml/layout/adminhtml_sitemap_index_grid_block.xml index cdaa6575d559c..632768e4a5f08 100644 --- a/app/code/Magento/Sitemap/view/adminhtml/layout/adminhtml_sitemap_index_grid_block.xml +++ b/app/code/Magento/Sitemap/view/adminhtml/layout/adminhtml_sitemap_index_grid_block.xml @@ -11,7 +11,7 @@ sitemapGrid - Magento\Sitemap\Model\ResourceModel\Sitemap\Collection + Magento\Sitemap\Model\ResourceModel\Sitemap\Collection sitemap_id diff --git a/app/code/Magento/Tax/view/adminhtml/layout/tax_rate_block.xml b/app/code/Magento/Tax/view/adminhtml/layout/tax_rate_block.xml index 463994262b7d3..5c50b306411ed 100644 --- a/app/code/Magento/Tax/view/adminhtml/layout/tax_rate_block.xml +++ b/app/code/Magento/Tax/view/adminhtml/layout/tax_rate_block.xml @@ -11,7 +11,7 @@ tax_rate_grid - Magento\Tax\Model\TaxRateCollection + Magento\Tax\Model\TaxRateCollection region_name ASC 1 diff --git a/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_block.xml b/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_block.xml index 5e42b835c035d..07afd05e63f8c 100644 --- a/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_block.xml +++ b/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_block.xml @@ -11,7 +11,7 @@ taxRuleGrid - Magento\Tax\Model\TaxRuleCollection + Magento\Tax\Model\TaxRuleCollection tax_rule_id ASC 1 diff --git a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_block.xml b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_block.xml index bb8fbd44629cf..e19460d56a89b 100644 --- a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_block.xml +++ b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_block.xml @@ -11,7 +11,7 @@ theme_grid - Magento\Theme\Model\ResourceModel\Theme\Grid\Collection + Magento\Theme\Model\ResourceModel\Theme\Grid\Collection 1 1 diff --git a/app/code/Magento/UrlRewrite/view/adminhtml/layout/adminhtml_url_rewrite_index.xml b/app/code/Magento/UrlRewrite/view/adminhtml/layout/adminhtml_url_rewrite_index.xml index 7d8151d270308..8b4910b625321 100644 --- a/app/code/Magento/UrlRewrite/view/adminhtml/layout/adminhtml_url_rewrite_index.xml +++ b/app/code/Magento/UrlRewrite/view/adminhtml/layout/adminhtml_url_rewrite_index.xml @@ -12,7 +12,7 @@ urlrewriteGrid - Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection + Magento\UrlRewrite\Model\ResourceModel\UrlRewriteCollection url_rewrite_id diff --git a/app/code/Magento/User/view/adminhtml/layout/adminhtml_locks_block.xml b/app/code/Magento/User/view/adminhtml/layout/adminhtml_locks_block.xml index 13cfbfe859333..d195ac93c16e5 100644 --- a/app/code/Magento/User/view/adminhtml/layout/adminhtml_locks_block.xml +++ b/app/code/Magento/User/view/adminhtml/layout/adminhtml_locks_block.xml @@ -12,7 +12,7 @@ lockedAdminsGrid - Magento\User\Model\ResourceModel\User\Locked\Collection + Magento\User\Model\ResourceModel\User\Locked\Collection user_id 1 diff --git a/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_grid_block.xml b/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_grid_block.xml index a4bc9aa5ed48b..9099028ce9bfc 100644 --- a/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_grid_block.xml +++ b/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_grid_block.xml @@ -11,7 +11,7 @@ permissionsUserGrid - Magento\User\Model\ResourceModel\User\Collection + Magento\User\Model\ResourceModel\User\Collection 1 username asc diff --git a/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_role_grid_block.xml b/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_role_grid_block.xml index 6d7ce67e2352b..f2d699b6cc08b 100644 --- a/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_role_grid_block.xml +++ b/app/code/Magento/User/view/adminhtml/layout/adminhtml_user_role_grid_block.xml @@ -11,7 +11,7 @@ roleGrid - Magento\Authorization\Model\ResourceModel\Role\Grid\Collection + Magento\Authorization\Model\ResourceModel\Role\Grid\Collection 1 role_id asc diff --git a/app/code/Magento/Variable/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml b/app/code/Magento/Variable/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml index d934e46117fb1..edee7fcca8222 100644 --- a/app/code/Magento/Variable/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml +++ b/app/code/Magento/Variable/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml @@ -11,7 +11,7 @@ customVariablesGrid - Magento\Variable\Model\ResourceModel\Variable\Collection + Magento\Variable\Model\ResourceModel\Variable\Collection variable_id ASC diff --git a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml index 934b0ca1a85b2..8ca3fab413b25 100644 --- a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml +++ b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml @@ -13,7 +13,7 @@ widgetInstanceGrid instance_id ASC - Magento\Widget\Model\ResourceModel\Widget\Instance\Collection + Magento\Widget\Model\ResourceModel\Widget\Instance\Collection diff --git a/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml b/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml index 95b786603390c..e364087405ed9 100644 --- a/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml +++ b/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml @@ -9,7 +9,7 @@ - Magento\Wishlist\Model\ResourceModel\Item\Collection\Grid + Magento\Wishlist\Model\ResourceModel\Item\Collection\Grid wishlistGrid true added_at diff --git a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php b/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php index ea9fef369e312..fb528a0fd1c91 100644 --- a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php +++ b/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php @@ -3,10 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\View\Layout\Argument\Interpreter; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Data\Argument\InterpreterInterface; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Stdlib\BooleanUtils; /** * Interpreter that instantiates object by a class name @@ -14,23 +18,33 @@ class DataObject implements InterpreterInterface { /** - * @var ObjectManagerInterface + * @var \Magento\Framework\ObjectManagerInterface */ private $objectManager; + /** + * @var \Magento\Framework\Stdlib\BooleanUtils + */ + private $booleanUtils; + /** * @var string|null */ private $expectedClass; /** - * @param ObjectManagerInterface $objectManager + * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param string|null $expectedClass + * @param \Magento\Framework\Stdlib\BooleanUtils|null $booleanUtils */ - public function __construct(ObjectManagerInterface $objectManager, $expectedClass = null) - { + public function __construct( + ObjectManagerInterface $objectManager, + ?string $expectedClass = null, + ?BooleanUtils $booleanUtils = null + ) { $this->objectManager = $objectManager; $this->expectedClass = $expectedClass; + $this->booleanUtils = $booleanUtils ?? ObjectManager::getInstance()->get(BooleanUtils::class); } /** @@ -44,13 +58,17 @@ public function evaluate(array $data) if (!isset($data['value'])) { throw new \InvalidArgumentException('Object class name is missing.'); } + + $shared = isset($data['shared']) ? $this->booleanUtils->toBoolean($data['shared']) : true; $className = $data['value']; - $result = $this->objectManager->create($className); + $result = $shared ? $this->objectManager->get($className) : $this->objectManager->create($className); + if ($this->expectedClass && !$result instanceof $this->expectedClass) { throw new \UnexpectedValueException( - sprintf("Instance of %s is expected, got %s instead.", $this->expectedClass, get_class($result)) + \sprintf('Instance of %s is expected, got %s instead.', $this->expectedClass, \get_class($result)) ); } + return $result; } } diff --git a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd index 39cdec05a65ea..f3967bb2fca45 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd @@ -14,6 +14,7 @@ + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php index 7cc280a930d9c..180888bcc1d3e 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Argument/Interpreter/ObjectTest.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\View\Test\Unit\Layout\Argument\Interpreter; -use \Magento\Framework\View\Layout\Argument\Interpreter\DataObject; +use Magento\Framework\View\Layout\Argument\Interpreter\DataObject; class ObjectTest extends \PHPUnit\Framework\TestCase { @@ -22,19 +22,55 @@ class ObjectTest extends \PHPUnit\Framework\TestCase protected $_interpreter; /** - * @var DataObject + * @var \Magento\Framework\Stdlib\BooleanUtils + */ + protected $_booleanUtils; + + /** + * @var \Magento\Framework\View\Layout\Argument\Interpreter\DataObject */ protected $_model; protected function setUp() { $this->_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); - $this->_model = new DataObject($this->_objectManager, self::EXPECTED_CLASS); + $this->_booleanUtils = $this->createMock(\Magento\Framework\Stdlib\BooleanUtils::class); + $this->_model = new DataObject($this->_objectManager, self::EXPECTED_CLASS, $this->_booleanUtils); } public function testEvaluate() { $input = ['name' => 'dataSource', 'value' => self::EXPECTED_CLASS]; + $this->_objectManager->expects($this->once()) + ->method('get') + ->with(self::EXPECTED_CLASS) + ->willReturn($this); + + $actual = $this->_model->evaluate($input); + $this->assertSame($this, $actual); + } + + public function textEvaluateShareEnabled() + { + $input = ['name' => 'dataSource', 'value' => self::EXPECTED_CLASS, 'shared' => true]; + $this->_booleanUtils->expects($this->once()) + ->method('toBoolean') + ->willReturn(true); + $this->_objectManager->expects($this->once()) + ->method('get') + ->with(self::EXPECTED_CLASS) + ->willReturn($this); + + $actual = $this->_model->evaluate($input); + $this->assertSame($this, $actual); + } + + public function textEvaluateShareDisabled() + { + $input = ['name' => 'dataSource', 'value' => self::EXPECTED_CLASS, 'shared' => false]; + $this->_booleanUtils->expects($this->once()) + ->method('toBoolean') + ->willReturn(false); $this->_objectManager->expects($this->once()) ->method('create') ->with(self::EXPECTED_CLASS) @@ -52,12 +88,56 @@ public function testEvaluateWrongClass($input, $expectedException, $expectedExce $this->expectException($expectedException); $this->expectExceptionMessage($expectedExceptionMessage); $self = $this; + $this->_objectManager->expects($this->any())->method('get')->willReturnCallback( + function ($className) use ($self) { + return $self->createMock($className); + } + ); + + $this->_model->evaluate($input); + } + + /** + * @dataProvider evaluateWrongClassDataProvider + */ + public function testEvaluateShareEnabledWrongClass($input, $expectedException, $expectedExceptionMessage) + { + $this->expectException($expectedException); + $this->expectExceptionMessage($expectedExceptionMessage); + $self = $this; + $this->_booleanUtils->expects($this->any()) + ->method('toBoolean') + ->willReturn(true); + $this->_objectManager->expects($this->any())->method('get')->willReturnCallback( + function ($className) use ($self) { + return $self->createMock($className); + } + ); + + $input['shared'] = true; + + $this->_model->evaluate($input); + } + + /** + * @dataProvider evaluateWrongClassDataProvider + */ + public function testEvaluateShareDisabledWrongClass($input, $expectedException, $expectedExceptionMessage) + { + $this->expectException($expectedException); + $this->expectExceptionMessage($expectedExceptionMessage); + $self = $this; + $this->_booleanUtils->expects($this->any()) + ->method('toBoolean') + ->willReturn(false); $this->_objectManager->expects($this->any())->method('create')->willReturnCallback( function ($className) use ($self) { return $self->createMock($className); } ); + $input['shared'] = false; + $this->_model->evaluate($input); } From 415288f8b8bfc4dd3b700e25442b074c260ba30e Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Thu, 20 Dec 2018 13:48:59 +0200 Subject: [PATCH 002/318] Fix static and integration test. --- .../Magento/Test/Integrity/Modular/LayoutFilesTest.php | 5 ++--- .../View/Layout/Argument/Interpreter/DataObject.php | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php index a11cd4b73b5c7..32a58e285d762 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -77,9 +77,8 @@ public function layoutArgumentsDataProvider() */ protected function isSkippedArgument(array $argumentData) { - // Do not take into account argument name and parameters - unset($argumentData['name']); - unset($argumentData['param']); + // Do not take into account argument name, shared and parameters + unset($argumentData['name'], $argumentData['param'], $argumentData['shared']); $isUpdater = isset($argumentData['updater']); unset($argumentData['updater']); diff --git a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php b/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php index fb528a0fd1c91..bf607672cae03 100644 --- a/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php +++ b/lib/internal/Magento/Framework/View/Layout/Argument/Interpreter/DataObject.php @@ -48,10 +48,7 @@ public function __construct( } /** - * {@inheritdoc} - * @return object - * @throws \InvalidArgumentException - * @throws \UnexpectedValueException + * @inheritdoc */ public function evaluate(array $data) { From 5abd3308539fd0449d9ffe22a2d826e1909cc074 Mon Sep 17 00:00:00 2001 From: Julian Wundrak Date: Thu, 20 Dec 2018 22:30:00 +0100 Subject: [PATCH 003/318] [#19908] locale in rest calls is always default locale --- .../Webapi/Controller/PathProcessor.php | 15 ++++++- .../Unit/Controller/PathProcessorTest.php | 44 +++++++++++++------ .../Webapi/Controller/PathProcessorTest.php | 22 ++++++++++ 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Webapi/Controller/PathProcessor.php b/app/code/Magento/Webapi/Controller/PathProcessor.php index c5748cc6e848e..20f1f02e38265 100644 --- a/app/code/Magento/Webapi/Controller/PathProcessor.php +++ b/app/code/Magento/Webapi/Controller/PathProcessor.php @@ -21,12 +21,21 @@ class PathProcessor */ private $storeManager; + /** + * @var \Magento\Framework\Locale\ResolverInterface + */ + private $localeResolver; + /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Framework\Locale\ResolverInterface $localeResolver */ - public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) - { + public function __construct( + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Framework\Locale\ResolverInterface $localeResolver + ) { $this->storeManager = $storeManager; + $this->localeResolver = $localeResolver; } /** @@ -57,9 +66,11 @@ public function process($pathInfo) $stores = $this->storeManager->getStores(false, true); if (isset($stores[$storeCode])) { $this->storeManager->setCurrentStore($storeCode); + $this->localeResolver->emulate($this->storeManager->getStore()->getId()); $path = '/' . (isset($pathParts[1]) ? $pathParts[1] : ''); } elseif ($storeCode === self::ALL_STORE_CODE) { $this->storeManager->setCurrentStore(\Magento\Store\Model\Store::ADMIN_CODE); + $this->localeResolver->emulate($this->storeManager->getStore()->getId()); $path = '/' . (isset($pathParts[1]) ? $pathParts[1] : ''); } else { $path = '/' . implode('/', $pathParts); diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php index c213c72b5185a..9a1eb249cd9b7 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php @@ -13,6 +13,9 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */ private $storeManagerMock; + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface */ + private $localeResolverMock; + /** @var \Magento\Webapi\Controller\PathProcessor */ private $model; @@ -24,13 +27,22 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManagerMock->expects($this->once()) - ->method('getStores') - ->willReturn([$this->arbitraryStoreCode => 'store object', 'default' => 'default store object']); - $this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock); + $store = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); + $store->method('getId')->willReturn(2); + + $this->storeManagerMock = $this->createConfiguredMock( + \Magento\Store\Model\StoreManagerInterface::class, + [ + 'getStores' => [$this->arbitraryStoreCode => 'store object', 'default' => 'default store object'], + 'getStore' => $store, + ] + ); + $this->storeManagerMock->expects($this->once())->method('getStores'); + + $this->localeResolverMock = $this->createMock(\Magento\Framework\Locale\ResolverInterface::class); + $this->localeResolverMock->method('emulate')->with(2); + + $this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock, $this->localeResolverMock); } /** @@ -38,15 +50,19 @@ protected function setUp() * * @param string $storeCodeInPath * @param string $storeCodeSet - * @param int $setCurrentStoreCallCtr + * @param int $setCurrentStoreCallCtr */ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1) { - $storeCodeInPath = !$storeCodeInPath ?: '/' . $storeCodeInPath; // add leading slash if store code not empty - $inPath = 'rest' . $storeCodeInPath . $this->endpointPath; + $storeCodeInPath = !$storeCodeInPath ? : '/' . $storeCodeInPath; // add leading slash if store code not empty + $inPath = 'rest' . $storeCodeInPath . $this->endpointPath; $this->storeManagerMock->expects($this->exactly($setCurrentStoreCallCtr)) ->method('setCurrentStore') ->with($storeCodeSet); + if($setCurrentStoreCallCtr > 0) { + $this->localeResolverMock->expects($this->once()) + ->method('emulate'); + } $result = $this->model->process($inPath); $this->assertSame($this->endpointPath, $result); } @@ -57,10 +73,10 @@ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentSto public function processPathDataProvider() { return [ - 'All store code' => ['all', Store::ADMIN_CODE], - 'Default store code' => ['', 'default', 0], - 'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode], - 'Explicit default store code' => ['default', 'default'] + 'All store code' => ['all', Store::ADMIN_CODE], + 'Default store code' => ['', 'default', 0], + 'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode], + 'Explicit default store code' => ['default', 'default'], ]; } } diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php index 932ad03d691e4..4b8bfd32b4f70 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php @@ -15,6 +15,11 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase */ protected $storeManager; + /** + * @var \Magento\Framework\Locale\ResolverInterface::class + */ + protected $localeResolver; + /** * @var \Magento\Webapi\Controller\PathProcessor */ @@ -25,6 +30,7 @@ protected function setUp() $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class); $this->storeManager->reinitStores(); + $this->localeResolver = $objectManager->get(\Magento\Framework\Locale\ResolverInterface::class); $this->pathProcessor = $objectManager->get(\Magento\Webapi\Controller\PathProcessor::class); } @@ -59,4 +65,20 @@ public function testProcessWithoutStoreCode() $this->assertEquals($path, $result); $this->assertEquals('default', $this->storeManager->getStore()->getCode()); } + + /** + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoConfigFixture default_store general/locale/code en_US + * @magentoConfigFixture fixturestore_store general/locale/code de_DE + */ + public function testProcessWithValidStoreCodeApplyLocale() + { + $locale = 'de_DE'; + $storeCode = 'fixturestore'; + $basePath = "rest/{$storeCode}"; + $path = $basePath . '/V1/customerAccounts/createCustomer'; + $this->pathProcessor->process($path); + $this->assertEquals($locale, $this->localeResolver->getLocale()); + $this->assertNotEquals('en_US', $this->localeResolver->getLocale()); + } } From ef724a622b5a45cb8dbeb9ca5f5d5039af4affcf Mon Sep 17 00:00:00 2001 From: Julian Wundrak Date: Sat, 22 Dec 2018 11:36:34 +0100 Subject: [PATCH 004/318] [#19908] add requested code style changes --- app/code/Magento/Webapi/Controller/PathProcessor.php | 7 +++++-- .../Webapi/Test/Unit/Controller/PathProcessorTest.php | 10 +++++----- .../Magento/Webapi/Controller/PathProcessorTest.php | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Webapi/Controller/PathProcessor.php b/app/code/Magento/Webapi/Controller/PathProcessor.php index 20f1f02e38265..b5f0be97de2f2 100644 --- a/app/code/Magento/Webapi/Controller/PathProcessor.php +++ b/app/code/Magento/Webapi/Controller/PathProcessor.php @@ -6,6 +6,7 @@ */ namespace Magento\Webapi\Controller; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; /** @@ -32,10 +33,12 @@ class PathProcessor */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Locale\ResolverInterface $localeResolver + \Magento\Framework\Locale\ResolverInterface $localeResolver = null ) { $this->storeManager = $storeManager; - $this->localeResolver = $localeResolver; + $this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get( + \Magento\Framework\Locale\ResolverInterface::class + ); } /** diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php index 9a1eb249cd9b7..e53d47d4b7238 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php @@ -54,8 +54,8 @@ protected function setUp() */ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1) { - $storeCodeInPath = !$storeCodeInPath ? : '/' . $storeCodeInPath; // add leading slash if store code not empty - $inPath = 'rest' . $storeCodeInPath . $this->endpointPath; + $storeCodeInPath = !$storeCodeInPath ?: '/' . $storeCodeInPath; // add leading slash if store code not empty + $inPath = 'rest' . $storeCodeInPath . $this->endpointPath; $this->storeManagerMock->expects($this->exactly($setCurrentStoreCallCtr)) ->method('setCurrentStore') ->with($storeCodeSet); @@ -73,9 +73,9 @@ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentSto public function processPathDataProvider() { return [ - 'All store code' => ['all', Store::ADMIN_CODE], - 'Default store code' => ['', 'default', 0], - 'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode], + 'All store code' => ['all', Store::ADMIN_CODE], + 'Default store code' => ['', 'default', 0], + 'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode], 'Explicit default store code' => ['default', 'default'], ]; } diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php index 4b8bfd32b4f70..43aa788dea3a8 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php @@ -18,7 +18,7 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase /** * @var \Magento\Framework\Locale\ResolverInterface::class */ - protected $localeResolver; + private $localeResolver; /** * @var \Magento\Webapi\Controller\PathProcessor From 29b4b3920d413c2571ef2d8fd2fb1dba55f63d43 Mon Sep 17 00:00:00 2001 From: Julian Wundrak Date: Thu, 27 Dec 2018 10:12:18 +0100 Subject: [PATCH 005/318] [#19908] Fix WebapiAyncTest --- .../Unit/Controller/PathProcessorTest.php | 2 +- .../Unit/Controller/PathProcessorTest.php | 29 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php index e53d47d4b7238..513e0cbafcbbd 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php @@ -50,7 +50,7 @@ protected function setUp() * * @param string $storeCodeInPath * @param string $storeCodeSet - * @param int $setCurrentStoreCallCtr + * @param int $setCurrentStoreCallCtr */ public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1) { diff --git a/app/code/Magento/WebapiAsync/Test/Unit/Controller/PathProcessorTest.php b/app/code/Magento/WebapiAsync/Test/Unit/Controller/PathProcessorTest.php index e5453f7574540..cea7a4168ea4e 100644 --- a/app/code/Magento/WebapiAsync/Test/Unit/Controller/PathProcessorTest.php +++ b/app/code/Magento/WebapiAsync/Test/Unit/Controller/PathProcessorTest.php @@ -15,6 +15,9 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */ private $storeManagerMock; + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface */ + private $localeResolverMock; + /** @var \Magento\Webapi\Controller\PathProcessor */ private $model; @@ -26,16 +29,22 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->storeManagerMock->expects($this->once()) - ->method('getStores') - ->willReturn([ - $this->arbitraryStoreCode => 'store object', - 'default' => 'default store object', - ]); - $this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock); + $store = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); + $store->method('getId')->willReturn(2); + + $this->storeManagerMock = $this->createConfiguredMock( + \Magento\Store\Model\StoreManagerInterface::class, + [ + 'getStores' => [$this->arbitraryStoreCode => 'store object', 'default' => 'default store object'], + 'getStore' => $store, + ] + ); + $this->storeManagerMock->expects($this->once())->method('getStores'); + + $this->localeResolverMock = $this->createMock(\Magento\Framework\Locale\ResolverInterface::class); + $this->localeResolverMock->method('emulate')->with(2); + + $this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock, $this->localeResolverMock); } /** From 11af87753f43c38d95c373a046ed9490cc2f88e3 Mon Sep 17 00:00:00 2001 From: Arvinda kumar Date: Wed, 9 Jan 2019 15:47:57 +0530 Subject: [PATCH 006/318] issue fixed #20124 Sort By label is hidden by Shop By Menu on listing page in iphone5 device issue fixed #20124 Sort By label is hidden by Shop By Menu on listing page in iphone5 device --- .../luma/Magento_Catalog/web/css/source/module/_toolbar.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less index 6bddc46003cbf..b587c169f67eb 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less @@ -84,7 +84,7 @@ .page-products & { position: absolute; - right: @indent__s; + right: 0; top: 0; z-index: 1; } From 334d71368b2d7ad8b060051b7009c730825f9c4f Mon Sep 17 00:00:00 2001 From: Khodu Vaishnav Date: Sat, 8 Dec 2018 16:50:22 +0530 Subject: [PATCH 007/318] patch-9155 : set default qty for add to cart from wishlist. patch-9155 : set default qty for add to cart from wishlist. patch-9155 : set default qty for add to cart in wishlist. --- .../Customer/Wishlist/Item/Column/Cart.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php index fe0683a52fe97..3e0a611b2e7c7 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php @@ -16,6 +16,28 @@ */ class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column { + /** + * @var \Magento\Catalog\Block\Product\View + */ + protected $productView; + + /** + * + * @param \Magento\Catalog\Block\Product\Context $context + * @param \Magento\Framework\App\Http\Context $httpContext + * @param array $data + * @param \Magento\Catalog\Block\Product\View $productView + */ + public function __construct( + \Magento\Catalog\Block\Product\Context $context, + \Magento\Framework\App\Http\Context $httpContext, + \Magento\Catalog\Block\Product\View $productView = null, + array $data = [] + ) { + $this->productView = $productView ?: + \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Block\Product\View::class); + parent::__construct($context, $httpContext, $data); + } /** * Returns qty to show visually to user * @@ -25,6 +47,8 @@ class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column public function getAddToCartQty(\Magento\Wishlist\Model\Item $item) { $qty = $item->getQty(); + $qty = $qty < $this->productView->getProductDefaultQty($this->getProductItem()) + ? $this->productView->getProductDefaultQty($this->getProductItem()) : $qty ; return $qty ? $qty : 1; } From 42b81c0d97d5948fb7f0c45970fab33cf2f9af99 Mon Sep 17 00:00:00 2001 From: Arvinda kumar Date: Tue, 29 Jan 2019 18:24:25 +0530 Subject: [PATCH 008/318] _module.less update _module.less update --- .../Magento_LayeredNavigation/web/css/source/_module.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_LayeredNavigation/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_LayeredNavigation/web/css/source/_module.less index 48461892fa631..5d752a5e04954 100644 --- a/app/design/frontend/Magento/luma/Magento_LayeredNavigation/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_LayeredNavigation/web/css/source/_module.less @@ -364,10 +364,10 @@ content: ''; display: block; height: 40px; - left: -15px; + left: 0; margin-top: -60px; position: relative; - width: 100px; + width: 75px; z-index: 99; } } From 9dc3a19d2cb37f4d0a4cddbab7334d0c579c45b9 Mon Sep 17 00:00:00 2001 From: Iaroslav Gyryn Date: Thu, 31 Jan 2019 09:42:59 +0200 Subject: [PATCH 009/318] magento/magento2#20481 REST products update category_ids cannot be removed --- .../Catalog/Model/ProductRepository.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index d124bf5e42639..217454b2eb729 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -11,6 +11,7 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap; use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\Catalog\Api\CategoryLinkManagementInterface; use Magento\Eav\Model\Entity\Attribute\Exception as AttributeException; use Magento\Framework\Api\Data\ImageContentInterface; use Magento\Framework\Api\Data\ImageContentInterfaceFactory; @@ -161,6 +162,16 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ private $readExtensions; + /** + * @var CategoryLinkManagementInterface + */ + private $categoryLinkManagement; + + /** + * @var AssignProductToCategories + */ + private $assignProductToCategories = false; + /** * ProductRepository constructor. * @param ProductFactory $productFactory @@ -187,6 +198,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @param int $cacheLimit [optional] * @param ReadExtensions|null $readExtensions + * @param Magento\Catalog\Api\CategoryLinkManagementInterface|null $categoryLinkManagement * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -214,7 +226,8 @@ public function __construct( CollectionProcessorInterface $collectionProcessor = null, \Magento\Framework\Serialize\Serializer\Json $serializer = null, $cacheLimit = 1000, - ReadExtensions $readExtensions = null + ReadExtensions $readExtensions = null, + CategoryLinkManagementInterface $categoryLinkManagement = null ) { $this->productFactory = $productFactory; $this->collectionFactory = $collectionFactory; @@ -239,6 +252,8 @@ public function __construct( $this->cacheLimit = (int)$cacheLimit; $this->readExtensions = $readExtensions ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(ReadExtensions::class); + $this->categoryLinkManagement = $categoryLinkManagement ?:\Magento\Framework\App\ObjectManager::getInstance() + ->get(CategoryLinkManagementInterface::class); } /** @@ -589,6 +604,7 @@ public function save(ProductInterface $product, $saveOptions = false) $extensionAttributes = $product->getExtensionAttributes(); if (empty($extensionAttributes->__toArray())) { $product->setExtensionAttributes($existingProduct->getExtensionAttributes()); + $this->assignProductToCategories = true; } } catch (NoSuchEntityException $e) { $existingProduct = null; @@ -626,6 +642,12 @@ public function save(ProductInterface $product, $saveOptions = false) } $this->saveProduct($product); + if ($this->assignProductToCategories === true) { + $this->categoryLinkManagement->assignProductToCategories( + $product->getSku(), + $product->getCategoryIds() + ); + } $this->removeProductFromLocalCache($product->getSku()); unset($this->instancesById[$product->getId()]); From b6020677c4fd3e99d59c67b953bfa53d70bed165 Mon Sep 17 00:00:00 2001 From: Iaroslav Gyryn Date: Thu, 31 Jan 2019 16:56:44 +0200 Subject: [PATCH 010/318] magento/magento2#20481 REST products update category_ids cannot be removed Code review --- .../Catalog/Model/ProductRepository.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 217454b2eb729..518a17ff3f101 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -165,12 +165,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa /** * @var CategoryLinkManagementInterface */ - private $categoryLinkManagement; - - /** - * @var AssignProductToCategories - */ - private $assignProductToCategories = false; + private $linkManagement; /** * ProductRepository constructor. @@ -227,7 +222,7 @@ public function __construct( \Magento\Framework\Serialize\Serializer\Json $serializer = null, $cacheLimit = 1000, ReadExtensions $readExtensions = null, - CategoryLinkManagementInterface $categoryLinkManagement = null + CategoryLinkManagementInterface $linkManagement = null ) { $this->productFactory = $productFactory; $this->collectionFactory = $collectionFactory; @@ -252,7 +247,7 @@ public function __construct( $this->cacheLimit = (int)$cacheLimit; $this->readExtensions = $readExtensions ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(ReadExtensions::class); - $this->categoryLinkManagement = $categoryLinkManagement ?:\Magento\Framework\App\ObjectManager::getInstance() + $this->linkManagement = $linkManagement ?:\Magento\Framework\App\ObjectManager::getInstance() ->get(CategoryLinkManagementInterface::class); } @@ -587,6 +582,7 @@ protected function processMediaGallery(ProductInterface $product, $mediaGalleryE */ public function save(ProductInterface $product, $saveOptions = false) { + $assignToCategories = false; $tierPrices = $product->getData('tier_price'); try { @@ -604,7 +600,7 @@ public function save(ProductInterface $product, $saveOptions = false) $extensionAttributes = $product->getExtensionAttributes(); if (empty($extensionAttributes->__toArray())) { $product->setExtensionAttributes($existingProduct->getExtensionAttributes()); - $this->assignProductToCategories = true; + $assignToCategories = true; } } catch (NoSuchEntityException $e) { $existingProduct = null; @@ -642,8 +638,8 @@ public function save(ProductInterface $product, $saveOptions = false) } $this->saveProduct($product); - if ($this->assignProductToCategories === true) { - $this->categoryLinkManagement->assignProductToCategories( + if ($assignToCategories === true) { + $this->linkManagement->assignProductToCategories( $product->getSku(), $product->getCategoryIds() ); From 73859cd565ddf112ba003953efb523688acdfea2 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Wed, 30 Jan 2019 11:47:02 +0200 Subject: [PATCH 011/318] ENGCOM-3715: Static test fix. --- .../Customer/Wishlist/Item/Column/Cart.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php index 3e0a611b2e7c7..d2871efc1aab9 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php @@ -6,7 +6,11 @@ namespace Magento\Wishlist\Block\Customer\Wishlist\Item\Column; +use Magento\Catalog\Block\Product\View; use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter; +use Magento\Catalog\Model\Product\Image\UrlBuilder; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\View\ConfigInterface; /** * Wishlist block customer item cart column @@ -17,27 +21,30 @@ class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column { /** - * @var \Magento\Catalog\Block\Product\View + * @var View */ protected $productView; /** - * * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\App\Http\Context $httpContext * @param array $data - * @param \Magento\Catalog\Block\Product\View $productView + * @param ConfigInterface|null $config + * @param UrlBuilder|null $urlBuilder + * @param View|null $productView */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, - \Magento\Catalog\Block\Product\View $productView = null, - array $data = [] + array $data = [], + ?ConfigInterface $config = null, + ?UrlBuilder $urlBuilder = null, + ?View $productView = null ) { - $this->productView = $productView ?: - \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Block\Product\View::class); - parent::__construct($context, $httpContext, $data); + $this->productView = $productView ?: ObjectManager::getInstance()->get(View::class); + parent::__construct($context, $httpContext, $data, $config, $urlBuilder); } + /** * Returns qty to show visually to user * @@ -48,8 +55,8 @@ public function getAddToCartQty(\Magento\Wishlist\Model\Item $item) { $qty = $item->getQty(); $qty = $qty < $this->productView->getProductDefaultQty($this->getProductItem()) - ? $this->productView->getProductDefaultQty($this->getProductItem()) : $qty ; - return $qty ? $qty : 1; + ? $this->productView->getProductDefaultQty($this->getProductItem()) : $qty; + return $qty ?: 1; } /** From d1b7097bc38e87669607cfac094d312d76ce7ab3 Mon Sep 17 00:00:00 2001 From: Iaroslav Gyryn Date: Thu, 7 Feb 2019 14:00:33 +0200 Subject: [PATCH 012/318] magento/magento2#20481 REST products update category_ids cannot be removed Code review, updated unit tests --- app/code/Magento/Catalog/Model/ProductRepository.php | 4 ++-- .../Test/Unit/Model/ProductRepositoryTest.php | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 518a17ff3f101..d78d1ca2f216f 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -193,7 +193,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @param int $cacheLimit [optional] * @param ReadExtensions|null $readExtensions - * @param Magento\Catalog\Api\CategoryLinkManagementInterface|null $categoryLinkManagement + * @param Magento\Catalog\Api\CategoryLinkManagementInterface|null $linkManagement * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -638,7 +638,7 @@ public function save(ProductInterface $product, $saveOptions = false) } $this->saveProduct($product); - if ($assignToCategories === true) { + if ($assignToCategories === true && $product->getCategoryIds()) { $this->linkManagement->assignProductToCategories( $product->getSku(), $product->getCategoryIds() diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index c729a0c58e1ec..6d3b4713b830d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -200,7 +200,8 @@ protected function setUp() 'setData', 'getStoreId', 'getMediaGalleryEntries', - 'getExtensionAttributes' + 'getExtensionAttributes', + 'getCategoryIds' ] ); @@ -220,7 +221,8 @@ protected function setUp() 'validate', 'save', 'getMediaGalleryEntries', - 'getExtensionAttributes' + 'getExtensionAttributes', + 'getCategoryIds' ] ); $this->initializedProduct->expects($this->any()) @@ -269,6 +271,12 @@ protected function setUp() $this->initializedProduct ->method('getExtensionAttributes') ->willReturn($this->productExtension); + $this->product + ->method('getCategoryIds') + ->willReturn([1, 2, 3, 4]); + $this->initializedProduct + ->method('getCategoryIds') + ->willReturn([1, 2, 3, 4]); $storeMock = $this->getMockBuilder(StoreInterface::class) ->disableOriginalConstructor() ->setMethods([]) From 814947905ba35e2bbaca4f4124d1e0ac19225ce5 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Thu, 7 Feb 2019 21:25:07 +0200 Subject: [PATCH 013/318] Minor code style fixes --- app/code/Magento/Catalog/Model/ProductRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index d78d1ca2f216f..57584b116a3a4 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -7,11 +7,11 @@ namespace Magento\Catalog\Model; +use Magento\Catalog\Api\CategoryLinkManagementInterface; use Magento\Catalog\Api\Data\ProductExtension; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap; use Magento\Catalog\Model\ResourceModel\Product\Collection; -use Magento\Catalog\Api\CategoryLinkManagementInterface; use Magento\Eav\Model\Entity\Attribute\Exception as AttributeException; use Magento\Framework\Api\Data\ImageContentInterface; use Magento\Framework\Api\Data\ImageContentInterfaceFactory; @@ -247,7 +247,7 @@ public function __construct( $this->cacheLimit = (int)$cacheLimit; $this->readExtensions = $readExtensions ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(ReadExtensions::class); - $this->linkManagement = $linkManagement ?:\Magento\Framework\App\ObjectManager::getInstance() + $this->linkManagement = $linkManagement ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(CategoryLinkManagementInterface::class); } From 0510379aa8668ae6b52e1c46f8acd9b17e291c18 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Tue, 26 Feb 2019 13:17:41 -0600 Subject: [PATCH 014/318] MC-15033: Configurable product gallery does not prepend images with multiple attributes - add functional test --- .../Catalog/Test/Mftf/Data/ProductData.xml | 9 ++++ .../AdminAddDefaultImageSimpleProductTest.xml | 4 +- .../AdminConfigurableProductActionGroup.xml | 16 +++++++ ...reateProductConfigurationsPanelSection.xml | 6 +++ .../StorefrontProductInfoMainSection.xml | 2 +- .../StorefrontFilterByImageSwatchTest.xml | 43 +++++++++++++++++-- 6 files changed, 74 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index d136661e917cb..10f70a7094fbe 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -222,6 +222,15 @@ magento-again jpg + + magento-adobe + 1.00 + Upload File + Yes + adobe-base.jpg + adobe-base + jpg + 霁产品 simple diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml index 88a39a9087bb3..117f094ee0607 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddDefaultImageSimpleProductTest.xml @@ -43,7 +43,9 @@ - + + + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml index d2abfc7977519..503a8ffd4e1d8 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml @@ -131,6 +131,22 @@ + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml index 9b4798c95ec72..242eb3b4ca79c 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml @@ -26,6 +26,12 @@ + + + + + + diff --git a/app/code/Magento/Swatches/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Swatches/Test/Mftf/Section/StorefrontProductInfoMainSection.xml index e40a04080285a..4290ddbbd8dd4 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Section/StorefrontProductInfoMainSection.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -9,7 +9,7 @@
- + diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index e4c96ab3a2ba7..5347a1a1f870f 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -79,16 +79,25 @@ - + + + + + + + + + - + - + + @@ -111,7 +120,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3a772bc0fba518ab0328cd6a881955ac719aef16 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Tue, 26 Feb 2019 13:36:53 -0600 Subject: [PATCH 015/318] MC-15033: Configurable product gallery does not prepend images with multiple attributes - add after clicks --- .../Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml index 503a8ffd4e1d8..c7af58212b5f5 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml @@ -143,8 +143,8 @@ - - + + From ce441c69dd37859fc4ddbd400ab7209ac021b6f2 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Wed, 27 Feb 2019 20:04:26 +0100 Subject: [PATCH 016/318] Fix for issue #21477 sets CURRENT_TIMESTAMP and updated_at fields in the DB Schema. --- app/code/Magento/Integration/etc/db_schema.xml | 2 +- app/code/Magento/Quote/etc/db_schema.xml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Integration/etc/db_schema.xml b/app/code/Magento/Integration/etc/db_schema.xml index f1824fadb97fd..cbf43d79b2cf6 100644 --- a/app/code/Magento/Integration/etc/db_schema.xml +++ b/app/code/Magento/Integration/etc/db_schema.xml @@ -107,7 +107,7 @@ comment="Oauth consumer"/> - diff --git a/app/code/Magento/Quote/etc/db_schema.xml b/app/code/Magento/Quote/etc/db_schema.xml index 6f9f81ba6b3fa..82d468547c479 100644 --- a/app/code/Magento/Quote/etc/db_schema.xml +++ b/app/code/Magento/Quote/etc/db_schema.xml @@ -108,7 +108,7 @@ default="0" comment="Quote Id"/> - @@ -218,7 +218,7 @@ default="0" comment="Quote Id"/> - @@ -322,7 +322,7 @@ default="0" comment="Quote Item Id"/> - @@ -434,7 +434,7 @@ default="0" comment="Quote Id"/> - @@ -470,7 +470,7 @@ default="0" comment="Address Id"/> - From b57dab0c754144cb94584523747bf2b40148d4c0 Mon Sep 17 00:00:00 2001 From: David Alger Date: Fri, 1 Mar 2019 15:43:20 -0600 Subject: [PATCH 017/318] Fixed curl adapter to properly set http version as passed in arguments to prevent failure when requesting from http2 capable endpoint --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index bc833bf3bb2d4..96af9be49f340 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -183,6 +183,12 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); } + if ($http_ver === \Zend_Http_Client::HTTP_1) { + curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + } elseif ($http_ver === \Zend_Http_Client::HTTP_0) { + curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + } + if (is_array($headers)) { curl_setopt($this->_getResource(), CURLOPT_HTTPHEADER, $headers); } From bc8f90993c35b5c232a923ef126ba97d046a35c0 Mon Sep 17 00:00:00 2001 From: Matthew Muscat Date: Thu, 19 Jul 2018 22:46:18 +1000 Subject: [PATCH 018/318] Resolve incorrect scope code selection when the requested scopeCode is null - resolves an issue whereby the incorrect scope could be returned when attempting to resolve a scope with a requested scopeCode of null - simplify the scope resolver logic to a avoid multiple if conditional checks - move scope interface class to an alias of the class - update docblock on the expected values available for scopeCode Signed-off-by: Matthew Muscat --- .../Framework/App/Config/ScopeCodeResolver.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php index 321997afdba95..8876f751f7c3d 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php +++ b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\App\Config; +use Magento\Framework\App\ScopeInterface; use Magento\Framework\App\ScopeResolverPool; /** @@ -34,7 +35,7 @@ public function __construct(ScopeResolverPool $scopeResolverPool) * Resolve scope code * * @param string $scopeType - * @param string $scopeCode + * @param string|null $scopeCode * @return string */ public function resolve($scopeType, $scopeCode) @@ -42,20 +43,25 @@ public function resolve($scopeType, $scopeCode) if (isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) { return $this->resolvedScopeCodes[$scopeType][$scopeCode]; } - if (($scopeCode === null || is_numeric($scopeCode)) - && $scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT - ) { + + if ($scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { $scopeResolver = $this->scopeResolverPool->get($scopeType); $resolverScopeCode = $scopeResolver->getScope($scopeCode); - } else { + } + else { $resolverScopeCode = $scopeCode; } - if ($resolverScopeCode instanceof \Magento\Framework\App\ScopeInterface) { + if ($resolverScopeCode instanceof ScopeInterface) { $resolverScopeCode = $resolverScopeCode->getCode(); } + if ($scopeCode == null) { + $scopeCode = $resolverScopeCode; + } + $this->resolvedScopeCodes[$scopeType][$scopeCode] = $resolverScopeCode; + return $resolverScopeCode; } From ca168091922bc4d34e2347304abb12e9f08a81f9 Mon Sep 17 00:00:00 2001 From: Matthew Muscat Date: Fri, 20 Jul 2018 11:56:16 +1000 Subject: [PATCH 019/318] update travis-ci for phpcs static test --- .../Magento/Framework/App/Config/ScopeCodeResolver.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php index 8876f751f7c3d..ea26b736eca98 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php +++ b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php @@ -47,8 +47,7 @@ public function resolve($scopeType, $scopeCode) if ($scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { $scopeResolver = $this->scopeResolverPool->get($scopeType); $resolverScopeCode = $scopeResolver->getScope($scopeCode); - } - else { + } else { $resolverScopeCode = $scopeCode; } From 9e5fdbbb0edbaceea6d5a17607dea1a21205286c Mon Sep 17 00:00:00 2001 From: Matthew Muscat Date: Fri, 20 Jul 2018 18:49:11 +1000 Subject: [PATCH 020/318] Update null conditional check --- lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php index ea26b736eca98..681af35944695 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php +++ b/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php @@ -55,7 +55,7 @@ public function resolve($scopeType, $scopeCode) $resolverScopeCode = $resolverScopeCode->getCode(); } - if ($scopeCode == null) { + if ($scopeCode === null) { $scopeCode = $resolverScopeCode; } From 321816680860cc7b9f1ef50e7a136e5a3a53af21 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Fri, 15 Mar 2019 14:16:16 +0200 Subject: [PATCH 021/318] MC-15404: Stabilize AdminAbleToShipPartiallyInvoicedItemsTest --- .../order/creditmemo/create/items.phtml | 69 +++++++++++-------- .../order/invoice/create/items.phtml | 51 +++++++------- 2 files changed, 67 insertions(+), 53 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml index fcf4ccad7060b..ba4af32ff69b2 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml @@ -136,67 +136,76 @@
#is'; - $content = preg_replace_callback( - $pattern, - function ($matchPart) use (&$script) { - $script[] = $matchPart[0]; - return ''; - }, - $content - ); - $subject->setContent( - str_replace('scopeConfig->isSetFlag( + self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM, + ScopeInterface::SCOPE_STORE + ) + ) { + $content = $subject->getContent(); + $script = []; + if (strpos($content, 'setContent( + str_replace(' 1 + + + 0 + + diff --git a/app/code/Magento/Theme/etc/system.xml b/app/code/Magento/Theme/etc/system.xml new file mode 100644 index 0000000000000..4abc87e845122 --- /dev/null +++ b/app/code/Magento/Theme/etc/system.xml @@ -0,0 +1,19 @@ + + + + +
+ + + + Magento\Config\Model\Config\Source\Yesno + + +
+
+
From 62abb3c6bbb894e13403da4145336a977170b44c Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 25 Apr 2019 10:28:24 -0500 Subject: [PATCH 273/318] MC-13613: Product mass update --- .../Framework/MessageQueue/PoisonPill/PoisonPillCompare.php | 5 ++--- .../MessageQueue/PoisonPill/PoisonPillCompareInterface.php | 3 +-- .../Framework/MessageQueue/PoisonPill/PoisonPillPut.php | 4 +--- .../Framework/MessageQueue/PoisonPill/PoisonPillRead.php | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompare.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompare.php index 404cf96964f6e..0b85fbb61472a 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompare.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompare.php @@ -8,13 +8,12 @@ namespace Magento\Framework\MessageQueue\PoisonPill; /** - * Interface describes how to describes how to compare poison pill with latest in DB. - * + * Describes how to compare given version of poison pill with latest in DB. */ class PoisonPillCompare implements PoisonPillCompareInterface { /** - * Dumb implementation + * Stub implementation * * @todo Will use cache storage after @MC-15997 * diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompareInterface.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompareInterface.php index e26b21d5a5387..acf78f5014ef6 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompareInterface.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillCompareInterface.php @@ -8,8 +8,7 @@ namespace Magento\Framework\MessageQueue\PoisonPill; /** - * Interface describes how to describes how to compare poison pill with latest in DB. - * + * Interface describes how to compare given version of poison pill with latest in DB. */ interface PoisonPillCompareInterface { diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillPut.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillPut.php index 08c67567ee5d3..7e6828633aea9 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillPut.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillPut.php @@ -7,8 +7,6 @@ namespace Magento\Framework\MessageQueue\PoisonPill; -use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface; - /** * Command interface describes how to create new version on poison pill. */ @@ -22,7 +20,7 @@ class PoisonPillPut implements PoisonPillPutInterface private $firstVersion = ''; /** - * Dumb framework implementation. + * Stub implementation. * * @todo Will use cache storage after @MC-15997 * diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php index b3013cb8c61c9..68048996ed0f9 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php @@ -13,7 +13,7 @@ class PoisonPillRead implements PoisonPillReadInterface { /** - * Returns get latest version of poison pill. + * Stub implementation. * * @todo Will use cache storage after @MC-15997 * From 406bcfd39c864fbe6e29931f54b4cc7b1181019b Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Thu, 25 Apr 2019 11:17:29 -0500 Subject: [PATCH 274/318] MAGETWO-99402: [MFTF] One Page Checkout with Addresses Search - Custom customer address attribute --- .../AdminEditCustomerAddressesFromActionGroup.xml | 9 +++++++++ .../Customer/Test/Mftf/Data/CustomerData.xml | 14 ++++++++++++++ .../Section/AdminEditCustomerAddressesSection.xml | 1 + 3 files changed, 24 insertions(+) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml index 594337c1a6922..9c38f23739b10 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml @@ -39,4 +39,13 @@
+ + + + + + + + + diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index f561e413a01f1..f8943dcfe8369 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -216,4 +216,18 @@ 0 0
+ + 0 + true + true + John.Doe@example.com + John + Doe + John Doe + pwdTest123! + 0 + 0 + US_Address_TX + US_Address_NY_Not_Default_Address + diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerAddressesSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerAddressesSection.xml index ffddc6292ef5d..4d66b40ee660b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerAddressesSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerAddressesSection.xml @@ -25,6 +25,7 @@ + From 694dc09c90fd90a2b484e834c4949f6f44af41f3 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Thu, 25 Apr 2019 11:33:14 -0500 Subject: [PATCH 275/318] magento/magento2#22074: Added strict type to the introduced method --- app/code/Magento/Catalog/Controller/Category/View.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index 5129692146ff6..da3d99a8d2745 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -230,7 +230,7 @@ public function execute() * @param Category $category * @return string */ - private function getPageType(Category $category) + private function getPageType(Category $category) : string { $hasChildren = $category->hasChildren(); if ($category->getIsAnchor()) { From 23e9dc45b1f6cc48b4bf42ad6a1f3980dddd083b Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 25 Apr 2019 12:06:12 -0500 Subject: [PATCH 276/318] MC-16040: Fix data cleanup after test --- ...oriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index ee3682c8ad4d7..52dce4d67f698 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -40,6 +40,7 @@ + From a9c4e569cc2fe5544a99f9ad8d95d7d89cbcbc12 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 25 Apr 2019 12:12:25 -0500 Subject: [PATCH 277/318] MC-16005: Deferred loading / parsing of JS p2 --- .../Theme/Controller/Result/JsFooterPlugin.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php index bf2a6c28709ac..ba2df6d66430e 100644 --- a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php @@ -37,15 +37,15 @@ public function __construct(ScopeConfigInterface $scopeConfig) */ public function beforeSendResponse(Http $subject) { - if ( - $this->scopeConfig->isSetFlag( - self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM, - ScopeInterface::SCOPE_STORE - ) - ) { - $content = $subject->getContent(); - $script = []; - if (strpos($content, 'getContent(); + $script = []; + if (strpos($content, 'scopeConfig->isSetFlag( + self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM, + ScopeInterface::SCOPE_STORE + ) + ) { $pattern = '#]*+(?.*?#is'; $content = preg_replace_callback( $pattern, From f96f890338dea8b1ca0eca02800244874a7de29b Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 25 Apr 2019 13:33:11 -0500 Subject: [PATCH 278/318] MC-13613 Product mass update --- .../MessageQueue/Test/Unit/ConsumerTest.php | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php index 5eb7cd587aaa2..7a3eb3b16baca 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php +++ b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php @@ -6,6 +6,8 @@ namespace Magento\Framework\MessageQueue\Test\Unit; +use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface; +use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface; use Magento\Framework\Phrase; /** @@ -65,6 +67,16 @@ class ConsumerTest extends \PHPUnit\Framework\TestCase */ private $consumer; + /** + * @var PoisonPillReadInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $poisonPillRead; + + /** + * @var PoisonPillCompareInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $poisonPillCompare; + /** * Set up. * @@ -85,8 +97,15 @@ protected function setUp() ->disableOriginalConstructor()->getMock(); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->poisonPillCompare = $this->getMockBuilder(PoisonPillCompareInterface::class) + ->disableOriginalConstructor()->getMock(); + $this->poisonPillRead = $this->getMockBuilder(PoisonPillReadInterface::class) + ->disableOriginalConstructor()->getMock(); //Hard dependency used because CallbackInvoker invokes closure logic defined inside of Customer class. - $this->callbackInvoker = new \Magento\Framework\MessageQueue\CallbackInvoker(); + $this->callbackInvoker = new \Magento\Framework\MessageQueue\CallbackInvoker( + $this->poisonPillRead, + $this->poisonPillCompare + ); $this->consumer = $objectManager->getObject( \Magento\Framework\MessageQueue\Consumer::class, [ @@ -134,7 +153,8 @@ public function testProcessWithNotFoundException() $numberOfMessages = 1; $consumerName = 'consumer.name'; $exceptionPhrase = new Phrase('Exception successfully thrown'); - + $this->poisonPillRead->expects($this->atLeastOnce())->method('getLatestVersion')->willReturn('version-1'); + $this->poisonPillCompare->expects($this->atLeastOnce())->method('isLatestVersion')->willReturn(true); $queue = $this->getMockBuilder(\Magento\Framework\MessageQueue\QueueInterface::class) ->disableOriginalConstructor()->getMock(); $this->configuration->expects($this->once())->method('getQueue')->willReturn($queue); From 2d7d5f4e61c63c6fab302e329fe0cb4e9617acca Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 25 Apr 2019 15:04:02 -0500 Subject: [PATCH 279/318] MAGETWO-99418: Deliver critical PR for 2.3.2 --- app/code/Magento/Config/composer.json | 1 - .../Model/ResourceModel/PoisonPill.php | 14 -------------- app/code/Magento/Store/composer.json | 1 - .../Theme/Controller/Result/JsFooterPlugin.php | 5 ++--- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index 3312fb630ccda..57c067d2cae27 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -7,7 +7,6 @@ "require": { "php": "~7.1.3||~7.2.0", "magento/framework": "*", - "magento/module-message-queue": "*", "magento/module-backend": "*", "magento/module-cron": "*", "magento/module-deploy": "*", diff --git a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php index e7dbc1af3f2b8..20687ca4cede2 100644 --- a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php +++ b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php @@ -9,7 +9,6 @@ use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface; use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface; -use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; /** @@ -22,19 +21,6 @@ class PoisonPill extends AbstractDb implements PoisonPillPutInterface, PoisonPil */ const QUEUE_POISON_PILL_TABLE = 'queue_poison_pill'; - /** - * PoisonPill constructor. - * - * @param Context $context - * @param string|null $connectionName - */ - public function __construct( - Context $context, - string $connectionName = null - ) { - parent::__construct($context, $connectionName); - } - /** * @inheritdoc */ diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index da408f105ccb6..ebaa32b95f48b 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -7,7 +7,6 @@ "require": { "php": "~7.1.3||~7.2.0", "magento/framework": "*", - "magento/module-message-queue": "*", "magento/module-catalog": "*", "magento/module-config": "*", "magento/module-directory": "*", diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php index ba2df6d66430e..14043f950ae16 100644 --- a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php @@ -40,11 +40,10 @@ public function beforeSendResponse(Http $subject) $content = $subject->getContent(); $script = []; if (strpos($content, 'scopeConfig->isSetFlag( + if ($this->scopeConfig->isSetFlag( self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM, ScopeInterface::SCOPE_STORE - ) + ) ) { $pattern = '#]*+(?.*?#is'; $content = preg_replace_callback( From 13111837518928df29ffe191e85bb3438e23e933 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 25 Apr 2019 16:19:28 -0500 Subject: [PATCH 280/318] Issue-230: adding varnish - fixing dispatch --- .../Resolver/Category/CategoriesIdentity.php | 2 +- .../Category/CategoryTreeIdentity.php | 2 +- .../Model/Resolver/Product/Identity.php | 2 +- .../Model/Resolver/Block/Identity.php | 2 +- .../Model/Resolver/Page/Identity.php | 2 +- .../Magento/GraphQl/Controller/GraphQl.php | 22 ++++++++++----- .../Controller/Plugin/GraphQl.php | 27 ++++++++----------- .../Magento/GraphQlCache/etc/graphql/di.xml | 1 + .../Controller/GraphQlControllerTest.php | 23 +++------------- .../Framework/App/PageCache/Kernel.php | 2 +- .../Query/Resolver/IdentityInterface.php | 2 +- .../MetaReader/CacheTagReader.php | 2 +- .../MetaReader/FieldMetaReader.php | 9 ++----- .../GraphQlReader/Reader/InputObjectType.php | 9 ++----- .../GraphQlReader/Reader/InterfaceType.php | 9 ++----- .../GraphQlReader/Reader/ObjectType.php | 9 ++----- 16 files changed, 47 insertions(+), 78 deletions(-) diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoriesIdentity.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoriesIdentity.php index d81f6db574a3d..aba2d7b198dbd 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoriesIdentity.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoriesIdentity.php @@ -18,7 +18,7 @@ class CategoriesIdentity implements IdentityInterface * Get category IDs from resolved data * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData): array { diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoryTreeIdentity.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoryTreeIdentity.php index 8cc77b53c5aaa..e4970f08b3eb7 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoryTreeIdentity.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CategoryTreeIdentity.php @@ -18,7 +18,7 @@ class CategoryTreeIdentity implements IdentityInterface * Get category ID from resolved data * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData): array { diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Identity.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Identity.php index bbb0057befc7a..198b1c112dca2 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Identity.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Identity.php @@ -18,7 +18,7 @@ class Identity implements IdentityInterface * Get product ids for cache tag * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData): array { diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/Block/Identity.php b/app/code/Magento/CmsGraphQl/Model/Resolver/Block/Identity.php index 9431d20692187..a40d23968c3c6 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/Block/Identity.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/Block/Identity.php @@ -19,7 +19,7 @@ class Identity implements IdentityInterface * Get block identities from resolved data * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData): array { diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/Page/Identity.php b/app/code/Magento/CmsGraphQl/Model/Resolver/Page/Identity.php index 5a11587f4b1e5..abc306451e309 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/Page/Identity.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/Page/Identity.php @@ -19,7 +19,7 @@ class Identity implements IdentityInterface * Get page ID from resolved data * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData): array { diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index f31492f8389f6..4271ac3f6c585 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -15,8 +15,8 @@ use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; use Magento\Framework\GraphQl\Schema\SchemaGeneratorInterface; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Webapi\Response; +use Magento\Framework\App\Response\Http as HttpResponse; use Magento\Framework\GraphQl\Query\Fields as QueryFields; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\App\ObjectManager; @@ -30,7 +30,7 @@ class GraphQl implements FrontControllerInterface { /** - * @var Response + * @var \Magento\Framework\Webapi\Response * @deprecated */ private $response; @@ -75,6 +75,11 @@ class GraphQl implements FrontControllerInterface */ private $jsonFactory; + /** + * @var HttpResponse + */ + private $httpResponse; + /** * @param Response $response * @param SchemaGeneratorInterface $schemaGenerator @@ -85,6 +90,8 @@ class GraphQl implements FrontControllerInterface * @param HttpRequestProcessor $requestProcessor * @param QueryFields $queryFields * @param JsonFactory|null $jsonFactory + * @param HttpResponse|null $httpResponse + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( Response $response, @@ -95,7 +102,8 @@ public function __construct( ContextInterface $resolverContext, HttpRequestProcessor $requestProcessor, QueryFields $queryFields, - JsonFactory $jsonFactory = null + JsonFactory $jsonFactory = null, + HttpResponse $httpResponse = null ) { $this->response = $response; $this->schemaGenerator = $schemaGenerator; @@ -106,15 +114,16 @@ public function __construct( $this->requestProcessor = $requestProcessor; $this->queryFields = $queryFields; $this->jsonFactory = $jsonFactory ?:ObjectManager::getInstance()->get(JsonFactory::class); + $this->httpResponse = $httpResponse ?:ObjectManager::getInstance()->get(HttpResponse::class); } /** * Handle GraphQL request * * @param RequestInterface $request - * @return ResultInterface + * @return Response */ - public function dispatch(RequestInterface $request) + public function dispatch(RequestInterface $request) : HttpResponse { $statusCode = 200; $jsonResult = $this->jsonFactory->create(); @@ -145,7 +154,8 @@ public function dispatch(RequestInterface $request) $jsonResult->setHttpResponseCode($statusCode); $jsonResult->setData($result); - return $jsonResult; + $jsonResult->renderResult($this->httpResponse); + return $this->httpResponse; } /** diff --git a/app/code/Magento/GraphQlCache/Controller/Plugin/GraphQl.php b/app/code/Magento/GraphQlCache/Controller/Plugin/GraphQl.php index 588aa851e880a..7c026e7d4136e 100644 --- a/app/code/Magento/GraphQlCache/Controller/Plugin/GraphQl.php +++ b/app/code/Magento/GraphQlCache/Controller/Plugin/GraphQl.php @@ -9,15 +9,15 @@ use Magento\Framework\App\FrontControllerInterface; use Magento\Framework\App\RequestInterface; -use Magento\Framework\App\ResponseInterface; use Magento\GraphQlCache\Model\CacheableQuery; use Magento\Framework\App\Response\Http as HttpResponse; use Magento\Framework\Controller\ResultInterface; use Magento\PageCache\Model\Config; use Magento\GraphQl\Controller\HttpRequestProcessor; +use Magento\Framework\App\Response\Http as ResponseHttp; /** - * Class Plugin + * Plugin for handling controller after controller tags and pre-controller validation. */ class GraphQl { @@ -76,24 +76,19 @@ public function beforeDispatch( } /** - * Plugin for GraphQL after dispatch to set tag and cache headers + * Plugin for GraphQL after render from dispatch to set tag and cache headers * - * The $response doesn't have a set type because it's alternating between ResponseInterface and ResultInterface - * depending if it comes from builtin cache or the dispatch. + * @param ResultInterface $subject + * @param ResultInterface $result + * @param ResponseHttp $response + * @return ResultInterface * - * @param FrontControllerInterface $subject - * @param ResponseInterface|ResultInterface $response - * @param RequestInterface $request - * @return ResponseInterface|ResultInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDispatch( - FrontControllerInterface $subject, - $response, - RequestInterface $request - ) { + public function afterRenderResult(ResultInterface $subject, ResultInterface $result, ResponseHttp $response) + { $sendNoCacheHeaders = false; - if ($this->config->isEnabled() && $request->isGet()) { + if ($this->config->isEnabled()) { if ($this->cacheableQuery->shouldPopulateCacheHeadersWithTags()) { $this->response->setPublicHeaders($this->config->getTtl()); $this->response->setHeader('X-Magento-Tags', implode(',', $this->cacheableQuery->getCacheTags()), true); @@ -108,6 +103,6 @@ public function afterDispatch( $this->response->setNoCacheHeaders(); } - return $response; + return $result; } } diff --git a/app/code/Magento/GraphQlCache/etc/graphql/di.xml b/app/code/Magento/GraphQlCache/etc/graphql/di.xml index 6636ebacf9e5c..5dd8c816ce929 100644 --- a/app/code/Magento/GraphQlCache/etc/graphql/di.xml +++ b/app/code/Magento/GraphQlCache/etc/graphql/di.xml @@ -19,6 +19,7 @@ type="Magento\GraphQlCache\Model\Plugin\App\PageCache\Identifier" sortOrder="1"/> + diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php index 49cdca8372593..d0d746812ec44 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php @@ -101,11 +101,7 @@ public function testDispatch() : void $headers = $this->objectManager->create(\Zend\Http\Headers::class) ->addHeaders(['Content-Type' => 'application/json']); $this->request->setHeaders($headers); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->create(\Magento\Framework\App\Response\Http::class); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphql->dispatch($this->request); - $result->renderResult($response); + $response = $this->graphql->dispatch($this->request); $output = $this->jsonSerializer->unserialize($response->getContent()); $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); @@ -147,11 +143,7 @@ public function testDispatchWithGet() : void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->create(\Magento\Framework\App\Response\Http::class); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphql->dispatch($this->request); - $result->renderResult($response); + $response = $this->graphql->dispatch($this->request); $output = $this->jsonSerializer->unserialize($response->getContent()); $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); @@ -203,11 +195,6 @@ public function testDispatchGetWithParameterizedVariables() : void $this->request->setMethod('GET'); $this->request->setParams($queryParams); $response = $this->graphql->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->create(\Magento\Framework\App\Response\Http::class); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphql->dispatch($this->request); - $result->renderResult($response); $output = $this->jsonSerializer->unserialize($response->getContent()); $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); @@ -257,11 +244,7 @@ public function testError() : void $headers = $this->objectManager->create(\Zend\Http\Headers::class) ->addHeaders(['Content-Type' => 'application/json']); $this->request->setHeaders($headers); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->create(\Magento\Framework\App\Response\Http::class); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphql->dispatch($this->request); - $result->renderResult($response); + $response = $this->graphql->dispatch($this->request); $outputResponse = $this->jsonSerializer->unserialize($response->getContent()); if (isset($outputResponse['errors'][0])) { if (is_array($outputResponse['errors'][0])) { diff --git a/lib/internal/Magento/Framework/App/PageCache/Kernel.php b/lib/internal/Magento/Framework/App/PageCache/Kernel.php index f89fe93957a97..b507e2e5ca43a 100644 --- a/lib/internal/Magento/Framework/App/PageCache/Kernel.php +++ b/lib/internal/Magento/Framework/App/PageCache/Kernel.php @@ -69,7 +69,7 @@ class Kernel * @param \Magento\Framework\App\Response\HttpFactory|null $httpFactory * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer * @param AppState|null $state - * @param \Magento\PageCache\Model\Cache\Type $fullPageCache + * @param \Magento\PageCache\Model\Cache\Type|null $fullPageCache */ public function __construct( \Magento\Framework\App\PageCache\Cache $cache, diff --git a/lib/internal/Magento/Framework/GraphQl/Query/Resolver/IdentityInterface.php b/lib/internal/Magento/Framework/GraphQl/Query/Resolver/IdentityInterface.php index b0cad2f133a7e..d65e86a37550d 100644 --- a/lib/internal/Magento/Framework/GraphQl/Query/Resolver/IdentityInterface.php +++ b/lib/internal/Magento/Framework/GraphQl/Query/Resolver/IdentityInterface.php @@ -14,7 +14,7 @@ interface IdentityInterface * Get identities from resolved data * * @param array $resolvedData - * @return array + * @return string[] */ public function getIdentities(array $resolvedData) : array; } diff --git a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/CacheTagReader.php b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/CacheTagReader.php index 666dfa8d3e8a9..2613b2829e79a 100644 --- a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/CacheTagReader.php +++ b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/CacheTagReader.php @@ -8,7 +8,7 @@ namespace Magento\Framework\GraphQlSchemaStitching\GraphQlReader\MetaReader; /** - * Reads documentation from the annotation @cacheable of an AST node + * Reads documentation from the annotation @cache of an AST node */ class CacheTagReader { diff --git a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/FieldMetaReader.php b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/FieldMetaReader.php index c20a3875e71fb..554d2636cf8c3 100644 --- a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/FieldMetaReader.php +++ b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/MetaReader/FieldMetaReader.php @@ -39,13 +39,8 @@ public function __construct( ) { $this->typeMetaReader = $typeMetaReader; $this->docReader = $docReader; - if ($cacheTagReader) { - $this->cacheTagReader = $cacheTagReader; - } else { - $this->cacheTagReader = \Magento\Framework\App\ObjectManager::getInstance()->get( - CacheTagReader::class - ); - } + $this->cacheTagReader = $cacheTagReader ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(CacheTagReader::class); } /** diff --git a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InputObjectType.php b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InputObjectType.php index 92ac22607b981..2eda79ce68b04 100644 --- a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InputObjectType.php +++ b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InputObjectType.php @@ -44,13 +44,8 @@ public function __construct( ) { $this->typeMetaReader = $typeMetaReader; $this->docReader = $docReader; - if ($cacheTagReader) { - $this->cacheTagReader = $cacheTagReader; - } else { - $this->cacheTagReader = \Magento\Framework\App\ObjectManager::getInstance()->get( - CacheTagReader::class - ); - } + $this->cacheTagReader = $cacheTagReader ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(CacheTagReader::class); } /** diff --git a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InterfaceType.php b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InterfaceType.php index bd21e6361d4c4..7c040cd2e104c 100644 --- a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InterfaceType.php +++ b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/InterfaceType.php @@ -44,13 +44,8 @@ public function __construct( ) { $this->fieldMetaReader = $fieldMetaReader; $this->docReader = $docReader; - if ($cacheTagReader) { - $this->cacheTagReader = $cacheTagReader; - } else { - $this->cacheTagReader = \Magento\Framework\App\ObjectManager::getInstance()->get( - CacheTagReader::class - ); - } + $this->cacheTagReader = $cacheTagReader ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(CacheTagReader::class); } /** diff --git a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/ObjectType.php b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/ObjectType.php index 361eb30423a98..77a44460f00ae 100644 --- a/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/ObjectType.php +++ b/lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader/Reader/ObjectType.php @@ -54,13 +54,8 @@ public function __construct( $this->fieldMetaReader = $fieldMetaReader; $this->docReader = $docReader; $this->implementsAnnotation = $implementsAnnotation; - if ($cacheTagReader) { - $this->cacheTagReader = $cacheTagReader; - } else { - $this->cacheTagReader = \Magento\Framework\App\ObjectManager::getInstance()->get( - CacheTagReader::class - ); - } + $this->cacheTagReader = $cacheTagReader ?? \Magento\Framework\App\ObjectManager::getInstance() + ->get(CacheTagReader::class); } /** From 4c8e768b4907bd81105a89e574b62b61d58be820 Mon Sep 17 00:00:00 2001 From: Prabhu Ram Date: Thu, 25 Apr 2019 16:37:45 -0500 Subject: [PATCH 281/318] MC-15960: Separate Graphql cache handing in VCL for the /graphql area - Modified vcls to separate graphql cache handling --- app/code/Magento/PageCache/etc/varnish4.vcl | 16 +++++++++++----- app/code/Magento/PageCache/etc/varnish5.vcl | 6 ++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl index 67c097241f868..2ee0aaa945fcd 100644 --- a/app/code/Magento/PageCache/etc/varnish4.vcl +++ b/app/code/Magento/PageCache/etc/varnish4.vcl @@ -123,11 +123,8 @@ sub vcl_hash { hash_data(server.ip); } - if (req.http.Store) { - hash_data(req.http.Store); - } - if (req.http.Content-Currency) { - hash_data(req.http.Content-Currency); + if (req.url ~ "graphql") { + call process_graphql_headers; } # To make sure http users don't see ssl warning @@ -137,6 +134,15 @@ sub vcl_hash { /* {{ design_exceptions_code }} */ } +sub process_graphql_headers { + if (req.http.Store) { + hash_data(req.http.Store); + } + if (req.http.Content-Currency) { + hash_data(req.http.Content-Currency); + } +} + sub vcl_backend_response { set beresp.grace = 3d; diff --git a/app/code/Magento/PageCache/etc/varnish5.vcl b/app/code/Magento/PageCache/etc/varnish5.vcl index 72a6e734f2628..1a8c552ac7550 100644 --- a/app/code/Magento/PageCache/etc/varnish5.vcl +++ b/app/code/Magento/PageCache/etc/varnish5.vcl @@ -130,6 +130,12 @@ sub vcl_hash { } /* {{ design_exceptions_code }} */ + if (req.url ~ "graphql") { + call process_graphql_headers; + } +} + +sub process_graphql_headers { if (req.http.Store) { hash_data(req.http.Store); } From db3b5e1dd6977a35591b90cea310a81df7710714 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 25 Apr 2019 16:46:11 -0500 Subject: [PATCH 282/318] Issue-230: adding varnish - fixing dispatch tests --- .../Framework/GraphQl/Config/GraphQlReaderTest.php | 6 +----- .../Catalog/CategoriesWithProductsCacheTest.php | 6 +----- .../Controller/Catalog/CategoryCacheTest.php | 7 +------ .../Catalog/DeepNestedCategoriesAndProductsTest.php | 6 +----- .../Controller/Catalog/ProductsCacheTest.php | 13 ++----------- .../GraphQlCache/Controller/Cms/BlockCacheTest.php | 6 +----- .../Controller/Cms/CmsPageCacheTest.php | 6 +----- 7 files changed, 8 insertions(+), 42 deletions(-) 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 f6994931562c2..af8d1c7af134b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php @@ -187,11 +187,7 @@ enumValues(includeDeprecated: true) { ->addHeaders(['Content-Type' => 'application/json']); $request->setHeaders($headers); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->create(\Magento\Framework\App\Response\Http::class); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphQlController->dispatch($request); - $result->renderResult($response); + $response = $this->graphQlController->dispatch($request); $output = $this->jsonSerializer->unserialize($response->getContent()); $expectedOutput = require __DIR__ . '/../_files/schema_response_sdl_description.php'; diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoriesWithProductsCacheTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoriesWithProductsCacheTest.php index f137a2aca8d4c..62cda28a4493a 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoriesWithProductsCacheTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoriesWithProductsCacheTest.php @@ -94,11 +94,7 @@ public function testToCheckRequestCacheTagsForCategoryWithProducts(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setParams($queryParams); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $expectedCacheTags = ['cat_c','cat_c_' . $categoryId,'cat_p','cat_p_' . $product->getId(),'FPC']; $actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoryCacheTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoryCacheTest.php index 3c2f46e1474b9..96f6685233f2c 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoryCacheTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/CategoryCacheTest.php @@ -62,12 +62,7 @@ public function testToCheckRequestCacheTagsForForCategory(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - /** @var $registry \Magento\Framework\Registry */ - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); $expectedCacheTags = ['cat_c','cat_c_' . $categoryId,'FPC']; diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/DeepNestedCategoriesAndProductsTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/DeepNestedCategoriesAndProductsTest.php index f8cc7f0e59105..7f992a0843f7c 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/DeepNestedCategoriesAndProductsTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/DeepNestedCategoriesAndProductsTest.php @@ -115,11 +115,7 @@ public function testDispatchForCacheHeadersOnDeepNestedQueries(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphql->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - $result->renderResult($response); + $response = $this->graphql->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); $this->assertEmpty( diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/ProductsCacheTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/ProductsCacheTest.php index ec55bfcb4928b..78534176a3525 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/ProductsCacheTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Catalog/ProductsCacheTest.php @@ -74,12 +74,7 @@ public function testToCheckRequestCacheTagsForProducts(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - /** @var $registry \Magento\Framework\Registry */ - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); $expectedCacheTags = ['cat_p', 'cat_p_' . $product->getId(), 'FPC']; @@ -111,11 +106,7 @@ public function testToCheckRequestNoTagsForProducts(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $actualCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); $expectedCacheTags = ['FPC']; diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/BlockCacheTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/BlockCacheTest.php index 6e9d2ca0f491b..160f5f9109f30 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/BlockCacheTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/BlockCacheTest.php @@ -68,11 +68,7 @@ public function testCmsBlocksRequestHasCorrectTags(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $expectedCacheTags = ['cms_b', 'cms_b_' . $block->getId(), 'cms_b_' . $block->getIdentifier(), 'FPC']; $rawActualCacheTags = $response->getHeader('X-Magento-Tags')->getFieldValue(); diff --git a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/CmsPageCacheTest.php b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/CmsPageCacheTest.php index fc797b01658ec..8d4bbfc0f2b17 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/CmsPageCacheTest.php +++ b/dev/tests/integration/testsuite/Magento/GraphQlCache/Controller/Cms/CmsPageCacheTest.php @@ -71,11 +71,7 @@ public function testToCheckCmsPageRequestCacheTags(): void $this->request->setPathInfo('/graphql'); $this->request->setMethod('GET'); $this->request->setQueryValue('query', $query); - /** @var \Magento\Framework\Controller\Result\Json $result */ - $result = $this->graphqlController->dispatch($this->request); - /** @var \Magento\Framework\App\Response\Http $response */ - $response = $this->objectManager->get(\Magento\Framework\App\Response\Http::class); - $result->renderResult($response); + $response = $this->graphqlController->dispatch($this->request); $this->assertEquals('MISS', $response->getHeader('X-Magento-Cache-Debug')->getFieldValue()); $requestedCacheTags = explode(',', $response->getHeader('X-Magento-Tags')->getFieldValue()); $expectedCacheTags = ['cms_p', 'cms_p_' .$pageId , 'FPC']; From cbe4d208ed610e45a4225c5a85249a600cc02714 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 25 Apr 2019 17:09:32 -0500 Subject: [PATCH 283/318] magento-engcom/msi#2110: Unskip MFTF for MAGETWO-44165 --- .../Test/Mftf/Test/AdminCreateAndSwitchProductType.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml index 93df31a7d89e5..2cc71964042a4 100755 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml @@ -53,9 +53,6 @@ - - - @@ -93,10 +90,6 @@ - - - - @@ -139,9 +132,6 @@ - - - From a7d21949bff10054751e7d9411292981420f64a6 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 25 Apr 2019 17:12:13 -0500 Subject: [PATCH 284/318] MSI 1.1.2 Release preparation --- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 35ba5803b09cc..055a3faf70be7 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -214,3 +214,4 @@ Magento/Elasticsearch/Model/Layer/Search Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldName/Resolver Magento/Elasticsearch6/Model/Client Magento/Config/App/Config/Type +Magento/InventoryReservationCli/Test/Integration From f9767ec1495fab540d3a0290d6dac8e52049e35d Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 25 Apr 2019 17:13:01 -0500 Subject: [PATCH 285/318] Issue-230: adding varnish - fixing controller type --- app/code/Magento/GraphQl/Controller/GraphQl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 4271ac3f6c585..5c6ed5feb5fd0 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -10,6 +10,7 @@ use Magento\Framework\App\FrontControllerInterface; use Magento\Framework\App\Request\Http; use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\ResponseInterface; use Magento\Framework\GraphQl\Exception\ExceptionFormatter; use Magento\Framework\GraphQl\Query\QueryProcessor; use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; @@ -121,9 +122,9 @@ public function __construct( * Handle GraphQL request * * @param RequestInterface $request - * @return Response + * @return ResponseInterface */ - public function dispatch(RequestInterface $request) : HttpResponse + public function dispatch(RequestInterface $request) : ResponseInterface { $statusCode = 200; $jsonResult = $this->jsonFactory->create(); From b50dbca8693b6ca49dd633cf121edecec99da128 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 25 Apr 2019 17:14:51 -0500 Subject: [PATCH 286/318] MC-15534: [MSI] Remove blacklisted dependency --- .../Integrity/DeclarativeDependencyTest.php | 34 ------------------- .../blacklisted_dependencies_ce.php | 9 ----- 2 files changed, 43 deletions(-) delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/blacklisted_dependencies_ce.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php index 87cc5afd5ecb3..46bbc93db49e9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php @@ -22,11 +22,6 @@ class DeclarativeDependencyTest extends \PHPUnit\Framework\TestCase */ private $dependencyProvider; - /** - * @var array - */ - private $blacklistedDependencies = []; - /** * Sets up data * @@ -50,14 +45,6 @@ protected function setUp() */ public function testUndeclaredDependencies() { - /** TODO: Remove this temporary solution after MC-15534 is closed */ - $filePattern = __DIR__ . '/_files/dependency_test/blacklisted_dependencies_*.php'; - $blacklistedDependencies = []; - foreach (glob($filePattern) as $fileName) { - $blacklistedDependencies = array_merge($blacklistedDependencies, require $fileName); - } - $this->blacklistedDependencies = $blacklistedDependencies; - $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this); $invoker( /** @@ -84,9 +71,6 @@ function ($file) { $result = []; foreach ($undeclaredDependency as $name => $modules) { $modules = array_unique($modules); - if ($this->filterBlacklistedDependencies($foundModuleName, $modules)) { - $result[] = $this->getErrorMessage($name) . "\n" . implode("\t\n", $modules) . "\n"; - } } if (!empty($result)) { $this->fail( @@ -98,24 +82,6 @@ function ($file) { ); } - /** - * Filter blacklisted dependencies. - * - * @todo Remove this temporary solution after MC-15534 is closed - * - * @param string $moduleName - * @param array $dependencies - * @return array - */ - private function filterBlacklistedDependencies(string $moduleName, array $dependencies): array - { - if (!empty($this->blacklistedDependencies[$moduleName])) { - $dependencies = array_diff($dependencies, $this->blacklistedDependencies[$moduleName]); - } - - return $dependencies; - } - /** * Convert file list to data provider structure. * diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/blacklisted_dependencies_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/blacklisted_dependencies_ce.php deleted file mode 100644 index 270cb99c29caa..0000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/blacklisted_dependencies_ce.php +++ /dev/null @@ -1,9 +0,0 @@ - ["Magento\Inventory"], -]; From 059ac0d5cc760d2adadec46892a1f91f4afa706d Mon Sep 17 00:00:00 2001 From: Prabhu Ram Date: Thu, 25 Apr 2019 17:31:54 -0500 Subject: [PATCH 287/318] MC-15960: Separate Graphql cache handing in VCL for the /graphql area - Modified vcls to separate graphql cache handling for queries starting with /graphql --- app/code/Magento/PageCache/etc/varnish4.vcl | 2 +- app/code/Magento/PageCache/etc/varnish5.vcl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl index 2ee0aaa945fcd..6de6b4e917044 100644 --- a/app/code/Magento/PageCache/etc/varnish4.vcl +++ b/app/code/Magento/PageCache/etc/varnish4.vcl @@ -123,7 +123,7 @@ sub vcl_hash { hash_data(server.ip); } - if (req.url ~ "graphql") { + if (req.url ~ "/graphql") { call process_graphql_headers; } diff --git a/app/code/Magento/PageCache/etc/varnish5.vcl b/app/code/Magento/PageCache/etc/varnish5.vcl index 1a8c552ac7550..4505e74629714 100644 --- a/app/code/Magento/PageCache/etc/varnish5.vcl +++ b/app/code/Magento/PageCache/etc/varnish5.vcl @@ -130,7 +130,7 @@ sub vcl_hash { } /* {{ design_exceptions_code }} */ - if (req.url ~ "graphql") { + if (req.url ~ "/graphql") { call process_graphql_headers; } } From 32443776da0b10507eacf8c49f97999101e926e7 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 25 Apr 2019 17:48:57 -0500 Subject: [PATCH 288/318] MAGETWO-99418: Deliver critical PR for 2.3.2 --- app/code/Magento/MessageQueue/Model/PoisonPillCompare.php | 2 +- .../MessageQueue/Model/ResourceModel/PoisonPill.php | 8 ++++---- .../Framework/MessageQueue/PoisonPill/PoisonPillRead.php | 4 ++-- .../MessageQueue/PoisonPill/PoisonPillReadInterface.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/MessageQueue/Model/PoisonPillCompare.php b/app/code/Magento/MessageQueue/Model/PoisonPillCompare.php index a4c89fd26506b..ffa478aecf36c 100644 --- a/app/code/Magento/MessageQueue/Model/PoisonPillCompare.php +++ b/app/code/Magento/MessageQueue/Model/PoisonPillCompare.php @@ -35,6 +35,6 @@ public function __construct( */ public function isLatestVersion(string $poisonPillVersion): bool { - return (string) $poisonPillVersion === (string) $this->poisonPillRead->getLatestVersion(); + return $poisonPillVersion === $this->poisonPillRead->getLatestVersion(); } } diff --git a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php index 20687ca4cede2..bc4b43c419780 100644 --- a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php +++ b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php @@ -50,7 +50,7 @@ public function put(): string /** * @inheritdoc */ - public function getLatestVersion(): ?string + public function getLatestVersion(): string { return $this->getVersionFromDb(); } @@ -58,9 +58,9 @@ public function getLatestVersion(): ?string /** * Returns version form DB or null. * - * @return string|null + * @return string */ - private function getVersionFromDb(): ?string + private function getVersionFromDb(): string { $select = $this->getConnection()->select()->from( $this->getTable(self::QUEUE_POISON_PILL_TABLE), @@ -69,6 +69,6 @@ private function getVersionFromDb(): ?string $result = $this->getConnection()->fetchOne($select); - return $result === false ? null : $result; + return (string)$result; } } diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php index 68048996ed0f9..0f0ed5a807473 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillRead.php @@ -19,8 +19,8 @@ class PoisonPillRead implements PoisonPillReadInterface * * @return string */ - public function getLatestVersion(): ?string + public function getLatestVersion(): string { - return null; + return ''; } } diff --git a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillReadInterface.php b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillReadInterface.php index 55ff5feb2d9b2..6748e3208611f 100644 --- a/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillReadInterface.php +++ b/lib/internal/Magento/Framework/MessageQueue/PoisonPill/PoisonPillReadInterface.php @@ -17,5 +17,5 @@ interface PoisonPillReadInterface * * @return string */ - public function getLatestVersion(): ?string; + public function getLatestVersion(): string; } From 32a6114c4d8a1471fa1fd6fe8b4b87aa56916aef Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 25 Apr 2019 18:13:33 -0500 Subject: [PATCH 289/318] MC-15534: [MSI] Remove blacklisted dependency --- .../Magento/Test/Integrity/DeclarativeDependencyTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php index 46bbc93db49e9..e090338f90c65 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DeclarativeDependencyTest.php @@ -71,6 +71,7 @@ function ($file) { $result = []; foreach ($undeclaredDependency as $name => $modules) { $modules = array_unique($modules); + $result[] = $this->getErrorMessage($name) . "\n" . implode("\t\n", $modules) . "\n"; } if (!empty($result)) { $this->fail( From 97bdecc78dde3a0c6d8eeaad98ecdfe50e8575be Mon Sep 17 00:00:00 2001 From: Nazarn96 Date: Fri, 26 Apr 2019 10:48:30 +0300 Subject: [PATCH 290/318] magento/magento2#22302 Static test fix --- app/code/Magento/Cms/Block/Block.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Block/Block.php b/app/code/Magento/Cms/Block/Block.php index 4fc37b50dcbc0..c611f4b1e9f05 100644 --- a/app/code/Magento/Cms/Block/Block.php +++ b/app/code/Magento/Cms/Block/Block.php @@ -86,7 +86,7 @@ public function getIdentities() } /** - * {@inheritdoc} + * @inheritdoc */ public function getCacheKeyInfo() { From 0a0b32b177b66a3d87b91347eec828cbc5086449 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Fri, 26 Apr 2019 09:20:53 -0500 Subject: [PATCH 291/318] Issue-230: adding varnish - fixing static --- app/code/Magento/GraphQl/Controller/GraphQl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 5c6ed5feb5fd0..75b3ad277c603 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -114,8 +114,8 @@ public function __construct( $this->resolverContext = $resolverContext; $this->requestProcessor = $requestProcessor; $this->queryFields = $queryFields; - $this->jsonFactory = $jsonFactory ?:ObjectManager::getInstance()->get(JsonFactory::class); - $this->httpResponse = $httpResponse ?:ObjectManager::getInstance()->get(HttpResponse::class); + $this->jsonFactory = $jsonFactory ?: ObjectManager::getInstance()->get(JsonFactory::class); + $this->httpResponse = $httpResponse ?: ObjectManager::getInstance()->get(HttpResponse::class); } /** From c1ba453f6bf1a6cb59af3cf6cf10dce8d22ab83a Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Fri, 26 Apr 2019 10:30:47 -0500 Subject: [PATCH 292/318] MAGETWO-99418: Deliver critical PR for 2.3.2 --- .../Magento/MessageQueue/Model/ResourceModel/PoisonPill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php index bc4b43c419780..e59abec8724fb 100644 --- a/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php +++ b/app/code/Magento/MessageQueue/Model/ResourceModel/PoisonPill.php @@ -38,7 +38,7 @@ public function put(): string $table = $this->getMainTable(); $uuid = uniqid('version-'); $version = $this->getVersionFromDb(); - if ($version !== null) { + if ($version !== '') { $connection->update($table, ['version' => $uuid]); } else { $connection->insert($table, ['version' => $uuid]); From 64bf6ddd8017b8566e094b25a7da22619b964295 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Fri, 26 Apr 2019 11:28:05 -0500 Subject: [PATCH 293/318] =?UTF-8?q?GraphQL-608:=20Remove=20=E2=80=9Ccart?= =?UTF-8?q?=5Faddress=5Fid=E2=80=9D=20from=20=E2=80=9CShippingMethodInput?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/performance-toolkit/benchmark.jmx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 5521f7024722b..22af21f07abc5 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -44214,7 +44214,7 @@ vars.put("product_sku", product.get("sku")); 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} + {"query":"mutation {\n setShippingMethodsOnCart(input: \n {\n cart_id: \"${quote_id}\", \n shipping_methods: [{\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} = From 16adb974aa7f3043239a481703305f2a3fc01aa2 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Fri, 26 Apr 2019 11:50:31 -0500 Subject: [PATCH 294/318] MAGETWO-99418: Deliver critical PR for 2.3.2 --- app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php index 14043f950ae16..a234cd589904c 100644 --- a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php +++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php @@ -14,7 +14,7 @@ */ class JsFooterPlugin { - const XML_PATH_DEV_MOVE_JS_TO_BOTTOM = 'dev/js/move_inline_to_bottom'; + private const XML_PATH_DEV_MOVE_JS_TO_BOTTOM = 'dev/js/move_inline_to_bottom'; /** * @var ScopeConfigInterface From 157f52095f541a51f2a0f86d9f32d35a89156840 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Fri, 26 Apr 2019 12:21:56 -0500 Subject: [PATCH 295/318] GraphQL-601: [Test Coverage] Offline payments methods --- .../Model/Resolver/SelectedPaymentMethod.php | 1 + .../Magento/QuoteGraphQl/etc/schema.graphqls | 7 ++- .../SetOfflinePaymentMethodsOnCartTest.php | 59 +++++++++++-------- .../SetOfflinePaymentMethodsOnCartTest.php | 58 ++++++++++-------- 4 files changed, 73 insertions(+), 52 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SelectedPaymentMethod.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SelectedPaymentMethod.php index 7a99b04638ac3..8cda06eba3c91 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SelectedPaymentMethod.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SelectedPaymentMethod.php @@ -36,6 +36,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value return [ 'code' => $payment->getMethod(), + 'title' => $payment->getMethodInstance()->getTitle(), 'purchase_order_number' => $payment->getPoNumber(), ]; } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index a9784e97c8952..67e40faae40a0 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -241,12 +241,13 @@ type AvailableShippingMethod { } type AvailablePaymentMethod { - code: String @doc(description: "The payment method code") - title: String @doc(description: "The payment method title.") + code: String! @doc(description: "The payment method code") + title: String! @doc(description: "The payment method title.") } type SelectedPaymentMethod { - code: String @doc(description: "The payment method code") + code: String! @doc(description: "The payment method code") + title: String! @doc(description: "The payment method title.") purchase_order_number: String @doc(description: "The purchase order number.") } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflinePaymentMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflinePaymentMethodsOnCartTest.php index e0f4756177715..0fe7aec2d6347 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflinePaymentMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetOfflinePaymentMethodsOnCartTest.php @@ -50,23 +50,38 @@ protected function setUp() * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php * * @param string $methodCode + * @param string $methodTitle * @dataProvider offlinePaymentMethodDataProvider */ - public function testSetOfflinePaymentMethod(string $methodCode) + public function testSetOfflinePaymentMethod(string $methodCode, string $methodTitle) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery( - $maskedQuoteId, - $methodCode - ); + $query = $this->getQuery($maskedQuoteId, $methodCode); $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('setPaymentMethodOnCart', $response); self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']); self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']); - self::assertArrayHasKey('code', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']); - self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']); + + $selectedPaymentMethod = $response['setPaymentMethodOnCart']['cart']['selected_payment_method']; + self::assertArrayHasKey('code', $selectedPaymentMethod); + self::assertEquals($methodCode, $selectedPaymentMethod['code']); + + self::assertArrayHasKey('title', $selectedPaymentMethod); + self::assertEquals($methodTitle, $selectedPaymentMethod['title']); + } + + /** + * @return array + */ + public function offlinePaymentMethodDataProvider(): array + { + return [ + 'check_mo' => [Checkmo::PAYMENT_METHOD_CHECKMO_CODE, 'Check / Money order'], + 'bank_transfer' => [Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE, 'Bank Transfer Payment'], + 'cash_on_delivery' => [Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE, 'Cash On Delivery'], + ]; } /** @@ -76,12 +91,11 @@ public function testSetOfflinePaymentMethod(string $methodCode) * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php - * - * @param string $methodCode */ public function testSetPurchaseOrderPaymentMethod() { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $methodTitle = 'Purchase Order'; $methodCode = Purchaseorder::PAYMENT_METHOD_PURCHASEORDER_CODE; $poNumber = 'abc123'; @@ -97,34 +111,28 @@ public function testSetPurchaseOrderPaymentMethod() cart { selected_payment_method { code + title purchase_order_number } } } } QUERY; - $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('setPaymentMethodOnCart', $response); self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']); self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']); - self::assertArrayHasKey('code', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']); - self::assertArrayHasKey('purchase_order_number', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']); - self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']); - self::assertEquals($poNumber, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['purchase_order_number']); - } - /** - * @return array - */ - public function offlinePaymentMethodDataProvider(): array - { - return [ - 'check_mo' => [Checkmo::PAYMENT_METHOD_CHECKMO_CODE], - 'bank_transfer' => [Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE], - 'cash_on_delivery' => [Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE], - ]; + $selectedPaymentMethod = $response['setPaymentMethodOnCart']['cart']['selected_payment_method']; + self::assertArrayHasKey('code', $selectedPaymentMethod); + self::assertEquals($methodCode, $selectedPaymentMethod['code']); + + self::assertArrayHasKey('title', $selectedPaymentMethod); + self::assertEquals($methodTitle, $selectedPaymentMethod['title']); + + self::assertArrayHasKey('purchase_order_number', $selectedPaymentMethod); + self::assertEquals($poNumber, $selectedPaymentMethod['purchase_order_number']); } /** @@ -147,6 +155,7 @@ private function getQuery( cart { selected_payment_method { code + title } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflinePaymentMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflinePaymentMethodsOnCartTest.php index 83fffd9defabf..7ec3148ea85a0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflinePaymentMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetOfflinePaymentMethodsOnCartTest.php @@ -42,23 +42,38 @@ protected function setUp() * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php * * @param string $methodCode + * @param string $methodTitle * @dataProvider offlinePaymentMethodDataProvider */ - public function testSetOfflinePaymentMethod(string $methodCode) + public function testSetOfflinePaymentMethod(string $methodCode, string $methodTitle) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery( - $maskedQuoteId, - $methodCode - ); + $query = $this->getQuery($maskedQuoteId, $methodCode); $response = $this->graphQlMutation($query); self::assertArrayHasKey('setPaymentMethodOnCart', $response); self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']); self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']); - self::assertArrayHasKey('code', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']); - self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']); + + $selectedPaymentMethod = $response['setPaymentMethodOnCart']['cart']['selected_payment_method']; + self::assertArrayHasKey('code', $selectedPaymentMethod); + self::assertEquals($methodCode, $selectedPaymentMethod['code']); + + self::assertArrayHasKey('title', $selectedPaymentMethod); + self::assertEquals($methodTitle, $selectedPaymentMethod['title']); + } + + /** + * @return array + */ + public function offlinePaymentMethodDataProvider(): array + { + return [ + 'check_mo' => [Checkmo::PAYMENT_METHOD_CHECKMO_CODE, 'Check / Money order'], + 'bank_transfer' => [Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE, 'Bank Transfer Payment'], + 'cash_on_delivery' => [Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE, 'Cash On Delivery'], + ]; } /** @@ -67,13 +82,12 @@ public function testSetOfflinePaymentMethod(string $methodCode) * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php - * - * @param string $methodCode */ public function testSetPurchaseOrderPaymentMethod() { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); $methodCode = Purchaseorder::PAYMENT_METHOD_PURCHASEORDER_CODE; + $methodTitle = 'Purchase Order'; $poNumber = 'abc123'; $query = << [Checkmo::PAYMENT_METHOD_CHECKMO_CODE], - 'bank_transfer' => [Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE], - 'cash_on_delivery' => [Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE], - ]; + $selectedPaymentMethod = $response['setPaymentMethodOnCart']['cart']['selected_payment_method']; + self::assertArrayHasKey('code', $selectedPaymentMethod); + self::assertEquals($methodCode, $selectedPaymentMethod['code']); + + self::assertArrayHasKey('title', $selectedPaymentMethod); + self::assertEquals($methodTitle, $selectedPaymentMethod['title']); + + self::assertArrayHasKey('purchase_order_number', $selectedPaymentMethod); + self::assertEquals($poNumber, $selectedPaymentMethod['purchase_order_number']); } /** @@ -138,6 +147,7 @@ private function getQuery( cart { selected_payment_method { code + title } } } From 692cd9dc92234b256e40c9aeb09055fd7207d4f0 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Sun, 28 Apr 2019 19:35:39 +0100 Subject: [PATCH 296/318] magento/magento2#21150: Fixed static tests --- .../Magento/blank/web/css/source/components/_modals_extend.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less b/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less index 2ab9f061c60c1..764a63bd88064 100644 --- a/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less +++ b/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less @@ -150,7 +150,7 @@ } .modal-popup { - pointer-events: auto; + pointer-events: auto; &.modal-slide { .modal-inner-wrap[class] { .lib-css(background-color, @modal-slide-mobile__background-color); From ee8778b330a4f327dffdaa90add23c51da8b3492 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Sun, 28 Apr 2019 19:36:04 +0100 Subject: [PATCH 297/318] magento/magento2#21150: Fixed static tests --- .../Magento/luma/web/css/source/components/_modals_extend.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less b/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less index 441b6669b545f..855700806fdba 100644 --- a/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less +++ b/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less @@ -150,7 +150,7 @@ } .modal-popup { - pointer-events: auto; + pointer-events: auto; &.modal-slide { .modal-inner-wrap[class] { .lib-css(background-color, @modal-slide-mobile__background-color); From 9b71d809edbf43e4d9eae6915add74286db187dc Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Sun, 28 Apr 2019 23:11:43 +0100 Subject: [PATCH 298/318] magento/magento2#21549: Fixed static tests --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 96af9be49f340..f2a703a193e28 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -4,11 +4,6 @@ * See COPYING.txt for license details. */ -/** - * HTTP CURL Adapter - * - * @author Magento Core Team - */ namespace Magento\Framework\HTTP\Adapter; /** @@ -115,8 +110,8 @@ public function setOptions(array $options = []) /** * Add additional option to cURL * - * @param int $option the CURLOPT_* constants - * @param mixed $value + * @param int $option the CURLOPT_* constants + * @param mixed $value * @return $this */ public function addOption($option, $value) From e161862468831a99cfb6fee8b77930909551c702 Mon Sep 17 00:00:00 2001 From: sanjay Date: Mon, 29 Apr 2019 09:56:56 +0530 Subject: [PATCH 299/318] fixed issue 22527 wishlist and compare icon alignment --- .../blank/Magento_Catalog/web/css/source/module/_listings.less | 1 + .../luma/Magento_Catalog/web/css/source/module/_listings.less | 1 + 2 files changed, 2 insertions(+) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less index b7af69fd5ca82..f96538b59a70f 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less @@ -104,6 +104,7 @@ .actions-primary { display: inline-block; + vertical-align: middle; } } 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 77fb53a2ab02a..eeec441c74aca 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 @@ -107,6 +107,7 @@ .actions-primary { display: inline-block; + vertical-align: middle; } } From 46d56fe5a9e732eaf2c11e1c51b21eb81427f291 Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Mon, 29 Apr 2019 10:19:12 +0530 Subject: [PATCH 300/318] code cleanup (http to https) --- app/code/Magento/Backend/Block/Store/Switcher.php | 2 +- app/code/Magento/Braintree/etc/adminhtml/system.xml | 2 +- .../Ui/DataProvider/Product/Form/Modifier/Websites.php | 2 +- .../view/adminhtml/ui_component/catalog_rule_form.xml | 2 +- .../Customer/view/base/ui_component/customer_form.xml | 2 +- app/code/Magento/Paypal/etc/adminhtml/system.xml | 10 +++++----- .../Paypal/etc/adminhtml/system/express_checkout.xml | 2 +- .../Paypal/etc/adminhtml/system/payflow_advanced.xml | 2 +- .../Paypal/etc/adminhtml/system/payflow_link.xml | 2 +- .../adminhtml/system/payments_pro_hosted_solution.xml | 2 +- .../Paypal/etc/adminhtml/system/paypal_payflowpro.xml | 2 +- .../view/adminhtml/ui_component/sales_rule_form.xml | 2 +- .../adminhtml/ui_component/search_synonyms_form.xml | 2 +- app/code/Magento/Tax/etc/config.xml | 2 +- .../Model/Config/Structure/Reader/_files/config.xml | 10 +++++----- 15 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Backend/Block/Store/Switcher.php b/app/code/Magento/Backend/Block/Store/Switcher.php index 1468df2b0b442..709f44a879a3f 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher.php +++ b/app/code/Magento/Backend/Block/Store/Switcher.php @@ -17,7 +17,7 @@ class Switcher extends \Magento\Backend\Block\Template /** * URL for store switcher hint */ - const HINT_URL = 'http://docs.magento.com/m2/ce/user_guide/configuration/scope.html'; + const HINT_URL = 'https://docs.magento.com/m2/ce/user_guide/configuration/scope.html'; /** * Name of website variable diff --git a/app/code/Magento/Braintree/etc/adminhtml/system.xml b/app/code/Magento/Braintree/etc/adminhtml/system.xml index 5215dbc00b7ef..67c47f8ea9dc3 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/system.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/system.xml @@ -41,7 +41,7 @@ - http://docs.magento.com/m2/ce/user_guide/payment/braintree.html + https://docs.magento.com/m2/ce/user_guide/payment/braintree.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php index 9cbbb86a2c555..7d1d5d4d77d1b 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php @@ -165,7 +165,7 @@ protected function getFieldsForFieldset() $websitesList = $this->getWebsitesList(); $isNewProduct = !$this->locator->getProduct()->getId(); $tooltip = [ - 'link' => 'http://docs.magento.com/m2/ce/user_guide/configuration/scope.html', + 'link' => 'https://docs.magento.com/m2/ce/user_guide/configuration/scope.html', 'description' => __( 'If your Magento installation has multiple websites, ' . 'you can edit the scope to use the product on specific sites.' diff --git a/app/code/Magento/CatalogRule/view/adminhtml/ui_component/catalog_rule_form.xml b/app/code/Magento/CatalogRule/view/adminhtml/ui_component/catalog_rule_form.xml index fb34a3ac4bb3b..8174434a06c49 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/ui_component/catalog_rule_form.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/ui_component/catalog_rule_form.xml @@ -136,7 +136,7 @@ number - http://docs.magento.com/m2/ce/user_guide/configuration/scope.html + https://docs.magento.com/m2/ce/user_guide/configuration/scope.html What is this? diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 7e6b7bbe9cd09..495b3d13645d9 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -118,7 +118,7 @@ number - http://docs.magento.com/m2/ce/user_guide/configuration/scope.html + https://docs.magento.com/m2/ce/user_guide/configuration/scope.html If your Magento installation has multiple websites, you can edit the scope to associate the customer with a specific site. diff --git a/app/code/Magento/Paypal/etc/adminhtml/system.xml b/app/code/Magento/Paypal/etc/adminhtml/system.xml index ea48aa65132e8..ca886c7827ffd 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system.xml @@ -75,7 +75,7 @@ payment/paypal_payment_pro/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html @@ -95,7 +95,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -174,7 +174,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -245,7 +245,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -290,7 +290,7 @@ payment/paypal_payment_pro/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml b/app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml index 7abefbe1a674e..d5287659ee7d2 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml @@ -13,7 +13,7 @@ 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 + https://docs.magento.com/m2/ce/user_guide/payment/paypal-express-checkout.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml b/app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml index e7de9c0d641a7..cba36916c3305 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml @@ -13,7 +13,7 @@ Includes Express Checkout)]]> payment/payflow_advanced/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-advanced.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-advanced.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml b/app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml index 647bc7a60975a..ed11e8ba18d07 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml @@ -13,7 +13,7 @@ Includes Express Checkout)]]> payment/payflow_link/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-link.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-link.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/payments_pro_hosted_solution.xml b/app/code/Magento/Paypal/etc/adminhtml/system/payments_pro_hosted_solution.xml index 35cd844204843..727bffdaf27e3 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/payments_pro_hosted_solution.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/payments_pro_hosted_solution.xml @@ -14,7 +14,7 @@ Includes Express Checkout)]]> 1 - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml index fcf3fb39d1b7d..e5a0319bdc1bf 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml @@ -14,7 +14,7 @@ payment/payflowpro/active 1 - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payflow-pro.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint diff --git a/app/code/Magento/SalesRule/view/adminhtml/ui_component/sales_rule_form.xml b/app/code/Magento/SalesRule/view/adminhtml/ui_component/sales_rule_form.xml index 570eb0bf151f0..639e12006232b 100644 --- a/app/code/Magento/SalesRule/view/adminhtml/ui_component/sales_rule_form.xml +++ b/app/code/Magento/SalesRule/view/adminhtml/ui_component/sales_rule_form.xml @@ -128,7 +128,7 @@ number - http://docs.magento.com/m2/ce/user_guide/configuration/scope.html + https://docs.magento.com/m2/ce/user_guide/configuration/scope.html What is this? diff --git a/app/code/Magento/Search/view/adminhtml/ui_component/search_synonyms_form.xml b/app/code/Magento/Search/view/adminhtml/ui_component/search_synonyms_form.xml index 9194bd5f741d6..09e5149004f3e 100644 --- a/app/code/Magento/Search/view/adminhtml/ui_component/search_synonyms_form.xml +++ b/app/code/Magento/Search/view/adminhtml/ui_component/search_synonyms_form.xml @@ -72,7 +72,7 @@ int - http://docs.magento.com/m2/ce/user_guide/stores/websites-stores-views.html + https://docs.magento.com/m2/ce/user_guide/stores/websites-stores-views.html You can adjust the scope of this synonym group by selecting an option from the list. diff --git a/app/code/Magento/Tax/etc/config.xml b/app/code/Magento/Tax/etc/config.xml index 0b837944a3614..afe7bd7861168 100644 --- a/app/code/Magento/Tax/etc/config.xml +++ b/app/code/Magento/Tax/etc/config.xml @@ -49,7 +49,7 @@ 0 - http://docs.magento.com/m2/ce/user_guide/tax/warning-messages.html + https://docs.magento.com/m2/ce/user_guide/tax/warning-messages.html diff --git a/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml index 95b9c7bd73e63..f473af1bce37c 100644 --- a/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml +++ b/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/config.xml @@ -74,7 +74,7 @@ payment/paypal_payment_pro/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html @@ -94,7 +94,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -162,7 +162,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -233,7 +233,7 @@ Accept credit card and PayPal payments securely. payment/wps_express/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-standard.html @@ -278,7 +278,7 @@ payment/paypal_payment_pro/active - http://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html + https://docs.magento.com/m2/ce/user_guide/payment/paypal-payments-pro.html From aaa28b8368625daf3d879d5d9c4a44b2927b75c8 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Mon, 29 Apr 2019 08:30:54 +0100 Subject: [PATCH 301/318] magento/magento2#22132: Fixed static tests --- app/code/Magento/Theme/Model/Design/Backend/File.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Theme/Model/Design/Backend/File.php b/app/code/Magento/Theme/Model/Design/Backend/File.php index 1dacf59559486..27636b4d574cd 100644 --- a/app/code/Magento/Theme/Model/Design/Backend/File.php +++ b/app/code/Magento/Theme/Model/Design/Backend/File.php @@ -104,6 +104,7 @@ public function beforeSave() return $this; } + //phpcs:ignore Magento2.Functions.DiscouragedFunction $this->updateMediaDirectory(basename($file), $value['url']); return $this; @@ -116,6 +117,7 @@ public function afterLoad() { $value = $this->getValue(); if ($value && !is_array($value)) { + //phpcs:ignore Magento2.Functions.DiscouragedFunction $fileName = $this->_getUploadDir() . '/' . basename($value); $fileInfo = null; if ($this->_mediaDirectory->isExist($fileName)) { @@ -126,6 +128,7 @@ public function afterLoad() 'url' => $url, 'file' => $value, 'size' => is_array($stat) ? $stat['size'] : 0, + //phpcs:ignore Magento2.Functions.DiscouragedFunction 'name' => basename($value), 'type' => $this->getMimeType($fileName), 'exists' => true, From e8f136991728d9ef709b3a817533cc417dcc65ee Mon Sep 17 00:00:00 2001 From: Oscar Recio Date: Thu, 25 Apr 2019 16:45:56 +0200 Subject: [PATCH 302/318] #631 Rename qty by quantity Rename CartItemQuantityInput by CartItemUpdateQuantityInput Rename CartItemInput by CartItemQuantityInput Adapt tests --- .../ConfigurableProductGraphQl/etc/schema.graphqls | 2 +- .../Model/Cart/AddSimpleProductToCart.php | 4 ++-- .../QuoteGraphQl/Model/Resolver/CartItems.php | 2 +- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 14 +++++++------- .../CatalogInventory/AddProductToCartTest.php | 4 ++-- .../AddConfigurableProductToCartTest.php | 6 +++--- ...AddSimpleProductWithCustomOptionsToCartTest.php | 4 ++-- ...ddVirtualProductWithCustomOptionsToCartTest.php | 4 ++-- .../Quote/Customer/AddSimpleProductToCartTest.php | 6 +++--- .../Quote/Customer/AddVirtualProductToCartTest.php | 6 +++--- .../Quote/Customer/CheckoutEndToEndTest.php | 4 ++-- .../Magento/GraphQl/Quote/Customer/GetCartTest.php | 6 +++--- .../Quote/Customer/RemoveItemFromCartTest.php | 4 ++-- .../Quote/Customer/SetPaymentMethodOnCartTest.php | 2 +- .../GraphQl/Quote/Customer/UpdateCartItemsTest.php | 10 +++++----- .../Quote/Guest/AddSimpleProductToCartTest.php | 6 +++--- .../Quote/Guest/AddVirtualProductToCartTest.php | 6 +++--- .../GraphQl/Quote/Guest/CheckoutEndToEndTest.php | 4 ++-- .../Magento/GraphQl/Quote/Guest/GetCartTest.php | 6 +++--- .../GraphQl/Quote/Guest/RemoveItemFromCartTest.php | 4 ++-- .../Quote/Guest/SetPaymentMethodOnCartTest.php | 2 +- .../GraphQl/Quote/Guest/UpdateCartItemsTest.php | 10 +++++----- 22 files changed, 58 insertions(+), 58 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index d4780c5c0867a..bf4ff723a646f 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -49,7 +49,7 @@ type AddConfigurableProductsToCartOutput { } input ConfigurableProductCartItemInput { - data: CartItemInput! + data: CartItemQuantityInput! variant_sku: String! customizable_options:[CustomizableOptionInput!] } diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index 6868ce3f7f1ff..ef9830bc75993 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -121,9 +121,9 @@ private function extractSku(array $cartItemData): string */ private function extractQty(array $cartItemData): float { - $qty = $this->arrayManager->get('data/qty', $cartItemData); + $qty = $this->arrayManager->get('data/quantity', $cartItemData); if (!isset($qty)) { - throw new GraphQlInputException(__('Missing key "qty" in cart item data')); + throw new GraphQlInputException(__('Missing key "quantity" in cart item data')); } return (float)$qty; } diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartItems.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartItems.php index da6619d15a489..f259dcd4a78ff 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartItems.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartItems.php @@ -38,7 +38,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $itemsData[] = [ 'id' => $cartItem->getItemId(), - 'qty' => $cartItem->getQty(), + 'quantity' => $cartItem->getQty(), 'product' => $productData, 'model' => $cartItem, ]; diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index a9784e97c8952..5da3c57851e74 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -31,7 +31,7 @@ input AddSimpleProductsToCartInput { } input SimpleProductCartItemInput { - data: CartItemInput! + data: CartItemQuantityInput! customizable_options:[CustomizableOptionInput!] } @@ -41,13 +41,13 @@ input AddVirtualProductsToCartInput { } input VirtualProductCartItemInput { - data: CartItemInput! + data: CartItemQuantityInput! customizable_options:[CustomizableOptionInput!] } -input CartItemInput { +input CartItemQuantityInput { sku: String! - qty: Float! + quantity: Float! } input CustomizableOptionInput { @@ -62,10 +62,10 @@ input ApplyCouponToCartInput { input UpdateCartItemsInput { cart_id: String! - cart_items: [CartItemQuantityInput!]! + cart_items: [CartItemUpdateQuantityInput!]! } -input CartItemQuantityInput { +input CartItemUpdateQuantityInput { cart_item_id: Int! quantity: Float! } @@ -297,7 +297,7 @@ type VirtualCartItem implements CartItemInterface @doc(description: "Virtual Car interface CartItemInterface @typeResolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemTypeResolver") { id: String! - qty: Float! + quantity: Float! product: ProductInterface! } 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 99f1dc004c50f..097e975130c70 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php @@ -97,7 +97,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty) : string cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" } } @@ -106,7 +106,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty) : string ) { cart { items { - qty + quantity } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index d22cd14a4ae26..fa45263e65548 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -44,7 +44,7 @@ public function testAddConfigurableProductToCart() $response = $this->graphQlMutation($query); $cartItems = $response['addConfigurableProductsToCart']['cart']['items']; - self::assertEquals($qty, $cartItems[0]['qty']); + self::assertEquals($qty, $cartItems[0]['quantity']); self::assertEquals($variantSku, $cartItems[0]['product']['sku']); } @@ -97,7 +97,7 @@ private function getQuery(string $maskedQuoteId, string $variantSku, int $qty): { variant_sku: "{$variantSku}" data: { - qty: {$qty} + quantity: {$qty} sku: "{$variantSku}" } } @@ -107,7 +107,7 @@ private function getQuery(string $maskedQuoteId, string $variantSku, int $qty): cart { items { id - qty + quantity product { name sku diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php index f33ccce82fcb7..714447f1e36a5 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php @@ -62,7 +62,7 @@ public function testAddSimpleProductWithOptions() cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" }, customizable_options: $queryCustomizableOptions @@ -121,7 +121,7 @@ public function testAddSimpleProductWithNoRequiredOptionsSet() cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php index ffd52bcf7fb15..6172403c74086 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php @@ -62,7 +62,7 @@ public function testAddVirtualProductWithOptions() cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" }, customizable_options: $queryCustomizableOptions @@ -121,7 +121,7 @@ public function testAddVirtualProductWithNoRequiredOptionsSet() cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php index 73b3e39721866..775d2733464ac 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php @@ -49,7 +49,7 @@ public function testAddSimpleProductToCart() $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']); - self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['qty']); + self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -142,7 +142,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cartItems: [ { data: { - qty: {$qty} + quantity: {$qty} sku: "{$sku}" } } @@ -151,7 +151,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cart { items { id - qty + quantity product { sku } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php index 4ec25bb030079..86444f767ca78 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php @@ -49,7 +49,7 @@ public function testAddVirtualProductToCart() $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('cart', $response['addVirtualProductsToCart']); - self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['qty']); + self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -142,7 +142,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cartItems: [ { data: { - qty: {$qty} + quantity: {$qty} sku: "{$sku}" } } @@ -151,7 +151,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cart { items { id - qty + quantity product { sku } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php index 8592a986c5dce..a67c199f244f3 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php @@ -216,7 +216,7 @@ private function addProductToCart(string $cartId, float $qty, string $sku): void cartItems: [ { data: { - qty: {$qty} + quantity: {$qty} sku: "{$sku}" } } @@ -225,7 +225,7 @@ private function addProductToCart(string $cartId, float $qty, string $sku): void ) { cart { items { - qty + quantity product { sku } 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 19b72b9e3ca4c..0e60277948e0f 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 @@ -54,11 +54,11 @@ public function testGetCart() self::assertCount(2, $response['cart']['items']); self::assertNotEmpty($response['cart']['items'][0]['id']); - self::assertEquals(2, $response['cart']['items'][0]['qty']); + self::assertEquals(2, $response['cart']['items'][0]['quantity']); self::assertEquals('simple_product', $response['cart']['items'][0]['product']['sku']); self::assertNotEmpty($response['cart']['items'][1]['id']); - self::assertEquals(2, $response['cart']['items'][1]['qty']); + self::assertEquals(2, $response['cart']['items'][1]['quantity']); self::assertEquals('virtual-product', $response['cart']['items'][1]['product']['sku']); } @@ -187,7 +187,7 @@ private function getQuery(string $maskedQuoteId): string cart(cart_id: "{$maskedQuoteId}") { items { id - qty + quantity product { sku } 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 39803f8d58447..5f953d43355fd 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 @@ -107,7 +107,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string ) { cart { items { - qty + quantity } } } @@ -216,7 +216,7 @@ private function getQuery(string $maskedQuoteId, int $itemId): string ) { cart { items { - qty + quantity } } } 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 2604ec5f0a0f9..593bb8c9fcb78 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 @@ -196,7 +196,7 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str ) { cart { items { - qty + quantity } } } 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 35e2d62214fb2..5ab0213db6074 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 @@ -76,7 +76,7 @@ public function testUpdateCartItemQty() $item = current($responseCart['items']); $this->assertEquals($itemId, $item['id']); - $this->assertEquals($qty, $item['qty']); + $this->assertEquals($qty, $item['quantity']); } /** @@ -229,7 +229,7 @@ public function testUpdateWithMissedCartItemId() cart { items { id - qty + quantity } } } @@ -259,7 +259,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string cart { items { id - qty + quantity } } } @@ -285,7 +285,7 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', - 'Required parameter "quantity" for "cart_items" is missing.' + 'Field CartItemUpdateQuantityInput.quantity of required type Float! was not provided.' ], ]; } @@ -312,7 +312,7 @@ private function getQuery(string $maskedQuoteId, int $itemId, float $qty): strin cart { items { id - qty + quantity } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php index 9e0693b160851..04c2daf755c1a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php @@ -44,7 +44,7 @@ public function testAddSimpleProductToCart() $response = $this->graphQlMutation($query); self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']); - self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['qty']); + self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -115,7 +115,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cartItems: [ { data: { - qty: $qty + quantity: $qty sku: "$sku" } } @@ -124,7 +124,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string ) { cart { items { - qty + quantity product { sku } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php index 3f2d734635c3e..def3306d4e822 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php @@ -44,7 +44,7 @@ public function testAddVirtualProductToCart() $response = $this->graphQlMutation($query); self::assertArrayHasKey('cart', $response['addVirtualProductsToCart']); - self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['qty']); + self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -116,7 +116,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string cartItems: [ { data: { - qty: {$qty} + quantity: {$qty} sku: "{$sku}" } } @@ -125,7 +125,7 @@ private function getQuery(string $maskedQuoteId, string $sku, int $qty): string ) { cart { items { - qty + quantity product { sku } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php index f5114b9253a40..fc7bcdba86243 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php @@ -176,7 +176,7 @@ private function addProductToCart(string $cartId, float $qty, string $sku): void cartItems: [ { data: { - qty: {$qty} + quantity: {$qty} sku: "{$sku}" } } @@ -185,7 +185,7 @@ private function addProductToCart(string $cartId, float $qty, string $sku): void ) { cart { items { - qty + quantity product { sku } 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 832e15058a4ee..64170079676b9 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 @@ -46,11 +46,11 @@ public function testGetCart() self::assertCount(2, $response['cart']['items']); self::assertNotEmpty($response['cart']['items'][0]['id']); - self::assertEquals(2, $response['cart']['items'][0]['qty']); + self::assertEquals(2, $response['cart']['items'][0]['quantity']); self::assertEquals('simple_product', $response['cart']['items'][0]['product']['sku']); self::assertNotEmpty($response['cart']['items'][1]['id']); - self::assertEquals(2, $response['cart']['items'][1]['qty']); + self::assertEquals(2, $response['cart']['items'][1]['quantity']); self::assertEquals('virtual-product', $response['cart']['items'][1]['product']['sku']); } @@ -156,7 +156,7 @@ private function getQuery(string $maskedQuoteId): string cart(cart_id: "{$maskedQuoteId}") { items { id - qty + quantity product { sku } 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 27f3f6367f662..77a057e52f686 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 @@ -96,7 +96,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string ) { cart { items { - qty + quantity } } } @@ -179,7 +179,7 @@ private function getQuery(string $maskedQuoteId, int $itemId): string ) { cart { items { - qty + quantity } } } 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 4ea7eac290f80..1b2ceecd213ab 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 @@ -164,7 +164,7 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str ) { cart { items { - qty + quantity } } } 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 1b8cf2e1c57f7..0d03b49125ce3 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 @@ -69,7 +69,7 @@ public function testUpdateCartItemQty() $item = current($responseCart['items']); $this->assertEquals($itemId, $item['id']); - $this->assertEquals($qty, $item['qty']); + $this->assertEquals($qty, $item['quantity']); } /** @@ -180,7 +180,7 @@ public function testUpdateWithMissedCartItemId() cart { items { id - qty + quantity } } } @@ -210,7 +210,7 @@ public function testUpdateWithMissedItemRequiredParameters(string $input, string cart { items { id - qty + quantity } } } @@ -236,7 +236,7 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', - 'Required parameter "quantity" for "cart_items" is missing.' + 'Field CartItemUpdateQuantityInput.quantity of required type Float! was not provided.' ], ]; } @@ -263,7 +263,7 @@ private function getQuery(string $maskedQuoteId, int $itemId, float $qty): strin cart { items { id - qty + quantity } } } From f52ad9a9f3e1651092e85e6d2394f1142522de64 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 10:10:47 -0500 Subject: [PATCH 303/318] =?UTF-8?q?GraphQL-608:=20Remove=20=E2=80=9Ccart?= =?UTF-8?q?=5Faddress=5Fid=E2=80=9D=20from=20=E2=80=9CShippingMethodInput?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/performance-toolkit/benchmark.jmx | 28 ++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 22af21f07abc5..00982dbc619bd 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -40986,7 +40986,7 @@ vars.putObject("randomIntGenerator", random); 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} + {"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 }\n }\n }\n}","variables":null,"operationName":null} = @@ -41010,7 +41010,7 @@ vars.putObject("randomIntGenerator", random); - {"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"}]}}}} + {"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"}}]}}}} Assertion.response_data false @@ -41176,7 +41176,7 @@ vars.putObject("randomIntGenerator", random); 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} + {"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 }\n }\n }\n}","variables":null,"operationName":null} = @@ -41200,7 +41200,7 @@ vars.putObject("randomIntGenerator", random); - {"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"}}}}} + {"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"}}}}}} Assertion.response_data false @@ -44059,7 +44059,7 @@ vars.put("product_sku", product.get("sku")); 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} + {"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 }\n }\n }\n}","variables":null,"operationName":null} = @@ -44083,7 +44083,7 @@ vars.put("product_sku", product.get("sku")); - {"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"}}}}} + {"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"}}}}}} Assertion.response_data false @@ -44098,7 +44098,7 @@ vars.put("product_sku", product.get("sku")); 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} + {"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 }\n }\n }\n}","variables":null,"operationName":null} = @@ -44122,7 +44122,7 @@ vars.put("product_sku", product.get("sku")); - {"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"}]}}}} + {"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"}}]}}}} Assertion.response_data false @@ -44176,7 +44176,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n shipping_addresses {\n address_id\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n shipping_addresses {\n postcode\n }\n }\n}","variables":null,"operationName":null} = @@ -44197,16 +44197,6 @@ vars.put("product_sku", product.get("sku")); mpaf/tool/fragments/ce/graphql/get_current_shipping_address.jmx - - - address_id - $.data.cart.shipping_addresses[0].address_id - - - BODY - - - true From e04f566bc9574a3aea93615e05b2ccd0d2b7b50b Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 10:26:56 -0500 Subject: [PATCH 304/318] =?UTF-8?q?GraphQL-608:=20Remove=20=E2=80=9Ccart?= =?UTF-8?q?=5Faddress=5Fid=E2=80=9D=20from=20=E2=80=9CShippingMethodInput?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/performance-toolkit/benchmark.jmx | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 00982dbc619bd..384832532ae00 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -44197,6 +44197,7 @@ vars.put("product_sku", product.get("sku")); mpaf/tool/fragments/ce/graphql/get_current_shipping_address.jmx + true From 5899e77a318994cbbc01ece2dd0073d243f4fa66 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 11:39:30 -0500 Subject: [PATCH 305/318] GraphQL-530: [Cart Operations] Update Cart Items validation messages --- .../Magento/GraphQl/CatalogInventory/AddProductToCartTest.php | 2 +- .../Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 df93fea7d9009..a97d30fef803f 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php @@ -94,7 +94,7 @@ public function testAddProductIfQuantityIsDecimal() $query = $this->getQuery($maskedQuoteId, $sku, $qty); $this->expectExceptionMessage( - "Could not add the product with SKU {$sku} to the shopping cart: The fewest you may purchase is 1." + "Could not add the product with SKU {$sku} to the shopping cart: The fewest you may purchase is 1" ); $this->graphQlMutation($query); } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php index 27ec288204048..b13277136fadb 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php @@ -48,7 +48,7 @@ public function testUpdateCartItemDecimalQty() $qty = 0.5; $this->expectExceptionMessage( - "Could not update the product with SKU simple_product: The fewest you may purchase is 1." + "Could not update the product with SKU simple_product: The fewest you may purchase is 1" ); $query = $this->getQuery($maskedQuoteId, $itemId, $qty); $this->graphQlMutation($query); From 035f60268d0a85594ce578eb41fb47225c45018f Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 12:06:51 -0500 Subject: [PATCH 306/318] GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration --- .../etc/schema.graphqls | 2 +- .../Model/Cart/AddSimpleProductToCart.php | 22 ++++++++--------- .../Model/Resolver/UpdateCartItems.php | 6 ++--- .../Magento/QuoteGraphQl/etc/schema.graphqls | 10 ++++---- .../CatalogInventory/AddProductToCartTest.php | 8 +++---- .../AddConfigurableProductToCartTest.php | 20 ++++++++-------- ...mpleProductWithCustomOptionsToCartTest.php | 8 +++---- ...tualProductWithCustomOptionsToCartTest.php | 8 +++---- .../Customer/AddSimpleProductToCartTest.php | 16 ++++++------- .../Customer/AddVirtualProductToCartTest.php | 12 +++++----- .../Quote/Customer/CheckoutEndToEndTest.php | 4 ++-- .../Quote/Customer/UpdateCartItemsTest.php | 18 +++++++------- .../Guest/AddSimpleProductToCartTest.php | 24 +++++++++---------- .../Guest/AddVirtualProductToCartTest.php | 24 +++++++++---------- .../Quote/Guest/CheckoutEndToEndTest.php | 10 ++++---- .../Quote/Guest/UpdateCartItemsTest.php | 18 +++++++------- 16 files changed, 105 insertions(+), 105 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index bf4ff723a646f..d4780c5c0867a 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -49,7 +49,7 @@ type AddConfigurableProductsToCartOutput { } input ConfigurableProductCartItemInput { - data: CartItemQuantityInput! + data: CartItemInput! variant_sku: String! customizable_options:[CustomizableOptionInput!] } diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index ef9830bc75993..ad730288e5cc2 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -66,8 +66,8 @@ public function __construct( public function execute(Quote $cart, array $cartItemData): void { $sku = $this->extractSku($cartItemData); - $qty = $this->extractQty($cartItemData); - if ($qty <= 0) { + $quantity = $this->extractQuantity($cartItemData); + if ($quantity <= 0) { throw new GraphQlInputException( __('Please enter a number greater than 0 in this field.') ); @@ -81,7 +81,7 @@ public function execute(Quote $cart, array $cartItemData): void } try { - $result = $cart->addProduct($product, $this->createBuyRequest($qty, $customizableOptions)); + $result = $cart->addProduct($product, $this->createBuyRequest($quantity, $customizableOptions)); } catch (\Exception $e) { throw new GraphQlInputException( __( @@ -113,19 +113,19 @@ private function extractSku(array $cartItemData): string } /** - * Extract Qty from cart item data + * Extract quantity from cart item data * * @param array $cartItemData * @return float * @throws GraphQlInputException */ - private function extractQty(array $cartItemData): float + private function extractQuantity(array $cartItemData): float { - $qty = $this->arrayManager->get('data/quantity', $cartItemData); - if (!isset($qty)) { + $quantity = $this->arrayManager->get('data/quantity', $cartItemData); + if (!isset($quantity)) { throw new GraphQlInputException(__('Missing key "quantity" in cart item data')); } - return (float)$qty; + return (float)$quantity; } /** @@ -148,15 +148,15 @@ private function extractCustomizableOptions(array $cartItemData): array /** * Format GraphQl input data to a shape that buy request has * - * @param float $qty + * @param float $quantity * @param array $customOptions * @return DataObject */ - private function createBuyRequest(float $qty, array $customOptions): DataObject + private function createBuyRequest(float $quantity, array $customOptions): DataObject { return $this->dataObjectFactory->create([ 'data' => [ - 'qty' => $qty, + 'qty' => $quantity, 'options' => $customOptions, ], ]); diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php index 78a07506556c0..59ca5a3f17fbf 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php @@ -98,7 +98,7 @@ private function processCartItems(Quote $cart, array $items): void if (!isset($item['quantity'])) { throw new GraphQlInputException(__('Required parameter "quantity" for "cart_items" is missing.')); } - $qty = (float)$item['quantity']; + $quantity = (float)$item['quantity']; $cartItem = $cart->getItemById($itemId); if ($cartItem === false) { @@ -107,10 +107,10 @@ private function processCartItems(Quote $cart, array $items): void ); } - if ($qty <= 0.0) { + if ($quantity <= 0.0) { $this->cartItemRepository->deleteById((int)$cart->getId(), $itemId); } else { - $cartItem->setQty($qty); + $cartItem->setQty($quantity); $this->cartItemRepository->save($cartItem); } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 5da3c57851e74..d805bb32958de 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -31,7 +31,7 @@ input AddSimpleProductsToCartInput { } input SimpleProductCartItemInput { - data: CartItemQuantityInput! + data: CartItemInput! customizable_options:[CustomizableOptionInput!] } @@ -41,11 +41,11 @@ input AddVirtualProductsToCartInput { } input VirtualProductCartItemInput { - data: CartItemQuantityInput! + data: CartItemInput! customizable_options:[CustomizableOptionInput!] } -input CartItemQuantityInput { +input CartItemInput { sku: String! quantity: Float! } @@ -62,10 +62,10 @@ input ApplyCouponToCartInput { input UpdateCartItemsInput { cart_id: String! - cart_items: [CartItemUpdateQuantityInput!]! + cart_items: [CartItemUpdateInput!]! } -input CartItemUpdateQuantityInput { +input CartItemUpdateInput { cart_item_id: Int! quantity: Float! } 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 097e975130c70..91b55903174d7 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php @@ -39,10 +39,10 @@ protected function setUp() public function testAddProductIfQuantityIsNotAvailable() { $sku = 'simple'; - $qty = 200; + $quantity = 200; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -58,10 +58,10 @@ public function testAddMoreProductsThatAllowed() $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/167'); $sku = 'custom-design-simple-product'; - $qty = 7; + $quantity = 7; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index fa45263e65548..6810f9d44ce91 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -37,14 +37,14 @@ protected function setUp() public function testAddConfigurableProductToCart() { $variantSku = 'simple_41'; - $qty = 2; + $quantity = 2; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $variantSku, $qty); + $query = $this->getQuery($maskedQuoteId, $variantSku, $quantity); $response = $this->graphQlMutation($query); $cartItems = $response['addConfigurableProductsToCart']['cart']['items']; - self::assertEquals($qty, $cartItems[0]['quantity']); + self::assertEquals($quantity, $cartItems[0]['quantity']); self::assertEquals($variantSku, $cartItems[0]['product']['sku']); } @@ -57,10 +57,10 @@ public function testAddConfigurableProductToCart() public function testAddProductIfQuantityIsNotAvailable() { $variantSku = 'simple_41'; - $qty = 200; + $quantity = 200; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $variantSku, $qty); + $query = $this->getQuery($maskedQuoteId, $variantSku, $quantity); $this->graphQlMutation($query); } @@ -73,20 +73,20 @@ public function testAddProductIfQuantityIsNotAvailable() public function testAddOutOfStockProduct() { $variantSku = 'simple_1010'; - $qty = 1; + $quantity = 1; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $variantSku, $qty); + $query = $this->getQuery($maskedQuoteId, $variantSku, $quantity); $this->graphQlMutation($query); } /** * @param string $maskedQuoteId * @param string $variantSku - * @param int $qty + * @param int $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $variantSku, int $qty): string + private function getQuery(string $maskedQuoteId, string $variantSku, int $quantity): string { return <<getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); $customOptionsValues = $this->getCustomOptionsValuesForQuery($sku); @@ -62,7 +62,7 @@ public function testAddSimpleProductWithOptions() cartItems: [ { data: { - quantity: $qty + quantity: $quantity sku: "$sku" }, customizable_options: $queryCustomizableOptions @@ -110,7 +110,7 @@ public function testAddSimpleProductWithOptions() public function testAddSimpleProductWithNoRequiredOptionsSet() { $sku = 'simple'; - $qty = 1; + $quantity = 1; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); $query = <<getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); $customOptionsValues = $this->getCustomOptionsValuesForQuery($sku); @@ -62,7 +62,7 @@ public function testAddVirtualProductWithOptions() cartItems: [ { data: { - quantity: $qty + quantity: $quantity sku: "$sku" }, customizable_options: $queryCustomizableOptions @@ -110,7 +110,7 @@ public function testAddVirtualProductWithOptions() public function testAddVirtualProductWithNoRequiredOptionsSet() { $sku = 'virtual'; - $qty = 1; + $quantity = 1; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); $query = <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']); - self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); + self::assertEquals($quantity, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -63,10 +63,10 @@ public function testAddSimpleProductToCart() public function testAddProductToNonExistentCart() { $sku = 'simple_product'; - $qty = 2; + $quantity = 2; $maskedQuoteId = 'non_existent_masked_id'; - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } @@ -130,10 +130,10 @@ public function testAddSimpleProductToAnotherCustomerCart() /** * @param string $maskedQuoteId * @param string $sku - * @param int $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $sku, int $qty): string + private function getQuery(string $maskedQuoteId, string $sku, float $quantity): string { return <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); self::assertArrayHasKey('cart', $response['addVirtualProductsToCart']); - self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); + self::assertEquals($quantity, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -130,10 +130,10 @@ public function testAddVirtualProductToAnotherCustomerCart() /** * @param string $maskedQuoteId * @param string $sku - * @param int $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $sku, int $qty): string + private function getQuery(string $maskedQuoteId, string $sku, float $quantity): string { return <<createCustomer(); $token = $this->loginCustomer(); @@ -89,7 +89,7 @@ public function testCheckoutWorkflow() $sku = $this->findProduct(); $cartId = $this->createEmptyCart(); - $this->addProductToCart($cartId, $qty, $sku); + $this->addProductToCart($cartId, $quantity, $sku); $this->setBillingAddress($cartId); $shippingAddress = $this->setShippingAddress($cartId); 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 5ab0213db6074..f0539084ec5b2 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 @@ -58,15 +58,15 @@ protected function setUp() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php */ - public function testUpdateCartItemQty() + public function testUpdateCartItemQuantity() { $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(); - $qty = 2; + $quantity = 2; - $query = $this->getQuery($maskedQuoteId, $itemId, $qty); + $query = $this->getQuery($maskedQuoteId, $itemId, $quantity); $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); $this->assertArrayHasKey('updateCartItems', $response); @@ -76,7 +76,7 @@ public function testUpdateCartItemQty() $item = current($responseCart['items']); $this->assertEquals($itemId, $item['id']); - $this->assertEquals($qty, $item['quantity']); + $this->assertEquals($quantity, $item['quantity']); } /** @@ -88,9 +88,9 @@ public function testRemoveCartItemIfQuantityIsZero() $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(); - $qty = 0; + $quantity = 0; - $query = $this->getQuery($maskedQuoteId, $itemId, $qty); + $query = $this->getQuery($maskedQuoteId, $itemId, $quantity); $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap()); $this->assertArrayHasKey('updateCartItems', $response); @@ -293,10 +293,10 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array /** * @param string $maskedQuoteId * @param int $itemId - * @param float $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string + private function getQuery(string $maskedQuoteId, int $itemId, float $quantity): string { return <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $response = $this->graphQlMutation($query); self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']); - self::assertEquals($qty, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); + self::assertEquals($quantity, $response['addSimpleProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -57,10 +57,10 @@ public function testAddSimpleProductToCart() public function testAddProductToNonExistentCart() { $sku = 'simple_product'; - $qty = 1; + $quantity = 1; $maskedQuoteId = 'non_existent_masked_id'; - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -73,10 +73,10 @@ public function testAddProductToNonExistentCart() public function testNonExistentProductToCart() { $sku = 'simple_product'; - $qty = 1; + $quantity = 1; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -88,9 +88,9 @@ public function testNonExistentProductToCart() public function testAddSimpleProductToCustomerCart() { $sku = 'simple_product'; - $qty = 2; + $quantity = 2; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->expectExceptionMessage( "The current user cannot perform operations on cart \"$maskedQuoteId\"" @@ -102,10 +102,10 @@ public function testAddSimpleProductToCustomerCart() /** * @param string $maskedQuoteId * @param string $sku - * @param int $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $sku, int $qty): string + private function getQuery(string $maskedQuoteId, string $sku, float $quantity): string { return <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $response = $this->graphQlMutation($query); self::assertArrayHasKey('cart', $response['addVirtualProductsToCart']); - self::assertEquals($qty, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); + self::assertEquals($quantity, $response['addVirtualProductsToCart']['cart']['items'][0]['quantity']); self::assertEquals($sku, $response['addVirtualProductsToCart']['cart']['items'][0]['product']['sku']); } @@ -57,10 +57,10 @@ public function testAddVirtualProductToCart() public function testAddVirtualToNonExistentCart() { $sku = 'virtual_product'; - $qty = 1; + $quantity = 1; $maskedQuoteId = 'non_existent_masked_id'; - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -73,10 +73,10 @@ public function testAddVirtualToNonExistentCart() public function testNonExistentProductToCart() { $sku = 'virtual_product'; - $qty = 1; + $quantity = 1; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -89,9 +89,9 @@ public function testNonExistentProductToCart() public function testAddVirtualProductToCustomerCart() { $sku = 'virtual_product'; - $qty = 2; + $quantity = 2; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->expectExceptionMessage( "The current user cannot perform operations on cart \"$maskedQuoteId\"" @@ -103,10 +103,10 @@ public function testAddVirtualProductToCustomerCart() /** * @param string $maskedQuoteId * @param string $sku - * @param int $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $sku, int $qty): string + private function getQuery(string $maskedQuoteId, string $sku, float $quantity): string { return <<findProduct(); $cartId = $this->createEmptyCart(); $this->setGuestEmailOnCart($cartId); - $this->addProductToCart($cartId, $qty, $sku); + $this->addProductToCart($cartId, $quantity, $sku); $this->setBillingAddress($cartId); $shippingAddress = $this->setShippingAddress($cartId); @@ -162,11 +162,11 @@ private function setGuestEmailOnCart(string $cartId): void /** * @param string $cartId - * @param float $qty + * @param float $quantity * @param string $sku * @return void */ - private function addProductToCart(string $cartId, float $qty, string $sku): void + private function addProductToCart(string $cartId, float $quantity, string $sku): void { $query = <<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(); - $qty = 2; + $quantity = 2; - $query = $this->getQuery($maskedQuoteId, $itemId, $qty); + $query = $this->getQuery($maskedQuoteId, $itemId, $quantity); $response = $this->graphQlMutation($query); $this->assertArrayHasKey('updateCartItems', $response); @@ -69,7 +69,7 @@ public function testUpdateCartItemQty() $item = current($responseCart['items']); $this->assertEquals($itemId, $item['id']); - $this->assertEquals($qty, $item['quantity']); + $this->assertEquals($quantity, $item['quantity']); } /** @@ -81,9 +81,9 @@ public function testRemoveCartItemIfQuantityIsZero() $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(); - $qty = 0; + $quantity = 0; - $query = $this->getQuery($maskedQuoteId, $itemId, $qty); + $query = $this->getQuery($maskedQuoteId, $itemId, $quantity); $response = $this->graphQlMutation($query); $this->assertArrayHasKey('updateCartItems', $response); @@ -244,10 +244,10 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array /** * @param string $maskedQuoteId * @param int $itemId - * @param float $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string + private function getQuery(string $maskedQuoteId, int $itemId, float $quantity): string { return << Date: Mon, 29 Apr 2019 13:43:49 -0500 Subject: [PATCH 307/318] GraphQL-621: BillingAddress and ShippingAddress should have different fields but share the common interface --- .../Model/Cart/ExtractQuoteAddressData.php | 9 ----- .../Resolver/CartAddressTypeResolver.php | 40 +++++++++++++++++++ .../Magento/QuoteGraphQl/etc/schema.graphqls | 20 +++++----- .../Quote/Customer/CheckoutEndToEndTest.php | 2 +- .../GetSpecifiedBillingAddressTest.php | 6 +-- .../Customer/SetBillingAddressOnCartTest.php | 12 +++--- .../Customer/SetShippingAddressOnCartTest.php | 4 +- .../Quote/Guest/CheckoutEndToEndTest.php | 2 +- .../Guest/GetSpecifiedBillingAddressTest.php | 6 +-- .../Guest/SetBillingAddressOnCartTest.php | 12 +++--- .../Guest/SetShippingAddressOnCartTest.php | 4 +- 11 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractQuoteAddressData.php b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractQuoteAddressData.php index 4d832f603cd91..c4d795293220f 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractQuoteAddressData.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/ExtractQuoteAddressData.php @@ -41,16 +41,7 @@ public function execute(QuoteAddress $address): array $addressData = $this->dataObjectConverter->toFlatArray($address, [], AddressInterface::class); $addressData['model'] = $address; - if ($address->getAddressType() == AbstractAddress::TYPE_SHIPPING) { - $addressType = 'SHIPPING'; - } elseif ($address->getAddressType() == AbstractAddress::TYPE_BILLING) { - $addressType = 'BILLING'; - } else { - $addressType = null; - } - $addressData = array_merge($addressData, [ - 'address_type' => $addressType, 'country' => [ 'code' => $address->getCountryId(), 'label' => $address->getCountry() diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php new file mode 100644 index 0000000000000..14c1dc76590a4 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php @@ -0,0 +1,40 @@ +getAddressType() == AbstractAddress::TYPE_SHIPPING) { + $addressType = 'ShippingCartAddress'; + } elseif ($address->getAddressType() == AbstractAddress::TYPE_BILLING) { + $addressType = 'BillingCartAddress'; + } else { + throw new LocalizedException( __('Unsupported cart address type')); + } + return $addressType; + } +} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 6d94685ac4d0f..dd32753bba9ca 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -183,14 +183,14 @@ type Cart { items: [CartItemInterface] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItems") applied_coupon: AppliedCoupon @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupon") email: String @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartEmail") - shipping_addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") - billing_address: CartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress") + shipping_addresses: [ShippingCartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") + billing_address: BillingCartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress") available_payment_methods: [AvailablePaymentMethod] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AvailablePaymentMethods") @doc(description: "Available payment methods") selected_payment_method: SelectedPaymentMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SelectedPaymentMethod") prices: CartPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartPrices") } -type CartAddress { +interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressTypeResolver") { firstname: String lastname: String company: String @@ -200,14 +200,19 @@ type CartAddress { postcode: String country: CartAddressCountry telephone: String - address_type: AdressTypeEnum + customer_notes: String +} + +type ShippingCartAddress implements CartAddressInterface { available_shipping_methods: [AvailableShippingMethod] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddress\\AvailableShippingMethods") selected_shipping_method: SelectedShippingMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddress\\SelectedShippingMethod") items_weight: Float - customer_notes: String cart_items: [CartItemQuantity] } +type BillingCartAddress implements CartAddressInterface { +} + type CartItemQuantity { cart_item_id: Int! quantity: Float! @@ -257,11 +262,6 @@ type SelectedPaymentMethod { type SelectedPaymentMethodAdditionalData { } -enum AdressTypeEnum { - SHIPPING - BILLING -} - type AppliedCoupon { code: String! } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php index a49b84e20a8a6..b5095bfabf0db 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php @@ -266,7 +266,7 @@ private function setBillingAddress(string $cartId): void ) { cart { billing_address { - address_type + __typename } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php index 1ba94346073db..e10d12d73e7a6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php @@ -71,7 +71,7 @@ public function testGeSpecifiedBillingAddress() 'label' => 'US', ], 'telephone' => '3468676', - 'address_type' => 'BILLING', + '__typename' => 'BillingCartAddress', 'customer_notes' => null, ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); @@ -110,7 +110,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet() 'label' => null, ], 'telephone' => null, - 'address_type' => 'BILLING', + '__typename' => null, 'customer_notes' => null, ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); @@ -197,7 +197,7 @@ private function getQuery(string $maskedQuoteId): string label } telephone - address_type + __typename customer_notes } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index 6b15f947a2477..fc73d88be1f87 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -99,7 +99,7 @@ public function testSetNewBillingAddress() code label } - address_type + __typename } } } @@ -159,7 +159,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() code label } - address_type + __typename } shipping_addresses { firstname @@ -173,7 +173,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() code label } - address_type + __typename } } } @@ -188,7 +188,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() self::assertArrayHasKey('shipping_addresses', $cartResponse); $shippingAddressResponse = current($cartResponse['shipping_addresses']); $this->assertNewAddressFields($billingAddressResponse); - $this->assertNewAddressFields($shippingAddressResponse, 'SHIPPING'); + $this->assertNewAddressFields($shippingAddressResponse, 'ShippingCartAddress'); } /** @@ -560,7 +560,7 @@ public function testSetNewBillingAddressWithRedundantStreetLine() * @param array $addressResponse * @param string $addressType */ - private function assertNewAddressFields(array $addressResponse, string $addressType = 'BILLING'): void + private function assertNewAddressFields(array $addressResponse, string $addressType = 'BillingCartAddress'): void { $assertionMap = [ ['response_field' => 'firstname', 'expected_value' => 'test firstname'], @@ -571,7 +571,7 @@ private function assertNewAddressFields(array $addressResponse, string $addressT ['response_field' => 'postcode', 'expected_value' => '887766'], ['response_field' => 'telephone', 'expected_value' => '88776655'], ['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']], - ['response_field' => 'address_type', 'expected_value' => $addressType] + ['response_field' => '__typename', 'expected_value' => $addressType] ]; $this->assertResponseFields($addressResponse, $assertionMap); 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 6b097e028ffe5..5d7a073d2d6d5 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 @@ -101,7 +101,7 @@ public function testSetNewShippingAddressOnCartWithSimpleProduct() label code } - address_type + __typename } } } @@ -548,7 +548,7 @@ private function assertNewShippingAddressFields(array $shippingAddressResponse): ['response_field' => 'postcode', 'expected_value' => '887766'], ['response_field' => 'telephone', 'expected_value' => '88776655'], ['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']], - ['response_field' => 'address_type', 'expected_value' => 'SHIPPING'] + ['response_field' => '__typename', 'expected_value' => 'ShippingCartAddress'] ]; $this->assertResponseFields($shippingAddressResponse, $assertionMap); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php index 7cd4e06a19e23..570c34d448073 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php @@ -226,7 +226,7 @@ private function setBillingAddress(string $cartId): void ) { cart { billing_address { - address_type + __typename } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php index d592443aed499..48bff73226894 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php @@ -63,7 +63,7 @@ public function testGeSpecifiedBillingAddress() 'label' => 'US', ], 'telephone' => '3468676', - 'address_type' => 'BILLING', + '__typename' => 'BillingCartAddress', ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); } @@ -100,7 +100,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet() 'label' => null, ], 'telephone' => null, - 'address_type' => 'BILLING', + '__typename' => 'BillingCartAddress', ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); } @@ -161,7 +161,7 @@ private function getQuery(string $maskedQuoteId): string label } telephone - address_type + __typename } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php index d2d53220f0042..d8d95040eea45 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php @@ -70,7 +70,7 @@ public function testSetNewBillingAddress() code label } - address_type + __typename } } } @@ -129,7 +129,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() code label } - address_type + __typename } shipping_addresses { firstname @@ -143,7 +143,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() code label } - address_type + __typename } } } @@ -158,7 +158,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter() self::assertArrayHasKey('shipping_addresses', $cartResponse); $shippingAddressResponse = current($cartResponse['shipping_addresses']); $this->assertNewAddressFields($billingAddressResponse); - $this->assertNewAddressFields($shippingAddressResponse, 'SHIPPING'); + $this->assertNewAddressFields($shippingAddressResponse, 'ShippingCartAddress'); } /** @@ -380,7 +380,7 @@ public function testSetNewBillingAddressRedundantStreetLine() * @param array $addressResponse * @param string $addressType */ - private function assertNewAddressFields(array $addressResponse, string $addressType = 'BILLING'): void + private function assertNewAddressFields(array $addressResponse, string $addressType = 'BillingCartAddress'): void { $assertionMap = [ ['response_field' => 'firstname', 'expected_value' => 'test firstname'], @@ -391,7 +391,7 @@ private function assertNewAddressFields(array $addressResponse, string $addressT ['response_field' => 'postcode', 'expected_value' => '887766'], ['response_field' => 'telephone', 'expected_value' => '88776655'], ['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']], - ['response_field' => 'address_type', 'expected_value' => $addressType] + ['response_field' => '__typename', 'expected_value' => $addressType] ]; $this->assertResponseFields($addressResponse, $assertionMap); 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 888b0e87734b6..c58098c6c2547 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 @@ -72,7 +72,7 @@ public function testSetNewShippingAddressOnCartWithSimpleProduct() code label } - address_type + __typename } } } @@ -383,7 +383,7 @@ private function assertNewShippingAddressFields(array $shippingAddressResponse): ['response_field' => 'postcode', 'expected_value' => '887766'], ['response_field' => 'telephone', 'expected_value' => '88776655'], ['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']], - ['response_field' => 'address_type', 'expected_value' => 'SHIPPING'] + ['response_field' => '__typename', 'expected_value' => 'ShippingCartAddress'] ]; $this->assertResponseFields($shippingAddressResponse, $assertionMap); From 63a740b04d223f96f148e4e1a16c892eeb2ea7a0 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 13:53:34 -0500 Subject: [PATCH 308/318] GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration --- .../Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php | 2 +- .../Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 f0539084ec5b2..bc88bd1ddb438 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 @@ -285,7 +285,7 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', - 'Field CartItemUpdateQuantityInput.quantity of required type Float! was not provided.' + 'Field CartItemUpdateInput.quantity of required type Float! was not provided.' ], ]; } 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 539dcaea2aaa6..1e1fb0a176992 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 @@ -236,7 +236,7 @@ public function dataProviderUpdateWithMissedRequiredParameters(): array ], 'missed_cart_item_qty' => [ 'cart_items: [{ cart_item_id: 1 }]', - 'Field CartItemUpdateQuantityInput.quantity of required type Float! was not provided.' + 'Field CartItemUpdateInput.quantity of required type Float! was not provided.' ], ]; } From 5766e1430b4243e984afb5bf6d079eb5c1f2656a Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 14:38:01 -0500 Subject: [PATCH 309/318] GraphQL-601: [Test Coverage] Offline payments methods --- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 3250e94761b12..6039a82357d36 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -191,7 +191,6 @@ type Cart { } type CartAddress { - address_id: Int firstname: String lastname: String company: String From 109182ede4519f2b81f1bce2b1f28600620077a0 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 14:49:10 -0500 Subject: [PATCH 310/318] GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration --- setup/performance-toolkit/benchmark.jmx | 52 ++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 384832532ae00..c1d21a08f9e2d 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -40796,7 +40796,7 @@ vars.putObject("randomIntGenerator", random); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -40947,7 +40947,7 @@ vars.putObject("randomIntGenerator", random); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41137,7 +41137,7 @@ vars.putObject("randomIntGenerator", random); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41347,7 +41347,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41567,7 +41567,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n qty: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n qty\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41739,7 +41739,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41779,7 +41779,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41820,13 +41820,13 @@ 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} + {"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 quantity\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -41850,7 +41850,7 @@ vars.put("product_sku", product.get("sku")); - {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","qty":5}]}}}} + {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","quantity":5}]}}}} Assertion.response_data false @@ -42045,7 +42045,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n qty: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n qty\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42085,7 +42085,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42126,13 +42126,13 @@ 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} + {"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 quantity\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42156,7 +42156,7 @@ vars.put("product_sku", product.get("sku")); - {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","qty":5}]}}}} + {"data":{"updateCartItems":{"cart":{"items":[{"id":"${item_id}","quantity":5}]}}}} Assertion.response_data false @@ -42303,7 +42303,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42343,7 +42343,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42390,7 +42390,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n removeItemFromCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_item_id: ${item_id}\n }\n ) {\n cart {\n items {\n qty\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n removeItemFromCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_item_id: ${item_id}\n }\n ) {\n cart {\n items {\n quantity\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42609,7 +42609,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n qty: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n qty\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42649,7 +42649,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42696,7 +42696,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n removeItemFromCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_item_id: ${item_id}\n }\n ) {\n cart {\n items {\n qty\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n removeItemFromCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_item_id: ${item_id}\n }\n ) {\n cart {\n items {\n quantity\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -42867,7 +42867,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -43094,7 +43094,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -43852,7 +43852,7 @@ vars.putObject("randomIntGenerator", random); false - {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n qty\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"{\n cart(cart_id: \"${quote_id}\") {\n items {\n id\n quantity\n product {\n sku\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -43959,7 +43959,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n qty: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n qty\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null} = @@ -44019,7 +44019,7 @@ vars.put("product_sku", product.get("sku")); false - {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n qty: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n qty\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} + {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null} = From c44df1ce0d64de8ec774278eebcffe58f43991af Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 15:12:53 -0500 Subject: [PATCH 311/318] GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration --- .../Model/Resolver/CartAddressTypeResolver.php | 4 ++-- .../CatalogInventory/AddProductToCartTest.php | 16 ++++++++-------- .../CatalogInventory/UpdateCartItemsTest.php | 14 +++++++------- .../Guest/GetSpecifiedBillingAddressTest.php | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php index 14c1dc76590a4..6f7c70b09cb0c 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php @@ -20,7 +20,7 @@ class CartAddressTypeResolver implements TypeResolverInterface /** * @inheritdoc */ - public function resolveType(array $data) : string + public function resolveType(array $data): string { if (!isset($data['model'])) { throw new LocalizedException(__('Missing key "model" in cart address data')); @@ -33,7 +33,7 @@ public function resolveType(array $data) : string } elseif ($address->getAddressType() == AbstractAddress::TYPE_BILLING) { $addressType = 'BillingCartAddress'; } else { - throw new LocalizedException( __('Unsupported cart address type')); + throw new LocalizedException(__('Unsupported cart address type')); } return $addressType; } 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 1633c83895e67..6f27693eeb4a7 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php @@ -71,13 +71,13 @@ public function testAddMoreProductsThatAllowed() * @expectedException \Exception * @expectedExceptionMessage Please enter a number greater than 0 in this field. */ - public function testAddSimpleProductToCartWithNegativeQty() + public function testAddSimpleProductToCartWithNegativeQuantity() { $sku = 'simple'; - $qty = -2; + $quantity = -2; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->graphQlMutation($query); } @@ -88,10 +88,10 @@ public function testAddSimpleProductToCartWithNegativeQty() public function testAddProductIfQuantityIsDecimal() { $sku = 'simple_product'; - $qty = 0.2; + $quantity = 0.2; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $query = $this->getQuery($maskedQuoteId, $sku, $qty); + $query = $this->getQuery($maskedQuoteId, $sku, $quantity); $this->expectExceptionMessage( "Could not add the product with SKU {$sku} to the shopping cart: The fewest you may purchase is 1" @@ -102,10 +102,10 @@ public function testAddProductIfQuantityIsDecimal() /** * @param string $maskedQuoteId * @param string $sku - * @param float $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, string $sku, float $qty) : string + private function getQuery(string $maskedQuoteId, string $sku, float $quantity) : string { return <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); $itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product'); - $qty = 0.5; + $quantity = 0.5; $this->expectExceptionMessage( "Could not update the product with SKU simple_product: The fewest you may purchase is 1" ); - $query = $this->getQuery($maskedQuoteId, $itemId, $qty); + $query = $this->getQuery($maskedQuoteId, $itemId, $quantity); $this->graphQlMutation($query); } /** * @param string $maskedQuoteId * @param int $itemId - * @param float $qty + * @param float $quantity * @return string */ - private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string + private function getQuery(string $maskedQuoteId, int $itemId, float $quantity): string { return << null, ], 'telephone' => null, - '__typename' => 'BillingCartAddress', + '__typename' => null, ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); } From 779f39c71e3b801c9a9e8650f2acd05889643daf Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 16:41:23 -0500 Subject: [PATCH 312/318] GraphQL-575: Schema inconsistency of "SelectedShippingMethod" declaration --- .../CatalogGraphQl/etc/schema.graphqls | 178 ------------------ app/code/Magento/GraphQl/etc/schema.graphqls | 178 ++++++++++++++++++ .../SelectedShippingMethod.php | 43 +++-- .../Magento/QuoteGraphQl/etc/schema.graphqls | 6 +- .../GetSelectedShippingMethodTest.php | 38 +++- .../SetOfflineShippingMethodsOnCartTest.php | 66 +++++-- .../Customer/SetShippingMethodsOnCartTest.php | 36 +++- .../Guest/GetSelectedShippingMethodTest.php | 38 +++- .../SetOfflineShippingMethodsOnCartTest.php | 66 +++++-- .../Guest/SetShippingMethodsOnCartTest.php | 36 +++- .../Ups/SetUpsShippingMethodsOnCartTest.php | 35 ++-- 11 files changed, 480 insertions(+), 240 deletions(-) diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index 08066e5fdfed3..9f102a1c6a150 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -16,179 +16,6 @@ type Query { @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\CategoryTree") @doc(description: "The category query searches for categories that match the criteria specified in the search and filter attributes") @cache(cacheTag: "cat_c", cacheIdentity: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CategoryTreeIdentity") } -enum CurrencyEnum @doc(description: "The list of available currency codes") { - AFN - ALL - AZN - DZD - AOA - ARS - AMD - AWG - AUD - BSD - BHD - BDT - BBD - BYR - BZD - BMD - BTN - BOB - BAM - BWP - BRL - GBP - BND - BGN - BUK - BIF - KHR - CAD - CVE - CZK - KYD - GQE - CLP - CNY - COP - KMF - CDF - CRC - HRK - CUP - DKK - DJF - DOP - XCD - EGP - SVC - ERN - EEK - ETB - EUR - FKP - FJD - GMD - GEK - GEL - GHS - GIP - GTQ - GNF - GYD - HTG - HNL - HKD - HUF - ISK - INR - IDR - IRR - IQD - ILS - JMD - JPY - JOD - KZT - KES - KWD - KGS - LAK - LVL - LBP - LSL - LRD - LYD - LTL - MOP - MKD - MGA - MWK - MYR - MVR - LSM - MRO - MUR - MXN - MDL - MNT - MAD - MZN - MMK - NAD - NPR - ANG - YTL - NZD - NIC - NGN - KPW - NOK - OMR - PKR - PAB - PGK - PYG - PEN - PHP - PLN - QAR - RHD - RON - RUB - RWF - SHP - STD - SAR - RSD - SCR - SLL - SGD - SKK - SBD - SOS - ZAR - KRW - LKR - SDG - SRD - SZL - SEK - CHF - SYP - TWD - TJS - TZS - THB - TOP - TTD - TND - TMM - USD - UGX - UAH - AED - UYU - UZS - VUV - VEB - VEF - VND - CHE - CHW - XOF - WST - YER - ZMK - ZWD - TRY - AZM - ROL - TRL - XPF -} - type Price @doc(description: "The Price object defines the price of a product as well as any tax-related adjustments.") { amount: Money @doc(description: "The price of a product plus a three-letter currency code") adjustments: [PriceAdjustment] @doc(description: "An array that provides information about tax, weee, or weee_tax adjustments") @@ -214,11 +41,6 @@ enum PriceTypeEnum @doc(description: "This enumeration the price type.") { DYNAMIC } -type Money @doc(description: "A Money object defines a monetary value, including a numeric value and a currency code.") { - value: Float @doc(description: "A number expressing a monetary value") - currency: CurrencyEnum @doc(description: "A three-letter currency code, such as USD or EUR") -} - type ProductPrices @doc(description: "The ProductPrices object contains the regular price of an item, as well as its minimum and maximum prices. Only composite products, which include bundle, configurable, and grouped products, can contain a minimum and maximum price.") { minimalPrice: Price @doc(description: "The lowest possible final price for all the options defined within a composite product. If you are specifying a price range, this would be the from value.") maximalPrice: Price @doc(description: "The highest possible final price for all the options defined within a composite product. If you are specifying a price range, this would be the to value.") diff --git a/app/code/Magento/GraphQl/etc/schema.graphqls b/app/code/Magento/GraphQl/etc/schema.graphqls index 7ea715097cdf3..ab8472aa56cf0 100644 --- a/app/code/Magento/GraphQl/etc/schema.graphqls +++ b/app/code/Magento/GraphQl/etc/schema.graphqls @@ -39,3 +39,181 @@ enum SortEnum @doc(description: "This enumeration indicates whether to return re type ComplexTextValue { html: String! @doc(description: "HTML format") } + +type Money @doc(description: "A Money object defines a monetary value, including a numeric value and a currency code.") { + value: Float @doc(description: "A number expressing a monetary value") + currency: CurrencyEnum @doc(description: "A three-letter currency code, such as USD or EUR") +} + +enum CurrencyEnum @doc(description: "The list of available currency codes") { + AFN + ALL + AZN + DZD + AOA + ARS + AMD + AWG + AUD + BSD + BHD + BDT + BBD + BYR + BZD + BMD + BTN + BOB + BAM + BWP + BRL + GBP + BND + BGN + BUK + BIF + KHR + CAD + CVE + CZK + KYD + GQE + CLP + CNY + COP + KMF + CDF + CRC + HRK + CUP + DKK + DJF + DOP + XCD + EGP + SVC + ERN + EEK + ETB + EUR + FKP + FJD + GMD + GEK + GEL + GHS + GIP + GTQ + GNF + GYD + HTG + HNL + HKD + HUF + ISK + INR + IDR + IRR + IQD + ILS + JMD + JPY + JOD + KZT + KES + KWD + KGS + LAK + LVL + LBP + LSL + LRD + LYD + LTL + MOP + MKD + MGA + MWK + MYR + MVR + LSM + MRO + MUR + MXN + MDL + MNT + MAD + MZN + MMK + NAD + NPR + ANG + YTL + NZD + NIC + NGN + KPW + NOK + OMR + PKR + PAB + PGK + PYG + PEN + PHP + PLN + QAR + RHD + RON + RUB + RWF + SHP + STD + SAR + RSD + SCR + SLL + SGD + SKK + SBD + SOS + ZAR + KRW + LKR + SDG + SRD + SZL + SEK + CHF + SYP + TWD + TJS + TZS + THB + TOP + TTD + TND + TMM + USD + UGX + UAH + AED + UYU + UZS + VUV + VEB + VEF + VND + CHE + CHW + XOF + WST + YER + ZMK + ZWD + TRY + AZM + ROL + TRL + XPF +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php index c58affa064c89..6f92611e25f48 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php @@ -11,6 +11,8 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Quote\Model\Quote\Address; +use Magento\Quote\Model\Quote\Address\Rate; /** * @inheritdoc @@ -25,19 +27,38 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value if (!isset($value['model'])) { throw new LocalizedException(__('"model" value should be specified')); } - + /** @var Address $address */ $address = $value['model']; + $rates = $address->getAllShippingRates(); - if ($address->getShippingMethod()) { - list($carrierCode, $methodCode) = explode('_', $address->getShippingMethod(), 2); - $shippingAmount = $address->getShippingAmount(); - } + if (count($rates) > 0) { + /** @var Rate $rate */ + $rate = current($rates); - return [ - 'carrier_code' => $carrierCode ?? null, - 'method_code' => $methodCode ?? null, - 'label' => $address->getShippingDescription(), - 'amount' => $shippingAmount ?? null, - ]; + $data = [ + 'carrier_code' => $rate->getCarrier(), + 'method_code' => $rate->getMethod(), + 'carrier_title' => $rate->getCarrierTitle(), + 'method_title' => $rate->getMethodTitle(), + 'amount' => [ + 'value' => $address->getShippingAmount(), + 'currency' => $address->getQuote()->getQuoteCurrencyCode(), + ], + 'base_amount' => [ + 'value' => $address->getBaseShippingAmount(), + 'currency' => $address->getQuote()->getBaseCurrencyCode(), + ], + ]; + } else { + $data = [ + 'carrier_code' => null, + 'method_code' => null, + 'carrier_title' => null, + 'method_title' => null, + 'amount' => null, + 'base_amount' => null, + ]; + } + return $data; } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 6d94685ac4d0f..43682934443cb 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -226,8 +226,10 @@ type CartAddressCountry { type SelectedShippingMethod { carrier_code: String method_code: String - label: String - amount: Float + carrier_title: String + method_title: String + amount: Money + base_amount: Money } type AvailableShippingMethod { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedShippingMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedShippingMethodTest.php index ba169d7a5bbc9..5575830ea51cd 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedShippingMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedShippingMethodTest.php @@ -64,6 +64,28 @@ public function testGetSelectedShippingMethod() self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['method_code']); + + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Flat Rate', $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Fixed', $shippingAddress['selected_shipping_method']['method_title']); + + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); + $amount = $shippingAddress['selected_shipping_method']['amount']; + + self::assertArrayHasKey('value', $amount); + self::assertEquals(10, $amount['value']); + self::assertArrayHasKey('currency', $amount); + self::assertEquals('USD', $amount['currency']); + + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + $baseAmount = $shippingAddress['selected_shipping_method']['base_amount']; + + self::assertArrayHasKey('value', $baseAmount); + self::assertEquals(10, $baseAmount['value']); + self::assertArrayHasKey('currency', $baseAmount); + self::assertEquals('USD', $baseAmount['currency']); } /** @@ -129,8 +151,10 @@ public function testGetGetSelectedShippingMethodIfShippingMethodIsNotSet() self::assertNull($shippingAddress['selected_shipping_method']['carrier_code']); self::assertNull($shippingAddress['selected_shipping_method']['method_code']); - self::assertNull($shippingAddress['selected_shipping_method']['label']); + self::assertNull($shippingAddress['selected_shipping_method']['carrier_title']); + self::assertNull($shippingAddress['selected_shipping_method']['method_title']); self::assertNull($shippingAddress['selected_shipping_method']['amount']); + self::assertNull($shippingAddress['selected_shipping_method']['base_amount']); } /** @@ -172,8 +196,16 @@ private function getQuery(string $maskedQuoteId): string selected_shipping_method { carrier_code method_code - label - amount + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } 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 4544691584721..c6c4a18bce4ab 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 @@ -48,12 +48,21 @@ protected function setUp() * * @param string $carrierCode * @param string $methodCode - * @param float $amount - * @param string $label + * @param string $carrierTitle + * @param string $methodTitle + * @param array $amount + * @param array $baseAmount + * @throws \Magento\Framework\Exception\NoSuchEntityException * @dataProvider offlineShippingMethodDataProvider */ - public function testSetOfflineShippingMethod(string $carrierCode, string $methodCode, float $amount, string $label) - { + public function testSetOfflineShippingMethod( + string $carrierCode, + string $methodCode, + string $carrierTitle, + string $methodTitle, + array $amount, + array $baseAmount + ) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); $query = $this->getQuery( @@ -77,11 +86,17 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($carrierTitle, $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); self::assertEquals($amount, $shippingAddress['selected_shipping_method']['amount']); - self::assertArrayHasKey('label', $shippingAddress['selected_shipping_method']); - self::assertEquals($label, $shippingAddress['selected_shipping_method']['label']); + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + self::assertEquals($baseAmount, $shippingAddress['selected_shipping_method']['base_amount']); } /** @@ -90,9 +105,30 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method public function offlineShippingMethodDataProvider(): array { return [ - 'flatrate_flatrate' => ['flatrate', 'flatrate', 10, 'Flat Rate - Fixed'], - 'tablerate_bestway' => ['tablerate', 'bestway', 10, 'Best Way - Table Rate'], - 'freeshipping_freeshipping' => ['freeshipping', 'freeshipping', 0, 'Free Shipping - Free'], + 'flatrate_flatrate' => [ + 'flatrate', + 'flatrate', + 'Flat Rate', + 'Fixed', + ['value' => 10, 'currency' => 'USD'], + ['value' => 10, 'currency' => 'USD'], + ], + 'tablerate_bestway' => [ + 'tablerate', + 'bestway', + 'Best Way', + 'Table Rate', + ['value' => 10, 'currency' => 'USD'], + ['value' => 10, 'currency' => 'USD'], + ], + 'freeshipping_freeshipping' => [ + 'freeshipping', + 'freeshipping', + 'Free Shipping', + 'Free', + ['value' => 0, 'currency' => 'USD'], + ['value' => 0, 'currency' => 'USD'], + ], ]; } @@ -122,8 +158,16 @@ private function getQuery( selected_shipping_method { carrier_code method_code - amount - label + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } 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 a5c91865926a5..9ddedbfc46541 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 @@ -67,10 +67,32 @@ public function testSetShippingMethodOnCartWithSimpleProduct() self::assertArrayHasKey('selected_shipping_method', $shippingAddress); self::assertArrayHasKey('carrier_code', $shippingAddress['selected_shipping_method']); - self::assertEquals($carrierCode, $shippingAddress['selected_shipping_method']['carrier_code']); + self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['carrier_code']); self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); - self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); + self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['method_code']); + + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Flat Rate', $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Fixed', $shippingAddress['selected_shipping_method']['method_title']); + + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); + $amount = $shippingAddress['selected_shipping_method']['amount']; + + self::assertArrayHasKey('value', $amount); + self::assertEquals(10, $amount['value']); + self::assertArrayHasKey('currency', $amount); + self::assertEquals('USD', $amount['currency']); + + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + $baseAmount = $shippingAddress['selected_shipping_method']['base_amount']; + + self::assertArrayHasKey('value', $baseAmount); + self::assertEquals(10, $baseAmount['value']); + self::assertArrayHasKey('currency', $baseAmount); + self::assertEquals('USD', $baseAmount['currency']); } /** @@ -347,6 +369,16 @@ private function getQuery( selected_shipping_method { carrier_code method_code + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedShippingMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedShippingMethodTest.php index bfdecca782319..bd684a950b590 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedShippingMethodTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedShippingMethodTest.php @@ -56,6 +56,28 @@ public function testGetSelectedShippingMethod() self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['method_code']); + + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Flat Rate', $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Fixed', $shippingAddress['selected_shipping_method']['method_title']); + + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); + $amount = $shippingAddress['selected_shipping_method']['amount']; + + self::assertArrayHasKey('value', $amount); + self::assertEquals(10, $amount['value']); + self::assertArrayHasKey('currency', $amount); + self::assertEquals('USD', $amount['currency']); + + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + $baseAmount = $shippingAddress['selected_shipping_method']['base_amount']; + + self::assertArrayHasKey('value', $baseAmount); + self::assertEquals(10, $baseAmount['value']); + self::assertArrayHasKey('currency', $baseAmount); + self::assertEquals('USD', $baseAmount['currency']); } /** @@ -100,8 +122,10 @@ public function testGetGetSelectedShippingMethodIfShippingMethodIsNotSet() self::assertNull($shippingAddress['selected_shipping_method']['carrier_code']); self::assertNull($shippingAddress['selected_shipping_method']['method_code']); - self::assertNull($shippingAddress['selected_shipping_method']['label']); + self::assertNull($shippingAddress['selected_shipping_method']['carrier_title']); + self::assertNull($shippingAddress['selected_shipping_method']['method_title']); self::assertNull($shippingAddress['selected_shipping_method']['amount']); + self::assertNull($shippingAddress['selected_shipping_method']['base_amount']); } /** @@ -128,8 +152,16 @@ private function getQuery(string $maskedQuoteId): string selected_shipping_method { carrier_code method_code - label - amount + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } 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 2dc4ea360acb9..ff2c5f2e6b528 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 @@ -40,12 +40,21 @@ protected function setUp() * * @param string $carrierCode * @param string $methodCode - * @param float $amount - * @param string $label + * @param string $carrierTitle + * @param string $methodTitle + * @param array $amount + * @param array $baseAmount + * @throws \Magento\Framework\Exception\NoSuchEntityException * @dataProvider offlineShippingMethodDataProvider */ - public function testSetOfflineShippingMethod(string $carrierCode, string $methodCode, float $amount, string $label) - { + public function testSetOfflineShippingMethod( + string $carrierCode, + string $methodCode, + string $carrierTitle, + string $methodTitle, + array $amount, + array $baseAmount + ) { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); $query = $this->getQuery( @@ -69,11 +78,17 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($carrierTitle, $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); self::assertEquals($amount, $shippingAddress['selected_shipping_method']['amount']); - self::assertArrayHasKey('label', $shippingAddress['selected_shipping_method']); - self::assertEquals($label, $shippingAddress['selected_shipping_method']['label']); + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + self::assertEquals($baseAmount, $shippingAddress['selected_shipping_method']['base_amount']); } /** @@ -82,9 +97,30 @@ public function testSetOfflineShippingMethod(string $carrierCode, string $method public function offlineShippingMethodDataProvider(): array { return [ - 'flatrate_flatrate' => ['flatrate', 'flatrate', 10, 'Flat Rate - Fixed'], - 'tablerate_bestway' => ['tablerate', 'bestway', 10, 'Best Way - Table Rate'], - 'freeshipping_freeshipping' => ['freeshipping', 'freeshipping', 0, 'Free Shipping - Free'], + 'flatrate_flatrate' => [ + 'flatrate', + 'flatrate', + 'Flat Rate', + 'Fixed', + ['value' => 10, 'currency' => 'USD'], + ['value' => 10, 'currency' => 'USD'], + ], + 'tablerate_bestway' => [ + 'tablerate', + 'bestway', + 'Best Way', + 'Table Rate', + ['value' => 10, 'currency' => 'USD'], + ['value' => 10, 'currency' => 'USD'], + ], + 'freeshipping_freeshipping' => [ + 'freeshipping', + 'freeshipping', + 'Free Shipping', + 'Free', + ['value' => 0, 'currency' => 'USD'], + ['value' => 0, 'currency' => 'USD'], + ], ]; } @@ -114,8 +150,16 @@ private function getQuery( selected_shipping_method { carrier_code method_code - amount - label + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } 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 3cac485f9f6f2..0c2bf1453b547 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 @@ -59,10 +59,32 @@ public function testSetShippingMethodOnCartWithSimpleProduct() self::assertArrayHasKey('selected_shipping_method', $shippingAddress); self::assertArrayHasKey('carrier_code', $shippingAddress['selected_shipping_method']); - self::assertEquals($carrierCode, $shippingAddress['selected_shipping_method']['carrier_code']); + self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['carrier_code']); self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); - self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); + self::assertEquals('flatrate', $shippingAddress['selected_shipping_method']['method_code']); + + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Flat Rate', $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals('Fixed', $shippingAddress['selected_shipping_method']['method_title']); + + self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']); + $amount = $shippingAddress['selected_shipping_method']['amount']; + + self::assertArrayHasKey('value', $amount); + self::assertEquals(10, $amount['value']); + self::assertArrayHasKey('currency', $amount); + self::assertEquals('USD', $amount['currency']); + + self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']); + $baseAmount = $shippingAddress['selected_shipping_method']['base_amount']; + + self::assertArrayHasKey('value', $baseAmount); + self::assertEquals(10, $baseAmount['value']); + self::assertArrayHasKey('currency', $baseAmount); + self::assertEquals('USD', $baseAmount['currency']); } /** @@ -358,6 +380,16 @@ private function getQuery( selected_shipping_method { carrier_code method_code + carrier_title + method_title + amount { + value + currency + } + base_amount { + value + currency + } } } } 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 ea498ddb31d16..2f6f39d169009 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php @@ -48,9 +48,9 @@ class SetUpsShippingMethodsOnCartTest extends GraphQlAbstract { /** - * Defines carrier label for "UPS" shipping method + * Defines carrier title for "UPS" shipping method */ - const CARRIER_LABEL = 'United Parcel Service'; + const CARRIER_TITLE = 'United Parcel Service'; /** * Defines carrier code for "UPS" shipping method @@ -87,9 +87,9 @@ protected function setUp() * * @dataProvider dataProviderShippingMethods * @param string $methodCode - * @param string $methodLabel + * @param string $methodTitle */ - public function testSetUpsShippingMethod(string $methodCode, string $methodLabel) + public function testSetUpsShippingMethod(string $methodCode, string $methodTitle) { $quoteReservedId = 'test_quote'; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($quoteReservedId); @@ -111,11 +111,11 @@ public function testSetUpsShippingMethod(string $methodCode, string $methodLabel self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); - self::assertArrayHasKey('label', $shippingAddress['selected_shipping_method']); - self::assertEquals( - self::CARRIER_LABEL . ' - ' . $methodLabel, - $shippingAddress['selected_shipping_method']['label'] - ); + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); } /** @@ -142,9 +142,9 @@ public function dataProviderShippingMethods(): array * * @dataProvider dataProviderShippingMethodsBasedOnCanadaAddress * @param string $methodCode - * @param string $methodLabel + * @param string $methodTitle */ - public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode, string $methodLabel) + public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode, string $methodTitle) { $quoteReservedId = 'test_quote'; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($quoteReservedId); @@ -166,11 +166,11 @@ public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode, self::assertArrayHasKey('method_code', $shippingAddress['selected_shipping_method']); self::assertEquals($methodCode, $shippingAddress['selected_shipping_method']['method_code']); - self::assertArrayHasKey('label', $shippingAddress['selected_shipping_method']); - self::assertEquals( - self::CARRIER_LABEL . ' - ' . $methodLabel, - $shippingAddress['selected_shipping_method']['label'] - ); + self::assertArrayHasKey('carrier_title', $shippingAddress['selected_shipping_method']); + self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']); + + self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); + self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); } /** @@ -216,7 +216,8 @@ private function getQuery( selected_shipping_method { carrier_code method_code - label + carrier_title + method_title } } } From 7d27046c88f320fc174145b380bfbdbd54a17a7d Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 20:15:37 -0500 Subject: [PATCH 313/318] GraphQL-575: Schema inconsistency of "SelectedShippingMethod" declaration --- .../Resolver/ShippingAddress/SelectedShippingMethod.php | 5 +++-- .../Quote/Customer/GetSpecifiedBillingAddressTest.php | 2 +- .../GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php | 2 +- .../Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php | 2 -- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php index 6f92611e25f48..cd8f20c3f164f 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php @@ -32,12 +32,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $rates = $address->getAllShippingRates(); if (count($rates) > 0) { + list($carrierCode, $methodCode) = explode('_', $address->getShippingMethod(), 2); /** @var Rate $rate */ $rate = current($rates); $data = [ - 'carrier_code' => $rate->getCarrier(), - 'method_code' => $rate->getMethod(), + 'carrier_code' => $carrierCode, + 'method_code' => $methodCode, 'carrier_title' => $rate->getCarrierTitle(), 'method_title' => $rate->getMethodTitle(), 'amount' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php index e10d12d73e7a6..1ff5ddbde54ec 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php @@ -110,7 +110,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet() 'label' => null, ], 'telephone' => null, - '__typename' => null, + '__typename' => 'BillingCartAddress', 'customer_notes' => null, ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php index 68e99feb5fae2..48bff73226894 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php @@ -100,7 +100,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet() 'label' => null, ], 'telephone' => null, - '__typename' => null, + '__typename' => 'BillingCartAddress', ]; self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']); } 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 2f6f39d169009..d317c243e84b6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php @@ -115,7 +115,6 @@ public function testSetUpsShippingMethod(string $methodCode, string $methodTitle self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']); self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); - self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); } /** @@ -170,7 +169,6 @@ public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode, self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']); self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']); - self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']); } /** From f6232000ebe7e9e5f7b85b236f5db272d65ea731 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 20:48:34 -0500 Subject: [PATCH 314/318] GraphQL-575: Schema inconsistency of "SelectedShippingMethod" declaration --- .../Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php | 2 ++ 1 file changed, 2 insertions(+) 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 d317c243e84b6..c50ae0a70380e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php @@ -88,6 +88,7 @@ protected function setUp() * @dataProvider dataProviderShippingMethods * @param string $methodCode * @param string $methodTitle + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function testSetUpsShippingMethod(string $methodCode, string $methodTitle) { @@ -142,6 +143,7 @@ public function dataProviderShippingMethods(): array * @dataProvider dataProviderShippingMethodsBasedOnCanadaAddress * @param string $methodCode * @param string $methodTitle + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode, string $methodTitle) { From 56f79ede444a84b6ba18b673602d1221d059e156 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 29 Apr 2019 23:21:16 -0500 Subject: [PATCH 315/318] GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration --- setup/performance-toolkit/benchmark.jmx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index c1d21a08f9e2d..0609be4d7d193 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -41820,7 +41820,7 @@ vars.put("product_sku", product.get("sku")); - + true @@ -42126,7 +42126,7 @@ vars.put("product_sku", product.get("sku")); - + true From 74ef0c0b5d168285d375b260ffbbddc87c4d3634 Mon Sep 17 00:00:00 2001 From: Nazarn96 Date: Tue, 30 Apr 2019 10:16:10 +0300 Subject: [PATCH 316/318] magento/magento2#22020 static-test-fix --- app/code/Magento/Catalog/Model/Product/Gallery/Processor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php index 21503c1c8a687..54bef2efa5d51 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php @@ -494,7 +494,7 @@ protected function getNotDuplicatedFilename($fileName, $dispretionPath) /** * Retrieve data for update attribute * - * @param \Magento\Catalog\Model\Product $object + * @param \Magento\Catalog\Model\Product $object * @return array * @since 101.0.0 */ From f900e10206da15d28bb52fc56b9a1eb230b438b6 Mon Sep 17 00:00:00 2001 From: Nazarn96 Date: Tue, 30 Apr 2019 11:40:10 +0300 Subject: [PATCH 317/318] magento/magento2#22526 static-test-fix --- .../Magento/Backend/Block/Store/Switcher.php | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Store/Switcher.php b/app/code/Magento/Backend/Block/Store/Switcher.php index 709f44a879a3f..9c35cfb5df81d 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher.php +++ b/app/code/Magento/Backend/Block/Store/Switcher.php @@ -86,6 +86,8 @@ class Switcher extends \Magento\Backend\Block\Template protected $_storeFactory; /** + * Switcher constructor. + * * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param \Magento\Store\Model\GroupFactory $storeGroupFactory @@ -106,7 +108,7 @@ public function __construct( } /** - * @return void + * @inheritdoc */ protected function _construct() { @@ -130,6 +132,8 @@ protected function _construct() } /** + * Get website collection. + * * @return \Magento\Store\Model\ResourceModel\Website\Collection */ public function getWebsiteCollection() @@ -169,6 +173,8 @@ public function isWebsiteSwitchEnabled() } /** + * Set website variable name. + * * @param string $varName * @return $this */ @@ -179,6 +185,8 @@ public function setWebsiteVarName($varName) } /** + * Get website variable name. + * * @return string */ public function getWebsiteVarName() @@ -191,6 +199,8 @@ public function getWebsiteVarName() } /** + * Check if current website selected. + * * @param \Magento\Store\Model\Website $website * @return bool */ @@ -200,6 +210,8 @@ public function isWebsiteSelected(\Magento\Store\Model\Website $website) } /** + * Return website Id. + * * @return int|null */ public function getWebsiteId() @@ -211,6 +223,8 @@ public function getWebsiteId() } /** + * Return group collection provided website. + * * @param int|\Magento\Store\Model\Website $website * @return \Magento\Store\Model\ResourceModel\Group\Collection */ @@ -247,6 +261,8 @@ public function isStoreGroupSwitchEnabled() } /** + * Sets store group variable name. + * * @param string $varName * @return $this */ @@ -257,6 +273,8 @@ public function setStoreGroupVarName($varName) } /** + * Return store group variable name. + * * @return string */ public function getStoreGroupVarName() @@ -269,6 +287,8 @@ public function getStoreGroupVarName() } /** + * Is provided group selected. + * * @param \Magento\Store\Model\Group $group * @return bool */ @@ -278,6 +298,8 @@ public function isStoreGroupSelected(\Magento\Store\Model\Group $group) } /** + * Return store group Id. + * * @return int|null */ public function getStoreGroupId() @@ -289,6 +311,8 @@ public function getStoreGroupId() } /** + * Return store collection. + * * @param \Magento\Store\Model\Group|int $group * @return \Magento\Store\Model\ResourceModel\Store\Collection */ @@ -328,6 +352,8 @@ public function getStores($group) } /** + * Return store Id. + * * @return int|null */ public function getStoreId() @@ -339,6 +365,8 @@ public function getStoreId() } /** + * Check is provided store selected. + * * @param \Magento\Store\Model\Store $store * @return bool */ @@ -358,6 +386,8 @@ public function isStoreSwitchEnabled() } /** + * Sets store variable name. + * * @param string $varName * @return $this */ @@ -368,6 +398,8 @@ public function setStoreVarName($varName) } /** + * Return store variable name. + * * @return mixed|string */ public function getStoreVarName() @@ -380,6 +412,8 @@ public function getStoreVarName() } /** + * Return switch url. + * * @return string */ public function getSwitchUrl() @@ -399,6 +433,8 @@ public function getSwitchUrl() } /** + * Checks if scope selected. + * * @return bool */ public function hasScopeSelected() @@ -472,6 +508,8 @@ public function getCurrentStoreName() } /** + * Sets store ids. + * * @param array $storeIds * @return $this */ @@ -482,6 +520,8 @@ public function setStoreIds($storeIds) } /** + * Return store ids. + * * @return array */ public function getStoreIds() @@ -490,6 +530,8 @@ public function getStoreIds() } /** + * Check if system is run in the single store mode. + * * @return bool */ public function isShow() @@ -498,6 +540,8 @@ public function isShow() } /** + * Render block. + * * @return string */ protected function _toHtml() From 5523461133237ccc8011898262a447c8d26ec50a Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Tue, 30 Apr 2019 15:04:25 -0500 Subject: [PATCH 318/318] magento-engcom/magento2ce#2809: Suppressed static test failures --- app/code/Magento/Catalog/Model/Product/Gallery/Processor.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php index 54bef2efa5d51..e1b788bc3941b 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php @@ -157,6 +157,7 @@ public function addImage( throw new LocalizedException(__("The image doesn't exist.")); } + // phpcs:ignore Magento2.Functions.DiscouragedFunction $pathinfo = pathinfo($file); $imgExtensions = ['jpg', 'jpeg', 'gif', 'png']; if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) { @@ -452,6 +453,7 @@ protected function getUniqueFileName($file, $forTmp = false) $destinationFile = $forTmp ? $this->mediaDirectory->getAbsolutePath($this->mediaConfig->getTmpMediaPath($file)) : $this->mediaDirectory->getAbsolutePath($this->mediaConfig->getMediaPath($file)); + // phpcs:ignore Magento2.Functions.DiscouragedFunction $destFile = dirname($file) . '/' . \Magento\MediaStorage\Model\File\Uploader::getNewFileName($destinationFile); }