From e71e2d7685380a5e26fbb975d31ca48cd09272a2 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote Date: Tue, 26 Dec 2017 12:09:31 -0600 Subject: [PATCH 001/277] MAGETWO-85007: Add Content Section - fix ui component wysiwyg element setDisabled --- .../view/base/web/js/form/element/wysiwyg.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 9e9427f5ce72c..ee3c414140fb5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -7,12 +7,13 @@ * @api */ define([ + 'wysiwygAdapter', 'Magento_Ui/js/lib/view/utils/async', 'underscore', 'ko', './abstract', - 'Magento_Variable/variables' -], function ($, _, ko, Abstract) { + 'Magento_Variable/variables', +], function (wysiwyg, $, _, ko, Abstract) { 'use strict'; return Abstract.extend({ @@ -94,14 +95,16 @@ define([ this.$wysiwygEditorButton.attr('disabled', status); /* eslint-disable no-undef */ - if (wysiwygAdapter) { - _.each(wysiwygAdapter.activeEditor().controlManager.controls, function (property, index, controls) { - controls[property.id].setDisabled(status); - }); + if (typeof wysiwyg != 'undefined' && wysiwyg.activeEditor()) { - wysiwygAdapter.activeEditor().getBody().setAttribute('contenteditable', !status); - } + if(typeof wysiwyg.activeEditor().controlManager !== 'undefined') { + _.each(wysiwyg.activeEditor().controlManager.controls, function (property, index, controls) { + controls[property.id].setDisabled(status); + }); + } + wysiwyg.activeEditor().getBody().setAttribute('contenteditable', !status); + } /* eslint-enable no-undef*/ } }); From 2603f91e3d470873c012c054f3e72916f79336ed Mon Sep 17 00:00:00 2001 From: Krissy Hiserote Date: Tue, 26 Dec 2017 17:05:28 -0600 Subject: [PATCH 002/277] MAGETWO-85007: Add Content Section - make sure the wysiwygEditorButton is not empty --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index ee3c414140fb5..30d90be661d34 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -92,7 +92,9 @@ define([ * @param {Boolean} status */ setDisabled: function (status) { - this.$wysiwygEditorButton.attr('disabled', status); + if (this.$wysiwygEditorButton != '') { + this.$wysiwygEditorButton.attr('disabled', status); + } /* eslint-disable no-undef */ if (typeof wysiwyg != 'undefined' && wysiwyg.activeEditor()) { From 8d3a2376fd383f1e152058471add0095af199100 Mon Sep 17 00:00:00 2001 From: Vincent MARMIESSE Date: Thu, 4 Jan 2018 17:30:19 +0100 Subject: [PATCH 003/277] #42 - Dynamically fill the image keys --- .../Model/Import/Product.php | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index ff18035686bd1..ea46a14f5d466 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -425,7 +425,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * * @var string[] */ - protected $_imagesArrayKeys = ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image']; + protected $_imagesArrayKeys = []; /** * Permanent entity columns. @@ -833,7 +833,8 @@ public function __construct( $this->_initAttributeSets() ->_initTypeModels() - ->_initSkus(); + ->_initSkus() + ->_initImagesArrayKeys(); $this->validator->init($this); } @@ -1076,6 +1077,27 @@ protected function _initSkus() return $this; } + /** + * Initialize image array keys. + * + * @return $this + */ + protected function _initImagesArrayKeys() + { + $select = $this->_connection->select()->from( + $this->getResource()->getTable('eav_attribute'), + ['code' => 'attribute_code'] + )->where( + 'frontend_input = :frontend_input' + ); + $bind = [':frontend_input' => 'media_image']; + + $this->_imagesArrayKeys = $this->_connection->fetchCol($select, $bind); + $this->_imagesArrayKeys[] = '_media_image'; + + return $this; + } + /** * Initialize product type models. * From 79b0a41f6feb8f4f4b5244567a2811dbb751e7c6 Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Fri, 5 Jan 2018 00:25:39 -0600 Subject: [PATCH 004/277] MAGETWO-85452: QA Activities - Clear preReqData after each test --- .../AdminAddImageToWYSIWYGCatalogCest.xml | 21 +++++------ .../AdminAddImageToWYSIWYGProductCest.xml | 35 ++++++++++--------- ...dminEditTextEditorProductAttributeCest.xml | 8 +++-- ...erifyDefaultWYSIWYGToolbarOnProducCest.xml | 6 ++-- ...yTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml | 8 +++-- ...yTinyMCEv4IsNativeWYSIWYGOnProductCest.xml | 5 +-- .../Cest/AdminAddImageToWYSIWYGBlockCest.xml | 3 +- .../Cest/AdminAddImageToWYSIWYGCMSCest.xml | 17 ++++----- .../AdminAddVariableToWYSIWYGBlockCest.xml | 3 +- .../Cest/AdminAddWidgetToWYSIWYGBlockCest.xml | 4 +-- ...getToWYSIWYGWithCMSStaticBlockTypeCest.xml | 3 +- ...WYSIWYGWithCatalogCategoryLinkTypeCest.xml | 1 + ...oWYSIWYGWithCatalogProductLinkTypeCest.xml | 2 ++ ...oWYSIWYGWithCatalogProductListTypeCest.xml | 3 ++ ...YGWithRecentlyComparedProductsTypeCest.xml | 2 ++ ...IWYGWithRecentlyViewedProductsTypeCest.xml | 2 ++ ...ifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 3 +- .../Cms/Metadata/block-meta.xml | 4 +++ .../FunctionalTest/Cms/Metadata/cms-meta.xml | 2 +- .../AdminAddImageToWYSIWYGNewsletterCest.xml | 16 ++++----- 20 files changed, 89 insertions(+), 59 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml index 6000f3ea1c310..7f719f1fd021e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml @@ -28,18 +28,18 @@ - - + + - + - - + + @@ -47,7 +47,7 @@ - + @@ -63,18 +63,19 @@ - + - + - + + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml index fbc835ff8b55c..85b8f2a70e8fe 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml @@ -28,17 +28,18 @@ - + + - - + + @@ -52,9 +53,9 @@ - + - + @@ -64,28 +65,29 @@ - + - + - + + - - + + + - - + @@ -93,18 +95,19 @@ - + - + - + + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml index e4bba1ddc4d97..2b8ef929051f8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml @@ -40,7 +40,7 @@ - + @@ -52,6 +52,7 @@ + @@ -65,9 +66,9 @@ - + - + @@ -75,6 +76,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml index 87c7b470305cc..e2c402422c22b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml @@ -30,7 +30,8 @@ - + + @@ -56,7 +57,8 @@ - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml index 108d3172d468d..90f517521f210 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml @@ -12,10 +12,11 @@ - + + @@ -30,8 +31,8 @@ - - + + @@ -61,6 +62,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml index df57f7b241f77..478110dd9a12a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml @@ -11,7 +11,7 @@ - + @@ -29,11 +29,12 @@ - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml index 1cac975dab8e0..699c2e23989b2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml @@ -16,7 +16,7 @@ - + @@ -108,6 +108,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml index 80e6d971cc4c9..dfa358c5caf40 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml @@ -28,14 +28,14 @@ - + - + - + @@ -49,9 +49,9 @@ - + - + @@ -61,7 +61,7 @@ - + @@ -69,13 +69,14 @@ - + + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml index 9c01494b749dd..05b8f2e027c6a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml @@ -16,7 +16,7 @@ - + @@ -121,6 +121,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml index 5d3e60220faef..83d0eaf2c44c9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -16,7 +16,7 @@ - + @@ -79,7 +79,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 0bf617bf29ca4..29b96d3aff72a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -17,7 +17,7 @@ - + @@ -69,6 +69,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 425226f3527eb..8fcf656cd1cc7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -66,6 +66,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml index 9521b0a8afd47..0fbc7c2d0b869 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml @@ -74,6 +74,8 @@ + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 8772efe0a2aa5..25769100f2707 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -79,6 +79,9 @@ + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index f2518c94385c5..c3a91eadd4bd5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -84,6 +84,8 @@ + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml index 82cd169d0a933..577f5560567a0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml @@ -74,6 +74,8 @@ + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 24fe3223c768e..2edde1df3355b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -18,7 +18,7 @@ - + @@ -92,6 +92,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/block-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/block-meta.xml index 0b8a174b60da3..0d2bc1bb3532c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/block-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/block-meta.xml @@ -16,4 +16,8 @@ true + + + application/json + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/cms-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/cms-meta.xml index c9ac524a161e8..da69bf2049598 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/cms-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/cms-meta.xml @@ -17,7 +17,7 @@ string - + application/json diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml index b93ff0a5fff6e..e238228ff6846 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml @@ -35,10 +35,10 @@ - + - + @@ -53,9 +53,9 @@ - + - + @@ -65,7 +65,7 @@ - + @@ -73,14 +73,14 @@ - + - + - + From 5d9247a1cddabfe5358981254572d8f9e12d3cd0 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Fri, 5 Jan 2018 10:39:39 -0600 Subject: [PATCH 005/277] MAGETWO-86383: Admin are unable to add variable to CMS Page and Block on Firefox Use jQuery global explicitly --- .../tiny_mce/plugins/magentovariable/editor_plugin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index d96ab6dcc5353..2168c5794241d 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -171,18 +171,18 @@ tinymce.create('tinymce.plugins.magentovariable', { el = spans[i]; if (el.hasClassName('magento-custom-var')) { - $(el).replaceWith( + jQuery(el).replaceWith( this.customDirectiveGenerator.processConfig( Base64.idDecode( - $(el).getAttribute('id') + jQuery(el).attr('id') ) ) ); } else { - $(el).replaceWith( + jQuery(el).replaceWith( this.configDirectiveGenerator.processConfig( Base64.idDecode( - $(el).getAttribute('id') + jQuery(el).attr('id') ) ) ); From 34d85dc072d367d00454008060a84977d6ef4ba0 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Fri, 5 Jan 2018 13:12:37 -0600 Subject: [PATCH 006/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Move toolbar enabling/disabling into respective adapters. TinyMCE4 functionality needs to be implemented. --- .../Tinymce3/view/base/web/tinymce3Adapter.js | 26 +++++++- .../view/base/web/js/form/element/wysiwyg.js | 32 ++++++---- .../wysiwyg/tiny_mce/tinymce4Adapter.js | 59 +++++++++++++------ 3 files changed, 85 insertions(+), 32 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 08bbb95888d8d..b5c74af6c3dd3 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -244,6 +244,13 @@ define([ return tinyMCE3.get(id); }, + /** + * @return {String} + */ + getId: function () { + return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; + }, + /** * @return {Object} */ @@ -261,6 +268,16 @@ define([ this.activeEditor().execCommand('mceInsertContent', typeof ui !== 'undefined' ? ui : false, content); }, + /** + * Set the status of the toolbar to disabled or enabled (true for enabled, false for disabled) + * @param {Boolean} enabled + */ + setToolbarStatus: function (enabled) { + _.each(this.activeEditor().controlManager.controls, function (property, index, controls) { + controls[property.id].setDisabled(!enabled); + }); + }, + /** * Set caret location in WYSIWYG editor. * @@ -558,7 +575,14 @@ define([ content = editor.getContent(); content = this.decodeContent(content); - jQuery('#' + this.id).val(content).trigger('change'); + this.getTextArea().val(content).trigger('change'); + }, + + /** + * @return {Object} jQuery textarea element + */ + getTextArea: function () { + return jQuery('#' + this.id); }, /** diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 9e9427f5ce72c..107761e714ce5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -7,12 +7,13 @@ * @api */ define([ + 'wysiwygAdapter', 'Magento_Ui/js/lib/view/utils/async', 'underscore', 'ko', './abstract', - 'Magento_Variable/variables' -], function ($, _, ko, Abstract) { + 'Magento_Variable/variables', +], function (wysiwyg, $, _, ko, Abstract) { 'use strict'; return Abstract.extend({ @@ -88,21 +89,26 @@ define([ /** * Set disabled property to wysiwyg component * - * @param {Boolean} status + * @param {Boolean} disabled */ - setDisabled: function (status) { - this.$wysiwygEditorButton.attr('disabled', status); + setDisabled: function (disabled) { + if (this.$wysiwygEditorButton) { + this.$wysiwygEditorButton.attr('disabled', disabled); + } /* eslint-disable no-undef */ - if (wysiwygAdapter) { - _.each(wysiwygAdapter.activeEditor().controlManager.controls, function (property, index, controls) { - controls[property.id].setDisabled(status); - }); - - wysiwygAdapter.activeEditor().getBody().setAttribute('contenteditable', !status); + if (typeof wysiwyg !== 'undefined') { + if (disabled) { + wysiwyg.setToolbarStatus(false); + wysiwyg.getPluginButtons().attr('disabled', 'disabled'); + wysiwyg.getTextArea().attr('disabled', 'disabled'); + } else { + wysiwyg.setToolbarStatus(true); + wysiwyg.getPluginButtons().removeAttr('disabled'); + wysiwyg.getTextArea().removeAttr('disabled'); + } } - /* eslint-enable no-undef*/ } }); -}); +}); \ No newline at end of file diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 2ea9d434dc179..c2a3032049bdb 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -67,14 +67,14 @@ define([ * Setup TinyMCE4 editor */ setup: function (mode) { - var settings; + var settings, + self = this; this.turnOff(); if (typeof mode === 'undefined') { mode = this.mode; } - var self = this; if (this.config.plugins) { this.config.plugins.forEach(function (plugin) { @@ -92,16 +92,17 @@ define([ pluginConstructor.adapter = self; }); } - }); - } if (jQuery.isReady) { tinyMCE4.dom.Event.domLoaded = true; } -settings = this.getSettings(); - settings.mode = mode; tinyMCE4.init(settings);this.getPluginButtons().hide(); + + settings = this.getSettings(); + settings.mode = mode; + tinyMCE4.init(settings); + this.getPluginButtons().hide(); }, /** @@ -126,6 +127,14 @@ settings = this.getSettings(); this.config.tinymce4.toolbar = toolbar.join(' '); }, + /** + * Set the status of the toolbar to disabled or enabled (true for enabled, false for disabled) + * @param {Boolean} enabled + */ + setToolbarStatus: function (enabled) { + // TODO + }, + /** * @return {Object} */ @@ -133,7 +142,7 @@ settings = this.getSettings(); var settings; settings = { - selector: 'textarea#' + this.id, + selector: 'textarea#' + this.getId(), theme: 'modern', 'entity_encoding': 'raw', 'convert_urls': false, @@ -240,6 +249,13 @@ settings = this.getSettings(); return tinyMCE4.get(id); }, + /** + * @return {String} + */ + getId: function () { + return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; + }, + /** * @return {Object} */ @@ -275,7 +291,7 @@ settings = this.getSettings(); storeId = this.config['store_id'] !== null ? this.config['store_id'] : 0, frameDialog = jQuery('div.mce-container[role="dialog"]'), wUrl = this.config['files_browser_window_url'] + - 'target_element_id/' + this.id + '/' + + 'target_element_id/' + this.getId() + '/' + 'store/' + storeId + '/'; this.mediaBrowserOpener = o.win; @@ -327,14 +343,14 @@ settings = this.getSettings(); * @return {jQuery|*|HTMLElement} */ getToggleButton: function () { - return $('toggle' + this.id); + return $('toggle' + this.getId()); }, /** * Get plugins button. */ getPluginButtons: function () { - return jQuery('#buttons' + this.id + ' > button.plugin'); + return jQuery('#buttons' + this.getId() + ' > button.plugin'); }, /** @@ -348,7 +364,7 @@ settings = this.getSettings(); this.getPluginButtons().hide(); - tinyMCE4.execCommand('mceAddControl', false, this.id); + tinyMCE4.execCommand('mceAddControl', false, this.getId()); return this; }, @@ -370,7 +386,7 @@ settings = this.getSettings(); this.getPluginButtons().show(); - tinyMCE4.execCommand('mceRemoveEditor', false, this.id); + tinyMCE4.execCommand('mceRemoveEditor', false, this.getId()); return this; }, @@ -381,14 +397,14 @@ settings = this.getSettings(); closePopups: function () { // close all popups to avoid problems with updating parent content area varienGlobalEvents.fireEvent('wysiwygClosePopups'); - this.closeEditorPopup('browser_window' + this.id); + this.closeEditorPopup('browser_window' + this.getId()); }, /** * @return {Boolean} */ toggle: function () { - if (!tinyMCE4.get(this.id)) { + if (!tinyMCE4.get(this.getId())) { this.turnOn(); return true; @@ -402,8 +418,8 @@ settings = this.getSettings(); * On form validation. */ onFormValidation: function () { - if (tinyMCE4.get(this.id)) { - $(this.id).value = tinyMCE4.get(this.id).getContent(); + if (tinyMCE4.get(this.getId())) { + $(this.getId()).value = tinyMCE4.get(this.getId()).getContent(); } }, @@ -481,7 +497,7 @@ settings = this.getSettings(); * Update text area. */ updateTextArea: function () { - var editor = tinyMCE4.get(this.id), + var editor = tinyMCE4.get(this.getId()), content; if (!editor) { @@ -494,7 +510,14 @@ settings = this.getSettings(); content = editor.getContent(); content = this.decodeContent(content); - jQuery('#' + this.id).val(content).trigger('change'); + this.getTextArea().val(content).trigger('change'); + }, + + /** + * @return {Object} jQuery textarea element + */ + getTextArea: function () { + return jQuery('#' + this.getId()); }, /** From a7742e7a1a047644f7aa645b1b97122d5e40e286 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Fri, 5 Jan 2018 14:58:02 -0600 Subject: [PATCH 007/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Implement TinyMCE4 functionality --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index c2a3032049bdb..164fc11cf4f1e 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -132,7 +132,10 @@ define([ * @param {Boolean} enabled */ setToolbarStatus: function (enabled) { - // TODO + var controlIds = this.get(this.getId()).theme.panel.rootControl.controlIdLookup; + _.each(controlIds, function (controlId) { + controlId.disabled(!enabled); + }); }, /** From a8bcf6817024b0d3bd5891a385e2967ff124469d Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Sat, 6 Jan 2018 17:07:01 -0600 Subject: [PATCH 008/277] MAGETWO-85452: QA Activities - Clean up created data tests, added actions support firefox browser --- .../acceptance/tests/_suite/sampleSuite.xml | 1 + .../AdminAddImageToWYSIWYGCatalogCest.xml | 2 +- .../AdminAddImageToWYSIWYGProductCest.xml | 2 +- .../Catalog/Cest/AdminCreateCategoryCest.xml | 2 +- .../Cest/AdminCreateSimpleProductCest.xml | 2 +- ...dminEditTextEditorProductAttributeCest.xml | 2 +- ...erifyDefaultWYSIWYGToolbarOnProducCest.xml | 2 +- ...yTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml | 2 +- ...yTinyMCEv4IsNativeWYSIWYGOnProductCest.xml | 2 +- .../Cest/AdminAddImageToWYSIWYGBlockCest.xml | 16 +++++---- .../Cest/AdminAddImageToWYSIWYGCMSCest.xml | 5 ++- .../AdminAddVariableToWYSIWYGBlockCest.xml | 35 ++++++++++--------- .../Cest/AdminAddVariableToWYSIWYGCMSCest.xml | 6 ++-- .../Cest/AdminAddWidgetToWYSIWYGBlockCest.xml | 24 +++++++------ ...WidgetToWYSIWYGWithCMSPageLinkTypeCest.xml | 14 ++++---- ...getToWYSIWYGWithCMSStaticBlockTypeCest.xml | 10 +++--- ...WYSIWYGWithCatalogCategoryLinkTypeCest.xml | 12 +++---- ...oWYSIWYGWithCatalogProductLinkTypeCest.xml | 20 +++++------ ...oWYSIWYGWithCatalogProductListTypeCest.xml | 16 ++++----- ...YGWithRecentlyComparedProductsTypeCest.xml | 24 ++++++------- ...IWYGWithRecentlyViewedProductsTypeCest.xml | 16 ++++----- .../Cest/AdminSwitchWYSIWYGOptionsCest.xml | 10 +++--- ...ifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 24 ++++++++----- ...yTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml | 3 +- .../Section/CmsPagesPageActionsSection.xml | 5 +++ ...dminAddVariableToWYSIWYGNewsletterCest.xml | 22 ++++++------ .../AdminAddWidgetToWYSIWYGNewsletterCest.xml | 10 +++--- 27 files changed, 155 insertions(+), 134 deletions(-) diff --git a/dev/tests/acceptance/tests/_suite/sampleSuite.xml b/dev/tests/acceptance/tests/_suite/sampleSuite.xml index d42f6d00132b9..b122c7002f92f 100644 --- a/dev/tests/acceptance/tests/_suite/sampleSuite.xml +++ b/dev/tests/acceptance/tests/_suite/sampleSuite.xml @@ -35,6 +35,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml index 7f719f1fd021e..a217085ed227a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml @@ -11,7 +11,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml index 85b8f2a70e8fe..6781c91ffe734 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml @@ -11,7 +11,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateCategoryCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateCategoryCest.xml index 1d12792785104..114cd0478cebe 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateCategoryCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateCategoryCest.xml @@ -22,7 +22,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateSimpleProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateSimpleProductCest.xml index 0c6238f07a59b..0cb5fb05ca8b7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateSimpleProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateSimpleProductCest.xml @@ -22,7 +22,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml index 2b8ef929051f8..7d8fd32a6455b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml @@ -11,7 +11,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml index e2c402422c22b..aa2354a06b9a7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml @@ -12,7 +12,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml index 90f517521f210..e21b0f47f5d2c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml @@ -12,7 +12,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml index 478110dd9a12a..4d453f42f7a59 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml @@ -11,7 +11,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml index 699c2e23989b2..5e603a761ca7b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml @@ -11,7 +11,7 @@ - + @@ -78,11 +78,13 @@ - - - - - + + + + + + + @@ -102,7 +104,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml index dfa358c5caf40..f3065163d778e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml @@ -11,7 +11,7 @@ - + @@ -73,8 +73,7 @@ - - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml index 05b8f2e027c6a..8ebfae731d64c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml @@ -11,7 +11,7 @@ - + @@ -30,15 +30,15 @@ - - + + - + @@ -46,7 +46,7 @@ - + @@ -60,14 +60,15 @@ - + + - + @@ -82,11 +83,13 @@ - - - - - + + + + + + + @@ -94,18 +97,18 @@ - + - + - + @@ -115,7 +118,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml index 4c35cd634cc00..f933a58d00123 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml @@ -11,7 +11,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -92,7 +92,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml index 83d0eaf2c44c9..07240974758a3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -11,7 +11,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -46,16 +46,18 @@ - + - - - - - + + + + + + + @@ -63,18 +65,18 @@ - + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml index 50ca32ce4050d..1814c3f038794 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml @@ -12,7 +12,7 @@ - + @@ -30,14 +30,14 @@ - + - + @@ -45,23 +45,23 @@ - + - + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 29b96d3aff72a..f14330ce207e8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -12,7 +12,7 @@ - + @@ -51,9 +51,9 @@ - - - + + + @@ -66,7 +66,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 8fcf656cd1cc7..04b0b968cfc03 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -11,7 +11,7 @@ - + @@ -30,14 +30,14 @@ - + - + @@ -45,11 +45,11 @@ - + - + @@ -60,7 +60,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml index 0fbc7c2d0b869..5fa3c07e53e3e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml @@ -12,7 +12,7 @@ - + @@ -34,41 +34,41 @@ - + - + - + - + - + - + - - + + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 25769100f2707..108ee114a7ec4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -11,7 +11,7 @@ - + @@ -36,14 +36,14 @@ - + - + @@ -51,28 +51,28 @@ - + - + - + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index c3a91eadd4bd5..0b139b1501713 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -12,7 +12,7 @@ - + @@ -34,23 +34,23 @@ - + - + - + - + @@ -58,28 +58,28 @@ - + - + - - + + - + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml index 577f5560567a0..670a0ecc35898 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml @@ -12,7 +12,7 @@ - + @@ -34,14 +34,14 @@ - + - + @@ -49,7 +49,7 @@ - + @@ -57,19 +57,19 @@ - + - + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml index a0e641bd0c1a6..ba6a1a3847379 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml @@ -36,7 +36,7 @@ - + @@ -47,9 +47,10 @@ + - + @@ -61,7 +62,7 @@ - + @@ -72,9 +73,10 @@ + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 2edde1df3355b..f2381eb347164 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -12,7 +12,7 @@ - + @@ -61,12 +61,17 @@ - - - - - + + + + + + + + + + @@ -75,18 +80,19 @@ - + + - + - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml index 790d87bab4b12..cde0e5360e796 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml @@ -12,7 +12,7 @@ - + @@ -61,6 +61,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsPagesPageActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsPagesPageActionsSection.xml index ad22c451fe65c..0e8ebc3fb2877 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsPagesPageActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsPagesPageActionsSection.xml @@ -9,6 +9,11 @@
+ + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddVariableToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddVariableToWYSIWYGNewsletterCest.xml index 8bf3b6ac035ff..8105f0c6bd18a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddVariableToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddVariableToWYSIWYGNewsletterCest.xml @@ -29,15 +29,15 @@ - - + + - + @@ -47,7 +47,7 @@ - + @@ -61,31 +61,31 @@ - + - + - + - + - + - + @@ -97,7 +97,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml index 48d989431504c..e45f5314088db 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -35,10 +35,10 @@ - + - + @@ -46,14 +46,14 @@ - + - + - + From 4e8dc706401dcdbe1c7595fc7ebdd4b2c4fb7a1f Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Sun, 7 Jan 2018 12:48:08 -0600 Subject: [PATCH 009/277] MAGETWO-85452: QA Activities - Added conditions for Firefox browser --- dev/tests/acceptance/tests/_suite/sampleSuite.xml | 1 - .../Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml | 3 +-- .../Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml | 2 ++ .../Catalog/Section/StorefrontProductInfoMainSection.xml | 1 + .../Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml | 1 + ...nAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml | 2 +- .../FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dev/tests/acceptance/tests/_suite/sampleSuite.xml b/dev/tests/acceptance/tests/_suite/sampleSuite.xml index b122c7002f92f..d42f6d00132b9 100644 --- a/dev/tests/acceptance/tests/_suite/sampleSuite.xml +++ b/dev/tests/acceptance/tests/_suite/sampleSuite.xml @@ -35,7 +35,6 @@ - diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml index 6781c91ffe734..8a8c10b036819 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml @@ -74,8 +74,7 @@ - - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml index 4d453f42f7a59..83d9f8dd086a7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml @@ -47,6 +47,7 @@ + @@ -56,6 +57,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml index d7382de429340..37381af2fce24 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml @@ -8,6 +8,7 @@
+ diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml index f933a58d00123..387f939441fa3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml @@ -92,6 +92,7 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 0b139b1501713..484cc6e9b536d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -80,7 +80,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml index ba6a1a3847379..50504c51b6d2e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml @@ -54,7 +54,7 @@ - + From 6c781b47a6e14aaa52fbda331deb60233c840a7f Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Sun, 7 Jan 2018 15:22:59 -0600 Subject: [PATCH 010/277] MAGETWO-85452: QA Activities - Added scrollTo on Storefront to recognize elements --- .../Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml | 4 ++-- ...AddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml | 1 - .../Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml index 8a8c10b036819..26fc706daf1d2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml @@ -60,7 +60,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 484cc6e9b536d..1e9f8f3ec128d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -14,7 +14,6 @@ - diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml index e45f5314088db..93bd61704fb40 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -45,6 +45,7 @@ + From ea2460819ff6575464b2b36afa3f3dc927b2e060 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Mon, 8 Jan 2018 14:57:44 -0600 Subject: [PATCH 011/277] MAGETWO-86142: Image url not encoding/decoding correctly Support encoding/decoding of double quote delimiters for parameters on frontend and backend. --- .../Magento/Catalog/Model/Template/Filter.php | 2 +- app/code/Magento/Cms/Model/Template/Filter.php | 2 +- .../Test/Unit/Model/Template/FilterTest.php | 16 ++++++++++++++++ .../Magento/Email/Model/Template/Filter.php | 2 +- .../Tinymce3/view/base/web/tinymce3Adapter.js | 15 +++++++++------ .../Magento/Widget/Model/Template/Filter.php | 2 +- .../Test/Unit/Model/Template/FilterTest.php | 18 ++++++++++++++++++ .../Widget/Model/Template/FilterTest.php | 14 ++++++++++++++ .../plugins/magentowidget/editor_plugin.js | 2 +- .../wysiwyg/tiny_mce/tinymce4Adapter.js | 13 ++++++++----- 10 files changed, 70 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index b4445510d49e2..1eb30ff95a40b 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -125,7 +125,7 @@ public function viewDirective($construction) */ public function mediaDirective($construction) { - $params = $this->getParameters($construction[2]); + $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES)); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } diff --git a/app/code/Magento/Cms/Model/Template/Filter.php b/app/code/Magento/Cms/Model/Template/Filter.php index 2dcbfbc4ab598..f93972bade2af 100644 --- a/app/code/Magento/Cms/Model/Template/Filter.php +++ b/app/code/Magento/Cms/Model/Template/Filter.php @@ -37,7 +37,7 @@ public function setUseSessionInUrl($flag) */ public function mediaDirective($construction) { - $params = $this->getParameters($construction[2]); + $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES)); return $this->_storeManager->getStore()->getBaseMediaDir() . '/' . $params['url']; } } diff --git a/app/code/Magento/Cms/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Cms/Test/Unit/Model/Template/FilterTest.php index 009a740305a82..09476f291fb06 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/Template/FilterTest.php @@ -62,4 +62,20 @@ public function testMediaDirective() ->willReturn($baseMediaDir); $this->assertEquals($expectedResult, $this->filter->mediaDirective($construction)); } + + public function testMediaDirectiveWithEncodedQuotes() + { + $baseMediaDir = 'pub/media'; + $construction = [ + '{{media url="wysiwyg/image.jpg"}}', + 'media', + ' url="wysiwyg/image.jpg"' + ]; + $expectedResult = 'pub/media/wysiwyg/image.jpg'; + + $this->storeMock->expects($this->once()) + ->method('getBaseMediaDir') + ->willReturn($baseMediaDir); + $this->assertEquals($expectedResult, $this->filter->mediaDirective($construction)); + } } diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index 11a7416f79e7a..1d8218f90a0b2 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -516,7 +516,7 @@ public function viewDirective($construction) */ public function mediaDirective($construction) { - $params = $this->getParameters($construction[2]); + $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES)); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 08bbb95888d8d..dfa3626c95ab1 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -448,21 +448,23 @@ define([ }, /** + * Convert {{directive}} style attributes syntax to absolute URLs * @param {Object} content * @return {*} */ encodeDirectives: function (content) { // collect all HTML tags with attributes that contain directives - return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function (match) { - var attributesString = match[2]; + return content.gsub(/<([a-z0-9\-\_]+[^>]+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function (match) { + var attributesString = match[2], + decodedDirectiveString; // process tag attributes string attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function (m) { - return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"'; + decodedDirectiveString = encodeURIComponent(Base64.mageEncode((m[3].replace(/"/g, '"')))); + return m[1] + '="' + m[2] + this.makeDirectiveUrl(decodedDirectiveString) + m[4] + '"'; }.bind(this)); return '<' + match[1] + attributesString + '>'; - }.bind(this)); }, @@ -493,16 +495,17 @@ define([ }, /** + * Convert absolute URLs to {{directive}} style attributes syntax * @param {Object} content * @return {*} */ decodeDirectives: function (content) { // escape special chars in directives url to use it in regular expression var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'), - reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+)')); + reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)')); return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind - return Base64.mageDecode(match[1]); + return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"'); }); }, diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index 7cd8276ffef3d..7c3e8e467e038 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -136,7 +136,7 @@ public function widgetDirective($construction) */ public function mediaDirective($construction) { - $params = $this->getParameters($construction[2]); + $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES)); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } diff --git a/app/code/Magento/Widget/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Widget/Test/Unit/Model/Template/FilterTest.php index a7fccf0bc14ca..db2f468da663c 100644 --- a/app/code/Magento/Widget/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Widget/Test/Unit/Model/Template/FilterTest.php @@ -270,4 +270,22 @@ public function testMediaDirective() $result = $this->filter->mediaDirective($construction); $this->assertEquals($baseUrl . $image, $result); } + + public function testMediaDirectiveWithEncodedQuotes() + { + $image = 'wysiwyg/VB.png'; + $construction = ['{{media url="' . $image . '"}}', 'media', ' url="' . $image . '"']; + $baseUrl = 'http://localhost/pub/media/'; + + $this->storeMock->expects($this->once()) + ->method('getBaseUrl') + ->with(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) + ->willReturn($baseUrl); + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->willReturn($this->storeMock); + + $result = $this->filter->mediaDirective($construction); + $this->assertEquals($baseUrl . $image, $result); + } } diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php index 095193ca0e764..fc3b0399d0497 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Template/FilterTest.php @@ -20,4 +20,18 @@ public function testMediaDirective() $result = $filter->mediaDirective($construction); $this->assertEquals($baseUrl . $image, $result); } + + public function testMediaDirectiveWithEncodedQuotes() + { + $image = 'wysiwyg/VB.png'; + $construction = ['{{media url="' . $image . '"}}', 'media', ' url="' . $image . '"']; + $baseUrl = 'http://localhost/pub/media/'; + + /** @var \Magento\Widget\Model\Template\Filter $filter */ + $filter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Widget\Model\Template\Filter::class + ); + $result = $filter->mediaDirective($construction); + $this->assertEquals($baseUrl . $image, $result); + } } diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index af8078c0a022d..69b3c3331013e 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -205,7 +205,7 @@ tinymce.create('tinymce.plugins.magentowidget', { widgetEl.parentNode.removeChild(widgetEl); }); - return doc.body.innerHTML; + return doc.body ? doc.body.innerHTML : content; }, /** diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 4139b58a20aec..294709df3c975 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -510,35 +510,38 @@ define([ }, /** + * Convert {{directive}} style attributes syntax to absolute URLs * @param {Object} content * @return {*} */ encodeDirectives: function (content) { // collect all HTML tags with attributes that contain directives return content.gsub(/<([a-z0-9\-\_]+[^>]+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function (match) { - var attributesString = match[2]; + var attributesString = match[2], + decodedDirectiveString; // process tag attributes string attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function (m) { - return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"'; + decodedDirectiveString = encodeURIComponent(Base64.mageEncode((m[3].replace(/"/g, '"')))); + return m[1] + '="' + m[2] + this.makeDirectiveUrl(decodedDirectiveString) + m[4] + '"'; }.bind(this)); return '<' + match[1] + attributesString + '>'; - }.bind(this)); }, /** + * Convert absolute URLs to {{directive}} style attributes syntax * @param {Object} content * @return {*} */ decodeDirectives: function (content) { // escape special chars in directives url to use it in regular expression var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'), - reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+)')); + reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)')); return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind - return Base64.mageDecode(match[1]); + return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"'); }); }, From 70108d6c58a40710c0bb6119bbc7eb37ad5a7129 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Mon, 8 Jan 2018 16:27:45 -0600 Subject: [PATCH 012/277] MAGETWO-86142: Image url not encoding/decoding correctly Fix JS static build failures --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 3 ++- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index dfa3626c95ab1..91dcc07adf01b 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -460,7 +460,8 @@ define([ // process tag attributes string attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function (m) { - decodedDirectiveString = encodeURIComponent(Base64.mageEncode((m[3].replace(/"/g, '"')))); + decodedDirectiveString = encodeURIComponent(Base64.mageEncode(m[3].replace(/"/g, '"'))); + return m[1] + '="' + m[2] + this.makeDirectiveUrl(decodedDirectiveString) + m[4] + '"'; }.bind(this)); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 294709df3c975..b73fa5609d735 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -522,7 +522,8 @@ define([ // process tag attributes string attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function (m) { - decodedDirectiveString = encodeURIComponent(Base64.mageEncode((m[3].replace(/"/g, '"')))); + decodedDirectiveString = encodeURIComponent(Base64.mageEncode(m[3].replace(/"/g, '"'))); + return m[1] + '="' + m[2] + this.makeDirectiveUrl(decodedDirectiveString) + m[4] + '"'; }.bind(this)); From b878cffa5be248555ac02ddb144bc3c4a9249a0d Mon Sep 17 00:00:00 2001 From: Krissy Hiserote Date: Tue, 9 Jan 2018 12:08:50 -0600 Subject: [PATCH 013/277] MAGETWO-85421: Build Stabilization - fix javascript formatting --- .../Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 30d90be661d34..5463e80c43946 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -12,7 +12,7 @@ define([ 'underscore', 'ko', './abstract', - 'Magento_Variable/variables', + 'Magento_Variable/variables' ], function (wysiwyg, $, _, ko, Abstract) { 'use strict'; @@ -92,14 +92,14 @@ define([ * @param {Boolean} status */ setDisabled: function (status) { - if (this.$wysiwygEditorButton != '') { + if (this.$wysiwygEditorButton !== '') { this.$wysiwygEditorButton.attr('disabled', status); } /* eslint-disable no-undef */ - if (typeof wysiwyg != 'undefined' && wysiwyg.activeEditor()) { + if (typeof wysiwyg !== 'undefined' && wysiwyg.activeEditor()) { - if(typeof wysiwyg.activeEditor().controlManager !== 'undefined') { + if (typeof wysiwyg.activeEditor().controlManager !== 'undefined') { _.each(wysiwyg.activeEditor().controlManager.controls, function (property, index, controls) { controls[property.id].setDisabled(status); }); From 076d5810ca25352f302158ddd572d77ff76801f5 Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Wed, 10 Jan 2018 01:14:19 -0600 Subject: [PATCH 014/277] MAGETWO-85452: QA Activities - Organize TinyMCE tests --- .../Cms/Section/TinyMCESection.xml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml new file mode 100644 index 0000000000000..cf4e21fe5e702 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml @@ -0,0 +1,53 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
From f29209b982d4610faaf779f94e631d0a0db220e2 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote Date: Wed, 10 Jan 2018 08:08:25 -0600 Subject: [PATCH 015/277] MAGETWO-85007: Add Content Section - fix after CR --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 5463e80c43946..8662071c2b2b6 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -92,7 +92,7 @@ define([ * @param {Boolean} status */ setDisabled: function (status) { - if (this.$wysiwygEditorButton !== '') { + if (this.$wysiwygEditorButton) { this.$wysiwygEditorButton.attr('disabled', status); } From 41d40673b55697cdb69228e603c79f495fb237f5 Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Wed, 10 Jan 2018 09:26:54 -0600 Subject: [PATCH 016/277] MAGETWO-85452: QA Activities - Updated TinyMCE Section --- .../Magento/FunctionalTest/Cms/Section/TinyMCESection.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml index cf4e21fe5e702..df8e2bee8ec05 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml @@ -9,10 +9,11 @@
+ - - + + @@ -21,6 +22,7 @@ + @@ -47,7 +49,6 @@ -
From 54a038d21e2a4a229734fb9ca72792e9b25eaf45 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Wed, 10 Jan 2018 10:55:12 -0600 Subject: [PATCH 017/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Fix JS static build failures --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 2 +- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 107761e714ce5..713edc393470b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -12,7 +12,7 @@ define([ 'underscore', 'ko', './abstract', - 'Magento_Variable/variables', + 'Magento_Variable/variables' ], function (wysiwyg, $, _, ko, Abstract) { 'use strict'; diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 164fc11cf4f1e..b1032b81d02fb 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -133,6 +133,7 @@ define([ */ setToolbarStatus: function (enabled) { var controlIds = this.get(this.getId()).theme.panel.rootControl.controlIdLookup; + _.each(controlIds, function (controlId) { controlId.disabled(!enabled); }); From b67b0d58728ca02346c115926354daeeff65315d Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Wed, 10 Jan 2018 16:20:26 -0600 Subject: [PATCH 018/277] MAGETWO-85452: QA Activities Redesign TinyMCE section and Media Gallery section --- .../AdminAddImageToWYSIWYGCatalogCest.xml | 39 +-------- ...yTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml | 15 +--- .../VerifyMediaGalleryActionGroup.xml | 13 +++ .../ActionGroup/VerifyTinyMCEActionGroup.xml | 31 +++++++ .../Cest/AdminAddImageToWYSIWYGBlockCest.xml | 56 ++++++------- .../AdminAddVariableToWYSIWYGBlockCest.xml | 12 +-- .../Cest/AdminAddWidgetToWYSIWYGBlockCest.xml | 4 +- ...ifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 30 ++----- ...yTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml | 18 +--- .../Section/BlockNewPageContentSection.xml | 39 --------- .../Section/CmsNewPagePageContentSection.xml | 53 ------------ .../Cms/Section/TinyMCESection.xml | 83 +++++++++++++++---- ...nyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml | 20 +---- 13 files changed, 163 insertions(+), 250 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml index a217085ed227a..0031093405d23 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml @@ -34,44 +34,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml index e21b0f47f5d2c..6eeac0388971d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml @@ -38,20 +38,7 @@ - - - - - - - - - - - - - - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml new file mode 100644 index 0000000000000..6785f691fd385 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml new file mode 100644 index 0000000000000..a5f47667c9d80 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml index 5e603a761ca7b..0407e5421d9e3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml @@ -33,47 +33,47 @@ - - + + - + - - - - - - - - + + + + + + + + - + - + - + - - - - + + + + - - - - + + + + - - + + - - - - + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml index 8ebfae731d64c..b14e0bd2711f3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml @@ -42,9 +42,9 @@ - - - + + + @@ -62,7 +62,7 @@ - + @@ -78,8 +78,8 @@ - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml index 07240974758a3..c221c9c46194d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -33,8 +33,8 @@ - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index f2381eb347164..05032947ec2b7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -35,29 +35,15 @@ - - - - - - - - - - - - - - - - - + + + - - - - + + + + @@ -65,8 +51,6 @@ - - diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml index cde0e5360e796..143e7d5c70eb2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml @@ -36,22 +36,8 @@ - - - - - - - - - - - - - - - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockNewPageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockNewPageContentSection.xml index 3053688a0c7b6..90c82a12a67da 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockNewPageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockNewPageContentSection.xml @@ -9,45 +9,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml index 1d189754b2fdf..7b3b10b78ed6e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml @@ -56,57 +56,4 @@
-
- - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml index df8e2bee8ec05..398dbf3cfd668 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml @@ -9,29 +9,16 @@
+ - - - - - - - - - - - - - - @@ -45,10 +32,78 @@ +
+
+ + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml index c5cd17bd2c2f1..5f0d48d0ee2d6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml @@ -11,7 +11,7 @@ - + @@ -35,22 +35,8 @@ - - - - - - - - - - - - - - - - + + From 6c24c0e765f93afcba74a0085362b7abd46f6665 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Mon, 11 Dec 2017 13:11:02 +0100 Subject: [PATCH 019/277] Ranged selects always miss the last range Fix unit test. 11 batches expected to handle 105 items: 1: 1-10 2: 11-20 3: 21-30 4: 31-40 5: 41-50 6: 51-60 7: 61-70 8: 71-80 9: 81-90 10: 91-100 11: 101-105 --- .../Magento/Framework/DB/Query/BatchRangeIterator.php | 4 ++-- .../Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php b/lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php index 9871df1b16841..5176c85cfa702 100644 --- a/lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php +++ b/lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php @@ -113,7 +113,7 @@ public function __construct( public function current() { if (null === $this->currentSelect) { - $this->isValid = ($this->currentOffset + $this->batchSize) <= $this->totalItemCount; + $this->isValid = $this->currentOffset < $this->totalItemCount; $this->currentSelect = $this->initSelectObject(); } return $this->currentSelect; @@ -144,7 +144,7 @@ public function next() if (null === $this->currentSelect) { $this->current(); } - $this->isValid = ($this->batchSize + $this->currentOffset) <= $this->totalItemCount; + $this->isValid = $this->currentOffset < $this->totalItemCount; $select = $this->initSelectObject(); if ($this->isValid) { $this->iteration++; diff --git a/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php index 22fdf0a05686a..9e2014c1b070a 100644 --- a/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php @@ -116,6 +116,6 @@ public function testIterations() $iterations++; } - $this->assertEquals(10, $iterations); + $this->assertEquals(11, $iterations); } } From f0358bddde42a981fc807f9bccb10d8701489787 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 08:24:47 -0600 Subject: [PATCH 020/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Remove eslint-disable and use underscore's _.isUndefined --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 713edc393470b..c6dd3e5f7c0bd 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -96,8 +96,7 @@ define([ this.$wysiwygEditorButton.attr('disabled', disabled); } - /* eslint-disable no-undef */ - if (typeof wysiwyg !== 'undefined') { + if (!_.isUndefined(wysiwyg)) { if (disabled) { wysiwyg.setToolbarStatus(false); wysiwyg.getPluginButtons().attr('disabled', 'disabled'); From 37640341be562ce7160afaca0afb68aaa58c8c31 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 08:25:16 -0600 Subject: [PATCH 021/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Remove stray redundant eslint-enable --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index c6dd3e5f7c0bd..050334e43e466 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -107,7 +107,6 @@ define([ wysiwyg.getTextArea().removeAttr('disabled'); } } - /* eslint-enable no-undef*/ } }); }); \ No newline at end of file From 88418ad4bda29dc91bffabdf4f3129dfe9e687fb Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Thu, 11 Jan 2018 16:51:45 +0200 Subject: [PATCH 022/277] Removed "Object" usage as class name --- .../Framework/Code/Reader/SourceArgumentsReaderTest.php | 4 ++-- .../Code/Reader/_files/SourceArgumentsReaderTest.php.sample | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php index 2f7f040d82c24..d1b22e853ce1d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/SourceArgumentsReaderTest.php @@ -41,8 +41,8 @@ public function getConstructorArgumentTypesDataProvider() '\Imported\Name\Space\One', '\Imported\Name\Space\AnotherTest\Extended', '\Imported\Name\Space\Test', - '\Imported\Name\Space\Object\Under\Test', - '\Imported\Name\Space\Object', + '\Imported\Name\Space\ClassName\Under\Test', + '\Imported\Name\Space\ClassName', '\Some\Testing\Name\Space\Test', 'array', '' diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/_files/SourceArgumentsReaderTest.php.sample b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/_files/SourceArgumentsReaderTest.php.sample index 8bf978150d003..47c059de2034b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/_files/SourceArgumentsReaderTest.php.sample +++ b/dev/tests/integration/testsuite/Magento/Framework/Code/Reader/_files/SourceArgumentsReaderTest.php.sample @@ -6,7 +6,7 @@ namespace Some\Testing\Name\Space; use Imported\Name\Space\One as FirstImport; -use Imported\Name\Space\Object; +use Imported\Name\Space\ClassName; use Imported\Name\Space\Test as Testing, \Imported\Name\Space\AnotherTest ; class AnotherSimpleClass @@ -16,8 +16,8 @@ class AnotherSimpleClass FirstImport $itemTwo, AnotherTest\Extended $itemThree, Testing $itemFour, - Object\Under\Test $itemFive, - Object $itemSix, + ClassName\Under\Test $itemFive, + ClassName $itemSix, Test $itemSeven, array $itemEight = [], $itemNine = 'test' From 76e50e36e5d896c1718695aab6d4e217ac26313f Mon Sep 17 00:00:00 2001 From: Kieu Phan Date: Thu, 11 Jan 2018 09:35:20 -0600 Subject: [PATCH 023/277] MAGETWO-85452: QA Activities - Move general sections out of CMS section to have access from other TESTs --- .../Cest/AdminAddImageToWYSIWYGBlockCest.xml | 6 +-- .../Cest/AdminAddImageToWYSIWYGCMSCest.xml | 52 +++++++++--------- .../AdminAddVariableToWYSIWYGBlockCest.xml | 6 +-- .../Cest/AdminAddVariableToWYSIWYGCMSCest.xml | 8 +-- .../Cest/AdminAddWidgetToWYSIWYGBlockCest.xml | 6 +-- ...WidgetToWYSIWYGWithCMSPageLinkTypeCest.xml | 6 +-- ...getToWYSIWYGWithCMSStaticBlockTypeCest.xml | 6 +-- ...WYSIWYGWithCatalogCategoryLinkTypeCest.xml | 6 +-- ...oWYSIWYGWithCatalogProductLinkTypeCest.xml | 6 +-- ...oWYSIWYGWithCatalogProductListTypeCest.xml | 6 +-- ...YGWithRecentlyComparedProductsTypeCest.xml | 6 +-- ...IWYGWithRecentlyViewedProductsTypeCest.xml | 6 +-- .../Cest/AdminSwitchWYSIWYGOptionsCest.xml | 8 +-- ...yTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml | 2 +- .../Section/CmsNewPagePageContentSection.xml | 36 ------------- .../AdminAddImageToWYSIWYGNewsletterCest.xml | 54 +++++++++---------- .../AdminAddWidgetToWYSIWYGNewsletterCest.xml | 2 +- ...nyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml | 2 +- 18 files changed, 94 insertions(+), 130 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml index 0407e5421d9e3..66007231a8588 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml @@ -87,9 +87,9 @@ - - - + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml index f3065163d778e..f0db340b6588c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml @@ -31,44 +31,44 @@ - - + + - + - - - - - - - + + + + + + + - + - + - - - - + + + + - - - - + + + + - - + + - - - - + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml index b14e0bd2711f3..d543b77fc03c7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml @@ -92,9 +92,9 @@ - - - + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml index 387f939441fa3..7336ed648ca82 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml @@ -41,10 +41,10 @@ - + - - + + @@ -61,7 +61,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml index c221c9c46194d..daf91b2f53cd0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -60,9 +60,9 @@ - - - + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml index 1814c3f038794..3d1de1a70a7c5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml @@ -33,10 +33,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index f14330ce207e8..c4a31f5797334 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -34,10 +34,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 04b0b968cfc03..872d374810d82 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -33,10 +33,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml index 5fa3c07e53e3e..73b20b1324fbf 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml @@ -37,10 +37,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 108ee114a7ec4..f2254a4e1bc0f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -39,10 +39,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 1e9f8f3ec128d..d344ffa725480 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -36,10 +36,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml index 670a0ecc35898..02dceb9ead976 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml @@ -37,10 +37,10 @@ - + - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml index 50504c51b6d2e..774d08b21dee6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml @@ -39,8 +39,8 @@ - - + + @@ -65,8 +65,8 @@ - - + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml index 143e7d5c70eb2..f643b3141181b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml @@ -35,7 +35,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml index 7b3b10b78ed6e..3388a0cf7c741 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml @@ -15,45 +15,9 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml index e238228ff6846..4277c16138aa0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml @@ -34,45 +34,45 @@ - + - - + + - - - - - - - - + + + + + + + + - + - + - - - - + + + + - - - - + + + + - - + + - - - - + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml index 93bd61704fb40..3e38d4712a82c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -33,7 +33,7 @@ - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml index 5f0d48d0ee2d6..2dcc47b5afc55 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml @@ -34,7 +34,7 @@ - + From 3be2328adb0970bee9e5bf4ef26451b26939863e Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 12:56:57 -0600 Subject: [PATCH 024/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Fix editor editability --- .../Tinymce3/view/base/web/tinymce3Adapter.js | 20 +++++++++++++++++ .../view/base/web/js/form/element/wysiwyg.js | 15 +++++++++---- .../wysiwyg/tiny_mce/tinymce4Adapter.js | 22 +++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index b5c74af6c3dd3..d406f995b501a 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -132,6 +132,10 @@ define([ ed.onInit.add(self.onEditorInit.bind(self)); + ed.onInit.add(function (editor) { + varienGlobalEvents.fireEvent('wysiwygEditorInitialized', editor); + }); + ed.onSubmit.add(function (edi, e) { varienGlobalEvents.fireEvent('tinymceSubmit', e); }); @@ -278,6 +282,22 @@ define([ }); }, + /** + * Set the status of the editor and toolbar + */ + setEditorStatus: function (enabled) { + if (this.activeEditor()) { + this.get(this.getId()).getBody().setAttribute('contenteditable', enabled); + this.setToolbarStatus(enabled); + } + + if (enabled) { + this.getTextArea().removeAttr('disabled'); + } else { + this.getTextArea().attr('disabled', 'disabled'); + } + }, + /** * Set caret location in WYSIWYG editor. * diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 050334e43e466..9fe075925ae17 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -3,6 +3,8 @@ * See COPYING.txt for license details. */ +/* global varienGlobalEvents */ + /** * @api */ @@ -49,6 +51,13 @@ define([ this.$wysiwygEditorButton = $(element); }.bind(this)); + // disable editor completely after initialization is field is disabled + varienGlobalEvents.attachEventHandler('wysiwygEditorInitialized', function () { + if (this.disabled()) { + this.setDisabled(true); + } + }.bind(this)); + return this; }, @@ -98,13 +107,11 @@ define([ if (!_.isUndefined(wysiwyg)) { if (disabled) { - wysiwyg.setToolbarStatus(false); + wysiwyg.setEditorStatus(false); wysiwyg.getPluginButtons().attr('disabled', 'disabled'); - wysiwyg.getTextArea().attr('disabled', 'disabled'); } else { - wysiwyg.setToolbarStatus(true); + wysiwyg.setEditorStatus(true); wysiwyg.getPluginButtons().removeAttr('disabled'); - wysiwyg.getTextArea().removeAttr('disabled'); } } } diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index b1032b81d02fb..79154ac740bde 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -101,6 +101,12 @@ define([ settings = this.getSettings(); settings.mode = mode; + settings.setup = function (editor) { + editor.on('init', function (args) { + varienGlobalEvents.fireEvent('wysiwygEditorInitialized', args.target); + }); + }; + tinyMCE4.init(settings); this.getPluginButtons().hide(); }, @@ -524,6 +530,22 @@ define([ return jQuery('#' + this.getId()); }, + /** + * Set the status of the editor and toolbar + */ + setEditorStatus: function (enabled) { + if (this.activeEditor()) { + this.get(this.getId()).getBody().setAttribute('contenteditable', enabled); + this.setToolbarStatus(enabled); + } + + if (enabled) { + this.getTextArea().removeAttr('disabled'); + } else { + this.getTextArea().attr('disabled', 'disabled'); + } + }, + /** * Retrieve directives URL with substituted directive value. * From a76268e31f0bffd8c4b71a2a63efeb5e3fdb2f18 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 12:59:36 -0600 Subject: [PATCH 025/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Operate on activeEditor --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 2 +- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index d406f995b501a..a1cc9c1ca8841 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -287,7 +287,7 @@ define([ */ setEditorStatus: function (enabled) { if (this.activeEditor()) { - this.get(this.getId()).getBody().setAttribute('contenteditable', enabled); + this.activeEditor().getBody().setAttribute('contenteditable', enabled); this.setToolbarStatus(enabled); } diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 79154ac740bde..c4ec062165e87 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -535,7 +535,7 @@ define([ */ setEditorStatus: function (enabled) { if (this.activeEditor()) { - this.get(this.getId()).getBody().setAttribute('contenteditable', enabled); + this.activeEditor().getBody().setAttribute('contenteditable', enabled); this.setToolbarStatus(enabled); } From d4bab7a8df5fe819e75c21df25a1b5903767fe22 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 13:29:35 -0600 Subject: [PATCH 026/277] MAGETWO-86142: Image url not encoding/decoding correctly HTML-encode directive on backend when asIs is true --- app/code/Magento/Cms/Helper/Wysiwyg/Images.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index f830910ca1e4f..4c24e90ba2501 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -171,7 +171,8 @@ public function getImageHtmlDeclaration($filename, $renderAsTag = false) $mediaPath = str_replace($mediaUrl, '', $fileurl); $directive = sprintf('{{media url="%s"}}', $mediaPath); if ($renderAsTag) { - $html = sprintf('', $this->isUsingStaticUrlsAllowed() ? $fileurl : $directive); + $src = $this->isUsingStaticUrlsAllowed() ? $fileurl : htmlentities($directive, ENT_QUOTES); + $html = sprintf('', $src); } else { if ($this->isUsingStaticUrlsAllowed()) { $html = $fileurl; // $mediaPath; From 92913c5eab28879eaf5f69ecf1c3efe016df56e4 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Thu, 11 Jan 2018 13:32:02 -0600 Subject: [PATCH 027/277] MAGETWO-86142: Image url not encoding/decoding correctly Fix test --- app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php index 1fcc10609870a..e873ba3296257 100644 --- a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php +++ b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php @@ -426,7 +426,7 @@ public function providerGetImageHtmlDeclarationRenderingAsTag() { return [ ['http://localhost', 'test.png', true, ''], - ['http://localhost', 'test.png', false, ''] + ['http://localhost', 'test.png', false, ''] ]; } From 47c497fb44ee487a4a6334c15d839afd5025b7c6 Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Thu, 11 Jan 2018 16:38:15 -0500 Subject: [PATCH 028/277] Log file path when image open throws exception --- lib/internal/Magento/Framework/Image/Adapter/Gd2.php | 5 ++++- lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php index 444ab7113d429..365fa5939b6b5 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php @@ -62,7 +62,10 @@ public function open($filename) throw new \OverflowException('Memory limit has been reached.'); } $this->imageDestroy(); - $this->_imageHandler = call_user_func($this->_getCallback('create'), $this->_fileName); + $this->_imageHandler = call_user_func( + $this->_getCallback('create', null, sprintf('Unsupported image format. File: %s', $this->_fileName)), + $this->_fileName + ); } /** diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php index 50b9a5a013273..e0ead031a9ba0 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php +++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php @@ -77,7 +77,7 @@ public function open($filename) try { $this->_imageHandler = new \Imagick($this->_fileName); } catch (\ImagickException $e) { - throw new \Exception('Unsupported image format.', $e->getCode(), $e); + throw new \Exception(sprintf('Unsupported image format. File: %s', $this->_fileName), $e->getCode(), $e); } $this->backgroundColor(); From 100e12331e0887aba4845c417ee2d3a3b1ab3c36 Mon Sep 17 00:00:00 2001 From: David Manners Date: Tue, 16 Jan 2018 14:36:20 +0000 Subject: [PATCH 029/277] magento-engcom/import-export-improvements#42: create an image type processor to enable more modular testing --- .../Model/Import/Product.php | 14 +++++++++++- .../Import/Product/ImageTypeProcessor.php | 17 ++++++++++++++ .../Import/Product/ImageTypeProcessorTest.php | 20 +++++++++++++++++ .../Test/Unit/Model/Import/ProductTest.php | 22 +++++++++++++++++-- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php create mode 100644 app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ImageTypeProcessorTest.php diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index ea46a14f5d466..3b307e2db9ab4 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -6,6 +6,7 @@ namespace Magento\CatalogImportExport\Model\Import; use Magento\Catalog\Model\Product\Visibility; +use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; @@ -699,6 +700,11 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ private $catalogConfig; + /** + * @var ImageTypeProcessor + */ + private $imageTypeProcessor; + /** * @param \Magento\Framework\Json\Helper\Data $jsonHelper * @param \Magento\ImportExport\Helper\Data $importExportData @@ -738,6 +744,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param array $data * @param array $dateAttrCodes * @param CatalogConfig $catalogConfig + * @param ImageTypeProcessor $imageTypeProcessor * @throws \Magento\Framework\Exception\LocalizedException * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -781,7 +788,8 @@ public function __construct( \Magento\Catalog\Model\Product\Url $productUrl, array $data = [], array $dateAttrCodes = [], - CatalogConfig $catalogConfig = null + CatalogConfig $catalogConfig = null, + ImageTypeProcessor $imageTypeProcessor = null ) { $this->_eventManager = $eventManager; $this->stockRegistry = $stockRegistry; @@ -814,6 +822,8 @@ public function __construct( $this->dateAttrCodes = array_merge($this->dateAttrCodes, $dateAttrCodes); $this->catalogConfig = $catalogConfig ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(CatalogConfig::class); + $this->imageTypeProcessor = $imageTypeProcessor ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(ImageTypeProcessor::class); parent::__construct( $jsonHelper, @@ -1084,6 +1094,8 @@ protected function _initSkus() */ protected function _initImagesArrayKeys() { + $this->_imagesArrayKeys = $this->imageTypeProcessor->getImageTypes(); + return $this; $select = $this->_connection->select()->from( $this->getResource()->getTable('eav_attribute'), ['code' => 'attribute_code'] diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php new file mode 100644 index 0000000000000..435592226f030 --- /dev/null +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php @@ -0,0 +1,17 @@ +assertEquals( + ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image'], + $typeProcessor->getImageTypes() + ); + } +} diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 862276d35bac5..5ab3f96b8882d 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -5,6 +5,7 @@ */ namespace Magento\CatalogImportExport\Test\Unit\Model\Import; +use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Stdlib\DateTime; use Magento\ImportExport\Model\Import; @@ -159,6 +160,9 @@ class ProductTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractI /** @var \Magento\Catalog\Model\Product\Url|\PHPUnit_Framework_MockObject_MockObject*/ protected $productUrl; + /** @var ImageTypeProcessor|\PHPUnit_Framework_MockObject_MockObject */ + protected $imageTypeProcessor; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -326,11 +330,16 @@ protected function setUp() $this->data = []; + $this->imageTypeProcessor = $this->getMockBuilder(ImageTypeProcessor::class) + ->disableOriginalConstructor() + ->getMock(); + $this->_objectConstructor() ->_parentObjectConstructor() ->_initAttributeSets() ->_initTypeModels() - ->_initSkus(); + ->_initSkus() + ->_initImagesArrayKeys(); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -373,7 +382,8 @@ protected function setUp() 'taxClassProcessor' => $this->taxClassProcessor, 'scopeConfig' => $this->scopeConfig, 'productUrl' => $this->productUrl, - 'data' => $this->data + 'data' => $this->data, + 'imageTypeProcessor' => $this->imageTypeProcessor ] ); $reflection = new \ReflectionClass(\Magento\CatalogImportExport\Model\Import\Product::class); @@ -496,6 +506,14 @@ protected function _initSkus() return $this; } + protected function _initImagesArrayKeys() + { + $this->imageTypeProcessor->expects($this->once())->method('getImageTypes')->willReturn( + ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image'] + ); + return $this; + } + public function testSaveProductAttributes() { $testTable = 'test_table'; From 36a053f2b3fc6016e7089f6947c670204b46ba43 Mon Sep 17 00:00:00 2001 From: David Manners Date: Tue, 16 Jan 2018 14:56:21 +0000 Subject: [PATCH 030/277] magento-engcom/import-export-improvements#42: refactor the ImageTypeProcessor so that it will actually use the database to load the image information --- .../Model/Import/Product.php | 12 ------ .../Import/Product/ImageTypeProcessor.php | 36 +++++++++++++++- .../Import/Product/ImageTypeProcessorTest.php | 41 ++++++++++++++++++- 3 files changed, 75 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 3b307e2db9ab4..eb909a4dfe8bd 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1096,18 +1096,6 @@ protected function _initImagesArrayKeys() { $this->_imagesArrayKeys = $this->imageTypeProcessor->getImageTypes(); return $this; - $select = $this->_connection->select()->from( - $this->getResource()->getTable('eav_attribute'), - ['code' => 'attribute_code'] - )->where( - 'frontend_input = :frontend_input' - ); - $bind = [':frontend_input' => 'media_image']; - - $this->_imagesArrayKeys = $this->_connection->fetchCol($select, $bind); - $this->_imagesArrayKeys[] = '_media_image'; - - return $this; } /** diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php index 435592226f030..ee5e18488d55c 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php @@ -5,13 +5,47 @@ */ namespace Magento\CatalogImportExport\Model\Import\Product; +use Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel; + class ImageTypeProcessor { + /** + * @var \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory + */ + private $resourceFactory; + + /** + * @param \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory $resourceFactory + */ + public function __construct( + \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory $resourceFactory + ) + { + $this->resourceFactory = $resourceFactory; + } + /** * @return array */ public function getImageTypes() { - return ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image']; + $imageKeys = []; + /** @var ResourceModel $resource */ + $resource = $this->resourceFactory->create(); + $connection = $resource->getConnection(); + $select = $connection->select(); + $select->from( + $resource->getTable('eav_attribute'), + ['code' => 'attribute_code'] + ); + $select->where( + 'frontend_input = :frontend_input' + ); + $bind = [':frontend_input' => 'media_image']; + + $imageKeys = $connection->fetchCol($select, $bind); + $imageKeys[] = '_media_image'; + + return $imageKeys; } } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ImageTypeProcessorTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ImageTypeProcessorTest.php index 6d76fbccccff0..fccfedd74fad2 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ImageTypeProcessorTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ImageTypeProcessorTest.php @@ -11,7 +11,46 @@ class ImageTypeProcessorTest extends \PHPUnit\Framework\TestCase { public function testGetImageTypes() { - $typeProcessor = new ImageTypeProcessor(); + $resourceFactory = $this->createPartialMock( + \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory::class, + ['create'] + ); + + $resource = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel::class) + ->disableOriginalConstructor() + ->setMethods(['getTable', 'getConnection']) + ->getMock(); + $resource->expects($this->once()) + ->method('getTable') + ->with('eav_attribute') + ->willReturnArgument(0); + $connection = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class); + $resource->expects($this->any()) + ->method('getConnection') + ->willReturn($connection); + $resourceFactory->expects($this->once()) + ->method('create') + ->willReturn($resource); + + $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) + ->disableOriginalConstructor() + ->getMock(); + $selectMock->expects($this->once()) + ->method('from') + ->with('eav_attribute', ['code' => 'attribute_code'], null) + ->willReturnSelf(); + $selectMock->expects($this->once()) + ->method('where') + ->with('frontend_input = :frontend_input') + ->willReturnSelf(); + $connection->expects($this->any()) + ->method('fetchCol') + ->willReturn(['image', 'small_image', 'thumbnail', 'swatch_image']); + $connection->expects($this->any()) + ->method('select') + ->willReturn($selectMock); + + $typeProcessor = new ImageTypeProcessor($resourceFactory); $this->assertEquals( ['image', 'small_image', 'thumbnail', 'swatch_image', '_media_image'], $typeProcessor->getImageTypes() From 2bbf5e0fc5a5235ccdeb8fc50428b37705d0cc11 Mon Sep 17 00:00:00 2001 From: David Manners Date: Tue, 16 Jan 2018 14:58:58 +0000 Subject: [PATCH 031/277] magento-engcom/import-export-improvements#42: refactor the initImagesArrayKeys to be private and remove the _ in the name --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index eb909a4dfe8bd..fc9b13e97a8ec 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -844,7 +844,7 @@ public function __construct( $this->_initAttributeSets() ->_initTypeModels() ->_initSkus() - ->_initImagesArrayKeys(); + ->initImagesArrayKeys(); $this->validator->init($this); } @@ -1092,7 +1092,7 @@ protected function _initSkus() * * @return $this */ - protected function _initImagesArrayKeys() + private function initImagesArrayKeys() { $this->_imagesArrayKeys = $this->imageTypeProcessor->getImageTypes(); return $this; From 80b56d33c067073aa04f00bf035272b4747b2e8f Mon Sep 17 00:00:00 2001 From: Cari Spruiell Date: Tue, 16 Jan 2018 11:01:04 -0600 Subject: [PATCH 032/277] MAGETWO-85423: Create or update functional tests - add new store view action group --- .../AdminCreateStoreViewActionGroup.xml | 24 +++++++++++++ .../Store/Cest/AdminCreateStoreViewCest.xml | 34 +++++++++++++++++++ .../Store/Page/AdminSystemStoreViewPage.xml | 13 +++++++ .../AdminNewStoreViewActionsSection.xml | 14 ++++++++ 4 files changed, 85 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Cest/AdminCreateStoreViewCest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml new file mode 100644 index 0000000000000..4ade252788a5b --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Cest/AdminCreateStoreViewCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Cest/AdminCreateStoreViewCest.xml new file mode 100644 index 0000000000000..c540de62d670c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Cest/AdminCreateStoreViewCest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + <description value="Create a store view in admin"/> + </annotations> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" /> + <!--Confirm new store view on Store Grid--> + <fillField selector="{{AdminStoresGridSection.storeFilterTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilter"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearch" /> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see selector="{{AdminStoresGridSection.storeNameInFirstRow}}" userInput="{{customStore.name}}" stepKey="seeNewStoreView" /> + </test> + </cest> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml new file mode 100644 index 0000000000000..f44ed06277617 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminSystemStorePage" url="/admin/admin/system_store/newStore" module="Store"> + <section name="AdminNewStoreViewMainActionsSection"/> + <section name="AdminNewStoreSection"/> + </page> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml new file mode 100644 index 0000000000000..5c2a04b034e5a --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminNewStoreViewActionsSection"> + <element name="backButton" type="button" selector="#back"/> + <element name="resetButton" type="button" selector="#reset"/> + <element name="saveButton" type="button" selector="#save"/> + </section> +</config> From e69be2804b5bcdbf7f8559daec3883a31ee71115 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 16 Jan 2018 19:01:55 +0200 Subject: [PATCH 033/277] MAGETWO-86754: Variable icon still gets selected after deleting variable from WYSIWYG content area --- .../plugins/magentovariable/editor_plugin.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index d96ab6dcc5353..fabb672ee724f 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -56,15 +56,22 @@ tinymce.create('tinymce.plugins.magentovariable', { * Highlight or dismiss Insert Variable button when variable is selected or deselected. */ onPostRender: function () { - var _this = this; - - editor.on('click', function (e) { - _this.active(false); - - if (jQuery(e.target).hasClass('magento-variable')) { - _this.active(true); - } - }); + var _this = this, + /** + * Toggle active state of Insert Variable button. + * + * @param {Object} e + */ + toggleVariableButton = function (e) { + _this.active(false); + + if (jQuery(e.target).hasClass('magento-variable')) { + _this.active(true); + } + }; + + editor.on('click', toggleVariableButton); + editor.on('change', toggleVariableButton); } }); From 90465e09931afe43cfa8a44e7b1f5d5b70d428cb Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 16 Jan 2018 14:03:11 -0600 Subject: [PATCH 034/277] MAGETWO-86142: Image url not encoding/decoding correctly Rename encode_directives to add_directives in default config file --- app/code/Magento/Cms/Helper/Wysiwyg/Images.php | 8 ++++---- app/code/Magento/Cms/Model/Wysiwyg/Config.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 4c24e90ba2501..012b8c04c1153 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -166,16 +166,16 @@ public function isUsingStaticUrlsAllowed() */ public function getImageHtmlDeclaration($filename, $renderAsTag = false) { - $fileurl = $this->getCurrentUrl() . $filename; + $fileUrl = $this->getCurrentUrl() . $filename; $mediaUrl = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA); - $mediaPath = str_replace($mediaUrl, '', $fileurl); + $mediaPath = str_replace($mediaUrl, '', $fileUrl); $directive = sprintf('{{media url="%s"}}', $mediaPath); if ($renderAsTag) { - $src = $this->isUsingStaticUrlsAllowed() ? $fileurl : htmlentities($directive, ENT_QUOTES); + $src = $this->isUsingStaticUrlsAllowed() ? $fileUrl : htmlentities($directive, ENT_QUOTES); $html = sprintf('<img src="%s" alt="" />', $src); } else { if ($this->isUsingStaticUrlsAllowed()) { - $html = $fileurl; // $mediaPath; + $html = $fileUrl; } else { $directive = $this->urlEncoder->encode($directive); $html = $this->_backendData->getUrl('cms/wysiwyg/directive', ['___directive' => $directive]); diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php index e326d243b3f87..9fdb27f0f02ef 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php @@ -192,7 +192,7 @@ public function getConfig($data = []) 'add_variables' => true, 'add_widgets' => true, 'no_display' => false, - 'encode_directives' => true, + 'add_directives' => true, 'width' => '100%', 'height' => '500px', 'plugins' => [], From bfca039f4f76e22292c60fcd9e979457b54a38ce Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 16 Jan 2018 15:36:21 -0600 Subject: [PATCH 035/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Set readonly attribute on editor when changing its status --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 3 +++ lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index a1cc9c1ca8841..cb0aefb75bab6 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -284,10 +284,13 @@ define([ /** * Set the status of the editor and toolbar + * + * @param {Boolean} enabled */ setEditorStatus: function (enabled) { if (this.activeEditor()) { this.activeEditor().getBody().setAttribute('contenteditable', enabled); + this.activeEditor().readonly = !enabled; this.setToolbarStatus(enabled); } diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index c4ec062165e87..cc6dbc7e0cb35 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -532,10 +532,13 @@ define([ /** * Set the status of the editor and toolbar + * + * @param {Boolean} enabled */ setEditorStatus: function (enabled) { if (this.activeEditor()) { this.activeEditor().getBody().setAttribute('contenteditable', enabled); + this.activeEditor().readonly = !enabled; this.setToolbarStatus(enabled); } From 5b3cee1973c86b6bcdc3452d67f8cb4ca5eb50ae Mon Sep 17 00:00:00 2001 From: Cari Spruiell <cspruiell@magento.com> Date: Tue, 16 Jan 2018 16:34:37 -0600 Subject: [PATCH 036/277] MAGETWO-85423: Create or update functional tests - use configured backend name in url --- .../Store/ActionGroup/AdminCreateStoreViewActionGroup.xml | 2 +- .../FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index 4ade252788a5b..6571e6b28a578 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -8,7 +8,7 @@ <!-- Test XML Example --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <actionGroup name="AdminCreateStoreViewActionGroup"> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToNewStoreView"/> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_store/newStore" stepKey="navigateToNewStoreView"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <!--Create Store View--> <selectOption selector="{{AdminNewStoreSection.storeGrpDropdown}}" userInput="Main Website Store" stepKey="selectStore" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml index f44ed06277617..8ee5be44c8169 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="AdminSystemStorePage" url="/admin/admin/system_store/newStore" module="Store"> + <page name="AdminSystemStorePage" url="/{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_store/newStore" module="Store"> <section name="AdminNewStoreViewMainActionsSection"/> <section name="AdminNewStoreSection"/> </page> From f148e355d098af526d9359285ccd48671c4221f3 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Wed, 17 Jan 2018 13:23:42 +0000 Subject: [PATCH 037/277] magento-engcom/import-export-improvements#43: make the customer import work with large sets of customer data in the database on low memory systems - replace the usage of the CollectionByPagesIteratorFactory with a fetchAll when loading current customers from the database, this was causing issues because of the extra overhead that the the iterator caused by using objects to store each row's data in this way we can use a similar approach to how the product import loads old skus. See: Magento\Catalog\Model\ResourceModel\Product::getProductEntitiesInfo --- .../ResourceModel/Import/Customer/Storage.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php index ae88e9672c9f4..67717fa371625 100644 --- a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php +++ b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php @@ -76,16 +76,17 @@ public function __construct( public function load() { if ($this->_isCollectionLoaded == false) { - $collection = clone $this->_customerCollection; - $collection->removeAttributeToSelect(); - $tableName = $collection->getResource()->getEntityTable(); - $collection->getSelect()->from($tableName, ['entity_id', 'website_id', 'email']); - - $this->_byPagesIterator->iterate( - $this->_customerCollection, - $this->_pageSize, - [[$this, 'addCustomer']] - ); + $connection = $this->_customerCollection->getConnection(); + $select = $connection->select(); + $select->from($this->_customerCollection->getMainTable(), ['entity_id', 'website_id', 'email']); + $results = $connection->fetchAll($select); + foreach ($results as $customer) { + $email = strtolower(trim($customer['email'])); + if (!isset($this->_customerIds[$email])) { + $this->_customerIds[$email] = []; + } + $this->_customerIds[$email][$customer['website_id']] = $customer['entity_id']; + } $this->_isCollectionLoaded = true; } From 62f472286daf1ac867dbdd6225fd432704dacc6a Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Wed, 17 Jan 2018 13:30:21 +0000 Subject: [PATCH 038/277] magento-engcom/import-export-improvements#43: refactor the addCustomer method so that it does not use the DataObject - replace current usage, - keep BC by using the toArray method of the DataObject in the current public method --- .../Model/Import/CustomerComposite.php | 3 +- .../ResourceModel/Import/Customer/Storage.php | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php index c10ba026fd624..f94a7357df71b 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php @@ -308,14 +308,13 @@ public function validateRow(array $rowData, $rowNumber) // Add new customer data into customer storage for address entity instance $websiteId = $this->_customerEntity->getWebsiteId($this->_currentWebsiteCode); if (!$this->_addressEntity->getCustomerStorage()->getCustomerId($this->_currentEmail, $websiteId)) { - $customerData = new \Magento\Framework\DataObject( + $this->_addressEntity->getCustomerStorage()->addCustomerByArray( [ 'id' => $this->_nextCustomerId, 'email' => $this->_currentEmail, 'website_id' => $websiteId, ] ); - $this->_addressEntity->getCustomerStorage()->addCustomer($customerData); $this->_nextCustomerId++; } diff --git a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php index 67717fa371625..88378deff5ab1 100644 --- a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php +++ b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php @@ -81,30 +81,38 @@ public function load() $select->from($this->_customerCollection->getMainTable(), ['entity_id', 'website_id', 'email']); $results = $connection->fetchAll($select); foreach ($results as $customer) { - $email = strtolower(trim($customer['email'])); - if (!isset($this->_customerIds[$email])) { - $this->_customerIds[$email] = []; - } - $this->_customerIds[$email][$customer['website_id']] = $customer['entity_id']; + $this->addCustomerByArray($customer); } $this->_isCollectionLoaded = true; } } + /** + * @param array $customer + * @return $this + */ + public function addCustomerByArray(array $customer) + { + $email = strtolower(trim($customer['email'])); + if (!isset($this->_customerIds[$email])) { + $this->_customerIds[$email] = []; + } + $this->_customerIds[$email][$customer['website_id']] = $customer['entity_id']; + + return $this; + } + /** * Add customer to array * + * @deprecated @see addCustomerByArray * @param \Magento\Framework\DataObject|\Magento\Customer\Model\Customer $customer * @return $this */ public function addCustomer(\Magento\Framework\DataObject $customer) { - $email = strtolower(trim($customer->getEmail())); - if (!isset($this->_customerIds[$email])) { - $this->_customerIds[$email] = []; - } - $this->_customerIds[$email][$customer->getWebsiteId()] = $customer->getId(); + $this->addCustomerByArray($customer->toArray()); return $this; } From 0d929cc6a27d5045a59f0dcf8a36b9e9d7b22e4d Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Wed, 17 Jan 2018 16:54:30 +0200 Subject: [PATCH 039/277] MAGETWO-86754: Variable icon still gets selected after deleting variable from WYSIWYG content area --- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index fabb672ee724f..bc0b44a7fc748 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -57,6 +57,7 @@ tinymce.create('tinymce.plugins.magentovariable', { */ onPostRender: function () { var _this = this, + /** * Toggle active state of Insert Variable button. * From b8fe3fa35b92be897f6c82c6afd93e8254b4bd07 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Wed, 17 Jan 2018 09:37:07 -0600 Subject: [PATCH 040/277] MAGETWO-85423: Create or update functional tests - create cart price rule --- .../SalesRule/Data/SalesRuleData.xml | 21 +++++++++++++++++++ .../SalesRule/Metadata/sales_rule-meta.xml | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml new file mode 100644 index 0000000000000..98d27e4bb0fbd --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="SimpleSalesRule" type="SalesRule"> + <data key="name" unique="suffix">SimpleSalesRule</data> + <data key="is_active">true</data> + <data key="coupon_type">No Coupon</data> + <array key="customer_group_ids"> + <item>1</item> + </array> + <array key="website_ids"> + <item>0</item> + </array> + </entity> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule-meta.xml index 9417c61dd1537..46dc532749f70 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule-meta.xml @@ -72,4 +72,7 @@ </object> </object> </operation> + <operation name="DeleteSalesRule" dataType="SalesRule" type="delete" auth="adminOauth" url="/V1/salesRules/{rule_id}" method="DELETE"> + <contentType>application/json</contentType> + </operation> </config> From b64336a80d999794a25aefd7cbea63b7a78c2786 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 10:08:28 -0600 Subject: [PATCH 041/277] MAGETWO-86142: Image url not encoding/decoding correctly Integrate escaper and refactor tests --- .../Magento/Cms/Helper/Wysiwyg/Images.php | 14 +++++- .../Test/Unit/Helper/Wysiwyg/ImagesTest.php | 46 ++++++++++++++++--- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 012b8c04c1153..61d0bce4254f3 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -50,6 +50,13 @@ class Images extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_storeManager; + /** + * String escaper + * + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * Construct * @@ -57,16 +64,19 @@ class Images extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Framework\Escaper $escaper */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Backend\Helper\Data $backendData, \Magento\Framework\Filesystem $filesystem, - \Magento\Store\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Framework\Escaper $escaper ) { parent::__construct($context); $this->_backendData = $backendData; $this->_storeManager = $storeManager; + $this->escaper = $escaper; $this->_directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); $this->_directory->create(\Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY); @@ -171,7 +181,7 @@ public function getImageHtmlDeclaration($filename, $renderAsTag = false) $mediaPath = str_replace($mediaUrl, '', $fileUrl); $directive = sprintf('{{media url="%s"}}', $mediaPath); if ($renderAsTag) { - $src = $this->isUsingStaticUrlsAllowed() ? $fileUrl : htmlentities($directive, ENT_QUOTES); + $src = $this->isUsingStaticUrlsAllowed() ? $fileUrl : $this->escaper->escapeHtml($directive); $html = sprintf('<img src="%s" alt="" />', $src); } else { if ($this->isUsingStaticUrlsAllowed()) { diff --git a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php index e873ba3296257..fa3eca95f31c3 100644 --- a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php +++ b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php @@ -67,6 +67,11 @@ class ImagesTest extends \PHPUnit\Framework\TestCase */ protected $backendDataMock; + /** + * @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject + */ + protected $escaperMock; + /** * @var string */ @@ -127,13 +132,16 @@ protected function setUp() $this->storeMock = $this->createMock(\Magento\Store\Model\Store::class); + $this->escaperMock = $this->createMock(\Magento\Framework\Escaper::class); + $this->imagesHelper = $this->objectManager->getObject( \Magento\Cms\Helper\Wysiwyg\Images::class, [ 'context' => $this->contextMock, 'filesystem' => $this->filesystemMock, 'storeManager' => $this->storeManagerMock, - 'backendData' => $this->backendDataMock + 'backendData' => $this->backendDataMock, + 'escaper' => $this->escaperMock, ] ); } @@ -151,6 +159,7 @@ protected function tearDown() $this->requestMock = null; $this->urlEncoderMock = null; $this->backendDataMock = null; + $this->escaperMock = null; } /** @@ -413,20 +422,38 @@ public function testGetCurrentUrl() * @param string $baseUrl * @param string $fileName * @param bool $isUsingStaticUrls + * @param string|null $escapedValue * @param string $expectedHtml * @dataProvider providerGetImageHtmlDeclarationRenderingAsTag */ - public function testGetImageHtmlDeclarationRenderingAsTag($baseUrl, $fileName, $isUsingStaticUrls, $expectedHtml) - { - $this->generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStaticUrls); + public function testGetImageHtmlDeclarationRenderingAsTag( + $baseUrl, + $fileName, + $isUsingStaticUrls, + $escapedValue, + $expectedHtml + ) { + $this->generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStaticUrls, $escapedValue); $this->assertEquals($expectedHtml, $this->imagesHelper->getImageHtmlDeclaration($fileName, true)); } public function providerGetImageHtmlDeclarationRenderingAsTag() { return [ - ['http://localhost', 'test.png', true, '<img src="http://localhost/test.png" alt="" />'], - ['http://localhost', 'test.png', false, '<img src="{{media url="/test.png"}}" alt="" />'] + [ + 'http://localhost', + 'test.png', + true, + null, + '<img src="http://localhost/test.png" alt="" />' + ], + [ + 'http://localhost', + 'test.png', + false, + '{{media url="/test.png"}}', + '<img src="{{media url="/test.png"}}" alt="" />' + ] ]; } @@ -467,8 +494,9 @@ public function providerGetImageHtmlDeclaration() /** * @param string $baseUrl * @param bool $isUsingStaticUrls + * @param string|null $escapedValue */ - protected function generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStaticUrls) + protected function generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStaticUrls, $escapedValue = null) { $storeId = 1; $this->imagesHelper->setStoreId($storeId); @@ -481,6 +509,10 @@ protected function generalSettingsGetImageHtmlDeclaration($baseUrl, $isUsingStat ->method('getStore') ->willReturn($this->storeMock); + if ($escapedValue) { + $this->escaperMock->expects($this->once())->method('escapeHtml')->willReturn($escapedValue); + } + $this->generalSettingsIsUsingStaticUrlsAllowed($isUsingStaticUrls); } } From 3c27ed4ea48de29c33d0e3de7df82a4c602e45a6 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 10:45:58 -0600 Subject: [PATCH 042/277] MAGETWO-86383: Admin are unable to add variable to CMS Page and Block on Firefox Add jQuery to global list --- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 2168c5794241d..c6277fbd3a434 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -3,7 +3,7 @@ * See COPYING.txt for license details. */ -/* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64 */ +/* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64, jQuery */ /* eslint-disable strict */ tinymce.create('tinymce.plugins.magentovariable', { From 48e4848fe516df09346e88f5fbb209845cc9c87f Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Wed, 17 Jan 2018 11:23:49 -0600 Subject: [PATCH 043/277] MAGETWO-85423: Create or update functional tests - add ability to create Catalog Price Rule --- .../CatalogRule/Data/CatalogRuleData.xml | 24 +++++++++++++++++ .../Metadata/catalog-rule-meta.xml | 27 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml new file mode 100644 index 0000000000000..289513ca14454 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="_defaultCatalogRule" type="catalogRule"> + <data key="name" unique="suffix">CatalogPriceRule</data> + <data key="description">Catalog Price Rule Description</data> + <data key="is_active">1</data> + <array key="customer_group_ids"> + <item>0</item> + </array> + <array key="website_ids"> + <item>1</item> + </array> + <data key="simple_action">by_percent</data> + <data key="discount_amount">10</data> + </entity> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml new file mode 100644 index 0000000000000..83bfd0070a2cc --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> + <operation name="createCatalogRule" dataType="catalogRule" + type="create" auth="adminFormKey" url="/catalog_rule/promo_catalog/save/" method="POST"> + <contentType>application/x-www-form-urlencoded</contentType> + <field key="name">string</field> + <field key="description">string</field> + <field key="is_active">string</field> + <array key="customer_group_ids"> + <value>integer</value> + </array> + <array key="website_ids"> + <value>integer</value> + </array> + <field key="simple_action">string</field> + <field key="discount_amount">string</field> + </operation> +</config> From f787800cdb3a6078f48312ed6ce9fa66ca672bb7 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 12:10:22 -0600 Subject: [PATCH 044/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Remove all UI feedback on hover (hide tooltip/background change) --- .../adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index cc6dbc7e0cb35..cb7d41045d43a 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -142,6 +142,19 @@ define([ _.each(controlIds, function (controlId) { controlId.disabled(!enabled); + controlId.canFocus = enabled; + + if (controlId.tooltip) { + controlId.tooltip().state.set('rendered', enabled); + if (enabled) { + jQuery(controlId.getEl()).children('button').andSelf().removeAttr('style'); + } else { + jQuery(controlId.getEl()).children('button').andSelf().attr('style', 'color: inherit;' + + 'background-color: inherit;' + + 'border-color: transparent;' + ); + } + } }); }, From 91a9f5adf2b951b27d720d8d327839ead543cf95 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 12:23:13 -0600 Subject: [PATCH 045/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Remove all UI feedback on hover (hide tooltip/background change) for TinyMCE3 --- .../Tinymce3/view/base/web/tinymce3Adapter.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index cb0aefb75bab6..b89404238d2e6 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -319,7 +319,7 @@ define([ storeId = this.config['store_id'] !== null ? this.config['store_id'] : 0, frameDialog = jQuery(o.win.frameElement).parents('[role="dialog"]'), wUrl = this.config['files_browser_window_url'] + - 'target_element_id/' + this.id + '/' + + 'target_element_id/' + this.getId() + '/' + 'store/' + storeId + '/'; this.mediaBrowserOpener = o.win; @@ -371,14 +371,14 @@ define([ * @return {jQuery|*|HTMLElement} */ getToggleButton: function () { - return $('toggle' + this.id); + return $('toggle' + this.getId()); }, /** * Get plugins button. */ getPluginButtons: function () { - return $$('#buttons' + this.id + ' > button.plugin'); + return jQuery('#buttons' + this.getId() + ' > button.plugin'); }, /** @@ -390,7 +390,7 @@ define([ this.setup(mode); - tinyMCE3.execCommand('mceAddControl', false, this.id); + tinyMCE3.execCommand('mceAddControl', false, this.getId()); this.getPluginButtons().each(function (e) { e.hide(); @@ -405,7 +405,7 @@ define([ turnOff: function () { this.closePopups(); - tinyMCE3.execCommand('mceRemoveControl', false, this.id); + tinyMCE3.execCommand('mceRemoveControl', false, this.getId()); this.getPluginButtons().each(function (e) { e.show(); @@ -420,8 +420,8 @@ define([ closePopups: function () { if (typeof closeEditorPopup == 'function') { // close all popups to avoid problems with updating parent content area - closeEditorPopup('widget_window' + this.id); - closeEditorPopup('browser_window' + this.id); + closeEditorPopup('widget_window' + this.getId()); + closeEditorPopup('browser_window' + this.getId()); } }, @@ -429,7 +429,7 @@ define([ * @return {Boolean} */ toggle: function () { - if (!tinyMCE3.get(this.id)) { + if (!tinyMCE3.get(this.getId())) { this.turnOn(); return true; @@ -455,8 +455,8 @@ define([ * On form validation. */ onFormValidation: function () { - if (tinyMCE3.get(this.id)) { - $(this.id).value = tinyMCE3.get(this.id).getContent(); + if (tinyMCE3.get(this.getId())) { + $(this.getId()).value = tinyMCE3.get(this.getId()).getContent(); } }, @@ -588,7 +588,7 @@ define([ * Update text area. */ updateTextArea: function () { - var editor = tinyMCE3.get(this.id), + var editor = tinyMCE3.get(this.getId()), content; if (!editor) { @@ -605,7 +605,7 @@ define([ * @return {Object} jQuery textarea element */ getTextArea: function () { - return jQuery('#' + this.id); + return jQuery('#' + this.getId()); }, /** From 0efccdf3d46e5fee82bcdf54890fdc385c4504e4 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 12:24:35 -0600 Subject: [PATCH 046/277] MAGETWO-86141: Disable/Enable TinyMCE Not Working Refactor --- .../Ui/view/base/web/js/form/element/wysiwyg.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 9fe075925ae17..eb60ef486f60c 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -105,14 +105,12 @@ define([ this.$wysiwygEditorButton.attr('disabled', disabled); } - if (!_.isUndefined(wysiwyg)) { - if (disabled) { - wysiwyg.setEditorStatus(false); - wysiwyg.getPluginButtons().attr('disabled', 'disabled'); - } else { - wysiwyg.setEditorStatus(true); - wysiwyg.getPluginButtons().removeAttr('disabled'); - } + if (wysiwyg && disabled) { + wysiwyg.setEditorStatus(false); + wysiwyg.getPluginButtons().attr('disabled', 'disabled'); + } else if (wysiwyg) { + wysiwyg.setEditorStatus(true); + wysiwyg.getPluginButtons().removeAttr('disabled'); } } }); From a1dc84cfa4b27f1d256d476a14b1bb3852d502d8 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 17 Jan 2018 14:16:52 -0600 Subject: [PATCH 047/277] MAGETWO-86142: Image url not encoding/decoding correctly Fix directive usage on product page when static = no, dynamic = yes --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 4 ++-- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 91dcc07adf01b..854a81f01576e 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -444,7 +444,7 @@ define([ * @param {String} directive */ makeDirectiveUrl: function (directive) { - return this.config['directives_url'].replace('directive', 'directive/___directive/' + directive); + return this.config['directives_url'].replace(/directive.*/, 'directive/___directive/' + directive); }, /** @@ -503,7 +503,7 @@ define([ decodeDirectives: function (content) { // escape special chars in directives url to use it in regular expression var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'), - reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)')); + reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)\/?')); return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"'); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index b73fa5609d735..01546eb9e6b17 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -506,7 +506,7 @@ define([ * @param {String} directive */ makeDirectiveUrl: function (directive) { - return this.config['directives_url'].replace('directive', 'directive/___directive/' + directive); + return this.config['directives_url'].replace(/directive.*/, 'directive/___directive/' + directive); }, /** @@ -539,7 +539,7 @@ define([ decodeDirectives: function (content) { // escape special chars in directives url to use it in regular expression var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'), - reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)')); + reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)\/?')); return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"'); From 3ee8961210135471751a5ae38ee98ce75a0bbc96 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 09:57:15 +0000 Subject: [PATCH 048/277] magento-engcom/import-export-improvements#43: fix the AddressTests to work with the new methods - since we are now working with the connection in the load method we need to correct mocks in place --- .../Test/Unit/Model/Import/AddressTest.php | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php index fe8c2dedb5744..e0fd78ba5e654 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php @@ -56,8 +56,8 @@ class AddressTest extends \PHPUnit\Framework\TestCase * @var array */ protected $_customers = [ - ['id' => 1, 'email' => 'test1@email.com', 'website_id' => 1], - ['id' => 2, 'email' => 'test2@email.com', 'website_id' => 2], + ['entity_id' => 1, 'email' => 'test1@email.com', 'website_id' => 1], + ['entity_id' => 2, 'email' => 'test2@email.com', 'website_id' => 2], ]; /** @@ -233,28 +233,43 @@ protected function _createAttrCollectionMock() */ protected function _createCustomerStorageMock() { - $customerStorage = $this->createPartialMock( - \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage::class, - ['load'] - ); + $customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + ->disableOriginalConstructor() + ->setMethods(['getConnection']) + ->getMock(); + $collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $collectionFactory + ->expects($this->any()) + ->method('create') + ->willReturn($customerCollection); + $byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + /** @var \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */ + $customerStorage = $this->getMockBuilder(\Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage::class) + ->setMethods(['load']) + ->setConstructorArgs([$collectionFactory, $byPagesIteratorFactory]) + ->getMock(); $resourceMock = $this->createPartialMock( \Magento\Customer\Model\ResourceModel\Customer::class, ['getIdFieldName'] ); + $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from']); + $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); + /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface */ + $connectionMock = $this->createPartialMock( + \Magento\Framework\DB\Adapter\Pdo\Mysql::class, + ['select', 'fetchAll'] + ); + $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock)); + $customerCollection->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock)); $resourceMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('id')); foreach ($this->_customers as $customerData) { - $data = [ - 'resource' => $resourceMock, - 'data' => $customerData, - $this->createMock(\Magento\Customer\Model\Config\Share::class), - $this->createMock(\Magento\Customer\Model\AddressFactory::class), - $this->createMock(\Magento\Customer\Model\ResourceModel\Address\CollectionFactory::class), - $this->createMock(\Magento\Customer\Model\GroupFactory::class), - $this->createMock(\Magento\Customer\Model\AttributeFactory::class), - ]; - /** @var $customer \Magento\Customer\Model\Customer */ - $customer = $this->_objectManagerMock->getObject(\Magento\Customer\Model\Customer::class, $data); - $customerStorage->addCustomer($customer); + $customerStorage->addCustomerByArray($customerData); } return $customerStorage; } From 5cc36b74dfeca0472cacc24abc4ecb2c7a2c8b70 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 10:04:46 +0000 Subject: [PATCH 049/277] magento-engcom/import-export-improvements#43: refactor the _createCustomerStorageMock so that it - uses getMockBuilder - only has items that are needed --- .../Test/Unit/Model/Import/AddressTest.php | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php index e0fd78ba5e654..21622c938d081 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php @@ -233,41 +233,52 @@ protected function _createAttrCollectionMock() */ protected function _createCustomerStorageMock() { + /** @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */ + $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) + ->disableOriginalConstructor() + ->setMethods(['from']) + ->getMock(); + $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); + + /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ + $connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class) + ->disableOriginalConstructor() + ->setMethods(['select', 'fetchAll']) + ->getMock(); + $connectionMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + + /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ $customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) ->disableOriginalConstructor() ->setMethods(['getConnection']) ->getMock(); + $customerCollection->expects($this->any()) + ->method('getConnection') + ->will($this->returnValue($connectionMock)); + + /** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ $collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $collectionFactory - ->expects($this->any()) + $collectionFactory->expects($this->any()) ->method('create') ->willReturn($customerCollection); + + /** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ $byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); + /** @var \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */ $customerStorage = $this->getMockBuilder(\Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage::class) ->setMethods(['load']) ->setConstructorArgs([$collectionFactory, $byPagesIteratorFactory]) ->getMock(); - $resourceMock = $this->createPartialMock( - \Magento\Customer\Model\ResourceModel\Customer::class, - ['getIdFieldName'] - ); - $selectMock = $this->createPartialMock(\Magento\Framework\DB\Select::class, ['from']); - $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); - /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface */ - $connectionMock = $this->createPartialMock( - \Magento\Framework\DB\Adapter\Pdo\Mysql::class, - ['select', 'fetchAll'] - ); - $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock)); - $customerCollection->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock)); - $resourceMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('id')); + foreach ($this->_customers as $customerData) { $customerStorage->addCustomerByArray($customerData); } From d45ade079d4cb83df28c0e2a7283d6b87cad857e Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 10:22:52 +0000 Subject: [PATCH 050/277] magento-engcom/import-export-improvements#43: refactor the StorageTests - make sure that we are testing the new method for adding customer by array --- .../Import/Customer/StorageTest.php | 114 ++++++++---------- 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php index 71f8f17c85509..9ab4474eb2caa 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php @@ -26,74 +26,63 @@ class StorageTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->_model = new \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage( - $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) - ->disableOriginalConstructor() - ->getMock(), - $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) - ->disableOriginalConstructor() - ->getMock(), - $this->_getModelDependencies() - ); - $this->_model->load(); - } - - protected function tearDown() - { - unset($this->_model); - } - - /** - * Retrieve all necessary objects mocks which used inside customer storage - * - * @return array - */ - protected function _getModelDependencies() - { - $select = $this->getMockBuilder(\Magento\Framework\DB\Select::class) + /** @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */ + $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) ->disableOriginalConstructor() ->setMethods(['from']) ->getMock(); - $select->expects($this->any())->method('from')->will($this->returnCallback([$this, 'validateFrom'])); + $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); + + /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ + $connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class) + ->disableOriginalConstructor() + ->setMethods(['select', 'fetchAll']) + ->getMock(); + $connectionMock->expects($this->any()) + ->method('select') + ->will($this->returnValue($selectMock)); + $connectionMock->expects($this->any()) + ->method('fetchAll') + ->will($this->returnValue([])); + + /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ $customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) ->disableOriginalConstructor() - ->setMethods(['load', 'removeAttributeToSelect', 'getResource', 'getSelect']) + ->setMethods(['getConnection','getMainTable']) ->getMock(); + $customerCollection->expects($this->any()) + ->method('getConnection') + ->will($this->returnValue($connectionMock)); - $resourceStub = new \Magento\Framework\DataObject(); - $resourceStub->setEntityTable($this->_entityTable); - $customerCollection->expects($this->once())->method('getResource')->will($this->returnValue($resourceStub)); + $customerCollection->expects($this->any()) + ->method('getMainTable') + ->willReturn('customer_entity'); - $customerCollection->expects($this->once())->method('getSelect')->will($this->returnValue($select)); + /** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ + $collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $collectionFactory->expects($this->any()) + ->method('create') + ->willReturn($customerCollection); - $byPagesIterator = $this->createPartialMock(\stdClass::class, ['iterate']); - $byPagesIterator->expects($this->once()) - ->method('iterate') - ->will($this->returnCallback([$this, 'iterate'])); + /** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ + $byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); - return [ - 'customer_collection' => $customerCollection, - 'collection_by_pages_iterator' => $byPagesIterator, - 'page_size' => 10 - ]; + $this->_model = new \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage( + $collectionFactory, + $byPagesIteratorFactory + ); + $this->_model->load(); } - /** - * Iterate stub - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @param \Magento\Framework\Data\Collection $collection - * @param int $pageSize - * @param array $callbacks - */ - public function iterate(\Magento\Framework\Data\Collection $collection, $pageSize, array $callbacks) + protected function tearDown() { - foreach ($collection as $customer) { - foreach ($callbacks as $callback) { - call_user_func($callback, $customer); - } - } + unset($this->_model); } /** @@ -117,8 +106,7 @@ public function testAddCustomer() $customer = $this->_addCustomerToStorage(); $this->assertAttributeCount(1, $propertyName, $this->_model); - - $expectedCustomerData = [$customer->getWebsiteId() => $customer->getId()]; + $expectedCustomerData = [$customer['website_id'] => $customer['entity_id']]; $this->assertAttributeContains($expectedCustomerData, $propertyName, $this->_model); } @@ -127,19 +115,19 @@ public function testGetCustomerId() $customer = $this->_addCustomerToStorage(); $this->assertEquals( - $customer->getId(), - $this->_model->getCustomerId($customer->getEmail(), $customer->getWebsiteId()) + $customer['entity_id'], + $this->_model->getCustomerId($customer['email'], $customer['website_id']) ); - $this->assertFalse($this->_model->getCustomerId('new@test.com', $customer->getWebsiteId())); + $this->assertFalse($this->_model->getCustomerId('new@test.com', $customer['website_id'])); } /** - * @return \Magento\Framework\DataObject + * @return array */ protected function _addCustomerToStorage() { - $customer = new \Magento\Framework\DataObject(['id' => 1, 'website_id' => 1, 'email' => 'test@test.com']); - $this->_model->addCustomer($customer); + $customer = ['entity_id' => 1, 'website_id' => 1, 'email' => 'test@test.com']; + $this->_model->addCustomerByArray($customer); return $customer; } From e65359171da8718c96171387eaad9161059771f9 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 10:30:52 +0000 Subject: [PATCH 051/277] magento-engcom/import-export-improvements#43: add a fallback for when older code with a customer object is used - in the addCustomer covert $customerData['id'] to $customerData['entity_id'] so that older code that uses customer objects will still work as expected --- .../ResourceModel/Import/Customer/Storage.php | 6 +++++- .../ResourceModel/Import/Customer/StorageTest.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php index 88378deff5ab1..65d7a85faf064 100644 --- a/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php +++ b/app/code/Magento/CustomerImportExport/Model/ResourceModel/Import/Customer/Storage.php @@ -112,7 +112,11 @@ public function addCustomerByArray(array $customer) */ public function addCustomer(\Magento\Framework\DataObject $customer) { - $this->addCustomerByArray($customer->toArray()); + $customerData = $customer->toArray(); + if (!isset($customerData['entity_id']) && isset($customer['id'])) { + $customerData['entity_id'] = $customerData['id']; + } + $this->addCustomerByArray($customerData); return $this; } diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php index 9ab4474eb2caa..018c7b932a8c7 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php @@ -101,6 +101,20 @@ public function testLoad() } public function testAddCustomer() + { + $customer = new \Magento\Framework\DataObject(['id' => 1, 'website_id' => 1, 'email' => 'test@test.com']); + $this->_model->addCustomer($customer); + + $propertyName = '_customerIds'; + $this->assertAttributeCount(1, $propertyName, $this->_model); + $this->assertAttributeContains([$customer->getWebsiteId() => $customer->getId()], $propertyName, $this->_model); + $this->assertEquals( + $customer->getId(), + $this->_model->getCustomerId($customer->getEmail(), $customer->getWebsiteId()) + ); + } + + public function testAddCustomerByArray() { $propertyName = '_customerIds'; $customer = $this->_addCustomerToStorage(); From c07b97bf9a86fdc3e5b17336e90be389ef21eacd Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 11:14:55 +0000 Subject: [PATCH 052/277] magento-engcom/import-export-improvements#43: fix app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php - make sure that the data format used when importing data matches the expected format --- .../CustomerImportExport/Model/Import/CustomerComposite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php index f94a7357df71b..f52e5d8c8817f 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php @@ -310,7 +310,7 @@ public function validateRow(array $rowData, $rowNumber) if (!$this->_addressEntity->getCustomerStorage()->getCustomerId($this->_currentEmail, $websiteId)) { $this->_addressEntity->getCustomerStorage()->addCustomerByArray( [ - 'id' => $this->_nextCustomerId, + 'entity_id' => $this->_nextCustomerId, 'email' => $this->_currentEmail, 'website_id' => $websiteId, ] From 330634b0056289aa476f18ba352e65281b77da52 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Thu, 18 Jan 2018 11:21:37 +0000 Subject: [PATCH 053/277] magento-engcom/import-export-improvements#43: update the AddressTest and StorageTest - fix up the lines of over 120 characters - import classes that will be used to shorten lines --- .../Test/Unit/Model/Import/AddressTest.php | 28 +++++++++++-------- .../Import/Customer/StorageTest.php | 20 +++++++------ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php index 21622c938d081..20625d9d7f999 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php @@ -8,6 +8,12 @@ use Magento\CustomerImportExport\Model\Import\Address; use Magento\ImportExport\Model\Import\AbstractEntity; +use Magento\Framework\DB\Select; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Customer\Model\ResourceModel\Customer\Collection; +use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; +use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory; +use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage; /** * Class AddressTest @@ -233,14 +239,14 @@ protected function _createAttrCollectionMock() */ protected function _createCustomerStorageMock() { - /** @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */ - $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) + /** @var Select|\PHPUnit_Framework_MockObject_MockObject $selectMock */ + $selectMock = $this->getMockBuilder(Select::class) ->disableOriginalConstructor() ->setMethods(['from']) ->getMock(); $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); - /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var $connectionMock AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ $connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class) ->disableOriginalConstructor() ->setMethods(['select', 'fetchAll']) @@ -249,8 +255,8 @@ protected function _createCustomerStorageMock() ->method('select') ->will($this->returnValue($selectMock)); - /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ - $customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + /** @var Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ + $customerCollection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->setMethods(['getConnection']) ->getMock(); @@ -258,8 +264,8 @@ protected function _createCustomerStorageMock() ->method('getConnection') ->will($this->returnValue($connectionMock)); - /** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ - $collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + /** @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ + $collectionFactory = $this->getMockBuilder(CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -267,14 +273,14 @@ protected function _createCustomerStorageMock() ->method('create') ->willReturn($customerCollection); - /** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ - $byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) + /** @var CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ + $byPagesIteratorFactory = $this->getMockBuilder(CollectionByPagesIteratorFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - /** @var \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */ - $customerStorage = $this->getMockBuilder(\Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage::class) + /** @var Storage|\PHPUnit_Framework_MockObject_MockObject $customerStorage */ + $customerStorage = $this->getMockBuilder(Storage::class) ->setMethods(['load']) ->setConstructorArgs([$collectionFactory, $byPagesIteratorFactory]) ->getMock(); diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php index 018c7b932a8c7..9a06ebae375a6 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/ResourceModel/Import/Customer/StorageTest.php @@ -6,6 +6,10 @@ namespace Magento\CustomerImportExport\Test\Unit\Model\ResourceModel\Import\Customer; use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Customer\Model\ResourceModel\Customer\Collection; +use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; +use Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory; class StorageTest extends \PHPUnit\Framework\TestCase { @@ -33,7 +37,7 @@ protected function setUp() ->getMock(); $selectMock->expects($this->any())->method('from')->will($this->returnSelf()); - /** @var $connectionMock \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var $connectionMock AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ $connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\Pdo\Mysql::class) ->disableOriginalConstructor() ->setMethods(['select', 'fetchAll']) @@ -45,8 +49,8 @@ protected function setUp() ->method('fetchAll') ->will($this->returnValue([])); - /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ - $customerCollection = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + /** @var Collection|\PHPUnit_Framework_MockObject_MockObject $customerCollection */ + $customerCollection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->setMethods(['getConnection','getMainTable']) ->getMock(); @@ -58,8 +62,8 @@ protected function setUp() ->method('getMainTable') ->willReturn('customer_entity'); - /** @var \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ - $collectionFactory = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class) + /** @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject $collectionFactory */ + $collectionFactory = $this->getMockBuilder(CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -67,13 +71,13 @@ protected function setUp() ->method('create') ->willReturn($customerCollection); - /** @var \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ - $byPagesIteratorFactory = $this->getMockBuilder(\Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory::class) + /** @var CollectionByPagesIteratorFactory|\PHPUnit_Framework_MockObject_MockObject $byPagesIteratorFactory */ + $byPagesIteratorFactory = $this->getMockBuilder(CollectionByPagesIteratorFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->_model = new \Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage( + $this->_model = new Storage( $collectionFactory, $byPagesIteratorFactory ); From 27a94c720d3c834bf607b369924b072b0ef1a534 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 18 Jan 2018 09:59:08 -0600 Subject: [PATCH 054/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Build stabilization tasks --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 2 +- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index eb60ef486f60c..bdb8060d24612 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -114,4 +114,4 @@ define([ } } }); -}); \ No newline at end of file +}); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index a7c8ad14c2be6..80558e1c8e157 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -101,6 +101,11 @@ define([ settings = this.getSettings(); settings.mode = mode; + + /** + * Fire wysiwygEditorInitialized event on setup + * @param {Object} editor + */ settings.setup = function (editor) { editor.on('init', function (args) { varienGlobalEvents.fireEvent('wysiwygEditorInitialized', args.target); From 6bf052a052196139773a2021a5509f3c941c5cff Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 18 Jan 2018 10:03:36 -0600 Subject: [PATCH 055/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Build stabilization --- app/code/Magento/Cms/Helper/Wysiwyg/Images.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 61d0bce4254f3..409bc93aef153 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -29,7 +29,7 @@ class Images extends \Magento\Framework\App\Helper\AbstractHelper * * @var int */ - protected $_storeId = null; + protected $_storeId; /** * @var \Magento\Framework\Filesystem\Directory\Write @@ -158,7 +158,7 @@ public function convertIdToPath($id) */ public function isUsingStaticUrlsAllowed() { - $checkResult = new \StdClass(); + $checkResult = (object) []; $checkResult->isAllowed = false; $this->_eventManager->dispatch( 'cms_wysiwyg_images_static_urls_allowed', From 45c52db7d9ad92821a09e7b137c4ddbc3d8917ce Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 18 Jan 2018 10:55:49 -0600 Subject: [PATCH 056/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Build stabilization --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 80558e1c8e157..13be3c16afc66 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -151,6 +151,7 @@ define([ if (controlId.tooltip) { controlId.tooltip().state.set('rendered', enabled); + if (enabled) { jQuery(controlId.getEl()).children('button').andSelf().removeAttr('style'); } else { From c1274611a5dc46d5f6264e6cb610c3ff95fffd49 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 18 Jan 2018 11:06:29 -0600 Subject: [PATCH 057/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Build stabilization --- .../adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 13be3c16afc66..45a14bc6f287b 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -102,16 +102,6 @@ define([ settings = this.getSettings(); settings.mode = mode; - /** - * Fire wysiwygEditorInitialized event on setup - * @param {Object} editor - */ - settings.setup = function (editor) { - editor.on('init', function (args) { - varienGlobalEvents.fireEvent('wysiwygEditorInitialized', args.target); - }); - }; - tinyMCE4.init(settings); this.getPluginButtons().hide(); }, @@ -221,6 +211,10 @@ define([ editor.on('ExecCommand', function (cmd) { varienGlobalEvents.fireEvent('tinymceExecCommand', cmd); }); + + editor.on('init', function (args) { + varienGlobalEvents.fireEvent('wysiwygEditorInitialized', args.target); + }); } }; From 6e635567c05a8a210ddd39d6ac96268400a5d7c4 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Fri, 19 Jan 2018 12:23:47 -0600 Subject: [PATCH 058/277] MAGETWO-86142: Image url not encoding/decoding correctly Fix IE11 issue where it treats encoded " as decoded and substitutes single quote delimiter for attribute --- .../plugins/magentovariable/editor_plugin.js | 14 ++++++-------- .../plugins/magentowidget/editor_plugin.js | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index d96ab6dcc5353..1bd755710ec0e 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -162,14 +162,12 @@ tinymce.create('tinymce.plugins.magentovariable', { * @returns {*} */ decodeVariables: function (content) { - var i, el, spans, element = document.createElement('elem'); + var parser, doc; - element.innerHTML = content; - spans = element.querySelectorAll('span.magento-variable'); - - for (i = 0; i < spans.length; i++) { - el = spans[i]; + parser = new DOMParser(); + doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); + [].forEach.call(doc.querySelectorAll('span.magento-variable'), function (el) { if (el.hasClassName('magento-custom-var')) { $(el).replaceWith( this.customDirectiveGenerator.processConfig( @@ -187,9 +185,9 @@ tinymce.create('tinymce.plugins.magentovariable', { ) ); } - } + }); - return element.innerHTML; + return doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : content; }, /** diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index 69b3c3331013e..ddf6e2f6402fd 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -189,7 +189,7 @@ tinymce.create('tinymce.plugins.magentowidget', { } parser = new DOMParser(); - doc = parser.parseFromString(content, 'text/html'); + doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); [].forEach.call(doc.querySelectorAll('.magento-widget'), function (widgetEl) { var widgetChildEl = widgetEl.querySelector('.magento-widget'); @@ -205,7 +205,7 @@ tinymce.create('tinymce.plugins.magentowidget', { widgetEl.parentNode.removeChild(widgetEl); }); - return doc.body ? doc.body.innerHTML : content; + return doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : content; }, /** From 0dd2cd2c1bb663592856820336e2b9b6eecc62f0 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 11:45:19 +0200 Subject: [PATCH 059/277] Fix typo in variable --- .../Magento/GraphQl/TestModule/GraphQlQueryTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php index a7e9a4481d772..c4a3eb433c60e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlQueryTest.php @@ -27,9 +27,9 @@ public function testQueryTestModuleReturnsResults() } QUERY; - $reponse = $this->graphQlQuery($query); - $this->assertArrayHasKey('testItem', $reponse); - $testItem = $reponse['testItem']; + $response = $this->graphQlQuery($query); + $this->assertArrayHasKey('testItem', $response); + $testItem = $response['testItem']; $this->assertArrayHasKey('item_id', $testItem); $this->assertArrayHasKey('name', $testItem); $this->assertEquals(1, $testItem['item_id']); @@ -51,9 +51,9 @@ public function testQueryTestModuleExtensionAttribute() } QUERY; - $reponse = $this->graphQlQuery($query); - $this->assertArrayHasKey('testItem', $reponse); - $testItem = $reponse['testItem']; + $response = $this->graphQlQuery($query); + $this->assertArrayHasKey('testItem', $response); + $testItem = $response['testItem']; $this->assertArrayHasKey('integer_list', $testItem); $this->assertEquals([3, 4, 5], $testItem['integer_list']); } From 435171044dbbab7ed07d8758e012b7c4134e1854 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 11:46:51 +0200 Subject: [PATCH 060/277] Fix typo in test method's name --- .../testsuite/Magento/GraphQl/Catalog/ProductViewTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php index 41d1d0e8f22ac..44bc309f754cb 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php @@ -665,7 +665,7 @@ private function assertEavAttributes($product, $actualResponse) $expectedAttribute = $product->getCustomAttribute($attributeCode); $assertionMap[] = [ - 'response_field' => $this->eavAttributesToGrahQlSchemaFieldTranslator($attributeCode), + 'response_field' => $this->eavAttributesToGraphQlSchemaFieldTranslator($attributeCode), 'expected_value' => $expectedAttribute ? $expectedAttribute->getValue() : null ]; } @@ -677,7 +677,7 @@ private function assertEavAttributes($product, $actualResponse) * @param string $eavAttributeCode * @return string */ - private function eavAttributesToGrahQlSchemaFieldTranslator(string $eavAttributeCode) + private function eavAttributesToGraphQlSchemaFieldTranslator(string $eavAttributeCode) { switch ($eavAttributeCode) { case 'news_from_date': From 7af19b65cc4081b3ecc141a392b7d8ed2f41cdce Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:08:34 +0200 Subject: [PATCH 061/277] Fix typos in DocBlocks --- .../lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php | 2 +- .../lib/Magento/Mtf/Client/Element/SwitcherElement.php | 2 +- .../Bundle/Test/TestCase/CancelPartiallyInvoicedOrderTest.php | 2 +- .../Block/Adminhtml/Product/Edit/Section/Attributes/Search.php | 2 +- .../Test/Constraint/AssertProductAttributeIsHtmlAllowed.php | 2 +- .../app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php | 2 +- .../Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php | 2 +- .../TestCase/Product/ReSavingProductAfterInitialSaveTest.php | 2 +- .../Constraint/AssertBillingAddressSameAsShippingCheckbox.php | 2 +- .../Checkout/Test/TestStep/RemoveProductsFromTheCartStep.php | 2 +- .../Test/TestCase/VerifyAdminAccountSharingEntityTest.php | 2 +- .../Test/Constraint/AssertProductTierPriceOnProductPage.php | 2 +- .../app/Magento/Customer/Test/Fixture/Customer/WebsiteId.php | 2 +- .../Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php | 2 +- .../Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php | 2 +- .../Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php | 2 +- .../app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php | 2 +- .../Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php | 2 +- .../Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php | 2 +- .../Shipping/Test/TestStep/FillShippingAddressesStep.php | 2 +- .../tests/app/Magento/Theme/Test/Block/Html/Footer.php | 2 +- .../tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 2 +- .../tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php | 2 +- .../app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php | 2 +- .../Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php | 2 +- .../Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php index c9f37e9c18945..3aa7010377fb4 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SimplifiedselectElement.php @@ -21,7 +21,7 @@ class SimplifiedselectElement extends SelectElement protected $optionGroupValue = ".//*[@data-title='%s' or contains(normalize-space(.), %s)]"; /** - * Select value in ropdown which has option groups. + * Select value in dropdown which has option groups. * * @param string $value * @return void diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php index 6dce3d12a1fbe..36a203bb057e1 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SwitcherElement.php @@ -22,7 +22,7 @@ class SwitcherElement extends SimpleElement protected $parentContainer = 'parent::div[@data-role="switcher"]'; /** - * XPath selector for label text on swticher element. + * XPath selector for label text on switcher element. * * @var string */ diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CancelPartiallyInvoicedOrderTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CancelPartiallyInvoicedOrderTest.php index 71d9b11d12eb1..00c53c5e837d2 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CancelPartiallyInvoicedOrderTest.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CancelPartiallyInvoicedOrderTest.php @@ -20,7 +20,7 @@ * 3. Open the created order. * 4. Create partial invoice * 4. Do cancel Order. - * 5. Perform all assetions. + * 5. Perform all assertions. * * @group Order_Management * @ZephyrId MAGETWO-67787 diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php index d17b06456c831..7b5bcf8060e2d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Attributes/Search.php @@ -37,7 +37,7 @@ class Search extends SuggestElement protected $actionToggle = '.action-toggle'; /** - * Saerch result dropdown. + * Search result dropdown. * * @var string */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php index f1999498b96df..47a4ab7be3313 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsHtmlAllowed.php @@ -23,7 +23,7 @@ class AssertProductAttributeIsHtmlAllowed extends AbstractConstraint /** * Check whether html tags are using in attribute value. - * Checked tag structure <b><i>atttribute_default_value</p></i></b> + * Checked tag structure <b><i>attribute_default_value</p></i></b> * * @param InjectableFixture $product * @param CatalogProductAttribute $attribute diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php index 2bd71dbf4f8a6..57fe2bb59154f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/WebsiteIds.php @@ -37,7 +37,7 @@ class WebsiteIds extends DataSource private $fixtureFactory; /** - * Rought fixture field data. + * Rough fixture field data. * * @var array */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php index 001e815ce2d2b..11805a00d03cc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php @@ -345,7 +345,7 @@ protected function preparePrice() } /** - * Preparation wheather product 'Is Virtual'. + * Preparation weather product 'Is Virtual'. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ReSavingProductAfterInitialSaveTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ReSavingProductAfterInitialSaveTest.php index 5ca7f06effc24..ba9714672cfbb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ReSavingProductAfterInitialSaveTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ReSavingProductAfterInitialSaveTest.php @@ -19,7 +19,7 @@ * * 1. Login to backend. * 2. Create a product with invalid from and To dates - * 3. Save the product which generates an error messsage + * 3. Save the product which generates an error message * 4. Modify the dates to valid values * 5. Save the product again * 6. Product is saved successfully diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php index 3e889c058ee84..9a042ab13f048 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressSameAsShippingCheckbox.php @@ -37,7 +37,7 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $billingCheckbox } /** - * Returns a string representation of successfull assertion. + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/RemoveProductsFromTheCartStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/RemoveProductsFromTheCartStep.php index b4ea9ba26b0c2..6e1042eed5d83 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/RemoveProductsFromTheCartStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/RemoveProductsFromTheCartStep.php @@ -30,7 +30,7 @@ class RemoveProductsFromTheCartStep implements TestStepInterface private $cartPage; /** - * Quantity of items that should be removed from shoping cart. + * Quantity of items that should be removed from shopping cart. * * @var int|null */ diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php index 36b544dc8b2d8..3191d975826f0 100644 --- a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php @@ -13,7 +13,7 @@ * Steps: * 1. Log in to Admin. * 2. Go to Stores>Configuration>Advanced>admin>Security. - * 3. * 7. Verify admin Acoount Sharing option availability. + * 3. * 7. Verify admin Account Sharing option availability. * * @group Config_(PS) * @ZephyrId MAGETWO-47822 diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php index 3845cdfd2d89f..01ff832cd7db3 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductTierPriceOnProductPage.php @@ -10,7 +10,7 @@ use Magento\ConfigurableProduct\Test\Block\Product\View\ConfigurableOptions; /** - * Open created configurble product on frontend and choose variation with tier price + * Open created configurable product on frontend and choose variation with tier price */ class AssertProductTierPriceOnProductPage extends AssertProductPage { diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer/WebsiteId.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer/WebsiteId.php index 72d7fdc63bc72..3e5ab87e0ed39 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer/WebsiteId.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer/WebsiteId.php @@ -38,7 +38,7 @@ class WebsiteId extends DataSource private $fixtureFactory; /** - * Rought fixture field data. + * Rough fixture field data. * * @var array */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php index 2eb82c04d1f81..2d2392f3328fe 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/AbstractApplyVatIdTest.php @@ -76,7 +76,7 @@ public function __prepare(FixtureFactory $fixtureFactory) } /** - * Prepare VAT ID confguration. + * Prepare VAT ID configuration. * * @param ConfigData $vatConfig * @param string $customerGroup diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php index 03779bd0ec674..a8c81ea14ba46 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ReAuthorizeTokensIntegrationEntityTest.php @@ -51,7 +51,7 @@ class ReAuthorizeTokensIntegrationEntityTest extends Injectable * * @param FixtureFactory $fixtureFactory * @param IntegrationIndex $integrationIndex - * @retun void + * @return void */ public function __inject(IntegrationIndex $integrationIndex, FixtureFactory $fixtureFactory) { diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php index 1dbe1dd94685a..0f748aa0a8c54 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php @@ -36,7 +36,7 @@ abstract class Sidebar extends Block protected $addToOrderProductName = './/tr/td[.="%s"]'; /** - * Add productz to order. + * Add products to order. * * @param array $products * @return void diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php index fa14fcdc34b96..20fe0c8f55ccb 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php @@ -23,7 +23,7 @@ * 2. Sales > Orders. * 3. Open the created order. * 4. Do cancel Order. - * 5. Perform all assetions. + * 5. Perform all assertions. * * @group Order_Management * @ZephyrId MAGETWO-28191 diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php index 0a15196d65ae2..6f8c8cf1e53bb 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php @@ -30,7 +30,7 @@ class CreateCustomOrderStatusEntityTest extends Injectable /* end tags */ /** - * Order staus page. + * Order status page. * * @var OrderStatusIndex */ diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php index 472218205cb4f..381de91030a61 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php @@ -10,7 +10,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Assert sales rule delte message. + * Assert sales rule delete message. */ class AssertCartPriceRuleSuccessDeleteMessage extends AbstractConstraint { diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestStep/FillShippingAddressesStep.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestStep/FillShippingAddressesStep.php index 681b2746a4c34..abc560075d576 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestStep/FillShippingAddressesStep.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestStep/FillShippingAddressesStep.php @@ -13,7 +13,7 @@ use Magento\Shipping\Test\Constraint\AssertCityBasedShippingRateChanged; /** - * Fill shipping addresses and assert rates relouding. + * Fill shipping addresses and assert rates reloading. */ class FillShippingAddressesStep implements TestStepInterface { diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php index 0bcf20b38801e..30842af0b020d 100644 --- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Footer.php @@ -120,7 +120,7 @@ public function selectStoreGroup(Store $store) } /** - * Check if correspondent "Store" is present in "Store" swither or not. + * Check if correspondent "Store" is present in "Store" switcher or not. * * @param Store $store * @return bool diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 15145c36afe0d..235b0d096533f 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -332,7 +332,7 @@ public function selectMassAction($massActionSelection) } /** - * Peform action using the dropdown above the grid. + * Perform action using the dropdown above the grid. * * @param array|string $action [array -> key = value from first select; value => value from subselect] * @return void diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php index a9c8e87f1dc97..5c27776c09620 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php @@ -150,7 +150,7 @@ public function setAlertText($text) } /** - * Wait until modal window will disapper. + * Wait until modal window will disappear. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php index 57a170b924fe7..a54907aa49ec7 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php @@ -19,7 +19,7 @@ * Steps: * 1. Navigate to backend. * 2. Go to grid page - * 3. Perfrom full text search + * 3. Perform full text search * 5. Perform Asserts * * @group Ui diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php index 114709becde6f..988229d308250 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php @@ -39,7 +39,7 @@ protected function prepareData(FixtureInterface $fixture) * * @param array $data * @param SimpleElement $context - * @retun void + * @return void */ protected function fillFields(array $data, SimpleElement $context) { diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php index 411c15732f2ee..636af4e8032db 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php @@ -12,7 +12,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Check that created widget displayed on frontent on Home page and on Advanced Search and + * Check that created widget displayed on frontend on Home page and on Advanced Search and * after click on widget link on frontend system redirects you to cms page. */ class AssertWidgetCmsPageLink extends AbstractConstraint From 1a16de17a5515220f2aaa9ebe088b4f2efa6a48e Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:12:38 +0200 Subject: [PATCH 062/277] Fix typo in variable name --- .../Test/Constraint/AssertCityBasedShippingRateChanged.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php index a449f79ef68f3..482b7d213e671 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php @@ -30,11 +30,11 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $shippingMethod, 'Shipping rate has not been changed.' ); } - $shippingAvaialability = $isShippingAvailable ? 'avaiable' : 'unavailable'; + $shippingAvailability = $isShippingAvailable ? 'avaiable' : 'unavailable'; \PHPUnit_Framework_Assert::assertEquals( $isShippingAvailable, $checkoutOnepage->getShippingMethodBlock()->isShippingMethodAvaiable($shippingMethod), - "Shipping rates for {$shippingMethod['shipping_service']} should be $shippingAvaialability." + "Shipping rates for {$shippingMethod['shipping_service']} should be $shippingAvailability." ); } From af9dc759fcee60569ffef5a8c0026c276154c1ad Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:22:55 +0200 Subject: [PATCH 063/277] Fix typo in test's name --- ...sertConfigurableWithDisabledOptionCatalogSearchNoResult.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/{AssertConfigurableWithDisabledOtpionCatalogSearchNoResult.php => AssertConfigurableWithDisabledOptionCatalogSearchNoResult.php} (97%) diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOtpionCatalogSearchNoResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOptionCatalogSearchNoResult.php similarity index 97% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOtpionCatalogSearchNoResult.php rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOptionCatalogSearchNoResult.php index 6bb947941909e..a7538508caa76 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOtpionCatalogSearchNoResult.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertConfigurableWithDisabledOptionCatalogSearchNoResult.php @@ -19,7 +19,7 @@ /** * Assert search has no results after disabling configurable children. */ -class AssertConfigurableWithDisabledOtpionCatalogSearchNoResult extends AbstractConstraint +class AssertConfigurableWithDisabledOptionCatalogSearchNoResult extends AbstractConstraint { /** * Assert search has no results and product list in absent after disabling configurable children. From 3765f05c907ba1cffd5cf7a51d7c7e6147a91165 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:25:02 +0200 Subject: [PATCH 064/277] Fix casing in variable name --- .../TestCase/LockAdminUserWhenEditingIntegrationTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php index 5f803d634fa2a..d1e9c9dee9ec2 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php @@ -84,7 +84,7 @@ public function __inject( /** * Run Lock user when creating new integration test. * - * @param Integration $initintegration + * @param Integration $initIntegration * @param Integration $integration * @param int $attempts * @param User $customAdmin @@ -92,7 +92,7 @@ public function __inject( * @return void */ public function test( - Integration $initintegration, + Integration $initIntegration, Integration $integration, $attempts, User $customAdmin, @@ -106,7 +106,7 @@ public function test( ['configData' => $this->configData] )->run(); $customAdmin->persist(); - $initintegration->persist(); + $initIntegration->persist(); // login to backend with new user $this->adminAuthLogin->open(); @@ -114,7 +114,7 @@ public function test( $this->adminAuthLogin->getLoginBlock()->submit(); // Steps - $filter = ['name' => $initintegration->getName()]; + $filter = ['name' => $initIntegration->getName()]; $this->integrationIndexPage->open(); $this->integrationIndexPage->getIntegrationGrid()->searchAndOpen($filter); for ($i = 0; $i < $attempts; $i++) { From a41a69367117f5c5da25ef93569f62d8f501567f Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:28:12 +0200 Subject: [PATCH 065/277] Fix typo in test method's name --- .../app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php | 2 +- .../Test/Constraint/AssertCityBasedShippingRateChanged.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php index 3a66629116de9..f5024d3eb7b26 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php @@ -91,7 +91,7 @@ public function selectShippingMethod(array $method) * @param array $method * @return bool */ - public function isShippingMethodAvaiable(array $method) + public function isShippingMethodAvailable(array $method) { $this->waitForShippingRates(); $selector = sprintf($this->shippingMethod, $method['shipping_method'], $method['shipping_service']); diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php index 482b7d213e671..75e6ccf90e529 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php @@ -33,7 +33,7 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $shippingMethod, $shippingAvailability = $isShippingAvailable ? 'avaiable' : 'unavailable'; \PHPUnit_Framework_Assert::assertEquals( $isShippingAvailable, - $checkoutOnepage->getShippingMethodBlock()->isShippingMethodAvaiable($shippingMethod), + $checkoutOnepage->getShippingMethodBlock()->isShippingMethodAvailable($shippingMethod), "Shipping rates for {$shippingMethod['shipping_service']} should be $shippingAvailability." ); } From a144cb6792f419d52480359bec3eedb6816a4413 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:28:36 +0200 Subject: [PATCH 066/277] Fix typo in test result --- .../Test/Constraint/AssertCityBasedShippingRateChanged.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php index 75e6ccf90e529..ea5de8d06be00 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertCityBasedShippingRateChanged.php @@ -30,7 +30,7 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $shippingMethod, 'Shipping rate has not been changed.' ); } - $shippingAvailability = $isShippingAvailable ? 'avaiable' : 'unavailable'; + $shippingAvailability = $isShippingAvailable ? 'available' : 'unavailable'; \PHPUnit_Framework_Assert::assertEquals( $isShippingAvailable, $checkoutOnepage->getShippingMethodBlock()->isShippingMethodAvailable($shippingMethod), From 5b7f939b5abb73f06031fc607febad693f2c123f Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 12:56:47 +0200 Subject: [PATCH 067/277] Fix typos in comments --- .../framework/Magento/TestFramework/Db/AbstractDb.php | 2 +- .../framework/Magento/TestFramework/Db/Mysql.php | 2 +- .../Magento/TestFramework/TestCase/AbstractConfigFiles.php | 2 +- .../testsuite/Magento/Catalog/Model/Product/TypeTest.php | 6 +++--- .../_files/product_export_with_product_links_data.php | 2 +- .../Magento/CatalogWidget/Block/Product/ProductListTest.php | 2 +- .../Magento/Customer/Model/CustomerMetadataTest.php | 2 +- .../Magento/Framework/Data/Form/Element/FieldsetTest.php | 2 +- .../Integration/Model/ResourceModel/Oauth/TokenTest.php | 2 +- .../Magento/Search/Model/SearchEngine/ConfigTest.php | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php b/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php index 949d17ffb5f66..a15bdec6157a3 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/AbstractDb.php @@ -84,7 +84,7 @@ abstract public function cleanup(); abstract protected function getSetupDbDumpFilename(); /** - * Is dump esxists + * Is dump exists * * @return bool */ diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php index 69f7f2b2ed8db..6900f89a55f9d 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php @@ -87,7 +87,7 @@ protected function getSetupDbDumpFilename() } /** - * Is dump esxists + * Is dump exists * * @return bool */ diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php index 913c710370816..92ac7ddd468ab 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php @@ -47,7 +47,7 @@ public function setUp() \Magento\Framework\App\Arguments\FileResolver\Primary::class )->disableOriginalConstructor()->getMock(); - /* Enable Validation regardles of MAGE_MODE */ + /* Enable Validation regardless of MAGE_MODE */ $validateStateMock = $this->getMockBuilder( \Magento\Framework\Config\ValidationStateInterface::class )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php index 7fe5fbc6303ad..dadee3d9b6fac 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php @@ -20,7 +20,7 @@ protected function setUp() } /** - * @param sring|null $typeId + * @param string|null $typeId * @param string $expectedClass * @dataProvider factoryDataProvider */ @@ -52,7 +52,7 @@ public function factoryDataProvider() } /** - * @param sring|null $typeId + * @param string|null $typeId * @dataProvider factoryReturnsSingletonDataProvider */ public function testFactoryReturnsSingleton($typeId) @@ -82,7 +82,7 @@ public function factoryReturnsSingletonDataProvider() } /** - * @param sring|null $typeId + * @param string|null $typeId * @param string $expectedClass * @dataProvider priceFactoryDataProvider */ diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php index d9482c40338a3..2f1f0a0b14f54 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php @@ -7,7 +7,7 @@ require dirname(dirname(__DIR__)) . '/Catalog/_files/category.php'; /** Create fixture store */ require dirname(dirname(__DIR__)) . '/Store/_files/second_store.php'; -/** Create product with mulselect attribute */ +/** Create product with multiselect attribute */ require dirname(dirname(__DIR__)) . '/Catalog/_files/products_with_multiselect_attribute.php'; $productModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php index 6892f7b3a8a88..3a64a134d5f95 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php @@ -68,7 +68,7 @@ public function testCreateCollection() . '`value`:[`' . implode(',', $multiselectAttributeOptionIds) . '`]^]^]'; $this->block->setData('conditions_encoded', $encodedConditions); - // Load products collection filtered using specified conditions and perform assesrions + // Load products collection filtered using specified conditions and perform assertions $productCollection = $this->block->createCollection(); $productCollection->load(); $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php index d88c0934e3f69..eb62eb886fd5d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php @@ -159,7 +159,7 @@ public function testGetCustomAttributesMetadataWithCustomAttributes() ); // Verify the consistency of custom attribute metadata from two services - // after getAttrbiuteCode was called + // after getAttributeCode was called foreach ($customAttributesMetadata2 as $attribute) { $attribute->getAttributeCode(); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php index 444e18927f9ee..9453b07f41fc8 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/FieldsetTest.php @@ -246,7 +246,7 @@ public function getSubFieldsetDataProvider() $fieldsetField = $textField; $fieldsetField[1] = 'fieldset'; $advancedFieldsetFld = $fieldsetField; - // set isAdvenced flag + // set isAdvanced flag $advancedFieldsetFld[4] = true; $result = [[[$fieldsetField, $textField, $advancedFieldsetFld], 1]]; return $result; diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php index ef93099556dd9..57fac92aaabd7 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/ResourceModel/Oauth/TokenTest.php @@ -252,7 +252,7 @@ public function deleteExpiredTokensDataProvider() } /** - * Make that only exired tokens were cleaned up + * Make that only expired tokens were cleaned up * * @param array $expectedRemovedTokenNumbers * @param array $expectedPreservedTokenNumbers diff --git a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php index 49d73e71672d4..74926abb52d41 100644 --- a/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Search/Model/SearchEngine/ConfigTest.php @@ -17,7 +17,7 @@ protected function setUp() $xmlPath = __DIR__ . '/../../_files/search_engine.xml'; $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - // Clear out the clache + // Clear out the cache $cacheManager = $objectManager->create(\Magento\Framework\App\Cache\Manager::class); /** @var \Magento\Framework\App\Cache\Manager $cacheManager */ $cacheManager->clean($cacheManager->getAvailableTypes()); From e5366c57c1625babd86390186a0ea9257f111174 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 13:03:04 +0200 Subject: [PATCH 068/277] Fix typos in variable names --- .../_files/notifications.php | 28 +++++++++---------- .../Catalog/Model/Product/ImageTest.php | 6 ++-- ..._configurable_with_category_and_weight.php | 4 +-- .../Framework/Mview/View/ChangelogTest.php | 4 +-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php b/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php index 4bb05645ed105..6615c24320b21 100644 --- a/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php +++ b/dev/tests/integration/testsuite/Magento/AdminNotification/_files/notifications.php @@ -4,34 +4,34 @@ * See COPYING.txt for license details. */ $om = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity( +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity( \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setTitle( 'Unread Critical 1' )->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR) +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR) ->setTitle('Unread Major 1') ->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity( +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity( \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setTitle( 'Unread Critical 2' )->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity( +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity( \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setTitle( 'Unread Critical 3' )->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity( +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity( \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setTitle( 'Read Critical 1' @@ -39,13 +39,13 @@ 1 )->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR) +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity(\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR) ->setTitle('Unread Major 2') ->save(); -$mesasge = $om->create(\Magento\AdminNotification\Model\Inbox::class); -$mesasge->setSeverity( +$message = $om->create(\Magento\AdminNotification\Model\Inbox::class); +$message->setSeverity( \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL )->setTitle( 'Removed Critical 1' diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php index eb32fb98ce8fe..37fee97161b2d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php @@ -21,8 +21,8 @@ public function testSetBaseFilePlaceholder() $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\Product\Image::class ); - /** @var \Magento\Catalog\Model\View\Asset\Placeholder $defualtPlaceholder */ - $defualtPlaceholder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + /** @var \Magento\Catalog\Model\View\Asset\Placeholder $defaultPlaceholder */ + $defaultPlaceholder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create( \Magento\Catalog\Model\View\Asset\Placeholder::class, ['type' => 'image'] @@ -30,7 +30,7 @@ public function testSetBaseFilePlaceholder() $model->setDestinationSubdir('image'); $model->setBaseFile(''); - $this->assertEquals($defualtPlaceholder->getSourceFile(), $model->getBaseFile()); + $this->assertEquals($defaultPlaceholder->getSourceFile(), $model->getBaseFile()); return $model; } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_category_and_weight.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_category_and_weight.php index 519841ddb61e4..b8449a829a227 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_category_and_weight.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_category_and_weight.php @@ -55,8 +55,8 @@ $eavAttributeValues = [ 'category_ids' => [2] ]; - foreach ($eavAttributeValues as $eavCategoryAttributeCode => $eavCategoryAtttributeValues) { - $product->setCustomAttribute($eavCategoryAttributeCode, $eavCategoryAtttributeValues); + foreach ($eavAttributeValues as $eavCategoryAttributeCode => $eavCategoryAttributeValues) { + $product->setCustomAttribute($eavCategoryAttributeCode, $eavCategoryAttributeValues); } $product = $productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php index b26a1cda2476d..c047bd4fffd3d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Mview/View/ChangelogTest.php @@ -126,14 +126,14 @@ public function testGetList() $this->assertEquals(0, $this->model->getVersion()); //the same that a table is empty $changelogName = $this->resource->getTableName($this->model->getName()); - $testChengelogData = [ + $testChangelogData = [ ['version_id' => 1, 'entity_id' => 1], ['version_id' => 2, 'entity_id' => 1], ['version_id' => 3, 'entity_id' => 2], ['version_id' => 4, 'entity_id' => 3], ['version_id' => 5, 'entity_id' => 1], ]; - foreach ($testChengelogData as $data) { + foreach ($testChangelogData as $data) { $this->connection->insert($changelogName, $data); } $this->assertEquals(5, $this->model->getVersion()); From 25827ba9fe26bb93c8251bda5adf7bd68338de58 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 13:07:46 +0200 Subject: [PATCH 069/277] Fix typo in comment --- .../static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php b/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php index c696881588567..1b4fb53c45010 100644 --- a/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php +++ b/dev/tests/static/framework/Magento/Sniffs/Less/ZeroUnitsSniff.php @@ -25,7 +25,7 @@ class ZeroUnitsSniff implements Sniff const CSS_PROPERTY_UNIT_REM = 'rem'; /** - * List of available CSS Propery units + * List of available CSS Property units * * @var array */ From c8ad439cc8f286ac7bb1c4548b019387f5b3a80f Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 13:08:41 +0200 Subject: [PATCH 070/277] Fix typo in property name --- .../Test/Integrity/Magento/Backend/ControllerAclTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php index 620b6ad21bf75..505d3e5c3270b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php @@ -31,7 +31,7 @@ class ControllerAclTest extends \PHPUnit\Framework\TestCase * * @var array */ - private $whiteListetBackendControllers = []; + private $whiteListedBackendControllers = []; /** * List of ACL resources collected from acl.xml files. @@ -57,7 +57,7 @@ protected function setUp() if (substr($item, 0, 1) === '#') { continue; } - $this->whiteListetBackendControllers[$item] = 1; + $this->whiteListedBackendControllers[$item] = 1; } } @@ -83,7 +83,7 @@ public function testAcl() $controllerClass = $this->getClassByFilePath($controllerPath); // skip whitelisted controllers. - if (isset($this->whiteListetBackendControllers[$controllerClass->getName()])) { + if (isset($this->whiteListedBackendControllers[$controllerClass->getName()])) { continue; } // we don't have to check abstract classes. From dc67156387b9e19017d1ac29db55ca6d4b27d859 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 21:16:54 +0200 Subject: [PATCH 071/277] Fix typo in database column comment --- app/code/Magento/Catalog/Setup/InstallSchema.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index a96f58ecc046a..db5359a11d15b 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -674,7 +674,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attriute Set ID' + 'Attribute Set ID' ) ->addColumn( 'parent_id', From c8bbc7ab616482fdbac26f31d2b461af7dcea6fd Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 21:49:31 +0200 Subject: [PATCH 072/277] Refactor getFrontName --- lib/internal/Magento/Framework/View/Context.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Context.php b/lib/internal/Magento/Framework/View/Context.php index 0c3932ffe4bd7..c3f1c3e691c84 100644 --- a/lib/internal/Magento/Framework/View/Context.php +++ b/lib/internal/Magento/Framework/View/Context.php @@ -332,15 +332,11 @@ public function getModuleName() } /** - * Retrieve the module name - * - * @return string - * - * @todo alias of getModuleName + * @see getModuleName */ public function getFrontName() { - return $this->getRequest()->getModuleName(); + return $this->getModuleName(); } /** From 8c03f9f8f80d5b414f38df5616f324d41172d089 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Sun, 21 Jan 2018 23:17:23 +0200 Subject: [PATCH 073/277] Remove redundant code --- app/code/Magento/AdminNotification/Model/Feed.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 1766425fb19b1..d3b0b8501c864 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -214,9 +214,6 @@ public function getFeedData() ); $curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0'); $data = $curl->read(); - if ($data === false) { - return false; - } $data = preg_split('/^\r?$/m', $data, 2); $data = trim($data[1]); $curl->close(); From efccf1b31193e2a753d2bbd4d2d8dbc92e5ff7ca Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Mon, 22 Jan 2018 10:58:58 -0600 Subject: [PATCH 074/277] MAGETWO-86932: Refactor MFTF Tests Remove skip group for all of our tests --- .../Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml | 1 - .../FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml | 1 - .../FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml | 2 +- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 1 - .../Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml | 1 - .../Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 1 - ...inAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml | 1 - .../FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 1 - .../Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 1 - .../Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml | 1 - 10 files changed, 1 insertion(+), 10 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml index 3868909a24b4b..b888881ab02d8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml @@ -16,7 +16,6 @@ <description value="Admin should be able to add image to WYSIWYG Editor on Product Page"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84375"/> - <group value="skip"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index c7683d847eda3..320de3bcf4f36 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -16,7 +16,6 @@ <description value="You should be able to add image to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84376"/> - <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml index 0fee3bc8686ec..a9bd1771aeaa5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml @@ -15,7 +15,7 @@ <title value="You should be able to add image to WYSIWYG Editor CMS"/> <description value="You should be able to add image to WYSIWYG Editor CMS"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-85825 "/> + <testCaseId value="MAGETWO-85825"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 77ac3ed328935..6e6971a6151f9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -15,7 +15,6 @@ <title value="You should be able to add variable to WYSIWYG Editor of Block"/> <description value="You should be able to add variable to WYSIWYG Editor Block"/> <testCaseId value="MAGETWO-84378"/> - <group value="skip"/> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index 6867fa376a632..435e1f6edbe15 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -16,7 +16,6 @@ <description value="Insert default Magento variable into content of WYSIWYG on Pages"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83504"/> - <group value="skip" /> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 998649c7c78c3..38c410af0b083 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -16,7 +16,6 @@ <description value="You should be able to add widget to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84654"/> - <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 7dedac0e843be..411b9cb64e308 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -17,7 +17,6 @@ <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83792"/> - <group value="skip" /> </annotations> <!--Main test--> <before> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index 11cec94b91b54..76e79e06bf435 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -17,7 +17,6 @@ <description value="Admin are able to switch between versions of TinyMCE."/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-82936"/> - <group value="skip" /> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 15c0b8c8e6639..88a20c6fb4aae 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -17,7 +17,6 @@ <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84184 "/> - <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml index 2c9c0066a6622..3df8c9529b6e5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml @@ -15,7 +15,6 @@ <title value="You should be able to add variable to WYSIWYG Editor of Newsletter"/> <description value="You should be able to add variable to WYSIWYG Editor Newsletter"/> <testCaseId value="MAGETWO-84379"/> - <group value="skip"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> From 1c78e30ef75b76ee06d1f63e38917d596be4d5d9 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Mon, 22 Jan 2018 14:18:21 -0600 Subject: [PATCH 075/277] MAGETWO-86932: Refactor MFTF Tests Fix filename --- ...roducCest.xml => VerifyDefaultWYSIWYGToolbarOnProductCest.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/{VerifyDefaultWYSIWYGToolbarOnProducCest.xml => VerifyDefaultWYSIWYGToolbarOnProductCest.xml} (100%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml From 754a4b9d340db184fc23ef18de24523c623949e6 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Mon, 22 Jan 2018 14:51:35 -0600 Subject: [PATCH 076/277] MAGETWO-85423: Create or update functional tests - Apply Cart Rule for product --- .../acceptance/tests/_suite/sampleSuite.xml | 20 +++++++++++++++++++ .../StorefrontProductActionSection.xml | 13 ++++++++++++ .../SalesRule/Section/DiscountSection.xml | 14 +++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml diff --git a/dev/tests/acceptance/tests/_suite/sampleSuite.xml b/dev/tests/acceptance/tests/_suite/sampleSuite.xml index d42f6d00132b9..c3a3e93b7d8f1 100644 --- a/dev/tests/acceptance/tests/_suite/sampleSuite.xml +++ b/dev/tests/acceptance/tests/_suite/sampleSuite.xml @@ -6,6 +6,26 @@ */ --> <suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Suite/etc/suiteSchema.xsd"> + <suite name="mySuite"> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createProduct"> + <required-entity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData stepKey="deleteMyProduct" createDataKey="createProduct"/> + <deleteData stepKey="deleteMyCategory" createDataKey="createCategory"/> + </after> + <include> + <group name="example"/> + <cest test="PersistMultipleEntitiesTest" name="PersistMultipleEntitiesCest"/> + <module name="SampleTests" file="SampleCest.xml"/> + </include> + <exclude> + <group name="testGroup"/> + </exclude> + </suite> <suite name="Catalog"> <include> <module name="Catalog" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml new file mode 100644 index 0000000000000..a3b3a4c1453cc --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="StorefrontProductActionSection"> + <element name="addToCart" type="button" selector="#product-addtocart-button"/> + </section> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml new file mode 100644 index 0000000000000..c4a745412f954 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="DiscountSection"> + <element name="CouponInput" type="input" selector="#coupon_code"/> + <element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/> + </section> +</config> From 87a7192f68b692b94b83a6eb4562db6c2c33f4d0 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Mon, 22 Jan 2018 18:54:59 -0600 Subject: [PATCH 077/277] MAGETWO-85423: Create or update functional tests - Added ActionGroup for applying cart rule on Shopping Cart --- .../Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml index c4a745412f954..4a8770f72686e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="DiscountSection"> + <element name="DiscountTab" type="button" selector="//strong[text()='Apply Discount Code']"/> <element name="CouponInput" type="input" selector="#coupon_code"/> <element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/> </section> From 5df0b5654c63869fe123a86807c425fde77a8d15 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Tue, 23 Jan 2018 08:55:19 -0600 Subject: [PATCH 078/277] MAGETWO-85423: Create or update functional tests - add coupon to sales rule data --- .../SalesRule/Data/SalesRuleCouponData.xml | 15 +++++++++++ .../SalesRule/Data/SalesRuleData.xml | 6 ++--- .../Metadata/sales_rule_coupon-meta.xml | 27 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml new file mode 100644 index 0000000000000..109e1974d6cfc --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="SimpleSalesRuleCoupon" type="SalesRuleCoupon"> + <var key="rule_id" entityKey="rule_id" entityType="SalesRule"/> + <data key="code" unique="suffix">Code</data> + <data key="is_primary">1</data> + </entity> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml index 98d27e4bb0fbd..eb84c66bd2b1c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml @@ -10,12 +10,12 @@ <entity name="SimpleSalesRule" type="SalesRule"> <data key="name" unique="suffix">SimpleSalesRule</data> <data key="is_active">true</data> - <data key="coupon_type">No Coupon</data> + <data key="coupon_type">SPECIFIC_COUPON</data> <array key="customer_group_ids"> - <item>1</item> + <item>0</item> </array> <array key="website_ids"> - <item>0</item> + <item>1</item> </array> </entity> </config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml new file mode 100644 index 0000000000000..55e05c92eb4b1 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> + <operation name="CreateSalesRuleCoupon" dataType="SalesRuleCoupon" type="create" auth="adminOauth" url="/V1/coupons" method="POST"> + <contentType>application/json</contentType> + <object key="coupon" dataType="SalesRuleCoupon"> + <field key="rule_id" required="true">integer</field> + <field key="code">string</field> + <field key="usage_limit">integer</field> + <field key="usage_per_customer">integer</field> + <field key="times_used">integer</field> + <field key="expiration_date">string</field> + <field key="is_primary">boolean</field> + <field key="created_at">string</field> + <field key="type">integer</field> + </object> + </operation> + <operation name="DeleteSalesRuleCoupon" dataType="SalesRuleCoupon" type="delete" auth="adminOauth" url="/V1/coupons/{coupon_id}" method="DELETE"> + <contentType>application/json</contentType> + </operation> +</config> From cfca4cf9001b87816d0980223696093a4690ca20 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 09:52:46 -0600 Subject: [PATCH 079/277] MAGETWO-86932: Refactor MFTF Tests Remove comment --- .../FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 38c410af0b083..24b25d3a3ef3a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -73,7 +73,6 @@ <waitForPageLoad stepKey="waitForPageLoad7" /> <see userInput="Home page" stepKey="seeHomePageCMSPage"/> <after> - <!--<deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage" />--> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> From 16d8bfc790c8bd3256a898fb80cfc50b198351c0 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <cspruiell@magento.com> Date: Tue, 23 Jan 2018 10:45:59 -0600 Subject: [PATCH 080/277] MAGETWO-85423: Create or update functional tests - add action groups to create user and user role --- .../AdminCreateUserActionGroup.xml | 32 +++++++++++++++ .../AdminCreateUserRoleActionGroup.xml | 24 ++++++++++++ .../User/Cest/AdminCreateUserCest.xml | 39 +++++++++++++++++++ .../User/Cest/AdminCreateUserRoleCest.xml | 36 +++++++++++++++++ .../FunctionalTest/User/Data/UserData.xml | 3 ++ .../FunctionalTest/User/Data/UserRoleData.xml | 16 ++++++++ .../User/Page/AdminEditRolePage.xml | 13 +++++++ .../User/Page/AdminEditUserPage.xml | 1 + .../User/Page/AdminRolesPage.xml | 12 ++++++ .../User/Section/AdminEditRoleInfoSection.xml | 17 ++++++++ .../Section/AdminEditRoleResourcesSection.xml | 14 +++++++ .../User/Section/AdminEditUserRoleSection.xml | 17 ++++++++ .../User/Section/AdminEditUserSection.xml | 5 +++ .../User/Section/AdminRoleGridSection.xml | 17 ++++++++ 14 files changed, 246 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml new file mode 100644 index 0000000000000..1c76913a619c8 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <actionGroup name="AdminCreateUserActionGroup"> + <arguments> + <argument name="role"/> + </arguments> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user/new" stepKey="navigateToNewUser"/> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{admin.username}}" stepKey="enterUserName" /> + <fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{admin.firstName}}" stepKey="enterFirstName" /> + <fillField selector="{{AdminEditUserSection.lastNameTextField}}" userInput="{{admin.lastName}}" stepKey="enterLastName" /> + <fillField selector="{{AdminEditUserSection.emailTextField}}" userInput="{{admin.username}}@magento.com" stepKey="enterEmail" /> + <fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="{{admin.password}}" stepKey="enterPassword" /> + <fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="{{admin.password}}" stepKey="confirmPassword" /> + <fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" /> + <scrollToTopOfPage stepKey="scrollToTopOfPage" /> + <click selector="{{AdminEditUserSection.userRoleTab}}" stepKey="clickUserRole" /> + <fillField selector="{{AdminEditUserRoleSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole" /> + <click selector="{{AdminEditUserRoleSection.searchButton}}" stepKey="clickSearch" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear1"/> + <click selector="{{AdminEditUserRoleSection.searchResultFirstRow}}" stepKey="selectRole" /> + <click selector="{{AdminEditUserSection.saveButton}}" stepKey="clickSaveUser" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see userInput="You saved the user." stepKey="seeSuccessMessage" /> + </actionGroup> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml new file mode 100644 index 0000000000000..e461aa5de962b --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <actionGroup name="AdminCreateUserRoleActionGroup"> + <arguments> + <argument name="role" /> + </arguments> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user_role/editrole" stepKey="navigateToNewRole"/> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminEditRoleInfoSection.roleName}}" userInput="{{role.name}}" stepKey="fillRoleName" /> + <fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterPassword" /> + <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> + <selectOption selector="{{AdminEditRoleResourcesSection.roleScopes}}" userInput="{{role.scope}}" stepKey="selectScope" /> + <selectOption selector="{{AdminEditRoleResourcesSection.resourceAccess}}" userInput="{{role.access}}" stepKey="selectAccess" /> + <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see userInput="You saved the role." stepKey="seeSuccessMessage" /> + </actionGroup> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml new file mode 100644 index 0000000000000..804d6bb8afa3d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <cest name="AdminCreateUserCest"> + <annotations> + <features value="Create a user in admin"/> + <stories value="Create a user in admin"/> + <env value="chrome"/> + <env value="firefox"/> + <group value="user"/> + </annotations> + <before> + <actionGroup ref="LoginActionGroup" stepKey="login"/> + </before> + <test name="AdminCreateUserWithNewAdminRoleTest"> + <annotations> + <title value="Create a user in admin"/> + <description value="Create a user in admin"/> + </annotations> + <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createNewAdminUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> + <argument name="role" value="adminRole"/> + </actionGroup> + <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToRoleGrid" /> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin.username}}" stepKey="filterByUserName" /> + <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin.username}}" stepKey="seeNewRole" /> + </test> + </cest> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml new file mode 100644 index 0000000000000..144c3d271e75d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <cest name="AdminCreateUserRoleCest"> + <annotations> + <features value="Create a user role in admin"/> + <stories value="Create a user role in admin"/> + <env value="chrome"/> + <env value="firefox"/> + <group value="userRole"/> + </annotations> + <before> + <actionGroup ref="LoginActionGroup" stepKey="login"/> + </before> + <test name="AdminCreateUserRoleTest"> + <annotations> + <title value="Create a user role in admin"/> + <description value="Create a user role in admin"/> + </annotations> + <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToRoleGrid" /> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminRoleGridSection.roleNameFilterTextField}}" userInput="{{adminRole.name}}" stepKey="enterRoleName" /> + <click selector="{{AdminRoleGridSection.searchButton}}" stepKey="clickSearch" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see selector="{{AdminRoleGridSection.roleNameInFirstRow}}" userInput="{{adminRole.name}}" stepKey="seeNewRole" /> + </test> + </cest> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml index a8461be7f49db..9c57d75b6fac0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml @@ -9,6 +9,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="admin" type="user"> + <data key="username" unique="suffix">admin</data> + <data key="firstName">John</data> + <data key="lastName">Smith</data> <data key="email">admin@magento.com</data> <data key="password">admin123</data> </entity> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml new file mode 100644 index 0000000000000..900f948d3f8e0 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="adminRole" type="role"> + <data key="name" unique="suffix">adminRole</data> + <data key="scope">1</data> + <data key="access">1</data> + </entity> +</config> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml new file mode 100644 index 0000000000000..9ad319d1b953d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminEditRolePage" url="/admin/admin/user_role/editrole" module="Magento_User"> + <section name="AdminEditRoleInfoSection"/> + <section name="AdminEditRoleResourcesSection"/> + </page> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditUserPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditUserPage.xml index a3e090c566fe2..e14a3479c0641 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditUserPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditUserPage.xml @@ -8,5 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> <page name="AdminEditUserPage" url="/admin/admin/user/new" module="Magento_User"> <section name="AdminEditUserSection"/> + <section name="AdminEditUserRoleSection"/> </page> </config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml new file mode 100644 index 0000000000000..bde3493347825 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminRolesPage" url="/admin/admin/user_role/" module="Magento_User"> + <section name="AdminRoleGridSection"/> + </page> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml new file mode 100644 index 0000000000000..7a917112f0559 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminEditRoleInfoSection"> + <element name="roleName" type="input" selector="#role_name"/> + <element name="password" type="input" selector="#current_password"/> + <element name="roleResourcesTab" type="button" selector="#role_info_tabs_account"/> + <element name="backButton" type="button" selector="button[title='Back']"/> + <element name="resetButton" type="button" selector="button[title='Reset']"/> + <element name="saveButton" type="button" selector="button[title='Save Role']"/> + </section> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml new file mode 100644 index 0000000000000..0e75aafdce452 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminEditRoleResourcesSection"> + <element name="roleScopes" type="select" selector="#gws_is_all"/> + <element name="resourceAccess" type="select" selector="#all"/> + <element name="resources" type="checkbox" selector="#role_info_tabs_account"/> + </section> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml new file mode 100644 index 0000000000000..7329044114075 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminEditUserRoleSection"> + <element name="usernameTextField" type="input" selector="#user_username"/> + <element name="roleNameFilterTextField" type="input" selector="#permissionsUserRolesGrid_filter_role_name"/> + <element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]"/> + <element name="resetButton" type="button" selector="button[title='Reset Filter']"/> + <element name="roleNameInFirstRow" type="text" selector=".col-role_name"/> + <element name="searchResultFirstRow" type="text" selector=".data-grid>tbody>tr"/> + </section> +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserSection.xml index a99af9f89372b..6cd771aa73823 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserSection.xml @@ -8,6 +8,11 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminEditUserSection"> <element name="usernameTextField" type="input" selector="#user_username"/> + <element name="firstNameTextField" type="input" selector="#user_firstname"/> + <element name="lastNameTextField" type="input" selector="#user_lastname"/> + <element name="emailTextField" type="input" selector="#user_email"/> + <element name="passwordTextField" type="input" selector="#user_password"/> + <element name="pwConfirmationTextField" type="input" selector="#user_confirmation"/> <element name="currentPasswordField" type="input" selector="#user_current_password"/> <element name="userRoleTab" type="button" selector="#page_tabs_roles_section"/> <element name="roleNameFilterTextField" type="input" selector="#permissionsUserRolesGrid_filter_role_name"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml new file mode 100644 index 0000000000000..61af0186f3546 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminRoleGridSection"> + <element name="idFilterTextField" type="input" selector="#roleGrid_filter_role_id"/> + <element name="roleNameFilterTextField" type="input" selector="#roleGrid_filter_role_name"/> + <element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]"/> + <element name="resetButton" type="button" selector="button[title='Reset Filter']"/> + <element name="roleNameInFirstRow" type="text" selector=".col-role_name"/> + <element name="searchResultFirstRow" type="text" selector=".data-grid>tbody>tr"/> + </section> +</config> From 2e33a0bc5ca333e6846fd8e483faa398f85788f4 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:49:29 -0600 Subject: [PATCH 081/277] :arrow_double_up: Forwardport of magento/magento2#11127 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11127.patch (created by @niccifor) based on commit(s): 1. 7d5fc2512cd21bd8e017ad94e4fbd1a04c3257ac --- app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php b/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php index 8c018ecee544b..f600c65e05f52 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/ItemCreation.php @@ -43,6 +43,7 @@ public function getOrderItemId() public function setOrderItemId($orderItemId) { $this->orderItemId = $orderItemId; + return $this; } /** @@ -59,6 +60,7 @@ public function getQty() public function setQty($qty) { $this->qty = $qty; + return $this; } /** From 6ff253472a7f3cf8d262b1bccf76f70f38b01db2 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:49:38 -0600 Subject: [PATCH 082/277] :arrow_double_up: Forwardport of magento/magento2#11138 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11138.patch (created by @jokeputs) based on commit(s): 1. 58d96ae476668625d285d88f77fa9b8f29799a33 --- .../Magento/Store/Model/Address/Renderer.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Store/Model/Address/Renderer.php b/app/code/Magento/Store/Model/Address/Renderer.php index 1f44b9dcec3e3..1d0fdd7284848 100644 --- a/app/code/Magento/Store/Model/Address/Renderer.php +++ b/app/code/Magento/Store/Model/Address/Renderer.php @@ -15,6 +15,12 @@ */ class Renderer { + const DEFAULT_TEMPLATE = "{{var name}}\n" . + "{{var street_line1}}\n" . + "{{depend street_line2}}{{var street_line2}}\n{{/depend}}" . + "{{depend city}}{{var city}},{{/depend}} {{var region}} {{depend postcode}}{{var postcode}},{{/depend}}\n" . + "{{var country}}"; + /** * @var EventManager */ @@ -25,18 +31,26 @@ class Renderer */ protected $filterManager; + /** + * @var string + */ + private $template; + /** * Constructor * * @param EventManager $eventManager * @param FilterManager $filterManager + * @param string $template */ public function __construct( EventManager $eventManager, - FilterManager $filterManager + FilterManager $filterManager, + $template = self::DEFAULT_TEMPLATE ) { $this->eventManager = $eventManager; $this->filterManager = $filterManager; + $this->template = $template; } /** @@ -50,9 +64,7 @@ public function format(DataObject $storeInfo, $type = 'html') { $this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]); $address = $this->filterManager->template( - "{{var name}}\n{{var street_line1}}\n{{depend street_line2}}{{var street_line2}}\n{{/depend}}" . - "{{depend city}}{{var city}},{{/depend}} {{var region}} {{depend postcode}}{{var postcode}},{{/depend}}\n" . - "{{var country}}", + $this->template, ['variables' => $storeInfo->getData()] ); From 2817416f0a46608c3de49ae3d3b118c9818ec70c Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:49:47 -0600 Subject: [PATCH 083/277] :arrow_double_up: Forwardport of magento/magento2#11134 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11134.patch (created by @Zifius) based on commit(s): 1. 70379e3017df257cff1b418fd7c3bbfe123078a8 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10775: 404 Forbidden sounds not right (reported by @irinikp) --- app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php index e8251b5be6030..ce59d2fd48e5a 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php @@ -34,7 +34,7 @@ public function execute() { /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); - $resultPage->setStatusHeader(404, '1.1', 'Forbidden'); + $resultPage->setStatusHeader(404, '1.1', 'Not Found'); $resultPage->setHeader('Status', '404 File not found'); $resultPage->addHandle('adminhtml_noroute'); return $resultPage; From 9701bb7dafc44e5717596607deedb583d25be537 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:49:56 -0600 Subject: [PATCH 084/277] :arrow_double_up: Forwardport of magento/magento2#11246 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11246.patch (created by @crissanclick) based on commit(s): 1. 79f9c8ae294263386b08aaf0b84c293dae64f585 2. 154dd01fc8015ec3493e957f6e9f4584e04c9ff5 3. c17b3ebfd2ac922776def21eca730fd5ac57f353 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11231: Can't close mobile search bar once typed (reported by @BenSpace48) --- .../Search/view/frontend/web/form-mini.js | 80 ++++++++++--------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js index 7b2c7003074cb..e8598f46eb5be 100644 --- a/app/code/Magento/Search/view/frontend/web/form-mini.js +++ b/app/code/Magento/Search/view/frontend/web/form-mini.js @@ -286,46 +286,50 @@ define([ $.getJSON(this.options.url, { q: value }, $.proxy(function (data) { - $.each(data, function (index, element) { - var html; - - element.index = index; - html = template({ - data: element + if (data.length) { + $.each(data, function (index, element) { + var html; + + element.index = index; + html = template({ + data: element + }); + dropdown.append(html); }); - dropdown.append(html); - }); - this.responseList.indexList = this.autoComplete.html(dropdown) - .css(clonePosition) - .show() - .find(this.options.responseFieldElements + ':visible'); - - this._resetResponseList(false); - this.element.removeAttr('aria-activedescendant'); - - if (this.responseList.indexList.length) { - this._updateAriaHasPopup(true); - } else { - this._updateAriaHasPopup(false); - } - this.responseList.indexList - .on('click', function (e) { - this.responseList.selected = $(e.currentTarget); - this.searchForm.trigger('submit'); - }.bind(this)) - .on('mouseenter mouseleave', function (e) { - this.responseList.indexList.removeClass(this.options.selectClass); - $(e.target).addClass(this.options.selectClass); - this.responseList.selected = $(e.target); - this.element.attr('aria-activedescendant', $(e.target).attr('id')); - }.bind(this)) - .on('mouseout', function (e) { - if (!this._getLastElement() && this._getLastElement().hasClass(this.options.selectClass)) { - $(e.target).removeClass(this.options.selectClass); - this._resetResponseList(false); - } - }.bind(this)); + this.responseList.indexList = this.autoComplete.html(dropdown) + .css(clonePosition) + .show() + .find(this.options.responseFieldElements + ':visible'); + + this._resetResponseList(false); + this.element.removeAttr('aria-activedescendant'); + + if (this.responseList.indexList.length) { + this._updateAriaHasPopup(true); + } else { + this._updateAriaHasPopup(false); + } + + this.responseList.indexList + .on('click', function (e) { + this.responseList.selected = $(e.currentTarget); + this.searchForm.trigger('submit'); + }.bind(this)) + .on('mouseenter mouseleave', function (e) { + this.responseList.indexList.removeClass(this.options.selectClass); + $(e.target).addClass(this.options.selectClass); + this.responseList.selected = $(e.target); + this.element.attr('aria-activedescendant', $(e.target).attr('id')); + }.bind(this)) + .on('mouseout', function (e) { + if (!this._getLastElement() && + this._getLastElement().hasClass(this.options.selectClass)) { + $(e.target).removeClass(this.options.selectClass); + this._resetResponseList(false); + } + }.bind(this)); + } }, this)); } else { this._resetResponseList(true); From ed5d239b463a6d4469bc29a5d258738ec9ecb028 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:50:10 -0600 Subject: [PATCH 085/277] :arrow_double_up: Forwardport of magento/magento2#11084 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11084.patch (created by @rubenRP) based on commit(s): 1. 6e5c8f0e1d1b2cd157cdc4cd4751ae7c29cffd31 2. 6be876957f0746e825ca94ad3045e2cdd32ff6c9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9920: stripped-min-length Validation via UI Component Fails with "special" characters (reported by @bap14) --- app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index c7fb51f813ba0..76b00f56e780c 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -244,7 +244,7 @@ define([ ], 'stripped-min-length': [ function (value, param) { - return $(value).text().length >= param; + return _.isUndefined(value) || value.length === 0 || utils.stripHtml(value).length >= param; }, $.mage.__('Please enter at least {0} characters') ], From c739ef6f6917adec2ad8db143da2e3cf9c036b58 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:50:21 -0600 Subject: [PATCH 086/277] :arrow_double_up: Forwardport of magento/magento2#11254 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11254.patch (created by @romainruaud) based on commit(s): 1. 43cfc7427dd2b7dc03633a4dcd6b170cb521ae9c Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10317: Region is being overridden when changing from a required-state country to one that is not required (reported by @nei) --- .../Magento/Checkout/view/frontend/web/js/region-updater.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index 82033590b1135..79050ca087740 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -206,7 +206,7 @@ define([ regionInput.removeClass('required-entry'); } - regionList.removeClass('required-entry').hide(); + regionList.removeClass('required-entry').prop('disabled', 'disabled').hide(); regionInput.show(); label.attr('for', regionInput.attr('id')); } From 3238020aa6092f2c551df1dad7941de7c385fa8e Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:50:32 -0600 Subject: [PATCH 087/277] :arrow_double_up: Forwardport of magento/magento2#11297 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11297.patch (created by @michielgerritsen) based on commit(s): 1. 60d66282d5c0bfcd04cd2110b378357b7e3dab98 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#5105: Error While send Invoice with Grouped Products (reported by @srbarba) --- .../view/frontend/templates/email/items/invoice/default.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml index 20c2c1869fedb..1fca65932b0b0 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml @@ -31,6 +31,6 @@ </td> <td class="item-qty"><?= /* @escapeNotVerified */ $_item->getQty() * 1 ?></td> <td class="item-price"> - <?= /* @escapeNotVerified */ $block->getItemPrice($_item) ?> + <?= /* @escapeNotVerified */ $block->getItemPrice($_item->getOrderItem()) ?> </td> </tr> From b9df95d3e281ceb232056777ff24ad2705f87b87 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:50:41 -0600 Subject: [PATCH 088/277] :arrow_double_up: Forwardport of magento/magento2#11165 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11165.patch (created by @bka) based on commit(s): 1. 33dcc36b1f5214929f281c5618a31bbc6bded27b Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#7582: Payment methods in payments title in wrong language (reported by @Bartlomiejsz) --- app/code/Magento/Quote/Model/QuoteRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/QuoteRepository.php b/app/code/Magento/Quote/Model/QuoteRepository.php index 01c21bbbe50a7..d3967794b300a 100644 --- a/app/code/Magento/Quote/Model/QuoteRepository.php +++ b/app/code/Magento/Quote/Model/QuoteRepository.php @@ -212,7 +212,7 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared if ($sharedStoreIds) { $quote->setSharedStoreIds($sharedStoreIds); } - $quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier); + $quote->$loadMethod($identifier)->setStoreId($this->storeManager->getStore()->getId()); if (!$quote->getId()) { throw NoSuchEntityException::singleField($loadField, $identifier); } From b68a790fca90e576702f4ae98c162bcc553c2a22 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:50:52 -0600 Subject: [PATCH 089/277] :arrow_double_up: Forwardport of magento/magento2#11205 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11205.patch (created by @Tomasz-Silpion) based on commit(s): 1. d98858e59b0fab496d7bc5b359f09f0792a4ade7 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11163: Magento 2.2.0 Pages showing error: Data key is missing: code-entity (reported by @kfaer) --- .../view/adminhtml/ui_component/cms_page_form.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml index 735de2bd7b177..cc9249b2d3d38 100644 --- a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml +++ b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml @@ -13,7 +13,12 @@ </settings> <container name="google_experiment_container" sortOrder="250"> <htmlContent name="html_content"> - <block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage" /> + <block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage"> + <arguments> + <argument name="code-entity" xsi:type="string">Magento\GoogleOptimizer\Block\Adminhtml\Cms\Page\EntityCmsPage</argument> + <argument name="form-name" xsi:type="string">cms_page_form</argument> + </arguments> + </block> </htmlContent> </container> </fieldset> From b8e7c76b2ff2d84c3780ee5486a82b4ca1374691 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:51:01 -0600 Subject: [PATCH 090/277] :arrow_double_up: Forwardport of magento/magento2#11390 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11390.patch (created by @jahvi) based on commit(s): 1. 51e0867597d4e0fc590afff51345fcd10ba12ef9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#8958: Hint mistake in english language (reported by @MighT-W315H31T) --- .../Backend/view/adminhtml/web/template/dynamic-rows/grid.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html b/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html index 74621806fa5fb..891ad48b33eff 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html +++ b/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html @@ -85,7 +85,7 @@ <div class="messages"> <div class="message message-notice notice"> <span - translate="'Search strings are either normal strings or regular exceptions (PCRE). They are matched in the same order as entered.'"></span> + translate="'Search strings are either normal strings or regular expressions (PCRE). They are matched in the same order as entered.'"></span> <br> <span translate="'Examples'"></span>: From 074285735cd6d33fd530302390ab8101e73d7e34 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:51:13 -0600 Subject: [PATCH 091/277] :arrow_double_up: Forwardport of magento/magento2#11219 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11219.patch (created by @mszydlo) based on commit(s): 1. c1c5796bcf467584833ac49fc40f74187b89973b --- .../Magento/Theme/view/frontend/templates/js/polyfill.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml b/app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml index 7e8854b914261..2b75bd2222e26 100644 --- a/app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml @@ -126,7 +126,7 @@ }; window.localStorage.__proto__ = window.localStorage = new Storage('local'); - window.sessionStorage.__proto__ = window.sessionStorag = new Storage('session'); + window.sessionStorage.__proto__ = window.sessionStorage = new Storage('session'); })(); } </script> From fde512eacfce36508bcec2b1c08ef381d0af3f92 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:51:22 -0600 Subject: [PATCH 092/277] :arrow_double_up: Forwardport of magento/magento2#11345 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11345.patch (created by @davidangel) based on commit(s): 1. dd6e5a36e2a3bcc1167d12897686fdb9ce1caa3d 2. 4092346a9505d190faf65930b63db881c3e3b5fd 3. 84ff52beb4adb70024060179ddff3eb1776e47db --- app/code/Magento/Cms/i18n/en_US.csv | 2 +- .../Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml | 2 +- .../app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Cms/i18n/en_US.csv b/app/code/Magento/Cms/i18n/en_US.csv index 983493bb7732a..e4989777593f8 100644 --- a/app/code/Magento/Cms/i18n/en_US.csv +++ b/app/code/Magento/Cms/i18n/en_US.csv @@ -133,7 +133,7 @@ Block,Block "Enable Page","Enable Page" Content,Content "Content Heading","Content Heading" -"Search Engine Optimisation","Search Engine Optimisation" +"Search Engine Optimization","Search Engine Optimization" "Meta Title","Meta Title" "Meta Keywords","Meta Keywords" "Meta Description","Meta Description" diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml index f8c4f07bd4336..5441481f6cea2 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml @@ -141,7 +141,7 @@ <fieldset name="search_engine_optimisation" sortOrder="20"> <settings> <collapsible>true</collapsible> - <label translate="true">Search Engine Optimisation</label> + <label translate="true">Search Engine Optimization</label> </settings> <field name="identifier" formElement="input"> <argument name="data" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml index 2ed1bdc790806..28de286b1411a 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml @@ -68,7 +68,7 @@ </custom_design> <seo> <class>\Magento\Backend\Test\Block\Widget\Tab</class> - <selector>//div[div/strong/span[text()="Search Engine Optimisation"]]</selector> + <selector>//div[div/strong/span[text()="Search Engine Optimization"]]</selector> <strategy>xpath</strategy> <fields> <identifier /> From e7d90de918be70731e2021dee757d1e7af374ab8 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:51:31 -0600 Subject: [PATCH 093/277] :arrow_double_up: Forwardport of magento/magento2#11183 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11183.patch (created by @larsroettig) based on commit(s): 1. fb2ec44114e113d959d4b098cf7b2e1660e51cde 2. 214fc33862252bbbfbe0da781b2f3383cb5eac87 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11166: ReindexAll -> getState() is not correct if the Indexer broke with PHP fatal error (reported by @larsroettig) --- app/code/Magento/Indexer/Model/Indexer.php | 5 ++ .../Indexer/Test/Unit/Model/IndexerTest.php | 50 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/app/code/Magento/Indexer/Model/Indexer.php b/app/code/Magento/Indexer/Model/Indexer.php index 412611d1dffd6..9faf5e7b728cd 100644 --- a/app/code/Magento/Indexer/Model/Indexer.php +++ b/app/code/Magento/Indexer/Model/Indexer.php @@ -418,6 +418,11 @@ public function reindexAll() $state->save(); $this->getView()->resume(); throw $exception; + } catch (\Error $error) { + $state->setStatus(StateInterface::STATUS_INVALID); + $state->save(); + $this->getView()->resume(); + throw $error; } } } diff --git a/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php b/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php index 2c25c698dd425..e9c82906121cc 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php @@ -273,6 +273,56 @@ function () { $this->model->reindexAll(); } + /** + * @expectedException \Error + * @expectedExceptionMessage Test Engine Error + */ + public function testReindexAllWithError() + { + + $indexId = 'indexer_internal_name'; + $this->loadIndexer($indexId); + + $stateMock = $this->createPartialMock( + \Magento\Indexer\Model\Indexer\State::class, + ['load', 'getId', 'setIndexerId', '__wakeup', 'getStatus', 'setStatus', 'save'] + ); + $stateMock->expects($this->once())->method('load')->with($indexId, 'indexer_id')->will($this->returnSelf()); + $stateMock->expects($this->never())->method('setIndexerId'); + $stateMock->expects($this->once())->method('getId')->will($this->returnValue(1)); + $stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf()); + $stateMock->expects($this->once())->method('getStatus')->will($this->returnValue('idle')); + $stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf()); + $this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock)); + + $this->viewMock->expects($this->once())->method('isEnabled')->will($this->returnValue(false)); + $this->viewMock->expects($this->never())->method('suspend'); + $this->viewMock->expects($this->once())->method('resume'); + + $actionMock = $this->createPartialMock( + \Magento\Framework\Indexer\ActionInterface::class, + ['executeFull', 'executeList', 'executeRow'] + ); + $actionMock->expects($this->once())->method('executeFull')->will( + $this->returnCallback( + function () { + throw new \Error('Test Engine Error'); + } + ) + ); + $this->actionFactoryMock->expects( + $this->once() + )->method( + 'create' + )->with( + 'Some\Class\Name' + )->will( + $this->returnValue($actionMock) + ); + + $this->model->reindexAll(); + } + protected function getIndexerData() { return [ From 6d4f36db79a9bee553b4acfe8c0820b5c046e6af Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:08 -0600 Subject: [PATCH 094/277] :arrow_double_up: Forwardport of magento/magento2#11240 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11240.patch (created by @leptoquark1) based on commit(s): 1. 16a8050e1252a943a80cf111b8392102135df617 2. 86032de8e54a0a8567dd8c503aa75ff38efbfa5c --- lib/internal/Magento/Framework/View/Model/Layout/Merge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Model/Layout/Merge.php b/lib/internal/Magento/Framework/View/Model/Layout/Merge.php index ea8f74107954c..fe5c94ed21b30 100644 --- a/lib/internal/Magento/Framework/View/Model/Layout/Merge.php +++ b/lib/internal/Magento/Framework/View/Model/Layout/Merge.php @@ -811,7 +811,7 @@ private function getXmlErrors($libXmlErrors) protected function _getPhysicalTheme(\Magento\Framework\View\Design\ThemeInterface $theme) { $result = $theme; - while ($result->getId() && !$result->isPhysical()) { + while ($result !== null && $result->getId() && !$result->isPhysical()) { $result = $result->getParentTheme(); } if (!$result) { From 2e83a36fbf3201bdaf6612dcfce08125687f0e28 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:15 -0600 Subject: [PATCH 095/277] :arrow_double_up: Forwardport of magento/magento2#11342 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11342.patch (created by @denisristic) based on commit(s): 1. 6dfb610d611f6b22770f0f738951bdb89ca73734 2. f77dadbd3ad92610515b7fecd22f6217bb708df5 3. fc4723441c7652917201cac2b4411639bf2acd76 4. 9d593a4dbd55d6bd0343c3587c1b9bc3e1470d5e 5. 79693c8800f61780bcd44cf3fbbee92615f70514 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11310: Method "getChildren" sort ordering (reported by @EliasKotlyar) --- app/code/Magento/Catalog/Model/Category.php | 7 +++++-- .../Magento/Catalog/Model/ResourceModel/Category/Flat.php | 6 +++++- .../testsuite/Magento/Catalog/Model/CategoryTreeTest.php | 8 ++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index c4d6742a02dd3..ff840635e4c70 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -780,11 +780,14 @@ public function getAllChildren($asArray = false) /** * Retrieve children ids comma separated * + * @param boolean $recursive + * @param boolean $isActive + * @param boolean $sortByPosition * @return string */ - public function getChildren() + public function getChildren($recursive = false, $isActive = true, $sortByPosition = false) { - return implode(',', $this->getResource()->getChildren($this, false)); + return implode(',', $this->getResource()->getChildren($this, $recursive, $isActive, $sortByPosition)); } /** diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index d7f8bd9d789a2..01e4b072b0367 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -602,9 +602,10 @@ public function isInRootCategoryList($category) * @param \Magento\Catalog\Model\Category $category * @param bool $recursive * @param bool $isActive + * @param bool $sortByPosition * @return array */ - public function getChildren($category, $recursive = true, $isActive = true) + public function getChildren($category, $recursive = true, $isActive = true, $sortByPosition = false) { $select = $this->getConnection()->select()->from( $this->getMainStoreTable($category->getStoreId()), @@ -619,6 +620,9 @@ public function getChildren($category, $recursive = true, $isActive = true) if ($isActive) { $select->where('is_active = ?', '1'); } + if ($sortByPosition) { + $select->order('position ASC'); + } $_categories = $this->getConnection()->fetchAll($select); $categoriesIds = []; foreach ($_categories as $_category) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php index 5e9244367bb13..8eeba1230f8b1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php @@ -128,6 +128,14 @@ public function testGetChildren() $this->assertEquals(array_diff([4, 13], explode(',', $this->_model->getChildren())), []); } + public function testGetChildrenSorted() + { + $this->_model->load(2); + $unsorted = explode(',', $this->_model->getChildren()); + sort($unsorted); + $this->assertEquals(array_diff($unsorted, explode(',', $this->_model->getChildren(true, true, true))), []); + } + public function testGetPathInStore() { $this->_model->load(5); From 23b4aa11f5a4a0b6bfe76cd1e812d36d88ed4d83 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:22 -0600 Subject: [PATCH 096/277] :arrow_double_up: Forwardport of magento/magento2#11493 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11493.patch (created by @JeroenVanLeusden) based on commit(s): 1. 221c593768ef67158740d143ceb55ef8b7f75436 --- app/code/Magento/Checkout/i18n/en_US.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/i18n/en_US.csv b/app/code/Magento/Checkout/i18n/en_US.csv index 69ec68a2cd579..8d297c4060abd 100644 --- a/app/code/Magento/Checkout/i18n/en_US.csv +++ b/app/code/Magento/Checkout/i18n/en_US.csv @@ -176,3 +176,4 @@ Payment,Payment "Not yet calculated","Not yet calculated" "We received your order!","We received your order!" "Thank you for your purchase!","Thank you for your purchase!" +"optional", "optional" From b50bfa811876af007426b734019fd149def63bba Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:30 -0600 Subject: [PATCH 097/277] :arrow_double_up: Forwardport of magento/magento2#11430 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11430.patch (created by @slackerzz) based on commit(s): 1. 354800097cfb6909aacaa98d8b8df3dfec4f8f35 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10941: Responsive Design Issue on Mobile with Magento 2.1.9 (reported by @rishabhchd19) --- .../luma/Magento_Catalog/web/css/source/module/_toolbar.less | 1 - 1 file changed, 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 5c51938b23422..580abf264cadc 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 @@ -44,7 +44,6 @@ line-height: @toolbar-mode-icon-font-size + 2; margin: 0; padding: 7px 0; - position: absolute; text-align: left; top: 0; vertical-align: middle; From 04cd60da14a87727768165942c23fc1403016e41 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:37 -0600 Subject: [PATCH 098/277] :arrow_double_up: Forwardport of magento/magento2#11199 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11199.patch (created by @osrecio) based on commit(s): 1. 41410ac66c1391ca0adb565e78cc32c71b872e9e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11176: Configured table prefix is not recognized in CLI admin:user:create (reported by @crtl) --- setup/src/Magento/Setup/Model/Installer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 4a9bfd9063656..60cf85efc40ca 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -1010,6 +1010,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix) public function installAdminUser($data) { $this->assertDbConfigExists(); + $data += ['db-prefix' => $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX)]; $setup = $this->setupFactory->create($this->context->getResources()); $adminAccount = $this->adminAccountFactory->create($setup->getConnection(), (array)$data); $adminAccount->save(); From 75d5a0522e8a18c2f403ea284d62e445e3d6ddc2 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:44 -0600 Subject: [PATCH 099/277] :arrow_double_up: Forwardport of magento/magento2#11299 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11299.patch (created by @lano-vargas) based on commit(s): 1. 17d37b2e362a75b69634ba9030ad37ef410713ab Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11275: Call to a member function addCrumb() (reported by @lano-vargas) --- app/code/Magento/Sales/Helper/Guest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php index a80be58bc003e..dd8845008d79e 100644 --- a/app/code/Magento/Sales/Helper/Guest.php +++ b/app/code/Magento/Sales/Helper/Guest.php @@ -178,6 +178,9 @@ public function loadValidOrder(App\RequestInterface $request) public function getBreadcrumbs(\Magento\Framework\View\Result\Page $resultPage) { $breadcrumbs = $resultPage->getLayout()->getBlock('breadcrumbs'); + if (!$breadcrumbs) { + return; + } $breadcrumbs->addCrumb( 'home', [ From 5e02b15fcbe310cd13e385d0ae7a3e6017b56497 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:51 -0600 Subject: [PATCH 100/277] :arrow_double_up: Forwardport of magento/magento2#11495 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11495.patch (created by @diazwatson) based on commit(s): 1. 84b0872d076bcb310f1febb550fb08addcac75ad Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9783: Multiple <depends> parameters in widget.xml not allowed (reported by @milansimek) --- .../Magento/Widget/Model/Config/Converter.php | 23 ++++++++++++++----- app/code/Magento/Widget/etc/widget.xsd | 4 ++-- app/code/Magento/Widget/etc/widget_file.xsd | 4 ++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Widget/Model/Config/Converter.php b/app/code/Magento/Widget/Model/Config/Converter.php index 010c46da56950..40718a5a5db9c 100644 --- a/app/code/Magento/Widget/Model/Config/Converter.php +++ b/app/code/Magento/Widget/Model/Config/Converter.php @@ -222,7 +222,7 @@ protected function _convertDepends($source) { $depends = []; foreach ($source->childNodes as $childNode) { - if ($childNode->nodeName == '#text') { + if ($childNode->nodeName === '#text') { continue; } if ($childNode->nodeName !== 'parameter') { @@ -231,12 +231,23 @@ protected function _convertDepends($source) ); } $parameterAttributes = $childNode->attributes; - $depends[$parameterAttributes->getNamedItem( - 'name' - )->nodeValue] = [ - 'value' => $parameterAttributes->getNamedItem('value')->nodeValue, - ]; + $dependencyName = $parameterAttributes->getNamedItem('name')->nodeValue; + $dependencyValue = $parameterAttributes->getNamedItem('value')->nodeValue; + + if (!isset($depends[$dependencyName])) { + $depends[$dependencyName] = [ + 'value' => $dependencyValue, + ]; + + continue; + } else if (!isset($depends[$dependencyName]['values'])) { + $depends[$dependencyName]['values'] = [$depends[$dependencyName]['value']]; + unset($depends[$dependencyName]['value']); + } + + $depends[$dependencyName]['values'][] = $dependencyValue; } + return $depends; } diff --git a/app/code/Magento/Widget/etc/widget.xsd b/app/code/Magento/Widget/etc/widget.xsd index caaeec8ac4b84..70c9ec8e3514f 100644 --- a/app/code/Magento/Widget/etc/widget.xsd +++ b/app/code/Magento/Widget/etc/widget.xsd @@ -212,8 +212,8 @@ <xs:annotation> <xs:documentation>List of parameters this parameter depends on.</xs:documentation> </xs:annotation> - <xs:all> + <xs:sequence maxOccurs="unbounded"> <xs:element name="parameter" type="dependsParameterType" /> - </xs:all> + </xs:sequence> </xs:complexType> </xs:schema> diff --git a/app/code/Magento/Widget/etc/widget_file.xsd b/app/code/Magento/Widget/etc/widget_file.xsd index 6ebf7a201212e..afdd506f3ba24 100644 --- a/app/code/Magento/Widget/etc/widget_file.xsd +++ b/app/code/Magento/Widget/etc/widget_file.xsd @@ -212,8 +212,8 @@ <xs:annotation> <xs:documentation>List of parameters this parameter depends on.</xs:documentation> </xs:annotation> - <xs:all> + <xs:sequence maxOccurs="unbounded"> <xs:element name="parameter" type="dependsParameterType" /> - </xs:all> + </xs:sequence> </xs:complexType> </xs:schema> From 97e48a7e72a48d5836cfe5c04ea5af53d6367990 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:54:58 -0600 Subject: [PATCH 101/277] :arrow_double_up: Forwardport of magento/magento2#11565 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11565.patch (created by @bap14) based on commit(s): 1. 7b0e90ae0f095685935c41670e268ded0870707e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9919: Pattern Validation via UI Component Fails to Interpret String as RegEx Pattern (reported by @bap14) --- app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index c7fb51f813ba0..7360f25b8baa6 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -360,7 +360,7 @@ define([ ], 'pattern': [ function (value, param) { - return param.test(value); + return new RegExp(param).test(value); }, $.mage.__('Invalid format.') ], From 88096d18a551d874785a2b82f03b6c989700de53 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:06 -0600 Subject: [PATCH 102/277] :arrow_double_up: Forwardport of magento/magento2#11510 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11510.patch (created by @cmuench) based on commit(s): 1. 10b57f46398d6a85afee751ab1c7c9f1b7d31d19 --- .../Command/AdminUserCreateCommand.php | 101 +++++++++++++++++- .../Command/AdminUserCreateCommandTest.php | 75 ++++++++++++- 2 files changed, 170 insertions(+), 6 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php index 940bcbbd6d7f1..4ad8e7c229bfd 100644 --- a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php +++ b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php @@ -6,13 +6,14 @@ namespace Magento\Setup\Console\Command; -use Magento\Setup\Model\AdminAccount; use Magento\Framework\Setup\ConsoleLogger; +use Magento\Setup\Model\AdminAccount; use Magento\Setup\Model\InstallerFactory; use Magento\User\Model\UserValidationRules; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; class AdminUserCreateCommand extends AbstractSetupCommand { @@ -50,6 +51,98 @@ protected function configure() parent::configure(); } + /** + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + /** @var \Symfony\Component\Console\Helper\QuestionHelper $questionHelper */ + $questionHelper = $this->getHelper('question'); + + if (!$input->getOption(AdminAccount::KEY_USER)) { + $question = new Question('<question>Admin user:</question> ', ''); + $this->addNotEmptyValidator($question); + + $input->setOption( + AdminAccount::KEY_USER, + $questionHelper->ask($input, $output, $question) + ); + } + + if (!$input->getOption(AdminAccount::KEY_PASSWORD)) { + $question = new Question('<question>Admin password:</question> ', ''); + $question->setHidden(true); + + $question->setValidator(function ($value) use ($output) { + $user = new \Magento\Framework\DataObject(); + $user->setPassword($value); + + $validator = new \Magento\Framework\Validator\DataObject(); + $this->validationRules->addPasswordRules($validator); + + $validator->isValid($user); + foreach ($validator->getMessages() as $message) { + throw new \Exception($message); + } + + return $value; + }); + + $input->setOption( + AdminAccount::KEY_PASSWORD, + $questionHelper->ask($input, $output, $question) + ); + } + + if (!$input->getOption(AdminAccount::KEY_EMAIL)) { + $question = new Question('<question>Admin email:</question> ', ''); + $this->addNotEmptyValidator($question); + + $input->setOption( + AdminAccount::KEY_EMAIL, + $questionHelper->ask($input, $output, $question) + ); + } + + if (!$input->getOption(AdminAccount::KEY_FIRST_NAME)) { + $question = new Question('<question>Admin first name:</question> ', ''); + $this->addNotEmptyValidator($question); + + $input->setOption( + AdminAccount::KEY_FIRST_NAME, + $questionHelper->ask($input, $output, $question) + ); + } + + if (!$input->getOption(AdminAccount::KEY_LAST_NAME)) { + $question = new Question('<question>Admin last name:</question> ', ''); + $this->addNotEmptyValidator($question); + + $input->setOption( + AdminAccount::KEY_LAST_NAME, + $questionHelper->ask($input, $output, $question) + ); + } + } + + /** + * @param \Symfony\Component\Console\Question\Question $question + * @return void + */ + private function addNotEmptyValidator(Question $question) + { + $question->setValidator(function ($value) { + if (trim($value) == '') { + throw new \Exception('The value cannot be empty'); + } + + return $value; + }); + } + /** * {@inheritdoc} */ @@ -57,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $errors = $this->validate($input); if ($errors) { - $output->writeln('<error>' . implode('</error>' . PHP_EOL . '<error>', $errors) . '</error>'); + $output->writeln('<error>' . implode('</error>' . PHP_EOL . '<error>', $errors) . '</error>'); // we must have an exit code higher than zero to indicate something was wrong return \Magento\Framework\Console\Cli::RETURN_FAILURE; } @@ -113,7 +206,7 @@ public function validate(InputInterface $input) ? '' : $input->getOption(AdminAccount::KEY_PASSWORD) ); - $validator = new \Magento\Framework\Validator\DataObject; + $validator = new \Magento\Framework\Validator\DataObject(); $this->validationRules->addUserInfoRules($validator); $this->validationRules->addPasswordRules($validator); diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php index 1cfd0c9494a51..d244f48d4e1ea 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php @@ -5,14 +5,21 @@ */ namespace Magento\Setup\Test\Unit\Console\Command; -use Magento\Setup\Model\AdminAccount; use Magento\Setup\Console\Command\AdminUserCreateCommand; +use Magento\Setup\Model\AdminAccount; use Magento\Setup\Mvc\Bootstrap\InitParamListener; use Magento\User\Model\UserValidationRules; +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Tester\CommandTester; class AdminUserCreateCommandTest extends \PHPUnit\Framework\TestCase { + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\Console\Helper\QuestionHelper + */ + private $questionHelperMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\InstallerFactory */ @@ -27,6 +34,10 @@ public function setUp() { $this->installerFactoryMock = $this->createMock(\Magento\Setup\Model\InstallerFactory::class); $this->command = new AdminUserCreateCommand($this->installerFactoryMock, new UserValidationRules()); + + $this->questionHelperMock = $this->getMockBuilder(QuestionHelper::class) + ->setMethods(['ask']) + ->getMock(); } public function testExecute() @@ -50,10 +61,70 @@ public function testExecute() $installerMock = $this->createMock(\Magento\Setup\Model\Installer::class); $installerMock->expects($this->once())->method('installAdminUser')->with($data); $this->installerFactoryMock->expects($this->once())->method('create')->willReturn($installerMock); - $commandTester->execute($options); + $commandTester->execute($options, ['interactive' => false]); $this->assertEquals('Created Magento administrator user named user' . PHP_EOL, $commandTester->getDisplay()); } + public function testInteraction() + { + $application = new Application(); + $application->add($this->command); + + $this->questionHelperMock->expects($this->at(0)) + ->method('ask') + ->will($this->returnValue('admin')); + + $this->questionHelperMock->expects($this->at(1)) + ->method('ask') + ->will($this->returnValue('Password123')); + + $this->questionHelperMock->expects($this->at(2)) + ->method('ask') + ->will($this->returnValue('john.doe@example.com')); + + $this->questionHelperMock->expects($this->at(3)) + ->method('ask') + ->will($this->returnValue('John')); + + $this->questionHelperMock->expects($this->at(4)) + ->method('ask') + ->will($this->returnValue('Doe')); + + // We override the standard helper with our mock + $this->command->getHelperSet()->set($this->questionHelperMock, 'question'); + + $installerMock = $this->createMock(\Magento\Setup\Model\Installer::class); + + $expectedData = [ + 'admin-user' => 'admin', + 'admin-password' => 'Password123', + 'admin-email' => 'john.doe@example.com', + 'admin-firstname' => 'John', + 'admin-lastname' => 'Doe', + 'magento-init-params' => null, + 'help' => false, + 'quiet' => false, + 'verbose' => false, + 'version' => false, + 'ansi' => false, + 'no-ansi' => false, + 'no-interaction' => false, + ]; + + $installerMock->expects($this->once())->method('installAdminUser')->with($expectedData); + $this->installerFactoryMock->expects($this->once())->method('create')->willReturn($installerMock); + + $commandTester = new CommandTester($this->command); + $commandTester->execute([ + 'command' => $this->command->getName(), + ]); + + $this->assertEquals( + 'Created Magento administrator user named admin' . PHP_EOL, + $commandTester->getDisplay() + ); + } + public function testGetOptionsList() { /* @var $argsList \Symfony\Component\Console\Input\InputArgument[] */ From 4c5c9524fd812668c04c9906b28ab3d87f350ec6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:15 -0600 Subject: [PATCH 103/277] :arrow_double_up: Forwardport of magento/magento2#11385 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11385.patch (created by @joni-jones) based on commit(s): 1. 1743a36a424ded64043fbc6592956099ebb0eec2 2. d1e6f822ce8d28ef1a941e3e33262782386344a6 3. 63b549b5bb052bb4a0b0b57cf81c7591f53b56e2 4. b1a0181d4148c6f994ad85c7e2f4f8b762fc6a3f Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10856: Sync billing with shipping address on Admin Reorder and Admin Customer Create Order page does not work for Existing address selected (reported by @NoorulBhoelai) --- .../Magento/Quote/Model/Quote/Address.php | 3 +- .../Test/Unit/Model/Quote/AddressTest.php | 28 ++++----- .../Magento/Sales/Model/AdminOrder/Create.php | 57 ++++++++++-------- .../adminhtml/web/order/create/scripts.js | 47 +++++++++------ .../Controller/Adminhtml/Order/CreateTest.php | 59 ++++++++++++++++++- 5 files changed, 134 insertions(+), 60 deletions(-) diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index 109ca91cb2ae8..87c5feaba8f2e 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -1170,7 +1170,8 @@ public function validateMinimumAmount() */ public function getAppliedTaxes() { - return $this->serializer->unserialize($this->getData('applied_taxes')); + $taxes = $this->getData('applied_taxes'); + return $taxes ? $this->serializer->unserialize($taxes) : []; } /** diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/AddressTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/AddressTest.php index d1e59bb365b29..c1c131260f17a 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/AddressTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/AddressTest.php @@ -7,7 +7,7 @@ namespace Magento\Quote\Test\Unit\Model\Quote; use Magento\Directory\Model\Currency; -use \Magento\Quote\Model\Quote\Address; +use Magento\Quote\Model\Quote\Address; use Magento\Quote\Model\Quote\Address\Rate; use Magento\Quote\Model\ResourceModel\Quote\Address\Rate\CollectionFactory as RateCollectionFactory; use Magento\Quote\Model\ResourceModel\Quote\Address\Rate\Collection as RatesCollection; @@ -26,6 +26,7 @@ use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Api\Data\WebsiteInterface; use Magento\Quote\Model\Quote\Address\RateResult\AbstractResult; +use Magento\Framework\Serialize\Serializer\Json; /** * Test class for sales quote address model @@ -121,7 +122,7 @@ protected function setUp() $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->scopeConfig = $this->createMock(\Magento\Framework\App\Config::class); - $this->serializer = $this->createMock(\Magento\Framework\Serialize\Serializer\Json::class); + $this->serializer = new Json(); $this->requestFactory = $this->getMockBuilder(RateRequestFactory::class) ->disableOriginalConstructor() @@ -283,20 +284,17 @@ public function testValidateMinimumAmountNegative() public function testSetAndGetAppliedTaxes() { $data = ['data']; - $result = json_encode($data); - - $this->serializer->expects($this->once()) - ->method('serialize') - ->with($data) - ->willReturn($result); - - $this->serializer->expects($this->once()) - ->method('unserialize') - ->with($result) - ->willReturn($data); + self::assertInstanceOf(Address::class, $this->address->setAppliedTaxes($data)); + self::assertEquals($data, $this->address->getAppliedTaxes()); + } - $this->assertInstanceOf(\Magento\Quote\Model\Quote\Address::class, $this->address->setAppliedTaxes($data)); - $this->assertEquals($data, $this->address->getAppliedTaxes()); + /** + * Checks a case, when applied taxes are not provided. + */ + public function testGetAppliedTaxesWithEmptyValue() + { + $this->address->setData('applied_taxes', null); + self::assertEquals([], $this->address->getAppliedTaxes()); } /** diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 732ad6ba2cf6c..dbacb440f5330 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -8,6 +8,8 @@ use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Model\Metadata\Form as CustomerForm; +use Magento\Framework\App\ObjectManager; +use Magento\Quote\Model\Quote\Address; use Magento\Quote\Model\Quote\Item; /** @@ -321,7 +323,7 @@ public function __construct( $this->dataObjectHelper = $dataObjectHelper; $this->orderManagement = $orderManagement; $this->quoteFactory = $quoteFactory; - $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + $this->serializer = $serializer ?: ObjectManager::getInstance() ->get(\Magento\Framework\Serialize\Serializer\Json::class); parent::__construct($data); } @@ -1454,32 +1456,36 @@ public function getBillingAddress() */ public function setBillingAddress($address) { - if (is_array($address)) { - $billingAddress = $this->_objectManager->create( - \Magento\Quote\Model\Quote\Address::class - )->setData( - $address - )->setAddressType( - \Magento\Quote\Model\Quote\Address::TYPE_BILLING - ); - $this->_setQuoteAddress($billingAddress, $address); - /** - * save_in_address_book is not a valid attribute and is filtered out by _setQuoteAddress, - * that is why it should be added after _setQuoteAddress call - */ - $saveInAddressBook = (int)(!empty($address['save_in_address_book'])); - $billingAddress->setData('save_in_address_book', $saveInAddressBook); - - if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) { - $shippingAddress = clone $billingAddress; - $shippingAddress->setSameAsBilling(true); - $shippingAddress->setSaveInAddressBook(false); - $address['save_in_address_book'] = 0; - $this->setShippingAddress($address); - } + if (!is_array($address)) { + return $this; + } + + $billingAddress = $this->_objectManager->create(Address::class) + ->setData($address) + ->setAddressType(Address::TYPE_BILLING); + + $this->_setQuoteAddress($billingAddress, $address); + + /** + * save_in_address_book is not a valid attribute and is filtered out by _setQuoteAddress, + * that is why it should be added after _setQuoteAddress call + */ + $saveInAddressBook = (int)(!empty($address['save_in_address_book'])); + $billingAddress->setData('save_in_address_book', $saveInAddressBook); + + $quote = $this->getQuote(); + if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) { + $address['save_in_address_book'] = 0; + $this->setShippingAddress($address); + } - $this->getQuote()->setBillingAddress($billingAddress); + // not assigned billing address should be saved as new + // but if quote already has the billing address it won't be overridden + if (empty($billingAddress->getCustomerAddressId())) { + $billingAddress->setCustomerAddressId(null); + $quote->getBillingAddress()->setCustomerAddressId(null); } + $quote->setBillingAddress($billingAddress); return $this; } @@ -1782,6 +1788,7 @@ public function _prepareCustomer() $address = $this->getShippingAddress()->setCustomerId($this->getQuote()->getCustomer()->getId()); $this->setShippingAddress($address); } + $this->getBillingAddress()->setCustomerId($customer->getId()); $this->getQuote()->updateCustomerData($this->getQuote()->getCustomer()); $customer = $this->getQuote()->getCustomer(); diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 629b7ac93ecee..a43c750ec823a 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -157,6 +157,7 @@ define([ } if(this.addresses[id]){ this.fillAddressFields(container, this.addresses[id]); + } else{ this.fillAddressFields(container, {}); @@ -190,43 +191,53 @@ define([ } }, - changeAddressField : function(event){ - var field = Event.element(event); - var re = /[^\[]*\[([^\]]*)_address\]\[([^\]]*)\](\[(\d)\])?/; - var matchRes = field.name.match(re); + /** + * Triggers on each form's element changes. + * + * @param {Object} event + */ + changeAddressField: function (event) { + var field = Event.element(event), + re = /[^\[]*\[([^\]]*)_address\]\[([^\]]*)\](\[(\d)\])?/, + matchRes = field.name.match(re), + type, + name, + data; if (!matchRes) { return; } - var type = matchRes[1]; - var name = matchRes[2]; - var data; + type = matchRes[1]; + name = matchRes[2]; - if(this.isBillingField(field.id)){ - data = this.serializeData(this.billingAddressContainer) - } - else{ - data = this.serializeData(this.shippingAddressContainer) + if (this.isBillingField(field.id)) { + data = this.serializeData(this.billingAddressContainer); + } else { + data = this.serializeData(this.shippingAddressContainer); } data = data.toObject(); - if( (type == 'billing' && this.shippingAsBilling) - || (type == 'shipping' && !this.shippingAsBilling) ) { + if (type === 'billing' && this.shippingAsBilling || type === 'shipping' && !this.shippingAsBilling) { data['reset_shipping'] = true; } - data['order['+type+'_address][customer_address_id]'] = $('order-'+type+'_address_customer_address_id').value; + data['order[' + type + '_address][customer_address_id]'] = null; + data['shipping_as_billing'] = jQuery('[name="shipping_same_as_billing"]').is(':checked') ? 1 : 0; + + if (name === 'customer_address_id') { + data['order[' + type + '_address][customer_address_id]'] = + $('order-' + type + '_address_customer_address_id').value; + } if (data['reset_shipping']) { this.resetShippingMethod(data); } else { this.saveData(data); - if (name == 'country_id' || name == 'customer_address_id') { + + if (name === 'country_id' || name === 'customer_address_id') { this.loadArea(['shipping_method', 'billing_method', 'totals', 'items'], true, data); } - // added for reloading of default sender and default recipient for giftmessages - //this.loadArea(['giftmessage'], true, data); } }, diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php index 5f3dbdabc640a..e071dde26a263 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php @@ -5,6 +5,10 @@ */ namespace Magento\Sales\Controller\Adminhtml\Order; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Backend\Model\Session\Quote; +use Magento\Quote\Api\CartRepositoryInterface; + /** * @magentoAppArea adminhtml * @magentoDbIsolation enabled @@ -158,7 +162,7 @@ public function testIndexAction() */ public function testGetAclResource($actionName, $reordered, $expectedResult) { - $this->_objectManager->get(\Magento\Backend\Model\Session\Quote::class)->setReordered($reordered); + $this->_objectManager->get(Quote::class)->setReordered($reordered); $orderController = $this->_objectManager->get( \Magento\Sales\Controller\Adminhtml\Order\Stub\OrderCreateStub::class ); @@ -229,4 +233,57 @@ public function testDeniedSaveAction() $this->dispatch('backend/sales/order_create/save'); $this->assertEquals('403', $this->getResponse()->getHttpResponseCode()); } + + /** + * Checks a case when shipping is the same as billing and billing address details was changed by request. + * Both billing and shipping addresses should be updated. + * + * @magentoAppArea adminhtml + * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php + */ + public function testSyncBetweenQuoteAddresses() + { + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get('customer@example.com'); + + /** @var CartRepositoryInterface $quoteRepository */ + $quoteRepository = $this->_objectManager->get(CartRepositoryInterface::class); + $quote = $quoteRepository->getActiveForCustomer($customer->getId()); + + $session = $this->_objectManager->get(Quote::class); + $session->setQuoteId($quote->getId()); + + $data = [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'street' => ['Soborna 23'], + 'city' => 'Kyiv', + 'country_id' => 'UA', + 'region' => 'Kyivska', + 'region_id' => 1 + ]; + $this->getRequest()->setPostValue( + [ + 'order' => ['billing_address' => $data], + 'reset_shipping' => 1, + 'customer_id' => $customer->getId(), + 'store_id' => 1, + 'json' => true + ] + ); + + $this->dispatch('backend/sales/order_create/loadBlock/block/shipping_address'); + self::assertEquals(200, $this->getResponse()->getHttpResponseCode()); + + $updatedQuote = $quoteRepository->get($quote->getId()); + + $billingAddress = $updatedQuote->getBillingAddress(); + self::assertEquals($data['region_id'], $billingAddress->getRegionId()); + self::assertEquals($data['country_id'], $billingAddress->getCountryId()); + + $shippingAddress = $updatedQuote->getShippingAddress(); + self::assertEquals($data['city'], $shippingAddress->getCity()); + self::assertEquals($data['street'], $shippingAddress->getStreet()); + } } From 56f77080cf9e1d03aeef651e450cd431096d7680 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:22 -0600 Subject: [PATCH 104/277] :arrow_double_up: Forwardport of magento/magento2#11499 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11499.patch (created by @joshuaswarren) based on commit(s): 1. bd95e4ec5b909f491afb2b1567fefebdc819b63c Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10025: Integration tests don't reset the database (reported by @dersam) --- .../framework/Magento/TestFramework/Application.php | 5 +++-- dev/tests/integration/framework/bootstrap.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index a5a16c547e089..bbe0286e29c68 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -444,7 +444,7 @@ public function cleanup() * @return void * @throws \Magento\Framework\Exception\LocalizedException */ - public function install() + public function install($cleanup) { $dirs = \Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS; $this->_ensureDirExists($this->installDir); @@ -459,8 +459,9 @@ public function install() $installParams = $this->getInstallCliParams(); // performance optimization: restore DB from last good dump to make installation on top of it (much faster) + // do not restore from the database if the cleanup option is set to ensure we have a clean DB to test on $db = $this->getDbInstance(); - if ($db->isDbDumpExists()) { + if ($db->isDbDumpExists() && !$cleanup) { $db->restoreFromDbDump(); } diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index 13008938147b5..4e14c8113a708 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -74,7 +74,7 @@ $application->cleanup(); } if (!$application->isInstalled()) { - $application->install(); + $application->install($settings->getAsBoolean('TESTS_CLEANUP')); } $application->initialize([]); From 93cba75d74c84208f7b4b67e268e03b00bdd67a6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:29 -0600 Subject: [PATCH 105/277] :arrow_double_up: Forwardport of magento/magento2#11710 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11710.patch (created by @gabrielqs-redstage) based on commit(s): 1. fb842675fcbc7c1e60fe80404204c6dd759a626b Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9763: When go checkout,Cart Price Rules 25%test coupon code can go wrong (reported by @michaeldyl520) --- .../view/frontend/web/js/model/resource-url-manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js b/app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js index 2d27d4a032b24..410f5b4927374 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js @@ -75,8 +75,8 @@ define([ quoteId: quoteId } : {}, urls = { - 'guest': '/guest-carts/' + quoteId + '/coupons/' + couponCode, - 'customer': '/carts/mine/coupons/' + couponCode + 'guest': '/guest-carts/' + quoteId + '/coupons/' + encodeURIComponent(couponCode), + 'customer': '/carts/mine/coupons/' + encodeURIComponent(couponCode) }; return this.getUrl(urls, params); From d6da9b6eb1778b7a29ffc2a7e179dfe9d25bcbf9 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:36 -0600 Subject: [PATCH 106/277] :arrow_double_up: Forwardport of magento/magento2#11720 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11720.patch (created by @amenk) based on commit(s): 1. f64281102c6c16b0e67d779d178054f179044187 --- app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index b12691ad16245..87d4b984cf933 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -113,8 +113,9 @@ public function collectRates(RateRequest $request) // Free shipping by qty $freeQty = 0; + $freePackageValue = 0; + if ($request->getAllItems()) { - $freePackageValue = 0; foreach ($request->getAllItems() as $item) { if ($item->getProduct()->isVirtual() || $item->getParentItem()) { continue; From 3914fda85cab393ea8571dda6c903765a62f74a4 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:43 -0600 Subject: [PATCH 107/277] :arrow_double_up: Forwardport of magento/magento2#11250 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11250.patch (created by @romainruaud) based on commit(s): 1. eefdc1cdb6c21298e135fbbf986cabf742647caa 2. 00afa44ab1d21cf3a66d07f9e365a3d64ca4fe85 3. a0bef71ffb754198bc0193851b8ab500c0825869 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10275: Admin global search - submit by enter doesn't work (reported by @ihor-sviziev) --- lib/web/mage/backend/suggest.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/web/mage/backend/suggest.js b/lib/web/mage/backend/suggest.js index 81bde35f9e12a..412a80804ae0f 100644 --- a/lib/web/mage/backend/suggest.js +++ b/lib/web/mage/backend/suggest.js @@ -245,6 +245,7 @@ case keyCode.ENTER: case keyCode.NUMPAD_ENTER: + this._toggleEnter(event); if (this.isDropdownShown() && this._focused) { this._proxyEvents(event); @@ -314,6 +315,30 @@ this._bindDropdown(); }, + /** + * @param {Object} event - event object + * @private + */ + _toggleEnter: function (event) { + var suggestList, + activeItems, + selectedItem; + + suggestList = $(event.currentTarget.parentNode).find('ul').first(); + activeItems = suggestList.find('._active'); + + if (activeItems.length >= 0) { + selectedItem = activeItems.first(); + + if (selectedItem.find('a') && selectedItem.find('a').attr('href') !== undefined) { + window.location = selectedItem.find('a').attr('href'); + event.preventDefault(); + + return false; + } + } + }, + /** * @param {Object} e - event object * @private From b8360520590d10826d0896bc8ba8e8a06d4e1784 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:50 -0600 Subject: [PATCH 108/277] :arrow_double_up: Forwardport of magento/magento2#11690 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11690.patch (created by @andrewhowdencom) based on commit(s): 1. 73178d87e5bc719c57e4dc874de3a4e62977e2bd Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11157: nginx.sample.conf missing heath_check.php? (reported by @craigcarnell) --- nginx.conf.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx.conf.sample b/nginx.conf.sample index 58c059657c070..7257c329df24b 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -162,7 +162,7 @@ location /media/import/ { } # PHP entry point for main application -location ~ (index|get|static|report|404|503)\.php$ { +location ~ (index|get|static|report|404|503|health_check)\.php$ { try_files $uri =404; fastcgi_pass fastcgi_backend; fastcgi_buffers 1024 4k; From 5130f5444cf5f8cd1cee2fc438db8e92bb086c9c Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:55:58 -0600 Subject: [PATCH 109/277] :arrow_double_up: Forwardport of magento/magento2#11637 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11637.patch (created by @briscoda) based on commit(s): 1. 1623a22e1d774de8b388a04abc168d8b3f1c2dc8 2. 1951f07d8ce53b9330fff70246500a059764ab05 3. 08c61ac5ac124cbf0a8c0cf971555dbd5f263ae6 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9944: Name attribute shows empty when creating custom fields on product creation form (reported by @PatrickSH) --- app/code/Magento/Ui/view/base/web/js/form/element/abstract.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js index 6bbcb4416d33a..b6979121a1891 100755 --- a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js @@ -118,8 +118,8 @@ define([ this._super(); - scope = this.dataScope; - name = scope.split('.').slice(1); + scope = this.dataScope.split('.'); + name = scope.length > 1 ? scope.slice(1) : scope; valueUpdate = this.showFallbackReset ? 'afterkeydown' : this.valueUpdate; From 4e965faa0f240f1a57c68c3d1efe711e56383732 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:05 -0600 Subject: [PATCH 110/277] :arrow_double_up: Forwardport of magento/magento2#11610 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11610.patch (created by @mrodespin) based on commit(s): 1. 70d7502aed7e6d9332399e7c38aa0e971d882b9a Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#6891: Add-to-cart checkbox still visible when $canItemsAddToCart = false (reported by @thdoan) --- .../Catalog/view/frontend/templates/product/list/items.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index aaa040c3a5833..b226a661d14a2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -202,7 +202,7 @@ switch ($type = $block->getType()) { <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> - <?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> + <?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> <?php if (!$_item->getRequiredOptions()): ?> <div class="field choice related"> <input type="checkbox" class="checkbox related" id="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>" name="related_products[]" value="<?= /* @escapeNotVerified */ $_item->getId() ?>" /> From ad6c0af7dddbe2855a336acd3fd55994851e6d26 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:13 -0600 Subject: [PATCH 111/277] :arrow_double_up: Forwardport of magento/magento2#11410 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11410.patch (created by @crissanclick) based on commit(s): 1. 6862db093f0fa415ff15625924f3b56acd9ad9bf 2. 4c698c21d2f42acbfc35d84356ed27ff2821d45e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11365: "Ignore this notification" isn't working (reported by @sigismund) --- .../Tax/Controller/Adminhtml/Tax/IgnoreTaxNotification.php | 4 ++-- .../Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax/IgnoreTaxNotification.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax/IgnoreTaxNotification.php index 847f1312e8caf..b623b6c6868e7 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax/IgnoreTaxNotification.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax/IgnoreTaxNotification.php @@ -51,8 +51,8 @@ public function execute() } // clear the block html cache - $this->_cacheTypeList->cleanType('block_html'); - $this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'block_html']); + $this->_cacheTypeList->cleanType('config'); + $this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'config']); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); diff --git a/app/code/Magento/Tax/Test/Unit/Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php b/app/code/Magento/Tax/Test/Unit/Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php index 0f879a6e162f5..2035885f05e8f 100644 --- a/app/code/Magento/Tax/Test/Unit/Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php +++ b/app/code/Magento/Tax/Test/Unit/Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php @@ -19,7 +19,7 @@ public function testExecute() ->getMock(); $cacheTypeList->expects($this->once()) ->method('cleanType') - ->with('block_html') + ->with('config') ->willReturn(null); $request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) From 6d3d70a72f08cba36c3aef6b59eea8db40eb4071 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:24 -0600 Subject: [PATCH 112/277] :arrow_double_up: Forwardport of magento/magento2#11765 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11765.patch (created by @bentideswell) based on commit(s): 1. 4d79191e6cf75dfde33a6b38a12d9d06c1e1748c --- lib/internal/Magento/Framework/View/Layout/etc/elements.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd index ea80380865e6a..39cdec05a65ea 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd @@ -138,7 +138,7 @@ <xs:simpleType name="blockClassType"> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z][a-zA-Z\d]*(\\[A-Z][a-zA-Z\d]*)*"/> + <xs:pattern value="[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*"/> </xs:restriction> </xs:simpleType> From 6b0c02c5fd00d7a4237c4e1fae40dc265e3e43c3 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:31 -0600 Subject: [PATCH 113/277] :arrow_double_up: Forwardport of magento/magento2#11425 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11425.patch (created by @denisristic) based on commit(s): 1. 720496ccfa3baedb8e0435df442bc32de19b2bcc 2. 0e4dd85af64b5d9ed035da373e80d6d3fb08e1f8 3. ce12a7439fe03a690a5d5acb76dde333118c3d80 --- .../Setup/Console/Command/InstallCommand.php | 171 +++++++++++++++++- 1 file changed, 166 insertions(+), 5 deletions(-) diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php index b0ccbba8c296f..a2e8715b02233 100644 --- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -13,6 +13,9 @@ use Magento\Framework\Setup\ConsoleLogger; use Symfony\Component\Console\Input\InputOption; use Magento\Setup\Model\ConfigModel; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Helper\QuestionHelper; /** * Command to install Magento application @@ -35,6 +38,16 @@ class InstallCommand extends AbstractSetupCommand */ const INPUT_KEY_USE_SAMPLE_DATA = 'use-sample-data'; + /** + * Parameter indicating command for interactive setup + */ + const INPUT_KEY_INTERACTIVE_SETUP = 'interactive'; + + /** + * Parameter indicating command shortcut for interactive setup + */ + const INPUT_KEY_INTERACTIVE_SETUP_SHORTCUT = 'i'; + /** * Regex for sales_order_increment_prefix validation. */ @@ -109,7 +122,13 @@ protected function configure() null, InputOption::VALUE_NONE, 'Use sample data' - ) + ), + new InputOption( + self::INPUT_KEY_INTERACTIVE_SETUP, + self::INPUT_KEY_INTERACTIVE_SETUP_SHORTCUT, + InputOption::VALUE_NONE, + 'Interactive Magento instalation' + ), ]); $this->setName('setup:install') ->setDescription('Installs the Magento application') @@ -139,12 +158,25 @@ protected function initialize(InputInterface $input, OutputInterface $output) { $inputOptions = $input->getOptions(); - $configOptionsToValidate = []; - foreach ($this->configModel->getAvailableOptions() as $option) { - if (array_key_exists($option->getName(), $inputOptions)) { - $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()]; + if ($inputOptions['interactive']) { + $configOptionsToValidate = $this->interactiveQuestions($input, $output); + } else { + $configOptionsToValidate = []; + foreach ($this->configModel->getAvailableOptions() as $option) { + if (array_key_exists($option->getName(), $inputOptions)) { + $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()]; + } + } + } + + if ($inputOptions['interactive']) { + $command = ''; + foreach ($configOptionsToValidate as $key => $value) { + $command .= " --{$key}={$value}"; } + $output->writeln("<comment>Try re-running command: php bin/magento setup:install{$command}</comment>"); } + $errors = $this->configModel->validate($configOptionsToValidate); $errors = array_merge($errors, $this->adminUser->validate($input)); $errors = array_merge($errors, $this->validate($input)); @@ -177,4 +209,133 @@ public function validate(InputInterface $input) } return $errors; } + + /** + * Runs interactive questions + * + * It will ask users for interactive questionst regarding setup configuration. + * + * @param InputInterface $input + * @param OutputInterface $output + * @return string[] Array of inputs + */ + private function interactiveQuestions(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + $configOptionsToValidate = []; + + foreach ($this->configModel->getAvailableOptions() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option, + true + ); + } + + $output->writeln(""); + + foreach ($this->userConfig->getOptionsList() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option + ); + } + + $output->writeln(""); + + foreach ($this->adminUser->getOptionsList() as $option) { + $configOptionsToValidate[$option->getName()] = $this->askQuestion( + $input, + $output, + $helper, + $option + ); + } + + $output->writeln(""); + + $returnConfigOptionsToValidate = []; + foreach ($configOptionsToValidate as $key => $value) { + if ($value != '') { + $returnConfigOptionsToValidate[$key] = $value; + } + } + + return $returnConfigOptionsToValidate; + } + + /** + * Runs interactive questions + * + * It will ask users for interactive questionst regarding setup configuration. + * + * @param InputInterface $input + * @param OutputInterface $output + * @param QuestionHelper $helper + * @param TextConfigOption|FlagConfigOption\SelectConfigOption $option + * @param Boolean $validateInline + * @return string[] Array of inputs + */ + private function askQuestion( + InputInterface $input, + OutputInterface $output, + QuestionHelper $helper, + $option, + $validateInline = false + ) { + if ($option instanceof \Magento\Framework\Setup\Option\SelectConfigOption) { + if ($option->isValueRequired()) { + $question = new ChoiceQuestion( + $option->getDescription() . '? ', + $option->getSelectOptions(), + $option->getDefault() + ); + } else { + $question = new ChoiceQuestion( + $option->getDescription() . ' [optional]? ', + $option->getSelectOptions(), + $option->getDefault() + ); + } + } else { + if ($option->isValueRequired()) { + $question = new Question( + $option->getDescription() . '? ', + $option->getDefault() + ); + } else { + $question = new Question( + $option->getDescription() . ' [optional]? ', + $option->getDefault() + ); + } + } + + $question->setValidator(function ($answer) use ($option, $validateInline) { + + if ($option instanceof \Magento\Framework\Setup\Option\SelectConfigOption) { + $answer = $option->getSelectOptions()[$answer]; + } + + if ($answer == null) { + $answer = ''; + } else { + $answer = trim($answer); + } + + if ($validateInline) { + $option->validate($answer); + } + + return $answer; + }); + + $value = $helper->ask($input, $output, $question); + + return $value; + } } From c8abb139f8006826989fe4231dabc21fd4a02fd0 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:37 -0600 Subject: [PATCH 114/277] :arrow_double_up: Forwardport of magento/magento2#11337 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11337.patch (created by @thiagolima-bm) based on commit(s): 1. ce4fb9740ec8a362f77110ff9755f871d5187fdd 2. beccd7dd47b6d8421cb50863acb476d9b9bcec4b 3. 84729b581638e00459fcca63bb6d7a1c77f252b9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10908: [2.2.0-rc3.0] Language switcher is broken when using multiple times (reported by @hostep) - magento/magento2#11211: Store View switcher not working on front-end and it throws an error (reported by @latypatil) --- app/code/Magento/Store/Model/Store.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 3dff61b9e7a57..f86788a9a5bcf 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -1182,18 +1182,29 @@ public function getCurrentUrl($fromStore = true) if (!$this->isUseStoreInUrl()) { $storeParsedQuery['___store'] = $this->getCode(); } + if ($fromStore !== false) { $storeParsedQuery['___from_store'] = $fromStore === true ? $this->_storeManager->getStore()->getCode() : $fromStore; } + $requestStringParts = explode('?', $requestString, 2); + $requestStringPath = $requestStringParts[0]; + if (isset($requestStringParts[1])) { + parse_str($requestStringParts[1], $requestString); + } else { + $requestString = []; + } + + $currentUrlQueryParams = array_merge($requestString, $storeParsedQuery); + $currentUrl = $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host'] . (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '') . $storeParsedUrl['path'] - . $requestString - . ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : ''); + . $requestStringPath + . ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : ''); return $currentUrl; } From c6a9b5f7b13554958b547f387637c4288eb60b0b Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:44 -0600 Subject: [PATCH 115/277] :arrow_double_up: Forwardport of magento/magento2#11824 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11824.patch (created by @briscoda) based on commit(s): 1. c5b2a0fac17de702c3ab8c16ff565f33fe2bc792 2. fe44f8f96bf39f57b182188a2af8af4ac0522b7b Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10291: Magento 2 Loading custom option dropdown issue (reported by @NagarajuKasa) --- .../Catalog/view/adminhtml/web/js/custom-options-type.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js index b46d09a7323b1..353c28d0c9421 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js @@ -103,11 +103,6 @@ define([ if (component) { component.visible(visible); - - /*eslint-disable max-depth */ - if (_.isFunction(component.clear)) { - component.clear(); - } } } }, this); From c867b81af936e01a3d8ba8baa7128de06a5b7cd5 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:51 -0600 Subject: [PATCH 116/277] :arrow_double_up: Forwardport of magento/magento2#11732 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11732.patch (created by @p-bystritsky) based on commit(s): 1. 16839952eed2596243ad2f883364d28620f36e28 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#5015: Report error csv doesn't work when trying to import a csv file with semicolon delimiter (reported by @agoeurysky) --- .../Magento/ImportExport/Helper/Report.php | 11 +++++++- .../Magento/ImportExport/Model/Report/Csv.php | 3 ++- .../Test/Unit/Helper/ReportTest.php | 25 +++++++++++++++++++ .../Test/Unit/Model/Report/CsvTest.php | 14 ++++++++++- .../Adminhtml/Import/ValidateTest.php | 23 +++++++++++++---- .../incorrect_catalog_product_comma.csv | 2 ++ .../incorrect_catalog_product_semicolon.csv | 2 ++ 7 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_comma.csv create mode 100644 dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_semicolon.csv diff --git a/app/code/Magento/ImportExport/Helper/Report.php b/app/code/Magento/ImportExport/Helper/Report.php index 708aa2e39df9a..92eaecfc16903 100644 --- a/app/code/Magento/ImportExport/Helper/Report.php +++ b/app/code/Magento/ImportExport/Helper/Report.php @@ -7,7 +7,6 @@ namespace Magento\ImportExport\Helper; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Stdlib\DateTime; use Magento\ImportExport\Model\Import; /** @@ -127,4 +126,14 @@ protected function getFilePath($filename) { return $this->varDirectory->getRelativePath(Import::IMPORT_HISTORY_DIR . $filename); } + + /** + * Get csv delimiter from request. + * + * @return string + */ + public function getDelimiter() + { + return $this->_request->getParam(Import::FIELD_FIELD_SEPARATOR, ','); + } } diff --git a/app/code/Magento/ImportExport/Model/Report/Csv.php b/app/code/Magento/ImportExport/Model/Report/Csv.php index f45910e519847..86c68d7c4df77 100644 --- a/app/code/Magento/ImportExport/Model/Report/Csv.php +++ b/app/code/Magento/ImportExport/Model/Report/Csv.php @@ -130,7 +130,8 @@ protected function createSourceCsvModel($sourceFile) return $this->sourceCsvFactory->create( [ 'file' => $sourceFile, - 'directory' => $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR) + 'directory' => $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR), + 'delimiter' => $this->reportHelper->getDelimiter(), ] ); } diff --git a/app/code/Magento/ImportExport/Test/Unit/Helper/ReportTest.php b/app/code/Magento/ImportExport/Test/Unit/Helper/ReportTest.php index baaf0071e54ea..52b6bdcfc5ee7 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Helper/ReportTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Helper/ReportTest.php @@ -44,12 +44,21 @@ class ReportTest extends \PHPUnit\Framework\TestCase */ protected $report; + /** + * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject + */ + private $requestMock; + /** * Set up */ protected function setUp() { $this->context = $this->createMock(\Magento\Framework\App\Helper\Context::class); + $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) + ->disableOriginalConstructor() + ->getMock(); + $this->context->expects($this->any())->method('getRequest')->willReturn($this->requestMock); $this->timezone = $this->createPartialMock( \Magento\Framework\Stdlib\DateTime\Timezone::class, ['date', 'getConfigTimezone', 'diff', 'format'] @@ -159,4 +168,20 @@ public function testGetReportSize() $result = $this->report->getReportSize('file'); $this->assertNull($result); } + + /** + * Test getDelimiter() take into consideration request param '_import_field_separator'. + */ + public function testGetDelimiter() + { + $testDelimiter = 'some delimiter'; + $this->requestMock->expects($this->once()) + ->method('getParam') + ->with($this->identicalTo(\Magento\ImportExport\Model\Import::FIELD_FIELD_SEPARATOR)) + ->willReturn($testDelimiter); + $this->assertEquals( + $testDelimiter, + $this->report->getDelimiter() + ); + } } diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Report/CsvTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Report/CsvTest.php index a305127f8461b..cf961d033946e 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Report/CsvTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Report/CsvTest.php @@ -45,8 +45,10 @@ class CsvTest extends \PHPUnit\Framework\TestCase protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $testDelimiter = 'some_delimiter'; $this->reportHelperMock = $this->createMock(\Magento\ImportExport\Helper\Report::class); + $this->reportHelperMock->expects($this->any())->method('getDelimiter')->willReturn($testDelimiter); $this->outputCsvFactoryMock = $this->createPartialMock( \Magento\ImportExport\Model\Export\Adapter\CsvFactory::class, @@ -65,7 +67,17 @@ protected function setUp() [23 => 'first error'], [27 => 'second error'] ); - $this->sourceCsvFactoryMock->expects($this->any())->method('create')->willReturn($this->sourceCsvMock); + $this->sourceCsvFactoryMock + ->expects($this->any()) + ->method('create') + ->with( + [ + 'file' => 'some_file_name', + 'directory' => null, + 'delimiter' => $testDelimiter + ] + ) + ->willReturn($this->sourceCsvMock); $this->filesystemMock = $this->createMock(\Magento\Framework\Filesystem::class); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php index f30663a199a67..552a23a0c1fd5 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php @@ -18,10 +18,11 @@ class ValidateTest extends \Magento\TestFramework\TestCase\AbstractBackendContro * @dataProvider validationDataProvider * @param string $fileName * @param string $message + * @param string $delimiter * @backupGlobals enabled * @magentoDbIsolation enabled */ - public function testValidationReturn($fileName, $message) + public function testValidationReturn($fileName, $message, $delimiter) { $validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR; @@ -36,7 +37,7 @@ public function testValidationReturn($fileName, $message) $this->getRequest()->setPostValue('behavior', 'append'); $this->getRequest()->setPostValue(Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy); $this->getRequest()->setPostValue(Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0); - $this->getRequest()->setPostValue('_import_field_separator', ','); + $this->getRequest()->setPostValue('_import_field_separator', $delimiter); /** @var \Magento\TestFramework\App\Filesystem $filesystem */ $filesystem = $this->_objectManager->get(\Magento\Framework\Filesystem::class); @@ -83,12 +84,24 @@ public function validationDataProvider() return [ [ 'file_name' => 'catalog_product.csv', - 'message' => 'File is valid' + 'message' => 'File is valid', + 'delimiter' => ',', ], [ 'file_name' => 'test.txt', - 'message' => '\'txt\' file extension is not supported' - ] + 'message' => '\'txt\' file extension is not supported', + 'delimiter' => ',', + ], + [ + 'file_name' => 'incorrect_catalog_product_comma.csv', + 'message' => 'Download full report', + 'delimiter' => ',', + ], + [ + 'file_name' => 'incorrect_catalog_product_semicolon.csv', + 'message' => 'Download full report', + 'delimiter' => ';', + ], ]; } } diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_comma.csv b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_comma.csv new file mode 100644 index 0000000000000..67114a40b2244 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_comma.csv @@ -0,0 +1,2 @@ +sku,store_view_code,attribute_set_code,product_type,categories,product_websites,name,description,short_description,weight,product_online,tax_class_name,visibility,price,special_price,special_price_from_date,special_price_to_date,url_key,meta_title,meta_keywords,meta_description,base_image,base_image_label,small_image,small_image_label,thumbnail_image,thumbnail_image_label,swatch_image,swatch_image_label,created_at,updated_at,new_from_date,new_to_date,display_product_options_in,map_price,msrp_price,map_enabled,gift_message_available,custom_design,custom_design_from,custom_design_to,custom_layout_update,page_layout,product_options_container,msrp_display_actual_price_type,country_of_manufacture,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,related_skus,related_position,crosssell_skus,crosssell_position,upsell_skus,upsell_position,additional_images,additional_image_labels,hide_from_product_page,custom_options,bundle_price_type,bundle_sku_type,bundle_price_view,bundle_weight_type,bundle_values,bundle_shipment_type,configurable_variations,configurable_variation_labels,associated_skus +Simple,,Default,simple,"Default Category/New",base,Simple,,,,1,"Taxable Goods","Catalo g, Search",100.0000,,,,simple,Simple,Simple,"Simple ",,,,,,,,,"10/25/17, 8:21 AM","10/25/17, 8:21 AM",,,"Block after Info Column",,,,"Use config",,,,,,,,,,100.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,1.0000,1,0,0,0,,,,,,,,,,,,,,,,,,, diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_semicolon.csv b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_semicolon.csv new file mode 100644 index 0000000000000..d0a0b8639cf78 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/_files/incorrect_catalog_product_semicolon.csv @@ -0,0 +1,2 @@ +sku;store_view_code;attribute_set_code;product_type;categories;product_websites;name;description;short_description;weight;product_online;tax_class_name;visibility;price;special_price;special_price_from_date;special_price_to_date;url_key;meta_title;meta_keywords;meta_description;base_image;base_image_label;small_image;small_image_label;thumbnail_image;thumbnail_image_label;swatch_image;swatch_image_label;created_at;updated_at;new_from_date;new_to_date;display_product_options_in;map_price;msrp_price;map_enabled;gift_message_available;custom_design;custom_design_from;custom_design_to;custom_layout_update;page_layout;product_options_container;msrp_display_actual_price_type;country_of_manufacture;additional_attributes;qty;out_of_stock_qty;use_config_min_qty;is_qty_decimal;allow_backorders;use_config_backorders;min_cart_qty;use_config_min_sale_qty;max_cart_qty;use_config_max_sale_qty;is_in_stock;notify_on_stock_below;use_config_notify_stock_qty;manage_stock;use_config_manage_stock;use_config_qty_increments;qty_increments;use_config_enable_qty_inc;enable_qty_increments;is_decimal_divided;website_id;related_skus;related_position;crosssell_skus;crosssell_position;upsell_skus;upsell_position;additional_images;additional_image_labels;hide_from_product_page;custom_options;bundle_price_type;bundle_sku_type;bundle_price_view;bundle_weight_type;bundle_values;bundle_shipment_type;configurable_variations;configurable_variation_labels;associated_skus +Simple;;Default;simple;"Default Category/New";base;Simple;;;;1;"Taxable Goods";"Catalo g, Search";100.0000;;;;simple;Simple;Simple;"Simple ";;;;;;;;;"10/25/17, 8,21 AM";"10/25/17, 8,21 AM";;;"Block after Info Column";;;;"Use config";;;;;;;;;;100.0000;0.0000;1;0;0;1;1.0000;1;10000.0000;1;1;1.0000;1;1;1;1;1.0000;1;0;0;0;;;;;;;;;;;;;;;;;;; From 88a3ad00d3ca97da847531c86bf64055dc1d790b Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:56:58 -0600 Subject: [PATCH 117/277] :arrow_double_up: Forwardport of magento/magento2#11397 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11397.patch (created by @michielgerritsen) based on commit(s): 1. 9ee464c765ac843e10235db9e619cb66e8cbee1f 2. 8e843ade22f640c9626eca9ce1111bd2edef5a3b 3. 69ef9dab06e1971c3db82be80778ece254a50443 4. 466095683102da9c3747a9442dfcb515d7d49c30 5. 567b331303d18e45f1981f63d4e6bb7499f620bc 6. 1ad99bc762d6c4e67f0d7386c5aa04fb4c02702e 7. 0784f5892501bc9a38fc3ac90da2821b2e49f8b9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9566: Status label is wrong in admin (reported by @darkogoles1) --- app/code/Magento/Sales/Model/Order/Config.php | 10 +++- .../Test/Unit/Model/Order/ConfigTest.php | 45 +++++++++++++++-- .../templates/order/view/history.phtml | 2 +- .../Magento/Sales/Model/Order/StatusTest.php | 49 +++++++++++++++++++ .../Magento/Sales/_files/order_status.php | 25 ++++++++++ 5 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Sales/Model/Order/StatusTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_status.php diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 1c7514142678b..e00eda647dc8d 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -122,8 +122,14 @@ public function getStateDefaultStatus($state) */ public function getStatusLabel($code) { - $code = $this->maskStatusForArea($this->state->getAreaCode(), $code); + $area = $this->state->getAreaCode(); + $code = $this->maskStatusForArea($area, $code); $status = $this->orderStatusFactory->create()->load($code); + + if ($area == 'adminhtml') { + return $status->getLabel(); + } + return $status->getStoreLabel(); } @@ -211,7 +217,7 @@ public function getStateStatuses($state, $addLabels = true) foreach ($collection as $item) { $status = $item->getData('status'); if ($addLabels) { - $statuses[$status] = $item->getStoreLabel(); + $statuses[$status] = $this->getStatusLabel($status); } else { $statuses[] = $status; } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index f3a35e485c166..86419c0c905b6 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -23,18 +23,41 @@ class ConfigTest extends \PHPUnit\Framework\TestCase */ protected $orderStatusCollectionFactoryMock; + /** + * @var \Magento\Sales\Model\Order\StatusFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $statusFactoryMock; + + /** + * @var \Magento\Sales\Model\Order\Status + */ + protected $orderStatusModel; + + /** + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + protected function setUp() { - $orderStatusFactory = $this->createMock(\Magento\Sales\Model\Order\StatusFactory::class); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->storeManagerMock = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); + $this->orderStatusModel = $objectManager->getObject(\Magento\Sales\Model\Order\Status::class, [ + 'storeManager' => $this->storeManagerMock, + ]); + $this->statusFactoryMock = $this->getMockBuilder(\Magento\Sales\Model\Order\StatusFactory::class) + ->setMethods(['load', 'create']) + ->getMock(); $this->orderStatusCollectionFactoryMock = $this->createPartialMock( \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory::class, ['create'] ); - $this->salesConfig = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) + $this->salesConfig = $objectManager ->getObject( \Magento\Sales\Model\Order\Config::class, [ - 'orderStatusFactory' => $orderStatusFactory, + 'orderStatusFactory' => $this->statusFactoryMock, 'orderStatusCollectionFactory' => $this->orderStatusCollectionFactoryMock ] ); @@ -147,6 +170,22 @@ public function testGetStatuses($state, $joinLabels, $collectionData, $expectedR ->method('joinStates') ->will($this->returnValue($collectionData)); + $this->statusFactoryMock->method('create') + ->willReturnSelf(); + + $this->statusFactoryMock->method('load') + ->willReturn($this->orderStatusModel); + + $storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); + $storeMock->method('getId') + ->willReturn(1); + + $this->storeManagerMock->method('getStore') + ->with($this->anything()) + ->willReturn($storeMock); + + $this->orderStatusModel->setData('store_labels', [1 => 'Pending label']); + $result = $this->salesConfig->getStateStatuses($state, $joinLabels); $this->assertSame($expectedResult, $result); diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml index 1ec51ffb793c6..6ac6e13a873ed 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml @@ -5,7 +5,7 @@ */ // @codingStandardsIgnoreFile - +/** @var \Magento\Sales\Block\Adminhtml\Order\View\History $block */ ?> <div id="order_history_block" class="edit-order-comments"> <?php if ($block->canAddComment()):?> diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/StatusTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/StatusTest.php new file mode 100644 index 0000000000000..e4b64e77d6e05 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/StatusTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Model\Order; + +/** + * Class ShipmentTest + * @package Magento\Sales\Model\Order + */ +class StatusTest extends \PHPUnit\Framework\TestCase +{ + public function theCorrectLabelIsUsedDependingOnTheAreaProvider() + { + return [ + 'backend label' => [ + 'adminhtml', + 'Example', + ], + 'store view label' => [ + 'frontend', + 'Store view example', + ], + ]; + } + + /** + * In the backend the regular label must be showed. + * + * @param $area + * @param $result + * + * @magentoDataFixture Magento/Sales/_files/order_status.php + * @dataProvider theCorrectLabelIsUsedDependingOnTheAreaProvider + */ + public function testTheCorrectLabelIsUsedDependingOnTheArea($area, $result) + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get(\Magento\Framework\App\State::class)->setAreaCode($area); + + /** @var \Magento\Sales\Model\Order $order */ + $order = $objectManager->create(\Magento\Sales\Model\Order::class); + $order->loadByIncrementId('100000001'); + + $this->assertEquals($result, $order->getStatusLabel()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_status.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status.php new file mode 100644 index 0000000000000..e65dd6b682396 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_status.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/order.php'; + +$orderStatus = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Sales\Model\Order\Status::class +); + +$data = [ + 'status' => 'example', + 'label' => 'Example', + 'store_labels' => [ + 1 => 'Store view example', + ] +]; + +$orderStatus->setData($data)->setStatus('example'); +$orderStatus->save(); + +$order->setStatus('example'); +$order->save(); From d87e316a2d6ee55debe2e712359adba8cb70fdb2 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:06 -0600 Subject: [PATCH 118/277] :arrow_double_up: Forwardport of magento/magento2#11817 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11817.patch (created by @p-bystritsky) based on commit(s): 1. 550434e94fa3b8d5ab5ece8064fee3ab539bf4f0 2. 566cc7fef2ab33d2b2ea296b2e4e8a83abf0838e 3. f0be8db3a5e35c8ab69748e0990790fc0fb146a0 4. de5990a2ef32135c2b774806373c45f5e5c43550 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#8970: Cannot assign products to categories not under tree root (reported by @marius-bica) --- .../Model/ProductScopeRewriteGenerator.php | 5 +- .../ProductScopeRewriteGeneratorTest.php | 68 ++++++++++++++----- .../_files/product_with_category.php | 2 +- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php index 81bbb08b0f39e..9c5c37b51f0b2 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php @@ -207,8 +207,9 @@ public function generateForSpecificStoreView($storeId, $productCategories, Produ */ public function isCategoryProperForGenerating(Category $category, $storeId) { - if ($category->getParentId() != \Magento\Catalog\Model\Category::TREE_ROOT_ID) { - list(, $rootCategoryId) = $category->getParentIds(); + $parentIds = $category->getParentIds(); + if (count($parentIds) >= 2) { + $rootCategoryId = $parentIds[1]; return $rootCategoryId == $this->storeManager->getStore($storeId)->getRootCategoryId(); } return false; diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php index 48399d5ef612b..06be01445df4c 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php @@ -47,6 +47,9 @@ class ProductScopeRewriteGeneratorTest extends \PHPUnit\Framework\TestCase /** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */ private $serializer; + /** @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject */ + private $categoryMock; + public function setUp() { $this->serializer = $this->createMock(\Magento\Framework\Serialize\Serializer\Json::class); @@ -83,6 +86,10 @@ function ($value) { $this->storeViewService = $this->getMockBuilder(\Magento\CatalogUrlRewrite\Service\V1\StoreViewService::class) ->disableOriginalConstructor()->getMock(); $this->storeManager = $this->createMock(StoreManagerInterface::class); + $storeRootCategoryId = 2; + $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)->disableOriginalConstructor()->getMock(); + $store->expects($this->any())->method('getRootCategoryId')->will($this->returnValue($storeRootCategoryId)); + $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); $mergeDataProviderFactory = $this->createPartialMock( \Magento\UrlRewrite\Model\MergeDataProviderFactory::class, ['create'] @@ -103,6 +110,7 @@ function ($value) { 'mergeDataProviderFactory' => $mergeDataProviderFactory ] ); + $this->categoryMock = $this->getMockBuilder(Category::class)->disableOriginalConstructor()->getMock(); } public function testGenerationForGlobalScope() @@ -112,12 +120,6 @@ public function testGenerationForGlobalScope() $product->expects($this->any())->method('getStoreIds')->will($this->returnValue([1])); $this->storeViewService->expects($this->once())->method('doesEntityHaveOverriddenUrlKeyForStore') ->will($this->returnValue(false)); - $categoryMock = $this->getMockBuilder(Category::class) - ->disableOriginalConstructor() - ->getMock(); - $categoryMock->expects($this->once()) - ->method('getParentId') - ->willReturn(1); $this->initObjectRegistryFactory([]); $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite([], $this->serializer); $canonical->setRequestPath('category-1') @@ -149,25 +151,21 @@ public function testGenerationForGlobalScope() 'category-3_3' => $current, 'category-4_4' => $anchorCategories ], - $this->productScopeGenerator->generateForGlobalScope([$categoryMock], $product, 1) + $this->productScopeGenerator->generateForGlobalScope([$this->categoryMock], $product, 1) ); } public function testGenerationForSpecificStore() { + $storeRootCategoryId = 2; + $category_id = 4; $product = $this->createMock(\Magento\Catalog\Model\Product::class); $product->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); $product->expects($this->never())->method('getStoreIds'); - $storeRootCategoryId = 'root-for-store-id'; - $category = $this->createMock(\Magento\Catalog\Model\Category::class); - $category->expects($this->any())->method('getParentIds') + $this->categoryMock->expects($this->any())->method('getParentIds') ->will($this->returnValue(['root-id', $storeRootCategoryId])); - $category->expects($this->any())->method('getParentId')->will($this->returnValue('parent_id')); - $category->expects($this->any())->method('getId')->will($this->returnValue('category_id')); - $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)->disableOriginalConstructor()->getMock(); - $store->expects($this->any())->method('getRootCategoryId')->will($this->returnValue($storeRootCategoryId)); - $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); - $this->initObjectRegistryFactory([$category]); + $this->categoryMock->expects($this->any())->method('getId')->will($this->returnValue($category_id)); + $this->initObjectRegistryFactory([$this->categoryMock]); $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite([], $this->serializer); $canonical->setRequestPath('category-1') ->setStoreId(1); @@ -184,7 +182,7 @@ public function testGenerationForSpecificStore() $this->assertEquals( ['category-1_1' => $canonical], - $this->productScopeGenerator->generateForSpecificStoreView(1, [$category], $product, 1) + $this->productScopeGenerator->generateForSpecificStoreView(1, [$this->categoryMock], $product, 1) ); } @@ -212,4 +210,40 @@ protected function initObjectRegistryFactory($entities) ->with(['entities' => $entities]) ->will($this->returnValue($objectRegistry)); } + + /** + * Test the possibility of url rewrite generation. + * + * @param array $parentIds + * @param bool $expectedResult + * @dataProvider isCategoryProperForGeneratingDataProvider + */ + public function testIsCategoryProperForGenerating($parentIds, $expectedResult) + { + $storeId = 1; + $this->categoryMock->expects(self::any())->method('getParentIds')->willReturn($parentIds); + $result = $this->productScopeGenerator->isCategoryProperForGenerating( + $this->categoryMock, + $storeId + ); + self::assertEquals( + $expectedResult, + $result + ); + } + + /** + * Data provider for testIsCategoryProperForGenerating. + * + * @return array + */ + public function isCategoryProperForGeneratingDataProvider() + { + return [ + [['0'], false], + [['1'], false], + [['1', '2'], true], + [['1', '3'], false], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_with_category.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_with_category.php index 2dc1713a5bb0d..aa753a3509987 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_with_category.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_with_category.php @@ -79,4 +79,4 @@ /** @var CategoryLinkManagementInterface $linkManagement */ $linkManagement = $objectManager->get(CategoryLinkManagementInterface::class); -$linkManagement->assignProductToCategories($product->getSku(), [$category->getEntityId()]); +$linkManagement->assignProductToCategories($product->getSku(), [Category::TREE_ROOT_ID, $category->getEntityId()]); From c76b04c9acde117c1021270500c8ded6954f6f05 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:14 -0600 Subject: [PATCH 119/277] :arrow_double_up: Forwardport of magento/magento2#11917 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11917.patch (created by @lewisvoncken) based on commit(s): 1. 80ba9c898fab57fba51ce7363e3afb883a83daa4 --- app/code/Magento/Customer/etc/webapi.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml index c536e26bcc82a..f9ef3a5f88228 100644 --- a/app/code/Magento/Customer/etc/webapi.xml +++ b/app/code/Magento/Customer/etc/webapi.xml @@ -200,6 +200,12 @@ <resource ref="anonymous"/> </resources> </route> + <route url="/V1/customers/resetPassword" method="POST"> + <service class="Magento\Customer\Api\AccountManagementInterface" method="resetPassword"/> + <resources> + <resource ref="anonymous"/> + </resources> + </route> <route url="/V1/customers/:customerId/confirm" method="GET"> <service class="Magento\Customer\Api\AccountManagementInterface" method="getConfirmationStatus"/> <resources> From 5ae21099aaa19699525c798f9ac0ef10db47b311 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:21 -0600 Subject: [PATCH 120/277] :arrow_double_up: Forwardport of magento/magento2#11949 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11949.patch (created by @nmalevanec) based on commit(s): 1. fbbebdc55413f7266c55085d8f989f128535378a Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11868: "Add Products" button has been duplicated after the customer group was changed (reported by @OleksiyOleksiyovych) --- .../Sales/view/adminhtml/web/order/create/scripts.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 629b7ac93ecee..1f82af91cbd7d 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -55,7 +55,8 @@ define([ } }); - var searchButton = new ControlButton(jQuery.mage.__('Add Products')), + var searchButtonId = 'add_products', + searchButton = new ControlButton(jQuery.mage.__('Add Products'), searchButtonId), searchAreaId = this.getAreaId('search'); searchButton.onClick = function() { $(searchAreaId).show(); @@ -74,7 +75,7 @@ define([ this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) { proceed(); - if ($(searchAreaId) && !$(searchAreaId).visible()) { + if ($(searchAreaId) && !$(searchAreaId).visible() && !$(searchButtonId)) { this.addControlButton(searchButton); } }); @@ -1383,12 +1384,15 @@ define([ _label: '', _node: null, - initialize: function(label){ + initialize: function(label, id){ this._label = label; this._node = new Element('button', { 'class': 'action-secondary action-add', 'type': 'button' }); + if (typeof id !== 'undefined') { + this._node.setAttribute('id', id) + } }, onClick: function(){ From b529c168f12adf427967e391d82472b97dab3c2d Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:35 -0600 Subject: [PATCH 121/277] :arrow_double_up: Forwardport of magento/magento2#11869 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11869.patch (created by @neeta-wagento) based on commit(s): 1. 9d3be732a88884a66d667b443b3dc1655ddd0721 2. 18ac9e57a0fee7e3d70ffed3f8469a0ba7272911 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#8954: Error While Trying To Load Quote Item Collection Using Magento\Quote\Model\ResourceModel\QuoteItem\Collection::getItems() (reported by @rendyep) --- .../Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php b/app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php index 52c33e98bbc73..6a04c34a23ec4 100644 --- a/app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php +++ b/app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php @@ -101,7 +101,7 @@ protected function _construct() */ public function getStoreId() { - return (int)$this->_quote->getStoreId(); + return (int)$this->_productCollectionFactory->create()->getStoreId(); } /** From c25b34ea171c6f52f8b4325969e1e1a21d9e0580 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:42 -0600 Subject: [PATCH 122/277] :arrow_double_up: Forwardport of magento/magento2#11405 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11405.patch (created by @gabrielqs-redstage) based on commit(s): 1. 0f4b69493b125c8113b43dac72db414e223a5d51 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9028: You cannot set a 303 redirect response using a result factory (reported by @jameshalsall) --- .../Framework/Controller/Result/Redirect.php | 18 +++++-- .../Test/Unit/Result/RedirectTest.php | 52 +++++++++++++------ 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/lib/internal/Magento/Framework/Controller/Result/Redirect.php b/lib/internal/Magento/Framework/Controller/Result/Redirect.php index d68caeb3e4409..120b18d873cff 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Redirect.php +++ b/lib/internal/Magento/Framework/Controller/Result/Redirect.php @@ -9,6 +9,8 @@ use Magento\Framework\App; use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface; use Magento\Framework\Controller\AbstractResult; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\UrlInterface; /** * In many cases controller actions may result in a redirect @@ -18,13 +20,14 @@ */ class Redirect extends AbstractResult { + /** - * @var \Magento\Framework\App\Response\RedirectInterface + * @var RedirectInterface */ protected $redirect; /** - * @var \Magento\Framework\UrlInterface + * @var UrlInterface */ protected $urlBuilder; @@ -37,11 +40,11 @@ class Redirect extends AbstractResult * Constructor * * @param App\Response\RedirectInterface $redirect - * @param \Magento\Framework\UrlInterface $urlBuilder + * @param UrlInterface $urlBuilder */ public function __construct( App\Response\RedirectInterface $redirect, - \Magento\Framework\UrlInterface $urlBuilder + UrlInterface $urlBuilder ) { $this->redirect = $redirect; $this->urlBuilder = $urlBuilder; @@ -70,6 +73,7 @@ public function setRefererOrBaseUrl() } /** + * URL Setter * @param string $url * @return $this */ @@ -97,7 +101,11 @@ public function setPath($path, array $params = []) */ protected function render(HttpResponseInterface $response) { - $response->setRedirect($this->url); + if (empty($this->httpResponseCode)) { + $response->setRedirect($this->url); + } else { + $response->setRedirect($this->url, $this->httpResponseCode); + } return $this; } } diff --git a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php index 0295f0713d429..65e7ee489e84c 100644 --- a/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php +++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectTest.php @@ -6,10 +6,13 @@ namespace Magento\Framework\Controller\Test\Unit\Result; -use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface; +use \PHPUnit\Framework\TestCase; +use \Magento\Framework\App\Response\HttpInterface as HttpResponseInterface; +use \Magento\Framework\App\Response\RedirectInterface; use \Magento\Framework\Controller\Result\Redirect; +use \Magento\Framework\UrlInterface; -class RedirectTest extends \PHPUnit\Framework\TestCase +class RedirectTest extends TestCase { /** @var \Magento\Framework\Controller\Result\Redirect */ protected $redirect; @@ -28,9 +31,9 @@ class RedirectTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->redirectInterface = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class); - $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class); - $this->urlInterface = $this->createMock(\Magento\Framework\UrlInterface::class); + $this->redirectInterface = $this->createMock(RedirectInterface::class); + $this->urlBuilder = $this->createMock(UrlInterface::class); + $this->urlInterface = $this->createMock(UrlInterface::class); $this->response = $this->createMock(HttpResponseInterface::class); $this->redirect = new Redirect($this->redirectInterface, $this->urlInterface); } @@ -39,7 +42,7 @@ public function testSetRefererUrl() { $this->redirectInterface->expects($this->once())->method('getRefererUrl'); $this->assertInstanceOf( - \Magento\Framework\Controller\Result\Redirect::class, + Redirect::class, $this->redirect->setRefererUrl() ); } @@ -48,7 +51,7 @@ public function testSetRefererOrBaseUrl() { $this->redirectInterface->expects($this->once())->method('getRedirectUrl'); $this->assertInstanceOf( - \Magento\Framework\Controller\Result\Redirect::class, + Redirect::class, $this->redirect->setRefererOrBaseUrl() ); } @@ -56,7 +59,7 @@ public function testSetRefererOrBaseUrl() public function testSetUrl() { $url = 'http://test.com'; - $this->assertInstanceOf(\Magento\Framework\Controller\Result\Redirect::class, $this->redirect->setUrl($url)); + $this->assertInstanceOf(Redirect::class, $this->redirect->setUrl($url)); } public function testSetPath() @@ -67,17 +70,36 @@ public function testSetPath() $this->returnValue($params) ); $this->assertInstanceOf( - \Magento\Framework\Controller\Result\Redirect::class, + Redirect::class, $this->redirect->setPath($path, $params) ); } - public function testRender() + public function httpRedirectResponseStatusCodes() { - $this->response->expects($this->once())->method('setRedirect'); - $this->assertInstanceOf( - \Magento\Framework\Controller\Result\Redirect::class, - $this->redirect->renderResult($this->response) - ); + return [ + [302, null], + [302, 302], + [303, 303] + ]; + } + + /** + * @param int $expectedStatusCode + * @param int|null $actualStatusCode + * @dataProvider httpRedirectResponseStatusCodes + */ + public function testRender($expectedStatusCode, $actualStatusCode) + { + $url = 'http://test.com'; + $this->redirect->setUrl($url); + $this->redirect->setHttpResponseCode($actualStatusCode); + + $this->response + ->expects($this->once()) + ->method('setRedirect') + ->with($url, $expectedStatusCode); + + $this->redirect->renderResult($this->response); } } From 0742a0b9ab83ae0ea09d93028be5a5ae81923a72 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:50 -0600 Subject: [PATCH 123/277] :arrow_double_up: Forwardport of magento/magento2#11770 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11770.patch (created by @euronetzrt) based on commit(s): 1. 3f108f6874bc4be2bdcd4014c55b3d3a1bd1e33d 2. a8aaaa55cd7caf2cec9c2152013ba96873df60c7 3. cd0ef23dedb55172bbb68551013caf6fc2d21356 4. e8877c39933ec14146884883d30d6d1192d723f4 --- .../adminhtml/templates/catalog/product/attribute/js.phtml | 6 ++++++ .../Swatches/view/adminhtml/web/js/product-attributes.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml index 69bc847c30f46..8a5f1919f78be 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml @@ -196,9 +196,11 @@ function switchDefaultValueField() <?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?> case '<?= /* @escapeNotVerified */ $type ?>': + var isFrontTabHidden = false; <?php foreach ($fields as $one): ?> <?php if ($one == '_front_fieldset'): ?> getFrontTab().hide(); + isFrontTabHidden = true; <?php elseif ($one == '_default_value'): ?> defaultValueTextVisibility = defaultValueTextareaVisibility = @@ -210,6 +212,10 @@ function switchDefaultValueField() setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false); <?php endif; ?> <?php endforeach; ?> + + if (!isFrontTabHidden){ + getFrontTab().show(); + } break; <?php endforeach; ?> diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js index 14cf1ebfe538f..1187e6bc4fdaa 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js @@ -182,6 +182,7 @@ define([ useProductImageForSwatch = false, defaultValueUpdateImage = false, optionDefaultInputType = '', + isFrontTabHidden = false, thing = this; if (!this.frontendInput.length) { @@ -247,6 +248,7 @@ define([ switch (option) { case '_front_fieldset': thing.tabsFront.hide(); + isFrontTabHidden = true; break; case '_default_value': @@ -263,6 +265,11 @@ define([ thing.setRowVisibility($('#' + option), false); } }); + + if (!isFrontTabHidden) { + thing.tabsFront.show(); + } + } else { this.tabsFront.show(); this.showDefaultRows(); From 45f4535e8d1eab421822be4b2aeb34c132b4be75 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:57:57 -0600 Subject: [PATCH 124/277] :arrow_double_up: Forwardport of magento/magento2#12013 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12013.patch (created by @crissanclick) based on commit(s): 1. 38921e7b5a61ff5c0c890b37eb9cbeba283a3f0f 2. e0ce5aaa5a0ce5f3faf16c8eec8b7bfe6e788c95 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#7995: If you leave as default, shipping lines disappear (reported by @rosandrest) --- app/code/Magento/Customer/etc/adminhtml/system.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index daf9240677588..fa1566af0c943 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -198,7 +198,8 @@ <field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> <label>Number of Lines in a Street Address</label> <backend_model>Magento\Customer\Model\Config\Backend\Address\Street</backend_model> - <comment>Leave empty for default (2). Valid range: 1-4</comment> + <comment>Valid range: 1-4</comment> + <validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate> </field> <field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Show Prefix</label> From 6c1e5beacb92c12a87929c07981ca3a9ad5be79d Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:06 -0600 Subject: [PATCH 125/277] :arrow_double_up: Forwardport of magento/magento2#11785 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11785.patch (created by @gomencal) based on commit(s): 1. ec08353b40fb7dc9fe1a4c859516f4090a552883 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#8846: Attribute option value uniqueness is not checked if created via REST Api (reported by @hilrob) --- .../Model/Product/Attribute/OptionManagement.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php index a840498dfbf2b..f2039a5002dcc 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php @@ -40,6 +40,17 @@ public function getItems($attributeCode) */ public function add($attributeCode, $option) { + /** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $currentOptions */ + $currentOptions = $this->getItems($attributeCode); + if (is_array($currentOptions)) { + array_walk($currentOptions, function (&$attributeOption) { + /** @var \Magento\Eav\Api\Data\AttributeOptionInterface $attributeOption */ + $attributeOption = $attributeOption->getLabel(); + }); + if (in_array($option->getLabel(), $currentOptions)) { + return false; + } + } return $this->eavOptionManagement->add( \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeCode, From d9eec50f60f24f4e8eb3da92384ddff907dfbabf Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:13 -0600 Subject: [PATCH 126/277] :arrow_double_up: Forwardport of magento/magento2#11993 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11993.patch (created by @RomaKis) based on commit(s): 1. c1136268d36cc70515c332ca81b7a6a7ec893717 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11700: "Something Went Wrong" error for limited access admin user (reported by @expgabe) --- app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php | 5 ++++- .../Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php index 18fd5eea2f5f2..4df9198c0b95d 100644 --- a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php +++ b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php @@ -79,7 +79,10 @@ private function validateAclResource($dataProviderConfigData) { if (isset($dataProviderConfigData['aclResource'])) { if (!$this->_authorization->isAllowed($dataProviderConfigData['aclResource'])) { - $this->_redirect('admin/denied'); + if (!$this->_request->isAjax()) { + $this->_redirect('admin/denied'); + } + return false; } } diff --git a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php index b1ef1dd9b5249..d41c90bfa760a 100644 --- a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php +++ b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php @@ -208,6 +208,13 @@ public function testExecuteAjaxRequestWithoutPermissions(array $dataProviderConf $this->requestMock->expects($this->any()) ->method('getParams') ->willReturn([]); + if ($isAllowed === false) { + $this->requestMock->expects($this->once()) + ->method('isAjax') + ->willReturn(true); + } + $this->responseMock->expects($this->never()) + ->method('setRedirect'); $this->responseMock->expects($this->any()) ->method('appendBody') ->with($renderedData); From 34b8ad8da0ceb68903a2034557fe32a87fc53d33 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:21 -0600 Subject: [PATCH 127/277] :arrow_double_up: Forwardport of magento/magento2#11879 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11879.patch (created by @nemesis-back) based on commit(s): 1. 3afed3d030b9dc29936de2aa775a406e999832bc Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#4004: Newsletter Subscriber create-date not set, and change_status_at broken (reported by @fvschie) --- .../Magento/Newsletter/Model/Subscriber.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 595c728117749..f54fd06864f80 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -94,6 +94,12 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel */ protected $_customerSession; + /** + * Date + * @var \Magento\Framework\Stdlib\DateTime\DateTime + */ + private $dateTime; + /** * Store manager * @@ -131,6 +137,7 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime * @param CustomerRepositoryInterface $customerRepository * @param AccountManagementInterface $customerAccountManagement * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation @@ -147,6 +154,7 @@ public function __construct( \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, + \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, CustomerRepositoryInterface $customerRepository, AccountManagementInterface $customerAccountManagement, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, @@ -159,6 +167,7 @@ public function __construct( $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_customerSession = $customerSession; + $this->dateTime = $dateTime; $this->customerRepository = $customerRepository; $this->customerAccountManagement = $customerAccountManagement; $this->inlineTranslation = $inlineTranslation; @@ -812,4 +821,18 @@ public function getSubscriberFullName() } return $name; } + + /** + * Set date of last changed status + * + * @return $this + */ + public function beforeSave() + { + parent::beforeSave(); + if ($this->dataHasChangedFor('subscriber_status')) { + $this->setChangeStatusAt($this->dateTime->gmtDate()); + } + return $this; + } } From 2c96f79d70e2a8758744c624bcc73b065ff6c06f Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:28 -0600 Subject: [PATCH 128/277] :arrow_double_up: Forwardport of magento/magento2#11556 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11556.patch (created by @joni-jones) based on commit(s): 1. fea77c70d62e9c9259596dd0a96a4993f200380b Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10583: Checkout place order exception when using a new address (reported by @mbijnsdorp) --- app/code/Magento/Quote/Model/Quote.php | 2 +- .../Magento/Quote/Model/QuoteTest.php | 2 +- .../Reflection/Test/Unit/Fixture/TSample.php | 25 +++++++ .../Test/Unit/Fixture/TSampleInterface.php | 21 ++++++ .../Test/Unit/TypeProcessorTest.php | 34 ++++++++- .../Framework/Reflection/TypeProcessor.php | 73 ++++++++++++++----- 6 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSample.php create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSampleInterface.php diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php index 18fa41e2beb58..5039af9a9081d 100644 --- a/app/code/Magento/Quote/Model/Quote.php +++ b/app/code/Magento/Quote/Model/Quote.php @@ -1046,7 +1046,7 @@ public function addCustomerAddress(\Magento\Customer\Api\Data\AddressInterface $ public function updateCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer) { $quoteCustomer = $this->getCustomer(); - $this->dataObjectHelper->mergeDataObjects(get_class($quoteCustomer), $quoteCustomer, $customer); + $this->dataObjectHelper->mergeDataObjects(CustomerInterface::class, $quoteCustomer, $customer); $this->setCustomer($quoteCustomer); return $this; } diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php index 258b14bf6e0d3..ecd8b62b122d4 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php @@ -393,7 +393,7 @@ protected function _getCustomerDataArray() \Magento\Customer\Model\Data\Customer::DOB => '2014-02-03 00:00:00', \Magento\Customer\Model\Data\Customer::EMAIL => 'qa@example.com', \Magento\Customer\Model\Data\Customer::FIRSTNAME => 'Joe', - \Magento\Customer\Model\Data\Customer::GENDER => 'Male', + \Magento\Customer\Model\Data\Customer::GENDER => 0, \Magento\Customer\Model\Data\Customer::GROUP_ID => \Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID, \Magento\Customer\Model\Data\Customer::ID => 1, diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSample.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSample.php new file mode 100644 index 0000000000000..1d78f9ed0a7d8 --- /dev/null +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSample.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Reflection\Test\Unit\Fixture; + +class TSample implements TSampleInterface +{ + /** + * @inheritdoc + */ + public function getPropertyName() + { + return ''; + } + + /** + * @inheritdoc + */ + public function getName() + { + return ''; + } +} diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSampleInterface.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSampleInterface.php new file mode 100644 index 0000000000000..db2fbd19736bf --- /dev/null +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/TSampleInterface.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Reflection\Test\Unit\Fixture; + +interface TSampleInterface +{ + /** + * Returns property name for a sample. + * + * @return string + */ + public function getPropertyName(); + + /** + * Doc block without return tag. + */ + public function getName(); +} diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 71e0834e784c0..9ee4d148d2fb5 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -6,8 +6,9 @@ // @codingStandardsIgnoreStart namespace Magento\Framework\Reflection\Test\Unit; -use Zend\Code\Reflection\ClassReflection; use Magento\Framework\Exception\SerializationException; +use Magento\Framework\Reflection\Test\Unit\Fixture\TSample; +use Zend\Code\Reflection\ClassReflection; /** * Type processor Test @@ -260,4 +261,35 @@ public function testGetOperationName() { $this->assertEquals("resNameMethodName", $this->_typeProcessor->getOperationName("resName", "methodName")); } + + /** + * Checks a case when method has only `@inheritdoc` annotation. + */ + public function testGetReturnTypeWithInheritDocBlock() + { + $expected = [ + 'type' => 'string', + 'isRequired' => true, + 'description' => null, + 'parameterCount' => 0 + ]; + + $classReflection = new ClassReflection(TSample::class); + $methodReflection = $classReflection->getMethod('getPropertyName'); + + self::assertEquals($expected, $this->_typeProcessor->getGetterReturnType($methodReflection)); + } + + /** + * Checks a case when method and parent interface don't have `@return` annotation. + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Getter return type must be specified using @return annotation. See Magento\Framework\Reflection\Test\Unit\Fixture\TSample::getName() + */ + public function testGetReturnTypeWithoutReturnTag() + { + $classReflection = new ClassReflection(TSample::class); + $methodReflection = $classReflection->getMethod('getName'); + $this->_typeProcessor->getGetterReturnType($methodReflection); + } } diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index 5d6054056d35e..74c1bc95b208b 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -8,6 +8,7 @@ use Magento\Framework\Exception\SerializationException; use Magento\Framework\Phrase; use Zend\Code\Reflection\ClassReflection; +use Zend\Code\Reflection\DocBlock\Tag\ReturnTag; use Zend\Code\Reflection\DocBlockReflection; use Zend\Code\Reflection\MethodReflection; use Zend\Code\Reflection\ParameterReflection; @@ -16,6 +17,7 @@ * Type processor of config reader properties * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) this suppress MUST be removed after removing deprecated methods. */ class TypeProcessor { @@ -275,22 +277,7 @@ protected function dataObjectGetterDescriptionToFieldDescription($shortDescripti */ public function getGetterReturnType($methodReflection) { - $methodDocBlock = $methodReflection->getDocBlock(); - if (!$methodDocBlock) { - throw new \InvalidArgumentException( - "Each getter must have description with @return annotation. " - . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodReflection->getName()}()" - ); - } - $returnAnnotations = $methodDocBlock->getTags('return'); - if (empty($returnAnnotations)) { - throw new \InvalidArgumentException( - "Getter return type must be specified using @return annotation. " - . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodReflection->getName()}()" - ); - } - /** @var \Zend\Code\Reflection\DocBlock\Tag\ReturnTag $returnAnnotation */ - $returnAnnotation = current($returnAnnotations); + $returnAnnotation = $this->getMethodReturnAnnotation($methodReflection); $types = $returnAnnotation->getTypes(); $returnType = current($types); $nullable = in_array('null', $types); @@ -362,7 +349,7 @@ public function isTypeSimple($type) self::NORMALIZED_INT_TYPE, self::NORMALIZED_FLOAT_TYPE, self::NORMALIZED_DOUBLE_TYPE, - self::NORMALIZED_BOOLEAN_TYPE + self::NORMALIZED_BOOLEAN_TYPE, ] ); } @@ -708,4 +695,56 @@ private function getNormalizedType($type) } return $type; } + + /** + * Parses `return` annotation from reflection method. + * + * @param MethodReflection $methodReflection + * @return ReturnTag + * @throws \InvalidArgumentException if doc block is empty or `@return` annotation doesn't exist + */ + private function getMethodReturnAnnotation(MethodReflection $methodReflection) + { + $methodName = $methodReflection->getName(); + $returnAnnotations = $this->getReturnFromDocBlock($methodReflection); + if (empty($returnAnnotations)) { + // method can inherit doc block from implemented interface, like for interceptors + $implemented = $methodReflection->getDeclaringClass()->getInterfaces(); + /** @var ClassReflection $parentClassReflection */ + foreach ($implemented as $parentClassReflection) { + if ($parentClassReflection->hasMethod($methodName)) { + $returnAnnotations = $this->getReturnFromDocBlock( + $parentClassReflection->getMethod($methodName) + ); + break; + } + } + // throw an exception if even implemented interface doesn't have return annotations + if (empty($returnAnnotations)) { + throw new \InvalidArgumentException( + "Getter return type must be specified using @return annotation. " + . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodName}()" + ); + } + } + return $returnAnnotations; + } + + /** + * Parses `return` annotation from doc block. + * + * @param MethodReflection $methodReflection + * @return ReturnTag + */ + private function getReturnFromDocBlock(MethodReflection $methodReflection) + { + $methodDocBlock = $methodReflection->getDocBlock(); + if (!$methodDocBlock) { + throw new \InvalidArgumentException( + "Each getter must have a doc block. " + . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodReflection->getName()}()" + ); + } + return current($methodDocBlock->getTags('return')); + } } From 0a030299e15ddc7b341be846fed7b470bb828c4b Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:36 -0600 Subject: [PATCH 129/277] :arrow_double_up: Forwardport of magento/magento2#12018 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12018.patch (created by @emiprotech) based on commit(s): 1. e2c0732571ef3b636d9238ee618c8282f1c04ab2 2. aa1c530d78f6a002977702f4adc129d3af1538a5 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12017: Cross-sell product placeholder image size issue (reported by @emiprotech) --- app/design/frontend/Magento/blank/etc/view.xml | 6 +++--- app/design/frontend/Magento/luma/etc/view.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/design/frontend/Magento/blank/etc/view.xml b/app/design/frontend/Magento/blank/etc/view.xml index c0c40250158c0..8264e3111de88 100644 --- a/app/design/frontend/Magento/blank/etc/view.xml +++ b/app/design/frontend/Magento/blank/etc/view.xml @@ -12,9 +12,9 @@ <width>140</width> <height>140</height> </image> - <image id="cart_cross_sell_products" type="thumbnail"> - <width>152</width> - <height>188</height> + <image id="cart_cross_sell_products" type="small_image"> + <width>240</width> + <height>300</height> </image> <image id="cart_page_product_thumbnail" type="small_image"> <width>110</width> diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml index f688c232b93c9..349224a34022c 100644 --- a/app/design/frontend/Magento/luma/etc/view.xml +++ b/app/design/frontend/Magento/luma/etc/view.xml @@ -12,9 +12,9 @@ <width>140</width> <height>140</height> </image> - <image id="cart_cross_sell_products" type="thumbnail"> - <width>200</width> - <height>248</height> + <image id="cart_cross_sell_products" type="small_image"> + <width>240</width> + <height>300</height> </image> <image id="cart_page_product_thumbnail" type="small_image"> <width>165</width> From fc38208d3908d6acdd28fb82bae9cde8102cfe90 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:43 -0600 Subject: [PATCH 130/277] :arrow_double_up: Forwardport of magento/magento2#11947 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11947.patch (created by @tkotosz) based on commit(s): 1. fadbf97e150b6561e6db9d17fb37bf46e1cbfe6f --- .../Model/Entity/Attribute/Backend/JsonEncoded.php | 2 +- .../Entity/Attribute/Backend/JsonEncodedTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/JsonEncoded.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/JsonEncoded.php index f47c73f01f238..5ea8e97e7004f 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/JsonEncoded.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/JsonEncoded.php @@ -58,7 +58,7 @@ public function afterLoad($object) { parent::afterLoad($object); $attrCode = $this->getAttribute()->getAttributeCode(); - $object->setData($attrCode, $this->jsonSerializer->unserialize($object->getData($attrCode))); + $object->setData($attrCode, $this->jsonSerializer->unserialize($object->getData($attrCode) ?: '{}')); return $this; } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/JsonEncodedTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/JsonEncodedTest.php index 96846c0d1fe56..d94d25e7fd180 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/JsonEncodedTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/JsonEncodedTest.php @@ -95,4 +95,18 @@ public function testAfterLoad() $this->model->afterLoad($product); $this->assertEquals([1, 2, 3], $product->getData('json_encoded')); } + + /** + * Test after load handler with null attribute value + */ + public function testAfterLoadWithNullAttributeValue() + { + $product = new \Magento\Framework\DataObject( + [ + 'json_encoded' => null + ] + ); + $this->model->afterLoad($product); + $this->assertEquals([], $product->getData('json_encoded')); + } } From 7734bd1b72aea5786df82bfa47a4b04a7ec09fba Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:49 -0600 Subject: [PATCH 131/277] :arrow_double_up: Forwardport of magento/magento2#11719 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11719.patch (created by @nmalevanec) based on commit(s): 1. 2bbad00ea2d09e525c3082878ca5bb6bc862fe5a 2. ec0210e602a503fe5c4ec097e336381ec7a8bc2e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10920: Sku => Entity_id relations are fetched inefficiently when inserting attributes values during product import (reported by @diwipl) --- .../Model/Import/Product.php | 17 ++++++--------- .../Test/Unit/Model/Import/ProductTest.php | 21 +------------------ 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index e05681212e84f..0a736890e8fe8 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -5,19 +5,18 @@ */ namespace Magento\CatalogImportExport\Model\Import; +use Magento\Catalog\Model\Config as CatalogConfig; use Magento\Catalog\Model\Product\Visibility; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\App\ObjectManager; +use Magento\Framework\Filesystem; use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor; use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface; use Magento\Framework\Stdlib\DateTime; -use Magento\Framework\Filesystem; use Magento\ImportExport\Model\Import; use Magento\ImportExport\Model\Import\Entity\AbstractEntity; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingError; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; -use Magento\Catalog\Model\Config as CatalogConfig; /** * Import entity product model @@ -1298,20 +1297,15 @@ protected function _saveLinks() */ protected function _saveProductAttributes(array $attributesData) { + $linkField = $this->getProductEntityLinkField(); foreach ($attributesData as $tableName => $skuData) { $tableData = []; foreach ($skuData as $sku => $attributes) { - $linkId = $this->_connection->fetchOne( - $this->_connection->select() - ->from($this->getResource()->getTable('catalog_product_entity')) - ->where('sku = ?', (string)$sku) - ->columns($this->getProductEntityLinkField()) - ); - + $linkId = $this->_oldSku[strtolower($sku)][$linkField]; foreach ($attributes as $attributeId => $storeValues) { foreach ($storeValues as $storeId => $storeValue) { $tableData[] = [ - $this->getProductEntityLinkField() => $linkId, + $linkField => $linkId, 'attribute_id' => $attributeId, 'store_id' => $storeId, 'value' => $storeValue, @@ -1321,6 +1315,7 @@ protected function _saveProductAttributes(array $attributesData) } $this->_connection->insertOnDuplicate($tableName, $tableData, ['value']); } + return $this; } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index 048a9f88f87a2..428407912725e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -6,7 +6,6 @@ namespace Magento\CatalogImportExport\Test\Unit\Model\Import; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Stdlib\DateTime; use Magento\ImportExport\Model\Import; /** @@ -513,25 +512,6 @@ public function testSaveProductAttributes() ] ] ]; - $entityTable = 'catalog_product_entity'; - $resource = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel::class) - ->disableOriginalConstructor() - ->setMethods(['getTable']) - ->getMock(); - $resource->expects($this->once())->method('getTable')->with($entityTable)->willReturnArgument(0); - $this->_resourceFactory->expects($this->once())->method('create')->willReturn($resource); - $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) - ->disableOriginalConstructor() - ->getMock(); - $selectMock->expects($this->once())->method('from')->with($entityTable, '*', null)->willReturnSelf(); - $selectMock->expects($this->once())->method('where')->with('sku = ?', $testSku)->willReturnSelf(); - $selectMock->expects($this->once())->method('columns')->with('entity_id')->willReturnSelf(); - $this->_connection->expects($this->any())->method('fetchOne')->willReturn(self::ENTITY_ID); - $this->_connection->expects($this->any())->method('select')->willReturn($selectMock); - $this->_connection->expects($this->any()) - ->method('quoteInto') - ->willReturnCallback([$this, 'returnQuoteCallback']); - $tableData[] = [ 'entity_id' => self::ENTITY_ID, 'attribute_id' => $attributeId, @@ -541,6 +521,7 @@ public function testSaveProductAttributes() $this->_connection->expects($this->once()) ->method('insertOnDuplicate') ->with($testTable, $tableData, ['value']); + $this->setPropertyValue($this->importProduct, '_oldSku', [$testSku => ['entity_id' => self::ENTITY_ID]]); $object = $this->invokeMethod($this->importProduct, '_saveProductAttributes', [$attributesData]); $this->assertEquals($this->importProduct, $object); } From d96327da58f026e36797a6b947df82c6d9668a10 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:58:57 -0600 Subject: [PATCH 132/277] :arrow_double_up: Forwardport of magento/magento2#11962 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11962.patch (created by @RomaKis) based on commit(s): 1. 1717df443c0a679ca88db0ac2d1b8d0e9e7b878b 2. c438c171ce51c4893e706f6af02eb7cf3e80eec7 3. 42d9b5281a3a4d8131bdb3ec98e36414fcc713a8 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11793: Magento2.1.5 admin shipping report shows wrong currency code (reported by @pushparaj100) --- .../Block/Adminhtml/Grid/AbstractGrid.php | 9 +- .../Block/Adminhtml/Grid/AbstractGridTest.php | 91 +++++++++++++++++++ 2 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/AbstractGridTest.php diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php index 48a87bf77cf94..158455db26455 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php @@ -363,12 +363,11 @@ public function setStoreIds($storeIds) public function getCurrentCurrencyCode() { if ($this->_currentCurrencyCode === null) { - $this->_currentCurrencyCode = count( - $this->_storeIds - ) > 0 ? $this->_storeManager->getStore( - array_shift($this->_storeIds) - )->getBaseCurrencyCode() : $this->_storeManager->getStore()->getBaseCurrencyCode(); + $this->_currentCurrencyCode = count($this->_storeIds) > 0 + ? $this->_storeManager->getStore(array_shift($this->_storeIds))->getCurrentCurrencyCode() + : $this->_storeManager->getStore()->getBaseCurrencyCode(); } + return $this->_currentCurrencyCode; } diff --git a/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/AbstractGridTest.php b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/AbstractGridTest.php new file mode 100644 index 0000000000000..dc16928861b1c --- /dev/null +++ b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/AbstractGridTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Reports\Test\Unit\Block\Adminhtml\Grid; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + +/** + * Test for class \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid. + */ +class AbstractGridTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid|\PHPUnit_Framework_MockObject_MockObject + */ + private $model; + + /** + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $storeManagerMock; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + + $this->storeManagerMock = $this->getMockForAbstractClass( + \Magento\Store\Model\StoreManagerInterface::class, + [], + '', + true, + true, + true, + ['getStore'] + ); + + $this->model = $objectManager->getObject( + \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid::class, + ['_storeManager' => $this->storeManagerMock] + ); + } + + /** + * @param $storeIds + * + * @dataProvider getCurrentCurrencyCodeDataProvider + */ + public function testGetCurrentCurrencyCode($storeIds) + { + $storeMock = $this->getMockForAbstractClass( + \Magento\Store\Api\Data\StoreInterface::class, + [], + '', + true, + true, + true, + ['getBaseCurrencyCode', 'getCurrentCurrencyCode'] + ); + + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + + $this->model->setStoreIds($storeIds); + + if ($storeIds) { + $storeMock->expects($this->once())->method('getCurrentCurrencyCode')->willReturn('EUR'); + $expectedCurrencyCode = 'EUR'; + } else { + $storeMock->expects($this->once())->method('getBaseCurrencyCode')->willReturn('USD'); + $expectedCurrencyCode = 'USD'; + } + + $currencyCode = $this->model->getCurrentCurrencyCode(); + $this->assertEquals($expectedCurrencyCode, $currencyCode); + } + + /** + * DataProvider for testGetCurrentCurrencyCode. + * + * @return array + */ + public function getCurrentCurrencyCodeDataProvider() + { + return [ + [[]], + [[2]], + ]; + } +} From 8c735e522da5744094d6e307602e0c3be8886057 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:05 -0600 Subject: [PATCH 133/277] :arrow_double_up: Forwardport of magento/magento2#11461 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11461.patch (created by @diglin) based on commit(s): 1. c170b4f9da948de14520e1c0901782346afcb42b 2. fd17ca1dbd79cb9de1a8c86d3e918d1c659ed3e0 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10811: Replace FollowSymLinks with SymLinksIfOwnerMatch (reported by @s3rj1k) --- .htaccess.sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.htaccess.sample b/.htaccess.sample index 8e6e702ced716..3c412725f2134 100644 --- a/.htaccess.sample +++ b/.htaccess.sample @@ -111,7 +111,8 @@ ############################################ ## enable rewrites - Options +FollowSymLinks + # The following line has better security but add some performance overhead - see https://httpd.apache.org/docs/2.4/en/misc/perf-tuning.html + Options -FollowSymLinks +SymLinksIfOwnerMatch RewriteEngine on ############################################ From 1a1131972971f41bdc11d866117914a1eab72f37 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:13 -0600 Subject: [PATCH 134/277] :arrow_double_up: Forwardport of magento/magento2#11722 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11722.patch (created by @nmalevanec) based on commit(s): 1. 751143bc1c79c14979b1282ec5115ffa58f5d0f9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#6802: Magento\Search\Helper\getSuggestUrl() not used in search template (reported by @schmengler) --- app/code/Magento/Search/Helper/Data.php | 2 +- .../Search/Test/Unit/Helper/DataTest.php | 46 +++++++++++++++++++ .../view/frontend/templates/form.mini.phtml | 4 +- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Search/Helper/Data.php b/app/code/Magento/Search/Helper/Data.php index f3ad8a39de00e..e813d7342761f 100644 --- a/app/code/Magento/Search/Helper/Data.php +++ b/app/code/Magento/Search/Helper/Data.php @@ -124,7 +124,7 @@ public function getSuggestUrl() { return $this->_getUrl( 'search/ajax/suggest', - ['_secure' => $this->storeManager->getStore()->isCurrentlySecure()] + ['_secure' => $this->_getRequest()->isSecure()] ); } diff --git a/app/code/Magento/Search/Test/Unit/Helper/DataTest.php b/app/code/Magento/Search/Test/Unit/Helper/DataTest.php index 5cfde7e8efda9..291362734feff 100644 --- a/app/code/Magento/Search/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Search/Test/Unit/Helper/DataTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Search\Test\Unit\Helper; /** @@ -43,6 +44,11 @@ class DataTest extends \PHPUnit\Framework\TestCase */ protected $storeManagerMock; + /** + * @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlBuilderMock; + protected function setUp() { $this->stringMock = $this->createMock(\Magento\Framework\Stdlib\StringUtils::class); @@ -53,9 +59,14 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods([]) ->getMock(); + $this->urlBuilderMock = $this->getMockBuilder(\Magento\Framework\UrlInterface::class) + ->setMethods(['getUrl']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); $this->contextMock = $this->createMock(\Magento\Framework\App\Helper\Context::class); $this->contextMock->expects($this->any())->method('getScopeConfig')->willReturn($this->scopeConfigMock); $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock); + $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilderMock); $this->model = new \Magento\Search\Helper\Data( $this->contextMock, @@ -126,4 +137,39 @@ public function queryTextDataProvider() ['testtest', 7, 'testtes'], ]; } + + /** + * Test getSuggestUrl() take into consideration type of request(secure, non-secure). + * + * @dataProvider getSuggestUrlDataProvider + * @param bool $isSecure + * @return void + */ + public function testGetSuggestUrl(bool $isSecure) + { + $this->requestMock->expects(self::once()) + ->method('isSecure') + ->willReturn($isSecure); + $this->urlBuilderMock->expects(self::once()) + ->method('getUrl') + ->with(self::identicalTo('search/ajax/suggest'), self::identicalTo(['_secure' => $isSecure])); + $this->model->getSuggestUrl(); + } + + /** + * Provide test data for testGetSuggestUrl() test. + * + * @return array + */ + public function getSuggestUrlDataProvider() + { + return [ + 'non-secure' => [ + 'isSecure' => false, + ], + 'secure' => [ + 'secure' => true, + ], + ]; + } } diff --git a/app/code/Magento/Search/view/frontend/templates/form.mini.phtml b/app/code/Magento/Search/view/frontend/templates/form.mini.phtml index c4297b404717c..2ea87be13d5e3 100644 --- a/app/code/Magento/Search/view/frontend/templates/form.mini.phtml +++ b/app/code/Magento/Search/view/frontend/templates/form.mini.phtml @@ -9,7 +9,7 @@ <?php /** @var $block \Magento\Framework\View\Element\Template */ /** @var $helper \Magento\Search\Helper\Data */ -$helper = $this->helper('Magento\Search\Helper\Data'); +$helper = $this->helper(\Magento\Search\Helper\Data::class); ?> <div class="block block-search"> <div class="block block-title"><strong><?= /* @escapeNotVerified */ __('Search') ?></strong></div> @@ -23,7 +23,7 @@ $helper = $this->helper('Magento\Search\Helper\Data'); <input id="search" data-mage-init='{"quickSearch":{ "formSelector":"#search_mini_form", - "url":"<?= /* @escapeNotVerified */ $block->getUrl('search/ajax/suggest', ['_secure' => $block->getRequest()->isSecure()]) ?>", + "url":"<?= /* @escapeNotVerified */ $helper->getSuggestUrl()?>", "destinationSelector":"#search_autocomplete"} }' type="text" From 3011b5e9e843bcd2dfd8cccea2f43070d20e4191 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:20 -0600 Subject: [PATCH 135/277] :arrow_double_up: Forwardport of magento/magento2#12082 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12082.patch (created by @mihaifaget) based on commit(s): 1. 521e79e7cbf3be0e0bba92cf41ca0c6685a5fd83 2. f71fae5b9ba1d9168995a5dd10b177026113efd2 3. d9485ccff810a7a26b96e06081408f6e0c17de28 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12079: Products in cart report error when we have grouped or bundle product (reported by @mihaifaget) --- .../Reports/Model/ResourceModel/Quote/Item/Collection.php | 2 +- .../Unit/Model/ResourceModel/Report/Quote/CollectionTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php index e9dbfdae7a9a5..d219aefe81d45 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php @@ -192,7 +192,7 @@ protected function getProductData(array $productIds) . ' AND product_name.attribute_id = ' . $productAttrNameId . ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID, ['name' => 'product_name.value'] - )->joinInner( + )->joinLeft( ['product_price' => $productAttrPrice->getBackend()->getTable()], "product_price.{$linkField} = main_table.{$linkField}" ." AND product_price.attribute_id = {$productAttrPriceId}", diff --git a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/Quote/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/Quote/CollectionTest.php index 051dc3f5f5593..7bb866287d37a 100644 --- a/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/Quote/CollectionTest.php +++ b/app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Report/Quote/CollectionTest.php @@ -124,7 +124,8 @@ public function testLoadWithFilter() $this->selectMock->expects($this->once())->method('reset')->willReturnSelf(); $this->selectMock->expects($this->once())->method('from')->willReturnSelf(); $this->selectMock->expects($this->once())->method('useStraightJoin')->willReturnSelf(); - $this->selectMock->expects($this->exactly(2))->method('joinInner')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('joinInner')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('joinLeft')->willReturnSelf(); $collection->expects($this->once())->method('getOrdersData')->willReturn([]); $productAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf(); $priceAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf(); From 850e38cd6f59676516be6ba8ebcd5cf43a81303c Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:27 -0600 Subject: [PATCH 136/277] :arrow_double_up: Forwardport of magento/magento2#12107 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12107.patch (created by @p-bystritsky) based on commit(s): 1. ca071c01d1e1d6c02a01fd108abc96cd29531605 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11880: Magento 2.1.9 Configurable::getUsedProducts returns a different array after product collections is cached (reported by @apedicdev) --- .../Model/Product/Type/Configurable.php | 2 +- .../Model/Product/Type/ConfigurableTest.php | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 360a11cf2748f..e6345af40f37a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -1296,7 +1296,7 @@ private function loadUsedProducts(\Magento\Catalog\Model\Product $product, $cach if ($salableOnly) { $collection = $this->salableProcessor->process($collection); } - $usedProducts = $collection->getItems(); + $usedProducts = array_values($collection->getItems()); $this->saveUsedProductsCacheData($product, $usedProducts, $cacheKey); } $product->setData($dataFieldName, $usedProducts); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php index 8aa8d4cc810b1..01a7ae6087e06 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php @@ -235,6 +235,26 @@ public function testGetUsedProducts() } } + /** + * Test getUsedProducts returns array with same indexes regardless collections was cache or not. + * + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + */ + public function testGetUsedProductsCached() + { + /** @var \Magento\Framework\App\Cache\StateInterface $cacheState */ + $cacheState = Bootstrap::getObjectManager()->get(\Magento\Framework\App\Cache\StateInterface::class); + $cacheState->setEnabled(\Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER, true); + + $products = $this->getUsedProducts(); + $productsCached = $this->getUsedProducts(); + self::assertEquals( + array_keys($products), + array_keys($productsCached) + ); + } + public function testGetUsedProductCollection() { $this->assertInstanceOf( @@ -570,4 +590,14 @@ protected function _prepareForCart() return $product; } + + /** + * @return ProductInterface[] + */ + protected function getUsedProducts() + { + $product = Bootstrap::getObjectManager()->create(Product::class); + $product->load(1); + return $this->model->getUsedProducts($product); + } } From 24dcb91572ed6b4e7068ad2371dc6ec769b16c77 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:34 -0600 Subject: [PATCH 137/277] :arrow_double_up: Forwardport of magento/magento2#12031 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12031.patch (created by @enriquei4) based on commit(s): 1. bce7d568c1894e8bdc9480d5face2369761b2cb5 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#6661: XHTML templates Don't Use Schema URNs (reported by @astorm) --- .../Ui/view/base/ui_component/templates/container/default.xhtml | 2 +- .../Ui/view/base/ui_component/templates/export/button.xhtml | 2 +- .../Ui/view/base/ui_component/templates/form/collapsible.xhtml | 2 +- .../Ui/view/base/ui_component/templates/form/default.xhtml | 2 +- .../Ui/view/base/ui_component/templates/listing/default.xhtml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml index dd4a2038a53c4..5bbf252c8a787 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../Ui/etc/ui_template.xsd"> +<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_template.xsd"> <div data-bind="scope: '{{getName()}}.areas'" class="entry-edit form-inline"> <!-- ko template: getTemplate() --><!-- /ko --> </div> diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml index 6dc91cf6b3d5b..977ea8374dfa8 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../Ui/etc/ui_template.xsd"> +<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_template.xsd"> <div data-bind="scope: '{{getName()}}.areas'"> <!-- ko template: getTemplate() --><!-- /ko --> </div> diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml index baab52111aebe..aedf18961a719 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../Ui/etc/ui_template.xsd"> +<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_template.xsd"> <div data-role="spinner" data-component="{{getName()}}.{{getName()}}" class="admin__form-loading-mask"> <div class="spinner"> <span/><span/><span/><span/><span/><span/><span/><span/> diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml index 5e0d699ed3edc..9d7715db905ab 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../Ui/etc/ui_template.xsd"> +<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_template.xsd"> <div data-role="spinner" data-component="{{getName()}}.areas" class="admin__data-grid-loading-mask"> <div class="spinner"> <span/><span/><span/><span/><span/><span/><span/><span/> diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml index 88a8e42e2966b..661c7c0c23dfb 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml @@ -9,7 +9,7 @@ class="admin__data-grid-outer-wrap" data-bind="scope: '{{getName()}}.{{getName()}}'" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../Ui/etc/ui_template.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_template.xsd"> <div data-role="spinner" data-component="{{getName()}}.{{getName()}}.{{spinner}}" class="admin__data-grid-loading-mask"> <div class="spinner"> <span/><span/><span/><span/><span/><span/><span/><span/> From c574e4696cee2087f25264fbb7235d0549acdcfa Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:42 -0600 Subject: [PATCH 138/277] :arrow_double_up: Forwardport of magento/magento2#12144 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12144.patch (created by @wexo-team) based on commit(s): 1. e046aad7cfe18ebbf5901e3150d36593243b7c8e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11230: Unit test fails after fresh installation (reported by @bnymn) --- .../Di/Code/Reader/FileClassScannerTest.php | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php index 72a9bcdc4df72..5bc7fd82b3251 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php @@ -204,13 +204,38 @@ class ThisIsNotMyTest self::assertContains('This\Is\Not\My\Ns\ThisIsNotMyTest', $result); } - public function testClassKeywordInMiddleOfFile() + public function testMultipleClassKeywordsInMiddleOfFileWithStringVariableParsing() { - $filename = __DIR__ - . '/../../../../../../../../../..' - . '/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php'; - $filename = realpath($filename); - $scanner = new FileClassScanner($filename); + $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ + 'getFileContents' + ])->getMock(); + $scanner->expects(self::once())->method('getFileContents')->willReturn(<<<'PHP' +<?php + +namespace This\Is\My\Ns; + +use stdClass; + +class ThisIsMyTest +{ + protected function firstMethod() + { + $test = 1; + $testString = "foo {$test}"; + $className = stdClass::class; + $testString2 = "bar {$test}"; + } + + protected function secondMethod() + { + $this->doMethod(stdClass::class)->runAction(); + } +} + +PHP + ); + + /* @var $scanner FileClassScanner */ $result = $scanner->getClassNames(); self::assertCount(1, $result); From 81615932ff7baa83066e95e37903bd3c1c3a1f9e Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:49 -0600 Subject: [PATCH 139/277] :arrow_double_up: Forwardport of magento/magento2#11944 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11944.patch (created by @mpchadwick) based on commit(s): 1. acc49c120c326c03ea7fe0a6c8b0fbc704d4057a 2. debea4227a15480ba2bb37be3ebce1c5870cdd42 3. 2cc85a11c767ee425042350c34712a4d6fba1abf 4. 01370500787b1a4c80b72c3061b83757bdd217f9 5. 46a0c9d9d4f62ca9f44675142f8d88c1c188d72c 6. a9d408e4e15c16345fd88a2d5d7f84450e7fb043 7. a22b31bc81238cabac824ecc192a6268cc9c22b1 8. b9ee5930b82f640b8e16373dab164bd662906d1f 9. 6bc4fcf6d7dc6bb9383abd98302f350d13d3471d --- .../Model/NewRelicWrapper.php | 13 +++++ ...tApplicationHandledExceptionToNewRelic.php | 47 ++++++++++++++++ .../NewRelicReporting/Plugin/HttpPlugin.php | 53 +++++++++++++++++++ app/code/Magento/NewRelicReporting/etc/di.xml | 3 ++ 4 files changed, 116 insertions(+) create mode 100644 app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php create mode 100644 app/code/Magento/NewRelicReporting/Plugin/HttpPlugin.php diff --git a/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php b/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php index c4818c38cd9c6..845ed0429d2c3 100644 --- a/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php +++ b/app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php @@ -28,6 +28,19 @@ public function addCustomParameter($param, $value) return false; } + /** + * Wrapper for 'newrelic_notice_error' function + * + * @param Exception $exception + * @return void + */ + public function reportError($exception) + { + if (extension_loaded('newrelic')) { + newrelic_notice_error($exception->getMessage(), $exception); + } + } + /** * Checks whether newrelic-php5 agent is installed * diff --git a/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php b/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php new file mode 100644 index 0000000000000..32a64e61b6f99 --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\NewRelicReporting\Model\Observer; + +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; +use Magento\NewRelicReporting\Model\Config; +use Magento\NewRelicReporting\Model\NewRelicWrapper; + +/** + * Class ReportApplicationHandledExceptionToNewRelic + */ +class ReportApplicationHandledExceptionToNewRelic implements ObserverInterface +{ + /** + * @var Config + */ + protected $config; + + /** + * @var NewRelicWrapper + */ + protected $newRelicWrapper; + + /** + * @param Config $config + * @param NewRelicWrapper $newRelicWrapper + */ + public function __construct( + Config $config, + NewRelicWrapper $newRelicWrapper + ) { + $this->config = $config; + $this->newRelicWrapper = $newRelicWrapper; + } + + public function execute(Observer $observer) + { + if ($this->config->isNewRelicEnabled()) { + $exception = $observer->getEvent()->getException(); + $this->newRelicWrapper->reportError($exception); + } + } +} diff --git a/app/code/Magento/NewRelicReporting/Plugin/HttpPlugin.php b/app/code/Magento/NewRelicReporting/Plugin/HttpPlugin.php new file mode 100644 index 0000000000000..a37d93329d43a --- /dev/null +++ b/app/code/Magento/NewRelicReporting/Plugin/HttpPlugin.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\NewRelicReporting\Plugin; + +use Magento\Framework\App\Bootstrap; +use Magento\Framework\App\Http; +use Magento\NewRelicReporting\Model\Config; +use Magento\NewRelicReporting\Model\NewRelicWrapper; + +class HttpPlugin +{ + /** + * @var Config + */ + private $config; + + /** + * @var NewRelicWrapper + */ + private $newRelicWrapper; + + /** + * @param Config $config + * @param NewRelicWrapper $newRelicWrapper + */ + public function __construct( + Config $config, + NewRelicWrapper $newRelicWrapper + ) { + $this->config = $config; + $this->newRelicWrapper = $newRelicWrapper; + } + + /** + * Report exception to New Relic + * + * @param Http $subject + * @param Bootstrap $bootstrap + * @param \Exception $exception + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeCatchException(Http $subject, Bootstrap $bootstrap, \Exception $exception) + { + if ($this->config->isNewRelicEnabled()) { + $this->newRelicWrapper->reportError($exception); + } + } +} diff --git a/app/code/Magento/NewRelicReporting/etc/di.xml b/app/code/Magento/NewRelicReporting/etc/di.xml index a0d06105dd3fe..cba92f91cd4bb 100644 --- a/app/code/Magento/NewRelicReporting/etc/di.xml +++ b/app/code/Magento/NewRelicReporting/etc/di.xml @@ -27,4 +27,7 @@ </argument> </arguments> </type> + <type name="Magento\Framework\App\Http"> + <plugin name="framework-http-newrelic" type="Magento\NewRelicReporting\Plugin\HttpPlugin"/> + </type> </config> From f06e173d86ee4ee3ed9da5e44f9e05b44b7736f6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 10:59:56 -0600 Subject: [PATCH 140/277] :arrow_double_up: Forwardport of magento/magento2#11968 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11968.patch (created by @jalogut) based on commit(s): 1. d6c6e66da1d1c42f23a8eec44e71526826b9d46e 2. 3ae078594c051c551d6b00d6bddc231561465839 --- .../Model/Import/Customer.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php index bee4479526037..016dca2fa526c 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/Customer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/Customer.php @@ -270,13 +270,29 @@ protected function _saveCustomerEntities(array $entitiesToCreate, array $entitie $this->_connection->insertOnDuplicate( $this->_entityTable, $entitiesToUpdate, - $this->customerFields + $this->getCustomerEntityFieldsToUpdate($entitiesToUpdate) ); } return $this; } + /** + * Filter the entity that are being updated so we only change fields found in the importer file + * + * @param array $entitiesToUpdate + * @return array + */ + private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array + { + $firstCustomer = reset($entitiesToUpdate); + $columnsToUpdate = array_keys($firstCustomer); + $customerFieldsToUpdate = array_filter($this->customerFields, function ($field) use ($columnsToUpdate) { + return in_array($field, $columnsToUpdate); + }); + return $customerFieldsToUpdate; + } + /** * Save customer attributes. * From b41594122f532f6a89165a70906a5b257562c0df Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:04 -0600 Subject: [PATCH 141/277] :arrow_double_up: Forwardport of magento/magento2#12061 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12061.patch (created by @atishgoswami) based on commit(s): 1. b30eda5e23739acac2f1a67aec718847b6743f19 2. 9e63c27f8e211754be0d75f4e303029c9fc9d259 3. bd8758d12f3c50ee042f9dec70950e551793e724 4. 75379cfc5b744fccd0698ccdc973b6490ecb915f --- .../Magento/Contact/Controller/Index/Post.php | 33 +++++++------------ app/code/Magento/Contact/Model/Mail.php | 8 ++--- .../Magento/Contact/Controller/IndexTest.php | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Contact/Controller/Index/Post.php b/app/code/Magento/Contact/Controller/Index/Post.php index 3374ff1fa5cf4..ee2d23b74df24 100644 --- a/app/code/Magento/Contact/Controller/Index/Post.php +++ b/app/code/Magento/Contact/Controller/Index/Post.php @@ -9,12 +9,13 @@ use Magento\Contact\Model\ConfigInterface; use Magento\Contact\Model\MailInterface; use Magento\Framework\App\Action\Context; -use Magento\Framework\App\ObjectManager; use Magento\Framework\App\Request\DataPersistorInterface; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\HTTP\PhpEnvironment\Request; use Psr\Log\LoggerInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\DataObject; class Post extends \Magento\Contact\Controller\Index { @@ -56,7 +57,7 @@ public function __construct( $this->context = $context; $this->mail = $mail; $this->dataPersistor = $dataPersistor; - $this->logger = $logger ?: \Magento\Framework\App\ObjectManager::getInstance()->get(LoggerInterface::class); + $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); } /** @@ -71,45 +72,33 @@ public function execute() } try { $this->sendEmail($this->validatedParams()); - $this->messageManager->addSuccess( + $this->messageManager->addSuccessMessage( __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.') ); - $this->getDataPersistor()->clear('contact_us'); + $this->dataPersistor->clear('contact_us'); } catch (LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); - $this->getDataPersistor()->set('contact_us', $this->getRequest()->getParams()); + $this->dataPersistor->set('contact_us', $this->getRequest()->getParams()); } catch (\Exception $e) { $this->logger->critical($e); $this->messageManager->addErrorMessage( __('An error occurred while processing your form. Please try again later.') ); - $this->getDataPersistor()->set('contact_us', $this->getRequest()->getParams()); + $this->dataPersistor->set('contact_us', $this->getRequest()->getParams()); } return $this->resultRedirectFactory->create()->setPath('contact/index'); } - /** - * Get Data Persistor - * - * @return DataPersistorInterface - */ - private function getDataPersistor() - { - if ($this->dataPersistor === null) { - $this->dataPersistor = ObjectManager::getInstance() - ->get(DataPersistorInterface::class); - } - - return $this->dataPersistor; - } - /** * @param array $post Post data from contact form * @return void */ private function sendEmail($post) { - $this->mail->send($post['email'], ['data' => new \Magento\Framework\DataObject($post)]); + $this->mail->send( + $post['email'], + ['data' => new DataObject($post)] + ); } /** diff --git a/app/code/Magento/Contact/Model/Mail.php b/app/code/Magento/Contact/Model/Mail.php index d63efbbca573b..43c1974252b5a 100644 --- a/app/code/Magento/Contact/Model/Mail.php +++ b/app/code/Magento/Contact/Model/Mail.php @@ -6,9 +6,10 @@ namespace Magento\Contact\Model; use Magento\Framework\Mail\Template\TransportBuilder; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Translate\Inline\StateInterface; use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\Area; class Mail implements MailInterface { @@ -49,8 +50,7 @@ public function __construct( $this->contactsConfig = $contactsConfig; $this->transportBuilder = $transportBuilder; $this->inlineTranslation = $inlineTranslation; - $this->storeManager = $storeManager ?: - ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); } /** @@ -71,7 +71,7 @@ public function send($replyTo, array $variables) ->setTemplateIdentifier($this->contactsConfig->emailTemplate()) ->setTemplateOptions( [ - 'area' => 'frontend', + 'area' => Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId() ] ) diff --git a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php index b8dbfec59845b..2d76632cae0b7 100644 --- a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php @@ -24,7 +24,7 @@ public function testPostAction() $this->assertRedirect($this->stringContains('contact/index')); $this->assertSessionMessages( $this->contains( - "Thanks for contacting us with your comments and questions. We'll respond to you very soon." + "Thanks for contacting us with your comments and questions. We'll respond to you very soon." ), \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS ); From 7369261d82e0e5ad926eaf4ccb2a8def79c4fcbb Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:17 -0600 Subject: [PATCH 142/277] :arrow_double_up: Forwardport of magento/magento2#11274 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11274.patch (created by @marinagociu) based on commit(s): 1. ae9f2050e0cb5dad500d39be9fd42e1116b9f60e 2. f6121da1dd59ba4097a9c706b25d6fcbc9202279 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10477: Cart price rule has failed if use dropdown attribute (reported by @minosss) --- .../Rule/Condition/Product/Subselect.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Subselect.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Subselect.php index 108cc341253ae..1e8fbf43ec3bc 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Subselect.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product/Subselect.php @@ -136,6 +136,7 @@ public function asHtml() * * @param \Magento\Framework\Model\AbstractModel $model * @return bool + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function validate(\Magento\Framework\Model\AbstractModel $model) { @@ -145,8 +146,22 @@ public function validate(\Magento\Framework\Model\AbstractModel $model) $attr = $this->getAttribute(); $total = 0; foreach ($model->getQuote()->getAllVisibleItems() as $item) { - if (parent::validate($item)) { - $total += $item->getData($attr); + $hasValidChild = false; + $useChildrenTotal = ($item->getProductType() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE); + $childrenAttrTotal = 0; + $children = $item->getChildren(); + if (!empty($children)) { + foreach ($children as $child) { + if (parent::validate($child)) { + $hasValidChild = true; + if ($useChildrenTotal) { + $childrenAttrTotal += $child->getData($attr); + } + } + } + } + if ($hasValidChild || parent::validate($item)) { + $total += (($hasValidChild && $useChildrenTotal) ? $childrenAttrTotal : $item->getData($attr)); } } return $this->validateAttribute($total); From dce1c66301cdddfee2dc2887f584c333d0b438b2 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:24 -0600 Subject: [PATCH 143/277] :arrow_double_up: Forwardport of magento/magento2#11952 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11952.patch (created by @RomaKis) based on commit(s): 1. eeb7dffa25bca4100753820b31ab4b544bfdb615 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11832: Create order (on Customer edit page) - not working from admin environment (reported by @psbhanu) --- .../Adminhtml/Order/Create/AbstractCreate.php | 18 +++++++++++ .../Order/Create/AbstractCreateTest.php | 32 +++++++++++++++++++ .../order/create/sidebar/items.phtml | 6 +--- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php index 85b0ed891b64f..f335705e3deee 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php @@ -160,4 +160,22 @@ public function convertPrice($value, $format = true) ) : $this->priceCurrency->convert($value, $this->getStore()); } + + /** + * If item is quote or wishlist we need to get product from it. + * + * @param $item + * + * @return Product + */ + public function getProduct($item) + { + if ($item instanceof Product) { + $product = $item; + } else { + $product = $item->getProduct(); + } + + return $product; + } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/AbstractCreateTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/AbstractCreateTest.php index 447fd7791ecbd..e010674ca354e 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/AbstractCreateTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/AbstractCreateTest.php @@ -3,8 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Block\Adminhtml\Order\Create; +use Magento\Catalog\Model\Product; use Magento\Catalog\Pricing\Price\FinalPrice; class AbstractCreateTest extends \PHPUnit\Framework\TestCase @@ -67,4 +69,34 @@ public function testGetItemPrice() ->willReturn($resultPrice); $this->assertEquals($resultPrice, $this->model->getItemPrice($this->productMock)); } + + /** + * @param $item + * + * @dataProvider getProductDataProvider + */ + public function testGetProduct($item) + { + $product = $this->model->getProduct($item); + + self::assertInstanceOf(Product::class, $product); + } + + /** + * DataProvider for testGetProduct. + * + * @return array + */ + public function getProductDataProvider() + { + $productMock = $this->createMock(Product::class); + + $itemMock = $this->createMock(\Magento\Wishlist\Model\Item::class); + $itemMock->expects($this->once())->method('getProduct')->willReturn($productMock); + + return [ + [$productMock], + [$itemMock], + ]; + } } diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml index 2ca2420934519..2dbf717f73439 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml @@ -67,11 +67,7 @@ <?php if ($block->canDisplayPrice()): ?> <td class="col-price"> - <?php if ($block->getDataId() == 'cart'): ?> - <?= /* @noEscape */ $block->getItemPrice($_item->getProduct()) ?> - <?php else: ?> - <?= /* @noEscape */ $block->getItemPrice($_item) ?> - <?php endif; ?> + <?= /* @noEscape */ $block->getItemPrice($block->getProduct($_item)) ?> </td> <?php endif; ?> From 95ed67ee4adbbd7f3f0107a52da4b9238cf44803 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:33 -0600 Subject: [PATCH 144/277] :arrow_double_up: Forwardport of magento/magento2#12001 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12001.patch (created by @RomaKis) based on commit(s): 1. 17aa13c9664fd55d02e535131b0d882102e61aab 2. 3f79b80549bf42ebf96ead47d39824d949723daa Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122 (reported by @lee586) --- .../Catalog/Model/Category/Link/SaveHandler.php | 4 +++- .../Unit/Model/Category/Link/SaveHandlerTest.php | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php b/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php index 29a1ef60a43de..f22c6903a230c 100644 --- a/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php +++ b/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php @@ -119,7 +119,9 @@ private function mergeCategoryLinks($newCategoryPositions, $oldCategoryPositions if ($key === false) { $result[] = $newCategoryPosition; - } elseif ($oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']) { + } elseif (isset($oldCategoryPositions[$key]) + && $oldCategoryPositions[$key]['position'] != $newCategoryPosition['position'] + ) { $result[] = $newCategoryPositions[$key]; unset($oldCategoryPositions[$key]); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/Link/SaveHandlerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/Link/SaveHandlerTest.php index 78db12be56b42..0b85ef38387fa 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/Link/SaveHandlerTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/Link/SaveHandlerTest.php @@ -197,6 +197,21 @@ public function getCategoryDataProvider() ], [], //affected category_ids ], + [ + [3], //model category_ids + [ + ['category_id' => 3, 'position' => 20], + ['category_id' => 4, 'position' => 30], + ], // dto category links + [ + ['category_id' => 3, 'position' => 10], + ], + [ + ['category_id' => 3, 'position' => 20], + ['category_id' => 4, 'position' => 30], + ], + [3, 4], //affected category_ids + ], ]; } From 05fcdd1a52c674ea09a34960cea71e73488fbc99 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:40 -0600 Subject: [PATCH 145/277] :arrow_double_up: Forwardport of magento/magento2#12077 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12077.patch (created by @RomaKis) based on commit(s): 1. 774799a545500aa2867b53a34028c747050ca1e2 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10628: Color attribute swatches are not visible if sorting is enabled (reported by @akashkarev) --- .../Catalog/Model/ResourceModel/Config.php | 3 +- .../Unit/Model/ResourceModel/ConfigTest.php | 107 ++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ConfigTest.php diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Config.php b/app/code/Magento/Catalog/Model/ResourceModel/Config.php index 7fb13265cd130..7b5d4e09a3599 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Config.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Config.php @@ -149,8 +149,7 @@ public function getAttributesUsedForSortBy() ['main_table' => $this->getTable('eav_attribute')] )->join( ['additional_table' => $this->getTable('catalog_eav_attribute')], - 'main_table.attribute_id = additional_table.attribute_id', - [] + 'main_table.attribute_id = additional_table.attribute_id' )->joinLeft( ['al' => $this->getTable('eav_attribute_label')], 'al.attribute_id = main_table.attribute_id AND al.store_id = ' . $this->getStoreId(), diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ConfigTest.php new file mode 100644 index 0000000000000..abbcef942373e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ConfigTest.php @@ -0,0 +1,107 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Unit\Model\ResourceModel; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + +/** + * Test for Magento\Catalog\Model\ResourceModel\Config + */ +class ConfigTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \Magento\Catalog\Model\ResourceModel\Config + */ + private $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $resource; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $storeManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $eavConfig; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + + $this->resource = $this->createMock(\Magento\Framework\App\ResourceConnection::class); + $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); + $this->eavConfig = $this->createMock(\Magento\Eav\Model\Config::class); + + $this->model = $objectManager->getObject( + \Magento\Catalog\Model\ResourceModel\Config::class, + [ + 'resource' => $this->resource, + 'storeManager' => $this->storeManager, + 'eavConfig' => $this->eavConfig, + ] + ); + + parent::setUp(); + } + + public function testGetAttributesUsedForSortBy() + { + $expression = 'someExpression'; + $storeId = 1; + $entityTypeId = 4; + + $connectionMock = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class); + $selectMock = $this->createMock(\Magento\Framework\DB\Select::class); + $storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class); + $entityTypeMock = $this->createMock(\Magento\Eav\Model\Entity\Type::class); + + $this->resource->expects($this->atLeastOnce())->method('getConnection')->willReturn($connectionMock); + + $connectionMock->expects($this->once())->method('getCheckSql') + ->with('al.value IS NULL', 'main_table.frontend_label', 'al.value') + ->willReturn($expression); + $connectionMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock); + + $this->resource->expects($this->exactly(3))->method('getTableName')->withConsecutive( + ['eav_attribute'], + ['catalog_eav_attribute'], + ['eav_attribute_label'] + )->willReturnOnConsecutiveCalls('eav_attribute', 'catalog_eav_attribute', 'eav_attribute_label'); + + $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock); + $storeMock->expects($this->once())->method('getId')->willReturn($storeId); + + $this->eavConfig->expects($this->once())->method('getEntityType')->willReturn($entityTypeMock); + $entityTypeMock->expects($this->once())->method('getId')->willReturn($entityTypeId); + + $selectMock->expects($this->once())->method('from') + ->with(['main_table' => 'eav_attribute'])->willReturn($selectMock); + $selectMock->expects($this->once())->method('join')->with( + ['additional_table' => 'catalog_eav_attribute'], + 'main_table.attribute_id = additional_table.attribute_id' + )->willReturn($selectMock); + $selectMock->expects($this->once())->method('joinLeft') + ->with( + ['al' => 'eav_attribute_label'], + 'al.attribute_id = main_table.attribute_id AND al.store_id = ' . $storeId, + ['store_label' => $expression] + )->willReturn($selectMock); + $selectMock->expects($this->exactly(2))->method('where')->withConsecutive( + ['main_table.entity_type_id = ?', $entityTypeId], + ['additional_table.used_for_sort_by = ?', 1] + )->willReturn($selectMock); + + $connectionMock->expects($this->once())->method('fetchAll')->with($selectMock); + + $this->model->getAttributesUsedForSortBy(); + } +} From 8b1a2972b3f0ddd4713d00055b8d60f737a72ce4 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:00:47 -0600 Subject: [PATCH 146/277] :arrow_double_up: Forwardport of magento/magento2#12035 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12035.patch (created by @sbaixauli) based on commit(s): 1. 65000d81b388a7218ae9c9ec5c12bcb00d932c3c 2. 81725aa3bc34d1f60dacfdf13d04975c51c751e8 3. 19fe0dfa6fbacc4ba30a2b33741def32dfb79275 4. 2e2f66b7ce51aa17673c4fc9c4558fbf5911e35a 5. 194ba57c450a030889015cc36466d4f6cadf616a Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#10014: Newsletter subscriptions status not isolated between multi stores (reported by @mikelevy300) --- .../Model/ResourceModel/Subscriber.php | 32 +++++++++++++++---- .../Magento/Newsletter/Model/Subscriber.php | 1 + .../Test/Unit/Model/SubscriberTest.php | 6 ++++ .../Controller/Adminhtml/IndexTest.php | 1 + .../Magento/Newsletter/_files/subscribers.php | 2 +- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php b/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php index c72ae42031001..c7ce4b2f2f11b 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Subscriber.php @@ -118,17 +118,37 @@ public function loadByEmail($subscriberEmail) */ public function loadByCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer) { - $select = $this->connection->select()->from($this->getMainTable())->where('customer_id=:customer_id'); - - $result = $this->connection->fetchRow($select, ['customer_id' => $customer->getId()]); + $select = $this->connection + ->select() + ->from($this->getMainTable()) + ->where('customer_id=:customer_id and store_id=:store_id'); + + $result = $this->connection + ->fetchRow( + $select, + [ + 'customer_id' => $customer->getId(), + 'store_id' => $customer->getStoreId() + ] + ); if ($result) { return $result; } - $select = $this->connection->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email'); - - $result = $this->connection->fetchRow($select, ['subscriber_email' => $customer->getEmail()]); + $select = $this->connection + ->select() + ->from($this->getMainTable()) + ->where('subscriber_email=:subscriber_email and store_id=:store_id'); + + $result = $this->connection + ->fetchRow( + $select, + [ + 'subscriber_email' => $customer->getEmail(), + 'store_id' => $customer->getStoreId() + ] + ); if ($result) { return $result; diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 595c728117749..f6bb0ef2ad041 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -349,6 +349,7 @@ public function loadByCustomerId($customerId) { try { $customerData = $this->customerRepository->getById($customerId); + $customerData->setStoreId($this->_storeManager->getStore()->getId()); $data = $this->getResource()->loadByCustomerData($customerData); $this->addData($data); if (!empty($data) && $customerData->getId() && !$this->getCustomerId()) { diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php index 7716f4744a922..5a4032dc4dffd 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php @@ -187,6 +187,12 @@ public function testUpdateSubscription() $customerDataMock->expects($this->once())->method('getStoreId')->willReturn('store_id'); $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email'); + $storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class) + ->disableOriginalConstructor() + ->setMethods(['getId']) + ->getMock(); + $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel); + $this->assertEquals($this->subscriber, $this->subscriber->updateSubscription($customerId)); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 769120127329e..dca24e92f0040 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -347,6 +347,7 @@ public function testSaveActionExistingCustomerUnsubscribeNewsletter() 'email' => 'customer@example.com', 'firstname' => 'test firstname', 'lastname' => 'test lastname', + 'sendemail_store_id' => 1 ], 'subscription' => '0' ]; diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php index 152d65681c54f..84e72979cc4c5 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php @@ -28,7 +28,7 @@ $subscriber = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create(\Magento\Newsletter\Model\Subscriber::class); -$subscriber->setStoreId($otherStore) +$subscriber->setStoreId($currentStore) // Intentionally setting ID to 0 instead of 2 to test fallback mechanism in Subscriber model ->setCustomerId(0) ->setSubscriberEmail('customer_two@example.com') From 90addb731c3b253d3da4dc564ddf94ac3525bd0f Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:04:12 -0600 Subject: [PATCH 147/277] :arrow_double_up: Forwardport of magento/magento2#12239 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12239.patch (created by @vovayatsyuk) based on commit(s): 1. 7f6b56078edb8eacc5b54e41cc84deb2fcf1fb41 --- .../Magento/Framework/ObjectManager/Factory/AbstractFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php b/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php index 99b35509c4bad..020159985105d 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php @@ -127,12 +127,12 @@ protected function createObject($type, $args) protected function resolveArgument(&$argument, $paramType, $paramDefault, $paramName, $requestedType) { if ($paramType && $argument !== $paramDefault && !is_object($argument)) { - $argumentType = $argument['instance']; if (!isset($argument['instance']) || $argument !== (array)$argument) { throw new \UnexpectedValueException( 'Invalid parameter configuration provided for $' . $paramName . ' argument of ' . $requestedType ); } + $argumentType = $argument['instance']; if (isset($argument['shared'])) { $isShared = $argument['shared']; From d5c9eef075cd5f4d9781ec7f3151a14e087d061d Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:04:19 -0600 Subject: [PATCH 148/277] :arrow_double_up: Forwardport of magento/magento2#11997 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11997.patch (created by @nmalevanec) based on commit(s): 1. 0db2b08cb125046077b0abf1039718a3f6805cf9 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11941: Invoice for products that use qty decimal rounds down to whole number (reported by @ralbin) --- .../Observer/AddStockItemsObserver.php | 77 +++++++ .../Observer/AddStockItemsObserverTest.php | 165 +++++++++++++++ .../Magento/CatalogInventory/etc/events.xml | 3 + .../product_simple_with_decimal_qty.php | 192 ++++++++++++++++++ ...oduct_simple_with_decimal_qty_rollback.php | 26 +++ .../Observer/AddStockItemsObserverTest.php | 41 ++++ .../Sales/Model/AdminOrder/CreateTest.php | 6 +- 7 files changed, 509 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/CatalogInventory/Observer/AddStockItemsObserver.php create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Observer/AddStockItemsObserverTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogInventory/Observer/AddStockItemsObserverTest.php diff --git a/app/code/Magento/CatalogInventory/Observer/AddStockItemsObserver.php b/app/code/Magento/CatalogInventory/Observer/AddStockItemsObserver.php new file mode 100644 index 0000000000000..8fa90cf6531c4 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Observer/AddStockItemsObserver.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogInventory\Observer; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Product\Collection; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory; +use Magento\CatalogInventory\Api\StockItemRepositoryInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; + +/** + * Add Stock items to product collection. + */ +class AddStockItemsObserver implements ObserverInterface +{ + /** + * @var StockItemCriteriaInterfaceFactory + */ + private $criteriaInterfaceFactory; + + /** + * @var StockItemRepositoryInterface + */ + private $stockItemRepository; + + /** + * @var StockConfigurationInterface + */ + private $stockConfiguration; + + /** + * AddStockItemsObserver constructor. + * + * @param StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory + * @param StockItemRepositoryInterface $stockItemRepository + * @param StockConfigurationInterface $stockConfiguration + */ + public function __construct( + StockItemCriteriaInterfaceFactory $criteriaInterfaceFactory, + StockItemRepositoryInterface $stockItemRepository, + StockConfigurationInterface $stockConfiguration + ) { + $this->criteriaInterfaceFactory = $criteriaInterfaceFactory; + $this->stockItemRepository = $stockItemRepository; + $this->stockConfiguration = $stockConfiguration; + } + + /** + * Add stock items to products in collection. + * + * @param Observer $observer + * @return void + */ + public function execute(Observer $observer) + { + /** @var Collection $productCollection */ + $productCollection = $observer->getData('collection'); + $productIds = array_keys($productCollection->getItems()); + $criteria = $this->criteriaInterfaceFactory->create(); + $criteria->setProductsFilter($productIds); + $criteria->setScopeFilter($this->stockConfiguration->getDefaultScopeId()); + $stockItemCollection = $this->stockItemRepository->getList($criteria); + foreach ($stockItemCollection->getItems() as $item) { + /** @var Product $product */ + $product = $productCollection->getItemById($item->getProductId()); + $productExtension = $product->getExtensionAttributes(); + $productExtension->setStockItem($item); + $product->setExtensionAttributes($productExtension); + } + } +} diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Observer/AddStockItemsObserverTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Observer/AddStockItemsObserverTest.php new file mode 100644 index 0000000000000..8de05bd014039 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Observer/AddStockItemsObserverTest.php @@ -0,0 +1,165 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogInventory\Test\Unit\Observer; + +use Magento\Catalog\Api\Data\ProductExtensionInterface; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\CatalogInventory\Api\Data\StockItemCollectionInterface; +use Magento\CatalogInventory\Api\Data\StockItemInterface; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\CatalogInventory\Api\StockItemCriteriaInterface; +use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory; +use Magento\CatalogInventory\Api\StockItemRepositoryInterface; +use Magento\CatalogInventory\Observer\AddStockItemsObserver; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; + +class AddStockItemsObserverTest extends TestCase +{ + /** + * Test subject. + * + * @var AddStockItemsObserver + */ + private $subject; + /** + * @var StockItemCriteriaInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $criteriaInterfaceFactoryMock; + + /** + * @var StockItemRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $stockItemRepositoryMock; + + /** + * @var StockConfigurationInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $stockConfigurationMock; + + /** + * @inheritdoc + */ + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->criteriaInterfaceFactoryMock = $this->getMockBuilder(StockItemCriteriaInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->stockItemRepositoryMock = $this->getMockBuilder(StockItemRepositoryInterface::class) + ->setMethods(['getList']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->stockConfigurationMock = $this->getMockBuilder(StockConfigurationInterface::class) + ->setMethods(['getDefaultScopeId']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->subject = $objectManager->getObject( + AddStockItemsObserver::class, + [ + 'criteriaInterfaceFactory' => $this->criteriaInterfaceFactoryMock, + 'stockItemRepository' => $this->stockItemRepositoryMock, + 'stockConfiguration' => $this->stockConfigurationMock + ] + ); + } + + /** + * Test AddStockItemsObserver::execute() add stock item to product as extension attribute. + */ + public function testExecute() + { + $productId = 1; + $defaultScopeId = 0; + + $criteria = $this->getMockBuilder(StockItemCriteriaInterface::class) + ->setMethods(['setProductsFilter', 'setScopeFilter']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $criteria->expects(self::once()) + ->method('setProductsFilter') + ->with(self::identicalTo([$productId])) + ->willReturn(true); + $criteria->expects(self::once()) + ->method('setScopeFilter') + ->with(self::identicalTo($defaultScopeId)) + ->willReturn(true); + + $this->criteriaInterfaceFactoryMock->expects(self::once()) + ->method('create') + ->willReturn($criteria); + $stockItemCollection = $this->getMockBuilder(StockItemCollectionInterface::class) + ->setMethods(['getItems']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $stockItem = $this->getMockBuilder(StockItemInterface::class) + ->setMethods(['getProductId']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $stockItem->expects(self::once()) + ->method('getProductId') + ->willReturn($productId); + + $stockItemCollection->expects(self::once()) + ->method('getItems') + ->willReturn([$stockItem]); + + $this->stockItemRepositoryMock->expects(self::once()) + ->method('getList') + ->with(self::identicalTo($criteria)) + ->willReturn($stockItemCollection); + + $this->stockConfigurationMock->expects(self::once()) + ->method('getDefaultScopeId') + ->willReturn($defaultScopeId); + + $productExtension = $this->getMockBuilder(ProductExtensionInterface::class) + ->setMethods(['setStockItem']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $productExtension->expects(self::once()) + ->method('setStockItem') + ->with(self::identicalTo($stockItem)); + + $product = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $product->expects(self::once()) + ->method('getExtensionAttributes') + ->willReturn($productExtension); + $product->expects(self::once()) + ->method('setExtensionAttributes') + ->with(self::identicalTo($productExtension)) + ->willReturnSelf(); + + /** @var ProductCollection|\PHPUnit_Framework_MockObject_MockObject $productCollection */ + $productCollection = $this->getMockBuilder(ProductCollection::class) + ->disableOriginalConstructor() + ->getMock(); + $productCollection->expects(self::once()) + ->method('getItems') + ->willReturn([$productId => $product]); + $productCollection->expects(self::once()) + ->method('getItemById') + ->with(self::identicalTo($productId)) + ->willReturn($product); + + /** @var Observer|\PHPUnit_Framework_MockObject_MockObject $observer */ + $observer = $this->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->getMock(); + $observer->expects(self::once()) + ->method('getData') + ->with('collection') + ->willReturn($productCollection); + + $this->subject->execute($observer); + } +} diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml index a2c33e3f7db9f..3197501e9b70b 100644 --- a/app/code/Magento/CatalogInventory/etc/events.xml +++ b/app/code/Magento/CatalogInventory/etc/events.xml @@ -39,4 +39,7 @@ <event name="admin_system_config_changed_section_cataloginventory"> <observer name="inventory" instance="Magento\CatalogInventory\Observer\UpdateItemsStockUponConfigChangeObserver"/> </event> + <event name="sales_quote_item_collection_products_after_load"> + <observer name="add_stock_items" instance="Magento\CatalogInventory\Observer\AddStockItemsObserver"/> + </event> </config> diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty.php new file mode 100644 index 0000000000000..37ce93cc9c420 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty.php @@ -0,0 +1,192 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory; + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); + +/** @var \Magento\TestFramework\ObjectManager $objectManager */ +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->get(\Magento\Catalog\Api\CategoryLinkManagementInterface::class); + +$tierPrices = []; +/** @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory */ +$tierPriceFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory::class); +/** @var $tpExtensionAttributes */ +$tpExtensionAttributesFactory = $objectManager->get(ProductTierPriceExtensionFactory::class); + +$adminWebsite = $objectManager->get(\Magento\Store\Api\WebsiteRepositoryInterface::class)->get('admin'); +$tierPriceExtensionAttributes1 = $tpExtensionAttributesFactory->create() + ->setWebsiteId($adminWebsite->getId()); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, + 'qty' => 2, + 'value' => 8, + ], + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, + 'qty' => 5, + 'value' => 5, + ], + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 3, + 'value' => 5, + ], + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + +$tierPriceExtensionAttributes2 = $tpExtensionAttributesFactory->create() + ->setWebsiteId($adminWebsite->getId()) + ->setPercentageValue(50); + +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 10, + ], + ] +)->setExtensionAttributes($tierPriceExtensionAttributes2); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = $objectManager->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple_with_decimal_qty') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrices($tierPrices) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 1, + 'is_in_stock' => 1, + ] + )->setCanSaveCustomOptions(true) + ->setHasOptions(true); + +$oldOptions = [ + [ + 'previous_group' => 'text', + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'sort_order' => 0, + 'price' => 1, + 'price_type' => 'fixed', + 'sku' => '1-text', + 'max_characters' => 100, + ], + [ + 'previous_group' => 'date', + 'title' => 'Test Date and Time', + 'type' => 'date_time', + 'is_require' => 1, + 'sort_order' => 0, + 'price' => 2, + 'price_type' => 'fixed', + 'sku' => '2-date', + ], + [ + 'previous_group' => 'select', + 'title' => 'Test Select', + 'type' => 'drop_down', + 'is_require' => 1, + 'sort_order' => 0, + 'values' => [ + [ + 'option_type_id' => null, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-1-select', + ], + [ + 'option_type_id' => null, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-2-select', + ], + ], + ], + [ + 'previous_group' => 'select', + 'title' => 'Test Radio', + 'type' => 'radio', + 'is_require' => 1, + 'sort_order' => 0, + 'values' => [ + [ + 'option_type_id' => null, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-1-radio', + ], + [ + 'option_type_id' => null, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-2-radio', + ], + ], + ], +]; + +$options = []; + +/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ +$customOptionFactory = $objectManager->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); + +foreach ($oldOptions as $option) { + /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option */ + $option = $customOptionFactory->create(['data' => $option]); + $option->setProductSku($product->getSku()); + + $options[] = $option; +} + +$product->setOptions($options); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$productRepository->save($product); + +$categoryLinkManagement->assignProductToCategories( + $product->getSku(), + [2] +); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty_rollback.php new file mode 100644 index 0000000000000..55bd53a2d5794 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_decimal_qty_rollback.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Exception\NoSuchEntityException; + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->getInstance()->reinitialize(); + +/** @var \Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); +try { + $product = $productRepository->get('simple_with_decimal_qty', false, null, true); + $productRepository->delete($product); +} catch (NoSuchEntityException $e) { +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Observer/AddStockItemsObserverTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Observer/AddStockItemsObserverTest.php new file mode 100644 index 0000000000000..71af5d102a8d7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Observer/AddStockItemsObserverTest.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogInventory\Observer; + +use Magento\CatalogInventory\Api\Data\StockItemInterface; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\ResourceModel\Quote\Item\Collection; +use Magento\Quote\Model\ResourceModel\Quote\Item\CollectionFactory; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +class AddStockItemsObserverTest extends TestCase +{ + /** + * Test addStockItemsObserver add stock items to products as extension attributes in quote item collection. + * + * @magentoDataFixture Magento/Sales/_files/quote.php + */ + public function testAddStockItemsToProductCollection() + { + $quote = Bootstrap::getObjectManager()->create(Quote::class); + $quote->load('test01', 'reserved_order_id'); + /** @var CollectionFactory $collectionFactory */ + $collectionFactory = Bootstrap::getObjectManager()->create(CollectionFactory::class); + /** @var Collection $collection */ + $collection = $collectionFactory->create(); + $collection->setQuote($quote); + /** @var Quote\Item $quoteItem */ + foreach ($collection->getItems() as $quoteItem) { + self::assertNotEmpty($quoteItem->getProduct()->getExtensionAttributes()->getStockItem()); + self::assertInstanceOf( + StockItemInterface::class, + $quoteItem->getProduct()->getExtensionAttributes()->getStockItem() + ); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php index 946d15b6a81d7..ee7ddc1ba1aba 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php @@ -394,7 +394,7 @@ public function testCreateOrderNewCustomerDifferentAddresses() } /** - * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Catalog/_files/product_simple_with_decimal_qty.php * @magentoDbIsolation enabled * @magentoAppIsolation enabled */ @@ -425,6 +425,10 @@ public function testCreateOrderNewCustomer() $paymentMethod ); $order = $this->_model->createOrder(); + //Check, order considering decimal qty in product. + foreach ($order->getItems() as $orderItem) { + self::assertTrue($orderItem->getIsQtyDecimal()); + } $this->_verifyCreatedOrder($order, $shippingMethod); } From 6ec62717c16ed96d45e670d7f867b724f0449aaa Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Tue, 23 Jan 2018 11:04:34 -0600 Subject: [PATCH 149/277] :arrow_double_up: Forwardport of magento/magento2#12296 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12296.patch (created by @madonzy) based on commit(s): 1. addda4281d079e1b9988ee6fc97d7d79f092acfd Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#3596: Notice: Undefined index: value in /app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php on line 72 (reported by @gnusmus) --- app/code/Magento/Payment/Helper/Data.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Payment/Helper/Data.php b/app/code/Magento/Payment/Helper/Data.php index e3122913d5dfa..f3565ea324290 100644 --- a/app/code/Magento/Payment/Helper/Data.php +++ b/app/code/Magento/Payment/Helper/Data.php @@ -293,6 +293,7 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit foreach ($methods as $code => $title) { if (isset($groups[$code])) { $labelValues[$code]['label'] = $title; + $labelValues[$code]['value'] = null; } elseif (isset($groupRelations[$code])) { unset($labelValues[$code]); $labelValues[$groupRelations[$code]]['value'][$code] = ['value' => $code, 'label' => $title]; From e12b69fa0813aae743bbf8786fb517926b396612 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Tue, 23 Jan 2018 11:15:55 -0600 Subject: [PATCH 150/277] MAGETWO-85423: Create or update functional tests - update mtf tests with new selectors --- .../CatalogRule/Test/Repository/CatalogRule.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogRule.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogRule.xml index e8959da642eac..fabf09a8ce772 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogRule.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogRule.xml @@ -72,6 +72,21 @@ <field name="discount_amount" xsi:type="string">10</field> </dataset> + <dataset name="active_catalog_price_rule_with_category_conditions"> + <field name="name" xsi:type="string">rule_name%isolation%</field> + <field name="description" xsi:type="string">Rule Description</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="1" xsi:type="string">General</item> + </field> + <field name="rule" xsi:type="string">[Category|is|2]</field> + <field name="simple_action" xsi:type="string">Adjust final price to this percentage</field> + <field name="discount_amount" xsi:type="string">50</field> + </dataset> + <dataset name="catalog_price_rule_priority_0"> <field name="name" xsi:type="string">catalog_price_rule_priority_0</field> <field name="description" xsi:type="string">-50% of price, Priority = 0</field> From 31bb7159bbbcf1167d0ede8453978fdbe32a9073 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 11:29:35 -0600 Subject: [PATCH 151/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Change 'Home page' to 'Home Page' --- .../FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml | 2 +- .../Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 2 +- .../Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml index 998286460affc..e103ec98a82f9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml @@ -87,7 +87,7 @@ <element name="WidgetType" type="button" selector="#select_widget_type"/> <element name="WidgetTemplate" type="button" selector="select[name='parameters[template]']"/> <element name="BtnChooser" type="button" selector=".btn-chooser"/> - <element name="CMSPage" type="text" selector="//td[contains(text(),'Home page')]"/> + <element name="CMSPage" type="text" selector="//td[contains(text(),'Home Page')]"/> <element name="BlockPage" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/> <element name="PreCreateCategory" type="text" selector=" //span[contains(text(),'{{var1}}')]" parameterized="true"/> <element name="PreCreateProduct" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 24b25d3a3ef3a..239637ab7a341 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -71,7 +71,7 @@ <see userInput="You saved the page." stepKey="seeSuccessMessage"/> <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage1"/> <waitForPageLoad stepKey="waitForPageLoad7" /> - <see userInput="Home page" stepKey="seeHomePageCMSPage"/> + <see userInput="Home Page" stepKey="seeHomePageCMSPage"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml index 105a543733442..ba67a5e28e32b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -49,7 +49,7 @@ <switchToWindow stepKey="switchToWindow" userInput="action_window"/> <switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" /> <waitForPageLoad stepKey="waitForPageLoad9"/> - <see userInput="Home page" stepKey="seeHomePageCMSPage"/> + <see userInput="Home Page" stepKey="seeHomePageCMSPage"/> <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> From b7703c98a592bc4ddab127a1fe1f802fde167e7b Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 13:07:27 -0600 Subject: [PATCH 152/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix race condition with mce4 adapter --- .../plugins/magentovariable/editor_plugin.js | 353 +++++++++--------- .../wysiwyg/tiny_mce/tinymce4Adapter.js | 39 +- 2 files changed, 201 insertions(+), 191 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 7497403dc504f..1368a0b5dc0cb 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -5,206 +5,203 @@ /* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64, jQuery */ /* eslint-disable strict */ -tinymce.create('tinymce.plugins.magentovariable', { - - /** - * Initialize editor plugin. - * - * @param {tinymce.editor} editor - Editor instance that the plugin is initialized in. - * @param {String} url - Absolute URL to where the plugin is located. - */ - init: function (editor, url) { - var self = this; - - require([ - 'Magento_Variable/js/config-directive-generator', - 'Magento_Variable/js/custom-directive-generator' - ], function (configDirectiveGenerator, customDirectiveGenerator) { - self.configDirectiveGenerator = configDirectiveGenerator; - self.customDirectiveGenerator = customDirectiveGenerator; - }); +define([ + 'Magento_Variable/js/config-directive-generator', + 'Magento_Variable/js/custom-directive-generator' +], function (configDirectiveGenerator, customDirectiveGenerator) { + tinymce.create('tinymce.plugins.magentovariable', { /** - * Add new command to open variables selector slideout. + * Initialize editor plugin. + * + * @param {tinymce.editor} editor - Editor instance that the plugin is initialized in. + * @param {String} url - Absolute URL to where the plugin is located. */ - editor.addCommand('openVariablesSlideout', function (commandConfig) { - var selectedElement; - - if (commandConfig) { - selectedElement = commandConfig.selectedElement; - } else { - selectedElement = tinymce.activeEditor.selection.getNode(); - } - MagentovariablePlugin.setEditor(editor); - MagentovariablePlugin.loadChooser( - self.constructor.config.url, - self.constructor.adapter.id, - selectedElement - ); - }); + init: function (editor, url) { + var self = this; - /** - * Add button to the editor toolbar. - */ - editor.addButton('magentovariable', { - title: jQuery.mage.__('Insert Variable'), - tooltip: jQuery.mage.__('Insert Variable'), - cmd: 'openVariablesSlideout', - image: url + '/img/icon.png', + /** + * Add new command to open variables selector slideout. + */ + editor.addCommand('openVariablesSlideout', function (commandConfig) { + var selectedElement; + + if (commandConfig) { + selectedElement = commandConfig.selectedElement; + } else { + selectedElement = tinymce.activeEditor.selection.getNode(); + } + MagentovariablePlugin.setEditor(editor); + MagentovariablePlugin.loadChooser( + self.constructor.config.url, + self.constructor.adapter.id, + selectedElement + ); + }); /** - * Highlight or dismiss Insert Variable button when variable is selected or deselected. + * Add button to the editor toolbar. */ - onPostRender: function () { - var _this = this; + editor.addButton('magentovariable', { + title: jQuery.mage.__('Insert Variable'), + tooltip: jQuery.mage.__('Insert Variable'), + cmd: 'openVariablesSlideout', + image: url + '/img/icon.png', + + /** + * Highlight or dismiss Insert Variable button when variable is selected or deselected. + */ + onPostRender: function () { + var _this = this; + + editor.on('click', function (e) { + _this.active(false); + + if (jQuery(e.target).hasClass('magento-variable')) { + _this.active(true); + } + }); + } + }); - editor.on('click', function (e) { - _this.active(false); + /** + * Double click handler on the editor to handle dbl click on variable placeholder. + */ + editor.on('dblclick', function (evt) { + if (jQuery(evt.target).hasClass('magento-variable')) { + editor.selection.collapse(false); + editor.execCommand('openVariablesSlideout', { + ui: true, + selectedElement: evt.target + }); + } + }); - if (jQuery(e.target).hasClass('magento-variable')) { - _this.active(true); - } - }); - } - }); + /** + * Attach event handler for when wysiwyg editor is about to encode its content + */ + varienGlobalEvents.attachEventHandler('wysiwygEncodeContent', function (content) { + content = self.encodeVariables(content); - /** - * Double click handler on the editor to handle dbl click on variable placeholder. - */ - editor.on('dblclick', function (evt) { - if (jQuery(evt.target).hasClass('magento-variable')) { - editor.selection.collapse(false); - editor.execCommand('openVariablesSlideout', { - ui: true, - selectedElement: evt.target - }); - } - }); + return content; + }); - /** - * Attach event handler for when wysiwyg editor is about to encode its content - */ - varienGlobalEvents.attachEventHandler('wysiwygEncodeContent', function (content) { - content = self.encodeVariables(content); + /** + * Attach event handler for when wysiwyg editor is about to decode its content + */ + varienGlobalEvents.attachEventHandler('wysiwygDecodeContent', function (content) { + content = self.decodeVariables(content); - return content; - }); + return content; + }); + }, /** - * Attach event handler for when wysiwyg editor is about to decode its content + * Encode variables in content + * + * @param {String} content + * @returns {*} */ - varienGlobalEvents.attachEventHandler('wysiwygDecodeContent', function (content) { - content = self.decodeVariables(content); + encodeVariables: function (content) { + content = content.gsub(/\{\{config path=\"([^\"]+)\"\}\}/i, function (match) { + var path = match[1], + magentoVariables, + imageHtml; + + magentoVariables = JSON.parse(this.constructor.config.placeholders); + + if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'default') { + imageHtml = '<span id="%id" class="magento-variable magento-placeholder mceNonEditable">%s</span>'; + imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']); + } else { + imageHtml = '<span id="%id" class="' + + 'magento-variable magento-placeholder magento-placeholder-error ' + + 'mceNonEditable' + + '">' + + 'Not found' + + '</span>'; + } + + return imageHtml.replace('%id', Base64.idEncode(path)); + }.bind(this)); + + content = content.gsub(/\{\{customVar code=([^\}\"]+)\}\}/i, function (match) { + var path = match[1], + magentoVariables, + imageHtml; + + magentoVariables = JSON.parse(this.constructor.config.placeholders); + + if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'custom') { + imageHtml = '<span id="%id" class="magento-variable magento-custom-var magento-placeholder ' + + 'mceNonEditable">%s</span>'; + imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']); + } else { + imageHtml = '<span id="%id" class="' + + 'magento-variable magento-custom-var magento-placeholder ' + + 'magento-placeholder-error mceNonEditable' + + '">' + + match[1] + + '</span>'; + } + + return imageHtml.replace('%id', Base64.idEncode(path)); + }.bind(this)); return content; - }); - }, - - /** - * Encode variables in content - * - * @param {String} content - * @returns {*} - */ - encodeVariables: function (content) { - content = content.gsub(/\{\{config path=\"([^\"]+)\"\}\}/i, function (match) { - var path = match[1], - magentoVariables, - imageHtml; - - magentoVariables = JSON.parse(this.constructor.config.placeholders); - - if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'default') { - imageHtml = '<span id="%id" class="magento-variable magento-placeholder mceNonEditable">%s</span>'; - imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']); - } else { - imageHtml = '<span id="%id" class="' + - 'magento-variable magento-placeholder magento-placeholder-error ' + - 'mceNonEditable' + - '">' + - 'Not found' + - '</span>'; - } - - return imageHtml.replace('%id', Base64.idEncode(path)); - }.bind(this)); - - content = content.gsub(/\{\{customVar code=([^\}\"]+)\}\}/i, function (match) { - var path = match[1], - magentoVariables, - imageHtml; - - magentoVariables = JSON.parse(this.constructor.config.placeholders); - - if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'custom') { - imageHtml = '<span id="%id" class="magento-variable magento-custom-var magento-placeholder ' + - 'mceNonEditable">%s</span>'; - imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']); - } else { - imageHtml = '<span id="%id" class="' + - 'magento-variable magento-custom-var magento-placeholder ' + - 'magento-placeholder-error mceNonEditable' + - '">' + - match[1] + - '</span>'; - } - - return imageHtml.replace('%id', Base64.idEncode(path)); - }.bind(this)); - - return content; - }, + }, - /** - * Decode variables in content. - * - * @param {String} content - * @returns {*} - */ - decodeVariables: function (content) { - var parser, doc; - - parser = new DOMParser(); - doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); - - [].forEach.call(doc.querySelectorAll('span.magento-variable'), function (el) { - if (el.hasClassName('magento-custom-var')) { - jQuery(el).replaceWith( - this.customDirectiveGenerator.processConfig( - Base64.idDecode( - jQuery(el).attr('id') + /** + * Decode variables in content. + * + * @param {String} content + * @returns {*} + */ + decodeVariables: function (content) { + var parser, doc; + + parser = new DOMParser(); + doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); + + [].forEach.call(doc.querySelectorAll('span.magento-variable'), function (el) { + if (el.hasClassName('magento-custom-var')) { + jQuery(el).replaceWith( + customDirectiveGenerator.processConfig( + Base64.idDecode( + jQuery(el).attr('id') + ) ) - ) - ); - } else { - jQuery(el).replaceWith( - this.configDirectiveGenerator.processConfig( - Base64.idDecode( - jQuery(el).attr('id') + ); + } else { + jQuery(el).replaceWith( + configDirectiveGenerator.processConfig( + Base64.idDecode( + jQuery(el).attr('id') + ) ) - ) - ); - } - }); + ); + } + }); - return doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : content; - }, + return doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : content; + }, + + /** + * @return {Object} + */ + getInfo: function () { + return { + longname: 'Magento Variable Manager Plugin', + author: 'Magento Core Team', + authorurl: 'http://magentocommerce.com', + infourl: 'http://magentocommerce.com', + version: '1.0' + }; + } + }); /** - * @return {Object} + * Register plugin */ - getInfo: function () { - return { - longname: 'Magento Variable Manager Plugin', - author: 'Magento Core Team', - authorurl: 'http://magentocommerce.com', - infourl: 'http://magentocommerce.com', - version: '1.0' - }; - } + tinymce.PluginManager.add('magentovariable', tinymce.plugins.magentovariable); }); - -/** - * Register plugin - */ -tinymce.PluginManager.add('magentovariable', tinymce.plugins.magentovariable); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 45a14bc6f287b..988561e75167b 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -67,7 +67,8 @@ define([ * Setup TinyMCE4 editor */ setup: function (mode) { - var settings, + var deferreds = [], + settings, self = this; this.turnOff(); @@ -78,20 +79,30 @@ define([ if (this.config.plugins) { this.config.plugins.forEach(function (plugin) { + var deferred; + self.addPluginToToolbar(plugin.name, '|'); - if (plugin.src) { - tinyMCE4.PluginManager.load(plugin.name, plugin.src, function () { - var pluginConstructor = tinyMCE4.plugins[plugin.name]; + if (!plugin.src) { + return; + } - if (!pluginConstructor) { - throw new Error($t('Could not find plugin with name %1').replace('%1', plugin.name)); - } + deferred = jQuery.Deferred(); + deferreds.push(deferred); - pluginConstructor.config = plugin.options; - pluginConstructor.adapter = self; - }); - } + require([plugin.src], function () { + var pluginConstructor = tinyMCE4.plugins[plugin.name]; + + if (!pluginConstructor) { + throw new Error($t('Could not find plugin with name %1').replace('%1', plugin.name)); + } + + pluginConstructor.config = plugin.options; + pluginConstructor.adapter = self; + + tinyMCE4.PluginManager.load(plugin.name, plugin.src); + deferred.resolve(); + }); }); } @@ -102,8 +113,10 @@ define([ settings = this.getSettings(); settings.mode = mode; - tinyMCE4.init(settings); - this.getPluginButtons().hide(); + jQuery.when.apply(jQuery, deferreds).done(function () { + tinyMCE4.init(settings); + this.getPluginButtons().hide(); + }.bind(this)); }, /** From 0f86b44262abcf4b7fabc312739261e6e586e173 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <cspruiell@magento.com> Date: Tue, 23 Jan 2018 13:33:19 -0600 Subject: [PATCH 153/277] MAGETWO-85423: Create or update functional tests - add action groups to create user and user role --- .../User/ActionGroup/AdminCreateUserActionGroup.xml | 12 ++++++------ .../FunctionalTest/User/Cest/AdminCreateUserCest.xml | 6 ++---- .../User/Cest/AdminCreateUserRoleCest.xml | 2 -- .../Magento/FunctionalTest/User/Data/UserData.xml | 5 ++++- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml index 1c76913a619c8..286d3cc2e9cd5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml @@ -12,12 +12,12 @@ </arguments> <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user/new" stepKey="navigateToNewUser"/> <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{admin.username}}" stepKey="enterUserName" /> - <fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{admin.firstName}}" stepKey="enterFirstName" /> - <fillField selector="{{AdminEditUserSection.lastNameTextField}}" userInput="{{admin.lastName}}" stepKey="enterLastName" /> - <fillField selector="{{AdminEditUserSection.emailTextField}}" userInput="{{admin.username}}@magento.com" stepKey="enterEmail" /> - <fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="{{admin.password}}" stepKey="enterPassword" /> - <fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="{{admin.password}}" stepKey="confirmPassword" /> + <fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{admin2.username}}" stepKey="enterUserName" /> + <fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{admin2.firstName}}" stepKey="enterFirstName" /> + <fillField selector="{{AdminEditUserSection.lastNameTextField}}" userInput="{{admin2.lastName}}" stepKey="enterLastName" /> + <fillField selector="{{AdminEditUserSection.emailTextField}}" userInput="{{admin2.username}}@magento.com" stepKey="enterEmail" /> + <fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="{{admin2.password}}" stepKey="enterPassword" /> + <fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="{{admin2.password}}" stepKey="confirmPassword" /> <fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" /> <scrollToTopOfPage stepKey="scrollToTopOfPage" /> <click selector="{{AdminEditUserSection.userRoleTab}}" stepKey="clickUserRole" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml index 804d6bb8afa3d..2f5573171eabb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserCest.xml @@ -8,8 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <cest name="AdminCreateUserCest"> <annotations> - <features value="Create a user in admin"/> - <stories value="Create a user in admin"/> <env value="chrome"/> <env value="firefox"/> <group value="user"/> @@ -30,10 +28,10 @@ </actionGroup> <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToRoleGrid" /> <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin.username}}" stepKey="filterByUserName" /> + <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin2.username}}" stepKey="filterByUserName" /> <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch" /> <waitForPageLoad stepKey="waitForPageLoad2" /> - <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin.username}}" stepKey="seeNewRole" /> + <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin2.username}}" stepKey="seeNewRole" /> </test> </cest> </config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml index 144c3d271e75d..0bbf8bfd2ec72 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Cest/AdminCreateUserRoleCest.xml @@ -8,8 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <cest name="AdminCreateUserRoleCest"> <annotations> - <features value="Create a user role in admin"/> - <stories value="Create a user role in admin"/> <env value="chrome"/> <env value="firefox"/> <group value="userRole"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml index 9c57d75b6fac0..0d7fc83d64153 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml @@ -9,10 +9,13 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="admin" type="user"> + <data key="email">admin@magento.com</data> + <data key="password">admin123</data> + </entity> + <entity name="admin2" type="user"> <data key="username" unique="suffix">admin</data> <data key="firstName">John</data> <data key="lastName">Smith</data> - <data key="email">admin@magento.com</data> <data key="password">admin123</data> </entity> </config> From 9c880e8b858afbae4fe747d85501175c1de462e5 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 15:37:29 -0600 Subject: [PATCH 154/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Add SortByIdDescendingActionGroup --- .../SortByIdDescendingActionGroup.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml new file mode 100644 index 0000000000000..2ccd30acbba39 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SortByIdDescendingActionGroup"> + <conditionalClick selector="//th[contains(text(), 'ID')]" dependentSelector="//th[contains(text(), 'ID') and not(contains(@class, '_descend'))]" stepKey="sortByIdDescending" visible="true"/> + <conditionalClick selector="//parent::th//span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]" stepKey="sortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForIdSortDescendingToFinish" /> + </actionGroup> +</actionGroups> From d4d5abf07fed69f771d4754f2edb777021a17805 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 15:58:56 -0600 Subject: [PATCH 155/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix sortByIdDescending action group --- .../Backend/ActionGroup/SortByIdDescendingActionGroup.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml index 2ccd30acbba39..b8b8a34c9b4f6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml @@ -9,8 +9,10 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="SortByIdDescendingActionGroup"> - <conditionalClick selector="//th[contains(text(), 'ID')]" dependentSelector="//th[contains(text(), 'ID') and not(contains(@class, '_descend'))]" stepKey="sortByIdDescending" visible="true"/> - <conditionalClick selector="//parent::th//span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]" stepKey="sortByIdDescending" visible="true"/> - <waitForLoadingMaskToDisappear stepKey="waitForIdSortDescendingToFinish" /> + <conditionalClick selector="//parent::th//span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" /> + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="//parent::th//span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" /> </actionGroup> </actionGroups> From 30c80d6b1cf6ef29167186b15c8da3169056f279 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Tue, 23 Jan 2018 16:00:41 -0600 Subject: [PATCH 156/277] MAGETWO-85423: Create or update functional tests - fix sales rules data and store view action group --- .../Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml | 3 +++ .../Store/ActionGroup/AdminCreateStoreViewActionGroup.xml | 1 + 2 files changed, 4 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml index eb84c66bd2b1c..b4c8a2ceede14 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml @@ -11,6 +11,9 @@ <data key="name" unique="suffix">SimpleSalesRule</data> <data key="is_active">true</data> <data key="coupon_type">SPECIFIC_COUPON</data> + <data key="uses_per_coupon">10</data> + <data key="uses_per_customer">10</data> + <data key="simple_action">by_percent</data> <array key="customer_group_ids"> <item>0</item> </array> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index 6571e6b28a578..2239372c875a6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -16,6 +16,7 @@ <fillField selector="{{AdminNewStoreSection.storeCodeTextField}}" userInput="{{customStore.code}}" stepKey="enterStoreViewCode" /> <selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="Enabled" stepKey="setStatus" /> <click selector="{{AdminNewStoreViewActionsSection.saveButton}}" stepKey="clickSaveStoreView" /> + <waitForElementVisible selector="//*[@id='html-body']/div[4]/aside[2]/div[2]/footer/button[2]" stepKey="waitForModal" /> <seeInSource html="'Warning message'" stepKey="seeWarning" /> <click selector="//*[@id='html-body']/div[4]/aside[2]/div[2]/footer/button[2]" stepKey="dismissModal" /> <waitForPageLoad stepKey="waitForPageLoad2"/> From 97a4786b4e3255659bebb5b519c306f34ac4e034 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Tue, 23 Jan 2018 16:04:26 -0600 Subject: [PATCH 157/277] magento/magento2#11499: Ensure database is cleared/Magento reinstalled when TESTS_CLEANUP is enabled - fixed WebApi test application --- .../framework/Magento/TestFramework/WebApiApplication.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php b/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php index 03364acbb8663..992653a3a65d6 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php @@ -26,8 +26,12 @@ public function run() /** * {@inheritdoc} */ - public function install() + public function install($cleanup) { + if ($cleanup) { + $this->cleanup(); + } + $installOptions = $this->getInstallConfig(); /* Install application */ From c84783ea639d3068c41c84e9348f33eb06f98a5e Mon Sep 17 00:00:00 2001 From: Enrique Guadalupe <enrique.guadalupe@interactiv4.com> Date: Tue, 23 Jan 2018 23:04:28 +0100 Subject: [PATCH 158/277] Clean region when select country without dropdown for states --- app/code/Magento/Checkout/view/frontend/web/js/region-updater.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index 82033590b1135..d3ec635c5c3dd 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -195,6 +195,7 @@ define([ regionInput.hide(); label.attr('for', regionList.attr('id')); } else { + this._removeSelectOptions(regionList); if (this.options.isRegionRequired) { regionInput.addClass('required-entry').removeAttr('disabled'); requiredLabel.addClass('required'); From d6a066d71ebcf9aeb170e3f0dc69c0f118e0ad59 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 16:06:20 -0600 Subject: [PATCH 159/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix AdminAddImageToWYSWIYGBlockCest test --- .../Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index 320de3bcf4f36..0c376ad94a874 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -52,7 +52,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> <attachFile selector="{{BlockWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading4" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> + <waitForElementVisible selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> <seeElement selector="{{BlockWYSIWYGSection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> <see selector="{{BlockWYSIWYGSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> <click selector="{{BlockWYSIWYGSection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> @@ -73,8 +73,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad6"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> @@ -88,11 +88,13 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending2" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockTitle" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidgetBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> <waitForPageLoad stepKey="waitForPageLoad9" /> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <waitForPageLoad stepKey="waitForPageLoad10"/> From b28dcdc2669aac1a7bba16ef063515536c0a8590 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Tue, 23 Jan 2018 16:13:20 -0600 Subject: [PATCH 160/277] magento/magento2#11499: Ensure database is cleared/Magento reinstalled when TESTS_CLEANUP is enabled - fixed WebApi test application --- dev/tests/api-functional/framework/bootstrap.php | 6 ++---- .../framework/Magento/TestFramework/Application.php | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/tests/api-functional/framework/bootstrap.php b/dev/tests/api-functional/framework/bootstrap.php index 7a7b061858ac7..942582392e89e 100644 --- a/dev/tests/api-functional/framework/bootstrap.php +++ b/dev/tests/api-functional/framework/bootstrap.php @@ -58,10 +58,8 @@ ); if (defined('TESTS_MAGENTO_INSTALLATION') && TESTS_MAGENTO_INSTALLATION === 'enabled') { - if (defined('TESTS_CLEANUP') && TESTS_CLEANUP === 'enabled') { - $application->cleanup(); - } - $application->install(); + $cleanup = (defined('TESTS_CLEANUP') && TESTS_CLEANUP === 'enabled'); + $application->install($cleanup); } $bootstrap = new \Magento\TestFramework\Bootstrap( diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index bbe0286e29c68..12f067fad53a9 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -441,6 +441,7 @@ public function cleanup() /** * Install an application * + * @param bool $cleanup * @return void * @throws \Magento\Framework\Exception\LocalizedException */ From 2226cfaf6a85e9b752603a1e4a132188e0a80d1a Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Tue, 23 Jan 2018 16:15:56 -0600 Subject: [PATCH 161/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix AdminAddVariableToWYSWIYGBlockCest test --- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 6e6971a6151f9..f13587431e2e5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -77,8 +77,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad7"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> @@ -92,6 +92,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappearAfterClickingBtnChooser" /> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending2" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockTitle" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> From 0fffced0700478d2e98d6b4a8181b8e142e98f42 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Tue, 23 Jan 2018 16:30:04 -0600 Subject: [PATCH 162/277] magento/magento2#11879: #4004: Newsletter Subscriber create-date not set, and change_status_at broken - fixed backward compatibility --- app/code/Magento/Newsletter/Model/Subscriber.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index f54fd06864f80..c3a5dc588eabf 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -137,13 +137,13 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime * @param CustomerRepositoryInterface $customerRepository * @param AccountManagementInterface $customerAccountManagement * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection + * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource + * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param array $data + * @param \Magento\Framework\Stdlib\DateTime\DateTime|null $dateTime * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -154,20 +154,22 @@ public function __construct( \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, CustomerRepositoryInterface $customerRepository, AccountManagementInterface $customerAccountManagement, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], + \Magento\Framework\Stdlib\DateTime\DateTime $dateTime = null ) { $this->_newsletterData = $newsletterData; $this->_scopeConfig = $scopeConfig; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_customerSession = $customerSession; - $this->dateTime = $dateTime; + $this->dateTime = $dateTime ?: \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Stdlib\DateTime\DateTime::class + ); $this->customerRepository = $customerRepository; $this->customerAccountManagement = $customerAccountManagement; $this->inlineTranslation = $inlineTranslation; From 596e2606b054eb551e198892270103946afd2346 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Tue, 23 Jan 2018 16:35:32 -0600 Subject: [PATCH 163/277] magento/magento2#11944: Report Handled Exceptions To New Relic - fixed Magento Component Health Index --- .../Observer/ReportApplicationHandledExceptionToNewRelic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php b/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php index 32a64e61b6f99..724a488570207 100644 --- a/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php +++ b/app/code/Magento/NewRelicReporting/Model/Observer/ReportApplicationHandledExceptionToNewRelic.php @@ -18,12 +18,12 @@ class ReportApplicationHandledExceptionToNewRelic implements ObserverInterface /** * @var Config */ - protected $config; + private $config; /** * @var NewRelicWrapper */ - protected $newRelicWrapper; + private $newRelicWrapper; /** * @param Config $config From 3f5baca8c1390475b9503e3b49bd93eca2e2fdfe Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Tue, 23 Jan 2018 17:02:28 -0600 Subject: [PATCH 164/277] MAGETWO-85423: Create or update functional tests - Move Variable action group to Variable module --- .../ActionGroup/CreateCustomVariableActionGroup.xml | 1 - .../FunctionalTest/{Cms => Variable}/Data/VariableData.xml | 1 - 2 files changed, 2 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{Cms => Variable}/ActionGroup/CreateCustomVariableActionGroup.xml (99%) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{Cms => Variable}/Data/VariableData.xml (99%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CreateCustomVariableActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml similarity index 99% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CreateCustomVariableActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml index 859fae5e4a559..a9d03e997e26f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CreateCustomVariableActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml @@ -5,7 +5,6 @@ * See COPYING.txt for license details. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <actionGroup name="CreateCustomVariableActionGroup"> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/VariableData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/Data/VariableData.xml similarity index 99% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/VariableData.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/Data/VariableData.xml index 35fcfb79e7789..cae5f669b013d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/VariableData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/Data/VariableData.xml @@ -5,7 +5,6 @@ * See COPYING.txt for license details. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="_defaultVariable" type="cms_page"> From e2b13994904475afc2b8588874304bd4c693b3fa Mon Sep 17 00:00:00 2001 From: Enrique Guadalupe <enrique.guadalupe@interactiv4.com> Date: Wed, 24 Jan 2018 09:37:37 +0100 Subject: [PATCH 165/277] Fix codestyle --- app/code/Magento/Checkout/view/frontend/web/js/region-updater.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index d3ec635c5c3dd..c24d083162c48 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -196,6 +196,7 @@ define([ label.attr('for', regionList.attr('id')); } else { this._removeSelectOptions(regionList); + if (this.options.isRegionRequired) { regionInput.addClass('required-entry').removeAttr('disabled'); requiredLabel.addClass('required'); From 45b7e256ae0a3ac0115e0a81b96e0ccf49abc7a4 Mon Sep 17 00:00:00 2001 From: Enrique Guadalupe <enrique.guadalupe@interactiv4.com> Date: Wed, 24 Jan 2018 09:37:53 +0100 Subject: [PATCH 166/277] Fix codestyle --- .../Magento/Checkout/view/frontend/web/js/region-updater.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index c24d083162c48..3dd540afb54f3 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -196,7 +196,7 @@ define([ label.attr('for', regionList.attr('id')); } else { this._removeSelectOptions(regionList); - + if (this.options.isRegionRequired) { regionInput.addClass('required-entry').removeAttr('disabled'); requiredLabel.addClass('required'); From f0af87edad79b295b4be87f6f92502bacfbc2764 Mon Sep 17 00:00:00 2001 From: serhii balko <serhii.balko@transoftgroup.com> Date: Wed, 24 Jan 2018 11:49:02 +0200 Subject: [PATCH 167/277] Forwardport of magento/magento2#11460 to 2.3-develop branch --- app/code/Magento/Store/App/Request/PathInfoProcessor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Store/App/Request/PathInfoProcessor.php b/app/code/Magento/Store/App/Request/PathInfoProcessor.php index 613a6d1998858..0afef45bbc2df 100644 --- a/app/code/Magento/Store/App/Request/PathInfoProcessor.php +++ b/app/code/Magento/Store/App/Request/PathInfoProcessor.php @@ -6,6 +6,7 @@ namespace Magento\Store\App\Request; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Store\Model\Store; class PathInfoProcessor implements \Magento\Framework\App\Request\PathInfoProcessorInterface { @@ -42,7 +43,7 @@ public function process(\Magento\Framework\App\RequestInterface $request, $pathI } if ($store->isUseStoreInUrl()) { - if (!$request->isDirectAccessFrontendName($storeCode)) { + if (!$request->isDirectAccessFrontendName($storeCode) && $storeCode != Store::ADMIN_CODE ) { $this->storeManager->setCurrentStore($store->getCode()); $pathInfo = '/' . (isset($pathParts[1]) ? $pathParts[1] : ''); return $pathInfo; From c52ad59d1f3987905702f56c7edaf7d2706933d8 Mon Sep 17 00:00:00 2001 From: David Manners <dmanners87@gmail.com> Date: Wed, 24 Jan 2018 12:10:51 +0100 Subject: [PATCH 168/277] magento-engcom/import-export-improvements#42 fix up static tests failure --- .../Model/Import/Product/ImageTypeProcessor.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php index ee5e18488d55c..415d21d4cbce6 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/ImageTypeProcessor.php @@ -19,8 +19,7 @@ class ImageTypeProcessor */ public function __construct( \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory $resourceFactory - ) - { + ) { $this->resourceFactory = $resourceFactory; } From e52ccd59b47e7cdd9ea27894da48ae739d6cd81b Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 09:30:59 -0600 Subject: [PATCH 169/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix AdminAddWidgetToWYSIWYGBlockCest test --- .../Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 239637ab7a341..c02b3480908eb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -11,7 +11,7 @@ <annotations> <features value="Add Widget to WYSIWYG of Block"/> <stories value="Apply new WYSIWYG in Block-MAGETWO-47309"/> - <group value="widgetBLock"/> + <group value="widgetBlock"/> <title value="You should be able to add widget to WYSIWYG Editor of Block"/> <description value="You should be able to add widget to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> @@ -46,8 +46,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad3"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> @@ -61,6 +61,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear2" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate2" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn2" /> + <waitForLoadingMaskToDisappear stepKey="waitForWidgetChooserLoadingMaskToDisappear"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending2" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockTitle" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> From c90f700264ede4232c4a555f22c2511337a6f83d Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 09:41:17 -0600 Subject: [PATCH 170/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest test --- .../Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 88a20c6fb4aae..b88691b942997 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -16,7 +16,7 @@ <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-84184 "/> + <testCaseId value="MAGETWO-84184"/> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> @@ -55,8 +55,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> @@ -72,6 +72,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappearAfterClickingBtnChooser" /> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending2" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockCode" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> From 61c612cccf59e996886237ebd8c89da78e7c6ab2 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 09:45:41 -0600 Subject: [PATCH 171/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix AdminAddWidgetToWYSIWYGWithCmsStaticBlockTypeCest test --- .../Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 6b2cbdc24ae2c..6dfc538c4507d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -47,6 +47,7 @@ <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> <waitForLoadingMaskToDisappear stepKey="wait3"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{WidgetSection.BlockPage($$createPreBlock.identifier$$)}}" stepKey="waitForSlideoutOpens" /> <click selector="{{WidgetSection.BlockPage($$createPreBlock.identifier$$)}}" stepKey="selectPreCreateBlock" /> <waitForElementNotVisible selector="{{WidgetSection.SelectBlockTitle}}" stepKey="waitForSlideoutCloses" /> From 01340633be8f8fd32ce71ce0d7cb9683b56c372b Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 09:52:51 -0600 Subject: [PATCH 172/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix misspelling --- .../Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 6dfc538c4507d..88df008deb317 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -14,7 +14,7 @@ <stories value="Widgets in WYSIWYG"/> <group value="CMSStaticBlock"/> <title value="Create CMS Page With Widget Type:CMS Static Block"/> - <description value="Create CMS Page With Widget Type:CMS Static Blocl"/> + <description value="Create CMS Page With Widget Type:CMS Static Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83787"/> </annotations> From c235173f0d6489a5b2af9ee7d1e2cfadc507b3e2 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Wed, 24 Jan 2018 10:25:54 -0600 Subject: [PATCH 173/277] MAGETWO-85423: Create or update functional tests - add argument to store view action group --- .../Store/ActionGroup/AdminCreateStoreViewActionGroup.xml | 5 ++++- .../Magento/FunctionalTest/Store/Data/StoreGroupData.xml | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index 2239372c875a6..60aa97e85be00 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -8,10 +8,13 @@ <!-- Test XML Example --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <actionGroup name="AdminCreateStoreViewActionGroup"> + <arguments> + <argument name="StoreGroup" defaultValue="_defaultStoreGroup"/> + </arguments> <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_store/newStore" stepKey="navigateToNewStoreView"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <!--Create Store View--> - <selectOption selector="{{AdminNewStoreSection.storeGrpDropdown}}" userInput="Main Website Store" stepKey="selectStore" /> + <selectOption selector="{{AdminNewStoreSection.storeGrpDropdown}}" userInput="{{StoreGroup.name}}" stepKey="selectStore" /> <fillField selector="{{AdminNewStoreSection.storeNameTextField}}" userInput="{{customStore.name}}" stepKey="enterStoreViewName" /> <fillField selector="{{AdminNewStoreSection.storeCodeTextField}}" userInput="{{customStore.code}}" stepKey="enterStoreViewCode" /> <selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="Enabled" stepKey="setStatus" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreGroupData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreGroupData.xml index 81ee940acf78a..544f1b77c79f6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreGroupData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreGroupData.xml @@ -6,6 +6,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="_defaultStoreGroup" type="group"> + <data key="name">Main Website Store</data> + <data key="code">main_website_store</data> + <data key="root_category_id">2</data> + <data key="website_id">1</data> + </entity> <entity name="customStoreGroup" type="group"> <data key="group_id">null</data> <data key="name" unique="suffix">store</data> From 8074c812f50a47689c074c57877f53fc9cf589b8 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:28:09 -0600 Subject: [PATCH 174/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Use prop instead of attr --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 4 ++-- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 4 ++-- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index bab08a7e82df5..370f141fda580 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -295,9 +295,9 @@ define([ } if (enabled) { - this.getTextArea().removeAttr('disabled'); + this.getTextArea().removeProp('disabled'); } else { - this.getTextArea().attr('disabled', 'disabled'); + this.getTextArea().prop('disabled', 'disabled'); } }, diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index bdb8060d24612..0ed4130a4b0f8 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -107,10 +107,10 @@ define([ if (wysiwyg && disabled) { wysiwyg.setEditorStatus(false); - wysiwyg.getPluginButtons().attr('disabled', 'disabled'); + wysiwyg.getPluginButtons().prop('disabled', 'disabled'); } else if (wysiwyg) { wysiwyg.setEditorStatus(true); - wysiwyg.getPluginButtons().removeAttr('disabled'); + wysiwyg.getPluginButtons().removeProp('disabled'); } } }); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 988561e75167b..f2215f4bc4208 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -569,9 +569,9 @@ define([ } if (enabled) { - this.getTextArea().removeAttr('disabled'); + this.getTextArea().removeProp('disabled'); } else { - this.getTextArea().attr('disabled', 'disabled'); + this.getTextArea().prop('disabled', 'disabled'); } }, From 35afe742787f7820e59478d724b50e3723b859ee Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:35:09 -0600 Subject: [PATCH 175/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix return type --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 2 +- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 370f141fda580..07f889f14e08f 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -249,7 +249,7 @@ define([ }, /** - * @return {String} + * @return {string|null} */ getId: function () { return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index f2215f4bc4208..63c0d49f8d151 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -286,7 +286,7 @@ define([ }, /** - * @return {String} + * @return {string|null} */ getId: function () { return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; From b99b218d68f41a162a46cdd082b0cc668d4e95f0 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:36:18 -0600 Subject: [PATCH 176/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Refactor for jQuery collection return --- .../Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 07f889f14e08f..91049223ec954 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -392,9 +392,7 @@ define([ tinyMCE3.execCommand('mceAddControl', false, this.getId()); - this.getPluginButtons().each(function (e) { - e.hide(); - }); + this.getPluginButtons().hide(); return this; }, @@ -407,9 +405,7 @@ define([ tinyMCE3.execCommand('mceRemoveControl', false, this.getId()); - this.getPluginButtons().each(function (e) { - e.show(); - }); + this.getPluginButtons().show(); return this; }, From 8dc70f6a8f1c9060510b79b41b9ebbf1194c55d5 Mon Sep 17 00:00:00 2001 From: Krissy Hiserote <khiserote@magento.com> Date: Wed, 24 Jan 2018 11:39:29 -0600 Subject: [PATCH 177/277] MAGETWO-85423: Create or update functional tests - fix docBlock spacing --- .../ActionGroup/CreateCustomVariableActionGroup.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml index a9d03e997e26f..fca88dc520192 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> - <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - --> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <actionGroup name="CreateCustomVariableActionGroup"> From cd32037f28e9b1d05d1d8f36a418b6b3dfd8ef0d Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:42:27 -0600 Subject: [PATCH 178/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Use prop instead of attr --- .../Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 0ed4130a4b0f8..85eac47c5cfae 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -101,8 +101,10 @@ define([ * @param {Boolean} disabled */ setDisabled: function (disabled) { - if (this.$wysiwygEditorButton) { - this.$wysiwygEditorButton.attr('disabled', disabled); + if (this.$wysiwygEditorButton && disabled) { + this.$wysiwygEditorButton.prop('disabled', 'disabled'); + } else if (this.$wysiwygEditorButton) { + this.$wysiwygEditorButton.removeProp('disabled'); } if (wysiwyg && disabled) { From a3b14fc7449c62793ced197a974fd35fc4705e3b Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:44:40 -0600 Subject: [PATCH 179/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Add SortByIdDescendingActionGroup to AdminEditTextEditorProductAttributeCest --- .../Catalog/Test/AdminEditTextEditorProductAttributeCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml index 9b91f5a923f60..4847f1a9d80d1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml @@ -64,6 +64,7 @@ <waitForPageLoad stepKey="waitForPageLoad8"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGrid" /> <waitForPageLoad stepKey="waitForPageLoad9"/> + <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <click selector="{{AdminProductGridActionSection.productName(_defaultProduct.name)}}" stepKey="navigateToEditProduct" /> <waitForPageLoad stepKey="waitForPageLoad10" /> <seeElement selector="{{ProductAttributeWYSIWYGSection.TinyMCE4($$myProductAttributeCreation.attribute_code$$)}}" stepKey="waitForPageLoad11"/> From 09591a2762a38dd72d4b6fe85be3bf9578d2c1c9 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 11:50:16 -0600 Subject: [PATCH 180/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Encapsulate jQuery and unify decodeVariables implementation to use jQuery --- .../plugins/magentovariable/editor_plugin.js | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 1368a0b5dc0cb..418ab06097d7e 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -3,12 +3,13 @@ * See COPYING.txt for license details. */ -/* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64, jQuery */ +/* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64 */ /* eslint-disable strict */ define([ 'Magento_Variable/js/config-directive-generator', - 'Magento_Variable/js/custom-directive-generator' -], function (configDirectiveGenerator, customDirectiveGenerator) { + 'Magento_Variable/js/custom-directive-generator', + 'jquery' +], function (configDirectiveGenerator, customDirectiveGenerator, jQuery) { tinymce.create('tinymce.plugins.magentovariable', { /** @@ -155,28 +156,26 @@ define([ * Decode variables in content. * * @param {String} content - * @returns {*} + * @returns {String} */ decodeVariables: function (content) { - var parser, doc; - - parser = new DOMParser(); - doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); + var $el = jQuery(el), + doc = (new DOMParser()).parseFromString(content.replace(/"/g, '&quot;'), 'text/html'); [].forEach.call(doc.querySelectorAll('span.magento-variable'), function (el) { - if (el.hasClassName('magento-custom-var')) { - jQuery(el).replaceWith( + if ($el.hasClass('magento-custom-var')) { + $el.replaceWith( customDirectiveGenerator.processConfig( Base64.idDecode( - jQuery(el).attr('id') + $el.attr('id') ) ) ); } else { - jQuery(el).replaceWith( + $el.replaceWith( configDirectiveGenerator.processConfig( Base64.idDecode( - jQuery(el).attr('id') + $el.attr('id') ) ) ); From bff760d95a3daf26a4f23eeac8c616b6a3c8aeef Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 12:02:59 -0600 Subject: [PATCH 181/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Allow for mage/adminhtml/events to be loaded and encapsulated in local AMD module --- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 5 +++-- lib/web/mage/adminhtml/events.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 85eac47c5cfae..b2b4a5ed2692c 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -14,8 +14,9 @@ define([ 'underscore', 'ko', './abstract', - 'Magento_Variable/variables' -], function (wysiwyg, $, _, ko, Abstract) { + 'mage/adminhtml/events', + 'Magento_Variable/variables', +], function (wysiwyg, $, _, ko, Abstract, varienGlobalEvents) { 'use strict'; return Abstract.extend({ diff --git a/lib/web/mage/adminhtml/events.js b/lib/web/mage/adminhtml/events.js index a64b3218c5032..9404f12400c3d 100644 --- a/lib/web/mage/adminhtml/events.js +++ b/lib/web/mage/adminhtml/events.js @@ -188,4 +188,5 @@ define([ }; window.varienGlobalEvents = new varienEvents(); //jscs:ignore requireCapitalizedConstructors + return varienGlobalEvents; }); From 929664ac88d2d356692dc591bd1bceb27fd195f7 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 12:08:11 -0600 Subject: [PATCH 182/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Change setEditorStatus to setEnabledStatus --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 2 +- app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 4 ++-- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 91049223ec954..d0f2d7236ee32 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -287,7 +287,7 @@ define([ * * @param {Boolean} enabled */ - setEditorStatus: function (enabled) { + setEnabledStatus: function (enabled) { if (this.activeEditor()) { this.activeEditor().getBody().setAttribute('contenteditable', enabled); this.activeEditor().readonly = !enabled; diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index b2b4a5ed2692c..57f54f14a40c1 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -109,10 +109,10 @@ define([ } if (wysiwyg && disabled) { - wysiwyg.setEditorStatus(false); + wysiwyg.setEnabledStatus(false); wysiwyg.getPluginButtons().prop('disabled', 'disabled'); } else if (wysiwyg) { - wysiwyg.setEditorStatus(true); + wysiwyg.setEnabledStatus(true); wysiwyg.getPluginButtons().removeProp('disabled'); } } diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 63c0d49f8d151..0076ba87efb56 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -561,7 +561,7 @@ define([ * * @param {Boolean} enabled */ - setEditorStatus: function (enabled) { + setEnabledStatus: function (enabled) { if (this.activeEditor()) { this.activeEditor().getBody().setAttribute('contenteditable', enabled); this.activeEditor().readonly = !enabled; From aefd089d3b29023d4ec09036f5ae836a97fe549b Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:10:50 -0600 Subject: [PATCH 183/277] :arrow_double_up: Forwardport of magento/magento2#11670 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11670.patch (created by @ajpevers) based on commit(s): 1. cfd92c4ff13bcd55d0ac6b06a820d74ee78f2558 2. 94ae23d423c1647e2d9722f6a5cdd42c9bb7902d 3. 914520985b2ed374a57dd74df8688fff46f06e5b 4. ce20c0a5a9b27ace8d9891e38e864ffecadb2eff 5. 23f315c82601a3b89499b7a288833f5d36c798a2 6. 72533ad5801b3839398e1bd091495537a5429361 7. 1d341efa8875779b266c00bee84c9d88f2037c59 8. f2ba426ebf75937a3390c8166a08323128a302f4 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11669: API salesRefundInvoiceV1 does no save invoice ID on credit memo (reported by @ajpevers) --- .../Magento/Sales/Model/Order/Creditmemo.php | 16 ++++++++++++++-- .../Model/ResourceModel/Order/Creditmemo.php | 4 ++++ .../testsuite/Magento/Paypal/Model/IpnTest.php | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index c09a5da9177c3..19aac897c21e2 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -7,10 +7,12 @@ namespace Magento\Sales\Model\Order; use Magento\Framework\Api\AttributeValueFactory; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Sales\Api\Data\CreditmemoInterface; use Magento\Sales\Model\AbstractModel; use Magento\Sales\Model\EntityInterface; +use Magento\Sales\Model\Order\InvoiceFactory; /** * Order creditmemo model @@ -112,6 +114,11 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt */ protected $priceCurrency; + /** + * @var InvoiceFactory + */ + private $invoiceFactory; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -128,6 +135,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data + * @param InvoiceFactory $invoiceFactory * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -145,7 +153,8 @@ public function __construct( PriceCurrencyInterface $priceCurrency, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], + InvoiceFactory $invoiceFactory = null ) { $this->_creditmemoConfig = $creditmemoConfig; $this->_orderFactory = $orderFactory; @@ -155,6 +164,7 @@ public function __construct( $this->_commentFactory = $commentFactory; $this->_commentCollectionFactory = $commentCollectionFactory; $this->priceCurrency = $priceCurrency; + $this->invoiceFactory = $invoiceFactory ?: ObjectManager::getInstance()->get(InvoiceFactory::class); parent::__construct( $context, $registry, @@ -377,6 +387,9 @@ public function canRefund() */ public function getInvoice() { + if (!$this->getData('invoice') instanceof \Magento\Sales\Api\Data\InvoiceInterface && $this->getInvoiceId()) { + $this->setInvoice($this->invoiceFactory->create()->load($this->getInvoiceId())); + } return $this->getData('invoice'); } @@ -1505,6 +1518,5 @@ public function setExtensionAttributes(\Magento\Sales\Api\Data\CreditmemoExtensi { return $this->_setExtensionAttributes($extensionAttributes); } - //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo.php b/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo.php index f95a3206ce786..5ecbbd777a14e 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo.php @@ -50,6 +50,10 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) $object->setBillingAddressId($object->getOrder()->getBillingAddress()->getId()); } + if (!$object->getInvoiceId() && $object->getInvoice()) { + $object->setInvoiceId($object->getInvoice()->getId()); + } + return parent::_beforeSave($object); } } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php index 2da602c52242d..1a22ea947f85a 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/IpnTest.php @@ -123,7 +123,7 @@ public function testProcessIpnRequestPartialRefund() /** * Refund rest of order amount by Paypal Express IPN message service. * - * @magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_and_creditmemo.php + * @magentoDataFixture Magento/Paypal/_files/order_express_with_invoice_and_shipping.php * @magentoConfigFixture current_store payment/paypal_express/active 1 * @magentoConfigFixture current_store paypal/general/merchant_country US */ @@ -147,7 +147,7 @@ public function testProcessIpnRequestRestRefund() $creditmemoItems = $order->getCreditmemosCollection()->getItems(); $this->assertEquals(Order::STATE_CLOSED, $order->getState()) ; - $this->assertEquals(2, count($creditmemoItems)); + $this->assertEquals(1, count($creditmemoItems)); $this->assertEquals(10, $order->getSubtotalRefunded()); $this->assertEquals(10, $order->getBaseSubtotalRefunded()); $this->assertEquals(20, $order->getShippingRefunded()); From 0c799d2defa8341b7eb23bd5c92717b5f64138e7 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:10:57 -0600 Subject: [PATCH 184/277] :arrow_double_up: Forwardport of magento/magento2#12328 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12328.patch (created by @RomaKis) based on commit(s): 1. 147f6380f77ce76d2616ae40bff278215ca8d27a Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9742: Default welcome message returns after being deleted (reported by @robgt) --- .../Theme/Model/Design/Config/Storage.php | 7 +++- .../Magento/Theme/Model/Design/ConfigTest.php | 40 +++++++++++++++++++ .../Magento/Theme/_files/config_data.php | 19 +++++++++ .../Theme/_files/config_data_rollback.php | 13 ++++++ 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Theme/Model/Design/ConfigTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Theme/_files/config_data.php create mode 100644 dev/tests/integration/testsuite/Magento/Theme/_files/config_data_rollback.php diff --git a/app/code/Magento/Theme/Model/Design/Config/Storage.php b/app/code/Magento/Theme/Model/Design/Config/Storage.php index a73f70efa0adf..c97114f963a09 100644 --- a/app/code/Magento/Theme/Model/Design/Config/Storage.php +++ b/app/code/Magento/Theme/Model/Design/Config/Storage.php @@ -87,10 +87,13 @@ public function load($scope, $scopeId) $scopeId, $fieldData->getFieldConfig() ); - if ($value !== null) { - $fieldData->setValue($value); + + if ($value === null) { + $value = ''; } + $fieldData->setValue($value); } + return $designConfig; } diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Design/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Design/ConfigTest.php new file mode 100644 index 0000000000000..0ff43a5fd41ca --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Design/ConfigTest.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Theme\Model\Design; + +/** + * Test for \Magento\Theme\Model\Design\Config\Storage. + */ +class ConfigTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \Magento\Theme\Model\Design\Config\Storage + */ + private $storage; + + protected function setUp() + { + $this->storage = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Theme\Model\Design\Config\Storage::class + ); + } + + /** + * Test design/header/welcome if it is saved in db as empty(null) it should be shown on backend as empty. + * + * @magentoDataFixture Magento/Theme/_files/config_data.php + */ + public function testLoad() + { + $data = $this->storage->load('stores', 1); + foreach ($data->getExtensionAttributes()->getDesignConfigData() as $configData) { + if ($configData->getPath() == 'design/header/welcome') { + $this->assertSame('', $configData->getValue()); + } + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Theme/_files/config_data.php b/dev/tests/integration/testsuite/Magento/Theme/_files/config_data.php new file mode 100644 index 0000000000000..b8cbebc1f67c1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Theme/_files/config_data.php @@ -0,0 +1,19 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Config\Model\Config\Factory; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var Factory $configFactory */ +$configFactory = $objectManager->create(Factory::class); +/** @var \Magento\Config\Model\Config $config */ +$config = $configFactory->create(); +$config->setScope('stores'); +$config->setStore('default'); +$config->setDataByPath('design/header/welcome', null); +$config->save(); diff --git a/dev/tests/integration/testsuite/Magento/Theme/_files/config_data_rollback.php b/dev/tests/integration/testsuite/Magento/Theme/_files/config_data_rollback.php new file mode 100644 index 0000000000000..ac02e98b49373 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Theme/_files/config_data_rollback.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/** @var \Magento\Framework\App\ResourceConnection $resource */ +$resource = $objectManager->get(\Magento\Framework\App\ResourceConnection::class); +$connection = $resource->getConnection(); +$tableName = $resource->getTableName('core_config_data'); + +$connection->query("DELETE FROM $tableName WHERE path = 'design/header/welcome';"); From 0a282955d6ec5b8e8f8fc6cf94d1a813adebb285 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:07 -0600 Subject: [PATCH 185/277] :arrow_double_up: Forwardport of magento/magento2#12253 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12253.patch (created by @KarlDeux) based on commit(s): 1. b64e4703de287e65b12e5c7f280643b1d1377808 2. c21229cb8e91ebd30a28ad63aa87405faeafeee6 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12058: Can't save emoji in custom product options (reported by @archonkulis) --- .../product/view/options/type/text.phtml | 2 + .../jasmine/tests/lib/mage/validation.test.js | 72 +++++++++++++++++++ lib/web/i18n/en_US.csv | 1 + lib/web/mage/validation.js | 18 +++++ 4 files changed, 93 insertions(+) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml index 79dc8591fd724..11aedc33c2d42 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml @@ -29,6 +29,7 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; if ($_option->getMaxCharacters()) { $_textValidate['maxlength'] = $_option->getMaxCharacters(); } + $_textValidate['validate-no-utf8mb4-characters'] = true; ?> <input type="text" id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" @@ -47,6 +48,7 @@ $class = ($_option->getIsRequire()) ? ' required' : ''; if ($_option->getMaxCharacters()) { $_textAreaValidate['maxlength'] = $_option->getMaxCharacters(); } + $_textAreaValidate['validate-no-utf8mb4-characters'] = true; ?> <textarea id="options_<?= /* @escapeNotVerified */ $_option->getId() ?>_text" class="product-custom-option" diff --git a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js index 50931f940c689..12138e5939a7b 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js @@ -183,4 +183,76 @@ define([ )).toEqual(true); }); }); + + describe('Testing 3 bytes characters only policy (UTF-8)', function () { + it('rejects data, if any of the characters cannot be stored using UTF-8 collation', function () { + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '😅😂', null + )).toEqual(false); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '😅 test 😂', null + )).toEqual(false); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '💩 👻 💀', null + )).toEqual(false); + }); + + it('approves data, if all the characters can be stored using UTF-8 collation', function () { + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '!$-_%ç&#?!', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '1234567890', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, ' ', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'test', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'испытание', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'тест', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'փորձարկում', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'परीक्षण', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'テスト', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '테스트', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '测试', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, '測試', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'ทดสอบ', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'δοκιμή', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'اختبار', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'تست', null + )).toEqual(true); + expect($.validator.methods['validate-no-utf8mb4-characters'].call( + $.validator.prototype, 'מִבְחָן', null + )).toEqual(true); + }); + }); + }); diff --git a/lib/web/i18n/en_US.csv b/lib/web/i18n/en_US.csv index 21cfb51d5e3c9..5c63a191420a4 100644 --- a/lib/web/i18n/en_US.csv +++ b/lib/web/i18n/en_US.csv @@ -99,6 +99,7 @@ Submit,Submit "Password cannot be the same as email address.","Password cannot be the same as email address." "Please fix this field.","Please fix this field." "Please enter a valid email address.","Please enter a valid email address." +"Please remove invalid characters: {0}.", "Please remove invalid characters: {0}." "Please enter a valid URL.","Please enter a valid URL." "Please enter a valid date (ISO).","Please enter a valid date (ISO)." "Please enter only digits.","Please enter only digits." diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index aaece677a485d..589eb63fc4e1f 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -395,6 +395,24 @@ $.mage.__('Please enter at least {0} characters') ], + /* detect chars that would require more than 3 bytes */ + 'validate-no-utf8mb4-characters': [ + function (value) { + var validator = this, + message = $.mage.__('Please remove invalid characters: {0}.'), + matches = value.match(/(?:[\uD800-\uDBFF][\uDC00-\uDFFF])/g), + result = matches === null; + + if (!result) { + validator.charErrorMessage = message.replace('{0}', matches.join()); + } + + return result; + }, function () { + return this.charErrorMessage; + } + ], + /* eslint-disable max-len */ 'email2': [ function (value, element) { From d0d8d03982dde84fb119636492d3272b54bd59e0 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:14 -0600 Subject: [PATCH 186/277] :arrow_double_up: Forwardport of magento/magento2#12495 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12495.patch (created by @vovayatsyuk) based on commit(s): 1. fe3033e36ff583598e443cb85aa53b031c2551a4 2. 80520c5b7d5579603a514e5c45e47ec2cce40000 --- app/code/Magento/Theme/Block/Html/Topmenu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Theme/Block/Html/Topmenu.php b/app/code/Magento/Theme/Block/Html/Topmenu.php index b1b22e06d7172..7747576988077 100644 --- a/app/code/Magento/Theme/Block/Html/Topmenu.php +++ b/app/code/Magento/Theme/Block/Html/Topmenu.php @@ -331,7 +331,7 @@ protected function _getMenuItemClasses(\Magento\Framework\Data\Tree\Node $item) /** * Add identity * - * @param array $identity + * @param string|array $identity * @return void */ public function addIdentity($identity) From 1623007dc26f1953b10893304f3d9b7efa8db805 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:22 -0600 Subject: [PATCH 187/277] :arrow_double_up: Forwardport of magento/magento2#12515 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12515.patch (created by @lfluvisotto) based on commit(s): 1. fe9221f2c75b66c981aaa7b385f52cf9133de5ff 2. a3ed399935e9b1582c0aa387cfd3fabd20b571e9 --- app/code/Magento/Variable/Block/System/Variable/Edit.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/code/Magento/Variable/Block/System/Variable/Edit.php b/app/code/Magento/Variable/Block/System/Variable/Edit.php index be68814ea27e2..ea119b88fa795 100644 --- a/app/code/Magento/Variable/Block/System/Variable/Edit.php +++ b/app/code/Magento/Variable/Block/System/Variable/Edit.php @@ -90,11 +90,7 @@ protected function _preparelayout() */ public function getFormHtml() { - $formHtml = parent::getFormHtml(); - if (!$this->_storeManager->isSingleStoreMode() && $this->getVariable()->getId()) { - $formHtml = $formHtml; - } - return $formHtml; + return parent::getFormHtml(); } /** From 64f63b3cf56fe03ae78a0154133d27f05749be4a Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:30 -0600 Subject: [PATCH 188/277] :arrow_double_up: Forwardport of magento/magento2#12516 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12516.patch (created by @lfluvisotto) based on commit(s): 1. 702d7fe27916ed66dbb72af5bd59d07c58d546bf 2. 66556661476c7727af7e7a2b75c2e37519aafc49 --- .../Model/Import/AdvancedPricing.php | 2 +- .../AdvancedPricing/Validator/WebsiteTest.php | 2 +- .../Block/System/Store/Edit/AbstractForm.php | 2 +- .../Controller/Adminhtml/System/Account/Save.php | 6 +++--- .../Unit/Block/Widget/Grid/ColumnSetTest.php | 2 +- .../Test/Unit/Block/Widget/Grid/ColumnTest.php | 2 +- .../view/adminhtml/templates/page/header.phtml | 4 ++-- .../view/adminhtml/templates/system/search.phtml | 8 ++++---- .../templates/widget/grid/extended.phtml | 8 ++++---- .../Block/Product/View/Options/Type/Select.php | 4 ++-- .../Backend/GroupPrice/AbstractTest.php | 2 +- .../catalog/product/tab/inventory.phtml | 16 ++++++++-------- app/code/Magento/Cms/Helper/Wysiwyg/Images.php | 2 +- .../Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php | 2 +- .../Structure/ElementVisibilityCompositeTest.php | 2 +- .../Model/Product/Cache/Tag/ConfigurableTest.php | 2 +- .../Block/Adminhtml/Edit/Tab/Newsletter.php | 2 +- .../DeploymentConfig/ImporterFactoryTest.php | 2 +- .../DeploymentConfig/ValidatorFactoryTest.php | 2 +- .../Downloadable/Model/LinkRepository.php | 2 +- .../Downloadable/Model/SampleRepository.php | 2 +- .../Product/Form/Modifier/CompositeTest.php | 2 +- .../Magento/Eav/Model/Entity/AbstractEntity.php | 2 +- .../Unit/Block/Adminhtml/Template/EditTest.php | 2 +- .../Model/Observer/ReportConcurrentAdmins.php | 4 ++-- .../ReportConcurrentAdminsToNewRelic.php | 4 ++-- .../ReportSystemCacheFlushToNewRelic.php | 4 ++-- .../Model/ResourceModel/Carrier/Tablerate.php | 4 ++-- .../Block/Adminhtml/Form/Field/ExportTest.php | 2 +- .../Model/ResourceModel/Report/Settlement.php | 2 +- .../Payflow/Service/Response/TransactionTest.php | 2 +- .../Review/Model/ResourceModel/Rating/Option.php | 2 +- .../Model/ResourceModel/AbstractResource.php | 2 +- .../Block/Adminhtml/Items/AbstractItemsTest.php | 2 +- .../Unit/Block/Adminhtml/Items/AbstractTest.php | 2 +- .../Test/Unit/Model/Order/Payment/InfoTest.php | 2 +- .../Test/Unit/Model/Order/Pdf/AbstractTest.php | 2 +- .../Unit/Model/Order/Pdf/Config/ReaderTest.php | 2 +- .../RowBaseAndTotalBaseCalculatorTestCase.php | 2 +- .../Magento/Ui/Config/Converter/HtmlContent.php | 2 +- .../Magento/User/Model/ResourceModel/User.php | 2 +- app/code/Magento/User/Model/User.php | 6 +++--- .../Magento/User/Test/Unit/Model/UserTest.php | 10 +++++----- app/code/Magento/Webapi/Model/Soap/Fault.php | 2 +- .../Test/Unit/Model/Config/FileResolverTest.php | 6 +++--- .../Framework/Api/ExtensionAttributesFactory.php | 2 +- .../Magento/Framework/App/State/CleanupFiles.php | 2 +- .../App/Test/Unit/Cache/Tag/ResolverTest.php | 2 +- .../Test/Unit/Cache/Tag/Strategy/DummyTest.php | 2 +- .../Test/Unit/Cache/Tag/Strategy/FactoryTest.php | 2 +- .../Unit/Cache/Tag/Strategy/IdentifierTest.php | 2 +- .../Framework/App/Test/Unit/Request/HttpTest.php | 4 ++-- .../Reader/_files/ClassesForArgumentsReader.php | 6 +++--- .../Data/Test/Unit/Tree/Node/CollectionTest.php | 2 +- lib/internal/Magento/Framework/Xml/Security.php | 2 +- 55 files changed, 87 insertions(+), 87 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 23829d3725119..0e8acb37104e6 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -394,7 +394,7 @@ protected function saveAndReplaceAdvancedPrices() ? $rowData[self::COL_TIER_PRICE] : 0, 'percentage_value' => $rowData[self::COL_TIER_PRICE_TYPE] === self::TIER_PRICE_TYPE_PERCENT ? $rowData[self::COL_TIER_PRICE] : null, - 'website_id' => $this->getWebsiteId($rowData[self::COL_TIER_PRICE_WEBSITE]) + 'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE]) ]; } } diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php index 5111b4932d7a8..9a380ff75da24 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php @@ -27,7 +27,7 @@ class WebsiteTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->webSiteModel = $this->getMockBuilder(\Magento\Store\Model\WebSite::class) + $this->webSiteModel = $this->getMockBuilder(\Magento\Store\Model\Website::class) ->setMethods(['getBaseCurrency']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php index f19799d2e4939..034887c67d1ee 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php @@ -37,7 +37,7 @@ protected function _prepareForm() ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']] ); - $this->_prepareStoreFieldSet($form); + $this->_prepareStoreFieldset($form); $form->addField( 'store_type', diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php index c9bce1cbf3888..421885a0c32a3 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php @@ -54,9 +54,9 @@ public function execute() $user = $this->_objectManager->create(\Magento\User\Model\User::class)->load($userId); $user->setId($userId) - ->setUsername($this->getRequest()->getParam('username', false)) - ->setFirstname($this->getRequest()->getParam('firstname', false)) - ->setLastname($this->getRequest()->getParam('lastname', false)) + ->setUserName($this->getRequest()->getParam('username', false)) + ->setFirstName($this->getRequest()->getParam('firstname', false)) + ->setLastName($this->getRequest()->getParam('lastname', false)) ->setEmail(strtolower($this->getRequest()->getParam('email', false))); if ($this->_objectManager->get(\Magento\Framework\Validator\Locale::class)->isValid($interfaceLocale)) { diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php index be171a8ed40bf..df242a4cf6129 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnSetTest.php @@ -117,7 +117,7 @@ public function testSetFilterTypePropagatesFilterTypeToColumns() public function testGetRowUrlIfUrlPathNotSet() { - $this->assertEquals('#', $this->_block->getRowUrl(new \StdClass())); + $this->assertEquals('#', $this->_block->getRowUrl(new \stdClass())); } public function testGetRowUrl() diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnTest.php index da13af87b71ea..c5c56fd75fbe7 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ColumnTest.php @@ -351,7 +351,7 @@ public function testSetGetGrid() $this->_block->setFilter('StdClass'); - $grid = new \StdClass(); + $grid = new \stdClass(); $this->_block->setGrid($grid); $this->assertEquals($grid, $this->_block->getGrid()); } diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index 40b7173f47417..8feccc9cf1b8f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -29,7 +29,7 @@ data-mage-init='{"dropdown":{}}' data-toggle="dropdown"> <span class="admin__action-dropdown-text"> - <span class="admin-user-account-text"><?= $block->escapeHtml($block->getUser()->getUsername()) ?></span> + <span class="admin-user-account-text"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span> </span> </a> <ul class="admin__action-dropdown-menu"> @@ -39,7 +39,7 @@ href="<?= /* @escapeNotVerified */ $block->getUrl('adminhtml/system_account/index') ?>" <?= /* @escapeNotVerified */ $block->getUiId('user', 'account', 'settings') ?> title="<?= $block->escapeHtml(__('Account Setting')) ?>"> - <?= /* @escapeNotVerified */ __('Account Setting') ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUsername()) ?></span>) + <?= /* @escapeNotVerified */ __('Account Setting') ?> (<span class="admin-user-name"><?= $block->escapeHtml($block->getUser()->getUserName()) ?></span>) </a> </li> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index a528133b2bc3a..b50183ced29b4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -28,16 +28,16 @@ <script data-template="search-suggest" type="text/x-magento-template"> <ul class="search-global-menu"> <li class="item"> - <a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getURL('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a> + <a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getUrl('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a> </li> <li class="item"> - <a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getURL('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a> + <a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getUrl('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a> </li> <li class="item"> - <a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getURL('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a> + <a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a> </li> <li class="item"> - <a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getURL('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a> + <a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getUrl('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a> </li> <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index a31bf4d23abaa..f97db4ad993b1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -72,7 +72,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->getPagerVisibility()): ?> <div class="admin__data-grid-pager-wrap"> <select name="<?= /* @escapeNotVerified */ $block->getVarNameLimit() ?>" - id="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-limit" + id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" onchange="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.loadByElement(this)" class="admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> @@ -91,7 +91,7 @@ $numColumns = sizeof($block->getColumns()); selected="selected"<?php endif; ?>>200 </option> </select> - <label for="<?= $block->escapeHTML($block->getHtmlId()) ?><?= $block->escapeHTML($block->getHtmlId()) ?>_page-limit" + <label for="<?= $block->escapeHtml($block->getHtmlId()) ?><?= $block->escapeHtml($block->getHtmlId()) ?>_page-limit" class="admin__control-support-text"><?= /* @escapeNotVerified */ __('per page') ?></label> <div class="admin__data-grid-pager"> @@ -107,12 +107,12 @@ $numColumns = sizeof($block->getColumns()); <button type="button" class="action-previous disabled"><span><?= /* @escapeNotVerified */ __('Previous page') ?></span></button> <?php endif; ?> <input type="text" - id="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-current" + id="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current" name="<?= /* @escapeNotVerified */ $block->getVarNamePage() ?>" value="<?= /* @escapeNotVerified */ $_curPage ?>" class="admin__control-text" onkeypress="<?= /* @escapeNotVerified */ $block->getJsObjectName() ?>.inputPage(event, '<?= /* @escapeNotVerified */ $_lastPage ?>')" <?= /* @escapeNotVerified */ $block->getUiId('current-page') ?> /> - <label class="admin__control-support-text" for="<?= $block->escapeHTML($block->getHtmlId()) ?>_page-current"> + <label class="admin__control-support-text" for="<?= $block->escapeHtml($block->getHtmlId()) ?>_page-current"> <?= /* @escapeNotVerified */ __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?> </label> <?php if ($_curPage < $_lastPage): ?> diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php index d546ef483132b..7df9b972e1501 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php @@ -44,9 +44,9 @@ public function getValuesHtml() ] ); if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN) { - $select->setName('options[' . $_option->getid() . ']')->addOption('', __('-- Please Select --')); + $select->setName('options[' . $_option->getId() . ']')->addOption('', __('-- Please Select --')); } else { - $select->setName('options[' . $_option->getid() . '][]'); + $select->setName('options[' . $_option->getId() . '][]'); $select->setClass('multiselect admin__control-multiselect' . $require . ' product-custom-option'); } foreach ($_option->getValues() as $_value) { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php index 5963d8b161633..3003c2f8085e4 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php @@ -47,7 +47,7 @@ protected function setUp() 'scopeOverriddenValue' => $scopeOverriddenValue ] ); - $resource = $this->createPartialMock(\StdClass::class, ['getMainTable']); + $resource = $this->createPartialMock(\stdClass::class, ['getMainTable']); $resource->expects($this->any())->method('getMainTable')->will($this->returnValue('table')); $this->_model->expects($this->any())->method('_getResource')->will($this->returnValue($resource)); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml index 15c33c56e3ac6..2c62bbf8db3e9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml @@ -27,7 +27,7 @@ <option value="0"<?php if ($block->getFieldValue('manage_stock') == 0): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ __('No') ?></option> </select> <input type="hidden" id="inventory_manage_stock_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('manage_stock') ?>"> - <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_manage_stock') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_manage_stock" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_manage_stock"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> <?php if (!$block->isReadonly()): ?> @@ -67,7 +67,7 @@ toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_con <input type="text" class="input-text validate-number" id="inventory_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_min_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_min_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_min_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> @@ -94,7 +94,7 @@ toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_m name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][min_sale_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('min_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_min_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_min_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_min_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> @@ -117,7 +117,7 @@ toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_con </label> <div class="control"> <input type="text" class="input-text validate-number" id="inventory_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][max_sale_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('max_sale_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> - <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_max_sale_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> <div class="control-inner-wrap"> <input type="checkbox" id="inventory_use_config_max_sale_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_max_sale_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> @@ -182,7 +182,7 @@ toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_con </select> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_backorders') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_backorders" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_backorders]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_backorders"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> @@ -207,7 +207,7 @@ toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_confi <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][notify_stock_qty]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('notify_stock_qty') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_notify_stock_qty') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_notify_stock_qty" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_notify_stock_qty"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> @@ -238,7 +238,7 @@ toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use <input type="hidden" id="inventory_enable_qty_increments_default" value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('enable_qty_increments') ?>"> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_enable_qty_inc') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_enable_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_enable_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> @@ -262,7 +262,7 @@ toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventor <div class="control"> <input type="text" class="input-text validate-digits" id="inventory_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][qty_increments]" value="<?= /* @escapeNotVerified */ $block->getFieldValue('qty_increments') * 1 ?>" <?= /* @escapeNotVerified */ $_readonly ?>> <div class="control-inner-wrap"> - <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->IsNew()) ? 'checked="checked"' : '' ?> + <?php $_checked = ($block->getFieldValue('use_config_qty_increments') || $block->isNew()) ? 'checked="checked"' : '' ?> <input type="checkbox" id="inventory_use_config_qty_increments" name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" value="1" <?= /* @escapeNotVerified */ $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?= /* @escapeNotVerified */ $_readonly ?>> <label for="inventory_use_config_qty_increments"><?= /* @escapeNotVerified */ __('Use Config Settings') ?></label> </div> diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index ed9c6a7a534fa..8267fc2720b6d 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -148,7 +148,7 @@ public function convertIdToPath($id) */ public function isUsingStaticUrlsAllowed() { - $checkResult = new \StdClass(); + $checkResult = new \stdClass(); $checkResult->isAllowed = false; $this->_eventManager->dispatch( 'cms_wysiwyg_images_static_urls_allowed', diff --git a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php index 1fcc10609870a..7ca3ac5f0778f 100644 --- a/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php +++ b/app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php @@ -293,7 +293,7 @@ protected function generalSettingsIsUsingStaticUrlsAllowed($allowedValue) { $storeId = 1; $this->imagesHelper->setStoreId($storeId); - $checkResult = new \StdClass(); + $checkResult = new \stdClass(); $checkResult->isAllowed = false; $this->eventManagerMock->expects($this->any()) ->method('dispatch') diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php index a3bdb6f008f1d..b779c29c93155 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php @@ -44,7 +44,7 @@ protected function setUp() public function testException() { $visibility = [ - 'stdClass' => new \StdClass() + 'stdClass' => new \stdClass() ]; new ElementVisibilityComposite($visibility); diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Cache/Tag/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Cache/Tag/ConfigurableTest.php index 519288a50c858..5b4a8d5b8a975 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Cache/Tag/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Cache/Tag/ConfigurableTest.php @@ -39,7 +39,7 @@ public function testGetWithScalar() public function testGetTagsWithObject() { $this->expectException(\InvalidArgumentException::class, 'Provided argument must be a product'); - $this->model->getTags(new \StdClass()); + $this->model->getTags(new \stdClass()); } public function testGetTagsWithVariation() diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php index 8506defbf9005..032d1ae5d732f 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php @@ -160,7 +160,7 @@ public function initForm() ] ); - if ($this->customerAccountManagement->isReadOnly($customerId)) { + if ($this->customerAccountManagement->isReadonly($customerId)) { $form->getElement('subscription')->setReadonly(true, true); } $isSubscribed = $subscriber->isSubscribed(); diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterFactoryTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterFactoryTest.php index c9e101ed3a9e8..8a0284eb4f775 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterFactoryTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterFactoryTest.php @@ -55,7 +55,7 @@ public function testCreateWithInvalidArgumentException() $className = 'some/class/name'; /** @var \StdClass|\PHPUnit_Framework_MockObject_MockObject $importerMock */ - $importerMock = $this->getMockBuilder(\StdClass::class) + $importerMock = $this->getMockBuilder(\stdClass::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ValidatorFactoryTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ValidatorFactoryTest.php index 1da524b37ca15..50960808781ab 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ValidatorFactoryTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ValidatorFactoryTest.php @@ -56,7 +56,7 @@ public function testCreateWrongImplementation() { $className = 'className'; - $stdMock = $this->getMockBuilder(\StdClass::class) + $stdMock = $this->getMockBuilder(\stdClass::class) ->disableOriginalConstructor() ->getMock(); $this->objectManagerMock->expects($this->once()) diff --git a/app/code/Magento/Downloadable/Model/LinkRepository.php b/app/code/Magento/Downloadable/Model/LinkRepository.php index 65239ad353c3f..b84a8284c9083 100644 --- a/app/code/Magento/Downloadable/Model/LinkRepository.php +++ b/app/code/Magento/Downloadable/Model/LinkRepository.php @@ -207,7 +207,7 @@ protected function saveLink( $isGlobalScopeContent ) { $linkData = [ - 'link_id' => (int)$link->getid(), + 'link_id' => (int)$link->getId(), 'is_delete' => 0, 'type' => $link->getLinkType(), 'sort_order' => $link->getSortOrder(), diff --git a/app/code/Magento/Downloadable/Model/SampleRepository.php b/app/code/Magento/Downloadable/Model/SampleRepository.php index 633243ac2eb86..5b9e8e784b9f3 100644 --- a/app/code/Magento/Downloadable/Model/SampleRepository.php +++ b/app/code/Magento/Downloadable/Model/SampleRepository.php @@ -215,7 +215,7 @@ protected function saveSample( $isGlobalScopeContent ) { $sampleData = [ - 'sample_id' => (int)$sample->getid(), + 'sample_id' => (int)$sample->getId(), 'is_delete' => 0, 'type' => $sample->getSampleType(), 'sort_order' => $sample->getSortOrder(), diff --git a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CompositeTest.php b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CompositeTest.php index 155f95874eeeb..5b04c83f4ffb7 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CompositeTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CompositeTest.php @@ -156,7 +156,7 @@ protected function canShowDownloadablePanel($typeId) */ protected function initModifiers() { - $this->modifierMock = $this->getMockBuilder(\StdClass::class) + $this->modifierMock = $this->getMockBuilder(\stdClass::class) ->setMethods(['modifyData', 'modifyMeta']) ->getMock(); $this->modifierFactoryMock->expects($this->once()) diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index c94d78238a1ab..900fb2215fb27 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1653,7 +1653,7 @@ public function saveAttribute(\Magento\Framework\DataObject $object, $attributeC $this->_processAttributeValues(); $connection->commit(); } catch (\Exception $e) { - $connection->rollback(); + $connection->rollBack(); throw $e; } diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php index 6adabaccb33ea..05e4986a79382 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php @@ -60,7 +60,7 @@ protected function setUp() ['getFilesystem', '__wakeup', 'getPath', 'getDirectoryRead'] ); - $viewFilesystem = $this->getMockBuilder(\Magento\Framework\View\Filesystem::class) + $viewFilesystem = $this->getMockBuilder(\Magento\Framework\View\FileSystem::class) ->setMethods(['getTemplateFileName']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdmins.php b/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdmins.php index 615c80633cb0f..9dfd0e1e3319a 100644 --- a/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdmins.php +++ b/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdmins.php @@ -66,8 +66,8 @@ public function execute(Observer $observer) $user = $this->backendAuthSession->getUser(); $jsonData = [ 'id' => $user->getId(), - 'username' => $user->getUsername(), - 'name' => $user->getFirstname() . ' ' . $user->getLastname(), + 'username' => $user->getUserName(), + 'name' => $user->getFirstName() . ' ' . $user->getLastName(), ]; $modelData = [ diff --git a/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdminsToNewRelic.php b/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdminsToNewRelic.php index cff1b159d481d..2f142f6ac8124 100644 --- a/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdminsToNewRelic.php +++ b/app/code/Magento/NewRelicReporting/Model/Observer/ReportConcurrentAdminsToNewRelic.php @@ -58,10 +58,10 @@ public function execute(Observer $observer) if ($this->backendAuthSession->isLoggedIn()) { $user = $this->backendAuthSession->getUser(); $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER_ID, $user->getId()); - $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER, $user->getUsername()); + $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER, $user->getUserName()); $this->newRelicWrapper->addCustomParameter( Config::ADMIN_NAME, - $user->getFirstname() . ' ' . $user->getLastname() + $user->getFirstName() . ' ' . $user->getLastName() ); } } diff --git a/app/code/Magento/NewRelicReporting/Model/Observer/ReportSystemCacheFlushToNewRelic.php b/app/code/Magento/NewRelicReporting/Model/Observer/ReportSystemCacheFlushToNewRelic.php index 0e3ad1605f948..5500aba195936 100644 --- a/app/code/Magento/NewRelicReporting/Model/Observer/ReportSystemCacheFlushToNewRelic.php +++ b/app/code/Magento/NewRelicReporting/Model/Observer/ReportSystemCacheFlushToNewRelic.php @@ -58,8 +58,8 @@ public function execute(Observer $observer) if ($user->getId()) { $this->deploymentsFactory->create()->setDeployment( 'Cache Flush', - $user->getUsername() . ' flushed the cache.', - $user->getUsername() + $user->getUserName() . ' flushed the cache.', + $user->getUserName() ); } } diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php index 6dab0849673dc..fc36eaf6a97db 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php @@ -231,10 +231,10 @@ private function importData(array $fields, array $values) $this->_importedRows += count($values); } } catch (\Magento\Framework\Exception\LocalizedException $e) { - $connection->rollback(); + $connection->rollBack(); throw new \Magento\Framework\Exception\LocalizedException(__('Unable to import data'), $e); } catch (\Exception $e) { - $connection->rollback(); + $connection->rollBack(); $this->logger->critical($e); throw new \Magento\Framework\Exception\LocalizedException( __('Something went wrong while importing table rates.') diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Block/Adminhtml/Form/Field/ExportTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Block/Adminhtml/Form/Field/ExportTest.php index cc164e504b665..3e2c7df9087da 100644 --- a/app/code/Magento/OfflineShipping/Test/Unit/Block/Adminhtml/Form/Field/ExportTest.php +++ b/app/code/Magento/OfflineShipping/Test/Unit/Block/Adminhtml/Form/Field/ExportTest.php @@ -37,7 +37,7 @@ public function testGetElementHtml() $requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); $requestMock->expects($this->once())->method('getParam')->with('website')->will($this->returnValue(1)); - $mockData = $this->createPartialMock(\StdClass::class, ['toHtml']); + $mockData = $this->createPartialMock(\stdClass::class, ['toHtml']); $mockData->expects($this->once())->method('toHtml')->will($this->returnValue($expected)); $blockMock->expects($this->once())->method('getRequest')->will($this->returnValue($requestMock)); diff --git a/app/code/Magento/Paypal/Model/ResourceModel/Report/Settlement.php b/app/code/Magento/Paypal/Model/ResourceModel/Report/Settlement.php index d9d69e5b489c8..6af182cac2a42 100644 --- a/app/code/Magento/Paypal/Model/ResourceModel/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/ResourceModel/Report/Settlement.php @@ -88,7 +88,7 @@ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) } $connection->commit(); } catch (\Exception $e) { - $connection->rollback(); + $connection->rollBack(); } } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php index f5c9ab9a3d9f1..93a1072782448 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/Service/Response/TransactionTest.php @@ -67,7 +67,7 @@ public function gatewayResponseInvariants() { return [ "Input data is a string" => ['testInput'], - "Input data is an object" => [new \StdClass], + "Input data is an object" => [new \stdClass], "Input data is an array" => [['test' => 'input']] ]; } diff --git a/app/code/Magento/Review/Model/ResourceModel/Rating/Option.php b/app/code/Magento/Review/Model/ResourceModel/Rating/Option.php index 6f68000a1efff..ef4acb6c90cb8 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Rating/Option.php +++ b/app/code/Magento/Review/Model/ResourceModel/Rating/Option.php @@ -154,7 +154,7 @@ public function addVote($option) } $connection->commit(); } catch (\Exception $e) { - $connection->rollback(); + $connection->rollBack(); throw new \Exception($e->getMessage()); } return $this; diff --git a/app/code/Magento/Rule/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Rule/Model/ResourceModel/AbstractResource.php index 2fdb960521a97..6e685a9a9b978 100644 --- a/app/code/Magento/Rule/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Rule/Model/ResourceModel/AbstractResource.php @@ -81,7 +81,7 @@ public function bindRuleToEntity($ruleIds, $entityIds, $entityType) try { $this->_multiplyBunchInsert($ruleIds, $entityIds, $entityType); } catch (\Exception $e) { - $this->getConnection()->rollback(); + $this->getConnection()->rollBack(); throw $e; } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractItemsTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractItemsTest.php index 20f7a7061b6b0..a390c43276085 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractItemsTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractItemsTest.php @@ -84,7 +84,7 @@ public function testGetItemRenderer() */ public function testGetItemRendererThrowsExceptionForNonexistentRenderer() { - $renderer = $this->createMock(\StdClass::class); + $renderer = $this->createMock(\stdClass::class); $layout = $this->createPartialMock( \Magento\Framework\View\Layout::class, ['getChildName', 'getBlock', '__wakeup'] diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractTest.php index 311e5f697675b..a34373f516c42 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Items/AbstractTest.php @@ -62,7 +62,7 @@ public function testGetItemRenderer() */ public function testGetItemRendererThrowsExceptionForNonexistentRenderer() { - $renderer = $this->createMock(\StdClass::class); + $renderer = $this->createMock(\stdClass::class); $layout = $this->createPartialMock( \Magento\Framework\View\Layout::class, ['getChildName', 'getBlock', '__wakeup'] diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php index 70e5ad127e44c..293c2eea1231d 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php @@ -179,7 +179,7 @@ public function testDecrypt() */ public function testSetAdditionalInformationException() { - $this->info->setAdditionalInformation('object', new \StdClass()); + $this->info->setAdditionalInformation('object', new \stdClass()); } /** diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php index c91d4edb155a4..0761b5abb5d45 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php @@ -19,7 +19,7 @@ public function testInsertTotals() // Setup parameters, that will be passed to the tested model method $page = $this->createMock(\Zend_Pdf_Page::class); - $order = new \StdClass(); + $order = new \stdClass(); $source = $this->createMock(\Magento\Sales\Model\Order\Invoice::class); $source->expects($this->any())->method('getOrder')->will($this->returnValue($order)); diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/Config/ReaderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/Config/ReaderTest.php index b1b51c3f12330..b808a4139e84e 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/Config/ReaderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/Config/ReaderTest.php @@ -87,7 +87,7 @@ protected function setUp() public function testRead() { $expectedResult = new \stdClass(); - $constraint = function (\DOMDOcument $actual) { + $constraint = function (\DOMDocument $actual) { try { $expected = __DIR__ . '/_files/pdf_merged.xml'; \PHPUnit\Framework\Assert::assertXmlStringEqualsXmlFile($expected, $actual->saveXML()); diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php index 833520cc2855d..cbd7ed46e38d7 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseAndTotalBaseCalculatorTestCase.php @@ -7,7 +7,7 @@ namespace Magento\Tax\Test\Unit\Model\Calculation; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Tax\Model\Calculation\RowbaseCalculator; +use Magento\Tax\Model\Calculation\RowBaseCalculator; use Magento\Tax\Model\Calculation\TotalBaseCalculator; /** diff --git a/app/code/Magento/Ui/Config/Converter/HtmlContent.php b/app/code/Magento/Ui/Config/Converter/HtmlContent.php index f77b4a5285d5a..db874a302bd50 100644 --- a/app/code/Magento/Ui/Config/Converter/HtmlContent.php +++ b/app/code/Magento/Ui/Config/Converter/HtmlContent.php @@ -23,7 +23,7 @@ public function convert(\DOMNode $node, array $data) if ($node->nodeType == XML_ELEMENT_NODE) { $xml = '<?xml version="1.0"?>' . "\n" . '<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . "\n" - . $node->ownerDocument->saveXml($node) . "\n" + . $node->ownerDocument->saveXML($node) . "\n" . '</layout>'; $items['layout']['xsi:type'] = 'string'; $items['layout']['name'] = 'layout'; diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index 880dec93fc91b..b3e4936266a3f 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -222,7 +222,7 @@ protected function _createUserRole($parentId, ModelUser $user) 'role_type' => RoleUser::ROLE_TYPE, 'user_id' => $user->getId(), 'user_type' => UserContextInterface::USER_TYPE_ADMIN, - 'role_name' => $user->getFirstname(), + 'role_name' => $user->getFirstName(), ] ); diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index b1b655dddd0a3..2a7d43008f2ad 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -467,7 +467,7 @@ protected function createChangesDescriptionString() $changes[] = __('password'); } - if ($this->getUsername() != $this->getOrigData('username') && $this->getOrigData('username')) { + if ($this->getUserName() != $this->getOrigData('username') && $this->getOrigData('username')) { $changes[] = __('username'); } @@ -515,7 +515,7 @@ protected function sendUserNotificationEmail($changes, $email = null) */ public function getName($separator = ' ') { - return $this->getFirstname() . $separator . $this->getLastname(); + return $this->getFirstName() . $separator . $this->getLastName(); } /** @@ -547,7 +547,7 @@ public function authenticate($username, $password) ['username' => $username, 'user' => $this] ); $this->loadByUsername($username); - $sensitive = $config ? $username == $this->getUsername() : true; + $sensitive = $config ? $username == $this->getUserName() : true; if ($sensitive && $this->getId()) { $result = $this->verifyIdentity($password); } diff --git a/app/code/Magento/User/Test/Unit/Model/UserTest.php b/app/code/Magento/User/Test/Unit/Model/UserTest.php index 847b6b34d3501..1d63d1aed3e1a 100644 --- a/app/code/Magento/User/Test/Unit/Model/UserTest.php +++ b/app/code/Magento/User/Test/Unit/Model/UserTest.php @@ -183,11 +183,11 @@ public function testSendNotificationEmailsIfRequired() $this->model->setPassword($password); $this->model->setOrigData('password', $origPassword); - $this->model->setUsername($username); + $this->model->setUserName($username); $this->model->setOrigData('username', $origUsername); - $this->model->setFirstname($firstName); - $this->model->setLastname($lastName); + $this->model->setFirstName($firstName); + $this->model->setLastName($lastName); $this->configMock->expects($this->exactly(4)) ->method('getValue') @@ -255,8 +255,8 @@ public function testSendPasswordResetConfirmationEmail() $lastName = 'Bar'; $this->model->setEmail($email); - $this->model->setFirstname($firstName); - $this->model->setLastname($lastName); + $this->model->setFirstName($firstName); + $this->model->setLastName($lastName); $this->configMock->expects($this->at(0)) ->method('getValue') diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index ee9c194e7c55a..b8ddf4e47d451 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -355,7 +355,7 @@ protected function _getWrappedErrorsXml($wrappedErrors) $errorsXml = ''; foreach ($wrappedErrors as $error) { - $errorsXml .= $this->_generateErrorNodeXml($error); + $errorsXml .= $this->_generateErrorNodeXML($error); } if (!empty($errorsXml)) { $wrappedErrorsNode = self::NODE_DETAIL_WRAPPED_ERRORS; diff --git a/app/code/Magento/Widget/Test/Unit/Model/Config/FileResolverTest.php b/app/code/Magento/Widget/Test/Unit/Model/Config/FileResolverTest.php index 65e45b73d88eb..301869a50a713 100644 --- a/app/code/Magento/Widget/Test/Unit/Model/Config/FileResolverTest.php +++ b/app/code/Magento/Widget/Test/Unit/Model/Config/FileResolverTest.php @@ -41,7 +41,7 @@ protected function setUp() public function testGetGlobal() { - $expected = new \StdClass(); + $expected = new \stdClass(); $this->moduleReader ->expects($this->once()) ->method('getConfigurationFiles') @@ -52,7 +52,7 @@ public function testGetGlobal() public function testGetDesign() { - $expected = new \StdClass(); + $expected = new \stdClass(); $this->componentDirSearch->expects($this->once()) ->method('collectFiles') ->with(ComponentRegistrar::THEME, 'etc/file') @@ -63,7 +63,7 @@ public function testGetDesign() public function testGetDefault() { - $expected = new \StdClass(); + $expected = new \stdClass(); $this->factory->expects($this->once())->method('create')->with([])->willReturn($expected); $this->assertSame($expected, $this->object->get('file', 'unknown')); } diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php b/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php index d7a92460a7f4d..dab0650fc7f6e 100644 --- a/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php +++ b/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php @@ -97,7 +97,7 @@ public function getExtensibleInterfaceName($extensibleClassName) } $modelReflection = new \ReflectionClass($extensibleClassName); if ($modelReflection->isInterface() - && $modelReflection->isSubClassOf(self::EXTENSIBLE_INTERFACE_NAME) + && $modelReflection->isSubclassOf(self::EXTENSIBLE_INTERFACE_NAME) && $modelReflection->hasMethod('getExtensionAttributes') ) { $this->classInterfaceMap[$extensibleClassName] = $extensibleClassName; diff --git a/lib/internal/Magento/Framework/App/State/CleanupFiles.php b/lib/internal/Magento/Framework/App/State/CleanupFiles.php index 4202fd8883ec0..c95caf8310b77 100644 --- a/lib/internal/Magento/Framework/App/State/CleanupFiles.php +++ b/lib/internal/Magento/Framework/App/State/CleanupFiles.php @@ -106,7 +106,7 @@ private function emptyDir($code, $subPath = null) $messages[] = $dirPath . $path; try { $dir->delete($path); - } catch (FilesystemException $e) { + } catch (FileSystemException $e) { $messages[] = $e->getMessage(); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php index 4348177ef326f..f4560ed31ae49 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php @@ -47,7 +47,7 @@ public function testGetTagsForNotObject() public function testGetTagsForObject() { $strategyReturnValue = ['test tag']; - $object = new \StdClass; + $object = new \stdClass; $this->strategy->expects($this->once()) ->method('getTags') ->with($object) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php index e8c76048f4eac..ad04326064587 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php @@ -28,7 +28,7 @@ public function testGetTagsWithObject() { $emptyArray = []; - $this->assertEquals($emptyArray, $this->model->getTags(new \StdClass)); + $this->assertEquals($emptyArray, $this->model->getTags(new \stdClass)); $identityInterface = $this->getMockForAbstractClass(\Magento\Framework\DataObject\IdentityInterface::class); $this->assertEquals($emptyArray, $this->model->getTags($identityInterface)); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php index 7f570d9f13523..8964bd70f0ba8 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php @@ -55,7 +55,7 @@ public function testGetStrategyWithScalar() public function testGetStrategyWithObject() { - $this->assertEquals($this->dummyStrategy, $this->model->getStrategy(new \StdClass)); + $this->assertEquals($this->dummyStrategy, $this->model->getStrategy(new \stdClass)); } public function testGetStrategyWithIdentityInterface() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php index e2039c0517c53..d0fcf9d8a739d 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php @@ -28,7 +28,7 @@ public function testGetWithScalar() public function testGetTagsWithObject() { - $this->assertEquals([], $this->model->getTags(new \StdClass)); + $this->assertEquals([], $this->model->getTags(new \stdClass)); } public function testGetTagsWithIdentityInterface() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php index 450e1ed0b3a00..66eee671e17d3 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php @@ -363,7 +363,7 @@ public function testIsSafeMethodTrue($httpMethod) { $this->_model = $this->getModel(); $_SERVER['REQUEST_METHOD'] = $httpMethod; - $this->assertEquals(true, $this->_model->IsSafeMethod()); + $this->assertEquals(true, $this->_model->isSafeMethod()); } /** @@ -375,7 +375,7 @@ public function testIsSafeMethodFalse($httpMethod) { $this->_model = $this->getModel(); $_SERVER['REQUEST_METHOD'] = $httpMethod; - $this->assertEquals(false, $this->_model->IsSafeMethod()); + $this->assertEquals(false, $this->_model->isSafeMethod()); } public function httpSafeMethodProvider() diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php index c867e39032e1e..800cd2851eb66 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php @@ -131,7 +131,7 @@ public function __construct( $this->_arrayVariable = $arrayVariable; } } -class ThirdClassForParentCall extends firstClassForParentCall +class ThirdClassForParentCall extends FirstClassForParentCall { /** * @var stdClass @@ -154,7 +154,7 @@ public function __construct(\stdClass $stdClassObject, \ClassExtendsDefaultPhpTy $this->_secondClass = $secondClass; } } -class WrongArgumentsOrder extends firstClassForParentCall +class WrongArgumentsOrder extends FirstClassForParentCall { /** * @var stdClass @@ -177,7 +177,7 @@ public function __construct(\stdClass $stdClassObject, \ClassExtendsDefaultPhpTy $this->_secondClass = $secondClass; } } -class ArgumentsOnSeparateLines extends firstClassForParentCall +class ArgumentsOnSeparateLines extends FirstClassForParentCall { /** * @var stdClass diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Tree/Node/CollectionTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Tree/Node/CollectionTest.php index 58e6378759010..e91ec72dae112 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Tree/Node/CollectionTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Tree/Node/CollectionTest.php @@ -40,7 +40,7 @@ public function testOffsets() $this->assertSame($this->collection->offsetExists('node1'), true); $this->collection->offsetSet('node1', 'Hello'); $this->assertSame($this->collection->offsetExists('node1'), true); - $this->assertSame($this->collection->offsetget('node1'), 'Hello'); + $this->assertSame($this->collection->offsetGet('node1'), 'Hello'); $this->collection->offsetUnset('node1'); $this->assertSame($this->collection->offsetExists('node1'), false); } diff --git a/lib/internal/Magento/Framework/Xml/Security.php b/lib/internal/Magento/Framework/Xml/Security.php index 72af506a3294e..e502429e4511a 100644 --- a/lib/internal/Magento/Framework/Xml/Security.php +++ b/lib/internal/Magento/Framework/Xml/Security.php @@ -72,7 +72,7 @@ function ($errno, $errstr) { E_WARNING ); - $result = (bool)$document->loadXml($xmlContent, LIBXML_NONET); + $result = (bool)$document->loadXML($xmlContent, LIBXML_NONET); restore_error_handler(); // Entity load to previous setting libxml_disable_entity_loader($loadEntities); From eceb5eb5d31608ef96403dbd7857e8178acb5dc6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:37 -0600 Subject: [PATCH 189/277] :arrow_double_up: Forwardport of magento/magento2#12161 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12161.patch (created by @scazz010) based on commit(s): 1. 6330103f3092db7414f2118588d9ffcee3a03e8a 2. faa71295186ddbf16f53b19286ce4f3035adf3f4 --- lib/web/mage/menu.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index a59ebbaf8badc..834981402f67f 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -21,6 +21,7 @@ define([ expanded: false, showDelay: 42, hideDelay: 300, + delay: 300, mediaBreakpoint: '(max-width: 768px)' }, @@ -30,6 +31,8 @@ define([ _create: function () { var self = this; + this.delay = this.options.delay; + this._super(); $(window).on('resize', function () { self.element.find('.submenu-reverse').removeClass('submenu-reverse'); @@ -586,7 +589,7 @@ define([ html.removeClass('nav-open'); setTimeout(function () { html.removeClass('nav-before-open'); - }, 300); + }, this.options.hideDelay); } }, From e1db353d9fd9ed508846160a3cdb16228c09b60a Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:43 -0600 Subject: [PATCH 190/277] :arrow_double_up: Forwardport of magento/magento2#12441 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12441.patch (created by @jalogut) based on commit(s): 1. 8805bc07da432624236a4678258a5c6973545810 2. e47ec9b35325c1c1134f9340784f7e8f79c36c61 3. 13574b461903ad8ac726e09ad3f6de015c670dbb --- .../Command/App/ConfigStatusCommand.php | 64 ++++++++++++++++ .../Command/App/ConfigStatusCommandTest.php | 76 +++++++++++++++++++ app/code/Magento/Deploy/etc/di.xml | 1 + 3 files changed, 141 insertions(+) create mode 100644 app/code/Magento/Deploy/Console/Command/App/ConfigStatusCommand.php create mode 100644 app/code/Magento/Deploy/Test/Unit/Console/Command/App/ConfigStatusCommandTest.php diff --git a/app/code/Magento/Deploy/Console/Command/App/ConfigStatusCommand.php b/app/code/Magento/Deploy/Console/Command/App/ConfigStatusCommand.php new file mode 100644 index 0000000000000..90438380e2232 --- /dev/null +++ b/app/code/Magento/Deploy/Console/Command/App/ConfigStatusCommand.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Deploy\Console\Command\App; + +use Magento\Deploy\Model\DeploymentConfig\ChangeDetector; +use Magento\Framework\Console\Cli; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for checking if Config propagation is up to date + */ +class ConfigStatusCommand extends Command +{ + /** + * Code for error when config import is required. + */ + const EXIT_CODE_CONFIG_IMPORT_REQUIRED = 2; + + /** + * @var ChangeDetector + */ + private $changeDetector; + + /** + * ConfigStatusCommand constructor. + * @param ChangeDetector $changeDetector + */ + public function __construct(ChangeDetector $changeDetector) + { + $this->changeDetector = $changeDetector; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('app:config:status') + ->setDescription('Checks if config propagation requires update'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->changeDetector->hasChanges()) { + $output->writeln( + '<info>Config files have changed. ' . + 'Run app:config:import or setup:upgrade command to synchronize configuration.</info>' + ); + return self::EXIT_CODE_CONFIG_IMPORT_REQUIRED; + } + $output->writeln('<info>Config files are up to date.</info>'); + return Cli::RETURN_SUCCESS; + } +} diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/App/ConfigStatusCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/App/ConfigStatusCommandTest.php new file mode 100644 index 0000000000000..7822e75930eba --- /dev/null +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/App/ConfigStatusCommandTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Deploy\Test\Unit\Console\Command\App; + +use Magento\Deploy\Console\Command\App\ConfigStatusCommand; +use Magento\Deploy\Model\DeploymentConfig\ChangeDetector; +use Magento\Framework\Console\Cli; +use Symfony\Component\Console\Tester\CommandTester; + +/** + * @inheritdoc + */ +class ConfigStatusCommandTest extends \PHPUnit\Framework\TestCase +{ + + /** + * @var ConfigStatusCommand + */ + private $command; + /** + * @var ChangeDetector + */ + private $changeDetector; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->changeDetector = $this->getMockBuilder(ChangeDetector::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->command = new ConfigStatusCommand($this->changeDetector); + } + + /** + * @param bool $hasChanges + * @param string $expectedMessage + * @param int $expectedCode + * + * @dataProvider executeDataProvider + */ + public function testExecute(bool $hasChanges, $expectedMessage, $expectedCode) + { + $this->changeDetector->expects($this->once()) + ->method('hasChanges') + ->will($this->returnValue($hasChanges)); + + $tester = new CommandTester($this->command); + $tester->execute([]); + + $this->assertEquals($expectedMessage, $tester->getDisplay()); + $this->assertSame($expectedCode, $tester->getStatusCode()); + } + + public function executeDataProvider() + { + return [ + 'Config is up to date' => [ + false, + 'Config files are up to date.' . PHP_EOL, + Cli::RETURN_SUCCESS + ], + 'Config needs update' => [ + true, + 'Config files have changed. ' . + 'Run app:config:import or setup:upgrade command to synchronize configuration.' . PHP_EOL, + ConfigStatusCommand::EXIT_CODE_CONFIG_IMPORT_REQUIRED, + ], + ]; + } +} diff --git a/app/code/Magento/Deploy/etc/di.xml b/app/code/Magento/Deploy/etc/di.xml index e47fca3a6b946..ce7c84c95538a 100644 --- a/app/code/Magento/Deploy/etc/di.xml +++ b/app/code/Magento/Deploy/etc/di.xml @@ -31,6 +31,7 @@ <item name="dumpApplicationCommand" xsi:type="object">\Magento\Deploy\Console\Command\App\ApplicationDumpCommand</item> <item name="sensitiveConfigSetCommand" xsi:type="object">\Magento\Deploy\Console\Command\App\SensitiveConfigSetCommand</item> <item name="configImportCommand" xsi:type="object">Magento\Deploy\Console\Command\App\ConfigImportCommand</item> + <item name="configStatusCommand" xsi:type="object">Magento\Deploy\Console\Command\App\ConfigStatusCommand</item> </argument> </arguments> </type> From 7b12d50d92e1503f959219a5c8f05ecbef1cc423 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:51 -0600 Subject: [PATCH 191/277] :arrow_double_up: Forwardport of magento/magento2#11608 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11608.patch (created by @sylink) based on commit(s): 1. 40d51e4646e47eb3b25ae68b3673ff06e1c51270 2. c7a6c5669660a1dfb909d21a4a7ef70d0d09b8ff Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#9633: Web Setup Wizard 500 error when session storage is configured to use memcache (reported by @dotsoa) --- .../Magento/Framework/Session/ConfigTest.php | 53 ++++++++++--------- .../Magento/Framework/Session/Config.php | 8 +++ .../Session/Test/Unit/ConfigTest.php | 27 ++++++---- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php index 629089ae4d99e..573531cff960a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php @@ -36,15 +36,18 @@ protected function setUp() $sessionManager->writeClose(); } $this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); - - $this->deploymentConfigMock->expects($this->at(0)) - ->method('get') - ->with(Config::PARAM_SESSION_SAVE_PATH) - ->will($this->returnValue(null)); - $this->deploymentConfigMock->expects($this->at(1)) + $this->deploymentConfigMock ->method('get') - ->with(Config::PARAM_SESSION_CACHE_LIMITER) - ->will($this->returnValue($this->_cacheLimiter)); + ->willReturnCallback(function ($configPath) { + switch ($configPath) { + case Config::PARAM_SESSION_SAVE_METHOD: + return 'files'; + case Config::PARAM_SESSION_CACHE_LIMITER: + return $this->_cacheLimiter; + default: + return null; + } + }); $this->_model = $this->_objectManager->create( \Magento\Framework\Session\Config::class, @@ -83,15 +86,6 @@ public function testDefaultConfiguration() $this->assertEquals($this->_model->getSavePath(), $this->_model->getOption('save_path')); } - /** - * Unable to add integration tests for testGetLifetimePathNonDefault - * - * Error: Cannot modify header information - headers already sent - */ - public function testGetLifetimePathNonDefault() - { - } - public function testSetOptionsInvalidValue() { $preValue = $this->_model->getOptions(); @@ -280,16 +274,27 @@ public function testConstructorSavePath($existing, $given, $expected) $this->markTestSkipped('Cannot set session.save_path with ini_set'); } - $this->deploymentConfigMock->expects($this->at(0)) + $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); + $deploymentConfigMock ->method('get') - ->with(Config::PARAM_SESSION_SAVE_PATH) - ->will($this->returnValue($given)); - - $this->_model = $this->_objectManager->create( + ->willReturnCallback(function ($configPath) use ($given) { + switch ($configPath) { + case Config::PARAM_SESSION_SAVE_METHOD: + return 'files'; + case Config::PARAM_SESSION_CACHE_LIMITER: + return $this->_cacheLimiter; + case Config::PARAM_SESSION_SAVE_PATH: + return $given; + default: + return null; + } + }); + + $model = $this->_objectManager->create( \Magento\Framework\Session\Config::class, - ['deploymentConfig' => $this->deploymentConfigMock] + ['deploymentConfig' => $deploymentConfigMock] ); - $this->assertEquals($expected, $this->_model->getOption('save_path')); + $this->assertEquals($expected, $model->getOption('save_path')); if ($sessionSavePath != ini_get('session.save_path')) { ini_set('session.save_path', $sessionSavePath); diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index 26ae1635f18f1..053bd3e7fd6b9 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -134,6 +134,14 @@ public function __construct( $this->setSavePath($savePath); } + /** + * Session save handler - memcache, files, etc + */ + $saveHandler = $deploymentConfig->get(self::PARAM_SESSION_SAVE_METHOD); + if ($saveHandler) { + $this->setOption('session.save_handler', $saveHandler); + } + /** * Session cache limiter */ diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php index 66fc12b493090..12e28cdb3970d 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php @@ -350,33 +350,36 @@ public function constructorDataProvider() true, true, [ - 'session.cache_limiter' => 'files', + 'session.cache_limiter' => 'private_no_expire', 'session.cookie_lifetime' => 7200, 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, 'session.cookie_secure' => false, + 'session.save_handler' => 'files' ], ], 'all invalid' => [ true, false, [ - 'session.cache_limiter' => 'files', + 'session.cache_limiter' => 'private_no_expire', 'session.cookie_httponly' => false, 'session.cookie_secure' => false, + 'session.save_handler' => 'files' ], ], 'invalid_valid' => [ false, true, [ - 'session.cache_limiter' => 'files', + 'session.cache_limiter' => 'private_no_expire', 'session.cookie_lifetime' => 3600, 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, 'session.cookie_secure' => false, + 'session.save_handler' => 'files' ], ], ]; @@ -429,14 +432,18 @@ protected function getModel($validator) ->will($this->returnValue($dirMock)); $deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); - $deploymentConfigMock->expects($this->at(0)) + $deploymentConfigMock ->method('get') - ->with(Config::PARAM_SESSION_SAVE_PATH) - ->will($this->returnValue(null)); - $deploymentConfigMock->expects($this->at(1)) - ->method('get') - ->with(Config::PARAM_SESSION_CACHE_LIMITER) - ->will($this->returnValue('files')); + ->willReturnCallback(function ($configPath) { + switch ($configPath) { + case Config::PARAM_SESSION_SAVE_METHOD: + return 'files'; + case Config::PARAM_SESSION_CACHE_LIMITER: + return 'private_no_expire'; + default: + return null; + } + }); $this->config = $this->helper->getObject( \Magento\Framework\Session\Config::class, From 60285c4011fa4ccabe6548ace2b6aefc0cc65c8f Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:11:58 -0600 Subject: [PATCH 192/277] :arrow_double_up: Forwardport of magento/magento2#12530 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12530.patch (created by @atishgoswami) based on commit(s): 1. 448bfec53114ae82db4eae41238e09a36885d6fd --- .../frontend/templates/product/view/opengraph/general.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml index b1e46776af465..a2b91a5eeb99f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml @@ -9,7 +9,7 @@ /** @var $block \Magento\Catalog\Block\Product\View */ ?> -<meta property="og:type" content="og:product" /> +<meta property="og:type" content="product" /> <meta property="og:title" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" /> <meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> <meta property="og:description" content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" /> From 21cfb6ab689b52d27dfe6816b27542f03ffbd73b Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:12:05 -0600 Subject: [PATCH 193/277] :arrow_double_up: Forwardport of magento/magento2#12507 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12507.patch (created by @PascalBrouwers) based on commit(s): 1. 9c5420fb378d2de46be4fdcd842e514e7206dfbc 2. daee4a8905ab50c6009f3baf304596644bc40d46 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12506: Fixup typo getDispretionPath -> getDispersionPath (reported by @PascalBrouwers) --- .../Catalog/Model/Product/Gallery/Processor.php | 2 +- .../Product/Option/Type/File/ValidatorFile.php | 2 +- app/code/Magento/Customer/Model/FileProcessor.php | 2 +- .../Adminhtml/Product/Gallery/RetrieveImage.php | 4 ++-- lib/internal/Magento/Framework/File/Uploader.php | 14 +++++++++++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php index 8cccf9e0de619..73d0f1fa6795b 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php @@ -149,7 +149,7 @@ public function addImage( } $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']); - $dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $fileName = $dispretionPath . '/' . $fileName; $fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index af6c4dba784f0..b54c66d75a058 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -150,7 +150,7 @@ public function validate($processingParams, $option) $extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION); $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($fileInfo['name']); - $dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $filePath = $dispersion; diff --git a/app/code/Magento/Customer/Model/FileProcessor.php b/app/code/Magento/Customer/Model/FileProcessor.php index 2d6917efdaf56..6a8472758c169 100644 --- a/app/code/Magento/Customer/Model/FileProcessor.php +++ b/app/code/Magento/Customer/Model/FileProcessor.php @@ -202,7 +202,7 @@ public function moveTemporaryFile($fileName) { $fileName = ltrim($fileName, '/'); - $dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $destinationPath = $this->entityTypeCode . $dispersionPath; if (!$this->mediaDirectory->create($destinationPath)) { diff --git a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php index 3658e36a82ec3..9950526182e3e 100644 --- a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php +++ b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php @@ -110,7 +110,7 @@ public function execute() $remoteFileUrl = $this->getRequest()->getParam('remote_image'); $this->validateRemoteFile($remoteFileUrl); $localFileName = Uploader::getCorrectFileName(basename($remoteFileUrl)); - $localTmpFileName = Uploader::getDispretionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName; + $localTmpFileName = Uploader::getDispersionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName; $localFilePath = $baseTmpMediaPath . ($localTmpFileName); $localUniqFilePath = $this->appendNewFileName($localFilePath); $this->validateRemoteFileExtensions($localUniqFilePath); @@ -174,7 +174,7 @@ private function validateRemoteFileExtensions($filePath) protected function appendResultSaveRemoteImage($fileName) { $fileInfo = pathinfo($fileName); - $tmpFileName = Uploader::getDispretionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename']; + $tmpFileName = Uploader::getDispersionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename']; $result['name'] = $fileInfo['basename']; $result['type'] = $this->imageAdapter->getMimeType(); $result['error'] = 0; diff --git a/lib/internal/Magento/Framework/File/Uploader.php b/lib/internal/Magento/Framework/File/Uploader.php index c3316db7be016..07de9941271c3 100644 --- a/lib/internal/Magento/Framework/File/Uploader.php +++ b/lib/internal/Magento/Framework/File/Uploader.php @@ -201,7 +201,7 @@ public function save($destinationFolder, $newFileName = null) if ($this->_enableFilesDispersion) { $fileName = $this->correctFileNameCase($fileName); $this->setAllowCreateFolders(true); - $this->_dispretionPath = self::getDispretionPath($fileName); + $this->_dispretionPath = self::getDispersionPath($fileName); $destinationFile .= $this->_dispretionPath; $this->_createDestinationFolder($destinationFile); } @@ -610,8 +610,20 @@ public static function getNewFileName($destinationFile) * * @param string $fileName * @return string + * @deprecated */ public static function getDispretionPath($fileName) + { + return self::getDispersionPath($fileName); + } + + /** + * Get dispertion path + * + * @param string $fileName + * @return string + */ + public static function getDispersionPath($fileName) { $char = 0; $dispertionPath = ''; From d173193c9612135a44d4f0490eef5995cb82c89f Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:12:13 -0600 Subject: [PATCH 194/277] :arrow_double_up: Forwardport of magento/magento2#12606 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12606.patch (created by @Alanaktion) based on commit(s): 1. bf611beabbfcb95d78cb6286b5ba803bea6cdb37 --- lib/internal/Magento/Framework/View/Design/Theme/ThemeList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Design/Theme/ThemeList.php b/lib/internal/Magento/Framework/View/Design/Theme/ThemeList.php index 826811b55b4bf..000fba24f0822 100644 --- a/lib/internal/Magento/Framework/View/Design/Theme/ThemeList.php +++ b/lib/internal/Magento/Framework/View/Design/Theme/ThemeList.php @@ -234,7 +234,7 @@ protected function _prepareConfigurationData($themePackage) $media = $themeConfig->getMedia(); $parentPathPieces = $themeConfig->getParentTheme(); - if (count($parentPathPieces) == 1) { + if (is_array($parentPathPieces) && count($parentPathPieces) == 1) { $pathPieces = $pathData['theme_path_pieces']; array_pop($pathPieces); $parentPathPieces = array_merge($pathPieces, $parentPathPieces); From b5a4ee42e65fec38b4d088335f44fbfd7e93c64c Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:12:19 -0600 Subject: [PATCH 195/277] :arrow_double_up: Forwardport of magento/magento2#12639 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12639.patch (created by @mzeis) based on commit(s): 1. 93ec6ea5801e6fae870e3dc91d821a6f67a5d3e0 --- .../Magento/Test/Php/XssPhtmlTemplateTest.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php index 34531b6b7c658..fac14af5ecab8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/XssPhtmlTemplateTest.php @@ -27,16 +27,14 @@ public function testXssSensitiveOutput() * Static test will cover the following cases: * * 1. /\* @noEscape \*\/ before output. Output doesn't require escaping. Test is green. - * 2. /\* @escapeNotVerified \*\/ before output. Output escaping is not checked and - * should be verified. Test is green. - * 3. Methods which contains "html" in their names (e.g. echo $object->{suffix}Html{postfix}() ). + * 2. Methods which contains "html" in their names (e.g. echo $object->{suffix}Html{postfix}() ). * Data is ready for the HTML output. Test is green. - * 4. AbstractBlock methods escapeHtml, escapeUrl, escapeQuote, escapeXssInUrl are allowed. Test is green. - * 5. Type casting and php function count() are allowed + * 3. AbstractBlock methods escapeHtml, escapeUrl, escapeQuote, escapeXssInUrl are allowed. Test is green. + * 4. Type casting and php function count() are allowed * (e.g. echo (int)$var, echo (float)$var, echo (bool)$var, echo count($var)). Test is green. - * 6. Output in single quotes (e.g. echo 'some text'). Test is green. - * 7. Output in double quotes without variables (e.g. echo "some text"). Test is green. - * 8. Other of p.1-7. Output is not escaped. Test is red. + * 5. Output in single quotes (e.g. echo 'some text'). Test is green. + * 6. Output in double quotes without variables (e.g. echo "some text"). Test is green. + * 7. Other of p.1-6. Output is not escaped. Test is red. * * @param string $file */ From f6570bd5d8e6b0767ce39f37d0355a5b61620638 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team <magento-engcom-team@magento.com> Date: Wed, 24 Jan 2018 12:12:26 -0600 Subject: [PATCH 196/277] :arrow_double_up: Forwardport of magento/magento2#12633 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12633.patch (created by @miguelbalparda) based on commit(s): 1. ef1ffd5c61d50b44bcbeb663872dbb1236bb5f93 2. cef5991721a1c85bc937b9d4d33fe79417ccc55e Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12632: Magento Connect no longer exist (reported by @miguelbalparda) --- .../view/adminhtml/templates/index.phtml | 6 +++--- .../web/partners/images/magento-connect.png | Bin 8179 -> 0 bytes .../web/partners/images/magento-marketplace.svg | 1 + .../web/css/source/_module.less | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png create mode 100644 app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-marketplace.svg diff --git a/app/code/Magento/Marketplace/view/adminhtml/templates/index.phtml b/app/code/Magento/Marketplace/view/adminhtml/templates/index.phtml index ec74b837e1077..a37306bf1eed7 100644 --- a/app/code/Magento/Marketplace/view/adminhtml/templates/index.phtml +++ b/app/code/Magento/Marketplace/view/adminhtml/templates/index.phtml @@ -46,9 +46,9 @@ </div> <div class="col-m-3"> <img - class="magento-connect-logo" + class="magento-marketplace-logo" src="<?php /* @escapeNotVerified */ echo $block - ->getViewFileUrl('Magento_Marketplace::partners/images/magento-connect.png'); + ->getViewFileUrl('Magento_Marketplace::partners/images/magento-marketplace.svg'); ?>" alt="Partner"/> </div> @@ -61,7 +61,7 @@ ); ?> </p> <a class="action-secondary" target="_blank" - href="http://www.magentocommerce.com/magento-connect/"> + href="https://marketplace.magento.com/"> <?= /* @escapeNotVerified */ __('Visit Magento Marketplaces') ?> </a> </div> diff --git a/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png b/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png deleted file mode 100644 index 575563f341b3550c8bd686eeeb0af8a8bc75690b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8179 zcmV<P9}M7$P)<h;3K|Lk000e1NJLTq006Q8000{Z1^@s6*qPN%001AlNkl<Zc-rlJ z2~-@{nXcLxxnmQ1usuZMU?(<C?BL|tPs9_y@ZyYftQXDrC3>+lo(!41#5tA{C0=A% zk}b4=*w<#?K|%`>XaykwVvztLfj|g^gpk;wX`uJLtGc?nzE^*>swH_zW^&#;<GiDL zP93VNZ{NDhcmMzUzyC^00FPqHZN<YuvE**KTfRWW1q3kS1#k*@Z9(AeN_y_(5a6!_ zc<uuCZu!C%czlM{4Jc&1Lih~KGOYbm4;hBJ3+}t+3s+b`;TE7^$P#~6A(XR>Ex^s% z1O6ix+Uc-K4KjA|@7;2@{68x2x&r-H`A?M#JzY_U5AW;Rx36^c!i6(YUY?PG`6q$j zeCkBOfqlD1jvTD&o*KIz_W#So(fDW%0Pe15`a%HN8sxus&V<80A0pkmU3ace-I0TB zs*G4~{Eqdg-d{3oGcPWcDsoVK)*{maPfQGlWo9Pw+3AVi{H#=Nc&I-T!e2k%7QiX& zHsig`&BqIl9XrtMa5(OIoB!lM54<^;?s>gBh^yNU+lh3o$8Ndjj*1?JRghK9%SmwO z=ES&5OOh=&uJtefyoL$H02A2SdOR~VbsGwElbMW^81(maMnQ1@)h{}Y&um_}ub?2^ zk(3k-qtU2ba<}}a6(<lNTV!^mYlU{>Q<#tY9z5EK5cYPe!Lx2Zkc*4r?P;kS(cE;n z;`1$*JHTX`zpuPJTc4Yo#8#B3Ole75(09K5t-nTB%z5tgI=q(&uv)c&g@tMM{QMNB zR;zvRFKyduwca~BJG<=eX86mC0|*3XmVk`m*7bN_2_!rNSSP}5K%l>(+it(7yeQ9- ztBUtDo~WwM&5HFD=chV!nwen#VzXYw?H23eh0ZrsX*-0yyYkfs_7;t1q-?{P*2a`i zc7pdX3LoEO>5}d}oQv-L&n2(m;v`80U;_YGpy0771&<>T;G}wgip$<kcj)(j?l*D~ zIL7x*k?X_DDd>{hvYB;DD@$?=`58NSyHyiJ?fR&eprDKH>6zDK4gwrXcpXamOdd(5 zS2mM*X<v6wR7-1P=H%t}m!{`5A(9r#8G}8HLty}d<lu$I41O*G=DA?72+#t-I`Q)H zLv<u9&LHq^g;y|z$nR!3r@~`{61*V<f?X-QVIOz21%h)cWQ%3v5#Z+U+^}F>3OKd? zHD2I+{V@SSa9vpsMiWMT^!0%a@PG-RJ~=%e1w6iWGkFlmKnQ@F6Z_^?=mkEQ<T9{M z1q)}O*J=#}GaD{TXz(nC0oGu85A~G;BlU~M&%+RE<(z?VvkEwLL10Wu{mnU`elRXR z0CSgCjIMtUuI!b7bvBfOKxs}zyex5;OiN1(a_psr>DIxE?W+#%FCEHCkM$1po`3x_ zB@l=8p4ub(+tQM@q4#{-TV3rZqE%@zLPP!0!?)Kn=(P__PTcr<OLIfc@wy}RhYs%V zJ$j_3y`#M~dUj^wF&X5y18d}J|BFp04_6&IxVyXV=z(V19NPJ*V7Jqzm>L@mJA1k_ zdQrXbDAo6hM1N|0IPBz!<JEPwhZ_&p?7P_6+5CY)KmPy(A1Gx-rQvwp;miFOR}#p~ z`o;UZ&$h3vJyP9Pvw!zcZ%6C9qeBBP$&1t1d;ZO~=94*P`5BHvRXo?$axACk-09Ur zm-=6YhxfO8<J!RU^xd(;d)ukMr&~^BPK}R*$s59EGA<pw*#BDn@gudDFPwgTd~QC3 z77)D6Z=GSj5sCiY>iLS_L!10EEIXcokP!h?{RUju&S7|Tp@2Qe3@8ai1Ypm_qgB?* z{|!t0)4-N+7>Zv9*OJ1+G!aG?O0r-cr?|LQrNe9w<g0%Vez-{m+H@1GrTo6PVNLrX z)Nwz6d+!=pdh6GKGZ47^dMIeSBzi8cfyg3QyJEFks213MyM&HNGAhG@WWb%hV) z^Wm^Ll{UZ!s>z;J=0nlKT;XfbZ}}D$OU3@xB{9&BM6d!EV5k1EJ_^dhEB(dwwpbi{ zAFiC&uo&|Lm}4Wsl>8fn78L{Iz#0g;FmK~#VE@mc-yQ~2(s$sfeIIP&hropjtu&d& zMa_eSIqB@KvRtixVf>-K?$%$WCT_*y1G@)!#_=i3rkR;smY<Ws=BZLV4$Fd)fE>5| zLmWM{zw7pTd-qh1CnfGc+>WitQl;{_IT`NMlz1d1#-g|=*V=obD@vv!oQqL(b+m5E zQ6+nFvy!;Vio%7W{47UG!VctSCvf}smX2m;rtk@|+t7dE{F@G|;oj!PqZOIyF+x&e zyx3lzH7hIGladmP%F5!ID?^te<$kEA#~#Z_O%O;~>F+)F`tF@Yn&gCS$j(gS(~@JM zN)&%nTwqw7n|YXVITU53g$8<8PFkF|JU`W*BF;r(+%}XK7noRw{T_$K9N5})vLr{9 z>Pb(Dk=l{l%FRmS+FMVhSdF^-=-ne%hF<FHIU6-{ZD{$N$#TDM;oUy#WSj^?{RS}6 z4??%@ahMWcfiB}kuyM=aUb__f%`X7sRdyG+KoePSvn9}0vmTlaPeZ%u@8C>$8hrBi zu^9avG#@?=WAQJ*O%Fs6P^9*GYY?|M8miy041Cc)0>}OcP4W*hz3Ew);v-=C=yACJ zxCE0)KL&2pbwOYQWKZd+_ys05eG6zy=O>H)8MDz(!n^e=Kx`On?>qwIJHf!Q_W<Wq zgyacsT6^@B*zIx4F}pq#Ce=$ouK2$A7cu+$hrt%T0e*3Cg~WL|RzVxh1Fr&?_Na9U zKf=Nvmch7XIZT-=!Djvd>_=Y(^Y*=P9#6Jo>~!qnx~G8O2f(}jD{#K^APgTpgX#Cb z2CeGHaB(7In4cM2mXndhmltQ5+)jgXK|LChCxR(AGnrphPdxfbAd@vqP1=FuM{3$= z@R$2LUQ18j3gX$f*E@Ffa9h>B$`MjC$WjrYt_=3QLVzM*?5!-DVVxFfM_wDc99fvB zau(#KGFJw>U*SbdU@>Tw1AV=#@^a$bc{z#h!!?z?S1(_D*=aKdT<Yt5JtJ+qkej`O zyMFb`ix%Ue(xjhzpuO!x3IS@*u2Qv0r++|lnR8>0=4B_l>B`Pb;LD1$EbVO#31m@; zB9-N4I<t}!K;xqNW24uez0`Mp)y|?UOF?FwXXNU@i$epwuMS=6dzCDDPglq4jFd!B ze>=}KN6*cSFPohj4W)b90GVlt!a!foDyr+S7z6DVZJ^2S3b43^I|5-_ORn0v@nP8G zo(4KHd2;jMEK2BmWBC&ayr$w^0dvhQ4zNmU3oYrKur3Jh*k^#A0tT*`a0xuuT4SMl z8Lr<h0d_|L*7;xyp!D#J!mI9CV~BnVp3Pr@CHm_yl}14rJX#C0Is}tVwS4Le(7*E# z+%@k(PWw{v7O#Z)y)Qw#<=b#=jQ~z=0T$b9SzUjWyE&P+(r=Rf9?)NppiL%OV$Jzj zPsVas-~Te)wVMIkL<CuS7_Ud7<fpK#UIL+J4d5{aQ&NNI3a1?j=hB|Q)W)xYIj{kk zA6x-J9}4!`8uaDy*ck=W*^*&!rXW*ybtxLQ!WH{Xu-hI7I#S^3s~ksv)v(m*sj;DN z5Z^5?%CUG^TOiL^1CQ41?Io++(RL!?_Q|J(*<Dep$xKZWZd|?mB2Dl>-<j95MJ`!h zl5e=ZuElIzDsf`g8VG?jSys9x$F6>(FfYSNmr<vdz;>ecNIh9eva+1WjcyMbj~}aS z&P?4Voa<=XL>p&ec3j$M87W&aHQpZv;TAt;#f?aSr;XCy+9GjwgKi?2ta?sXyoYFj zW_E0u%%y2E8;{mBrpL$Pz~0IcnIqdR`oQvnOuI@9V(n(bQhJA%a|Rf7ng<GUGnw?1 zc*!#mZ>8_(BHr8E-TAAe`0Xez$hK={Cqn2Qbh&S4r2KKo!dS>c-W%|&71_o4+BF0s zE1)E6<)>yQz0%7HzB2~8kqB4%kHM~62L5yw<8)aS^qemG4X)LUW9uVuZhREp{saAT zJD6-Mb!>P9x(%Vw?cXRscO#tmJkbw^heBPSK8z2QFc<v`z`Ft*GCkO}3e=u$`?uh^ zE^ZW-k;Xt2htpq*T8Ix5y+Rm-(a}iR`a5c4_{sMkgQ@bj0OOFjw!@16q8ylPt}<-? zI$Uwj0ka({>L0D8p*}@B^PU3Q(q90J*QJd~9z~uDs}oAWG$Or&o^gxgA@l1(z{Y<Q zaBD*VR*p%?{q?*g1#UZw)wme|4fS`g%n_{@@n)yP5+HcplFPX^G!U5-7Xtz_W3@_? zb#<`om7=^9XGLj&-tBZKWF9GlLJEpFd!WTQuT)Rpc&x9dBT5D`@n3o$(UO$J?HKIu zdX4JyZbtym`dskYGxaga@gJkLv95yL@=*VUm8#TuVP9pzjBb9E0w*arvzjzYn`JKO zg2>xd=?UJNs(nNB`$e%%nh5%e(i{VUn1Dq9l>6A<b!K<C!MwkF>LCtolXugT#?{ zisRQW%s)hZB+y^I-1Bm(7#r*?E7TemHFu~PRL5yG-Amu4r|iJxOWiA_v3Ne6?spF! zFJ0LBZ6NM(z-m`|ApTZx2ZHei!YN2Vqf3t3y(9ItmiNC3Z_IKCA~!YpgD{8E>O~;j zrXc3PJDB+6BVdng06mx1Y^F07A3q9n+zY_`z$yYG+~y!THgR>AsUZT%R`G8jZckv5 z(!eD@f$hUbfdjt=J)_IR-rO8^gVLGwUAV+{g|Rl3^vrr~m8swjST;WcbY}_R9pYHH z0JtV2Vbd$&o{5+%e+#o4z6EraXk8Q_vYIek&i{mS^WOoTMJ73CAy~!w9#;VMRoVoc zD*!g5I7S2r<5$9+Z{G(byZ|_vKsZddR131G6s#So-ggn4&k|Y<i^}SKB_nA`(YVy# z^BOHaElBO*ns(x?UF~N!`8nv+mC*d`L^oL~TJ+l&Os|^{>S}L{uBj>?CM%kq5zm(t zWY{TCq`yY(bdVr+x}~YEBq=@`Cy&?Ey6lEPd6zLZHsH{{(qUC{40_tzJ^<qk=sVl7 zHajIz$jeCJ_mt&m3v)8rl6;k;v@p|38?U@L)0CR99hGIpS})^P7<Drb5SJ~=&vck{ z3lDq}RD<1}Q5oWxs&?-jmp7l;uyB8IPAZd^9?LtewtMM0ZN{@5CpQtLId-_J{WGOJ zmtAqFdhbP|H>X>UXL?xkt-y|V`X?P{vN-MfWkBIdz_Ablw?!!js4U|%1oRn<#m9Gh z3K{(2ULflq;PuRf+inB7?7gh#_OvW+dIDVe&jHb^N}!$XS>xIe0!PAfz;q*me&=<W zlr%<3ZE4vI``b(4to#k=eX{D|D*Pu*zw@_1Q!HpL?7Ta`dsEAW-W2TG^c?v0_ko!_ z*&<nR{iQYL)E~mLPV@>nk(e!v!mR4on5z&sLjEtYu;+Ieje7|T?>`B?QDu^VY`U__ zoA6&@7dbD6Yg?$ljO<Amm+!AQe=L{)&g%%2tgpH&*1X}%u%&(nR)=03qtk~KD!tuJ zZ)K)#7l`u;EUS<MlD1Pv3o_HT2&4uGqBSy!JhUK3#TMu1Ip(IP9`n1v#qkG;S`cT{ z&1)neyBSt-q33*5PId-Ipv@Qg>9Iq5y4qXoQ(8p&K%WW77K8eJS_rb#r9~<$aoFyz zwzXvK=BCt-wKTL=5Qz7d6)))3GY?A^y16YSGcg`}N{h4&#||{sA3fMycX)q$gSZLm zj_he`IDVk^_>lu`r%yHHP<`FP<U_exDIE3Btk+S%<u7CfNVOo2EK>_vek;jMbC%>J zF~&thkSuvMH5}ZXl<+Yc>JJ~5<+x8;<>toY6{$%v(xxP^NY6zhK#M|)MY=UkZHMu_ zhhP;Kn%b4+DYCR=5kYl0NEQ+fLFs9ZgJbReK;_%8z!B^O69|_@a=|ozRvrQ9-=oGx zCD_#Ofut&ut}x!SO87v0mbe^l&1lF1AkiI89HSdvg{vc-_q-DTXT`7l9GR#kcKr+s z(a(ZCk;s9y-3%TH8}z+8%$gbwcl6`1PAo2ytms0|dR^)Ya2vh`N5WI!;=+K~=V03L zO<>0haBL3+5`%#)ArKl=Ch9k@8(P6_eFo}n5x~OPQj*wY$x&8McvyoV>iV*G!j03h zjt`fC*%1!jtW{coTl#$G>G~J~TU*nKf;+9LCMY8#!CR0U&svQ$L01O4UQLYKf`;SA z{4yI)lWm++7UiWmb5)6+$<fQtk|sFN*SU(oT9A{%wzjlqS}nJ%k!F7S;liRUYffGY zt20dbbLeB^SHDqIlx|H+*@D8{Bu14iDhr}z+gVzspB|t1I@KYG>}-2WH1TQT!V*ya zOff7@JxDaEAUn-XK_P)n@ZLr(&NaW4m9kyfzqfo8;G{DaM1v{{Gpt2f32xd{<aSB! z>u76ENK1;xu|w5eGCwB32{+v?)j4_mP;J7Fk8wuav@{oB)#21GY0MN|Q#~|ia8@zE zLBUU8@gnf{!!R=UrF&8lNLS`t%K8l=H}vlODM*qd{z%qdUSKMYvt`42(fWD{{|De& z@afGHo$J~4q9PLaeL#C<1qE8nO@2yN56#(j?Rt?{m%j#hEI|Y?`ra)9+4#YiVQoq` zNkA1`fg}S;<1mg!*y3M?ZQFkVMo!dH-=Xba<N5emKm;<TPt`hEqY?&<w6>hh9ANVx zz$sEdI5nZ1+o>QPEVZ-aMHsey8y-!2DZQ6xya9kA6kdHOZ6HB51Yji%+c41+VO{?S znC;&H%%c%B55(=I31~V|Q=JsI86B-ncO*1iqM|?tiB#!Zg_g!c6_otQ%1Gp|3|xHW zj(Rq&lB7EV?&!7t=V@o3s69|mn}e*RRL9}GN49oq^;k%5ZVFpaASPXOlR@(H(XlJf zR#fC@cU5FBbf0Z}_xk1T$QwhwFHs7e>c~JQ6@>b+duM^hVO{hCnPHrFSVyPReveNs zyuOSm4V?$k&d&rB0Pmm{J#BC1q{Vux_LPki*rXJ-L34j;UaB)UEyim#Y44K*!-0$4 zuaT6utGq}{fge4;{X7b7ls&r&)g;*s_MeydJ|!z;mn|2Zs~k3Ld=f}`K>{XG3mL=? zkFPGgv<Zwsl6CH_X)%2m0yZrI&<(EgeQyi_Zw#RTjOH8-(a^s4AZ)vT1Gz2CU0CD! zV3`Qy{|4wsA^=9R;(kNal%sX74g^a67a(pjx9knX4d(j813*KTi4{Nd6ts(%FYp`- zvu=GJmXDqWZ4{{;r#{H2dQ+qcPr@@$srAi^M?q8&(1kfUpNtE#_8fd3#5@tckoQmU z{%$GISs~Fn`5+KnzVj{Sn|+mxfkz*L$;KA%HWA~=-vjC9E?(5tdHBvJpRC(opPm$p zzV5DH$&JYzZTQ;Ya!QU6_auGyaLvA6gZ@sQNt||XWyuU_z?9ISj9hiq&SA2eByY(s zm)f(N7MHf2sx2T+zPlo4!E_VIoX4eTX{paiNfGtygB88=vm?tWTSIQ;cDGFzNnIs{ zSylq`xz3gk2w<{0Am2}n4nKSGLf4ygubZC;F3Qbd%8GML1T>k8-U{|wRuj-EIYJwX zE&^#~d7idNmB<n8krfv@OjTZzYa-7?NfJ_H<i4>^Q($*j%UTKssm`Ki`eFGUTCa~X z_{TEc6Qxgj8QlB#gB?B-MVTymPB9AHRwbom;bs&ZAc2bjX%_=5{f5Wj?b+W&fFieQ z^!lQEsM|~3>EFe|`o9HpwrpGq76k-g`rI0<`x{txEC(qTQt%7-&nU1>xoYm6CBUvX zK=1Jfk(ED#S?rtpR60ZNlCy^7{$ZI86GV$>6S*xnc77F|gYfXCVB7u;u&jLu_Ug9* z)+Du~=b?0appaD*#x@mZavCM70Eaf%z54^;U2*zEj!v06dhTQq$Our-J?GB|T77_? z>RP|J@hRxyA_4t$h#V_OK;BzfG((C3X`i1=|Jv-vfL-E(l7%6jNlA=PrHMsXOd4`> zLJUZLBCFQYR9`|e)b5=nnwcBdzG2kN29FH(zFfV#WW1tKWhDz(UYKSzh>C*zu8xjV zn@C-tBnNS2O1kW;te8A?^7!rx=Q>wYMotE7$LUisq}i&{le`Uehib>J4L+}#9(`=E z@7$^r$7&igl6Ro8tUyb0qJDAaK~gcOzR^H!+?l@a={WTP1&90g?i#&4NIkHpd^9yK z8g)mj+Ir5lt{xt`5J^<w{MqJr39O_`w~CumqZxa2YU;`pr_a<S<mM%^bdak1e8*e< z0Pv=4ML-eUc4^`%^JYD=RnYz6OITE`0<IjFJeLeG@AP2A_^GN*p2<rQl&&VXPHKey zy+^@{kv@jo*5AqwUWvltwU`$<w>keO5VY6BWvh$X-Y9JP8@R+x0NrpTja?@oSe63W zQ!10^y(J(jK^sHrCvR19yMBs=b@zigmBdp$IiRFEuup{}PL$F%JPb@<l(KssqENkM zCjO&P=(jxqbmTBF>Vu^3MAt7_(+hisXY+mu_vu14ZB+6&&hhgrW@DbhRP^7&)|qSK zg~c%Wppe@=u>yVNrunu5Yaq@W&4YDz?BThMPs0=a1Ta$DMYMu8ngn<XvS^X73=Kwp z`hbu}K|+5@Vk`;^vK@2ksgO?t*{z^spu`<dH#g=;R&#Rf2@0N46XTGZp2*XcE`nvJ zs8ydo(->W~vrtW{gK>URlD5XKUkRs-+s?9F{fWBj`kI>E7c0t(wMB*b_O#?UDYHg8 zHMw@0RLYz+*4I|&s?t5laa)m<mLO09hX72+N(sch=gzDqE;z3q4<R5^R#81Wx$IL3 zp7!QVG(O5i-v0btXWIvbS*dQ?#A(T-4QDur$}kSSlE7Rj#s$d<TacN#gU=E*>eRHY zLSB9nL#F~QX8lrW5!p{r3eMp_ATEej*<Sp*q$RuJz5{d7FJRmGTVPKVj4?0Z`bW!w zo@~J=Cmh6c23*NMgM07GV57qzl>7|X8wGv#KSI6fNf=VT4-8iK6Q8FIK`M!Rb}(Y@ zcMo7b=DYCDTwDRKoi>!@9Z70+G^W|DZ;7{szW`+G#~6Zm@jd!?m%)8Bfg!MvoF{KI zN?Mq=K8Zz9bzyIuTQLWOQXj!iN1*m&%x``I7SVI?$v*;L{Rd$8&*9CEgnh$TVA>c8 zbY%+QbkeyKNktKVqhI$O7(V<unA{%$CBFvttcF><cdYv=7WS?eV4d_Oe@t`1Zq+}4 z7c-LHgy-Nad>#Ce_3$04zt9oYb@ueTbT;C%fUMJM9;EXT1DASNeqKN|e0Au>_A_lU zBiF7j_Xl-zvyYzbZ2#cc!TsG0bw_G@&vm?I(rSWe5+|--4L^IjC5Cg_6lPHpt0>Ml zQLso>kLPXvgvi2z_MxGHo>x!Q9jqrXR#p@*xNK&>2(F%*45ifevBL-2iS{&}I97f6 z(uI|j!j`SKO}sxVf|AByvztD3%ye#QER<5t7cXAC!y}O<eErJ6OXOXePS#ePYN*>S zw@Y4V{KnOA3Oo-Us_H&+bbnh*+wsiF>ES0n>jWTiSlJr;0YNlos<q0qe>JojKgOb{ z!P?$c0vo>sq&^S!*vEkJ$|?v}N%xg3&)l^z9C{y?#P31<akyxOzk>P1mtZS<6S%xj zO_?<RJ1OxoHxi;P`X$WO>*3K)hJg1;XtK`i6|-XIyr08fpKN!!Xk6xCI$z;vNM<Z$ zzl81Vfl{g~Q8xEYMaw)LYN=TZYvr#Y%#DOe;}I-31Hsu4_H+j4&RGf5hu_59M~}f0 zy&T$Y--UhGzk=&6F~Oq=r}4|)2kd+pnzQWAtXJXK`Z)M^1Hp?*i#7RqP#-XHCKhgk z?=TV_B<tTlY%F;LbK-n0u6qoQ?N0;Nh2SL=0C4WlK0NOIzi=#5=AEDSeTOKMWr`fV z>BOOGz$NL0Zthm#M$a^}H<neD<{3yro1Z1G@b53O67gAy2`VyY{=D!0(y=-n?tA>8 z^%#Rm*!L?2JmddY!4#b{#<?IyGZJc_><@R$4299jFFBhfsUwd05GNo-?(i~Frq45Z zF%s9BN}=g2g>xd3Kq@6=+_w@^q(j3!7Y>K-Oa$?6*)vdkaE?d9GapW;(j==2Yq0P1 z+gunN!%=c<;QKB77=d##0;ZuT>E5Li$F>mW&n9|xp|H({VzNIHH}=|X>cMd6u7?vn zATY856c)~>)OcW5E&$Tl;Ft>~`s1EyE5+EcVVFl&5S8KJ3(gq^es9LvXTmUbMuls2 zEmrlY_<mcUByD^i&={Wmi-7EA{{6qZ*x9~Tl}rhV;>ktL_`|fZ<o-}Z>a;HeofVTR z@v)mxT~#?OTVpwc_~(jnGXNAmXH$CFTbqXc#8F3C;oupMLe`CC7c77NbMGf$5Rl0N z(!!91qobD&z^@<>xamBB?85!&XD<{Ic-_WevX<1AOSlCnIi*Y7mj2!@;h7jgN*2ff zlaEBoMQRsT|1+s?j9F;{{DG(Z&+TQIPY}mWz%$;gLxCKezRVwSSXoVxKMOF2P^MB& zv{A}hZcEyDoIZrIne-b{D=2L~1%y+d={eP-_(10L^q0P4z~9<b-Y>`*csk2)=)k@K z3J%HQ*6iOk)O1peu$t?nBa)<0P^OF|FFF>w<ZiiJzKDga1_f_}Vk(@@Tu>^Rq`Z7F znNpOW?l@etr<Y_rlFsh_9~^hf7aGX$`ZQoVcR{D+q>ECzE~Ao;bdp|6vff=F-z}e4 Z{txa8J~OL4=@S3|002ovPDHLkV1k>X=`a8Q diff --git a/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-marketplace.svg b/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-marketplace.svg new file mode 100644 index 0000000000000..388544d5d7f3d --- /dev/null +++ b/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-marketplace.svg @@ -0,0 +1 @@ +<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 273.37 35.85"><defs><style>.cls-1{fill:#f26322;}.cls-2{fill:#4d4d4d;}</style></defs><title>Artboard 1 \ No newline at end of file diff --git a/app/design/adminhtml/Magento/backend/Magento_Marketplace/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Marketplace/web/css/source/_module.less index 6afe96c7f9ef8..d4f918567e579 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Marketplace/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Marketplace/web/css/source/_module.less @@ -61,7 +61,7 @@ } .partners-footer { - .magento-connect-logo { + .magento-marketplace-logo { float: right; margin-bottom: 1px; } From b32bdc9a34247f33af0d7f2ed80868c55b1e5aae Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:12:34 -0600 Subject: [PATCH 197/277] :arrow_double_up: Forwardport of magento/magento2#12063 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12063.patch (created by @RomaKis) based on commit(s): 1. 0c82649c1f6e9151a5503782bdf874e3d4606fa8 2. 1ef474cb75650e68f4ea7f13e9704a237eab9fe7 3. e195dd6075dfa54392c7d444bdab3eb63596ff51 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11946: Layer navigation showing wrong product count (reported by @sunilit42) --- .../Mysql/Aggregation/DataProvider.php | 67 ++------ .../Aggregation/DataProvider/QueryBuilder.php | 148 +++++++++++++++++ .../DataProvider/QueryBuilderTest.php | 154 ++++++++++++++++++ .../Mysql/Aggregation/DataProviderTest.php | 67 ++++---- 4 files changed, 347 insertions(+), 89 deletions(-) create mode 100644 app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilder.php create mode 100644 app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilderTest.php diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php index a2242ff0f355b..5887c76e8ddc2 100644 --- a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php +++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php @@ -3,10 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogSearch\Model\Adapter\Mysql\Aggregation; use Magento\Catalog\Model\Product; -use Magento\CatalogInventory\Model\Stock; +use Magento\CatalogSearch\Model\Adapter\Mysql\Aggregation\DataProvider\QueryBuilder; use Magento\Customer\Model\Session; use Magento\Eav\Model\Config; use Magento\Framework\App\ResourceConnection; @@ -19,7 +20,7 @@ use Magento\Framework\App\ObjectManager; /** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * DataProvider for Catalog search Mysql. */ class DataProvider implements DataProviderInterface { @@ -48,23 +49,31 @@ class DataProvider implements DataProviderInterface */ private $connection; + /** + * @var QueryBuilder; + */ + private $queryBuilder; + /** * @param Config $eavConfig * @param ResourceConnection $resource * @param ScopeResolverInterface $scopeResolver * @param Session $customerSession + * @param QueryBuilder|null $queryBuilder */ public function __construct( Config $eavConfig, ResourceConnection $resource, ScopeResolverInterface $scopeResolver, - Session $customerSession + Session $customerSession, + QueryBuilder $queryBuilder = null ) { $this->eavConfig = $eavConfig; $this->resource = $resource; $this->connection = $resource->getConnection(); $this->scopeResolver = $scopeResolver; $this->customerSession = $customerSession; + $this->queryBuilder = $queryBuilder ?: ObjectManager::getInstance()->get(QueryBuilder::class); } /** @@ -79,47 +88,13 @@ public function getDataSet( $attribute = $this->eavConfig->getAttribute(Product::ENTITY, $bucket->getField()); - $select = $this->getSelect(); - - $select->joinInner( - ['entities' => $entityIdsTable->getName()], - 'main_table.entity_id = entities.entity_id', - [] + $select = $this->queryBuilder->build( + $attribute, + $entityIdsTable->getName(), + $currentScope, + $this->customerSession->getCustomerGroupId() ); - if ($attribute->getAttributeCode() === 'price') { - /** @var \Magento\Store\Model\Store $store */ - $store = $this->scopeResolver->getScope($currentScope); - if (!$store instanceof \Magento\Store\Model\Store) { - throw new \RuntimeException('Illegal scope resolved'); - } - $table = $this->resource->getTableName('catalog_product_index_price'); - $select->from(['main_table' => $table], null) - ->columns([BucketInterface::FIELD_VALUE => 'main_table.min_price']) - ->where('main_table.customer_group_id = ?', $this->customerSession->getCustomerGroupId()) - ->where('main_table.website_id = ?', $store->getWebsiteId()); - } else { - $currentScopeId = $this->scopeResolver->getScope($currentScope) - ->getId(); - $table = $this->resource->getTableName( - 'catalog_product_index_eav' . ($attribute->getBackendType() === 'decimal' ? '_decimal' : '') - ); - $subSelect = $select; - $subSelect->from(['main_table' => $table], ['main_table.entity_id', 'main_table.value']) - ->distinct() - ->joinLeft( - ['stock_index' => $this->resource->getTableName('cataloginventory_stock_status')], - 'main_table.source_id = stock_index.product_id', - [] - ) - ->where('main_table.attribute_id = ?', $attribute->getAttributeId()) - ->where('main_table.store_id = ? ', $currentScopeId) - ->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK); - $parentSelect = $this->getSelect(); - $parentSelect->from(['main_table' => $subSelect], ['main_table.value']); - $select = $parentSelect; - } - return $select; } @@ -130,12 +105,4 @@ public function execute(Select $select) { return $this->connection->fetchAssoc($select); } - - /** - * @return Select - */ - private function getSelect() - { - return $this->connection->select(); - } } diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilder.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilder.php new file mode 100644 index 0000000000000..ca077ef7227d5 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilder.php @@ -0,0 +1,148 @@ +resource = $resource; + $this->scopeResolver = $scopeResolver; + $this->inventoryConfig = $inventoryConfig; + } + + /** + * Build select. + * + * @param AbstractAttribute $attribute + * @param string $tableName + * @param int $currentScope + * @param int $customerGroupId + * + * @return Select + */ + public function build( + AbstractAttribute $attribute, + string $tableName, + int $currentScope, + int $customerGroupId + ) : Select { + $select = $this->resource->getConnection()->select(); + $select->joinInner( + ['entities' => $tableName], + 'main_table.entity_id = entities.entity_id', + [] + ); + + if ($attribute->getAttributeCode() === 'price') { + return $this->buildQueryForPriceAttribute($currentScope, $customerGroupId, $select); + } + + return $this->buildQueryForAttribute($currentScope, $attribute, $select); + } + + /** + * Build select for price attribute. + * + * @param int $currentScope + * @param int $customerGroupId + * @param Select $select + * + * @return Select + */ + private function buildQueryForPriceAttribute( + int $currentScope, + int $customerGroupId, + Select $select + ) : Select { + /** @var \Magento\Store\Model\Store $store */ + $store = $this->scopeResolver->getScope($currentScope); + if (!$store instanceof \Magento\Store\Model\Store) { + throw new \RuntimeException('Illegal scope resolved'); + } + + $table = $this->resource->getTableName('catalog_product_index_price'); + $select->from(['main_table' => $table], null) + ->columns([BucketInterface::FIELD_VALUE => 'main_table.min_price']) + ->where('main_table.customer_group_id = ?', $customerGroupId) + ->where('main_table.website_id = ?', $store->getWebsiteId()); + + return $select; + } + + /** + * Build select for attribute. + * + * @param int $currentScope + * @param AbstractAttribute $attribute + * @param Select $select + * + * @return Select + */ + private function buildQueryForAttribute( + int $currentScope, + AbstractAttribute $attribute, + Select $select + ) : Select { + $currentScopeId = $this->scopeResolver->getScope($currentScope)->getId(); + $table = $this->resource->getTableName( + 'catalog_product_index_eav' . ($attribute->getBackendType() === 'decimal' ? '_decimal' : '') + ); + $select->from(['main_table' => $table], ['main_table.entity_id', 'main_table.value']) + ->distinct() + ->joinLeft( + ['stock_index' => $this->resource->getTableName('cataloginventory_stock_status')], + 'main_table.source_id = stock_index.product_id', + [] + ) + ->where('main_table.attribute_id = ?', $attribute->getAttributeId()) + ->where('main_table.store_id = ? ', $currentScopeId); + + if (!$this->inventoryConfig->isShowOutOfStock($currentScopeId)) { + $select->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK); + } + + $parentSelect = $this->resource->getConnection()->select(); + $parentSelect->from(['main_table' => $select], ['main_table.value']); + return $parentSelect; + } +} diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilderTest.php new file mode 100644 index 0000000000000..b52664df749fe --- /dev/null +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProvider/QueryBuilderTest.php @@ -0,0 +1,154 @@ +resourceConnectionMock = $this->createMock(ResourceConnection::class); + $this->scopeResolverMock = $this->createMock(ScopeResolverInterface::class); + $this->adapterMock = $this->createMock(AdapterInterface::class); + $this->inventoryConfigMock = $this->createMock(CatalogInventoryConfiguration::class); + + $this->resourceConnectionMock->expects($this->atLeastOnce()) + ->method('getConnection') + ->willReturn($this->adapterMock); + + $this->model = new QueryBuilder( + $this->resourceConnectionMock, + $this->scopeResolverMock, + $this->inventoryConfigMock + ); + } + + public function testBuildWithPriceAttributeCode() + { + $tableName = 'test_table'; + $scope = 1; + $selectMock = $this->createMock(Select::class); + $attributeMock = $this->createMock(AbstractAttribute::class); + $storeMock = $this->createMock(Store::class); + + $this->adapterMock->expects($this->atLeastOnce())->method('select') + ->willReturn($selectMock); + $selectMock->expects($this->once())->method('joinInner') + ->with(['entities' => $tableName], 'main_table.entity_id = entities.entity_id', []); + $attributeMock->expects($this->once())->method('getAttributeCode') + ->willReturn('price'); + $this->scopeResolverMock->expects($this->once())->method('getScope') + ->with($scope)->willReturn($storeMock); + $storeMock->expects($this->once())->method('getWebsiteId')->willReturn(1); + $this->resourceConnectionMock->expects($this->once())->method('getTableName') + ->with('catalog_product_index_price')->willReturn('catalog_product_index_price'); + $selectMock->expects($this->once())->method('from') + ->with(['main_table' => 'catalog_product_index_price'], null) + ->willReturn($selectMock); + $selectMock->expects($this->once())->method('columns') + ->with(['value' => 'main_table.min_price']) + ->willReturn($selectMock); + $selectMock->expects($this->exactly(2))->method('where') + ->withConsecutive( + ['main_table.customer_group_id = ?', 1], + ['main_table.website_id = ?', 1] + )->willReturn($selectMock); + + $this->model->build($attributeMock, $tableName, $scope, 1); + } + + public function testBuildWithNotPriceAttributeCode() + { + $tableName = 'test_table'; + $scope = 1; + $selectMock = $this->createMock(Select::class); + $attributeMock = $this->createMock(AbstractAttribute::class); + $storeMock = $this->createMock(Store::class); + + $this->adapterMock->expects($this->atLeastOnce())->method('select') + ->willReturn($selectMock); + $selectMock->expects($this->once())->method('joinInner') + ->with(['entities' => $tableName], 'main_table.entity_id = entities.entity_id', []); + $attributeMock->expects($this->once())->method('getBackendType') + ->willReturn('decimal'); + $this->scopeResolverMock->expects($this->once())->method('getScope') + ->with($scope)->willReturn($storeMock); + $storeMock->expects($this->once())->method('getId')->willReturn(1); + $this->resourceConnectionMock->expects($this->exactly(2))->method('getTableName') + ->withConsecutive( + ['catalog_product_index_eav_decimal'], + ['cataloginventory_stock_status'] + )->willReturnOnConsecutiveCalls( + 'catalog_product_index_eav_decimal', + 'cataloginventory_stock_status' + ); + + $selectMock->expects($this->exactly(2))->method('from') + ->withConsecutive( + [ + ['main_table' => 'catalog_product_index_eav_decimal'], + ['main_table.entity_id', 'main_table.value'] + ], + [['main_table' => $selectMock], ['main_table.value']] + ) + ->willReturn($selectMock); + $selectMock->expects($this->once())->method('distinct')->willReturn($selectMock); + $selectMock->expects($this->once())->method('joinLeft') + ->with( + ['stock_index' => 'cataloginventory_stock_status'], + 'main_table.source_id = stock_index.product_id', + [] + )->willReturn($selectMock); + $attributeMock->expects($this->once())->method('getAttributeId')->willReturn(3); + $selectMock->expects($this->exactly(3))->method('where') + ->withConsecutive( + ['main_table.attribute_id = ?', 3], + ['main_table.store_id = ? ', 1], + ['stock_index.stock_status = ?', Stock::STOCK_IN_STOCK] + )->willReturn($selectMock); + $this->inventoryConfigMock->expects($this->once())->method('isShowOutOfStock')->with(1)->willReturn(false); + + $this->model->build($attributeMock, $tableName, $scope, 1); + } +} diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php index 4305bc5cb0706..7c558f60b7433 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php @@ -7,6 +7,7 @@ namespace Magento\CatalogSearch\Test\Unit\Model\Adapter\Mysql\Aggregation; use Magento\CatalogSearch\Model\Adapter\Mysql\Aggregation\DataProvider; +use Magento\CatalogSearch\Model\Adapter\Mysql\Aggregation\DataProvider\QueryBuilder; use Magento\Eav\Model\Config; use Magento\Customer\Model\Session; use Magento\Framework\App\ResourceConnection; @@ -21,6 +22,8 @@ use Magento\Framework\DB\Ddl\Table; /** + * Test for Magento\CatalogSearch\Model\Adapter\Mysql\Aggregation\DataProvider. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class DataProviderTest extends \PHPUnit\Framework\TestCase @@ -55,6 +58,11 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase */ private $adapterMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $queryBuilderMock; + protected function setUp() { $this->eavConfigMock = $this->createMock(Config::class); @@ -63,72 +71,53 @@ protected function setUp() $this->sessionMock = $this->createMock(Session::class); $this->adapterMock = $this->createMock(AdapterInterface::class); $this->resourceConnectionMock->expects($this->once())->method('getConnection')->willReturn($this->adapterMock); + $this->queryBuilderMock = $this->createMock(QueryBuilder::class); $this->model = new DataProvider( $this->eavConfigMock, $this->resourceConnectionMock, $this->scopeResolverMock, - $this->sessionMock + $this->sessionMock, + $this->queryBuilderMock ); } - public function testGetDataSetUsesFrontendPriceIndexerTableIfAttributeIsPrice() + public function testGetDataSet() { $storeId = 1; - $attributeCode = 'price'; + $attributeCode = 'my_decimal'; $scopeMock = $this->createMock(Store::class); $scopeMock->expects($this->any())->method('getId')->willReturn($storeId); + $dimensionMock = $this->createMock(Dimension::class); $dimensionMock->expects($this->any())->method('getValue')->willReturn($storeId); + $this->scopeResolverMock->expects($this->any())->method('getScope')->with($storeId)->willReturn($scopeMock); $bucketMock = $this->createMock(BucketInterface::class); $bucketMock->expects($this->once())->method('getField')->willReturn($attributeCode); + $attributeMock = $this->createMock(Attribute::class); - $attributeMock->expects($this->any())->method('getAttributeCode')->willReturn($attributeCode); - $this->eavConfigMock->expects($this->once()) - ->method('getAttribute')->with(Product::ENTITY, $attributeCode) - ->willReturn($attributeMock); + $this->eavConfigMock->expects($this->once())->method('getAttribute') + ->with(Product::ENTITY, $attributeCode)->willReturn($attributeMock); - $selectMock = $this->createMock(Select::class); - $selectMock->expects($this->any())->method('from')->willReturnSelf(); - $selectMock->expects($this->any())->method('where')->willReturnSelf(); - $selectMock->expects($this->any())->method('columns')->willReturnSelf(); - $this->adapterMock->expects($this->once())->method('select')->willReturn($selectMock); $tableMock = $this->createMock(Table::class); + $tableMock->expects($this->once())->method('getName')->willReturn('test'); + + $this->sessionMock->expects($this->once())->method('getCustomerGroupId')->willReturn(1); + + $this->queryBuilderMock->expects($this->once())->method('build') + ->with($attributeMock, 'test', $storeId, 1); $this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock); } - public function testGetDataSetUsesFrontendPriceIndexerTableForDecimalAttributes() + public function testExecute() { - $storeId = 1; - $attributeCode = 'my_decimal'; - - $scopeMock = $this->createMock(Store::class); - $scopeMock->expects($this->any())->method('getId')->willReturn($storeId); - $dimensionMock = $this->createMock(Dimension::class); - $dimensionMock->expects($this->any())->method('getValue')->willReturn($storeId); - $this->scopeResolverMock->expects($this->any())->method('getScope')->with($storeId)->willReturn($scopeMock); - - $bucketMock = $this->createMock(BucketInterface::class); - $bucketMock->expects($this->once())->method('getField')->willReturn($attributeCode); - $attributeMock = $this->createMock(Attribute::class); - $attributeMock->expects($this->any())->method('getAttributeCode')->willReturn($attributeCode); - $this->eavConfigMock->expects($this->once()) - ->method('getAttribute')->with(Product::ENTITY, $attributeCode) - ->willReturn($attributeMock); - $selectMock = $this->createMock(Select::class); - $selectMock->expects($this->any())->method('from')->willReturnSelf(); - $selectMock->expects($this->any())->method('distinct')->willReturnSelf(); - $selectMock->expects($this->any())->method('where')->willReturnSelf(); - $selectMock->expects($this->any())->method('columns')->willReturnSelf(); - $selectMock->expects($this->any())->method('joinLeft')->willReturnSelf(); - $selectMock->expects($this->any())->method('group')->willReturnSelf(); - $this->adapterMock->expects($this->any())->method('select')->willReturn($selectMock); - $tableMock = $this->createMock(Table::class); - $this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock); + $this->adapterMock->expects($this->once())->method('fetchAssoc')->with($selectMock); + + $this->model->execute($selectMock); } } From 3c6d9bef7435b10fbf9570332ce27f6ceae9a7ac Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:12:41 -0600 Subject: [PATCH 198/277] :arrow_double_up: Forwardport of magento/magento2#12786 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12786.patch (created by @aschrammel) based on commit(s): 1. 935dd8d294a5f24417dae8df3b1425e1113a76e9 2. deffe81b0a99aada6f6121e5b70c10d4ea471e0d --- app/code/Magento/Widget/Model/Widget/Instance.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index 07a995e3f7734..f21609cb1ef5c 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -34,7 +34,12 @@ class Instance extends \Magento\Framework\Model\AbstractModel const PRODUCT_LAYOUT_HANDLE = 'catalog_product_view'; - const SINGLE_PRODUCT_LAYOUT_HANLDE = 'catalog_product_view_id_{{ID}}'; + /** + * @deprecated see self::SINGLE_PRODUCT_LAYOUT_HANDLE + */ + const SINGLE_PRODUCT_LAYOUT_HANLDE = self::SINGLE_PRODUCT_LAYOUT_HANDLE; + + const SINGLE_PRODUCT_LAYOUT_HANDLE = 'catalog_product_view_id_{{ID}}'; const PRODUCT_TYPE_LAYOUT_HANDLE = 'catalog_product_view_type_{{TYPE}}'; @@ -188,12 +193,12 @@ protected function _construct() $this->_specificEntitiesLayoutHandles = [ 'anchor_categories' => self::SINGLE_CATEGORY_LAYOUT_HANDLE, 'notanchor_categories' => self::SINGLE_CATEGORY_LAYOUT_HANDLE, - 'all_products' => self::SINGLE_PRODUCT_LAYOUT_HANLDE, + 'all_products' => self::SINGLE_PRODUCT_LAYOUT_HANDLE, ]; foreach (array_keys($this->_productType->getTypes()) as $typeId) { $layoutHandle = str_replace('{{TYPE}}', $typeId, self::PRODUCT_TYPE_LAYOUT_HANDLE); $this->_layoutHandles[$typeId . '_products'] = $layoutHandle; - $this->_specificEntitiesLayoutHandles[$typeId . '_products'] = self::SINGLE_PRODUCT_LAYOUT_HANLDE; + $this->_specificEntitiesLayoutHandles[$typeId . '_products'] = self::SINGLE_PRODUCT_LAYOUT_HANDLE; } } From d4c7ca0d4aeac15b8961e0e8a582fe716a088972 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:12:48 -0600 Subject: [PATCH 199/277] :arrow_double_up: Forwardport of magento/magento2#11462 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/11462.patch (created by @avstudnitz) based on commit(s): 1. 11e38f68a9956cbdc1d7c48284bc712729f43a90 2. 7800e5dd8aac704da3f2b1799baadf2a01269c61 3. 252529f0819d2792982452ed9d929d5fb526996d 4. 519b805c2853f895d804c49e08bd7a23b108c38c 5. eb79b38beb6b79411fe95d30e324d7d094ab5874 6. fce3afe6390be6c0eb2d5fcdb2f76108d6a44e77 7. 3e38118c1e7f92e77963a6ae4f42e66520e6f58f Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#7241: No option to start with blank option for prefix and suffix in checkout. (reported by @spyrule) --- .../Config/Model/Config/Source/Nooptreq.php | 10 ++++-- .../Magento/Customer/Block/Widget/Name.php | 14 +++++--- app/code/Magento/Customer/Model/Options.php | 32 +++++++++++++++++-- .../Magento/Customer/etc/adminhtml/system.xml | 4 +-- app/code/Magento/Customer/i18n/en_US.csv | 4 +-- 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Source/Nooptreq.php b/app/code/Magento/Config/Model/Config/Source/Nooptreq.php index 03fe5ca2abccc..1c9eb801dfec7 100644 --- a/app/code/Magento/Config/Model/Config/Source/Nooptreq.php +++ b/app/code/Magento/Config/Model/Config/Source/Nooptreq.php @@ -11,15 +11,19 @@ */ class Nooptreq implements \Magento\Framework\Option\ArrayInterface { + const VALUE_NO = ''; + const VALUE_OPTIONAL = 'opt'; + const VALUE_REQUIRED = 'req'; + /** * @return array */ public function toOptionArray() { return [ - ['value' => '', 'label' => __('No')], - ['value' => 'opt', 'label' => __('Optional')], - ['value' => 'req', 'label' => __('Required')] + ['value' => self::VALUE_NO, 'label' => __('No')], + ['value' => self::VALUE_OPTIONAL, 'label' => __('Optional')], + ['value' => self::VALUE_REQUIRED, 'label' => __('Required')] ]; } } diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php index ecd09319cd85e..35f3bbefb8f00 100644 --- a/app/code/Magento/Customer/Block/Widget/Name.php +++ b/app/code/Magento/Customer/Block/Widget/Name.php @@ -106,8 +106,11 @@ public function getPrefixOptions() $prefixOptions = $this->options->getNamePrefixOptions(); if ($this->getObject() && !empty($prefixOptions)) { - $oldPrefix = $this->escapeHtml(trim($this->getObject()->getPrefix())); - $prefixOptions[$oldPrefix] = $oldPrefix; + $prefixOption = $this->getObject()->getPrefix(); + $oldPrefix = $this->escapeHtml(trim($prefixOption)); + if ($prefixOption !== null && !isset($prefixOptions[$oldPrefix]) && !isset($prefixOptions[$prefixOption])) { + $prefixOptions[$oldPrefix] = $oldPrefix; + } } return $prefixOptions; } @@ -161,8 +164,11 @@ public function getSuffixOptions() { $suffixOptions = $this->options->getNameSuffixOptions(); if ($this->getObject() && !empty($suffixOptions)) { - $oldSuffix = $this->escapeHtml(trim($this->getObject()->getSuffix())); - $suffixOptions[$oldSuffix] = $oldSuffix; + $suffixOption = $this->getObject()->getSuffix(); + $oldSuffix = $this->escapeHtml(trim($suffixOption)); + if ($suffixOption !== null && !isset($suffixOptions[$oldSuffix]) && !isset($suffixOptions[$suffixOption])) { + $suffixOptions[$oldSuffix] = $oldSuffix; + } } return $suffixOptions; } diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php index ee109dac08104..7747e309d82a6 100644 --- a/app/code/Magento/Customer/Model/Options.php +++ b/app/code/Magento/Customer/Model/Options.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Model; +use Magento\Config\Model\Config\Source\Nooptreq as NooptreqSource; use Magento\Customer\Helper\Address as AddressHelper; use Magento\Framework\Escaper; @@ -42,7 +43,10 @@ public function __construct( */ public function getNamePrefixOptions($store = null) { - return $this->_prepareNamePrefixSuffixOptions($this->addressHelper->getConfig('prefix_options', $store)); + return $this->prepareNamePrefixSuffixOptions( + $this->addressHelper->getConfig('prefix_options', $store), + $this->addressHelper->getConfig('prefix_show', $store) == NooptreqSource::VALUE_OPTIONAL + ); } /** @@ -53,16 +57,34 @@ public function getNamePrefixOptions($store = null) */ public function getNameSuffixOptions($store = null) { - return $this->_prepareNamePrefixSuffixOptions($this->addressHelper->getConfig('suffix_options', $store)); + return $this->prepareNamePrefixSuffixOptions( + $this->addressHelper->getConfig('suffix_options', $store), + $this->addressHelper->getConfig('suffix_show', $store) == NooptreqSource::VALUE_OPTIONAL + ); + } + + /** + * @param $options + * @param bool $isOptional + * @return array|bool + * + * @deprecated + * @see prepareNamePrefixSuffixOptions() + */ + protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false) + { + return $this->prepareNamePrefixSuffixOptions($options, $isOptional); } /** * Unserialize and clear name prefix or suffix options + * If field is optional, add an empty first option. * * @param string $options + * @param bool $isOptional * @return array|bool */ - protected function _prepareNamePrefixSuffixOptions($options) + private function prepareNamePrefixSuffixOptions($options, $isOptional = false) { $options = trim($options); if (empty($options)) { @@ -74,6 +96,10 @@ protected function _prepareNamePrefixSuffixOptions($options) $value = $this->escaper->escapeHtml(trim($value)); $result[$value] = $value; } + if ($isOptional && trim(current($options))) { + $result = array_merge([' ' => ' '], $result); + } + return $result; } } diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index daf9240677588..46d7f589022b8 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -209,7 +209,7 @@ - Put semicolon in the beginning for empty first option.
Leave empty for open text field.]]> + Leave empty for open text field.]]>
@@ -227,7 +227,7 @@ - Put semicolon in the beginning for empty first option.
Leave empty for open text field.]]> + Leave empty for open text field.]]>
diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv index 1db22ebf2d93a..5d7d8b2bf30a4 100644 --- a/app/code/Magento/Customer/i18n/en_US.csv +++ b/app/code/Magento/Customer/i18n/en_US.csv @@ -479,9 +479,9 @@ Strong,Strong "The title that goes before name (Mr., Mrs., etc.)","The title that goes before name (Mr., Mrs., etc.)" "Prefix Dropdown Options","Prefix Dropdown Options" " - Semicolon (;) separated values.
Put semicolon in the beginning for empty first option.
Leave empty for open text field. + Semicolon (;) separated values.
Leave empty for open text field. "," - Semicolon (;) separated values.
Put semicolon in the beginning for empty first option.
Leave empty for open text field. + Semicolon (;) separated values.
Leave empty for open text field. " "Show Middle Name (initial)","Show Middle Name (initial)" "Always optional.","Always optional." From 07fa73aa7e698bc212ebeb65efbe558e49ac054a Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:12:55 -0600 Subject: [PATCH 200/277] :arrow_double_up: Forwardport of magento/magento2#12810 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12810.patch (created by @nicka101) based on commit(s): 1. 5f1b8461045779966bb5e70954d4ff96dd2447d9 --- app/code/Magento/Eav/Model/Config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index cc68709cd3b03..0eecca21b0d54 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -503,6 +503,7 @@ public function getAttribute($entityType, $code) } if (isset($this->attributes[$entityTypeCode][$code])) { + \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__); return $this->attributes[$entityTypeCode][$code]; } From 60426c6cd24c2f7d1881a27459a2a46628a81b3f Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:13:02 -0600 Subject: [PATCH 201/277] :arrow_double_up: Forwardport of magento/magento2#12730 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12730.patch (created by @EfremovaVI) based on commit(s): 1. 370e526de6b6f67b5f07dea5bfbc91884f9311ea 2. 5e43f84815c8a00f4216242fc9e3ee2e442f3552 3. ff7029f231b4289ced181485708e35fca0ad6a42 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12713: Currency symbol overlaps entered attribute option's price while creating Configurable Product (reported by @alena-marchenko) --- .../web/css/source/module/components/_currency-addon.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less index 0c33b8d3b8a02..1e5d03d6f25c2 100644 --- a/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less +++ b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/web/css/source/module/components/_currency-addon.less @@ -10,7 +10,8 @@ @currency-addon-symbol__border-color: @field-control__border-color; @currency-addon-symbol__color: @color-gray52; @currency-addon-symbol__height: @field-control__height; -@currency-addon-symbol__width: 1.6rem; +@currency-addon-symbol__width: 2.6rem; + // // Common From 14f85e9cd1f6c3349a5ce35c49c14e5772687d86 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:13:11 -0600 Subject: [PATCH 202/277] :arrow_double_up: Forwardport of magento/magento2#12732 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12732.patch (created by @ihor-sviziev) based on commit(s): 1. ecf27becd6bc99842527153f45e0e7fc91c95624 2. 5e4bf42b29de485cf19b119e32e52effe5ce1820 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12206: Tracking link returns 404 page in admin panel (reported by @catstantin) --- app/code/Magento/Shipping/Helper/Data.php | 24 +++++-- .../Magento/Shipping/etc/adminhtml/di.xml | 7 ++ .../Magento/Shipping/Helper/DataTest.php | 72 +++++++++++++++---- 3 files changed, 85 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Shipping/Helper/Data.php b/app/code/Magento/Shipping/Helper/Data.php index c2535336495f7..835454389cf7a 100644 --- a/app/code/Magento/Shipping/Helper/Data.php +++ b/app/code/Magento/Shipping/Helper/Data.php @@ -9,6 +9,10 @@ */ namespace Magento\Shipping\Helper; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Store\Model\StoreManagerInterface; + class Data extends \Magento\Framework\App\Helper\AbstractHelper { /** @@ -19,19 +23,28 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper protected $_allowedHashKeys = ['ship_id', 'order_id', 'track_id']; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; + /** + * @var UrlInterface|null + */ + private $url; + /** * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param StoreManagerInterface $storeManager + * @param UrlInterface|null $url */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Store\Model\StoreManagerInterface $storeManager + StoreManagerInterface $storeManager, + UrlInterface $url = null ) { $this->_storeManager = $storeManager; + $this->url = $url ?: ObjectManager::getInstance()->get(UrlInterface::class); + parent::__construct($context); } @@ -63,12 +76,13 @@ protected function _getTrackingUrl($key, $model, $method = 'getId') { $urlPart = "{$key}:{$model->{$method}()}:{$model->getProtectCode()}"; $params = [ + '_scope' => $model->getStoreId(), + '_nosid' => true, '_direct' => 'shipping/tracking/popup', '_query' => ['hash' => $this->urlEncoder->encode($urlPart)] ]; - $storeModel = $this->_storeManager->getStore($model->getStoreId()); - return $storeModel->getUrl('', $params); + return $this->url->getUrl('', $params); } /** diff --git a/app/code/Magento/Shipping/etc/adminhtml/di.xml b/app/code/Magento/Shipping/etc/adminhtml/di.xml index 54d5d9664e66f..36bd1ae9d3505 100644 --- a/app/code/Magento/Shipping/etc/adminhtml/di.xml +++ b/app/code/Magento/Shipping/etc/adminhtml/di.xml @@ -7,4 +7,11 @@ --> + + + + + Magento\Framework\Url + + diff --git a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php index eaac89cc6851b..99a28812a12d5 100644 --- a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php @@ -5,16 +5,18 @@ */ namespace Magento\Shipping\Helper; +use Magento\Store\Model\StoreManagerInterface; + class DataTest extends \PHPUnit\Framework\TestCase { /** * @var \Magento\Shipping\Helper\Data */ - protected $_helper = null; + private $helper; protected function setUp() { - $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $this->helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( \Magento\Shipping\Helper\Data::class ); } @@ -31,33 +33,77 @@ public function testGetTrackingPopupUrlBySalesModel($modelName, $getIdMethod, $e { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $constructArgs = []; - if (\Magento\Sales\Model\Order\Shipment::class == $modelName) { - $orderRepository = $this->_getMockOrderRepository($code); + if (\Magento\Sales\Model\Order\Shipment::class === $modelName) { + $orderRepository = $this->getMockOrderRepository($code); + $constructArgs['orderRepository'] = $orderRepository; + } elseif (\Magento\Sales\Model\Order\Shipment\Track::class === $modelName) { + $shipmentRepository = $this->getMockShipmentRepository($code); + $constructArgs['shipmentRepository'] = $shipmentRepository; + } + + $model = $objectManager->create($modelName, $constructArgs); + $model->{$getIdMethod}($entityId); + + if (\Magento\Sales\Model\Order::class === $modelName) { + $model->setProtectCode($code); + } + if (\Magento\Sales\Model\Order\Shipment\Track::class === $modelName) { + $model->setParentId(1); + } + + $actual = $this->helper->getTrackingPopupUrlBySalesModel($model); + $this->assertEquals($expected, $actual); + } + + /** + * From the admin panel with custom URL we should have generated frontend URL + * + * @param string $modelName + * @param string $getIdMethod + * @param int $entityId + * @param string $code + * @param string $expected + * @magentoAppArea adminhtml + * @magentoConfigFixture admin_store web/unsecure/base_link_url http://admin.localhost/ + * @dataProvider getTrackingPopupUrlBySalesModelDataProvider + */ + public function testGetTrackingPopupUrlBySalesModelFromAdmin($modelName, $getIdMethod, $entityId, $code, $expected) + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var StoreManagerInterface $storeManager */ + $storeManager = $objectManager->create(StoreManagerInterface::class); + $storeManager->reinitStores(); + + $constructArgs = []; + if (\Magento\Sales\Model\Order\Shipment::class === $modelName) { + $orderRepository = $this->getMockOrderRepository($code); $constructArgs['orderRepository'] = $orderRepository; - } elseif (\Magento\Sales\Model\Order\Shipment\Track::class == $modelName) { - $shipmentRepository = $this->_getMockShipmentRepository($code); + } elseif (\Magento\Sales\Model\Order\Shipment\Track::class === $modelName) { + $shipmentRepository = $this->getMockShipmentRepository($code); $constructArgs['shipmentRepository'] = $shipmentRepository; } $model = $objectManager->create($modelName, $constructArgs); $model->{$getIdMethod}($entityId); - if (\Magento\Sales\Model\Order::class == $modelName) { + if (\Magento\Sales\Model\Order::class === $modelName) { $model->setProtectCode($code); } - if (\Magento\Sales\Model\Order\Shipment\Track::class == $modelName) { + if (\Magento\Sales\Model\Order\Shipment\Track::class === $modelName) { $model->setParentId(1); } - $actual = $this->_helper->getTrackingPopupUrlBySalesModel($model); + //Frontend URL should be used there + $actual = $this->helper->getTrackingPopupUrlBySalesModel($model); $this->assertEquals($expected, $actual); } /** * @param $code - * @return \Magento\Sales\Api\OrderRepositoryInterface + * @return \Magento\Sales\Api\OrderRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected function _getMockOrderRepository($code) + private function getMockOrderRepository($code) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $order = $objectManager->create(\Magento\Sales\Model\Order::class); @@ -71,10 +117,10 @@ protected function _getMockOrderRepository($code) * @param $code * @return \Magento\Sales\Model\Order\ShipmentRepository|\PHPUnit_Framework_MockObject_MockObject */ - protected function _getMockShipmentRepository($code) + private function getMockShipmentRepository($code) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $orderRepository = $this->_getMockOrderRepository($code); + $orderRepository = $this->getMockOrderRepository($code); $shipmentArgs = ['orderRepository' => $orderRepository]; $shipment = $objectManager->create(\Magento\Sales\Model\Order\Shipment::class, $shipmentArgs); From 99e3a76b47267c930d4268b7bbf65500d1913f24 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:14:28 -0600 Subject: [PATCH 203/277] :arrow_double_up: Forwardport of magento/magento2#12401 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12401.patch (created by @therool) based on commit(s): 1. ba0472f27f53a51ba532ec33fb017663902f34ab 2. 48923e1c95a235b490d3a119139bb762e947c68f 3. 774cb4c67ece33041901035602aa62c180ae76b1 4. 12145bca8cc87f5072cd5fcbcbd85493c012af4d 5. 7bdb92156a3ea588196d7bdc8b9899b894092b7c 6. 70f5e3860919d97c58c443862d6e6bcf7ff0a5a2 7. 92f620f87717d4ddee66726a403b70fb79b151d4 8. 1c7123fe902932c77053873bd73d452bb74e5f77 9. 9d5fa49fd44e14cde60c65e3c28486e4f5e3ddfa 10. a35b4686c1b95dc356595246410e527d7c57e2ac Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#11885: Magento 2.2 Paypal Can't Accept Checkout Agreements Before Routing to PayPal (reported by @Silarn) --- app/code/Magento/Paypal/Model/Express.php | 7 ++- .../Paypal/Test/Unit/Model/ExpressTest.php | 11 +++- .../web/js/action/set-payment-method.js | 42 +------------- .../js/model/place-order-mixin.test.js | 55 ++++++++++++++++++ .../set-payment-information-mixin.test.js | 56 +++++++++++++++++++ .../paypal-express-abstract.test.js | 28 ++++++++++ 6 files changed, 158 insertions(+), 41 deletions(-) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index 8ba8adcede511..accb22b265335 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -669,7 +669,7 @@ public function getApi() public function assignData(\Magento\Framework\DataObject $data) { parent::assignData($data); - + $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); if (!is_array($additionalData)) { @@ -677,6 +677,11 @@ public function assignData(\Magento\Framework\DataObject $data) } foreach ($additionalData as $key => $value) { + // Skip extension attributes + if ($key === \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) { + continue; + } + $this->getInfoInstance()->setAdditionalInformation($key, $value); } return $this; diff --git a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php index 6a2d33d010190..1b8c33622e784 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php @@ -161,12 +161,21 @@ public function testAssignData() { $transportValue = 'something'; + $extensionAttribute = $this->getMockForAbstractClass( + \Magento\Quote\Api\Data\PaymentExtensionInterface::class, + [], + '', + false, + false + ); + $data = new DataObject( [ PaymentInterface::KEY_ADDITIONAL_DATA => [ Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue, Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue, - Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue + Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue, + \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttribute ] ] ); diff --git a/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js b/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js index a994f9defd583..63e34437c6f90 100644 --- a/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js +++ b/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js @@ -4,48 +4,12 @@ */ define([ - 'jquery', 'Magento_Checkout/js/model/quote', - 'Magento_Checkout/js/model/url-builder', - 'mage/storage', - 'Magento_Checkout/js/model/error-processor', - 'Magento_Customer/js/model/customer', - 'Magento_Checkout/js/model/full-screen-loader' -], function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) { + 'Magento_Checkout/js/action/set-payment-information' +], function (quote, setPaymentInformation) { 'use strict'; return function (messageContainer) { - var serviceUrl, - payload, - paymentData = quote.paymentMethod(); - - /** - * Checkout for guest and registered customer. - */ - if (!customer.isLoggedIn()) { - serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', { - cartId: quote.getQuoteId() - }); - payload = { - cartId: quote.getQuoteId(), - email: quote.guestEmail, - paymentMethod: paymentData - }; - } else { - serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {}); - payload = { - cartId: quote.getQuoteId(), - paymentMethod: paymentData - }; - } - fullScreenLoader.startLoader(); - - return storage.post( - serviceUrl, JSON.stringify(payload) - ).fail(function (response) { - errorProcessor.process(response, messageContainer); - }).always(function () { - fullScreenLoader.stopLoader(); - }); + return setPaymentInformation(messageContainer, quote.paymentMethod()); }; }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js new file mode 100644 index 0000000000000..545daf0a330c9 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js @@ -0,0 +1,55 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + mocks = { + 'Magento_Checkout/js/action/place-order': jasmine.createSpy('placeOrderAction'), + 'Magento_CheckoutAgreements/js/model/agreements-assigner': jasmine.createSpy('agreementsAssigner') + }, + defaultContext = require.s.contexts._, + mixin, + placeOrderAction; + + beforeEach(function (done) { + window.checkoutConfig = { + checkoutAgreements: { + isEnabled: true + } + }; + injector.mock(mocks); + injector.require([ + 'Magento_CheckoutAgreements/js/model/place-order-mixin', + 'Magento_Checkout/js/action/place-order' + ], function (Mixin, placeOrder) { + mixin = Mixin; + placeOrderAction = placeOrder; + done(); + }); + }); + + describe('Magento_CheckoutAgreements/js/model/place-order-mixin', function () { + it('mixin is applied to Magento_Checkout/js/action/place-order', function () { + var placeOrderMixins = defaultContext.config.config.mixins['Magento_Checkout/js/action/place-order']; + + expect(placeOrderMixins['Magento_CheckoutAgreements/js/model/place-order-mixin']).toBe(true); + }); + + it('Magento_CheckoutAgreements/js/model/agreements-assigner is called', function () { + var messageContainer = jasmine.createSpy('messageContainer'), + paymentData = {}; + + mixin(placeOrderAction)(paymentData, messageContainer); + expect(mocks['Magento_CheckoutAgreements/js/model/agreements-assigner']) + .toHaveBeenCalledWith(paymentData); + expect(mocks['Magento_Checkout/js/action/place-order']) + .toHaveBeenCalledWith(paymentData, messageContainer); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js new file mode 100644 index 0000000000000..ed525bfd96a6c --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js @@ -0,0 +1,56 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + mocks = { + 'Magento_Checkout/js/action/set-payment-information': jasmine.createSpy('placeOrderAction'), + 'Magento_CheckoutAgreements/js/model/agreements-assigner': jasmine.createSpy('agreementsAssigner') + }, + defaultContext = require.s.contexts._, + mixin, + placeOrderAction; + + beforeEach(function (done) { + window.checkoutConfig = { + checkoutAgreements: { + isEnabled: true + } + }; + injector.mock(mocks); + injector.require([ + 'Magento_CheckoutAgreements/js/model/set-payment-information-mixin', + 'Magento_Checkout/js/action/set-payment-information' + ], function (Mixin, setPaymentInformation) { + mixin = Mixin; + placeOrderAction = setPaymentInformation; + done(); + }); + }); + + describe('Magento_CheckoutAgreements/js/model/set-payment-information-mixin', function () { + it('mixin is applied to Magento_Checkout/js/action/set-payment-information', function () { + var placeOrderMixins = defaultContext + .config.config.mixins['Magento_Checkout/js/action/set-payment-information']; + + expect(placeOrderMixins['Magento_CheckoutAgreements/js/model/set-payment-information-mixin']).toBe(true); + }); + + it('Magento_CheckoutAgreements/js/model/agreements-assigner is called', function () { + var messageContainer = jasmine.createSpy('messageContainer'), + paymentData = {}; + + mixin(placeOrderAction)(messageContainer, paymentData); + expect(mocks['Magento_CheckoutAgreements/js/model/agreements-assigner']) + .toHaveBeenCalledWith(paymentData); + expect(mocks['Magento_Checkout/js/action/set-payment-information']) + .toHaveBeenCalledWith(messageContainer, paymentData); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js index dc520c5238568..47e3507ea1321 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js @@ -16,6 +16,13 @@ define([ describe('paypal/js/view/payment/method-renderer/paypal-express-abstract', function () { var injector = new Squire(), + successPromise = jasmine.createSpyObj('successPromise', ['done']), + setPaymentMock = jasmine.createSpy('set-payment-information', function () { + return successPromise; + }).and.callThrough(), + validateMock = jasmine.createSpy('validate', function () { + return true; + }).and.callThrough(), mocks = { 'Magento_Checkout/js/model/quote': { billingAddress: ko.observable(), @@ -23,6 +30,10 @@ define([ paymentMethod: ko.observable(), totals: ko.observable({}) + }, + 'Magento_Checkout/js/action/set-payment-information': setPaymentMock, + 'Magento_Checkout/js/model/payment/additional-validators': { + validate: validateMock } }, paypalExpressAbstract, @@ -85,6 +96,23 @@ define([ }, 500); }); + it('setPaymentMethodAction is called before redirect to paypal', function () { + spyOn(paypalExpressAbstract, 'selectPaymentMethod'); + paypalExpressAbstract.continueToPayPal(); + expect(paypalExpressAbstract.selectPaymentMethod).toHaveBeenCalled(); + expect(validateMock).toHaveBeenCalled(); + expect(validateMock.calls.mostRecent()).toEqual(jasmine.objectContaining({ + object: mocks['Magento_Checkout/js/model/payment/additional-validators'], + args: [], + returnValue: true + })); + expect(setPaymentMock).toHaveBeenCalled(); + expect(setPaymentMock.calls.mostRecent()).toEqual(jasmine.objectContaining({ + returnValue: successPromise + })); + expect(successPromise.done).toHaveBeenCalledWith(jasmine.any(Function)); + }); + afterAll(function (done) { tplElement.remove(); done(); From 4cfc07e28a8edb388011168e5fd0726dc6c71119 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:14:35 -0600 Subject: [PATCH 204/277] :arrow_double_up: Forwardport of magento/magento2#12902 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12902.patch (created by @joni-jones) based on commit(s): 1. 0c5cb6ada1c46b7e68ee4cbd282c5369d63cbab7 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12900: Braintree "Place Order" button is disabled after failed validation (reported by @ifekaj) --- .../view/payment/method-renderer/cc-form.js | 1 + .../payment/method-renderer/cc-form.test.js | 35 ++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js index 2834c0a683979..39bdf582c8cd7 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js @@ -79,6 +79,7 @@ define( */ onError: function (response) { braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized')); + this.isPlaceOrderActionAllowed(true); throw response.message; }, diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js index d71f517b5e7f9..52739eec2782b 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js @@ -27,7 +27,7 @@ define([ ), 'Magento_Braintree/js/view/payment/adapter': jasmine.createSpyObj( 'adapter', - ['setup', 'setConfig'] + ['setup', 'setConfig', 'showError'] ) }, braintreeCcForm; @@ -43,14 +43,17 @@ define([ }; injector.mock(mocks); injector.require(['Magento_Braintree/js/view/payment/method-renderer/cc-form'], function (Constr) { - braintreeCcForm = new Constr({ - provider: 'provName', - name: 'test', - index: 'test' - }); - - done(); + braintreeCcForm = new Constr({ + provider: 'provName', + name: 'test', + index: 'test', + item: { + title: 'Braintree' + } }); + + done(); + }); }); it('Check if payment code and message container are restored after onActiveChange call.', function () { @@ -65,5 +68,21 @@ define([ expect(braintreeCcForm.getCode()).toEqual(expectedCode); expect(braintreeCcForm.messageContainer).toEqual(expectedMessageContainer); }); + + it('Check if form validation fails when "Place Order" button should be active.', function () { + var errorMessage = 'Something went wrong.', + + /** + * Anonymous wrapper + */ + func = function () { + braintreeCcForm.clientConfig.onError({ + 'message': errorMessage + }); + }; + + expect(func).toThrow(errorMessage); + expect(braintreeCcForm.isPlaceOrderActionAllowed()).toBeTruthy(); + }); }); }); From ea616e0a217e74707305f1038e6ca207d4bdaba6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:14:42 -0600 Subject: [PATCH 205/277] :arrow_double_up: Forwardport of magento/magento2#12931 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12931.patch (created by @jalogut) based on commit(s): 1. c66fde62da658439a6972e4e1a9770d7e13735a9 --- .../source/module/main/actions-bar/_store-switcher.less | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less index 2ae0f3d2430bb..80bebb22a9043 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less @@ -42,6 +42,14 @@ max-height: 250px; overflow-y: auto; padding-top: .25em; + &::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; + } + &::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0, 0, 0, .5); + } li { border: 0; From be55217eae883abd02d44211fa0a88bb0a1d803c Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:14:49 -0600 Subject: [PATCH 206/277] :arrow_double_up: Forwardport of magento/magento2#12857 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12857.patch (created by @jonashrem) based on commit(s): 1. 351231dfb5d8779109607859fc3261ec6cd5b787 2. c92ae1b43eef87cfd348afbc019024b767faac2d --- app/bootstrap.php | 4 ++-- .../view/magento/setup/readiness-check/progress.phtml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/bootstrap.php b/app/bootstrap.php index 6701a9f4dd51e..aba8668f4a158 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -14,12 +14,12 @@ if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) { if (PHP_SAPI == 'cli') { echo 'Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. ' . - 'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html'; + 'Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html'; } else { echo <<

Magento supports PHP 7.0.2, 7.0.4, and 7.0.6 or later. Please read - + Magento System Requirements. HTML; diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index c1ac41c6b5f2e..eb9dd0ce9d1aa 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -336,7 +336,7 @@

For additional assistance, see - PHP settings check help .

@@ -392,7 +392,7 @@ @@ -413,7 +413,7 @@

The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables.
- Our PHP extension help can get you started. + Our PHP extension help can get you started.

For additional assistance, contact your hosting provider. @@ -477,7 +477,7 @@

@@ -500,7 +500,7 @@ The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables.
- For help, see our File Permission Help or call your hosting provider. + For help, see our File Permission Help or call your hosting provider.

  • Date: Wed, 24 Jan 2018 12:14:57 -0600 Subject: [PATCH 207/277] :arrow_double_up: Forwardport of magento/magento2#12845 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12845.patch (created by @schmengler) based on commit(s): 1. 50ffc6ac185ac8c9e6f95f0e60ec7a3d510e743b Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12844: "Cannot instantiate interface Magento\Framework\Interception\ObjectManager\ConfigInterface" error in integration tests (reported by @schmengler) --- dev/tests/integration/etc/di/preferences/ce.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tests/integration/etc/di/preferences/ce.php b/dev/tests/integration/etc/di/preferences/ce.php index 0e6f90d75f311..d5aaa7e730826 100644 --- a/dev/tests/integration/etc/di/preferences/ce.php +++ b/dev/tests/integration/etc/di/preferences/ce.php @@ -16,6 +16,8 @@ \Magento\Framework\App\Response\Http::class => \Magento\TestFramework\Response::class, \Magento\Framework\Interception\PluginListInterface::class => \Magento\TestFramework\Interception\PluginList::class, + \Magento\Framework\Interception\ObjectManager\ConfigInterface::class => + \Magento\TestFramework\ObjectManager\Config::class, \Magento\Framework\Interception\ObjectManager\Config\Developer::class => \Magento\TestFramework\ObjectManager\Config::class, \Magento\Framework\View\LayoutInterface::class => \Magento\TestFramework\View\Layout::class, From 7f42a672ee864f2fc186d0259eb0de2e3d9634f6 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:15:04 -0600 Subject: [PATCH 208/277] :arrow_double_up: Forwardport of magento/magento2#12755 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12755.patch (created by @virtual97) based on commit(s): 1. 2ccb374aaf4a646594eb01e72fee7748871fadcc 2. 288d0d47e4998e1b8981063b562e87f783f08f42 3. e78ea61cc080a38bb7985f04b5bf33ab0547cf73 Fixed GitHub Issues in 2.3-develop branch: - magento/magento2#12294: Bug: Adding Custom Attribute - The value of Admin scope can't be empty (reported by @webscot) --- .../templates/catalog/product/attribute/options.phtml | 2 +- app/code/Magento/Catalog/view/adminhtml/web/js/options.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index a0041d2e02988..ce38b5f97c6e8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder(); - - - - - - - - - -
    -
    -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-qunit.js b/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-qunit.js deleted file mode 100644 index 60dffe84db0fc..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-qunit.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -test( "initialization", function() { - var calendar = $('#calendar').calendar(); - ok( calendar.is(':mage-calendar'), "this test is fine" ); - calendar.calendar('destroy'); -}); -test( "global configuration merge", function() { - $.extend(true, $, { - calendarConfig: { - showOn: 'button', - showAnim: '', - buttonImageOnly: true, - showButtonPanel: true, - showWeek: true, - timeFormat: '', - showTime: false, - showHour: false, - showMinute: false - } - }); - var calendar = $('#calendar').calendar(); - equal('button', calendar.calendar('option', 'showOn')); - equal('', calendar.calendar('option', 'showAnim')); - ok(calendar.calendar('option', 'buttonImageOnly')); - ok(calendar.calendar('option', 'showButtonPanel')); - ok(calendar.calendar('option', 'showWeek')); - equal('', calendar.calendar('option', 'timeFormat')); - equal(false, calendar.calendar('option', 'showTime')); - equal(false, calendar.calendar('option', 'showHour')); - equal(false, calendar.calendar('option', 'showMinute')); - calendar.calendar('destroy'); - delete $.calendarConfig; -}); -test( "specifying AM/PM in timeformat option changes AMPM option to true", function(){ - var calendar = $('#calendar').calendar({timeFormat: 'hh:mm tt', ampm: false}); - ok(calendar.calendar('option', 'ampm')); - calendar.calendar('destroy'); -}); -test( "omitting AM/PM in timeformat option changes AMPM option to false", function(){ - var calendar = $('#calendar').calendar({timeFormat: 'hh:mm'}); - notEqual(true, calendar.calendar('option', 'ampm')); - calendar.calendar('destroy'); -}); -test( "with server timezone offset", function(){ - var serverTimezoneSeconds = 1346122095, - calendar = $('#calendar').calendar({serverTimezoneSeconds: serverTimezoneSeconds}), - currentDate = new Date(); - currentDate.setTime((serverTimezoneSeconds + currentDate.getTimezoneOffset() * 60) * 1000); - ok(currentDate.toString() === calendar.calendar('getTimezoneDate').toString()); - calendar.calendar('destroy'); -}); -test( "without sever timezone offset", function() { - var calendar = $('#calendar').calendar(), - currentDate = new Date(); - ok(currentDate.toString() === calendar.calendar('getTimezoneDate').toString()); - calendar.calendar('destroy'); -}); -test( "dateTime format conversions", function() { - var calendar = $('#calendar').calendar({dateFormat: 'M/d/yy', timeFormat: 'h:mm a'}); - equal('mm/d/yy', calendar.calendar('option', 'dateFormat')); - equal('h:mm tt', calendar.calendar('option', 'timeFormat')); - calendar.calendar('destroy'); - calendar.calendar({dateFormat: 'MMMM/EEEE/yyyy', timeFormat: 'HH:mm'}); - equal('MM/DD/yy', calendar.calendar('option', 'dateFormat')); - equal('hh:mm', calendar.calendar('option', 'timeFormat')); - calendar.calendar('destroy'); -}); -test( "destroy", function() { - var calendar = $('#calendar').calendar(), - calendarExist = calendar.is(':mage-calendar'); - calendar.calendar('destroy'); - equal(true, calendarExist != calendar.is(':mage-calendar')); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-test.js deleted file mode 100644 index 7748106b303c3..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -CalendarTest = TestCase('CalendarTest'); -CalendarTest.prototype.testInit = function() { - /*:DOC += */ - var calendar = jQuery('#calendar').calendar(); - assertEquals(true, calendar.is(':mage-calendar')); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testGlobalConfigurationMerge = function() { - /*:DOC += */ - $.extend(true, $, { - calendarConfig: { - showOn: 'button', - showAnim: '', - buttonImageOnly: true, - showButtonPanel: true, - showWeek: true, - timeFormat: '', - showTime: false, - showHour: false, - showMinute: false - } - }); - var calendar = $('#calendar').calendar(); - assertEquals('button', calendar.calendar('option', 'showOn')); - assertEquals('', calendar.calendar('option', 'showAnim')); - assertEquals(true, calendar.calendar('option', 'buttonImageOnly')); - assertEquals(true, calendar.calendar('option', 'showButtonPanel')); - assertEquals(true, calendar.calendar('option', 'showWeek')); - assertEquals('', calendar.calendar('option', 'timeFormat')); - assertEquals(false, calendar.calendar('option', 'showTime')); - assertEquals(false, calendar.calendar('option', 'showHour')); - assertEquals(false, calendar.calendar('option', 'showMinute')); - calendar.calendar('destroy'); - delete $.calendarConfig; -}; -CalendarTest.prototype.testEnableAMPM = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar({timeFormat: 'hh:mm tt', ampm: false}); - assertEquals(true, calendar.calendar('option', 'ampm')); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testDisableAMPM = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar({timeFormat: 'hh:mm'}); - assertTrue(!calendar.calendar('option', 'ampm')); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testWithServerTimezoneOffset = function() { - /*:DOC += */ - var serverTimezoneSeconds = 1346122095, - calendar = $('#calendar').calendar({serverTimezoneSeconds: serverTimezoneSeconds}), - currentDate = new Date(); - currentDate.setTime((serverTimezoneSeconds + currentDate.getTimezoneOffset() * 60) * 1000); - assertEquals(true, currentDate.toString() === calendar.calendar('getTimezoneDate').toString()); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testWithServerTimezoneShift = function() { - /*:DOC += */ - var serverTimezoneOffset = 43200, - calendar = $('#calendar').calendar({serverTimezoneOffset: serverTimezoneOffset}), - currentDate = new Date(); - - setTimeout(function () { - currentDate.setTime(currentDate.getTime() + (serverTimezoneOffset + currentDate.getTimezoneOffset() * 60) * 1000); - assertEquals(true, currentDate.toString() === calendar.calendar('getTimezoneDate').toString()); - calendar.calendar('destroy'); - }, 61000); -}; -CalendarTest.prototype.testWithoutServerTimezoneOffset = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar(), - currentDate = new Date(); - assertEquals(true, currentDate.toString() === calendar.calendar('getTimezoneDate').toString()); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testInitDateTimePicker = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar(); - assertEquals(true, calendar.hasClass('_has-datepicker')); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testDateTimeMapping = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar({dateFormat: 'M/d/yy', timeFormat: 'h:mm a'}); - assertEquals('mm/d/yy', calendar.calendar('option', 'dateFormat')); - assertEquals('h:mm TT', calendar.calendar('option', 'timeFormat')); - calendar.calendar('destroy'); - calendar.calendar({dateFormat: 'MMMM/EEEE/yyyy'}); - assertEquals('MM/DD/yy', calendar.calendar('option', 'dateFormat')); - calendar.calendar('destroy'); -}; -CalendarTest.prototype.testDestroy = function() { - /*:DOC += */ - var calendar = $('#calendar').calendar(), - calendarExist = calendar.is(':mage-calendar'); - calendar.calendar('destroy'); - assertEquals(true, calendarExist != calendar.is(':mage-calendar')); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar.html b/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar.html deleted file mode 100644 index b474dc2d5ce95..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/calendar.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Calendar Widget: QUnit Tests - - - - - - - - - - - -
    -
    - -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/date-range-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/calendar/date-range-test.js deleted file mode 100644 index 61211c067ad12..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/calendar/date-range-test.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -DaterangeTest = TestCase('DaterangeTest'); -DaterangeTest.prototype.testInit = function() { - /*:DOC += -
    - */ - var dateRange = jQuery('#date-range').dateRange(); - assertEquals(true, dateRange.is(':mage-dateRange')); - dateRange.dateRange('destroy'); -}; -DaterangeTest.prototype.testInitDateRangeDatepickers = function() { - /*:DOC += -
    - - -
    - */ - var options = { - from: { - id: "from" - }, - to: { - id: "to" - } - }, - dateRange = $('#date-range').dateRange(options), - from = $('#'+options.from.id), - to = $('#'+options.to.id); - - assertEquals(true, from.hasClass('_has-datepicker')); - assertEquals(true, to.hasClass('_has-datepicker')); - dateRange.dateRange('destroy'); -}; -DaterangeTest.prototype.testDestroy = function() { - /*:DOC += -
    - - -
    - */ - var options = { - from: { - id: "from" - }, - to: { - id: "to" - } - }, - dateRange = $('#date-range').dateRange(options), - from = $('#'+options.from.id), - to = $('#'+options.to.id), - dateRangeExist = dateRange.is(':mage-dateRange'), - fromExist = from.hasClass('_has-datepicker'), - toExist = to.hasClass('_has-datepicker'); - - dateRange.dateRange('destroy'); - assertEquals(true, dateRangeExist != dateRange.is(':mage-dateRange')); - assertEquals(true, fromExist != from.hasClass('_has-datepicker')); - assertEquals(true, toExist != to.hasClass('_has-datepicker')); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/content.html b/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/content.html deleted file mode 100644 index e81938dfbeaba..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/content.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - -

    Test text

    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/index.html deleted file mode 100644 index ccfd4d97f0331..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Unit test - - - - - - - - - - - -
    -
    -
    - - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/test-collapsible.js b/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/test-collapsible.js deleted file mode 100644 index 1a22e5a79eb1d..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/collapsible/test-collapsible.js +++ /dev/null @@ -1,180 +0,0 @@ -/** - * @category mage.collapsible - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/* - Test if the collapsible widget gets initialized when is called and destroy function works - */ -test('initialization & destroy', function() { - expect(2); - var group = $('
    '); - group.collapsible(); - ok( group.is(':mage-collapsible'), "widget instantiated" ); - group.collapsible('destroy'); - ok( !group.is(':mage-collapsible'), "widget destroyed" ); -}); - -/* - Test enable, disable, activate, deactivate functions - */ -test('Enable, disable, activate, deactivate methods', function() { - expect(5); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.appendTo("body"); - group.collapsible(); - group.collapsible("deactivate"); - ok(content.is(':hidden'), "Content is collapsed"); - group.collapsible("activate"); - ok(content.is(':visible'), "Content is expanded"); - group.collapsible("disable"); - ok(content.is(':hidden'), "Content is collapsed"); - group.collapsible("activate"); - ok(content.is(':hidden'), "Content is collapsed"); - group.collapsible("enable"); - group.collapsible("activate"); - ok(content.is(':visible'), "Content is expanded"); - group.collapsible('destroy'); -}); - -/* - Test if the widget gets expanded/collapsed when the title is clicked - */ -test('Collapse and expand', function() { - expect(3); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.appendTo("body"); - group.collapsible(); - group.collapsible("deactivate"); - ok(content.is(':hidden'), "Content is collapsed"); - title.trigger("click"); - ok(content.is(':visible'), "Content gets expanded on click title"); - title.trigger("click"); - ok(content.is(':hidden'), "Content gets collapsed on click again"); - group.collapsible('destroy'); -}); - - -/* - Test state Classes - */ -test('State classes', function() { - expect(3); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.collapsible({openedState:"opened", closedState:"closed", disabledState:"disabled"}); - ok( group.hasClass("closed")); - title.trigger("click"); - ok( group.hasClass("opened")); - group.collapsible("disable"); - ok( group.hasClass("disabled")); - group.collapsible('destroy'); -}); - -/* - Test if icons are added to title when widget gets initialized and are removed when gets destroyed - */ -test('Create & destroy icons', function() { - expect(2); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.collapsible({icons: {header:"minus",activeHeader:"plus"}}); - ok(title.children("[data-role=icons]").length, "Icons added to title" ); - group.collapsible('destroy'); - ok(!title.children("[data-role=icons]").length, "Icons removed from title" ); -}); - -/* - Test if icon classes are changed when content gets expanded/collapsed - */ -test('Change icons when content gets expanded/collapsed', function() { - expect(2); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.collapsible({icons: {header:"minus",activeHeader:"plus"}}); - group.collapsible("deactivate"); - var icons = group.collapsible("option","icons"); - ok(title.children("[data-role=icons]").hasClass(icons.header), "When content is collapsed,header has the right class for icons" ); - title.trigger("click"); - ok(title.children("[data-role=icons]").hasClass(icons.activeHeader), "When content is expanded,header has the right class for icons" ); - group.collapsible('destroy'); -}); - - -/* - Test if content gets expanded/collapsed when certain keys are pressed - */ -asyncTest( "keyboard support", function() { - - expect( 5 ); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - title.appendTo(group); - content.appendTo(group); - group.appendTo("body"); - group.collapsible(); - group.collapsible("deactivate"); - - title.on("focus",function(ev){ - ok(content.is(':hidden'), "Content is collapsed"); - title.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.ENTER } )); - ok(content.is(':visible'), "Content is expanded"); - title.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.ENTER } )); - ok(content.is(':hidden'), "Content is collapsed"); - title.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.SPACE } )); - ok(content.is(':visible'), "Content is expanded"); - title.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.SPACE } )); - ok(content.is(':hidden'), "Content is collapsed"); - group.collapsible('destroy'); - start(); - } ); - - setTimeout(function(){ - title.focus(); - },10); - -}); - -/* - Test if content gets updated via Ajax when title is clicked - */ -test('Update content via ajax', function() { - expect(2); - var group = $('
    '); - var title = $('
    '); - var content = $('
    '); - var ajax = $(''); - title.appendTo(group); - content.appendTo(group); - ajax.appendTo(content); - group.appendTo("body"); - group.collapsible({ajaxContent : true}); - group.collapsible("deactivate"); - ok(!content.children("p").length, "Content has no data"); - title.trigger("click"); - ok(content.children("p"), "Content gets data from content.html"); - group.collapsible('destroy'); -}); - - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/decorate-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/decorate-test.js deleted file mode 100644 index 96bad35a17e2e..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/decorate-test.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -DecoratorTest = TestCase('DecoratorTest'); -DecoratorTest.prototype.testDecoratorList = function () { - /*:DOC +=
      -
    • item1
    • -
    • item2
    • -
    • item3
    • -
    • item4
    • -
    - */ - var list = $('#list'); - list.decorate('list'); - assertTrue($(list.find('li')[0]).hasClass('odd')); - assertFalse($(list.find('li')[0]).hasClass('even')); - assertTrue($(list.find('li')[1]).hasClass('even')); - assertFalse($(list.find('li')[1]).hasClass('odd')); - assertTrue($(list.find('li')[2]).hasClass('odd')); - assertFalse($(list.find('li')[2]).hasClass('even')); - assertTrue($(list.find('li')[3]).hasClass('even')); - assertFalse($(list.find('li')[3]).hasClass('odd')); - assertTrue($(list.find('li')[3]).hasClass('last')); -}; - -DecoratorTest.prototype.testDecoratorGeneral = function () { - /*:DOC +=
    -
    item1
    -
    item2
    -
    item3
    -
    item4
    -
    - */ - var itemClass = '.item'; - $(itemClass).decorate('generic'); - assertTrue($($(itemClass)[0]).hasClass('odd')); - assertFalse($($(itemClass)[0]).hasClass('even')); - assertTrue($($(itemClass)[0]).hasClass('first')); - assertFalse($($(itemClass)[0]).hasClass('last')); - - assertFalse($($(itemClass)[1]).hasClass('odd')); - assertTrue($($(itemClass)[1]).hasClass('even')); - assertFalse($($(itemClass)[1]).hasClass('first')); - assertFalse($($(itemClass)[1]).hasClass('last')); - - assertTrue($($(itemClass)[2]).hasClass('odd')); - assertFalse($($(itemClass)[2]).hasClass('even')); - assertFalse($($(itemClass)[2]).hasClass('first')); - assertFalse($($(itemClass)[2]).hasClass('last')); - - assertFalse($($(itemClass)[3]).hasClass('odd')); - assertTrue($($(itemClass)[3]).hasClass('even')); - assertFalse($($(itemClass)[3]).hasClass('first')); - assertTrue($($(itemClass)[3]).hasClass('last')); -}; - -DecoratorTest.prototype.testDecoratorTable = function (){ - /*:DOC += - - - - - - - - - - - - - - - - - - - - - - -
    MonthSavings
    Sum$180
    January$100
    February$80
    - */ - var tableId = '#foo'; - $(tableId).decorate('table'); - assertTrue($(tableId).find('thead tr').hasClass('first')); - assertTrue($(tableId).find('thead tr').hasClass('last')); - assertFalse($(tableId).find('thead tr').hasClass('odd')); - assertFalse($(tableId).find('thead tr').hasClass('even')); - - assertTrue($(tableId).find('tfoot tr').hasClass('first')); - assertTrue($(tableId).find('tfoot tr').hasClass('last')); - assertFalse($(tableId).find('tfoot tr').hasClass('odd')); - assertFalse($(tableId).find('tfoot tr').hasClass('even')); - - assertFalse($(tableId).find('tfoot tr td').last().hasClass('first')); - assertTrue($(tableId).find('tfoot tr td').last().hasClass('last')); - assertFalse($(tableId).find('tfoot tr td').last().hasClass('odd')); - assertFalse($(tableId).find('tfoot tr td').last().hasClass('even')); - - assertTrue($(tableId).find('tbody tr').first().hasClass('first')); - assertTrue($(tableId).find('tbody tr').first().hasClass('odd')); - assertFalse($(tableId).find('tbody tr').first().hasClass('last')); - assertFalse($(tableId).find('tbody tr').first().hasClass('even')); - assertFalse($(tableId).find('tbody tr').last().hasClass('first')); - assertFalse($(tableId).find('tbody tr').last().hasClass('odd')); - assertTrue($(tableId).find('tbody tr').last().hasClass('last')); - assertTrue($(tableId).find('tbody tr').last().hasClass('even')); - - assertFalse($(tableId).find('tbody tr td').last().hasClass('first')); - assertFalse($(tableId).find('tbody tr td').last().hasClass('odd')); - assertTrue($(tableId).find('tbody tr td').last().hasClass('last')); - assertFalse($(tableId).find('tbody tr td').last().hasClass('even')); -}; - -DecoratorTest.prototype.testDecoratorDataList = function () { - /*:DOC +=
    -
    item
    -
    item
    -
    item
    -
    item
    -
    - */ - var listId = '#data-list'; - $(listId).decorate('dataList'); - assertTrue($(listId).find('dt').first().hasClass('odd')); - assertFalse($(listId).find('dt').first().hasClass('even')); - assertFalse($(listId).find('dt').first().hasClass('last')); - - assertTrue($(listId).find('dt').last().hasClass('even')); - assertFalse($(listId).find('dt').last().hasClass('odd')); - assertTrue($(listId).find('dt').last().hasClass('last')); - - assertTrue($(listId).find('dd').first().hasClass('odd')); - assertFalse($(listId).find('dd').first().hasClass('even')); - assertFalse($(listId).find('dd').first().hasClass('last')); - - assertTrue($(listId).find('dd').last().hasClass('even')); - assertFalse($(listId).find('dd').last().hasClass('odd')); - assertTrue($(listId).find('dd').last().hasClass('last')); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/index.html deleted file mode 100644 index 3d6ed5a7c1d28..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Unit test - - - - - - - - - - - - -
    -
    -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/test-dropdown.js b/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/test-dropdown.js deleted file mode 100644 index e67c92b3d4018..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/dropdown/test-dropdown.js +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/* - testing if dialog opens when the triggerEvent is triggered - */ -test( "triggerEvent", function() { - expect(2); - var opener = $('
    '); - var dialog = $('
    '); - dialog.dropdownDialog({"triggerEvent":"click", "triggerTarget":opener}); - opener.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), true, "Dropdown opens when click opener"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"triggerEvent":null, "triggerTarget":opener}); - opener.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), false, "Dropdown doesn't open when click opener"); - dialog.dropdownDialog( "destroy" ); - -}); - -/* - testing if a specified class is added to the trigger - */ -test( "triggerClass", function() { - expect(2); - var opener = $('
    '); - var dialog = $('
    '); - dialog.dropdownDialog({"triggerTarget":opener,"triggerClass":"active"}); - dialog.dropdownDialog("open"); - ok( opener.hasClass("active"), "Class added to opener when dialog opens" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"triggerEvent":opener, "triggerClass":null}); - dialog.dropdownDialog("open"); - ok( !opener.hasClass("active"), "Class added to opener when dialog opens" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - -}); - -/* - testing if a specified class is added to the element which the dialog appends to - */ -test( "parentClass", function() { - expect(2); - var parent = $('
    '); - var dialog = $('
    '); - - dialog.dropdownDialog({"parentClass":"active","appendTo":parent}); - dialog.dropdownDialog("open"); - ok( parent.hasClass("active"), "Class is added to parent when dialog opens" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"parentClass":null,"appendTo":parent}); - dialog.dropdownDialog("open"); - ok( !parent.hasClass("active"), "No class is added to parent when dialog opens" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - -}); - -/* - testing if a specified class is added to the element that becomes dialog - */ -test( "dialogContentClass", function() { - expect(2); - var dialog = $('
    '); - - dialog.dropdownDialog({"dialogContentClass":"active"}); - dialog.dropdownDialog("open"); - ok( $('.ui-dialog-content').hasClass("active"), "Class is added to dialog content when dialog opens" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"dialogContentClass": null}); - dialog.dropdownDialog("open"); - ok( !$('.ui-dialog-content').hasClass("active"), "No class is added to dialog content" ); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if a specified class is added to dialog - */ -test( "defaultDialogClass", function() { - expect(3); - var dialog = $('
    '); - - dialog.dropdownDialog({"defaultDialogClass":"custom"}); - ok( $('.ui-dialog').hasClass("custom"), "Class is added to dialog" ); - ok( !$('.ui-dialog').hasClass("mage-dropdown-dialog"), "Default class has been overwritten" ); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({}); - ok( $('.ui-dialog').hasClass("mage-dropdown-dialog"), "Default class hasn't been overwritten" ); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if the specified trigger actually opens the dialog - */ -test( "triggerTarget", function() { - expect(2); - var opener = $('
    '); - var dialog = $('
    '); - - dialog.dropdownDialog({"triggerTarget":opener}); - opener.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), true, "Dropdown opens when click opener"); - dialog.dropdownDialog("close"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"triggerTarget":null}); - opener.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), false, "Dropdown doesn't open when click opener"); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if the dialog gets closed when clicking outside of it - */ -test( "closeOnClickOutside", function() { - expect(2); - var outside = $('
    ').attr({"id":"outside"}); - var dialog = $('
    ').attr({"id":"dialog"}); - outside.appendTo("#qunit-fixture"); - dialog.appendTo("#qunit-fixture"); - - dialog.dropdownDialog({"closeOnClickOutside":true}); - dialog.dropdownDialog("open"); - outside.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), false, "Dropdown closes when click outside dropdown"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"closeOnClickOutside":false}); - dialog.dropdownDialog("open"); - outside.trigger("click"); - equal(dialog.dropdownDialog("isOpen"), true, "Dropdown doesn't close when click outside dropdown"); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if the dialog gets closed when mouse leaves the dialog area - */ -asyncTest( "closeOnMouseLeave true", function() { - expect(1); - var outside = $('
    ').attr({"id":"outside"}); - var dialog = $('
    ').attr({"id":"dialog"}); - var opener = $('
    ').attr({"id":"opener"}); - outside.appendTo("#qunit-fixture"); - dialog.appendTo("#qunit-fixture"); - opener.appendTo("#qunit-fixture"); - - dialog.dropdownDialog({"closeOnMouseLeave":true}); - dialog.dropdownDialog("open"); - dialog.trigger("mouseenter"); - dialog.trigger("mouseleave"); - - setTimeout(function() { - equal(dialog.dropdownDialog("isOpen"), false, "Dropdown closes when mouseleave the dropdown area"); - dialog.dropdownDialog( "destroy" ); - start(); - }, 3000); - -}); - -/* - testing if the dialog gets closed when mouse leaves the dialog area - */ -asyncTest( "closeOnMouseLeave false", function() { - expect(1); - var outside = $('
    ').attr({"id":"outside"}); - var dialog = $('
    ').attr({"id":"dialog"}); - var opener = $('
    ').attr({"id":"opener"}); - outside.appendTo("#qunit-fixture"); - dialog.appendTo("#qunit-fixture"); - opener.appendTo("#qunit-fixture"); - - dialog.dropdownDialog({"closeOnMouseLeave":false}); - dialog.dropdownDialog("open"); - dialog.trigger("mouseenter"); - dialog.trigger("mouseleave"); - - setTimeout(function() { - equal(dialog.dropdownDialog("isOpen"), true, "Dropdown doesn't close when mouseleave the dropdown area"); - dialog.dropdownDialog( "destroy" ); - start(); - }, 3000); - -}); - -/* - testing if the dialog gets closed with the specified delay - */ -asyncTest( "timeout", function() { - expect(2); - var outside = $('
    ').attr({"id":"outside"}); - var dialog = $('
    ').attr({"id":"dialog"}); - var opener = $('
    ').attr({"id":"opener"}); - outside.appendTo("#qunit-fixture"); - dialog.appendTo("#qunit-fixture"); - opener.appendTo("#qunit-fixture"); - - dialog.dropdownDialog({"timeout":2000}); - dialog.dropdownDialog("open"); - dialog.trigger("mouseenter"); - dialog.trigger("mouseleave"); - equal(dialog.dropdownDialog("isOpen"), true, "Dropdown doesn't close when mouseleave the dropdown area"); - setTimeout(function() { - equal(dialog.dropdownDialog("isOpen"), false, "Dropdown closes when mouseleave the dropdown area, after timeout passed"); - dialog.dropdownDialog( "destroy" ); - start(); - }, 3000); - -}); - -/* - testing if the title bar is prevented from being created - */ -test( "createTitileBar", function() { - expect(2); - var dialog = $('
    '); - dialog.dropdownDialog({"createTitleBar":true}); - ok(($(".ui-dialog").find(".ui-dialog-titlebar").length > 0), "Title bar is created"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"createTitleBar":false}); - ok($(".ui-dialog").find(".ui-dialog-titlebar").length <= 0, "Title bar isn't created"); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if the position function gets disabled - */ -test( "autoPosition", function() { - expect(2); - var dialog = $('
    '); - dialog.dropdownDialog({"autoPosition":false}); - dialog.dropdownDialog("open"); - ok(($(".ui-dialog").css("top") === 'auto'), "_position function disabled"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"autoPosition":true}); - dialog.dropdownDialog("open"); - ok(($(".ui-dialog").css("top") !== '0px'), "_position function enabled"); - dialog.dropdownDialog( "destroy" ); -}); - -/* - testing if the size function gets disabled - */ -test( "autoSize", function() { - expect(2); - var dialog = $('
    '); - dialog.dropdownDialog({"autoSize":true, width:"300"}); - dialog.dropdownDialog("open"); - ok(($(".ui-dialog").css("width") === '300px'), "_size function enabled"); - dialog.dropdownDialog( "destroy" ); - - dialog.dropdownDialog({"autoSize":false, width:"300"}); - dialog.dropdownDialog("open"); - ok($(".ui-dialog").css("width") !== '300px', "_size function disabled"); - dialog.dropdownDialog( "destroy" ); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/form/form-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/form/form-test.js deleted file mode 100644 index 83bdefd399eaf..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/form/form-test.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -FormTest = TestCase('FormTest'); -FormTest.prototype.setUp = function() { - /*:DOC +=
    */ -}; -FormTest.prototype.tearDown = function() { - var formInstance = jQuery('#form').data('form'); - if(formInstance && formInstance.destroy) { - formInstance.destroy(); - } -}; -FormTest.prototype.testInit = function() { - var form = jQuery('#form').form(); - assertTrue(form.is(':mage-form')); -}; -FormTest.prototype.testRollback = function() { - var form = jQuery('#form').form(), - initialFormAttrs = { - action: form.prop('action'), - target: form.prop('target'), - method: form.prop('method') - }; - - form.data("form").oldAttributes = initialFormAttrs; - form.prop({ - action: 'new/action/url', - target: '_blank', - method: 'POST' - }); - - assertNotEquals(form.prop('action'), initialFormAttrs.action); - assertNotEquals(form.prop('target'), initialFormAttrs.target); - assertNotEquals(form.prop('method'), initialFormAttrs.method); - form.data("form")._rollback(); - assertEquals(form.prop('action'), initialFormAttrs.action); - assertEquals(form.prop('target'), initialFormAttrs.target); - assertEquals(form.prop('method'), initialFormAttrs.method); -}; -FormTest.prototype.testGetHandlers = function() { - var form = jQuery('#form').form(), - handlersData = form.form('option', 'handlersData'), - handlers = []; - $.each(handlersData, function(key) { - handlers.push(key); - }); - assertEquals(handlers.join(' '), form.data("form")._getHandlers().join(' ')); -}; -FormTest.prototype.testStoreAttribute = function() { - var form = jQuery('#form').form(), - initialFormAttrs = { - action: form.attr('action'), - target: form.attr('target'), - method: form.attr('method') - }; - form.data("form")._storeAttribute('action'); - form.data("form")._storeAttribute('target'); - form.data("form")._storeAttribute('method'); - - assertEquals(form.data("form").oldAttributes.action, initialFormAttrs.action); - assertEquals(form.data("form").oldAttributes.target, initialFormAttrs.target); - assertEquals(form.data("form").oldAttributes.method, initialFormAttrs.method); -}; -FormTest.prototype.testBind = function() { - var form = jQuery('#form').form(), - submitted = false, - handlersData = form.form('option', 'handlersData'); - - form.on('submit', function(e) { - submitted = true; - e.stopImmediatePropagation(); - e.preventDefault(); - }); - $.each(handlersData, function(key) { - form.trigger(key); - assertTrue(submitted); - submitted = false; - }); - form.off('submit'); -}; -FormTest.prototype.testGetActionUrl = function() { - var form = jQuery('#form').form(), - action = form.attr('action'), - testUrl = 'new/action/url', - testArgs = { - args: {arg: 'value'} - }; - - form.data("form")._storeAttribute('action'); - assertEquals(form.data("form")._getActionUrl(testArgs), action + '/arg/value/'); - assertEquals(form.data("form")._getActionUrl(testUrl), testUrl); - assertEquals(form.data("form")._getActionUrl(), action); -}; -FormTest.prototype.testProcessData = function() { - var form = jQuery('#form').form(), - initialFormAttrs = { - action: form.attr('action'), - target: form.attr('target'), - method: form.attr('method') - }, - testSimpleData = { - action: 'new/action/url', - target: '_blank', - method: 'POST' - }, - testActionArgsData = { - action: { - args: { - arg: 'value' - } - } - }; - var processedData = form.data("form")._processData(testSimpleData); - - assertEquals(form.data("form").oldAttributes.action, initialFormAttrs.action); - assertEquals(form.data("form").oldAttributes.target, initialFormAttrs.target); - assertEquals(form.data("form").oldAttributes.method, initialFormAttrs.method); - - assertEquals(processedData.action, testSimpleData.action); - assertEquals(processedData.target, testSimpleData.target); - assertEquals(processedData.method, testSimpleData.method); - - form.data("form")._rollback(); - - processedData = form.data("form")._processData(testActionArgsData); - form.data("form")._storeAttribute('action'); - var newActionUrl = form.data("form")._getActionUrl(testActionArgsData.action); - - assertEquals(processedData.action, newActionUrl); -}; -FormTest.prototype.testBeforeSubmit = function() { - /*:DOC +=
    */ - var testHandler = { - action: { - args: { - arg1: 'value1' - } - } - }, - form = jQuery('#form').form({handlersData: { - testHandler: testHandler - } - }), - beforeSubmitData = { - action: { - args: { - arg2: 'value2' - } - }, - target: '_blank' - }, - eventData = { - method: 'POST' - }, - resultData = $.extend( - true, - {}, - testHandler, - beforeSubmitData, - eventData - ); - form.data("form")._storeAttribute('action'); - - var testForm = jQuery('#test-form'); - resultData = form.data("form")._processData(resultData); - testForm.prop(resultData); - - form.on('beforeSubmit', function(e, data) { - jQuery.extend(data, beforeSubmitData); - }); - form.on('submit', function(e) { - e.stopImmediatePropagation(); - e.preventDefault(); - }); - form.data("form")._beforeSubmit('testHandler', eventData); - - assertEquals(testForm.prop('action'), form.prop('action')); - assertEquals(testForm.prop('target'), form.prop('target')); - assertEquals(testForm.prop('method'), form.prop('method')); -}; -FormTest.prototype.testSubmit = function() { - var form = jQuery('#form').form({ - handlersData: { - save: {} - } - }), - formSubmitted = false; - - form.data("form")._storeAttribute('action'); - form.data("form")._storeAttribute('target'); - form.data("form")._storeAttribute('method'); - form - .on('submit', function(e) { - e.preventDefault(); - e.stopImmediatePropagation(); - e.preventDefault(); - formSubmitted = true; - }) - .prop({ - action: 'new/action/url', - target: '_blank', - method: 'POST' - }); - - form.data("form")._submit({type: 'save'}); - - assertEquals(form.attr('action'), form.data("form").oldAttributes.action); - assertEquals(form.attr('target'), form.data("form").oldAttributes.target); - assertEquals(form.attr('method'), form.data("form").oldAttributes.method); - assertTrue(formSubmitted); - form.off('submit'); -}; -FormTest.prototype.testBuildURL = function() { - var dataProvider = [ - { - params: ['http://domain.com//', {'key[one]': 'value 1', 'key2': '# value'}], - expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/' - }, - { - params: ['http://domain.com', {'key[one]': 'value 1', 'key2': '# value'}], - expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/' - }, - { - params: ['http://domain.com?some=param', {'key[one]': 'value 1', 'key2': '# value'}], - expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value' - }, - { - params: ['http://domain.com?some=param&', {'key[one]': 'value 1', 'key2': '# value'}], - expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value' - } - ], - method = jQuery.mage.form._proto._buildURL, - quantity = dataProvider.length; - - expectAsserts(quantity); - for (var i = 0; i < quantity; i++) { - assertEquals(dataProvider[i].expected, method.apply(null, dataProvider[i].params)); - } -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/loader/jquery-loader-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/loader/jquery-loader-test.js deleted file mode 100644 index 174a4efc14da1..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/loader/jquery-loader-test.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TestCase('options', function() { - expect(3); - - var element = $('
    '); - element.appendTo('body'); - element.loader(); - element.loader('show'); - equal( element.find('p').text(), 'Please wait...', '.loader() text matches' ); - equal( element.find('img').prop('src').split('/').pop(), 'icon.gif', '.loader() icons match' ); - equal( element.find('img').prop('alt'), 'Loading...', '.loader() image alt text matches' ); - element.loader('destroy'); - -}); - -TestCase( 'element init', function() { - expect(1); - - var element = $('
    '); - element.appendTo('body'); - element.loader(); - element.loader('show'); - equal(element.is(':mage-loader'), true, '.loader() init on element'); - element.loader('destroy'); - -}); - -TestCase( 'body init', function() { - expect(1); - - //Initialize Loader on Body - var body = $('body').loader(); - body.loader('show'); - equal(body.is(':mage-loader'), true, '.loader() init on body'); - body.loader('destroy'); -}); - -TestCase( 'show/hide', function() { - expect(3); - - var element = $('
    '); - element.appendTo('body'); - element.loader(); - - //Loader show - element.loader('show'); - equal($('.loading-mask').is(':visible'), true, '.loader() open'); - - //Loader hide - element.loader('hide'); - equal($('.loading-mask').is( ":hidden" ), true, '.loader() closed' ); - - //Loader hide on process complete - element.loader('show'); - element.trigger('processStop'); - equal($('.loading-mask').is('visible'), false, '.loader() closed after process'); - - element.loader('destroy'); - -}); - -TestCase( 'destroy', function() { - expect(1); - - var element = $("#loader").loader(); - element.loader('show'); - element.loader('destroy'); - equal( $('.loading-mask').is(':visible'), false, '.loader() destroyed'); - -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js deleted file mode 100644 index 3dd08f57ab8b3..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -LoaderTest = TestCase('LoaderTest'); -LoaderTest.prototype.setUp = function() { - /*:DOC +=
    */ -}; -LoaderTest.prototype.tearDown = function() { - var loaderInstance = jQuery('#loader').data('loader'); - if(loaderInstance && loaderInstance.destroy) { - loaderInstance.destroy(); - } -}; -LoaderTest.prototype.getInstance = function() { - return jQuery('#loader').data('loader'); -}; -LoaderTest.prototype.testInit = function() { - var div = jQuery('#loader').loader(); - div.loader('show'); - assertEquals(true, div.is(':mage-loader')); -}; -// @TODO Need to be fixed to avoid errors on the bamboo server in context of MAGETWO-5085 ticket -/*LoaderTest.prototype._testCreateOnBeforeSend = function() { - /*:DOC +=
    */ -/* var loader = jQuery('#loader').trigger('ajaxSend'); - assertEquals(true, loader.is(':mage-loader')); - loader.loader('destroy'); -};*/ -LoaderTest.prototype.testLoaderOnBody = function() { - var body = jQuery('body').loader(); - body.loader('show'); - assertEquals(true, jQuery('body div:first').is('.loading-mask')); - body.loader('destroy'); -}; -LoaderTest.prototype.testLoaderOnDOMElement = function() { - var div = jQuery('#loader').loader(), - loaderInstance = this.getInstance(); - div.loader('show'); - assertEquals(true, div.find(':first-child').is(loaderInstance.spinner)); -}; -LoaderTest.prototype.testLoaderOptions = function() { - /*:DOC +=
    */ - var div = jQuery('#loader').loader({ - icon: 'icon.gif', - texts: { - loaderText: 'Loader Text', - imgAlt: 'Image Alt Text' - } - }), - loaderInstance = this.getInstance(); - div.loader('show'); - assertEquals('icon.gif', loaderInstance.spinner.find('img').attr('src')); - assertEquals('Image Alt Text', loaderInstance.spinner.find('img').attr('alt')); - assertEquals('Loader Text', loaderInstance.spinner.find('div.popup-inner').text()); - div.loader('destroy'); - div.loader({ - template:'
    ' - }); - div.loader('show'); - loaderInstance = this.getInstance(); - assertEquals(true, loaderInstance.spinner.is('#test-template')); - div.loader('destroy'); -}; -LoaderTest.prototype.testHideOnComplete = function() { - /*:DOC +=
    */ - var div = jQuery('#loader').loader(); - div.loader('show'); - loaderIsVisible = jQuery('.loading-mask').is(':visible'); - div.trigger('processStop'); - assertEquals(false, jQuery('.loading-mask').is(':visible') === loaderIsVisible); -}; -LoaderTest.prototype.testRender = function() { - /*:DOC +=
    */ - var div = jQuery('#loader').loader(); - div.loader('show'); - assertEquals(true, $('.loading-mask').is(':visible')); -}; -LoaderTest.prototype.testShowHide = function() { - /*:DOC +=
    */ - var div = jQuery('#loader').loader(); - div.loader('show'); - assertEquals(true, $('.loading-mask').is(':visible')); - div.loader('hide'); - assertEquals(false, $('.loading-mask').is(':visible')); -}; -LoaderTest.prototype.testDestroy = function() { - /*:DOC +=
    */ - var div = jQuery('#loader').loader(), - loaderExist = div.is(':mage-loader'); - div.loader('destroy'); - assertEquals(false, div.is(':mage-loader') === loaderExist); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html b/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html deleted file mode 100644 index 362dec7138276..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Unit test - - - - - - - - - - - -
    -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js b/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js deleted file mode 100644 index 0e1c4a3682b89..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @category mage.js - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - - /* - Set key logger to check key press event - */ - function KeyLogger( target ) { - if ( !(this instanceof KeyLogger) ) { - return new KeyLogger( target ); - } - this.target = target; - this.log = []; - - var self = this; - - this.target.off( 'keydown' ).on( 'keydown', function( event ) { - self.log.push( event.keyCode ); - }); -} -/* - testing if menu get expanded class when option set to true - */ -test( 'Menu Expanded', function() { - expect(1); - var menu = $('#menu'); - var menuItems = menu.find('li'); - var submenu = menuItems.find('ul'); - menu.menu({ - expanded: true - }); - ok(submenu.hasClass('expanded'), 'Expanded Class added'); -}); -/* - testing if down arrow is pressed - */ -test( 'Down Arrow', function() { - expect(1); - var event, - menu = $('#menu'), - keys = KeyLogger(menu); - event = $.Event('keydown'); - event.keyCode = $.ui.keyCode.DOWN; - menu.trigger( event ); - equal( keys.log[ 0 ], 40, 'Down Arrow Was Pressed' ); -}); -/* - testing if up arrow is pressed - */ -test( 'Up Arrow', function() { - expect(1); - var event, - menu = $('#menu'), - keys = KeyLogger(menu); - event = $.Event('keydown'); - event.keyCode = $.ui.keyCode.UP; - menu.trigger( event ); - equal( keys.log[ 0 ], 38, 'Up Arrow Was Pressed' ); -}); -/* - testing if left arrow is pressed - */ -test( 'Left Arrow', function() { - expect(1); - var event, - menu = $('#menu'), - keys = KeyLogger(menu); - event = $.Event('keydown'); - event.keyCode = $.ui.keyCode.LEFT; - menu.trigger( event ); - equal( keys.log[ 0 ], 37, 'Left Arrow Was Pressed' ); -}); -/* - testing if right arrow is pressed - */ -test( 'Right Arrow', function() { - expect(1); - var event, - menu = $('#menu'), - keys = KeyLogger(menu); - event = $.Event('keydown'); - event.keyCode = $.ui.keyCode.RIGHT; - menu.trigger( event ); - equal( keys.log[ 0 ], 39, 'Right Arrow Was Pressed' ); -}); -/* - testing if max limit being set - */ -test( 'Max Limit', function() { - expect(1); - var menu = $('#menu'); - menu.navigation({ - maxItems: 3 - }); - var menuItems = menu.find('> li:visible'); - equal(menuItems.length, 4, 'Max Limit Reach'); -}); -/* - testing if responsive menu is set - */ -test( 'Responsive: More Menu', function() { - expect(1); - var menu = $('#menu'); - menu.navigation({ - responsive: 'onResize' - }); - ok($('body').find('.ui-menu.more'), 'More Menu Created'); -}); - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js deleted file mode 100644 index 4b2b961f753ee..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js +++ /dev/null @@ -1,952 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -SuggestTest = TestCase('SuggestTest'); -SuggestTest.prototype.setUp = function() { - /*:DOC += */ - this.suggestElement = jQuery('#suggest'); -}; -SuggestTest.prototype.tearDown = function() { - this.suggestDestroy(); -}; -SuggestTest.prototype.suggestDestroy = function() { - if(this.suggestElement.data('suggest')) { - this.suggestElement.suggest('destroy'); - } -}; -SuggestTest.prototype.suggestCreate = function(options, element) { - return (element || this.suggestElement).suggest(options || {} ).data('suggest'); -}; -SuggestTest.prototype.uiHash = { - item: { - id: 1, - label: 'Test Label' - } -}; - -SuggestTest.prototype.testInit = function() { - this.suggestElement.suggest(); - assertTrue(this.suggestElement.is(':mage-suggest')); -}; -SuggestTest.prototype.testCreate = function() { - var suggestOptions = { - controls: { - selector: '.test', - eventsMap: { - focus: ['testfocus'], - blur: ['testblur'], - select: ['testselect'] - } - }, - showRecent: true, - storageKey: 'jsTestDriver-test-suggest-recent', - multiselect: true - }, - recentItems = [{ - id: "1", - "label": "TestLabel1" - }, - { - id: "2", - label: "TestLabel2" - }], - setTemplateExecuted, - prepareValueFieldExecuted, - renderExecuted, - bindExecuted; - - if(window.localStorage) { - localStorage.setItem(suggestOptions.storageKey, JSON.stringify(recentItems)); - } - - var suggestInstance = this.suggestCreate(suggestOptions), - nonSelectedItem = {id: '', label: ''}; - - assertEquals(null, suggestInstance._term); - assertEquals(suggestInstance._nonSelectedItem, nonSelectedItem); - assertNull(suggestInstance._renderedContext); - assertEquals(suggestInstance._selectedItem, nonSelectedItem); - var control = suggestInstance.options.controls; - assertEquals(suggestInstance._control, control); - assertEquals(suggestInstance._recentItems, window.localStorage ? recentItems : []); - assertTrue(suggestInstance.valueField.is(':hidden')); - if(window.localStorage) { - localStorage.removeItem(suggestOptions.storageKey); - } -}; -SuggestTest.prototype.testRender = function() { - var suggestOptions = { - dropdownWrapper: '
    ', - className: 'test-suggest', - inputWrapper: '
    ' - }; - - var suggestInstance = this.suggestCreate(suggestOptions); - suggestInstance._render(); - - assertTrue(suggestInstance.dropdown.hasClass('wrapper-test')); - assertTrue(suggestInstance.dropdown.is(':hidden')); - assertTrue(suggestInstance.element.closest('.test-input-wrapper').size() > 0); - assertTrue(suggestInstance.element.closest('.' + suggestOptions.className).size() > 0); - assertEquals(suggestInstance.element.attr('autocomplete'), 'off'); - - suggestOptions.appendMethod = 'before'; - this.suggestDestroy(); - suggestInstance = this.suggestCreate(suggestOptions); - suggestInstance._render(); - assertTrue(suggestInstance.element.prev().is(suggestInstance.dropdown)); - - suggestOptions.appendMethod = 'after'; - this.suggestDestroy(); - suggestInstance = this.suggestCreate(suggestOptions); - suggestInstance._render(); - assertTrue(suggestInstance.element.next().is(suggestInstance.dropdown)); -}; -SuggestTest.prototype.testCreateValueField = function() { - var suggestInstance = this.suggestCreate(), - valueField = suggestInstance._createValueField(); - assertTrue(valueField.is('input')); - assertTrue(valueField.is(':hidden')); - this.suggestDestroy(); - - suggestInstance = this.suggestCreate({multiselect: true}); - valueField = suggestInstance._createValueField(); - assertTrue(valueField.is('select')); - assertTrue(valueField.is(':hidden')); - assertEquals(valueField.attr('multiple'), 'multiple'); -}; -SuggestTest.prototype.testPrepareValueField = function() { - var suggestInstance = this.suggestCreate(), - suggestName = this.suggestElement.attr('name'); - suggestInstance._prepareValueField(); - - assertNotUndefined(suggestInstance.valueField); - assertTrue(suggestInstance.element.prev().is(suggestInstance.valueField)); - assertUndefined(suggestInstance.element.attr('name')); - assertEquals(suggestInstance.valueField.attr('name'), suggestName); - this.suggestDestroy(); - - - var valueField = jQuery(''); - jQuery('body').append(valueField); - suggestInstance = this.suggestCreate({valueField: '#suggest-single-select-value'}); - assertTrue(suggestInstance.valueField.is(valueField)); -}; -SuggestTest.prototype.testDestroy = function() { - var suggestOptions = { - inputWrapper: '
    ', - valueField: null - }, - suggestInstance = this.suggestCreate(suggestOptions), - suggestName = suggestInstance.valueField.attr('name'); - - assertNotUndefined(suggestInstance.dropdown); - assertNotUndefined(suggestInstance.valueField); - assertUndefined(this.suggestElement.attr('name')); - - this.suggestElement.suggest('destroy'); - - assertEquals(this.suggestElement.closest('.test-input-wrapper').length, 0); - assertUndefined(this.suggestElement.attr('autocomplete')); - assertEquals(this.suggestElement.attr('name'), suggestName); - assertFalse(suggestInstance.valueField.parents('html').length > 0); - assertFalse(suggestInstance.dropdown.parents('html').length > 0); -}; -SuggestTest.prototype.testValue = function() { - var value = 'test-value'; - this.suggestElement.val(value); - jQuery('body').append('
    ' + value + '
    '); - - var suggestInputInsatnce = this.suggestCreate(), - suggestDivInsatnce = this.suggestCreate(null, jQuery('#suggest-div')); - - assertEquals(suggestInputInsatnce._value(), value); - assertEquals(suggestDivInsatnce._value(), value); -}; -SuggestTest.prototype.testProxyEvents = function() { - var fakeEvent = $.extend({}, $.Event('keydown'), { - ctrlKey: false, - keyCode: $.ui.keyCode.ENTER, - which: $.ui.keyCode.ENTER - }), - suggestInstance = this.suggestCreate({controls: {selector: null}}), - ctrlKey, - keyCode, - which; - - suggestInstance.dropdown.on('keydown', function(e) { - ctrlKey = e.ctrlKey; - keyCode = e.keyCode; - which = e.which; - }); - - suggestInstance._proxyEvents(fakeEvent); - - assertEquals(ctrlKey, fakeEvent.ctrlKey); - assertEquals(keyCode, fakeEvent.keyCode); - assertEquals(which, fakeEvent.which); -}; -SuggestTest.prototype.testBind = function() { - var eventIsBinded = false, - suggestOptions = { - events: { - click: function() { - eventIsBinded = true; - } - } - }; - this.suggestCreate(suggestOptions); - - this.suggestElement.trigger('click'); - assertTrue(eventIsBinded); -}; -SuggestTest.prototype.testChange = function() { - var changeIsTriggered, - suggestInstance = this.suggestCreate(); - - suggestInstance._term = 'changed'; - this.suggestElement.on('suggestchange', function(e) { - changeIsTriggered = true; - }); - - suggestInstance._change($.Event('click')); - assertTrue(changeIsTriggered); -}; -SuggestTest.prototype.testBindDropdown = function() { - var suggestOptions = { - controls: { - eventsMap: { - focus: ['testFocus'], - blur: ['testBlur'], - select: ['testSelect'] - } - } - }, - suggestInstance = this.suggestCreate(suggestOptions), - focusTriggered, - blurTriggered, - selectTriggered; - - suggestInstance._onSelectItem = function() { - selectTriggered = true; - }; - suggestInstance._focusItem = function() { - focusTriggered = true; - }; - suggestInstance._blurItem = function() { - blurTriggered = true; - }; - suggestInstance._bindDropdown(); - - suggestInstance.dropdown.trigger('testFocus'); - suggestInstance.dropdown.trigger('testBlur'); - suggestInstance.dropdown.trigger('testSelect'); - - assertTrue(focusTriggered); - assertTrue(blurTriggered); - assertTrue(selectTriggered); -}; -SuggestTest.prototype.testTrigger = function() { - var propogationStopped = true, - suggestInstance = this.suggestCreate(); - - this.suggestElement - .on('suggesttestevent', function() { - return false; - }); - this.suggestElement.parent().on('suggesttestevent', function() { - propogationStopped = false; - }); - suggestInstance._trigger('testevent'); - - assertTrue(propogationStopped); -}; -SuggestTest.prototype.testFocusItem = function() { - var focusUiParam = false, - suggestInstance = this.suggestCreate(); - - this.suggestElement.on('suggestfocus', function(e, ui) { - focusUiParam = ui; - }); - - assertUndefined(suggestInstance._focused); - assertEquals(suggestInstance.element.val(), ''); - - suggestInstance._focusItem($.Event('focus'), this.uiHash); - assertEquals(suggestInstance._focused, this.uiHash.item); - assertEquals(focusUiParam, this.uiHash); - assertEquals(suggestInstance.element.val(), this.uiHash.item.label); -}; -SuggestTest.prototype.testBlurItem = function() { - var suggestInstance = this.suggestCreate(); - - suggestInstance._focusItem($.Event('focus'), this.uiHash); - assertEquals(suggestInstance._focused, this.uiHash.item); - assertEquals(suggestInstance.element.val(), this.uiHash.item.label); - - suggestInstance._blurItem(); - assertNull(suggestInstance._focused); - //assertEquals(suggestInstance.element.val(), suggestInstance._term.toString()); -}; -SuggestTest.prototype.testOnSelectItem = function() { - var item = this.uiHash.item, - beforeSelect, - beforeSelectUI, - beforeSelectPropagationStopped = true, - select, - selectUI, - selectPropagationStopped = true, - suggestInstance = this.suggestCreate(); - - suggestInstance._focused = item; - this.suggestElement - .on('suggestbeforeselect', function(e, ui) { - beforeSelect = true; - beforeSelectUI = ui; - }) - .on('suggestselect', function(e, ui) { - select = true; - selectUI = ui; - }) - .parent() - .on('suggestbeforeselect', function() { - beforeSelectPropagationStopped = false; - }) - .on('suggestselect', function() { - selectPropagationStopped = false; - }); - - suggestInstance._onSelectItem($.Event('select')); - - assertTrue(beforeSelect); - assertTrue(select); - assertFalse(beforeSelectPropagationStopped); - assertFalse(selectPropagationStopped); - assertEquals(beforeSelectUI.item, item); - assertEquals(selectUI.item, item); - - beforeSelect = select = beforeSelectUI = selectUI = null; - beforeSelectPropagationStopped = selectPropagationStopped = true; - - this.suggestElement - .on('suggestbeforeselect.returnfalse', function(e, ui) { - return false; - }); - - suggestInstance._focused = item; - suggestInstance._onSelectItem($.Event('select')); - assertTrue(beforeSelect); - assertNull(select); - assertTrue(beforeSelectPropagationStopped); - assertTrue(selectPropagationStopped); - assertEquals(beforeSelectUI.item, item); - assertNull(selectUI); - - beforeSelect = select = beforeSelectUI = selectUI = null; - beforeSelectPropagationStopped = selectPropagationStopped = true; - - this.suggestElement - .off('suggestbeforeselect.returnfalse') - .on('suggestselect.returnfalse', function() { - return false; - }); - - suggestInstance._focused = item; - suggestInstance._onSelectItem($.Event('select')); - assertTrue(beforeSelect); - assertTrue(select); - assertFalse(beforeSelectPropagationStopped); - assertTrue(selectPropagationStopped); - assertEquals(beforeSelectUI.item, item); - assertEquals(selectUI.item, item); - - beforeSelect = select = beforeSelectUI = selectUI = null; - beforeSelectPropagationStopped = selectPropagationStopped = true; - - this.suggestElement.off('suggestselect.returnfalse'); - var event = $.Event('select'); - event.target = this.suggestElement[0]; - - suggestInstance._onSelectItem(event, item); - assertEquals(suggestInstance._selectedItem, item); -}; -SuggestTest.prototype.testSelectItem = function() { - var suggestInstance = this.suggestCreate(); - - suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null; - suggestInstance.valueField.val(''); - - suggestInstance._selectItem($.Event('select')); - assertNull(suggestInstance._selectedItem); - assertNull(suggestInstance._term); - assertEquals(suggestInstance.valueField.val(), ''); - - suggestInstance._focused = this.uiHash.item; - - suggestInstance._selectItem($.Event('select')); - assertEquals(suggestInstance._selectedItem, suggestInstance._focused); - assertEquals(suggestInstance._term, suggestInstance._focused.label); - assertEquals(suggestInstance.valueField.val(), suggestInstance._focused.id); - assertTrue(suggestInstance.dropdown.is(':hidden')); - - this.suggestDestroy(); - - var suggestOptions; - if(window.localStorage) { - suggestOptions = { - showRecent: true, - storageKey: 'jsTestDriver-test-suggest-recent' - }; - suggestInstance = this.suggestCreate(suggestOptions); - suggestInstance._focused = this.uiHash.item; - - suggestInstance._selectItem($.Event('select')); - - var storedItem = localStorage.getItem(suggestOptions.storageKey); - assertEquals(storedItem, JSON.stringify([this.uiHash.item])); - localStorage.removeItem(suggestOptions.storageKey); - } -}; -SuggestTest.prototype.testSelectItemMultiselect = function() { - var suggestInstance = this.suggestCreate({multiselect: true}); - - suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null; - suggestInstance.valueField.val(''); - - suggestInstance._selectItem($.Event('select')); - assertNull(suggestInstance._selectedItem); - assertNull(suggestInstance._term); - assertFalse(suggestInstance.valueField.find('option').length > 0); - assertTrue(suggestInstance.dropdown.is(':hidden')); - - suggestInstance._focused = this.uiHash.item; - var selectedElement = jQuery('
    '); - var event = $.Event('select'); - event.target = selectedElement[0]; - - suggestInstance._selectItem(event); - assertEquals(suggestInstance._selectedItem, suggestInstance._focused); - assertEquals(suggestInstance._term, ''); - assertTrue(suggestInstance._getOption(suggestInstance._focused).length > 0); - assertTrue(selectedElement.hasClass(suggestInstance.options.selectedClass)); - assertTrue(suggestInstance.dropdown.is(':hidden')); - - suggestInstance._selectItem(event); - assertEquals(suggestInstance._selectedItem, suggestInstance._nonSelectedItem); - assertFalse(suggestInstance._getOption(suggestInstance._focused).length > 0); - assertFalse(selectedElement.hasClass(suggestInstance.options.selectedClass)); - assertTrue(suggestInstance.dropdown.is(':hidden')); -}; -SuggestTest.prototype.testResetSuggestValue = function() { - var suggestInstance = this.suggestCreate(); - suggestInstance.valueField.val('test'); - suggestInstance._resetSuggestValue(); - assertEquals(suggestInstance.valueField.val(), suggestInstance._nonSelectedItem.id); -}; -SuggestTest.prototype.testResetSuggestValueMultiselect = function() { - var suggestInstance = this.suggestCreate({multiselect: true}); - suggestInstance._focused = this.uiHash.item; - var selectedElement = jQuery('
    '); - var event = $.Event('select'); - event.target = selectedElement[0]; - - suggestInstance._selectItem(event); - suggestInstance._resetSuggestValue(); - - var suggestValue = suggestInstance.valueField.val(); - assertArray(suggestValue); - assertNotUndefined(suggestValue[0]); - assertEquals(suggestValue[0], this.uiHash.item.id); -}; -SuggestTest.prototype.testReadItemData = function() { - var testElement = jQuery('
    '), - suggestInstance = this.suggestCreate(); - assertEquals(suggestInstance._readItemData(testElement), suggestInstance._nonSelectedItem); - testElement.data('suggestOption', 'test'); - assertEquals(suggestInstance._readItemData(testElement), 'test'); -}; -SuggestTest.prototype.testIsDropdownShown = function() { - var suggestInstance = this.suggestCreate(); - suggestInstance.dropdown.hide(); - assertFalse(suggestInstance.isDropdownShown()); - suggestInstance.dropdown.show(); - assertTrue(suggestInstance.isDropdownShown()); -}; -SuggestTest.prototype.testOpen = function() { - var openTriggered = false, - suggestInstance = this.suggestCreate(); - - this.suggestElement.on('suggestopen', function() { - openTriggered = true; - }); - - suggestInstance.dropdown.show(); - suggestInstance.open($.Event('open')); - assertFalse(openTriggered); - - suggestInstance.dropdown.hide(); - suggestInstance.open($.Event('open')); - assertTrue(openTriggered); - assertTrue(suggestInstance.dropdown.is(':visible')); -}; -SuggestTest.prototype.testClose = function() { - var closeTriggered = false, - suggestInstance = this.suggestCreate(); - - suggestInstance.element.val('test'); - suggestInstance._renderedContext = 'test'; - suggestInstance.dropdown.show().append('
    '); - - this.suggestElement.on('suggestclose', function() { - closeTriggered = true; - }); - - suggestInstance.close($.Event('close')); - assertNull(suggestInstance._renderedContext); - assertTrue(suggestInstance.dropdown.is(':hidden')); - assertFalse(suggestInstance.dropdown.children().length > 0); - assertTrue(closeTriggered); -}; -SuggestTest.prototype.testSetTemplate = function() { - /*:DOC += */ - var suggestInstance = this.suggestCreate({template: '
    <%= data.test %>
    '}), - tmpl, - html; - - tmpl = suggestInstance.templates[suggestInstance.templateName] - - html = jQuery('
    ').append(tmpl({ - data: { - test: 'test' - } - })).html(); - - assertEquals(html, '
    test
    '); - - suggestInstance = this.suggestCreate({ - template: '#test-template' - }); - - tmpl = suggestInstance.templates[suggestInstance.templateName]; - - html = jQuery('
    ').append(tmpl({ - data: { - test: 'test' - } - })).html(); - - assertEquals(html, '
    test
    '); -}; -SuggestTest.prototype.testSearch = function() { - var searchTriggered = false, - seachPropagationStopped = true, - suggestInstance = this.suggestCreate(); - - this.suggestElement - .on('suggestsearch', function() { - searchTriggered = true; - }) - .parent() - .on('suggestsearch', function() { - seachPropagationStopped = false; - }); - - suggestInstance._term = suggestInstance._value(); - suggestInstance._selectedItem = null; - - suggestInstance.preventBlur = true; - suggestInstance.search($.Event('search')); - - assertNull(suggestInstance._selectedItem); - assertFalse(searchTriggered); - suggestInstance.preventBlur = false; - - this.suggestElement.val('test'); - suggestInstance.search($.Event('search')); - - assertEquals(suggestInstance._term, suggestInstance._value()); - assertTrue(searchTriggered); - assertFalse(seachPropagationStopped); - - searchTriggered = false; - seachPropagationStopped = true; - suggestInstance._selectedItem = null; - suggestInstance.options.minLength = 10; - this.suggestElement.val('testtest'); - - suggestInstance.search($.Event('search')); - - assertEquals(suggestInstance._selectedItem, suggestInstance._nonSelectedItem); - assertEquals(suggestInstance.valueField.val(), suggestInstance._selectedItem.id); - assertFalse(searchTriggered); - - searchTriggered = false; - seachPropagationStopped = true; - suggestInstance._selectedItem = null; - suggestInstance.options.minLength = 1; - this.suggestElement.val('test'); - - this.suggestElement - .on('suggestsearch.returnfalse', function() { - return false; - }); - - suggestInstance.search($.Event('search')); - - assertEquals(suggestInstance._term, suggestInstance._value()); - assertTrue(searchTriggered); - assertTrue(seachPropagationStopped); -}; -SuggestTest.prototype.testUderscoreSearch = function() { - var sourceLaunched = false, - sorceTerm = null, - responceExists = false, - suggestOptions = { - source: function(term, response){ - sourceLaunched = true; - sorceTerm = term; - responceExists = (response && jQuery.type(response) === 'function'); - }, - delay: null - }, - suggestInstance = this.suggestCreate(suggestOptions); - - suggestInstance._search($.Event('search'), 'test', {}); - assertTrue(sourceLaunched); - assertEquals(sorceTerm, 'test'); - assertTrue(responceExists); - assertTrue(this.suggestElement.hasClass(suggestInstance.options.loadingClass)); - assertUndefined(suggestInstance._searchTimeout); - - suggestInstance.options.delay = 100; - suggestInstance._search($.Event('search'), 'test', {}); - assertNotUndefined(suggestInstance._searchTimeout); -}; -SuggestTest.prototype.testPrepareDropdownContext = function() { - var suggestInstance = this.suggestCreate(); - - suggestInstance._items = [this.uiHash.item]; - suggestInstance._term = 'test'; - suggestInstance._selectedItem = this.uiHash.item; - - var context = suggestInstance._prepareDropdownContext({}); - - assertEquals(context.items, suggestInstance._items); - assertEquals(context.term, suggestInstance._term); - assertEquals(context.optionData(this.uiHash.item), - 'data-suggest-option="' + JSON.stringify(this.uiHash.item).replace(/"/g, '"') + '"'); - assertTrue(context.itemSelected(this.uiHash.item)); - assertNotUndefined(context.noRecordsText); - assertFalse(context.recentShown()); - assertNotUndefined(context.recentTitle); - assertNotUndefined(context.showAllTitle); - assertFalse(context.allShown()); -}; -SuggestTest.prototype.testIsItemSelected = function() { - var suggestInstance = this.suggestCreate(); - assertFalse(suggestInstance._isItemSelected(this.uiHash.item)); - suggestInstance._selectedItem = this.uiHash.item; - assertTrue(suggestInstance._isItemSelected(this.uiHash.item)); - this.suggestDestroy(); - - suggestInstance = this.suggestCreate({multiselect: true}); - assertFalse(suggestInstance._isItemSelected(this.uiHash.item)); - suggestInstance.valueField.append(''); - assertTrue(suggestInstance._isItemSelected(this.uiHash.item)); -}; -SuggestTest.prototype.testRenderDropdown = function() { - var testContext = { - test: 'test' - }, - contentUpdatedTriggered = false, - suggestOptions = { - template: '
    <%= data.test %>
    ' - }, - suggestInstance = this.suggestCreate(suggestOptions); - - suggestInstance.dropdown.on('contentUpdated', function() { - contentUpdatedTriggered = true; - }); - suggestInstance.element.addClass(suggestInstance.options.loadingClass); - - suggestInstance._renderDropdown(null, [this.uiHash.item], testContext); - - assertEquals(suggestInstance._items, [this.uiHash.item]); - assertEquals(suggestInstance.dropdown.html(), '
    test
    '); - assertTrue(contentUpdatedTriggered); - assertEquals(suggestInstance._renderedContext, suggestInstance._prepareDropdownContext(testContext)); - assertFalse(suggestInstance.element.hasClass(suggestInstance.options.loadingClass)); - assertTrue(suggestInstance.dropdown.is(':visible')); -}; -SuggestTest.prototype.testProcessResponse = function() { - var testContext = { - test: 'test' - }, - responseTriggered = false, - suggestOptions = { - template: '
    <%= data.test %>
    ' - }, - responcePropagationStopped = true, - rendererExists, - responseData, - suggestInstance = this.suggestCreate(suggestOptions); - - this.suggestElement - .on('suggestresponse', function(e, data, renderer) { - responseTriggered = true; - rendererExists = (renderer && jQuery.type(renderer) === 'function'); - responseData = data; - }) - .parent() - .on('suggestresponse', function() { - responcePropagationStopped = false; - }); - suggestInstance._processResponse($.Event('response'), [this.uiHash.item], testContext); - - assertTrue(responseTriggered); - assertTrue(rendererExists); - assertEquals(responseData, [this.uiHash.item]); - assertFalse(responcePropagationStopped); - assertEquals(suggestInstance.dropdown.html(), '
    test
    '); - - suggestInstance.dropdown.empty(); - this.suggestElement - .on('suggestresponse.returnfalse', function() { - return false; - }); - responcePropagationStopped = true; - - suggestInstance._processResponse($.Event('response'), [this.uiHash.item], testContext); - - assertTrue(responcePropagationStopped); - assertFalse(suggestInstance.dropdown.children().tength > 0); -}; -SuggestTest.prototype.testSource = function() { - var sourceArray = [this.uiHash.item], - sourceUrl = 'www.test.url', - sourceFuncExecuted = false, - responseExecuted = false, - responseItems = null, - sourceFuncTerm = "", - sourceFuncResponse = null, - ajaxData = '', - ajaxUrl = '', - sourceFunc = function(term, response) { - sourceFuncExecuted = true; - sourceFuncTerm = term; - sourceFuncResponse = (response && jQuery.type(response) === 'function'); - }, - response = function (items) { - responseExecuted = true; - responseItems = items; - }; - - var suggestInstance = this.suggestCreate({ - source: sourceArray - }); - - suggestInstance._source('test', response); - - assertTrue(responseExecuted); - assertEquals(responseItems, sourceArray); - this.suggestDestroy(); - - responseExecuted = false; - responseItems = null; - - suggestInstance = this.suggestCreate({ - source: sourceUrl, - ajaxOptions: { - beforeSend: function(xhr, settings) { - xhr.abort(); - ajaxData = settings.data; - ajaxUrl = settings.url; - settings.success(sourceArray); - } - }, - termAjaxArgument: 'test' - }); - suggestInstance._source('test', response); - - assertTrue(responseExecuted); - assertEquals(responseItems, sourceArray); - assertEquals(ajaxData, 'test=test'); - assertEquals(ajaxUrl, sourceUrl); - this.suggestDestroy(); - - responseExecuted = false; - responseItems = null; - - suggestInstance = this.suggestCreate({ - source: sourceFunc - }); - suggestInstance._source('test', response); - - assertTrue(sourceFuncExecuted); - assertEquals(sourceFuncTerm, 'test'); - assertTrue(sourceFuncResponse); -}; -SuggestTest.prototype.testAbortSearch = function() { - var searchAborted = false, - suggestInstance = this.suggestCreate(); - - this.suggestElement.addClass(suggestInstance.options.loadingClass); - suggestInstance._xhr = { - abort: function() { - searchAborted = true; - } - }; - - suggestInstance._abortSearch(); - - assertFalse(this.suggestElement.hasClass(suggestInstance.options.loadingClass)); - assertTrue(searchAborted); -}; -SuggestTest.prototype.testShowAll = function() { - var searchAborted, - showAllTerm, - showAllContext, - suggestInstance = this.suggestCreate(); - suggestInstance._abortSearch = function() { - searchAborted = true; - }; - suggestInstance._search = function(e, term, context) { - showAllTerm = term; - showAllContext = context; - }; - - suggestInstance._showAll(jQuery.Event('showAll')); - - assertTrue(searchAborted); - assertEquals(showAllTerm, ''); - assertEquals(showAllContext, {_allShown: true}); -}; -SuggestTest.prototype.testAddRecent = function() { - var recentItems = [ - {id: 2, label: 'Test Label 2'}, - {id: 3, label: 'Test Label 3'} - ], - suggestInstance = this.suggestCreate(); - - suggestInstance._recentItems = recentItems; - suggestInstance.options.storageKey = 'jsTestDriver-test-suggest-recent'; - suggestInstance._addRecent(this.uiHash.item); - - recentItems.unshift(this.uiHash.item); - assertEquals(recentItems, suggestInstance._recentItems); - if(window.localStorage) { - assertEquals(localStorage.getItem(suggestInstance.options.storageKey), JSON.stringify(recentItems)); - } - - suggestInstance._addRecent(this.uiHash.item); - assertEquals(recentItems, suggestInstance._recentItems); - if(window.localStorage) { - assertEquals(localStorage.getItem(suggestInstance.options.storageKey), JSON.stringify(recentItems)); - } - - suggestInstance.options.storageLimit = 1; - var newRecentItem = {id: 4, label: 'Test Label 4'}; - suggestInstance._addRecent(newRecentItem); - - assertEquals([newRecentItem], suggestInstance._recentItems); - if(window.localStorage) { - assertEquals(localStorage.getItem(suggestInstance.options.storageKey), JSON.stringify([newRecentItem])); - localStorage.removeItem(suggestInstance.options.storageKey); - } -}; -SuggestTest.prototype.testRenderMultiselect = function() { - var suggestOptions = { - multiselect: true, - multiSuggestWrapper: '
    ' - }, - suggestInstance = this.suggestCreate(suggestOptions); - - assertTrue(this.suggestElement.closest('[data-role="parent-choice-element"]').is('#test-multisuggest-wrapper')); - assertTrue(suggestInstance.elementWrapper.is('#test-multisuggest-wrapper')); -}; -SuggestTest.prototype.testGetOptions = function() { - var suggestInstance = this.suggestCreate(); - - assertFalse(suggestInstance._getOptions().length > 0); - - var option = jQuery(''); - suggestInstance.valueField.append(option); - assertTrue(suggestInstance._getOptions().is(option)); -}; -SuggestTest.prototype.testFilterSelected = function() { - var items = [this.uiHash.item, {id: 2, label: 'Test Label2'}], - suggestInstance = this.suggestCreate(); - - suggestInstance.valueField.append(''); - assertEquals(suggestInstance._filterSelected(items), [this.uiHash.item]); -}; -SuggestTest.prototype.testCreateOption = function() { - var suggestInstance = this.suggestCreate(); - - var option = suggestInstance._createOption(this.uiHash.item); - assertEquals(option.val(), "1"); - assertEquals(option.prop('selected'), true); - assertEquals(option.text(), "Test Label"); - assertNotUndefined(option.data('renderedOption')); -}; -SuggestTest.prototype.testAddOption = function() { - var selectTarget = jQuery('
    '), - event = jQuery.Event('add'), - suggestInstance = this.suggestCreate(); - - event.target = selectTarget[0]; - suggestInstance._addOption(event, this.uiHash.item); - - var option = suggestInstance.valueField.find('option[value=' + this.uiHash.item.id + ']'); - assertTrue(option.length > 0); - assertTrue(option.data('selectTarget').is(selectTarget)); -}; -SuggestTest.prototype.testGetOption = function() { - var suggestInstance = this.suggestCreate(); - - assertFalse(suggestInstance._getOption(this.uiHash.item).length > 0); - - var option = jQuery(''); - suggestInstance.valueField.append(option); - assertTrue(suggestInstance._getOption(this.uiHash.item).length > 0); - assertTrue(suggestInstance._getOption(option).length > 0); -}; -SuggestTest.prototype.testRemoveLastAdded = function() { - var suggestInstance = this.suggestCreate({multiselect: true}); - - suggestInstance._addOption({}, this.uiHash.item); - assertTrue(suggestInstance.valueField.find('option').length > 0); - suggestInstance._removeLastAdded(); - assertFalse(suggestInstance.valueField.find('option').length > 0); -}; -SuggestTest.prototype.testRemoveOption = function() { - var selectTarget = jQuery('
    '), - event = jQuery.Event('select'), - suggestInstance = this.suggestCreate({multiselect: true}); - - selectTarget.addClass(suggestInstance.options.selectedClass); - event.target = selectTarget[0]; - - suggestInstance._addOption(event, this.uiHash.item); - assertTrue(suggestInstance.valueField.find('option').length > 0); - suggestInstance.removeOption(event, this.uiHash.item); - assertFalse(suggestInstance.valueField.find('option').length > 0); - assertFalse(selectTarget.hasClass(suggestInstance.options.selectedClass)); -}; -SuggestTest.prototype.testRenderOption = function() { - var suggestInstance = this.suggestCreate(), - choiceTmpl; - - suggestInstance.elementWrapper = jQuery('
    ').appendTo('body'); - - choiceTmpl = mageTemplate(suggestInstance.options.choiceTemplate, { - text: this.uiHash.item.label - }); - - var testOption = jQuery(choiceTmpl), - option = suggestInstance._renderOption(this.uiHash.item); - - assertTrue(option.next().is(suggestInstance.elementWrapper)); - assertEquals(jQuery('
    ').append(testOption).html(), jQuery('
    ').append(option).html()); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js deleted file mode 100644 index 2a63c6953ef87..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -TreeSuggestTest = TestCase('TreeSuggestTest'); -TreeSuggestTest.prototype.setUp = function() { - /*:DOC += */ - this.suggestElement = jQuery('#tree-suggest'); -}; -TreeSuggestTest.prototype.tearDown = function() { - this.treeSuggestDestroy(); -}; -TreeSuggestTest.prototype.treeSuggestDestroy = function() { - if(this.suggestElement.data('treeSuggest')) { - this.suggestElement.treeSuggest('destroy'); - } -}; -TreeSuggestTest.prototype.treeSuggestCreate = function(options, element) { - return (element || this.suggestElement).treeSuggest(options || {} ).data('treeSuggest'); -}; -TreeSuggestTest.prototype.uiHash = { - item: { - id: 1, - label: 'Test Label' - } -}; -TreeSuggestTest.prototype.stub = function(instance, methodName, retVal) { - var d = $.Deferred(); - if(instance && instance[methodName]) { - instance[methodName] = function() { - d.resolve(arguments); - if(retVal) { - return retVal; - } - }; - } - return d.promise(); -}; - -TreeSuggestTest.prototype.testInit = function() { - var treeSuggestInstance = this.treeSuggestCreate(); - assertTrue(this.suggestElement.is(':mage-treeSuggest')); - assertEquals(treeSuggestInstance.widgetEventPrefix, 'suggest'); -}; - -TreeSuggestTest.prototype.testClose = function() { - var treeSuggestInstance = this.treeSuggestCreate(), - elementFocused = false; - treeSuggestInstance.element.on('focus', function() { - elementFocused = true; - }); - treeSuggestInstance.dropdown.text('test').show(); - treeSuggestInstance.close(); - assertEquals(treeSuggestInstance.dropdown.text(), ''); - assertTrue(treeSuggestInstance.dropdown.is(':hidden')); - - treeSuggestInstance.dropdown.text('test').show(); - treeSuggestInstance.close(jQuery.Event('select')); - assertEquals(treeSuggestInstance.dropdown.text(), ''); - assertTrue(treeSuggestInstance.dropdown.is(':hidden')); - - treeSuggestInstance.dropdown.text('test').show(); - treeSuggestInstance.close(jQuery.Event('select_tree_node')); - assertEquals(treeSuggestInstance.dropdown.text(), 'test'); - assertTrue(treeSuggestInstance.dropdown.is(':visible')); -}; -TreeSuggestTest.prototype.testFilterSelected = function() { - var treeSuggestInstance = this.treeSuggestCreate(); - assertEquals(treeSuggestInstance._filterSelected([this.uiHash.item], {_allShown: true}), [this.uiHash.item]); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html deleted file mode 100644 index 30c29e38cc102..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Tabs Widget: QUnit Tests - - - - - - - - - - - -
    -
    -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js deleted file mode 100644 index 7129357159f9f..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TabsTest = TestCase('TabsTest'); -TabsTest.prototype.testInit = function() { - /*:DOC +=
    */ - var tabs = jQuery('#tabs').tabs(); - assertTrue(tabs.is(':mage-tabs')); -}; - -TabsTest.prototype.testCreate = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    • - -
      -
    • -
    */ - var tabs = jQuery('#tabs').tabs({active: 'tab2'}); - assertEquals(tabs.tabs('option', 'active'), tabs.data("tabs").anchors.index(jQuery('#tab2'))); -}; - -TabsTest.prototype.testActiveAnchor = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    • - -
      -
    • -
    */ - var tabs = jQuery('#tabs').tabs({active: 'tab2'}); - assertTrue(tabs.tabs('activeAnchor').is(tabs.data("tabs").anchors.eq(tabs.tabs('option', 'active')))); -}; - -TabsTest.prototype.testGetTabIndex = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    • - -
      -
    • -
    */ - var tabs = jQuery('#tabs').tabs(); - assertEquals(0, tabs.data("tabs")._getTabIndex('tab1')); - assertEquals(1, tabs.data("tabs")._getTabIndex('tab2')); -}; - -TabsTest.prototype.testGetPanelForTab = function() { - /*:DOC +=
      -
    • - -
    • -
    -
    -
    -
    */ - var tabs = jQuery('#tabs').tabs({destination: '#destination'}); - assertTrue(jQuery(tabs.data("tabs")._getPanelForTab(jQuery('#tab1').closest('li'))).is('#tab1_content')); -}; - -TabsTest.prototype.testMovePanelsInDestination = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    -
    -
    */ - var tabs = jQuery('#tabs').tabs({destination: '#destination'}); - var panel = jQuery('#tab1_content'); - tabs.append(panel); - assertTrue(panel.parents('#tabs').length > 0); - assertEquals(panel.parents(tabs.tabs('option', 'destination')).length, 0); - - tabs.data("tabs")._movePanelsInDestination(panel); - assertEquals(panel.parents('#tabs').length, 0); - assertTrue(panel.parents(tabs.tabs('option', 'destination')).length > 0); - - tabs.tabs('option', 'destination', null); - tabs.append(panel); - assertTrue(panel.parents('#tabs').length > 0); - - tabs.data("tabs")._movePanelsInDestination(panel); - assertTrue(panel.parents('#tabs').length > 0); -}; - -TabsTest.prototype.testAjaxLoad = function() { - /*:DOC +=
    - */ - var tabs = jQuery('#tabs').tabs(), - ui = { - tab: jQuery('#tab1'), - panel: jQuery('#tab1_content') - }; - tabs.tabs('option', 'load')({}, ui); - assertEquals(jQuery('#tab1').attr('href'), '#tab1_content'); -}; - -TabsTest.prototype.testOnContentChange = function() { - /*:DOC +=
    - */ - var eventMock = { - data: { - index: 0 - } - }, - tabs = jQuery('#tabs').tabs(); - - tabs.data("tabs")._onContentChange(eventMock); - assertTrue(jQuery('#tab1').hasClass('_changed')); -}; - -TabsTest.prototype.testOnFocus = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    • - -
      -
    • -
    - */ - var eventMock = { - data: { - index: 1 - } - }, - tabs = jQuery('#tabs').tabs(); - - assertNotEquals(tabs.tabs('option', '_active'), eventMock.data.index); - - tabs.data("tabs")._onFocus(eventMock); - assertEquals(tabs.tabs('option', '_active'), eventMock.data.index); -}; - -TabsTest.prototype.testOnBeforeSubmit = function() { - /*:DOC +=
      -
    • - -
      -
    • -
    - */ - var tabs = jQuery('#tabs').tabs({active: 'tab1'}), - data= {}, - testData = { - action: { - args: { - tab: 'tab1' - } - } - }, - testDataTabArgument = { - action: { - args: { - testtab: 'tab1' - } - } - }, - tabPrefix = 'test-', - tabIdArgument = 'testtab'; - - tabs.data("tabs")._onBeforeSubmit({}, data); - assertEquals(data, testData); - data = {}; - - jQuery('#tab1').prop('id', 'test-tab1'); - tabs.tabs('option', 'tabsBlockPrefix', tabPrefix); - tabs.data("tabs")._onBeforeSubmit({}, data); - assertEquals(data, testData); - tabs.tabs('option', 'tabsBlockPrefix', null); - jQuery('#test-tab1').prop('id', 'tab1'); - data = {}; - - tabs.tabs('option', 'tabIdArgument', tabIdArgument); - tabs.data("tabs")._onBeforeSubmit({}, data); - assertEquals(data, testDataTabArgument); -}; - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js deleted file mode 100644 index 582c55da344d3..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @category mage.js - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/* - - */ -test( "Initialization", function() { - expect(2); - var tabs = $("
    "); - tabs.tabs(); - ok( tabs.is(':mage-tabs'), "widget instantiated" ); - tabs.tabs('destroy'); - ok( !tabs.is(':mage-tabs'), "widget destroyed" ); -}); - -test( "Collapsible instantiation", function() { - expect(2); - var tabs = $("
    "); - var title = $("
    ").attr("data-role","collapsible"); - title.appendTo(tabs); - tabs.tabs(); - ok( title.is(':mage-collapsible'), "widget instantiated" ); - tabs.tabs('destroy'); - ok( !title.is(':mage-collapsible'), "widget destroyed" ); -}); - -test( "Tabs behavior - closing others tabs when one gets activated", function() { - expect(4); - var tabs = $('
    '); - var title1 = $('
    ').appendTo(tabs); - var content1 = $('
    ').appendTo(tabs); - var title2 = $('
    ').appendTo(tabs); - var content2 = $('
    ').appendTo(tabs); - tabs.appendTo("body"); - tabs.tabs(); - ok( content1.is(':visible'), "content visible" ); - ok( content2.is(':hidden'), "content hidden" ); - title2.trigger('click'); - ok( content1.is(':hidden'), "content hidden" ); - ok( content2.is(':visible'), "content visible" ); - tabs.tabs('destroy'); -}); - -test( "Testing enable,disable,activate,deactivate options", function() { - expect(6); - var tabs = $('
    '); - var title = $('
    ').appendTo(tabs); - var content = $('
    ').appendTo(tabs); - tabs.appendTo("body"); - tabs.tabs(); - ok( content.is(':visible'), "content visible" ); - tabs.tabs("deactivate",0); - ok( content.is(':hidden'), "content hidden" ); - tabs.tabs("activate",0); - ok( content.is(':visible'), "content visible" ); - tabs.tabs("disable",0); - ok( content.is(':hidden'), "content hidden" ); - title.trigger("click"); - ok( content.is(':hidden'), "content hidden" ); - tabs.tabs("enable",0); - title.trigger("click"); - ok( content.is(':visible'), "content visible" ); - tabs.tabs('destroy'); -}); - -asyncTest( "Keyboard support for tabs view", function() { - - expect( 5 ); - var tabs = $('
    '); - var title1 = $('
    ').appendTo(tabs); - var content1 = $('
    ').appendTo(tabs); - var title2 = $('
    ').appendTo(tabs); - var content2 = $('
    ').appendTo(tabs); - tabs.appendTo("body"); - tabs.tabs(); - - title1.on("focus",function(ev){ - ok(content1.is(':visible'), "Content is expanded"); - title1.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.RIGHT } )); - ok(content2.is(':visible'), "Content is expanded"); - ok(content1.is(':hidden'), "Content is collapsed"); - title2.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.LEFT } )); - ok(content1.is(':visible'), "Content is expanded"); - ok(content2.is(':hidden'), "Content is collapsed"); - tabs.tabs('destroy'); - start(); - } ); - - setTimeout(function(){ - title1.focus(); - },10); -}); - -asyncTest( "Keyboard support for accordion view", function() { - - expect( 5 ); - var tabs = $('
    '); - var title1 = $('
    ').appendTo(tabs); - var content1 = $('
    ').appendTo(tabs); - var title2 = $('
    ').appendTo(tabs); - var content2 = $('
    ').appendTo(tabs); - tabs.appendTo("body"); - tabs.tabs({openOnFocus:false}); - - title1.on("focus",function(ev){ - ok(content1.is(':visible'), "Content is expanded"); - title1.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.RIGHT } )); - ok(content1.is(':visible'), "Content is expanded"); - ok(content2.is(':hidden'), "Content is collapsed"); - title2.trigger($.Event( 'keydown', { keyCode: $.ui.keyCode.ENTER } )); - ok(content2.is(':visible'), "Content is expanded"); - ok(content1.is(':hidden'), "Content is collapsed"); - tabs.tabs('destroy'); - start(); - } ); - - setTimeout(function(){ - title1.focus(); - },10); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js deleted file mode 100644 index a9bbc7fb10d2d..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TranslateTest = TestCase('TranslateTest'); -TranslateTest.prototype.testTranslateExist = function() { - assertNotUndefined(jQuery.mage.translate); -}; -TranslateTest.prototype.testTranslationParametersOneArgument = function() { - jQuery.mage.translate.add('Hello World!'); - assertEquals( - 'Hello World!', - jQuery.mage.translate.translate('Hello World!')); -}; -TranslateTest.prototype.testTranslationParametersArray = function() { - jQuery.mage.translate.add(['Hello World!', 'Bonjour tout le monde!']); - assertEquals( - 'Hello World!', - jQuery.mage.translate.translate('Hello World!')); -}; -TranslateTest.prototype.testTranslationParametersObject = function() { - var translation = {'Hello World!': 'Bonjour tout le monde!'}; - jQuery.mage.translate.add(translation); - assertEquals( - translation['Hello World!'], - jQuery.mage.translate.translate('Hello World!')); - - translation = { - 'Hello World!': 'Hallo Welt!', - 'Some text with symbols!-+"%#*': 'Ein Text mit Symbolen!-+"%#*' - }; - jQuery.mage.translate.add(translation); - jQuery.each(translation, function(key) { - assertEquals(translation[key], jQuery.mage.translate.translate(key)); - }); -}; -TranslateTest.prototype.testTranslationParametersTwoArguments = function() { - jQuery.mage.translate.add('Hello World!', 'Bonjour tout le monde!'); - assertEquals( - 'Bonjour tout le monde!', - jQuery.mage.translate.translate('Hello World!')); -}; -TranslateTest.prototype.testTranslationAlias = function() { - var translation = {'Hello World!': 'Bonjour tout le monde!'}; - jQuery.mage.translate.add(translation); - assertEquals(translation['Hello World!'], jQuery.mage.__('Hello World!')); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js deleted file mode 100644 index 18a117f1913b1..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TranslateInlineTest = TestCase('TranslateInlineTest'); -TranslateInlineTest.prototype.testInit = function() { - /*:DOC += -
    - */ - var translateInline = jQuery('[data-role="translate-dialog"]').translateInline(); - assertTrue(translateInline.is(':mage-translateInline')); - translateInline.translateInline('destroy'); -}; -TranslateInlineTest.prototype.testDialogOpenOnEdit = function() { - /*:DOC += -
    - */ - var options= { - dialog: { - id: 'dialog-id' - } - }; - var translateInline = jQuery('[data-role="translate-dialog"]').translateInline(options), - isDialogHiddenOnInit = translateInline.is(':hidden'); - translateInline.trigger('edit.editTrigger'); - var dialogVisibleAfterTriggerEdit = translateInline.is(':visible'); - assertTrue(isDialogHiddenOnInit); - assertTrue(dialogVisibleAfterTriggerEdit); - translateInline.translateInline('destroy'); -}; -TranslateInlineTest.prototype.testTranslationFormTemplate = function() { - /*:DOC += -
    - */ - var options = { - translateForm: { - data:{ - id: 'translate-form-id', - newTemplateVariable: 'New Template Variable' - } - } - }, - translateInline = jQuery('[data-role="translate-dialog"]').translateInline(options); - translateInline.trigger('edit.editTrigger'); - var translateForm = jQuery('#' + options.translateForm.data.id); - assertTrue(translateForm.size() > 0); - assertEquals(translateForm.text(), options.translateForm.data.newTemplateVariable); - translateInline.translateInline('destroy'); -}; -// @TODO Need to be fixed to avoid errors on the bamboo server in context of MAGETWO-5085 ticket -/*TranslateInlineTest.prototype._testTranslateFormSubmit = function() { - FORM_KEY = 'form_key'; - var options = { - ajaxUrl: 'www.test.com', - area: 'test', - translateForm: { - template:'
    ', - data:{ - id: 'translate-form-id' - } - }, - dialog: { - id: 'dialog-id', - buttons : [{ - 'class': 'submit-button' - }] - } - }, - translateInline = jQuery(document).translateInline(options), - submit = jQuery('.ui-dialog-buttonset .submit-button'), - ajaxParametersCorrect = false; - - translateInline.trigger('edit.editTrigger'); - var parameters = jQuery.param({area: options.area}) + - '&' + jQuery('#' + options.translateForm.data.id).serialize(), - dialog = jQuery('#' + options.dialog.id), - dialogVisibleOnAjaxSend = false, - dialogHiddenAfterAjaxComplete = false; - jQuery(document) - .on('ajaxSend', function(e, jqXHR, settings){ - jqXHR.abort(); - dialogVisibleOnAjaxSend = dialog.is(':visible'); - ajaxParametersCorrect = settings.data.indexOf(parameters) >= 0; - jQuery(this).trigger('ajaxComplete'); - }); - submit.trigger('click'); - assertEquals(true, dialogVisibleOnAjaxSend); - assertEquals(true, ajaxParametersCorrect); - assertEquals(true, dialog.is(':hidden')); - translateInline.translateInline('destroy'); -};*/ -TranslateInlineTest.prototype.testDestroy = function() { - /*:DOC += -
    - - */ - var options = { - translateForm: { - data:{ - id: 'translate-form-id', - newTemplateVariable: '' - } - } - }, - translateInline = jQuery('[data-role="translate-dialog"]').translateInline(options), - editTrigger = jQuery('#edit-trigger-id').editTrigger(), - editTriggerCreated = editTrigger.size() && jQuery('#edit-trigger-id').is(':mage-editTrigger'), - editTriggerEventIsBound = false; - - assertTrue(translateInline.is(':mage-translateInline')); - assertTrue(editTriggerCreated); - translateInline.on('edit.editTrigger', function(){editTriggerEventIsBound = true;}); - translateInline.translateInline('destroy'); - translateInline.trigger('edit.editTrigger'); - assertFalse(translateInline.is(':mage-translateInline')); - assertFalse(editTriggerEventIsBound); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html deleted file mode 100644 index 00661de6d8153..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - Validation - - - - - - - - - - - - - - - - - -
    -
    -
    - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js b/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js deleted file mode 100644 index 602ba4b8d3e60..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js +++ /dev/null @@ -1,611 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -test( "testValidateNoHtmlTags", function() { - expect(4); - equal($.validator.methods['validate-no-html-tags'].call(this, ""),true); - equal($.validator.methods['validate-no-html-tags'].call(this, null),true); - equal($.validator.methods['validate-no-html-tags'].call(this, "abc"),true); - equal($.validator.methods['validate-no-html-tags'].call(this, "
    abc
    "),false); - -}); - -test( "testAllowContainerClassName", function() { - expect(4); - var radio = $(''); - radio.appendTo("#qunit-fixture"); - equal($.validator.methods['allow-container-className'].call(this, radio[0]),true); - var checkbox = $(''); - equal($.validator.methods['allow-container-className'].call(this, checkbox[0]),true); - var radio2 = $(''); - equal($.validator.methods['allow-container-className'].call(this, radio2[0]),false); - var checkbox2 = $(''); - equal($.validator.methods['allow-container-className'].call(this, checkbox2[0]),false); -}); - -test( "testValidateSelect", function() { - expect(5); - equal($.validator.methods['validate-select'].call(this, ""),false); - equal($.validator.methods['validate-select'].call(this, "none"),false); - equal($.validator.methods['validate-select'].call(this, null),false); - equal($.validator.methods['validate-select'].call(this, undefined),false); - equal($.validator.methods['validate-select'].call(this, "abc"),true); -}); - -test( "testValidateNotEmpty", function() { - expect(5); - ok(!$.validator.methods['validate-no-empty'].call(this, "")); - ok(!$.validator.methods['validate-no-empty'].call(this, null)); - ok(!$.validator.methods['validate-no-empty'].call(this, undefined)); - ok(!$.validator.methods['validate-no-empty'].call(this, " ")); - ok($.validator.methods['validate-no-empty'].call(this, "test")); -}); - -test( "testValidateStreet", function() { - expect(9); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, ""),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, null),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, undefined),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " "),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, "abc "),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " 123 "),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " abc123 "),true); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " !@# "),false); - equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " abc.123 "),false); -}); - -test( "testValidatePhoneStrict", function() { - expect(9); - equal($.validator.methods['validate-phoneStrict'].call(this, ""),true); - equal($.validator.methods['validate-phoneStrict'].call(this, null),true); - equal($.validator.methods['validate-phoneStrict'].call(this, undefined),true); - equal($.validator.methods['validate-phoneStrict'].call(this, " "),false); - equal($.validator.methods['validate-phoneStrict'].call(this, "5121231234"),false); - equal($.validator.methods['validate-phoneStrict'].call(this, "512.123.1234"),false); - equal($.validator.methods['validate-phoneStrict'].call(this, "512-123-1234"),true); - equal($.validator.methods['validate-phoneStrict'].call(this, "(512)123-1234"),true); - equal($.validator.methods['validate-phoneStrict'].call(this, "(512) 123-1234"),true); -}); - -test( "testValidatePhoneLax", function() { - expect(11); - equal($.validator.methods['validate-phoneLax'].call(this, ""),true); - equal($.validator.methods['validate-phoneLax'].call(this, null),true); - equal($.validator.methods['validate-phoneLax'].call(this, undefined),true); - equal($.validator.methods['validate-phoneLax'].call(this, " "),false); - equal($.validator.methods['validate-phoneLax'].call(this, "5121231234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "512.123.1234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "512-123-1234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "(512)123-1234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "(512) 123-1234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "(512)1231234"),true); - equal($.validator.methods['validate-phoneLax'].call(this, "(512)_123_1234"),false); -}); - -test( "testValidateFax", function() { - expect(9); - equal($.validator.methods['validate-fax'].call(this, ""),true); - equal($.validator.methods['validate-fax'].call(this, null),true); - equal($.validator.methods['validate-fax'].call(this, undefined),true); - equal($.validator.methods['validate-fax'].call(this, " "),false); - equal($.validator.methods['validate-fax'].call(this, "5121231234"),false); - equal($.validator.methods['validate-fax'].call(this, "512.123.1234"),false); - equal($.validator.methods['validate-fax'].call(this, "512-123-1234"),true); - equal($.validator.methods['validate-fax'].call(this, "(512)123-1234"),true); - equal($.validator.methods['validate-fax'].call(this, "(512) 123-1234"),true); -}); - -test( "testValidateEmail", function() { - expect(11); - equal($.validator.methods['validate-email'].call(this, ""),true); - equal($.validator.methods['validate-email'].call(this, null),true); - equal($.validator.methods['validate-email'].call(this, undefined),true); - equal($.validator.methods['validate-email'].call(this, " "),false); - equal($.validator.methods['validate-email'].call(this, "123@123.com"),true); - equal($.validator.methods['validate-email'].call(this, "abc@124.en"),true); - equal($.validator.methods['validate-email'].call(this, "abc@abc.commmmm"),true); - equal($.validator.methods['validate-email'].call(this, "abc.abc.abc@abc.commmmm"),true); - equal($.validator.methods['validate-email'].call(this, "abc.abc-abc@abc.commmmm"),true); - equal($.validator.methods['validate-email'].call(this, "abc.abc_abc@abc.commmmm"),true); - equal($.validator.methods['validate-email'].call(this, "abc.abc_abc@abc"),false); -}); - -test( "testValidateEmailSender", function() { - expect(10); - equal($.validator.methods['validate-emailSender'].call(this, ""),true); - equal($.validator.methods['validate-emailSender'].call(null),true); - equal($.validator.methods['validate-emailSender'].call(undefined),true); - equal($.validator.methods['validate-emailSender'].call(" "),true); - equal($.validator.methods['validate-emailSender'].call("123@123.com"),true); - equal($.validator.methods['validate-emailSender'].call("abc@124.en"),true); - equal($.validator.methods['validate-emailSender'].call("abc@abc.commmmm"),true); - equal($.validator.methods['validate-emailSender'].call("abc.abc.abc@abc.commmmm"),true); - equal($.validator.methods['validate-emailSender'].call("abc.abc-abc@abc.commmmm"),true); - equal($.validator.methods['validate-emailSender'].call("abc.abc_abc@abc.commmmm"),true); -}); - -test( "testValidatePassword", function() { - expect(9); - equal($.validator.methods['validate-password'].call(this, ""),true); - equal($.validator.methods['validate-password'].call(this, null),false); - equal($.validator.methods['validate-password'].call(this, undefined),false); - equal($.validator.methods['validate-password'].call(this, " "),true); - equal($.validator.methods['validate-password'].call(this, "123@123.com"),true); - equal($.validator.methods['validate-password'].call(this, "abc"),false); - equal($.validator.methods['validate-password'].call(this, "abc "),false); - equal($.validator.methods['validate-password'].call(this, " abc "),false); - equal($.validator.methods['validate-password'].call(this, "dddd"),false); -}); - -test( "testValidateAdminPassword", function() { - expect(9); - equal(true, $.validator.methods['validate-admin-password'].call(this, "")); - equal(false, $.validator.methods['validate-admin-password'].call(this, null)); - equal(false, $.validator.methods['validate-admin-password'].call(this, undefined)); - equal(true, $.validator.methods['validate-admin-password'].call(this, " ")); - equal(true, $.validator.methods['validate-admin-password'].call(this, "123@123.com")); - equal(false, $.validator.methods['validate-admin-password'].call(this, "abc")); - equal(false, $.validator.methods['validate-admin-password'].call(this, "abc ")); - equal(false, $.validator.methods['validate-admin-password'].call(this, " abc ")); - equal(false, $.validator.methods['validate-admin-password'].call(this, "dddd")); -}); - -test( "testValidateUrl", function() { - expect(8); - equal(true, $.validator.methods['validate-url'].call(this, "")); - equal(true, $.validator.methods['validate-url'].call(this, null)); - equal(true, $.validator.methods['validate-url'].call(this, undefined)); - equal(false, $.validator.methods['validate-url'].call(this, " ")); - equal(true, $.validator.methods['validate-url'].call(this, "http://www.google.com")); - equal(true, $.validator.methods['validate-url'].call(this, "http://127.0.0.1:8080/index.php")); - equal(true, $.validator.methods['validate-url'].call(this, "http://app-spot.com/index.php")); - equal(true, $.validator.methods['validate-url'].call(this, "http://app-spot_space.com/index.php")); -}); - -test( "testValidateCleanUrl", function() { - expect(8); - equal(true, $.validator.methods['validate-clean-url'].call(this, "")); - equal(true, $.validator.methods['validate-clean-url'].call(this, null)); - equal(true, $.validator.methods['validate-clean-url'].call(this, undefined)); - equal(false, $.validator.methods['validate-clean-url'].call(this, " ")); - equal(true, $.validator.methods['validate-clean-url'].call(this, "http://www.google.com")); - equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1:8080/index.php")); - equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1:8080")); - equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1")); -}); - -test( "testValidateXmlIdentifier", function() { - expect(8); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, "")); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, null)); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, undefined)); - equal(false, $.validator.methods['validate-xml-identifier'].call(this, " ")); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc")); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc_123")); - equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc-123")); - equal(false, $.validator.methods['validate-xml-identifier'].call(this, "123-abc")); -}); - -test( "testValidateSsn", function() { - expect(8); - equal(true, $.validator.methods['validate-ssn'].call(this, "")); - equal(true, $.validator.methods['validate-ssn'].call(this, null)); - equal(true, $.validator.methods['validate-ssn'].call(this, undefined)); - equal(false, $.validator.methods['validate-ssn'].call(this, " ")); - equal(false, $.validator.methods['validate-ssn'].call(this, "abc")); - equal(true, $.validator.methods['validate-ssn'].call(this, "123-13-1234")); - equal(true, $.validator.methods['validate-ssn'].call(this, "012-12-1234")); - equal(false, $.validator.methods['validate-ssn'].call(this, "23-12-1234")); -}); - -test( "testValidateZip", function() { - expect(8); - equal(true, $.validator.methods['validate-zip-us'].call(this, "")); - equal(true, $.validator.methods['validate-zip-us'].call(this, null)); - equal(true, $.validator.methods['validate-zip-us'].call(this, undefined)); - equal(false, $.validator.methods['validate-zip-us'].call(this, " ")); - equal(true, $.validator.methods['validate-zip-us'].call(this, "12345-1234")); - equal(true, $.validator.methods['validate-zip-us'].call(this, "02345")); - equal(false, $.validator.methods['validate-zip-us'].call(this, "1234")); - equal(false, $.validator.methods['validate-zip-us'].call(this, "1234-1234")); -}); - -test( "testValidateDateAu", function() { - expect(8); - equal(true, $.validator.methods['validate-date-au'].call(this, "")); - equal(true, $.validator.methods['validate-date-au'].call(this, null)); - equal(true, $.validator.methods['validate-date-au'].call(this, undefined)); - equal(false, $.validator.methods['validate-date-au'].call(this, " ")); - equal(true, $.validator.methods['validate-date-au'].call(this, "01/01/2012")); - equal(true, $.validator.methods['validate-date-au'].call(this, "30/01/2012")); - equal(false, $.validator.methods['validate-date-au'].call(this, "01/30/2012")); - equal(false, $.validator.methods['validate-date-au'].call(this, "1/1/2012")); -}); - -test( "testValidateCurrencyDollar", function() { - expect(8); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, "")); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, null)); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, undefined)); - equal(false, $.validator.methods['validate-currency-dollar'].call(this, " ")); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$123")); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$1,123.00")); - equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$1234")); - equal(false, $.validator.methods['validate-currency-dollar'].call(this, "$1234.1234")); -}); - -test( "testValidateNotNegativeNumber", function() { - expect(11); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, "")); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, null)); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, undefined)); - equal(false, $.validator.methods['validate-not-negative-number'].call(this, " ")); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, "0")); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1")); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1234")); - equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1,234.1234")); - equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1")); - equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1e")); - equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1,234.1234")); -}); - -test( "testValidateGreaterThanZero", function() { - expect(11); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "")); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, null)); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, undefined)); - equal(false, $.validator.methods['validate-greater-than-zero'].call(this, " ")); - equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "0")); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1")); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1234")); - equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1,234.1234")); - equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1")); - equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1e")); - equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1,234.1234")); -}); - -test( "testValidateCssLength", function() { - expect(11); - equal(true, $.validator.methods['validate-css-length'].call(this, "")); - equal(true, $.validator.methods['validate-css-length'].call(this, null)); - equal(true, $.validator.methods['validate-css-length'].call(this, undefined)); - equal(false, $.validator.methods['validate-css-length'].call(this, " ")); - equal(false, $.validator.methods['validate-css-length'].call(this, "0")); - equal(true, $.validator.methods['validate-css-length'].call(this, "1")); - equal(true, $.validator.methods['validate-css-length'].call(this, "1234")); - equal(true, $.validator.methods['validate-css-length'].call(this, "1,234.1234")); - equal(false, $.validator.methods['validate-css-length'].call(this, "-1")); - equal(false, $.validator.methods['validate-css-length'].call(this, "-1e")); - equal(false, $.validator.methods['validate-css-length'].call(this, "-1,234.1234")); -}); - -test( "testValidateData", function() { - expect(9); - equal(true, $.validator.methods['validate-data'].call(this, "")); - equal(true, $.validator.methods['validate-data'].call(this, null)); - equal(true, $.validator.methods['validate-data'].call(this, undefined)); - equal(false, $.validator.methods['validate-data'].call(this, " ")); - equal(false, $.validator.methods['validate-data'].call(this, "123abc")); - equal(true, $.validator.methods['validate-data'].call(this, "abc")); - equal(false, $.validator.methods['validate-data'].call(this, " abc")); - equal(true, $.validator.methods['validate-data'].call(this, "abc123")); - equal(false, $.validator.methods['validate-data'].call(this, "abc-123")); -}); - - -test( "testValidateOneRequiredByName", function() { - expect(4); - var radio = $(''); - radio.appendTo("#qunit-fixture"); - ok(!$.validator.methods['validate-one-required-by-name'].call(this, - null, radio[0])); - var radio2 = $(''); - radio2.appendTo("#qunit-fixture"); - ok($.validator.methods['validate-one-required-by-name'].call(this, - null, radio2[0])); - - var checkbox = $(''); - checkbox.appendTo("#qunit-fixture"); - ok(!$.validator.methods['validate-one-required-by-name'].call(this, - null, checkbox[0])); - var checkbox2 = $(''); - checkbox2.appendTo("#qunit-fixture"); - ok($.validator.methods['validate-one-required-by-name'].call(this, - null, checkbox2[0])); -}); - -test( "testLessThanEqualsTo", function() { - expect(5); - var elm1 = $(''); - var elm2 = $(''); - ok(!$.validator.methods['less-than-equals-to'].call(this, elm1[0].value, - elm1, elm2)); - elm1[0].value = 4; - ok($.validator.methods['less-than-equals-to'].call(this, elm1[0].value, - elm1, elm2)); - - var elm3 = $(''); - var elm4= $(''); - ok($.validator.methods['less-than-equals-to'].call(this, elm3[0].value, - elm3, elm4)); - - var elm5 = $(''); - var elm6= $(''); - ok($.validator.methods['less-than-equals-to'].call(this, elm5[0].value, - elm5, elm6)); - - var elm7 = $(''); - var elm8= $(''); - ok($.validator.methods['less-than-equals-to'].call(this, elm7[0].value, - elm7, elm8)); -}); - -test( "testGreaterThanEqualsTo", function() { - expect(5); - - var elm1 = $(''); - var elm2 = $(''); - ok(!$.validator.methods['greater-than-equals-to'].call(this, elm1[0].value, - elm1, elm2)); - elm1[0].value = 9; - ok($.validator.methods['greater-than-equals-to'].call(this, elm1[0].value, - elm1, elm2)); - - var elm3 = $(''); - var elm4= $(''); - ok($.validator.methods['greater-than-equals-to'].call(this, elm3[0].value, - elm3, elm4)); - - var elm5 = $(''); - var elm6= $(''); - ok($.validator.methods['greater-than-equals-to'].call(this, elm5[0].value, - elm5, elm6)); - - var elm7 = $(''); - var elm8= $(''); - ok($.validator.methods['greater-than-equals-to'].call(this, elm7[0].value, - elm7, elm8)); -}); - -test( "testValidateGroupedQty", function() { - expect(5); - var div1 = $('
    '); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div1); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div1); - $('').appendTo(div1); - - ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div1[0])); - - var div2 = $('
    '); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div2); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div2); - $('').appendTo(div2); - ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div2[0])); - - var div3 = $('
    '); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div3); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div3); - $('').appendTo(div3); - ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div3[0])); - - var div4 = $('
    '); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div4); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div4); - $('').appendTo(div4); - ok($.validator.methods['validate-grouped-qty'].call(this, null, null, div4[0])); - - var div5 = $('
    '); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div5); - $('').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}") - .appendTo(div5); - $('').appendTo(div5); - ok($.validator.methods['validate-grouped-qty'].call(this, null, null, div5[0])); - -}); - -test( "testValidateCCTypeSelect", function() { - expect(14); - var visaValid = $(''); - var visaInvalid = $(''); - var mcValid = $(''); - var mcInvalid = $(''); - var aeValid = $(''); - var aeInvalid = $(''); - - var diValid = $(''); - var diInvalid = $(''); - var dnValid = $(''); - var dnInvalid = $(''); - var jcbValid = $(''); - var jcbInvalid = $(''); - var upValid = $(''); - var upInvalid = $(''); - - ok($.validator.methods['validate-cc-type-select'].call(this, 'VI', null, visaValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'VI', null, visaInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'MC', null, mcValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'MC', null, mcInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'AE', null, aeValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'AE', null, aeInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'DI', null, diValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'DI', null, diInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'DN', null, dnValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'DN', null, dnInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'JCB', null, jcbValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'JCB', null, jcbInvalid)); - ok($.validator.methods['validate-cc-type-select'].call(this, 'UP', null, upValid)); - ok(!$.validator.methods['validate-cc-type-select'].call(this, 'UP', null, upInvalid)); -}); - -test( "testValidateCCNumber", function() { - expect(37); - ok($.validator.methods['validate-cc-number'].call(this, '4916835098995909', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '5265071363284878', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6011120623356953', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '371293266574617', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '4916835098995901', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '5265071363284870', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6011120623356951', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '371293266574619', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '2221220000000003', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '2721220000000008', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '601109020000000003', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6011111144444444', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6011222233334444', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6011522233334447', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '601174455555553', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6011745555555550', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '601177455555556', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '601182455555556', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '601187999555558', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '601287999555556', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6444444444444443', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6644444444444441', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '3044444444444444', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '3064444444444449', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '3095444444444442', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '3096444444444441', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '3696444444444445', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '3796444444444444', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '3896444444444443', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '3528444444444449', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '3529444444444448', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6221262244444440', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6229981111111111', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6249981111111117', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6279981111111110', null, null)); - ok($.validator.methods['validate-cc-number'].call(this, '6282981111111115', null, null)); - ok(!$.validator.methods['validate-cc-number'].call(this, '6289981111111118', null, null)); -}); - -test( "testValidateCCType", function() { - expect(14); - var select = $(''); - - select.val('VI'); - ok($.validator.methods['validate-cc-type'].call(this, '4916835098995909', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select)); - select.val('MC'); - ok($.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '4916835098995909', null, select)); - select.val('AE'); - ok($.validator.methods['validate-cc-type'].call(this, '371293266574617', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select)); - select.val('DI'); - ok($.validator.methods['validate-cc-type'].call(this, '6011050000000009', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '371293266574617', null, select)); - select.val('DN'); - ok($.validator.methods['validate-cc-type'].call(this, '3095434000000001', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '6011050000000009', null, select)); - select.val('JCB'); - ok($.validator.methods['validate-cc-type'].call(this, '3528000000000007', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '3095434000000001', null, select)); - select.val('UP'); - ok($.validator.methods['validate-cc-type'].call(this, '6221260000000000', null, select)); - ok(!$.validator.methods['validate-cc-type'].call(this, '3528000000000007', null, select)); -}); - -test( "testValidateCCExp", function() { - expect(3); - var year = $(''), - currentTime = new Date(), - currentMonth = currentTime.getMonth() + 1, - currentYear = currentTime.getFullYear(); - year.val(currentYear); - if (currentMonth > 1) { - ok(!$.validator.methods['validate-cc-exp'].call(this, currentMonth - 1, null, year)); - } - ok($.validator.methods['validate-cc-exp'].call(this, currentMonth, null, year)); - year.val(currentYear + 1); - ok($.validator.methods['validate-cc-exp'].call(this, currentMonth, null, year)); - -}); - -test( "testValidateCCCvn", function() { - expect(8); - var ccType = $(''); - - ccType.val('VI'); - ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType)); - ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType)); - ccType.val('MC'); - ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType)); - ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType)); - ccType.val('AE'); - ok($.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType)); - ok(!$.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType)); - ccType.val('DI'); - ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType)); - ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType)); -}); - -test( "testValidateNumberRange", function() { - expect(14); - ok($.validator.methods['validate-number-range'].call(this, '-1', null, null)); - ok($.validator.methods['validate-number-range'].call(this, '1', null, null)); - ok($.validator.methods['validate-number-range'].call(this, '', null, null)); - ok($.validator.methods['validate-number-range'].call(this, null, null, null)); - ok($.validator.methods['validate-number-range'].call(this, '0', null, null)); - ok(!$.validator.methods['validate-number-range'].call(this, 'asds', null, null)); - - ok($.validator.methods['validate-number-range'].call(this, '10', null, '10-20.06')); - ok($.validator.methods['validate-number-range'].call(this, '15', null, '10-20.06')); - ok(!$.validator.methods['validate-number-range'].call(this, '1', null, '10-20.06')); - ok(!$.validator.methods['validate-number-range'].call(this, '30', null, '10-20.06')); - - var el1 = $('').get(0); - ok($.validator.methods['validate-number-range'].call(this, '10', el1, null)); - ok($.validator.methods['validate-number-range'].call(this, '15', el1, null)); - ok(!$.validator.methods['validate-number-range'].call(this, '1', el1, null)); - ok($.validator.methods['validate-number-range'].call(this, '30', el1, null)); -}); - - - -test( "testValidateDigitsRange", function() { - expect(15); - ok($.validator.methods['validate-digits-range'].call(this, '-1', null, null)); - ok($.validator.methods['validate-digits-range'].call(this, '1', null, null)); - ok($.validator.methods['validate-digits-range'].call(this, '', null, null)); - ok($.validator.methods['validate-digits-range'].call(this, null, null, null)); - ok($.validator.methods['validate-digits-range'].call(this, '0', null, null)); - ok(!$.validator.methods['validate-digits-range'].call(this, 'asds', null, null)); - - ok($.validator.methods['validate-digits-range'].call(this, '10', null, '10-20')); - ok($.validator.methods['validate-digits-range'].call(this, '15', null, '10-20')); - ok(!$.validator.methods['validate-digits-range'].call(this, '1', null, '10-20')); - ok(!$.validator.methods['validate-digits-range'].call(this, '30', null, '10-20')); - ok($.validator.methods['validate-digits-range'].call(this, '30', null, '10-20.06')); - - var el1 = $('').get(0); - ok($.validator.methods['validate-digits-range'].call(this, '10', el1, null)); - ok($.validator.methods['validate-digits-range'].call(this, '15', el1, null)); - ok(!$.validator.methods['validate-digits-range'].call(this, '1', el1, null)); - ok(!$.validator.methods['validate-digits-range'].call(this, '30', el1, null)); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html b/dev/tests/js/jasmine/assets/lib/web/mage/menu.html similarity index 50% rename from dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html rename to dev/tests/js/jasmine/assets/lib/web/mage/menu.html index d0a3b9b873801..03c673a7dac5f 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html +++ b/dev/tests/js/jasmine/assets/lib/web/mage/menu.html @@ -1,36 +1,10 @@ - - - - - - Unit test - - - - - - - - - - - - -
    -
    - - +
\ No newline at end of file diff --git a/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html b/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html new file mode 100644 index 0000000000000..dd4d665ca188e --- /dev/null +++ b/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html @@ -0,0 +1,8 @@ +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html b/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html new file mode 100644 index 0000000000000..5e48598a081a2 --- /dev/null +++ b/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html @@ -0,0 +1,4 @@ + +
\ No newline at end of file diff --git a/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js b/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js new file mode 100644 index 0000000000000..19a54d95cf704 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js @@ -0,0 +1,80 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +define([ + 'jquery', + 'mage/accordion' +], function ($) { + 'use strict'; + + describe('Test for mage/accordion jQuery plugin', function () { + it('check if accordion can be initialized', function () { + var accordion = $('
'); + + accordion.accordion(); + expect(accordion.is(':mage-accordion')).toBeTruthy(); + + accordion.accordion('destroy'); + expect(accordion.is(':mage-accordion')).toBeFalsy(); + }); + it('check one-collapsible element accordion', function () { + var accordion = $('
'), + title1 = $('
').appendTo(accordion), + content1 = $('
').appendTo(accordion), + title2 = $('
').appendTo(accordion), + content2 = $('
').appendTo(accordion); + + accordion.appendTo('body'); + + accordion.accordion(); + + expect(accordion.is(':mage-accordion')).toBeTruthy(); + + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':hidden')).toBeTruthy(); + + title2.trigger('click'); + + expect(content1.is(':hidden')).toBeTruthy(); + expect(content2.is(':visible')).toBeTruthy(); + + title1.trigger('click'); + + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':hidden')).toBeTruthy(); + + accordion.accordion('destroy'); + + expect(accordion.is(':mage-accordion')).toBeFalsy(); + }); + it('check multi-collapsible element accordion', function () { + var accordion = $('
'), + title1 = $('
').appendTo(accordion), + content1 = $('
').appendTo(accordion), + title2 = $('
').appendTo(accordion), + content2 = $('
').appendTo(accordion); + + accordion.appendTo('body'); + + accordion.accordion({ + multipleCollapsible: true + }); + + expect(accordion.is(':mage-accordion')).toBeTruthy(); + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':hidden')).toBeTruthy(); + + $(title1).trigger('click'); + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':hidden')).toBeTruthy(); + + $(title2).trigger('click'); + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':visible')).toBeTruthy(); + + accordion.accordion('destroy'); + expect(accordion.is(':mage-accordion')).toBeFalsy(); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js b/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js new file mode 100644 index 0000000000000..84880e6af72c5 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js @@ -0,0 +1,524 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/backend/suggest' +], function ($) { + 'use strict'; + + describe('mage/backend/suggest', function () { + var suggestSelector = '#suggest'; + + beforeEach(function () { + var $suggest = $(''); + + $('body').append($suggest); + $('body').append(''); + }); + + afterEach(function () { + $(suggestSelector).remove(); + $('#test-template').remove(); + $(suggestSelector).suggest('destroy'); + }); + + it('Check that suggest inited', function () { + var $suggest = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }); + + expect($suggest.is(':mage-suggest')).toBe(true); + }); + + it('Check suggest create', function () { + var options = { + template: '#test-template', + choiceTemplate: '
  • ', + controls: { + selector: '.test', + eventsMap: { + focus: ['testfocus'], + blur: ['testblur'], + select: ['testselect'] + } + }, + showRecent: true, + storageKey: 'test-suggest-recent', + multiselect: true + }, + recentItems = [{ + id: '1', + label: 'TestLabel1' + }, + { + id: '2', + label: 'TestLabel2' + } + ], + nonSelectedItem = { + id: '', + label: '' + }, + suggestInstance; + + if (window.localStorage) { + localStorage.setItem(options.storageKey, JSON.stringify(recentItems)); + } + + suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest'); + + expect(suggestInstance._term).toBe(null); + expect(suggestInstance._nonSelectedItem).toEqual(nonSelectedItem); + expect(suggestInstance._renderedContext).toBe(null); + expect(suggestInstance._selectedItem).toEqual(nonSelectedItem); + expect(suggestInstance._control).toEqual(suggestInstance.options.controls); + expect(suggestInstance._recentItems).toEqual(window.localStorage ? recentItems : []); + expect(suggestInstance.valueField.is(':hidden')).toBe(true); + + if (window.localStorage) { + localStorage.removeItem(options.storageKey); + } + }); + + it('Check suggest render', function () { + var options = { + template: '#test-template', + choiceTemplate: '
  • ', + dropdownWrapper: '
    ', + className: 'test-suggest', + inputWrapper: '
    ' + }, + suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest'); + + suggestInstance._render(); + + expect(suggestInstance.dropdown.hasClass('wrapper-test')).toBe(true); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + expect(suggestInstance.element.closest('.test-input-wrapper').size()).toBeGreaterThan(0); + expect(suggestInstance.element.closest('.' + options.className).size()).toBeGreaterThan(0); + expect(suggestInstance.element.attr('autocomplete')).toBe('off'); + + options.appendMethod = 'before'; + $(suggestSelector).suggest('destroy'); + suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest'); + suggestInstance._render(); + expect(suggestInstance.element.prev().is(suggestInstance.dropdown)).toBe(true); + + options.appendMethod = 'after'; + $(suggestSelector).suggest('destroy'); + suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest'); + suggestInstance._render(); + expect(suggestInstance.element.next().is(suggestInstance.dropdown)).toBe(true); + }); + + it('Check suggest createValueField', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + valueField = suggestInstance._createValueField(); + + expect(valueField.is('input')).toBe(true); + expect(valueField.is(':hidden')).toBe(true); + + $(suggestSelector).suggest('destroy'); + suggestInstance = $(suggestSelector).suggest({ + multiselect: true, + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + valueField = suggestInstance._createValueField(); + + expect(valueField.is('select')).toBe(true); + expect(valueField.is(':hidden')).toBe(true); + expect(valueField.attr('multiple')).toBe('multiple'); + }); + + it('Check suggest prepareValueField', function () { + var $suggest = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }), + suggestInstance = $suggest.data('mage-suggest'), + suggestName = $suggest.attr('name'); + + suggestInstance._prepareValueField(); + + expect(suggestInstance.valueField).not.toBe(true); + expect(suggestInstance.element.prev().is(suggestInstance.valueField)).toBe(true); + expect(suggestInstance.element.attr('name')).toBe(undefined); + expect(suggestInstance.valueField.attr('name')).toBe(suggestName); + }); + + it('Check suggest destroy', function () { + var options = { + template: '#test-template', + choiceTemplate: '
  • ', + inputWrapper: '
    ', + valueField: null + }, + $suggest = $(suggestSelector).suggest(options), + suggestInstance = $suggest.data('mage-suggest'), + suggestName = $suggest.attr('name'); + + expect(suggestInstance.dropdown).not.toBe(undefined); + expect(suggestInstance.valueField).not.toBe(undefined); + expect(suggestName).toBe(undefined); + + $suggest.suggest('destroy'); + + expect($suggest.closest('.test-input-wrapper').length).toBe(0); + expect($suggest.attr('autocomplete')).toBe(undefined); + expect($suggest.attr('name')).toBe(suggestInstance.valueField.attr('name')); + expect(suggestInstance.valueField.parents('html').length).not.toBeGreaterThan(0); + expect(suggestInstance.dropdown.parents('html').length).not.toBeGreaterThan(0); + }); + + it('Check suggest value', function () { + var value = 'test-value', + suggestInstance, suggestDivInstance; + + $(suggestSelector).val(value); + $('body').append('
    ' + value + '
    '); + + suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + suggestDivInstance = $('#suggest-div').suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + + expect(suggestInstance._value()).toBe(value); + expect(suggestDivInstance._value()).toBe(value); + $('#suggest-div').remove(); + }); + + it('Check suggest bind', function () { + var eventIsBinded = false, + options = { + template: '#test-template', + choiceTemplate: '
  • ', + events: { + /** Stub function */ + click: function () { + eventIsBinded = true; + } + } + }, + $suggest = $(suggestSelector).suggest(options); + + $suggest.trigger('click'); + expect(eventIsBinded).toBe(true); + }); + + it('Check suggest focus/blur', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }; + + expect(suggestInstance._focused).toBe(undefined); + expect(suggestInstance.element.val()).toBe(''); + + suggestInstance._focusItem($.Event('focus'), uiHash); + + expect(suggestInstance._focused).toEqual(uiHash.item); + expect(suggestInstance.element.val()).toBe(uiHash.item.label); + + suggestInstance._blurItem(); + + expect(suggestInstance._focused).toBe(null); + expect(suggestInstance.element.val()).toBe(''); + }); + + it('Check suggest select', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }; + + suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null; + suggestInstance.valueField.val(''); + suggestInstance._selectItem($.Event('select')); + + expect(suggestInstance._selectedItem).toBe(null); + expect(suggestInstance._term).toBe(null); + expect(suggestInstance.valueField.val()).toBe(''); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + + suggestInstance._focused = uiHash.item; + suggestInstance._selectItem($.Event('select')); + + expect(suggestInstance._selectedItem).toEqual(suggestInstance._focused); + expect(suggestInstance._term).toBe(suggestInstance._focused.label); + expect(suggestInstance.valueField.val()).toBe(suggestInstance._focused.id.toString()); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + }); + + it('Check suggest multiselect', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ', + multiselect: true + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + event = $.Event('select'), + selectedElement = $('
    '); + + event.target = selectedElement[0]; + suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null; + suggestInstance.valueField.val(''); + suggestInstance._selectItem(event); + + expect(suggestInstance._selectedItem).toBe(null); + expect(suggestInstance._term).toBe(null); + expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + + suggestInstance._focused = uiHash.item; + suggestInstance._selectItem(event); + + expect(suggestInstance._selectedItem).toEqual(suggestInstance._focused); + expect(suggestInstance._term).toBe(''); + expect(suggestInstance._getOption(suggestInstance._focused).length).toBeGreaterThan(0); + expect(selectedElement.hasClass(suggestInstance.options.selectedClass)).toBe(true); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + + suggestInstance._selectItem(event); + expect(suggestInstance._selectedItem).toEqual(suggestInstance._nonSelectedItem); + expect(suggestInstance._term).toBe(''); + expect(suggestInstance._getOption(suggestInstance._focused).length).not.toBeGreaterThan(0); + expect(selectedElement.hasClass(suggestInstance.options.selectedClass)).toBe(false); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + }); + + it('Check suggest reset value', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + + suggestInstance.valueField.val('test'); + expect(suggestInstance.valueField.val()).toBe('test'); + suggestInstance._resetSuggestValue(); + expect(suggestInstance.valueField.val()).toBe(suggestInstance._nonSelectedItem.id); + }); + + it('Check suggest reset multiselect value', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ', + multiselect: true + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + event = $.Event('select'); + + event.target = $('
    ')[0]; + suggestInstance._focused = uiHash.item; + + suggestInstance._selectItem(event); + suggestInstance._resetSuggestValue(); + + expect(suggestInstance.valueField.val() instanceof Array).toBe(true); + expect(suggestInstance.valueField.val()[0]).not.toBe(undefined); + expect(suggestInstance.valueField.val()[0]).toBe(uiHash.item.id.toString()); + }); + + it('Check suggest read item data', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + testElement = $('
    '); + + expect(suggestInstance._readItemData(testElement)).toEqual(suggestInstance._nonSelectedItem); + testElement.data('suggestOption', 'test'); + expect(suggestInstance._readItemData(testElement)).toEqual('test'); + }); + + it('Check suggest template', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '
    <%= data.test %>
    ', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + tmpl = suggestInstance.templates[suggestInstance.templateName], + html = $('
    ').append(tmpl({ + data: { + test: 'test' + } + })).html(); + + expect(html).toEqual('
    test
    '); + suggestInstance.destroy(); + $('body').append(''); + + suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + tmpl = suggestInstance.templates[suggestInstance.templateName]; + html = $('
    ').append(tmpl({ + data: { + test: 'test' + } + })).html(); + + expect(html).toEqual('
    test
    '); + $('#test-template').remove(); + }); + + it('Check suggest dropdown visibility', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'); + + suggestInstance.dropdown.hide(); + expect(suggestInstance.isDropdownShown()).toBe(false); + expect(suggestInstance.dropdown.is(':hidden')).toBe(true); + + suggestInstance.dropdown.show(); + expect(suggestInstance.isDropdownShown()).toBe(true); + expect(suggestInstance.dropdown.is(':visible')).toBe(true); + }); + + it('Check suggest create option', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + option = suggestInstance._createOption(uiHash.item); + + expect(option.val()).toBe('1'); + expect(option.prop('selected')).toBe(true); + expect(option.text()).toBe('Test Label'); + expect(option.data('renderedOption')).not.toBe(undefined); + }); + + it('Check suggest add option', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + selectTarget = $('
    '), + event = $.Event('add'), + option; + + event.target = selectTarget[0]; + suggestInstance._addOption(event, uiHash.item); + option = suggestInstance.valueField.find('option[value=' + uiHash.item.id + ']'); + + expect(option.length).toBeGreaterThan(0); + expect(option.data('selectTarget').is(selectTarget)).toBe(true); + }); + + it('Check suggest get option', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ' + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + option = $(''); + + expect(suggestInstance._getOption(uiHash.item).length).not.toBeGreaterThan(0); + + suggestInstance.valueField.append(option); + expect(suggestInstance._getOption(uiHash.item).length).toBeGreaterThan(0); + expect(suggestInstance._getOption(option).length).toBeGreaterThan(0); + }); + + it('Check suggest last added', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ', + multiselect: true + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }; + + suggestInstance._addOption({}, uiHash.item); + expect(suggestInstance.valueField.find('option').length).toBeGreaterThan(0); + suggestInstance._removeLastAdded(); + expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0); + }); + + it('Check suggest remove option', function () { + var suggestInstance = $(suggestSelector).suggest({ + template: '#test-template', + choiceTemplate: '
  • ', + multiselect: true + }).data('mage-suggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }, + selectTarget = $('
    '), + event = $.Event('select'); + + selectTarget.addClass(suggestInstance.options.selectedClass); + event.target = selectTarget[0]; + + suggestInstance._addOption(event, uiHash.item); + expect(suggestInstance.valueField.find('option').length).toBeGreaterThan(0); + suggestInstance.removeOption(event, uiHash.item); + expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0); + expect(selectTarget.hasClass(suggestInstance.options.selectedClass)).toBe(false); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js b/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js new file mode 100644 index 0000000000000..b116fc7058808 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js @@ -0,0 +1,52 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/backend/tree-suggest' +], function ($) { + 'use strict'; + + describe('mage/backend/tree-suggest', function () { + var treeSuggestSelector = '#tree-suggest'; + + beforeEach(function () { + var $treeSuggest = $(''); + + $('body').append($treeSuggest); + }); + + afterEach(function () { + $(treeSuggestSelector).remove(); + $(treeSuggestSelector).treeSuggest('destroy'); + }); + + it('Check that treeSuggest inited', function () { + var $treeSuggest = $(treeSuggestSelector).treeSuggest(), + treeSuggestInstance = $treeSuggest.data('mage-treeSuggest'); + + expect($treeSuggest.is(':mage-treeSuggest')).toBe(true); + expect(treeSuggestInstance.widgetEventPrefix).toBe('suggest'); + }); + + it('Check treeSuggest filter', function () { + var treeSuggestInstance = $(treeSuggestSelector).treeSuggest().data('mage-treeSuggest'), + uiHash = { + item: { + id: 1, + label: 'Test Label' + } + }; + + expect(treeSuggestInstance._filterSelected( + [uiHash.item], + { + _allShown: true + } + )).toEqual([uiHash.item]); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js b/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js new file mode 100644 index 0000000000000..b2c6aed2c9fba --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js @@ -0,0 +1,173 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'jquery/ui', + 'mage/calendar' +], function ($) { + 'use strict'; + + describe('mage/calendar', function () { + describe('Check calendar', function () { + var calendarSelector = '#calendar'; + + beforeEach(function () { + var $calendar = $(''); + + $('body').append($calendar); + }); + + afterEach(function () { + $(calendarSelector).remove(); + $(calendarSelector).calendar('destroy'); + }); + + it('Check that calendar inited', function () { + var $calendar = $(calendarSelector).calendar(); + + expect($calendar.is(':mage-calendar')).toBe(true); + }); + + it('Check configuration merge', function () { + var $calendar; + + $.extend(true, $, { + calendarConfig: { + showOn: 'button', + showAnim: '', + buttonImageOnly: true, + showButtonPanel: true, + showWeek: true, + timeFormat: '', + showTime: false, + showHour: false, + showMinute: false + } + }); + + $calendar = $(calendarSelector).calendar(); + + expect($calendar.calendar('option', 'showOn')).toBe('button'); + expect($calendar.calendar('option', 'showAnim')).toBe(''); + expect($calendar.calendar('option', 'buttonImageOnly')).toBe(true); + expect($calendar.calendar('option', 'showButtonPanel')).toBe(true); + expect($calendar.calendar('option', 'showWeek')).toBe(true); + expect($calendar.calendar('option', 'timeFormat')).toBe(''); + expect($calendar.calendar('option', 'showTime')).toBe(false); + expect($calendar.calendar('option', 'showHour')).toBe(false); + expect($calendar.calendar('option', 'showMinute')).toBe(false); + + delete $.calendarConfig; + }); + + it('Specifying AM/PM in timeformat option changes AMPM option to true', function () { + var $calendar = $(calendarSelector).calendar({ + timeFormat: 'hh:mm tt', + ampm: false + }); + + expect($calendar.calendar('option', 'ampm')).toBe(true); + }); + + it('Omitting AM/PM in timeformat option changes AMPM option to false', function () { + var $calendar = $(calendarSelector).calendar({ + timeFormat: 'hh:mm' + }); + + expect($calendar.calendar('option', 'ampm')).toBe(null); + }); + + it('With server timezone offset', function () { + var serverTimezoneSeconds = 1346122095, + $calendar = $(calendarSelector).calendar({ + serverTimezoneSeconds: serverTimezoneSeconds + }), + currentDate = new Date(); + + currentDate.setTime((serverTimezoneSeconds + currentDate.getTimezoneOffset() * 60) * 1000); + + expect($calendar.calendar('getTimezoneDate').toString()).toBe(currentDate.toString()); + }); + + it('Without sever timezone offset', function () { + var $calendar = $(calendarSelector).calendar(), + currentDate = new Date(); + + expect($calendar.calendar('getTimezoneDate').toString()).toBe(currentDate.toString()); + }); + + it('Check destroy', function () { + var $calendar = $(calendarSelector).calendar(); + + expect($calendar.is(':mage-calendar')).toBe(true); + $calendar.calendar('destroy'); + expect($calendar.is(':mage-calendar')).toBe(false); + }); + }); + describe('Check dateRange', function () { + var dateRangeSelector = '#date-range'; + + beforeEach(function () { + var $dateRange = $('
    ' + + '' + + '' + + '
    '); + + $('body').append($dateRange); + }); + + afterEach(function () { + $(dateRangeSelector).remove(); + $(dateRangeSelector).dateRange('destroy'); + }); + + it('Check that dateRange inited', function () { + var $dateRange = $(dateRangeSelector).dateRange(); + + expect($dateRange.is(':mage-dateRange')).toBe(true); + }); + + it('Check that dateRange inited with additional options', function () { + var $from = $('#from'), + $to = $('#to'); + + $(dateRangeSelector).dateRange({ + from: { + id: 'from' + }, + to: { + id: 'to' + } + }); + + expect($from.hasClass('_has-datepicker')).toBe(true); + expect($to.hasClass('_has-datepicker')).toBe(true); + }); + + it('Check destroy', function () { + var $dateRange = $(dateRangeSelector).dateRange({ + from: { + id: 'from' + }, + to: { + id: 'to' + } + }), + $from = $('#from'), + $to = $('#to'); + + expect($dateRange.is(':mage-dateRange')).toBe(true); + expect($from.hasClass('_has-datepicker')).toBe(true); + expect($to.hasClass('_has-datepicker')).toBe(true); + $dateRange.dateRange('destroy'); + expect($dateRange.is(':mage-dateRange')).toBe(false); + expect($from.hasClass('_has-datepicker')).toBe(false); + expect($to.hasClass('_has-datepicker')).toBe(false); + }); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js b/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js new file mode 100644 index 0000000000000..d6c95d2887ec7 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js @@ -0,0 +1,211 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* eslint-disable max-nested-callbacks */ +/* jscs:disable jsDoc */ + +define([ + 'jquery', + 'jquery/ui', + 'mage/collapsible' +], function ($) { + 'use strict'; + + describe('Test for mage/collapsible jQuery plugin', function () { + it('check if collapsible can be initialized and destroyed', function () { + var group = $('
    '); + + group.collapsible(); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + group.remove(); + }); + + describe('Test enable, disable, activate and deactivate methods', function () { + var group = $('
    '), + content = $('
    ').appendTo(group); + + $('
    ').prependTo(group); + + beforeEach(function () { + group.appendTo('body'); + }); + + afterEach(function () { + group.remove(); + }); + + it('check enable and disable methods', function () { + group.collapsible(); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + group.collapsible('disable'); + expect(content.is(':hidden')).toBeTruthy(); + + group.collapsible('enable'); + expect(content.is(':visible')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + }); + + it('check activate and deactivate methods', function () { + group.collapsible(); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + group.collapsible('deactivate'); + expect(content.is(':hidden')).toBeTruthy(); + + group.collapsible('activate'); + expect(content.is(':visible')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + }); + }); + + it('check if the widget gets expanded/collapsed when the title is clicked', function () { + var group = $('
    '), + title = $('
    ').appendTo(group), + content = $('
    ').appendTo(group); + + group.appendTo('body'); + + group.collapsible(); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + group.collapsible('deactivate'); + expect(content.is(':hidden')).toBeTruthy(); + + title.trigger('click'); + expect(content.is(':visible')).toBeTruthy(); + + title.trigger('click'); + expect(content.is(':hidden')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + group.remove(); + }); + + it('check state classes', function () { + var group = $('
    '), + title = $('
    ').appendTo(group); + + $('
    ').appendTo(group); + + group.appendTo('body'); + + group.collapsible({ + openedState: 'opened', + closedState: 'closed', + disabledState: 'disabled' + }); + expect(group.is(':mage-collapsible')).toBeTruthy(); + expect(group.hasClass('closed')).toBeTruthy(); + + title.trigger('click'); + expect(group.hasClass('opened')).toBeTruthy(); + + group.collapsible('disable'); + expect(group.hasClass('disabled')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + group.remove(); + }); + + it('check if icons are added to title when initialized and removed when destroyed', function () { + var group = $('
    '), + title = $('
    ').appendTo(group); + + $('
    ').appendTo(group); + + group.appendTo('body'); + + group.collapsible({ + icons: { + header: 'minus', + activeHeader: 'plus' + } + }); + expect(group.is(':mage-collapsible')).toBeTruthy(); + expect(title.children('[data-role=icons]').length).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + expect(title.children('[data-role=icons]').length).toBeFalsy(); + group.remove(); + }); + + it('check if icon classes are changed when content gets expanded/collapsed', function () { + var group = $('
    '), + title = $('
    ').appendTo(group), + content = $('
    ').appendTo(group), + icons; + + group.appendTo('body'); + + group.collapsible({ + icons: { + header: 'minus', + activeHeader: 'plus' + } + }); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + icons = group.collapsible('option', 'icons'); + group.collapsible('deactivate'); + expect(content.is(':hidden')).toBeTruthy(); + expect(title.children('[data-role=icons]').hasClass(icons.header)).toBeTruthy(); + + title.trigger('click'); + expect(title.children('[data-role=icons]').hasClass(icons.activeHeader)).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + group.remove(); + }); + + it('check if content gets updated via Ajax when title is clicked', function () { + var group = $('
    '), + title = $('
    ').appendTo(group), + content = $('
    ').appendTo(group); + + $('').appendTo(group); + + $.get = jasmine.createSpy().and.callFake(function () { + var d = $.Deferred(); + + d.promise().success = function () { + }; + + d.promise().complete = function () { + }; + + return d.promise(); + }); + + group.appendTo('body'); + + group.collapsible({ + ajaxContent: true + }); + expect(group.is(':mage-collapsible')).toBeTruthy(); + + group.collapsible('deactivate'); + expect(content.is(':hidden')).toBeTruthy(); + expect(content.children('p').length).toBeFalsy(); + + title.trigger('click'); + expect(content.children('p')).toBeTruthy(); + + group.collapsible('destroy'); + expect(group.is(':mage-collapsible')).toBeFalsy(); + group.remove(); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js b/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js new file mode 100644 index 0000000000000..898bcf8b51128 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js @@ -0,0 +1,201 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'mage/decorate', + 'jquery' +], function (decorate, $) { + 'use strict'; + + describe('mage/decorate', function () { + describe('"list" method', function () { + var listId = 'testList'; + + beforeEach(function () { + var list = $('
    '); + + $('body').append(list); + }); + + afterEach(function () { + $('#' + listId).remove(); + }); + + it('Check correct class decoration', function () { + var $list = $('#' + listId); + + $list.decorate('list'); + expect($list.find('li:first').hasClass('first')).toBe(false); + expect($list.find('li:first').hasClass('odd')).toBe(true); + expect($list.find('li:last').hasClass('last')).toBe(true); + expect($list.find('li:odd').hasClass('even')).toBe(true); + expect($list.find('li:even').hasClass('odd')).toBe(true); + }); + }); + + describe('"generic" method', function () { + var listId = 'testList'; + + beforeEach(function () { + var list = $('
    '); + + $('body').append(list); + }); + + afterEach(function () { + $('#' + listId).remove(); + }); + + it('Check correct class decoration with default params', function () { + var $list = $('#' + listId); + + $list.find('li').decorate('generic'); + expect($list.find('li:first').hasClass('first')).toBe(true); + expect($list.find('li:first').hasClass('odd')).toBe(true); + expect($list.find('li:last').hasClass('last')).toBe(true); + expect($list.find('li:odd').hasClass('even')).toBe(true); + expect($list.find('li:even').hasClass('odd')).toBe(true); + }); + + it('Check correct class decoration with custom params', function () { + var $list = $('#' + listId); + + $list.find('li').decorate('generic', ['last', 'first']); + expect($list.find('li:first').hasClass('first')).toBe(true); + expect($list.find('li:first').hasClass('odd')).toBe(false); + expect($list.find('li:last').hasClass('last')).toBe(true); + expect($list.find('li:odd').hasClass('even')).toBe(false); + expect($list.find('li:even').hasClass('odd')).toBe(false); + }); + + it('Check correct class decoration with empty items', function () { + var $list = $('#' + listId); + + $list.find('span').decorate('generic', ['last', 'first']); + expect($list.find('li:first').hasClass('first')).toBe(false); + expect($list.find('li:first').hasClass('odd')).toBe(false); + expect($list.find('li:last').hasClass('last')).toBe(false); + expect($list.find('li:odd').hasClass('even')).toBe(false); + expect($list.find('li:even').hasClass('odd')).toBe(false); + }); + }); + + describe('"table" method', function () { + var tableId = 'testTable'; + + beforeEach(function () { + var table = $('' + + '' + + '' + + '' + + '' + + '' + + '>' + + '' + + '
    '); + + $('body').append(table); + }); + + afterEach(function () { + $('#' + tableId).remove(); + }); + + it('Check correct class decoration with default params', function () { + var $table = $('#' + tableId); + + $table.decorate('table'); + expect($table.find('tbody tr:first').hasClass('first')).toBe(true); + expect($table.find('tbody tr:first').hasClass('odd')).toBe(true); + expect($table.find('tbody tr:odd').hasClass('even')).toBe(true); + expect($table.find('tbody tr:even').hasClass('odd')).toBe(true); + expect($table.find('tbody tr:last').hasClass('last')).toBe(true); + expect($table.find('thead tr:first').hasClass('first')).toBe(true); + expect($table.find('thead tr:last').hasClass('last')).toBe(true); + expect($table.find('tfoot tr:first').hasClass('first')).toBe(true); + expect($table.find('tfoot tr:last').hasClass('last')).toBe(true); + expect($table.find('tr td:last').hasClass('last')).toBe(true); + expect($table.find('tr td:first').hasClass('first')).toBe(false); + }); + + it('Check correct class decoration with custom params', function () { + var $table = $('#' + tableId); + + $table.decorate('table', { + 'tbody': ['first'], + 'tbody tr': ['first'], + 'thead tr': ['first'], + 'tfoot tr': ['last'], + 'tr td': ['first'] + }); + expect($table.find('tbody:first').hasClass('first')).toBe(true); + expect($table.find('tbody tr:first').hasClass('first')).toBe(true); + expect($table.find('tbody tr:first').hasClass('odd')).toBe(false); + expect($table.find('tbody tr:odd').hasClass('even')).toBe(false); + expect($table.find('tbody tr:even').hasClass('odd')).toBe(false); + expect($table.find('tbody tr:last').hasClass('last')).toBe(false); + expect($table.find('thead tr:first').hasClass('first')).toBe(true); + expect($table.find('thead tr:last').hasClass('last')).toBe(false); + expect($table.find('tfoot tr:first').hasClass('first')).toBe(false); + expect($table.find('tfoot tr:last').hasClass('last')).toBe(true); + expect($table.find('tr td:last').hasClass('last')).toBe(false); + expect($table.find('tr td:first').hasClass('first')).toBe(true); + }); + }); + + describe('"dataList" method', function () { + var listId = 'testDataList'; + + beforeEach(function () { + var list = $('
    '); + + $('body').append(list); + }); + + afterEach(function () { + $('#' + listId).remove(); + }); + + it('Check correct class decoration', function () { + var $list = $('#' + listId); + + $list.decorate('dataList'); + expect($list.find('dt:first').hasClass('first')).toBe(false); + expect($list.find('dt:first').hasClass('odd')).toBe(true); + expect($list.find('dt:odd').hasClass('even')).toBe(true); + expect($list.find('dt:even').hasClass('odd')).toBe(true); + expect($list.find('dt:last').hasClass('last')).toBe(true); + expect($list.find('dd:first').hasClass('first')).toBe(false); + expect($list.find('dd:first').hasClass('odd')).toBe(true); + expect($list.find('dd:odd').hasClass('even')).toBe(true); + expect($list.find('dd:even').hasClass('odd')).toBe(true); + expect($list.find('dd:last').hasClass('last')).toBe(true); + }); + }); + + describe('Call decorate with fake method', function () { + var listId = 'testDataList'; + + beforeEach(function () { + var list = $('
    '); + + $('body').append(list); + }); + + afterEach(function () { + $('#' + listId).remove(); + }); + + it('Check error message', function () { + var $list = $('#' + listId); + + spyOn($, 'error'); + $list.decorate('customMethod'); + expect($.error).toHaveBeenCalledWith('Method customMethod does not exist on jQuery.decorate'); + }); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js b/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js new file mode 100644 index 0000000000000..1d149efe040e0 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js @@ -0,0 +1,357 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* eslint-disable max-nested-callbacks */ + +define([ + 'jquery', + 'mage/dropdown' +], function ($) { + 'use strict'; + + describe('Test for mage/dropdown jQuery plugin', function () { + it('check if dialog opens when the triggerEvent is triggered', function () { + var opener = $('
    '), + dialog = $('
    '); + + dialog.dropdownDialog({ + 'triggerEvent': 'click', + 'triggerTarget': opener + }); + + opener.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'triggerEvent': null, + 'triggerTarget': opener + }); + + opener.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeFalsy(); + dialog.dropdownDialog('destroy'); + }); + + it('check if a specified class is added to the trigger', function () { + var opener = $('
    '), + dialog = $('
    '); + + dialog.dropdownDialog({ + 'triggerClass': 'active', + 'triggerTarget': opener + }); + + dialog.dropdownDialog('open'); + expect(opener.hasClass('active')).toBeTruthy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'triggerClass': null, + 'triggerTarget': opener + }); + + dialog.dropdownDialog('open'); + expect(opener.hasClass('active')).toBeFalsy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + }); + + it('check if a specified class is added to the element which the dialog appends to', function () { + var parent = $('
    '), + dialog = $('
    '); + + dialog.dropdownDialog({ + 'parentClass': 'active', + 'appendTo': parent + }); + + dialog.dropdownDialog('open'); + expect(parent.hasClass('active')).toBeTruthy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'parentClass': null, + 'appendTo': parent + }); + + dialog.dropdownDialog('open'); + expect(parent.hasClass('active')).toBeFalsy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + }); + + it('check if a specified class is added to the element that becomes dialog', function () { + var dialog = $('
    '), + content; + + dialog.dropdownDialog({ + 'dialogContentClass': 'active' + }); + + content = $('.ui-dialog-content'); + dialog.dropdownDialog('open'); + expect(content.hasClass('active')).toBeTruthy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'dialogContentClass': null + }); + + dialog.dropdownDialog('open'); + expect(content.hasClass('active')).toBeFalsy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + }); + + it('check if a specified class is added to dialog', function () { + var dialog = $('
    '), + uiClass = '.ui-dialog', + ui; + + dialog.dropdownDialog({ + 'defaultDialogClass': 'custom' + }); + + ui = $(uiClass); + expect(ui.hasClass('custom')).toBeTruthy(); + expect(ui.hasClass('mage-dropdown-dialog')).toBeFalsy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({}); + ui = $(uiClass); + expect(ui.hasClass('mage-dropdown-dialog')).toBeTruthy(); + + dialog.dropdownDialog('destroy'); + }); + + it('check if the specified trigger actually opens the dialog', function () { + var opener = $('
    '), + dialog = $('
    '); + + dialog.dropdownDialog({ + 'triggerTarget': opener + }); + + opener.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + + dialog.dropdownDialog('close'); + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'triggerTarget': null + }); + + opener.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeFalsy(); + + dialog.dropdownDialog('destroy'); + }); + + it('check if the dialog gets closed when clicking outside of it', function () { + var container = $('
    '), + outside = $('
    ').attr('id', 'outside').appendTo(container), + dialog = $('
    ').attr('id', 'dialog').appendTo(container); + + container.appendTo('body'); + + dialog.dropdownDialog({ + 'closeOnClickOutside': true + }); + + dialog.dropdownDialog('open'); + outside.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeFalsy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'closeOnClickOutside': false + }); + + dialog.dropdownDialog('open'); + outside.trigger('click'); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + + dialog.dropdownDialog('destroy'); + }); + + it('check if the dialog gets closed when mouse leaves the dialog area', function () { + var container = $('
    '), + dialog = $('
    ').attr('id', 'dialog').appendTo(container); + + $('
    ').attr('id', 'outside').appendTo(container); + $('
    ').attr('id', 'opener').appendTo(container); + + container.appendTo('body'); + + jasmine.clock().install(); + + dialog.dropdownDialog({ + 'closeOnMouseLeave': true + }); + + dialog.dropdownDialog('open'); + dialog.trigger('mouseenter'); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + + dialog.trigger('mouseleave'); + + jasmine.clock().tick(10); + + expect(dialog.dropdownDialog('isOpen')).toBeFalsy(); + dialog.dropdownDialog('destroy'); + + jasmine.clock().uninstall(); + }); + + it('check if the dialog does not close when mouse leaves the dialog area', function () { + var container = $('
    '), + dialog = $('
    ').attr('id', 'dialog').appendTo(container); + + $('
    ').attr('id', 'outside').appendTo(container); + $('
    ').attr('id', 'opener').appendTo(container); + + container.appendTo('body'); + + jasmine.clock().install(); + + dialog.dropdownDialog({ + 'closeOnMouseLeave': false + }); + + dialog.dropdownDialog('open'); + dialog.trigger('mouseenter'); + dialog.trigger('mouseleave'); + jasmine.clock().tick(10); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + dialog.dropdownDialog('destroy'); + + jasmine.clock().uninstall(); + }); + + it('check if the dialog gets closed with the specified delay', function (done) { + var container = $('
    '), + dialog = $('
    ').attr('id', 'dialog').appendTo(container); + + $('
    ').attr('id', 'outside').appendTo(container); + $('
    ').attr('id', 'opener').appendTo(container); + + container.appendTo('body'); + + dialog.dropdownDialog({ + 'timeout': 5 + }); + + dialog.dropdownDialog('open'); + dialog.trigger('mouseenter'); + dialog.trigger('mouseleave'); + expect(dialog.dropdownDialog('isOpen')).toBeTruthy(); + + setTimeout(function () { + expect(dialog.dropdownDialog('isOpen')).toBeFalsy(); + dialog.dropdownDialog('destroy'); + done(); + }, 6); + }); + + /* + * jQuery ui version 1.9.2 belongs to the adminhtml. + * + * This test will fail on backend since backend's jquery.ui will + * add ui-dialog-titlebar class anyway on create. + */ + if ($.ui.version !== '1.9.2') { + it('check if the title bar is prevented from being created', function () { + var dialog = $('
    '), + uiClass = '.ui-dialog', + ui; + + dialog.dropdownDialog({ + 'createTitleBar': true + }); + + ui = $(uiClass); + expect(ui.find('.ui-dialog-titlebar').length > 0).toBeTruthy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'createTitleBar': false + }); + + ui = $(uiClass); + expect(ui.find('.ui-dialog-titlebar').length <= 0).toBeTruthy(); + + dialog.dropdownDialog('destroy'); + }); + } + + it('check if the position function gets disabled', function () { + var dialog = $('
    '), + uiClass = '.ui-dialog', + ui; + + dialog.dropdownDialog({ + 'autoPosition': false + }); + + ui = $(uiClass); + dialog.dropdownDialog('open'); + expect(ui.css('top') === 'auto').toBeTruthy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'autoPosition': true + }); + + ui = $(uiClass); + dialog.dropdownDialog('open'); + expect(ui.css('top') !== '0px').toBeTruthy(); + + dialog.dropdownDialog('destroy'); + }); + + it('check if the size function gets disabled', function () { + var dialog = $('
    '), + uiClass = '.ui-dialog', + ui; + + dialog.dropdownDialog({ + 'autoSize': true, + 'width': '300' + }); + + ui = $(uiClass); + dialog.dropdownDialog('open'); + expect(ui.css('width') === '300px').toBeTruthy(); + + dialog.dropdownDialog('destroy'); + + dialog.dropdownDialog({ + 'autoSize': false, + 'width': '300' + }); + + ui = $(uiClass); + dialog.dropdownDialog('open'); + expect(ui.css('width') === '300px').toBeFalsy(); + + dialog.dropdownDialog('destroy'); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/form.test.js b/dev/tests/js/jasmine/tests/lib/mage/form.test.js new file mode 100644 index 0000000000000..6202f93da999a --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/form.test.js @@ -0,0 +1,262 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* eslint-disable max-nested-callbacks */ +/* jscs:disable jsDoc */ + +define([ + 'jquery', + 'mage/backend/form' +], function ($) { + 'use strict'; + + /* + * jQuery ui version 1.9.2 belongs to the adminhtml. + * + * This test will fail on frontend since mage/backend/form only belongs to backend. + */ + if ($.ui.version === '1.9.2') { + describe('Test for mage/form jQuery plugin', function () { + var id = 'edit_form', + elementId = '#' + id; + + beforeEach(function () { + var element = $('
    '); + + element.appendTo('body'); + }); + + afterEach(function () { + $(elementId).remove(); + }); + + it('check if form can be initialized', function () { + var form = $(elementId).form(); + + expect(form.is(':mage-form')).toBeTruthy(); + }); + + it('check get handlers', function () { + var form = $(elementId).form(), + handlersData = form.form('option', 'handlersData'), + handlers = []; + + $.each(handlersData, function (key) { + handlers.push(key); + }); + expect(handlers.join(' ')).toBe(form.data('form')._getHandlers().join(' ')); + }); + + it('check store attribute', function () { + var form = $(elementId).form(), + initialFormAttrs = { + action: form.attr('action'), + target: form.attr('target'), + method: form.attr('method') + }; + + form.data('form')._storeAttribute('action'); + form.data('form')._storeAttribute('target'); + form.data('form')._storeAttribute('method'); + + expect(form.data('form').oldAttributes.action).toBe(initialFormAttrs.action); + expect(form.data('form').oldAttributes.target).toBe(initialFormAttrs.target); + expect(form.data('form').oldAttributes.method).toBe(initialFormAttrs.method); + }); + + it('check bind', function () { + var form = $(elementId).form(), + submitted = false, + handlersData = form.form('option', 'handlersData'); + + form.on('submit', function (e) { + submitted = true; + e.stopImmediatePropagation(); + e.preventDefault(); + }); + + $.each(handlersData, function (key) { + form.trigger(key); + expect(submitted).toBeTruthy(); + submitted = false; + }); + + form.off('submit'); + }); + + it('check get action URL', function () { + var form = $(elementId).form(), + action = form.attr('action'), + testUrl = 'new/action/url', + testArgs = { + args: { + arg: 'value' + } + }; + + form.data('form')._storeAttribute('action'); + expect(form.data('form')._getActionUrl(testArgs)).toBe(action + '/arg/value/'); + expect(form.data('form')._getActionUrl(testUrl)).toBe(testUrl); + expect(form.data('form')._getActionUrl()).toBe(action); + }); + + it('check process data', function () { + var form = $(elementId).form(), + initialFormAttrs = { + action: form.attr('action'), + target: form.attr('target'), + method: form.attr('method') + }, + testSimpleData = { + action: 'new/action/url', + target: '_blank', + method: 'POST' + }, + testActionArgsData = { + action: { + args: { + arg: 'value' + } + } + }, + processedData = form.data('form')._processData(testSimpleData); + + expect(form.data('form').oldAttributes.action).toBe(initialFormAttrs.action); + expect(form.data('form').oldAttributes.target).toBe(initialFormAttrs.target); + expect(form.data('form').oldAttributes.method).toBe(initialFormAttrs.method); + expect(processedData.action).toBe(testSimpleData.action); + expect(processedData.target).toBe(testSimpleData.target); + expect(processedData.method).toBe(testSimpleData.method); + + form.data('form')._rollback(); + processedData = form.data('form')._processData(testActionArgsData); + form.data('form')._storeAttribute('action'); + expect(processedData.action).toBe(form.data('form')._getActionUrl(testActionArgsData.action)); + }); + + it('check before submit', function () { + var testForm = $('
    ').appendTo('body'), + testHandler = { + action: { + args: { + arg1: 'value1' + } + } + }, + form = $(elementId).form({ + handlersData: { + testHandler: testHandler + } + }), + beforeSubmitData = { + action: { + args: { + arg2: 'value2' + } + }, + target: '_blank' + }, + eventData = { + method: 'POST' + }, + resultData = $.extend(true, {}, testHandler, beforeSubmitData, eventData); + + form.data('form')._storeAttribute('action'); + resultData = form.data('form')._processData(resultData); + testForm.prop(resultData); + + form.on('beforeSubmit', function (e, data) { + $.extend(data, beforeSubmitData); + }); + + form.on('submit', function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + }); + + form.data('form')._beforeSubmit('testHandler', eventData); + expect(testForm.prop('action')).toBe(form.prop('action')); + expect(testForm.prop('target')).toBe(form.prop('target')); + expect(testForm.prop('method')).toBe(form.prop('method')); + }); + + it('check submit', function () { + var formSubmitted = false, + form = $(elementId).form({ + handlersData: { + save: {} + } + }); + + form.data('form')._storeAttribute('action'); + form.data('form')._storeAttribute('target'); + form.data('form')._storeAttribute('method'); + + form.on('submit', function (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + e.preventDefault(); + formSubmitted = true; + }).prop({ + action: 'new/action/url', + target: '_blank', + method: 'POST' + }); + + form.data('form')._submit({ + type: 'save' + }); + + expect(form.attr('action')).toBe(form.data('form').oldAttributes.action); + expect(form.attr('target')).toBe(form.data('form').oldAttributes.target); + expect(form.attr('method')).toBe(form.data('form').oldAttributes.method); + expect(formSubmitted).toBeTruthy(); + + form.off('submit'); + }); + + it('check build URL', function () { + var dataProvider = [ + { + params: ['http://domain.com//', { + 'key[one]': 'value 1', + 'key2': '# value' + }], + expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/' + }, + { + params: ['http://domain.com', { + 'key[one]': 'value 1', + 'key2': '# value' + }], + expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/' + }, + { + params: ['http://domain.com?some=param', { + 'key[one]': 'value 1', + 'key2': '# value' + }], + expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value' + }, + { + params: ['http://domain.com?some=param&', { + 'key[one]': 'value 1', + 'key2': '# value' + }], + expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value' + } + ], + method = $.mage.form._proto._buildURL, + quantity = dataProvider.length, + i = 0; + + expect(quantity).toBeTruthy(); + + for (i; i < quantity; i++) { + expect(dataProvider[i].expected).toBe(method.apply(null, dataProvider[i].params)); + } + }); + }); + } +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/loader.test.js b/dev/tests/js/jasmine/tests/lib/mage/loader.test.js new file mode 100644 index 0000000000000..93dd2ee91902c --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/loader.test.js @@ -0,0 +1,79 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/loader' +], function ($) { + 'use strict'; + + describe('mage/loader', function () { + describe('Check loader', function () { + var loaderSelector = '#loader'; + + beforeEach(function () { + var $loader = $('
    '); + + $('body').append($loader); + }); + + afterEach(function () { + $(loaderSelector).remove(); + $(loaderSelector).loader('destroy'); + }); + + it('Check that loader inited', function () { + var $loader = $(loaderSelector).loader({ + icon: 'icon.gif' + }); + + $loader.loader('show'); + + expect($loader.is(':mage-loader')).toBe(true); + expect($loader.find('p').text()).toBe('Please wait...'); + expect($loader.find('img').prop('src').split('/').pop()).toBe('icon.gif'); + expect($loader.find('img').prop('alt')).toBe('Loading...'); + }); + + it('Body init', function () { + var $loader = $('body').loader(); + + $loader.loader('show'); + + expect($loader.is(':mage-loader')).toBe(true); + $loader.loader('destroy'); + }); + + it('Check show/hide', function () { + var $loader = $(loaderSelector).loader(), + $loadingMask; + + $loader.loader('show'); + $loadingMask = $('.loading-mask'); + expect($loadingMask.is(':visible')).toBe(true); + + $loader.loader('hide'); + expect($loadingMask.is(':hidden')).toBe(true); + + $loader.loader('show'); + $loader.trigger('processStop'); + expect($loadingMask.is(':hidden')).toBe(true); + }); + + it('Check destroy', function () { + var $loader = $(loaderSelector).loader(), + $loadingMask; + + $loader.loader('show'); + $loadingMask = $('.loading-mask'); + expect($loadingMask.is(':visible')).toBe(true); + + $loader.loader('destroy'); + expect($loadingMask.is(':visible')).toBe(false); + }); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/menu.test.js b/dev/tests/js/jasmine/tests/lib/mage/menu.test.js new file mode 100644 index 0000000000000..69d8af4ff3dba --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/menu.test.js @@ -0,0 +1,110 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/menu', + 'text!tests/assets/lib/web/mage/menu.html' +], function ($, menu, menuTmpl) { + 'use strict'; + + describe('mage/menu', function () { + describe('Menu expanded', function () { + var menuSelector = '#menu'; + + beforeEach(function () { + var $menu = $(menuTmpl); + + $('body').append($menu); + }); + + afterEach(function () { + $(menuSelector).remove(); + }); + + it('Check that menu expanded', function () { + var $menu = $(menuSelector), + $menuItems = $menu.find('li'), + $submenu = $menuItems.find('ul'); + + menu.menu({ + expanded: true + }, $menu); + expect($submenu.hasClass('expanded')).toBe(true); + }); + }); + + describe('Menu hover event', function () { + var menuSelector = '#menu', + $menu; + + beforeEach(function () { + var $menuObject = $(menuTmpl); + + $('body').append($menuObject); + $menu = $(menuSelector).menu({ + delay: 0, + showDelay: 0, + hideDelay: 0 + }); + }); + + afterEach(function () { + $(menuSelector).remove(); + }); + + it('Check that menu expanded', function (done) { + var $menuItem = $menu.find('li.test-menu-item'), + $submenu = $menuItem.find('ul'); + + $menuItem.trigger('mouseover'); + setTimeout(function () { + expect($submenu.attr('aria-expanded')).toBe('true'); + $menuItem.trigger('mouseout'); + setTimeout(function () { + expect($submenu.attr('aria-expanded')).toBe('false'); + done(); + }, 300); + }, 300); + }); + }); + + describe('Menu navigation', function () { + var menuSelector = '#menu', + $menu; + + beforeEach(function () { + var $menuObject = $(menuTmpl); + + $('body').append($menuObject); + $menu = $(menuSelector).menu(); + }); + + afterEach(function () { + $(menuSelector).remove(); + }); + + it('Check max item limit', function () { + var $menuItems; + + $menu.navigation({ + maxItems: 3 + }); + $menuItems = $menu.find('li:visible'); + + expect($menuItems.length).toBe(4); + }); + + it('Check that More Menu item will be added', function () { + $menu.navigation({ + responsive: 'onResize' + }); + + expect($('body').find('.ui-menu-more').length).toBeGreaterThan(0); + }); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js b/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js new file mode 100644 index 0000000000000..a6138df073434 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js @@ -0,0 +1,93 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'jquery/ui', + 'mage/tabs', + 'text!tests/assets/lib/web/mage/tabs.html' +], function ($, ui, tabs, tabsTmpl) { + 'use strict'; + + describe('mage/tabs', function () { + var tabsSelector = '#tabs'; + + beforeEach(function () { + var $tabs = $(tabsTmpl); + + $('body').append($tabs); + }); + + afterEach(function () { + $(tabsSelector).remove(); + $(tabsSelector).tabs('destroy'); + }); + + it('Check tabs inited', function () { + var $tabs = $(tabsSelector).tabs(); + + expect($tabs.is(':mage-tabs')).toBe(true); + }); + + it('Check tabs collapsible inited', function () { + var $title1 = $('#title1'), + $title2 = $('#title2'); + + $(tabsSelector).tabs(); + + expect($title1.is(':mage-collapsible')).toBe(true); + expect($title2.is(':mage-collapsible')).toBe(true); + }); + + it('Check tabs active', function () { + var $content1 = $('#content1'), + $content2 = $('#content2'); + + $(tabsSelector).tabs({ + active: 1 + }); + + expect($content1.is(':hidden')).toBe(true); + expect($content2.is(':visible')).toBe(true); + }); + + it('Check tabs closing others tabs when one gets activated', function () { + var $title2 = $('#title2'), + $content1 = $('#content1'), + $content2 = $('#content2'); + + $(tabsSelector).tabs(); + + expect($content1.is(':visible')).toBe(true); + expect($content2.is(':hidden')).toBe(true); + + $title2.trigger('click'); + + expect($content1.is(':hidden')).toBe(true); + expect($content2.is(':visible')).toBe(true); + }); + + it('Check tabs enable,disable,activate,deactivate options', function () { + var $title1 = $('#title1'), + $content1 = $('#content1'), + $tabs = $(tabsSelector).tabs(); + + expect($content1.is(':visible')).toBe(true); + $tabs.tabs('deactivate', 0); + expect($content1.is(':hidden')).toBe(true); + $tabs.tabs('activate', 0); + expect($content1.is(':visible')).toBe(true); + $tabs.tabs('disable', 0); + expect($content1.is(':hidden')).toBe(true); + $title1.trigger('click'); + expect($content1.is(':hidden')).toBe(true); + $tabs.tabs('enable', 0); + expect($content1.is(':visible')).toBe(true); + $title1.trigger('click'); + expect($content1.is(':visible')).toBe(true); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js b/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js new file mode 100644 index 0000000000000..bcdfc4cc59705 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js @@ -0,0 +1,111 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/translate-inline', + 'text!tests/assets/lib/web/mage/translate-inline.html' +], function ($, TranslateInline, translateTmpl) { + 'use strict'; + + describe('mage/translate-inline', function () { + describe('Check translate', function () { + var translateSelector = '[data-role="translate-dialog"]', + translateTemplateSelector = '#translate-form-template'; + + beforeEach(function () { + var translateBlock = $(translateTmpl); + + $('body').append(translateBlock); + }); + + afterEach(function () { + $(translateSelector).remove(); + $(translateSelector).translateInline('destroy'); + $(translateTemplateSelector).remove(); + }); + + it('Check that translate inited', function () { + var translateInline = $(translateSelector).translateInline(); + + expect(translateInline.is(':mage-translateInline')).toBe(true); + }); + + it('Check that translate hidden on init and visible on trigger', function () { + var translateInline = $(translateSelector).translateInline({ + id: 'dialog-id' + }), + isDialogHiddenOnInit = translateInline.is(':hidden'), + dialogVisibleAfterTriggerEdit; + + translateInline.trigger('edit.editTrigger'); + dialogVisibleAfterTriggerEdit = translateInline.is(':visible'); + expect(isDialogHiddenOnInit).toBe(true); + expect(dialogVisibleAfterTriggerEdit).toBe(true); + }); + + it('Check translation form template', function () { + var translateFormId = 'translate-form-id', + translateFormContent = 'New Template Variable', + translateInline = $(translateSelector).translateInline({ + translateForm: { + data: { + id: translateFormId, + newTemplateVariable: translateFormContent + } + } + }), + $translateForm; + + translateInline.trigger('edit.editTrigger'); + $translateForm = $('#' + translateFormId); + + expect($translateForm.length).toBeGreaterThan(0); + expect($translateForm.text()).toBe(translateFormContent); + }); + + it('Check translation submit', function () { + var options = { + ajaxUrl: 'www.test.com', + area: 'test', + translateForm: { + template: '
    ', + data: { + id: 'translate-form-id' + } + } + }, + expectedEequestData = 'area=test&test=test', + translateInline = $(translateSelector).translateInline(options), + $submitButton = $('body').find('.action-primary'), + originalAjax = $.ajax; + + $.ajax = jasmine.createSpy().and.callFake(function (request) { + expect(request.url).toBe(options.ajaxUrl); + expect(request.type).toBe('POST'); + expect(request.data).toBe(expectedEequestData); + + return { + complete: jasmine.createSpy() + }; + }); + + translateInline.trigger('edit.editTrigger'); + $submitButton.trigger('click'); + $.ajax = originalAjax; + }); + + it('Check translation destroy', function () { + var translateInline = $(translateSelector).translateInline(); + + translateInline.trigger('edit.editTrigger'); + expect(translateInline.is(':mage-translateInline')).toBe(true); + translateInline.translateInline('destroy'); + expect(translateInline.is(':mage-translateInline')).toBe(false); + }); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/translate.test.js b/dev/tests/js/jasmine/tests/lib/mage/translate.test.js new file mode 100644 index 0000000000000..c87cfa227c1aa --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/translate.test.js @@ -0,0 +1,49 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* eslint-disable max-nested-callbacks */ +define([ + 'jquery', + 'mage/translate' +], function ($) { + 'use strict'; + + describe('Test for mage/translate jQuery plugin', function () { + it('works with one string as parameter', function () { + $.mage.translate.add('Hello World!'); + expect('Hello World!').toEqual($.mage.translate.translate('Hello World!')); + }); + it('works with one array as parameter', function () { + $.mage.translate.add(['Hello World!', 'Bonjour tout le monde!']); + expect('Hello World!').toEqual($.mage.translate.translate('Hello World!')); + }); + it('works with one object as parameter', function () { + var translation = { + 'Hello World!': 'Bonjour tout le monde!' + }; + + $.mage.translate.add(translation); + expect(translation['Hello World!']).toEqual($.mage.translate.translate('Hello World!')); + + translation = { + 'Hello World!': 'Hallo Welt!', + 'Some text with symbols!-+"%#*': 'Ein Text mit Symbolen!-+"%#*' + }; + + $.mage.translate.add(translation); + $.each(translation, function (key) { + expect(translation[key]).toEqual($.mage.translate.translate(key)); + }); + }); + it('works with two string as parameter', function () { + $.mage.translate.add('Hello World!', 'Bonjour tout le monde!'); + expect('Bonjour tout le monde!').toEqual($.mage.translate.translate('Hello World!')); + }); + it('works with translation alias __', function () { + $.mage.translate.add('Hello World!'); + expect('Hello World!').toEqual($.mage.__('Hello World!')); + }); + }); + +}); diff --git a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js index 50931f940c689..7a0a8d9751e09 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js @@ -183,4 +183,892 @@ define([ )).toEqual(true); }); }); + + describe('Testing validate-no-html-tags', function () { + it('validate-no-html-tags', function () { + expect($.validator.methods['validate-no-html-tags'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-no-html-tags'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-no-html-tags'] + .call($.validator.prototype, 'abc')).toEqual(true); + expect($.validator.methods['validate-no-html-tags'] + .call($.validator.prototype, '
    abc
    ')).toEqual(false); + }); + }); + + describe('Testing allow-container-className', function () { + it('allow-container-className', function () { + var radio = $(''), + checkbox = $(''), + radio2 = $(''), + checkbox2 = $(''); + + expect($.validator.methods['allow-container-className'] + .call($.validator.prototype, radio[0])).toEqual(true); + expect($.validator.methods['allow-container-className'] + .call($.validator.prototype, checkbox[0])).toEqual(true); + expect($.validator.methods['allow-container-className'] + .call($.validator.prototype, radio2[0])).toEqual(false); + expect($.validator.methods['allow-container-className'] + .call($.validator.prototype, checkbox2[0])).toEqual(false); + }); + }); + + describe('Testing validate-select', function () { + it('validate-select', function () { + expect($.validator.methods['validate-select'] + .call($.validator.prototype, '')).toEqual(false); + expect($.validator.methods['validate-select'] + .call($.validator.prototype, 'none')).toEqual(false); + expect($.validator.methods['validate-select'] + .call($.validator.prototype, null)).toEqual(false); + expect($.validator.methods['validate-select'] + .call($.validator.prototype, undefined)).toEqual(false); + expect($.validator.methods['validate-select'] + .call($.validator.prototype, 'abc')).toEqual(true); + }); + }); + + describe('Testing validate-no-empty', function () { + it('validate-no-empty', function () { + expect($.validator.methods['validate-no-empty'] + .call($.validator.prototype, '')).toEqual(false); + expect($.validator.methods['validate-no-empty'] + .call($.validator.prototype, null)).toEqual(false); + expect($.validator.methods['validate-no-empty'] + .call($.validator.prototype, undefined)).toEqual(false); + expect($.validator.methods['validate-no-empty'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-no-empty'] + .call($.validator.prototype, 'test')).toEqual(true); + }); + }); + + describe('Testing validate-alphanum-with-spaces', function () { + it('validate-alphanum-with-spaces', function () { + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, ' ')).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, 'abc ')).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, ' 123 ')).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, ' abc123 ')).toEqual(true); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, ' !@# ')).toEqual(false); + expect($.validator.methods['validate-alphanum-with-spaces'] + .call($.validator.prototype, ' abc.123 ')).toEqual(false); + }); + }); + + describe('Testing validate-phoneStrict', function () { + it('validate-phoneStrict', function () { + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '5121231234')).toEqual(false); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '512.123.1234')).toEqual(false); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '512-123-1234')).toEqual(true); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '(512)123-1234')).toEqual(true); + expect($.validator.methods['validate-phoneStrict'] + .call($.validator.prototype, '(512) 123-1234')).toEqual(true); + }); + }); + + describe('Testing validate-phoneLax', function () { + it('validate-phoneLax', function () { + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '5121231234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '512.123.1234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '512-123-1234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '(512)123-1234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '(512) 123-1234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '(512)1231234')).toEqual(true); + expect($.validator.methods['validate-phoneLax'] + .call($.validator.prototype, '(512)_123_1234')).toEqual(false); + }); + }); + + describe('Testing validate-fax', function () { + it('validate-fax', function () { + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '5121231234')).toEqual(false); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '512.123.1234')).toEqual(false); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '512-123-1234')).toEqual(true); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '(512)123-1234')).toEqual(true); + expect($.validator.methods['validate-fax'] + .call($.validator.prototype, '(512) 123-1234')).toEqual(true); + }); + }); + + describe('Testing validate-email', function () { + it('validate-email', function () { + expect($.validator.methods['validate-email'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, '123@123.com')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc@124.en')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc.abc.abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc.abc-abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc.abc_abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-email'] + .call($.validator.prototype, 'abc.abc_abc@abc')).toEqual(false); + }); + }); + + describe('Testing validate-emailSender', function () { + it('validate-emailSender', function () { + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, ' ')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, '123@123.com')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, 'abc@124.en')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, 'abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, 'abc.abc.abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, 'abc.abc-abc@abc.commmmm')).toEqual(true); + expect($.validator.methods['validate-emailSender'] + .call($.validator.prototype, 'abc.abc_abc@abc.commmmm')).toEqual(true); + }); + }); + + describe('Testing validate-password', function () { + it('validate-password', function () { + expect($.validator.methods['validate-password'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, null)).toEqual(false); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, undefined)).toEqual(false); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, ' ')).toEqual(true); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, '123@123.com')).toEqual(true); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, 'abc')).toEqual(false); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, 'abc ')).toEqual(false); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, ' abc ')).toEqual(false); + expect($.validator.methods['validate-password'] + .call($.validator.prototype, 'dddd')).toEqual(false); + }); + }); + + describe('Testing validate-admin-password', function () { + it('validate-admin-password', function () { + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, null)).toEqual(false); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, undefined)).toEqual(false); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, ' ')).toEqual(true); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, '123@123.com')).toEqual(true); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, 'abc')).toEqual(false); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, 'abc ')).toEqual(false); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, ' abc ')).toEqual(false); + expect($.validator.methods['validate-admin-password'] + .call($.validator.prototype, 'dddd')).toEqual(false); + }); + }); + + describe('Testing validate-url', function () { + it('validate-url', function () { + expect($.validator.methods['validate-url'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, 'http://www.google.com')).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, 'http://127.0.0.1:8080/index.php')).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, 'http://app-spot.com/index.php')).toEqual(true); + expect($.validator.methods['validate-url'] + .call($.validator.prototype, 'http://app-spot_space.com/index.php')).toEqual(true); + }); + }); + + describe('Testing validate-clean-url', function () { + it('validate-clean-url', function () { + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, 'http://www.google.com')).toEqual(true); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, 'http://127.0.0.1:8080/index.php')).toEqual(false); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, 'http://127.0.0.1:8080')).toEqual(false); + expect($.validator.methods['validate-clean-url'] + .call($.validator.prototype, 'http://127.0.0.1')).toEqual(false); + }); + }); + + describe('Testing validate-xml-identifier', function () { + it('validate-xml-identifier', function () { + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, 'abc')).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, 'abc_123')).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, 'abc-123')).toEqual(true); + expect($.validator.methods['validate-xml-identifier'] + .call($.validator.prototype, '123-abc')).toEqual(false); + }); + }); + + describe('Testing validate-ssn', function () { + it('validate-ssn', function () { + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, 'abc')).toEqual(false); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, '123-13-1234')).toEqual(true); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, '012-12-1234')).toEqual(true); + expect($.validator.methods['validate-ssn'] + .call($.validator.prototype, '23-12-1234')).toEqual(false); + }); + }); + + describe('Testing validate-zip-us', function () { + it('validate-zip-us', function () { + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, '12345-1234')).toEqual(true); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, '02345')).toEqual(true); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, '1234')).toEqual(false); + expect($.validator.methods['validate-zip-us'] + .call($.validator.prototype, '1234-1234')).toEqual(false); + }); + }); + + describe('Testing validate-date-au', function () { + it('validate-date-au', function () { + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, '01/01/2012')).toEqual(true); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, '30/01/2012')).toEqual(true); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, '01/30/2012')).toEqual(false); + expect($.validator.methods['validate-date-au'] + .call($.validator.prototype, '1/1/2012')).toEqual(false); + }); + }); + + describe('Testing validate-currency-dollar', function () { + it('validate-currency-dollar', function () { + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, '$123')).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, '$1,123.00')).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, '$1234')).toEqual(true); + expect($.validator.methods['validate-currency-dollar'] + .call($.validator.prototype, '$1234.1234')).toEqual(false); + }); + }); + + describe('Testing validate-not-negative-number', function () { + it('validate-not-negative-number', function () { + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '0')).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '1')).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '1234')).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '1,234.1234')).toEqual(true); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '-1')).toEqual(false); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '-1e')).toEqual(false); + expect($.validator.methods['validate-not-negative-number'] + .call($.validator.prototype, '-1,234.1234')).toEqual(false); + }); + }); + + describe('Testing validate-greater-than-zero', function () { + it('validate-greater-than-zero', function () { + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '0')).toEqual(false); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '1')).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '1234')).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '1,234.1234')).toEqual(true); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '-1')).toEqual(false); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '-1e')).toEqual(false); + expect($.validator.methods['validate-greater-than-zero'] + .call($.validator.prototype, '-1,234.1234')).toEqual(false); + }); + }); + + describe('Testing validate-css-length', function () { + it('validate-css-length', function () { + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, null)).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, undefined)).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '0')).toEqual(true); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '1')).toEqual(true); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '1234')).toEqual(true); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '1,234.1234')).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '-1')).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '-1e')).toEqual(false); + expect($.validator.methods['validate-css-length'] + .call($.validator.prototype, '-1,234.1234')).toEqual(false); + }); + }); + + describe('Testing validate-data', function () { + it('validate-data', function () { + expect($.validator.methods['validate-data'] + .call($.validator.prototype, '')).toEqual(true); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, null)).toEqual(true); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, undefined)).toEqual(true); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, ' ')).toEqual(false); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, '123abc')).toEqual(false); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, 'abc')).toEqual(true); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, ' abc')).toEqual(false); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, 'abc123')).toEqual(true); + expect($.validator.methods['validate-data'] + .call($.validator.prototype, 'abc-123')).toEqual(false); + }); + }); + + describe('Testing validate-one-required-by-name', function () { + it('validate-one-required-by-name', function () { + var radio = $(''), + radio2 = $(''), + checkbox = $(''), + checkbox2 = $(''), + $test = $('
    '), + prevForm = $.validator.prototype.currentForm; + + $.validator.prototype.currentForm = $test[0]; + + $test.append(radio); + expect($.validator.methods['validate-one-required-by-name'] + .call($.validator.prototype, null, radio[0], true)).toEqual(false); + $test.append(radio2); + expect($.validator.methods['validate-one-required-by-name'] + .call($.validator.prototype, null, radio2[0], true)).toEqual(true); + $test.append(checkbox); + expect($.validator.methods['validate-one-required-by-name'] + .call($.validator.prototype, null, checkbox[0], true)).toEqual(false); + $test.append(checkbox2); + expect($.validator.methods['validate-one-required-by-name'] + .call($.validator.prototype, null, checkbox2[0], true)).toEqual(true); + + $.validator.prototype.currentForm = prevForm; + }); + }); + + describe('Testing less-than-equals-to', function () { + it('less-than-equals-to', function () { + var elm1 = $(''), + elm2 = $(''), + elm3 = $(''), + elm4 = $(''), + elm5 = $(''), + elm6 = $(''), + elm7 = $(''), + elm8 = $(''); + + expect($.validator.methods['less-than-equals-to'] + .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(false); + elm1[0].value = 4; + expect($.validator.methods['less-than-equals-to'] + .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(true); + expect($.validator.methods['less-than-equals-to'] + .call($.validator.prototype, elm3[0].value, elm3, elm4)).toEqual(true); + expect($.validator.methods['less-than-equals-to'] + .call($.validator.prototype, elm5[0].value, elm5, elm6)).toEqual(true); + expect($.validator.methods['less-than-equals-to'] + .call($.validator.prototype, elm7[0].value, elm7, elm8)).toEqual(true); + }); + }); + + describe('Testing greater-than-equals-to', function () { + it('greater-than-equals-to', function () { + var elm1 = $(''), + elm2 = $(''), + elm3 = $(''), + elm4 = $(''), + elm5 = $(''), + elm6 = $(''), + elm7 = $(''), + elm8 = $(''); + + expect($.validator.methods['greater-than-equals-to'] + .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(false); + elm1[0].value = 9; + expect($.validator.methods['greater-than-equals-to'] + .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(true); + expect($.validator.methods['greater-than-equals-to'] + .call($.validator.prototype, elm3[0].value, elm3, elm4)).toEqual(true); + expect($.validator.methods['greater-than-equals-to'] + .call($.validator.prototype, elm5[0].value, elm5, elm6)).toEqual(true); + expect($.validator.methods['greater-than-equals-to'] + .call($.validator.prototype, elm7[0].value, elm7, elm8)).toEqual(true); + }); + }); + + describe('Testing validate-cc-type-select', function () { + it('validate-cc-type-select', function () { + var visaValid = $(''), + visaInvalid = $(''), + mcValid = $(''), + mcInvalid = $(''), + aeValid = $(''), + aeInvalid = $(''), + diValid = $(''), + diInvalid = $(''), + dnValid = $(''), + dnInvalid = $(''), + jcbValid = $(''), + jcbInvalid = $(''); + + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'VI', null, visaValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'VI', null, visaInvalid)).toEqual(false); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'MC', null, mcValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'MC', null, mcInvalid)).toEqual(false); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'AE', null, aeValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'AE', null, aeInvalid)).toEqual(false); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'DI', null, diValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'DI', null, diInvalid)).toEqual(false); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'DN', null, dnValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'DN', null, dnInvalid)).toEqual(false); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'JCB', null, jcbValid)).toEqual(true); + expect($.validator.methods['validate-cc-type-select'] + .call($.validator.prototype, 'JCB', null, jcbInvalid)).toEqual(false); + }); + }); + + describe('Testing validate-cc-number', function () { + it('validate-cc-number', function () { + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '4916835098995909', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '5265071363284878', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011120623356953', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '371293266574617', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '4916835098995901', null, null)).toEqual(false); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '5265071363284870', null, null)).toEqual(false); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011120623356951', null, null)).toEqual(false); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '371293266574619', null, null)).toEqual(false); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '2221220000000003', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '2721220000000008', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601109020000000003', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011111144444444', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011222233334444', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011522233334447', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601174455555553', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6011745555555550', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601177455555556', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601182455555556', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601187999555558', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '601287999555556', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6444444444444443', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6644444444444441', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3044444444444444', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3064444444444449', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3095444444444442', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3096444444444441', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3696444444444445', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3796444444444444', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3896444444444443', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3528444444444449', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '3529444444444448', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6221262244444440', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6229981111111111', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6249981111111117', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6279981111111110', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6282981111111115', null, null)).toEqual(true); + expect($.validator.methods['validate-cc-number'] + .call($.validator.prototype, '6289981111111118', null, null)).toEqual(true); + }); + }); + + describe('Testing validate-cc-type', function () { + it('validate-cc-type', function () { + var select = $(''); + + select.val('VI'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '4916835098995909', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '5265071363284878', null, select)).toEqual(false); + + select.val('MC'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '5265071363284878', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '4916835098995909', null, select)).toEqual(false); + + select.val('AE'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '371293266574617', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '5265071363284878', null, select)).toEqual(false); + + select.val('DI'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '6011050000000009', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '371293266574617', null, select)).toEqual(false); + + select.val('DN'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '3095434000000001', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '6011050000000009', null, select)).toEqual(false); + + select.val('JCB'); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '3528000000000007', null, select)).toEqual(true); + expect($.validator.methods['validate-cc-type'] + .call($.validator.prototype, '3095434000000001', null, select)).toEqual(false); + }); + }); + + describe('Testing validate-cc-exp', function () { + it('validate-cc-exp', function () { + var year = $(''), + currentTime = new Date(), + currentMonth = currentTime.getMonth() + 1, + currentYear = currentTime.getFullYear(); + + year.val(currentYear); + + if (currentMonth > 1) { + expect($.validator.methods['validate-cc-exp'] + .call($.validator.prototype, currentMonth - 1, null, year)).toEqual(false); + } + expect($.validator.methods['validate-cc-exp'] + .call($.validator.prototype, currentMonth, null, year)).toEqual(true); + year.val(currentYear + 1); + expect($.validator.methods['validate-cc-exp'] + .call($.validator.prototype, currentMonth, null, year)).toEqual(true); + }); + }); + + describe('Testing validate-cc-cvn', function () { + it('validate-cc-cvn', function () { + var ccType = $(''); + + ccType.val('VI'); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '123', null, ccType)).toEqual(true); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '1234', null, ccType)).toEqual(false); + + ccType.val('MC'); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '123', null, ccType)).toEqual(true); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '1234', null, ccType)).toEqual(false); + + ccType.val('AE'); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '1234', null, ccType)).toEqual(true); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '123', null, ccType)).toEqual(false); + + ccType.val('DI'); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '123', null, ccType)).toEqual(true); + expect($.validator.methods['validate-cc-cvn'] + .call($.validator.prototype, '1234', null, ccType)).toEqual(false); + }); + }); + + describe('Testing validate-number-range', function () { + it('validate-number-range', function () { + var el1 = $('').get(0); + + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '-1', null, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '1', null, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '', null, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, null, null, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '0', null, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, 'asds', null, null)).toEqual(false); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '10', null, '10-20.06')).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '15', null, '10-20.06')).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '1', null, '10-20.06')).toEqual(false); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '30', null, '10-20.06')).toEqual(false); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '10', el1, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '15', el1, null)).toEqual(true); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '1', el1, null)).toEqual(false); + expect($.validator.methods['validate-number-range'] + .call($.validator.prototype, '30', el1, null)).toEqual(true); + }); + }); + + describe('Testing validate-digits-range', function () { + it('validate-digits-range', function () { + var el1 = $('').get(0); + + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '-1', null, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '1', null, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '', null, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, null, null, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '0', null, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, 'asds', null, null)).toEqual(false); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '10', null, '10-20')).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '15', null, '10-20')).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '1', null, '10-20')).toEqual(false); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '30', null, '10-20')).toEqual(false); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '30', null, '10-20.06')).toEqual(false); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '10', el1, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '15', el1, null)).toEqual(true); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '1', el1, null)).toEqual(false); + expect($.validator.methods['validate-digits-range'] + .call($.validator.prototype, '30', el1, null)).toEqual(false); + }); + }); }); diff --git a/lib/web/jquery/jstree/jquery.jstree.js b/lib/web/jquery/jstree/jquery.jstree.js index e2f6330ba45eb..4671256b4207b 100644 --- a/lib/web/jquery/jstree/jquery.jstree.js +++ b/lib/web/jquery/jstree/jquery.jstree.js @@ -28,7 +28,7 @@ "use strict"; // top wrapper to prevent multiple inclusion (is this OK?) -(function () { if(jQuery && jQuery.jstree) { return; } +(function () { var is_ie6 = false, is_ie7 = false, is_ff2 = false; /* diff --git a/lib/web/mage/collapsible.js b/lib/web/mage/collapsible.js index 0d8cf836c198e..267734605f141 100644 --- a/lib/web/mage/collapsible.js +++ b/lib/web/mage/collapsible.js @@ -243,7 +243,7 @@ define([ }); // For collapsible widget only (not tabs or accordion) - if (this.header.parent().attr('role') != 'presentation') { //eslint-disable-line eqeqeq + if (this.header.parent().attr('role') !== 'presentation') { this.header .parent() .attr('role', 'tablist'); @@ -316,9 +316,9 @@ define([ * Disable. */ disable: function () { + this.options.disabled = true; this._off(this.trigger); this.forceDeactivate(); - this.options.disabled = true; if (this.options.disabledState) { this.element.addClass(this.options.disabledState); @@ -330,12 +330,14 @@ define([ * Enable. */ enable: function () { - this._on(this.trigger, this.events); this.options.disabled = false; + this._on(this.trigger, this.events); + this.forceActivate(); if (this.options.disabledState) { this.element.removeClass(this.options.disabledState); } + this.trigger.attr('tabIndex', 0); }, /** @@ -517,7 +519,7 @@ define([ that = this; if (url) { - this.xhr = $.get({ + that.xhr = $.get({ url: url, dataType: 'html' }, function () { @@ -533,7 +535,8 @@ define([ setTimeout(function () { that.content.html(response); }, 1); - }).complete(function (jqXHR, status) { + }); + that.xhr.complete(function (jqXHR, status) { setTimeout(function () { if (status === 'abort') { that.content.stop(false, true); diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index aaece677a485d..e5c604655101e 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -826,11 +826,13 @@ result = true; range = param; - if (typeof range === 'object') { + if (typeof range === 'string') { m = dataAttrRange.exec(range); if (m) { result = result && $.mage.isBetween(numValue, m[1], m[2]); + } else { + result = false; } } else if (elm && elm.className) { classes = elm.className.split(' '); @@ -877,11 +879,13 @@ result = true; range = param; - if (typeof range === 'object') { + if (typeof range === 'string') { m = dataAttrRange.exec(range); if (m) { result = result && $.mage.isBetween(numValue, m[1], m[2]); + } else { + result = false; } } else if (elm && elm.className) { classes = elm.className.split(' '); From bcaa9b042cb54a2c003e747ba2aef1b548f930dc Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Wed, 24 Jan 2018 21:37:54 +0200 Subject: [PATCH 224/277] MAGETWO-87132: Remove JsTestDriver from Magento codebase --- .../testFromCreateProject/composer.lock | 28 - .../_files/testSkeleton/composer.lock | 12 - .../Model/_files/testSkeleton/composer.lock | 12 - dev/tests/js/JsTestDriver/.gitignore | 3 - .../framework/qunit/qunit-1.14.0.css | 237 -- .../framework/qunit/qunit-1.14.0.js | 2288 ----------------- .../JsTestDriver/framework/requirejs-util.js | 53 - dev/tests/js/JsTestDriver/framework/stub.js | 132 - .../js/JsTestDriver/jsTestDriver.php.dist | 35 - .../js/JsTestDriver/jsTestDriverOrder.php | 25 - dev/tests/js/JsTestDriver/run_js_tests.php | 245 -- .../testsuite/lib/ko/datepicker/datepicker.js | 33 - .../testsuite/lib/ko/datepicker/index.html | 29 - .../testsuite/lib/storage/index.html | 30 - .../testsuite/lib/storage/test-storage.js | 23 - .../testsuite/mage/_demo/index.html | 24 - .../JsTestDriver/testsuite/mage/_demo/test.js | 7 - .../testsuite/mage/button/button-test.js | 21 - .../mage/edit_trigger/edit-trigger-test.js | 117 - .../testsuite/mage/list/index.html | 25 - .../testsuite/mage/list/jquery-list-test.js | 46 - .../JsTestDriver/testsuite/mage/mage-test.js | 9 - .../mage/search/regular-search-test.js | 46 - .../translate-inline-vde-dialog-test.js | 80 - .../translate-inline-vde-test.js | 141 - .../testsuite/mage/webapi-test.js | 121 - .../testsuite/mage/zoom/zoom-test.js | 337 --- 27 files changed, 4159 deletions(-) delete mode 100644 dev/tests/js/JsTestDriver/.gitignore delete mode 100644 dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.css delete mode 100644 dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.js delete mode 100644 dev/tests/js/JsTestDriver/framework/requirejs-util.js delete mode 100644 dev/tests/js/JsTestDriver/framework/stub.js delete mode 100644 dev/tests/js/JsTestDriver/jsTestDriver.php.dist delete mode 100644 dev/tests/js/JsTestDriver/jsTestDriverOrder.php delete mode 100644 dev/tests/js/JsTestDriver/run_js_tests.php delete mode 100644 dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/datepicker.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/index.html delete mode 100644 dev/tests/js/JsTestDriver/testsuite/lib/storage/index.html delete mode 100644 dev/tests/js/JsTestDriver/testsuite/lib/storage/test-storage.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/_demo/index.html delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/_demo/test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/button/button-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/edit_trigger/edit-trigger-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/list/index.html delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/list/jquery-list-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js delete mode 100644 dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock index a94f384ba701b..756542fbdb222 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock @@ -782,34 +782,6 @@ "dev/tests/functional/.gitignore", "dev/tests/functional/.gitignore" ], - [ - "dev/tests/js/JsTestDriver/run_js_tests.php", - "dev/tests/js/JsTestDriver/run_js_tests.php" - ], - [ - "dev/tests/js/JsTestDriver/jsTestDriverOrder.php", - "dev/tests/js/JsTestDriver/jsTestDriverOrder.php" - ], - [ - "dev/tests/js/JsTestDriver/jsTestDriver.php.dist", - "dev/tests/js/JsTestDriver/jsTestDriver.php.dist" - ], - [ - "dev/tests/js/JsTestDriver/framework", - "dev/tests/js/JsTestDriver/framework" - ], - [ - "dev/tests/js/JsTestDriver/testsuite/lib", - "dev/tests/js/JsTestDriver/testsuite/lib" - ], - [ - "dev/tests/js/JsTestDriver/testsuite/mage", - "dev/tests/js/JsTestDriver/testsuite/mage" - ], - [ - "dev/tests/js/JsTestDriver/.gitignore", - "dev/tests/js/JsTestDriver/.gitignore" - ], [ "dev/tests/js/jasmine", "dev/tests/js/jasmine" diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock index f027a2397f97f..48fa6d0d0cd34 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock @@ -775,18 +775,6 @@ "dev/tests/functional/.gitignore", "dev/tests/functional/.gitignore" ], - [ - "dev/tests/js/run_js_tests.php", - "dev/tests/js/run_js_tests.php" - ], - [ - "dev/tests/js/jsTestDriverOrder.php", - "dev/tests/js/jsTestDriverOrder.php" - ], - [ - "dev/tests/js/jsTestDriver.php.dist", - "dev/tests/js/jsTestDriver.php.dist" - ], [ "dev/tests/js/spec", "dev/tests/js/spec" diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock index f027a2397f97f..48fa6d0d0cd34 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock @@ -775,18 +775,6 @@ "dev/tests/functional/.gitignore", "dev/tests/functional/.gitignore" ], - [ - "dev/tests/js/run_js_tests.php", - "dev/tests/js/run_js_tests.php" - ], - [ - "dev/tests/js/jsTestDriverOrder.php", - "dev/tests/js/jsTestDriverOrder.php" - ], - [ - "dev/tests/js/jsTestDriver.php.dist", - "dev/tests/js/jsTestDriver.php.dist" - ], [ "dev/tests/js/spec", "dev/tests/js/spec" diff --git a/dev/tests/js/JsTestDriver/.gitignore b/dev/tests/js/JsTestDriver/.gitignore deleted file mode 100644 index e94f6f277fc54..0000000000000 --- a/dev/tests/js/JsTestDriver/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -test-output/ -jsTestDriver.php -jsTestDriver.conf \ No newline at end of file diff --git a/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.css b/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.css deleted file mode 100644 index 93026e3ba3f6d..0000000000000 --- a/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.css +++ /dev/null @@ -1,237 +0,0 @@ -/*! - * QUnit 1.14.0 - * http://qunitjs.com/ - * - * Copyright 2013 jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2014-01-31T16:40Z - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699A4; - background-color: #0D3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: 400; - - border-radius: 5px 5px 0 0; -} - -#qunit-header a { - text-decoration: none; - color: #C2CCD1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #FFF; -} - -#qunit-testrunner-toolbar label { - display: inline-block; - padding: 0 0.5em 0 0.1em; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #EEE; - overflow: hidden; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2B81AF; - color: #FFF; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - -#qunit-modulefilter-container { - float: right; -} - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #FFF; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #C2CCD1; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests li .runtime { - float: right; - font-size: smaller; -} - -.qunit-assert-list { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #FFF; - - border-radius: 5px; -} - -.qunit-collapsed { - display: none; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: 0.2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 0.5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #E0F2BE; - color: #374E0C; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #FFCACA; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: #000; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - padding: 5px; - background-color: #FFF; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #3C510C; - background-color: #FFF; - border-left: 10px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #FFF; - border-left: 10px solid #EE5757; - white-space: pre; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 5px 5px; -} - -#qunit-tests .fail { color: #000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: #008000; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2B81AF; - background-color: #D2E0E6; - - border-bottom: 1px solid #FFF; -} -#qunit-testresult .module-name { - font-weight: 700; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; - width: 1000px; - height: 1000px; -} diff --git a/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.js b/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.js deleted file mode 100644 index 0e279fde17024..0000000000000 --- a/dev/tests/js/JsTestDriver/framework/qunit/qunit-1.14.0.js +++ /dev/null @@ -1,2288 +0,0 @@ -/*! - * QUnit 1.14.0 - * http://qunitjs.com/ - * - * Copyright 2013 jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2014-01-31T16:40Z - */ - -(function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - setTimeout = window.setTimeout, - clearTimeout = window.clearTimeout, - defined = { - document: typeof window.document !== "undefined", - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** - * Provides a normalized error string, correcting an issue - * with IE 7 (and prior) where Error.prototype.toString is - * not properly implemented - * - * Based on http://es5.github.com/#x15.11.4.4 - * - * @param {String|Error} error - * @return {String} error message - */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** - * Makes a clone of an object using only Array or Object as base, - * and copies over the own enumerable properties. - * - * @param {Object} obj - * @return {Object} New object with only the own properties (recursively). - */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// We use the prototype to distinguish between properties that should -// be exposed as globals (and in exports) and those that shouldn't -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** - * Config object: Maintain internal state - * Later exposed as QUnit.config - * `config` initialized at top of scope - */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // by default, scroll to top of the page when suite is done - scrolltop: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, current, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - if ( urlParams[ current[ 0 ] ] ) { - urlParams[ current[ 0 ] ] = [].concat( urlParams[ current[ 0 ] ], current[ 1 ] ); - } else { - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = []; - if ( urlParams.testNumber ) { - - // Ensure that urlParams.testNumber is an array - urlParams.testNumber = [].concat( urlParams.testNumber ); - for ( i = 0; i < urlParams.testNumber.length; i++ ) { - current = urlParams.testNumber[ i ]; - config.testNumber.push( parseInt( current, 10 ) ); - } - } - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -extend( QUnit, { - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

    " + escapeText( document.title ) + "

    " + - "

    " + - "
    " + - "

    " + - "
      "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
       "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - /* - DEPRECATED: Use multiple tests instead of resetting inside a test. - Use testStart or testDone for custom cleanup. - This method will throw an error in 2.0, and will be removed in 2.1 - */ - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - } - - // Consider: typeof null === object - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Expected:
      " + expected + "
      Result:
      " + actual + "
      Diff:
      " + QUnit.diff( expected, actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Result:
      " + escapeText( actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( hasOwn.call( params, key ) ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - } - return window.location.protocol + "//" + window.location.host + - window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent, - addClass: addClass, - hasClass: hasClass, - removeClass: removeClass - // load, equiv, jsDump, diff: Attached later -}); - -/** - * @deprecated: Created for backwards compatibility with test runner that set the hook function - * into QUnit.{hook}, instead of invoking it and passing the hook function. - * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. - * Doing this allows us to tell if the following methods have been overwritten on the actual - * QUnit object. - */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, runtime } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( !defined.document || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, j, label, len, main, ol, toolbar, val, selection, - urlConfigContainer, moduleFilter, userAgent, - numModules = 0, - moduleNames = [], - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - if ( !val.value || typeof val.value === "string" ) { - urlConfigHtml += ""; - } else { - urlConfigHtml += ""; - } - } - for ( i in config.modules ) { - if ( config.modules.hasOwnProperty( i ) ) { - moduleNames.push(i); - } - } - numModules = moduleNames.length; - moduleNames.sort( function( a, b ) { - return a.localeCompare( b ); - }); - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = id( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = id( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigContainer = document.createElement("span"); - urlConfigContainer.innerHTML = urlConfigHtml; - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" for checkboxes - // * Fallback from event.target to event.srcElement - addEvents( urlConfigContainer.getElementsByTagName("input"), "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? - target.defaultValue || true : - undefined; - window.location = QUnit.url( params ); - }); - addEvents( urlConfigContainer.getElementsByTagName("select"), "change", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.options[ target.selectedIndex ].value || undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( "span" ); - moduleFilter.setAttribute( "id", "qunit-modulefilter-container" ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url({ - module: ( selectedModule === "" ) ? undefined : selectedModule, - // Remove any existing filters - filter: undefined, - testNumber: undefined - }); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -if ( defined.document ) { - addEvent( window, "load", QUnit.load ); -} - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will suppress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not suppressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - delete config.previousModule; - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
      ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && defined.document && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( config.scrolltop && window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = ( test.module + ": " + test.testName ).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber.length > 0 ) { - if ( inArray( test.testNumber, config.testNumber ) < 0 ) { - return false; - } - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** - * Escape text for attribute or text content. - */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case "'": - return "'"; - case "\"": - return """; - case "<": - return "<"; - case ">": - return ">"; - case "&": - return "&"; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - if ( hasOwn.call( window, key ) ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( hasOwn.call( b, prop ) ) { - // Avoid "Member not found" error in IE8 caused by messing with window.constructor - if ( !( prop === "constructor" && a === window ) ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - } else { - a[ prop ] = b[ prop ]; - } - } - } - } - - return a; -} - -/** - * @param {HTMLElement} elem - * @param {string} type - * @param {Function} fn - */ -function addEvent( elem, type, fn ) { - if ( elem.addEventListener ) { - - // Standards-based browsers - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - - // support: IE <9 - elem.attachEvent( "on" + type, fn ); - } else { - - // Caller must ensure support for event listeners is present - throw new Error( "addEvent() was called in a context without event listener support" ); - } -} - -/** - * @param {Array|NodeList} elems - * @param {string} type - * @param {Function} fn - */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not necessarily - elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); -} - -function id( name ) { - return defined.document && document.getElementById && document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( - // Emit moduleStart when we're switching from one module to another - this.module !== config.previousModule || - // They could be equal (both undefined) but if the previousModule property doesn't - // yet exist it means this is the first test in a suite that isn't wrapped in a - // module, in which case we'll just emit a moduleStart event for 'undefined'. - // Without this, reporters can get testStart before moduleStart which is a problem. - !hasOwn.call( config, "previousModule" ) - ) { - if ( hasOwn.call( config, "previousModule" ) ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - /*jshint camelcase:false */ - - - /** - * Expose the current test environment. - * - * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. - */ - QUnit.current_testEnvironment = this.testEnvironment; - - /*jshint camelcase:true */ - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
      " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - runtime: this.runtime, - // DEPRECATED: this property will be removed in 2.0.0, use runtime instead - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// `assert` initialized at top of scope -// Assert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -assert = QUnit.assert = { - /** - * Asserts rough true-ish result. - * @name ok - * @function - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - msg = msg || ( result ? "okay" : "failed" ); - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = "" + escapeText( msg ) + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
      Source:
      " +
      -					escapeText( source ) +
      -					"
      "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** - * Assert that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * @name equal - * @function - * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); - */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, - - /** - * @name notEqual - * @function - */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, - - /** - * @name propEqual - * @function - */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notPropEqual - * @function - */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name deepEqual - * @function - */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notDeepEqual - * @function - */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name strictEqual - * @function - */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, - - /** - * @name notStrictEqual - * @function - */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( !message && typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - - // expected is an Error object - } else if ( expected instanceof Error ) { - ok = actual instanceof Error && - actual.name === expected.name && - actual.message === expected.message; - - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - - // expected is a string - } else if ( QUnit.objectType( expected ) === "string" ) { - ok = expected === errorString( actual ); - - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, "No exception was thrown." ); - } - } -}; - -/** - * @deprecated since 1.8.0 - * Kept assertion helpers in root for backwards compatibility. - */ -extend( QUnit.constructor.prototype, assert ); - -/** - * @deprecated since 1.9.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.constructor.prototype.raises = function() { - QUnit.push( false, false, false, "QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead" ); -}; - -/** - * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.constructor.prototype.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.constructor.prototype.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - parentsB = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - /*jshint camelcase:false */ - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotation VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && - // the regex itself - a.source === b.source && - // and its modifiers - a.global === b.global && - // (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline && - a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop, aCircular, bCircular; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - parents.pop(); - parentsB.pop(); - return false; - } - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - parentsB.pop(); - return false; - } - } - parents.pop(); - parentsB.pop(); - return true; - }, - - "object": function( b, a ) { - /*jshint forin:false */ - var i, j, loop, aCircular, bCircular, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || - ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - - // be strict: don't ensure hasOwnProperty and go deep - for ( i in a ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - eq = false; - break; - } - } - } - aProperties.push(i); - if ( !loop && !innerEquiv(a[i], b[i]) ) { - eq = false; - break; - } - } - - parents.pop(); - parentsB.pop(); - callers.pop(); // unstack, we are done - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || - QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); - }; - - return innerEquiv; -}()); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\""; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || - // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
      " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this.depth + ( extra || 0 ) ).join(chr); - }, - up: function( a ) { - this.depth += a || 1; - }, - down: function( a ) { - this.depth -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - depth: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - /*jshint forin:false */ - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( hasOwn.call( ns, i ) ) { - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// For browser, export only select globals -if ( typeof window !== "undefined" ) { - extend( window, QUnit.constructor.prototype ); - window.QUnit = QUnit; -} - -// For CommonJS environments, export everything -if ( typeof module !== "undefined" && module.exports ) { - module.exports = QUnit; -} - - -// Get a reference to the global object, like window in browsers -}( (function() { - return this; -})() )); diff --git a/dev/tests/js/JsTestDriver/framework/requirejs-util.js b/dev/tests/js/JsTestDriver/framework/requirejs-util.js deleted file mode 100644 index b9d6b833d36af..0000000000000 --- a/dev/tests/js/JsTestDriver/framework/requirejs-util.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -(function ($, window) { - "use strict"; - - // List of define() calls with arguments and call stack - var defineCalls = []; - - // Get current call stack, including script path information - var getFileStack = function() { - try { - throw new Error(); - } catch (e) { - if (!e.stack) { - throw new Error('The browser needs to support Error.stack property'); - } - return e.stack; - } - }; - - // Intercept RequireJS define() calls, which are performed by AMD scripts upon loading - window.define = function () { - var stack = getFileStack(); - defineCalls.push({ - stack: stack, - args: arguments - }); - }; - - window.require = function(dependencies, callback){ - return callback && callback(); - }; - - // Exposed interface - var requirejsUtil = { - getDefineArgsInScript: function (scriptPath) { - var result; - for (var i = 0; i < defineCalls.length; i++) { - if (defineCalls[i].stack.indexOf(scriptPath) >= 0) { - result = defineCalls[i].args; - break; - } - } - return result; - } - }; - - window.jsunit = window.jsunit || {}; - $.extend(window.jsunit, {requirejsUtil: requirejsUtil}); -})(jQuery, window); diff --git a/dev/tests/js/JsTestDriver/framework/stub.js b/dev/tests/js/JsTestDriver/framework/stub.js deleted file mode 100644 index c966ab578cac8..0000000000000 --- a/dev/tests/js/JsTestDriver/framework/stub.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -(function ($, window) { - "use strict"; - - function wrapMethod(object, property, method, copyProperties) { - if (!object) { - throw new TypeError("Should wrap property of object"); - } - - if (typeof method != "function") { - throw new TypeError("Method wrapper should be function"); - } - - var wrappedMethod = object[property], - error; - - if ($.type(wrappedMethod) !== 'function') { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } - - if (wrappedMethod.restore) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } - - if (error) { - if (wrappedMethod._stack) { - error.stack += '\n--------------\n' + wrappedMethod._stack; - } - throw error; - } - - // IE 8 does not support hasOwnProperty. - var owned = object.hasOwnProperty ? - object.hasOwnProperty(property) : - Object.prototype.hasOwnProperty.call(object, property); - - object[property] = method; - method.displayName = property; - // Stack trace which can be used to find what line of code the original method was created on. - method._stack = (new Error('Stack Trace for original')).stack; - - method.restore = function () { - if (!owned) { - delete object[property]; - } - if (object[property] === method) { - object[property] = wrappedMethod; - } - }; - - if (copyProperties) { - for (var prop in wrappedMethod) { - if (!Object.prototype.hasOwnProperty.call(method, prop)) { - method[prop] = wrappedMethod[prop]; - } - } - } - - return method; - } - - function stub(object, property, func, copyProperties) { - if (!!func && typeof func != "function") { - throw new TypeError("Custom stub should be function"); - } - - var wrapper; - - if (func) { - wrapper = func; - } else { - wrapper = stub.create(); - } - - if (!object && typeof property === "undefined") { - return stub.create(); - } - - if (typeof property === "undefined" && typeof object == "object") { - for (var prop in object) { - if (typeof object[prop] === "function") { - stub(object, prop); - } - } - - return object; - } - - return wrapMethod(object, property, wrapper, copyProperties); - } - - $.extend(stub, (function () { - var proto = { - create: function create() { - var functionStub = function () { - functionStub.callCount = functionStub.callCount ? functionStub.callCount + 1 : 1; - functionStub.lastCallArgs = arguments; - functionStub.callArgsStack.push(arguments); - if (functionStub.returnCallback && $.type(functionStub.returnCallback) === 'function') { - return functionStub.returnCallback.apply(functionStub.returnCallback, arguments); - } else if (functionStub.returnValue) { - return functionStub.returnValue; - } - }; - $.extend(functionStub, stub); - functionStub.reset(); - functionStub.displayName = "stub"; - return functionStub; - }, - - reset: function() { - this.callCount = null; - this.lastCallArgs = []; - this.callArgsStack = []; - this.returnValue = null; - this.returnCallback = null; - } - }; - - return proto; - }())); - - window.jsunit = window.jsunit || {}; - $.extend(window.jsunit, { - stub: stub - }); -})(jQuery, window); diff --git a/dev/tests/js/JsTestDriver/jsTestDriver.php.dist b/dev/tests/js/JsTestDriver/jsTestDriver.php.dist deleted file mode 100644 index 089e5220f2d8f..0000000000000 --- a/dev/tests/js/JsTestDriver/jsTestDriver.php.dist +++ /dev/null @@ -1,35 +0,0 @@ - 'http://localhost:9876', - 'load' => array( - '/dev/tests/js/JsTestDriver/framework', - '/lib/web/mage/webapi.js', - '/lib/web/mage/validation/validation.js', - '/lib/web/jquery/jstree/jquery.jstree.js', - '/lib/web/jquery/jquery-ui-timepicker-addon.js', - '/lib/web/mage/cookies.js', - '/lib/web/mage/calendar.js', - '/lib/web/mage/loader_old.js', - '/lib/web/mage/edit-trigger.js', - '/lib/web/mage/translate-inline.js', - '/lib/web/mage/translate-inline-vde.js', - '/lib/web/mage/backend/form.js', - '/lib/web/mage/backend/button.js', - '/lib/web/mage/backend/tabs.js', - '/lib/web/mage/backend/menu.js', - '/lib/web/mage/backend/suggest.js', - '/lib/web/mage/backend/tree-suggest.js', - '/lib/web/mage/zoom.js', - ), - 'test' => array('/dev/tests/js/JsTestDriver/testsuite'), - 'JsTestDriver' => '{{path_to_jstestdriver_jar}}' -); diff --git a/dev/tests/js/JsTestDriver/jsTestDriverOrder.php b/dev/tests/js/JsTestDriver/jsTestDriverOrder.php deleted file mode 100644 index 8ee790a281655..0000000000000 --- a/dev/tests/js/JsTestDriver/jsTestDriverOrder.php +++ /dev/null @@ -1,25 +0,0 @@ - 0) { - fwrite($fh, "proxy:" . PHP_EOL); - foreach ($proxies as $proxy) { - $proxyServer = sprintf($proxy['server'], $server, normalize(RELATIVE_APP_ROOT)); - fwrite($fh, ' - {matcher: "' . $proxy['matcher'] . '", server: "' . $proxyServer . '"}' . PHP_EOL); - } -} - -fwrite($fh, "load:" . PHP_EOL); -foreach ($sortedFiles as $file) { - if (!in_array($file, $serveFiles)) { - fwrite($fh, " - " . $file . PHP_EOL); - } -} - -fwrite($fh, "test:" . PHP_EOL); -foreach ($testFiles as $file) { - fwrite($fh, " - " . $file . PHP_EOL); -} - -if (count($serveFiles) > 0) { - fwrite($fh, "serve:" . PHP_EOL); - foreach ($serveFiles as $file) { - fwrite($fh, " - " . $file . PHP_EOL); - } -} - -fclose($fh); - -$testOutput = __DIR__ . '/test-output'; - -$filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); -if ($filesystemAdapter->isExists($testOutput)) { - $filesystemAdapter->deleteDirectory($testOutput); -} -mkdir($testOutput); - -$command - = 'java -jar "' . $jsTestDriver . '" --config "' . $jsTestDriverConf . '" --reset --port ' . $port . - ' --browser "' . $browser . '" --raiseOnFailure true --tests all --testOutput "' . $testOutput . '"'; - -echo $command . PHP_EOL; - -if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - system($command); -} else { - $commandFile = __DIR__ . '/run_js_tests.sh'; - $fh = fopen($commandFile, 'w'); - - $shellCommand - = 'LSOF=`/usr/sbin/lsof -i :' . $port . ' -t` - if [ "$LSOF" != "" ]; - then - kill -9 $LSOF - fi - - # Skip Xvfb setup for OS X since there browsers do not support headless display that way - if [ "$(uname)" != "Darwin" ]; then - DISPLAY_NUM=99 - ps -ef | egrep "[X]vfb.*:$DISPLAY_NUM" - if [ $? -eq 0 ] ; then - pkill Xvfb - fi - - XVFB=`which Xvfb` - if [ "$?" -eq 1 ]; - then - echo "Xvfb not found." - exit 1 - fi - - $XVFB :$DISPLAY_NUM -nolisten inet6 -ac & - PID_XVFB="$!" # take the process ID - export DISPLAY=:$DISPLAY_NUM # set display to use that of the Xvfb - fi - - USER=`whoami` - SUDO=`which sudo` - - # run the tests - $SUDO -u $USER ' . $command . ' - - if [ "$(uname)" != "Darwin" ]; then - kill -9 $PID_XVFB # shut down Xvfb (firefox will shut down cleanly by JsTestDriver) - fi - echo "Done."'; - - fwrite($fh, $shellCommand . PHP_EOL); - fclose($fh); - chmod($commandFile, 0750); - - exec($commandFile); -} - -/** - * Show a message that displays how to use (invoke) this PHP script and exit. - */ -function showUsage() -{ - reportError('Usage: php run_js_tests.php'); -} - -/** - * Reports an error given an error message and exits, effectively halting the PHP script's execution. - * - * @param string $message - Error message to be displayed to the user. - * - * @SuppressWarnings(PHPMD.ExitExpression) - */ -function reportError($message) -{ - echo $message . PHP_EOL; - exit(1); -} - -/** - * Takes a file or directory path in any form and normalizes it to fully absolute canonical form - * relative to this PHP script's location. - * - * @param string $filePath - File or directory path to be fully normalized to canonical form. - * - * @return string - The fully resolved path converted to absolute form. - */ -function normalize($filePath) -{ - return str_replace('\\', '/', realpath(__DIR__ . '/' . $filePath)); -} - -/** - * Accepts an array of directories and generates a list of Javascript files (.js) in those directories and - * all subdirectories recursively. - * - * @param array $dirs - An array of directories as specified in the configuration file (i.e. $configFile). - * - * @return array - An array of directory paths to all Javascript files found by recursively searching the - * specified array of directories. - */ -function listFiles($dirs) -{ - $baseDir = normalize(RELATIVE_APP_ROOT); - $result = []; - foreach ($dirs as $dir) { - $path = $baseDir . $dir; - if (is_file($path)) { - $path = substr_replace($path, RELATIVE_APP_ROOT, 0, strlen($baseDir)); - array_push($result, $path); - } else { - $paths = glob($path . '/*', GLOB_ONLYDIR | GLOB_NOSORT); - $paths = substr_replace($paths, '', 0, strlen($baseDir)); - $result = array_merge($result, listFiles($paths)); - - $files = glob($path . '/*.js', GLOB_NOSORT); - $files = substr_replace($files, RELATIVE_APP_ROOT, 0, strlen($baseDir)); - $result = array_merge($result, $files); - } - } - return $result; -} diff --git a/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/datepicker.js b/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/datepicker.js deleted file mode 100644 index 267c5d3df9a91..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/datepicker.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -test('DatepickerBinding', function () { - expect(1); - - var element = $('#datepicker'), - observable = ko.observable(), - openBtn, - todayBtn, - todayDate, - dateFormat, - result; - - ko.applyBindingsToNode(element, { - datepicker: observable - }); - - dateFormat = $(element).datepicker('option', 'dateFormat'); - todayDate = moment().format(dateFormat); - - btn = $('img.ui-datepicker-trigger'); - todayBtn = $('[data-handler="today"]'); - - btn.click(); - todayBtn.click(); - - result = moment(observable()).format(dateFormat); - - equal(todayDate, result); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/index.html b/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/index.html deleted file mode 100644 index e66e34da43945..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/lib/ko/datepicker/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - Unit test - - - - - - - - - -
      -
      - -
      - - - diff --git a/dev/tests/js/JsTestDriver/testsuite/lib/storage/index.html b/dev/tests/js/JsTestDriver/testsuite/lib/storage/index.html deleted file mode 100644 index cd33350031db3..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/lib/storage/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Unit test - - - - - - - - - - - -
      -
      -
      - - - diff --git a/dev/tests/js/JsTestDriver/testsuite/lib/storage/test-storage.js b/dev/tests/js/JsTestDriver/testsuite/lib/storage/test-storage.js deleted file mode 100644 index c0eebc166ec50..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/lib/storage/test-storage.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @category mage.collapsible - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -test('Storage', function() { - expect(2); - var key = 'test-storage'; - var storage = $.localStorage; - if(window.localStorage !== null) { - localStorage.setItem(key,'false'); - storage.set(key,'true'); - equal(localStorage.getItem(key),"true"); - equal(localStorage.getItem(key),storage.get(key)); - } else { - $.cookie(key,'false'); - storage.set(key,'true'); - equal($.cookie(key),"true"); - equal($.cookie(key),storage.get(key)); - } -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/_demo/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/_demo/index.html deleted file mode 100644 index e541c6212a7a4..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/_demo/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Unit test - - - - - - - -
      -
      - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/_demo/test.js b/dev/tests/js/JsTestDriver/testsuite/mage/_demo/test.js deleted file mode 100644 index 1d148f4318993..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/_demo/test.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TestCase( "hello test", function() { - ok( 1 == "1", "Passed!" ); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/button/button-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/button/button-test.js deleted file mode 100644 index b980acdc40545..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/button/button-test.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -ButtonTest = TestCase('ButtonTest'); -ButtonTest.prototype.testInit = function() { - /*:DOC += */ - assertTrue(jQuery('#test-button').button().is(':ui-button')); -}; -ButtonTest.prototype.testBind = function() { - /*:DOC +=
      */ - var testEventTriggered = false; - jQuery('#event-target').on('testEvent', function(e) { - testEventTriggered = true; - }); - jQuery('#test-button').button({ - event: 'testEvent', - target: '#event-target' - }).click(); - assertTrue(testEventTriggered); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/edit_trigger/edit-trigger-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/edit_trigger/edit-trigger-test.js deleted file mode 100644 index c28f1e4943438..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/edit_trigger/edit-trigger-test.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -EditTriggerTest = TestCase('EditTriggerTest'); -EditTriggerTest.prototype.testInit = function() { - var editTrigger = jQuery('body').editTrigger(); - assertEquals(true, !!editTrigger.data('mageEditTrigger')); - editTrigger.editTrigger('destroy'); -}; -EditTriggerTest.prototype.testCreate = function() { - /*:DOC += - */ - var options = { - img: 'img.gif', - alt: 'translate' - }, - editTrigger = jQuery('body').editTrigger(options); - var trigger = jQuery('.translate-edit-icon'); - assertNotNull(trigger); - assertTrue(trigger.is('img')); - assertEquals(true, trigger.attr('src') === options.img); - assertEquals(true, trigger.attr('alt') === options.alt); - assertEquals(true, trigger.is(':hidden')); - editTrigger.editTrigger('destroy'); -}; -EditTriggerTest.prototype.testShowHideOnMouseMove = function() { - /*:DOC +=
      -
      text
      -
      - - */ - var editTrigger = jQuery('body').editTrigger({ - editSelector: '.edit', - delay: 0 - }), - trigger = jQuery('.translate-edit-icon'), - editElement = jQuery('.edit'), - container = jQuery('.container'); - editElement.trigger('mousemove'); - assertEquals(true, trigger.is(':visible')); - container.trigger('mousemove'); - assertEquals(true, trigger.is(':hidden')); - editTrigger.editTrigger('destroy'); -}; -EditTriggerTest.prototype.testTriggerClick = function() { - /*:DOC +=
      text
      - - */ - var editTrigger = jQuery('body').editTrigger({ - editSelector: '.edit' - }), - trigger = jQuery('.translate-edit-icon'), - editElement = jQuery('.edit'), - editTriggered = false; - $('body').on('edit.editTrigger', function() { editTriggered = true; }); - editElement.trigger('mousemove'); - trigger.trigger('click'); - assertEquals(true, editTriggered); - editTrigger.editTrigger('destroy'); -}; -EditTriggerTest.prototype.testDestroy = function() { - var editTrigger = jQuery('body').editTrigger(), - editProcessed = false, - mousemoveProcessed = false; - - $('body') - .on('edit.editTrigger', function() {editProcessed = true;}) - .on('mousemove.editTrigger', function() {mousemoveProcessed = true;}); - - editTrigger.editTrigger('destroy'); - assertEquals(false, !!editTrigger.data('mageEditTrigger')); - - $('body').trigger('edit.editTrigger'); - assertEquals(false, editProcessed); - - $('body').trigger('mousemove.editTrigger'); - assertEquals(false, mousemoveProcessed); -}; -var EditTriggerTestAsync = AsyncTestCase('EditTriggerTestAsync'); -EditTriggerTestAsync.prototype.testHideEditTriggerWithDelay = function(queue) { - /*:DOC +=
      -
      text
      -
      - - */ - var editTrigger = jQuery(document).editTrigger({ - editSelector: '.edit', - delay: 1000 - }), - trigger = jQuery('.translate-edit-icon'), - editElement = jQuery('.edit'), - container = jQuery('.container'), - visibleOnMouseout, - hiddenAfterDelay; - editElement.trigger('mousemove'); - container.trigger('mousemove'); - queue.call('Step 1: Start hiding with delay', function(callbacks) { - visibleOnMouseout = trigger.is(':visible'); - setTimeout(callbacks.add(function() { - hiddenAfterDelay = trigger.is(':hidden'); - }), 1050); - }); - queue.call('Step 2: Check is trigger are hidden after delay', function() { - assertEquals(true, visibleOnMouseout); - assertEquals(true, hiddenAfterDelay); - editTrigger.editTrigger('destroy'); - }); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/list/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/list/index.html deleted file mode 100644 index 3d4672640bc3b..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/list/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Unit test - - - - - - - - - - - -
      -
      - - diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/list/jquery-list-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/list/jquery-list-test.js deleted file mode 100644 index affe9f11574ef..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/list/jquery-list-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @category mage.loader - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -test('init & destroy', function() { - expect(2); - var element = $('
      '); - element.list(); - ok(element.hasClass('list-widget'), "Class added" ); - element.list('destroy'); - ok(!element.hasClass('list-widget'), "Class removed" ); -}); - -test('add to list', function() { - expect(1); - var element = $('
      '); - var button = $(''); - button.appendTo(element); - element.appendTo('body'); - var destination = $('
      '); - destination.appendTo('body'); - element.list({ - template : 'test', - templateWrapper : '
      ', - templateClass : 'fieldset' - }); - button.trigger('click'); - ok(destination.children('[data-role="addedItem"]').length, "Content is added to list"); - element.list('destroy'); - element.remove(); - destination.remove(); -}); - -test('remove from list', function() { - expect(1); - var button = $(''); - var removeButton = $('[data-button=remove]'); - var destination = $('
      '); - button.list({template: '#template',destinationSelector: '#test',listLimit: 5}); - button.trigger('click'); - removeButton.trigger('click'); - ok(!destination.children('[data-role=item]').length, "Content is removed from the list"); - button.list('destroy'); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js deleted file mode 100644 index 445f6619e7e35..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -MageTest = TestCase('MageTest'); - -MageTest.prototype.setUp = function() { - /*:DOC += */ -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js deleted file mode 100644 index a79d05ba8a246..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @category mage.js - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -//Code to be tested for /app/code/Magento/Search/view/frontend/form-mini.js (_onSubmit) -function regularSearch() { - if (this.document.getElementById('search').value === this.document.getElementById('search').placeholder || this.document.getElementById('search').value === '') { - this.document.getElementById('search').placeholder = 'Please specify at least one search term'; - this.document.getElementById('search').value = this.document.getElementById('search').placeholder; - } -} -//The test case -RegularSearchTest = TestCase("RegularSearchTest"); -RegularSearchTest.prototype.setUp = function() { - /*:DOC += -
      -
      -
      - -
      - -
      -
      - -
      - -
      */ -}; -RegularSearchTest.prototype.testRegularSearch = function(){ - //before - var inputValue = document.getElementById('search'); - assertEquals("", inputValue.value); - regularSearch(); - //after - inputValue = document.getElementById('search'); - assertEquals("Please specify at least one search term", inputValue.value); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js deleted file mode 100644 index 358235eb13bf8..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TranslateInlineDialogVdeTest = TestCase('TranslateInlineDialogVdeTest'); - -TranslateInlineDialogVdeTest.prototype.testInit = function() { - /*:DOC += - -
      - */ - var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde(); - assertTrue(translateInlineDialogVde.is(':mage-translateInlineDialogVde')); - translateInlineDialogVde.translateInlineDialogVde('destroy'); -}; -TranslateInlineDialogVdeTest.prototype.testWithTemplate = function() { - /*:DOC += - -
      - */ - var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde(); - assertEquals(true, translateInlineDialogVde.is(':mage-translateInlineDialogVde')); - translateInlineDialogVde.translateInlineDialogVde('destroy'); -}; -TranslateInlineDialogVdeTest.prototype.testOpenAndClose = function() { - /*:DOC += -
      - -
      - */ - var options = { - textTranslations: jQuery('[data-translate-mode="text"]'), - imageTranslations: jQuery('[data-translate-mode="alt"]'), - scriptTranslations: jQuery('[data-translate-mode="script"]') - }; - - var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde(options); - - var widget = { - element : jQuery('#randomElement') - }; - - jQuery('#translate-dialog').translateInlineDialogVde('openWithWidget', null, widget, function() { }); - assertTrue(jQuery('#translate-dialog').translateInlineDialogVde('isOpen')); - - jQuery('#translate-dialog').translateInlineDialogVde('close'); - assertFalse(jQuery('#translate-dialog').translateInlineDialogVde('isOpen')); - - jQuery('#translate-dialog').translateInlineDialogVde('destroy'); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js deleted file mode 100644 index 3822310460132..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -TranslateInlineVdeTest = TestCase('TranslateInlineVdeTest'); -TranslateInlineVdeTest.prototype.testInit = function() { - /*:DOC +=
      text
      - - */ - var translateInlineVde = jQuery('[data-translate]').translateInlineVde(); - assertTrue(translateInlineVde.is(':mage-translateInlineVde')); - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testCreate = function() { - /*:DOC +=
      text
      - - */ - assertEquals(0, jQuery('[data-translate] > img').size()); - var translateInlineVde = jQuery('[data-translate]').translateInlineVde(); - assertEquals(1, jQuery('[data-translate] > img').size()); - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testHideAndShow = function() { - /*:DOC +=
      text
      - - */ - var translateInlineVde = jQuery('[data-translate]').translateInlineVde(), - iconImg = jQuery('[data-translate] > img'); - assertFalse(iconImg.is('.hidden')); - - translateInlineVde.translateInlineVde('hide'); - assertTrue(iconImg.is('.hidden') ); - - translateInlineVde.translateInlineVde('show'); - assertFalse(iconImg.is('.hidden') ); - assertFalse(jQuery('[data-translate]').is(':hidden') ); - - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testReplaceTextNormal = function() { - /*:DOC +=
      text
      - - */ - var translateInlineVde = jQuery('[data-translate]').translateInlineVde(); - var newValue = 'New value'; - - jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue); - - var translateData = jQuery('#translateElem').data('translate'); - assertEquals(newValue, translateData[0]['shown']); - assertEquals(newValue, translateData[0]['translated']); - - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testReplaceTextNullOrBlank = function() { - /*:DOC +=
      text
      - - */ - var translateInlineVde = jQuery('[data-translate]').translateInlineVde(); - var newValue = null; - - jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue); - - var translateData = jQuery('#translateElem').data('translate'); - assertEquals(' ', translateData[0]['shown']); - assertEquals(' ', translateData[0]['translated']); - - newValue = 'Some value'; - jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue); - - translateData = jQuery('#translateElem').data('translate'); - assertEquals(newValue, translateData[0]['shown']); - assertEquals(newValue, translateData[0]['translated']); - - newValue = ''; - jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue); - - translateData = jQuery('#translateElem').data('translate'); - assertEquals(' ', translateData[0]['shown']); - assertEquals(' ', translateData[0]['translated']); - - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testClick = function() { - /*:DOC +=
      text
      - - */ - var counter = 0; - var callback = function() { - counter++; - }; - var translateInlineVde = jQuery('[data-translate]').translateInlineVde({ - onClick: callback - }), - iconImg = jQuery('[data-translate] > img'); - - iconImg.trigger('click'); - assertEquals(1, counter); - assertTrue(jQuery('#translateElem').hasClass('invisible')); - - translateInlineVde.translateInlineVde('destroy'); -}; -TranslateInlineVdeTest.prototype.testDblClick = function() { - /*:DOC +=
      text
      - - */ - var counter = 0; - var callback = function() { - counter++; - }; - var translateInlineVde = jQuery('[data-translate]').translateInlineVde({ - onClick: callback - }), - iconImg = jQuery('[data-translate] > img'); - - assertEquals(1, jQuery('#translateElem').find('img').size()); - - translateInlineVde.trigger('dblclick'); - assertEquals(1, counter); - - assertEquals(0, jQuery('#translateElem').find('img').size()); - assertTrue(jQuery('#translateElem').hasClass('invisible')); - - translateInlineVde.translateInlineVde('destroy'); -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js deleted file mode 100644 index b03b3bc3d889a..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -WebapiTest = TestCase('WebapiTest'); - -WebapiTest.prototype.testConstructorSuccess = function() { - var successCallback = function(){}; - new $.mage.Webapi('baseUrl', {'timeout': 100, 'success': successCallback}); -}; - -WebapiTest.prototype.testConstructorSuccessEmptyArgs = function() { - new $.mage.Webapi('baseUrl'); -}; - -WebapiTest.prototype.testConstructorInvalidBaseUrl = function() { - expectAsserts(1); - try { - var invalidBaseUrl = 1; - new $.mage.Webapi(invalidBaseUrl); - } catch (e) { - var expectedException = "String baseUrl parameter required"; - assertEquals("Invalid exception was thrown.", expectedException, e); - } -}; - -WebapiTest.prototype.testCallInvalidMethod = function() { - var Webapi = new $.mage.Webapi('baseUrl'); - expectAsserts(1); - try { - Webapi.call('resourceUri', 'INVALID_HTTP_METHOD'); - } catch (e) { - var expectedException = "Method name is not valid: INVALID_HTTP_METHOD"; - assertEquals("Invalid exception was thrown.", expectedException, e); - } -}; - -WebapiTest.prototype.testCallSuccessCallback = function() { - // ensure that custom successCallback was executed - expectAsserts(1); - var successCallback = function(response) { - assertObject("Response is expected to be an object", response); - }; - var Webapi = new $.mage.Webapi('baseUrl', {'success': successCallback}); - $.ajax = function(settings) { - settings.success({}); - }; - Webapi.call('products', 'GET'); -}; - -WebapiTest.prototype.testCallErrorCallback = function() { - // ensure that custom successCallback was executed - expectAsserts(1); - var errorCallback = function(response) { - assertObject("Response is expected to be an object", response); - }; - var Webapi = new $.mage.Webapi('baseUrl', {'error': errorCallback}); - $.ajax = function(settings) { - settings.error({}); - }; - Webapi.call('products', 'GET'); -}; - -WebapiTest.prototype.testCallProductGet = function() { - var baseUri = 'baseUrl'; - var Webapi = new $.mage.Webapi(baseUri); - var httpMethod = Webapi.method.get; - var idObj = {id: 1}; - var productResourceUri = '/products/'; - var resourceVersion = 'v1'; - var expectedUri = baseUri + '/webapi/rest/' + resourceVersion + productResourceUri + '1'; - // ensure that $.ajax() was executed - expectAsserts(3); - $.ajax = function(settings) { - assertEquals("URI for API call does not match with expected one.", expectedUri, settings.url); - assertEquals("HTTP method for API call does not match with expected one.", httpMethod, settings.type); - assertEquals("Data for API call does not match with expected one.", '1', settings.data); - }; - Webapi.Product(resourceVersion).get(idObj); -}; - -WebapiTest.prototype.testCallProductCreate = function() { - var baseUri = 'baseUrl'; - var Webapi = new $.mage.Webapi(baseUri); - var httpMethod = Webapi.method.create; - var productResourceUri = '/products/'; - var resourceVersion = 'v1'; - var expectedUri = baseUri + '/webapi/rest/' + resourceVersion + productResourceUri; - productData = { - "type_id": "simple", - "attribute_set_id": 4, - "sku": "1234567890", - "weight": 1, - "status": 1, - "visibility": 4, - "name": "Simple Product", - "description": "Simple Description", - "price": 99.95, - "tax_class_id": 0 - }; - // ensure that $.ajax() was executed - expectAsserts(3); - $.ajax = function(settings) { - assertEquals("URI for API call does not match with expected one.", expectedUri, settings.url); - assertEquals("HTTP method for API call does not match with expected one.", httpMethod, settings.type); - assertEquals("Data for API call does not match with expected one.", productData, settings.data); - }; - Webapi.Product(resourceVersion).create(productData); -}; - -WebapiTest.prototype.testCallProductCreateInvalidVersion = function() { - expectAsserts(1); - var invalidVersion = 'invalidVersion'; - try { - var Webapi = new $.mage.Webapi('BaseUrl'); - Webapi.Product(invalidVersion); - } catch (e) { - var expectedException = "Incorrect version format: " + invalidVersion; - assertEquals("Invalid exception was thrown.", expectedException, e); - } -}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js deleted file mode 100644 index a9dc0fd239a28..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js +++ /dev/null @@ -1,337 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -ZoomTest = TestCase('ZoomTest'); -ZoomTest.prototype.setUp = function() { - /*:DOC += - - - - - -
      - -
      - */ - this.zoomElement = jQuery('[data-role=zoom-test]'); -}; -ZoomTest.prototype.tearDown = function() { - this.zoomDestroy(); -}; -ZoomTest.prototype.zoomDestroy = function() { - if(this.zoomElement.data('zoom')) { - this.zoomElement.zoom('destroy'); - } -}; -ZoomTest.prototype.zoomCreate = function(options, element) { - return (element || this.zoomElement).zoom(options || {} ).data('zoom'); -}; -ZoomTest.prototype.testInit = function() { - this.zoomElement.zoom(); - assertTrue(this.zoomElement.is(':mage-zoom')); -}; -ZoomTest.prototype.testCreate = function() { - var zoomInstance = this.zoomCreate(), - _setZoomData = jsunit.stub(zoomInstance, '_setZoomData'), - _render = jsunit.stub(zoomInstance, '_render'), - _bind = jsunit.stub(zoomInstance, '_bind'), - _hide = jsunit.stub(zoomInstance, '_hide'), - _largeImageLoaded = jsunit.stub(zoomInstance, '_largeImageLoaded'); - - zoomInstance.largeImage = [{ - complete: false - }]; - - zoomInstance._create(); - assertTrue(_setZoomData.callCount === 1); - assertTrue(_render.callCount === 1); - assertTrue(_bind.callCount === 1); - assertNull(_largeImageLoaded.callCount); - assertTrue(_hide.callCount === 2); - _setZoomData.reset(); - _render.reset(); - _bind.reset(); - _hide.reset(); - - zoomInstance.largeImage[0].complete = true; - zoomInstance._create(); - assertTrue(_setZoomData.callCount === 1); - assertTrue(_render.callCount === 1); - assertTrue(_bind.callCount === 1); - assertTrue(_largeImageLoaded.callCount === 1); - assertTrue(_hide.callCount === 2); -}; -ZoomTest.prototype.testRender = function() { - var zoomInstance = this.zoomCreate(), - _renderControl = jsunit.stub(zoomInstance, '_renderControl'), - _renderLargeImage = jsunit.stub(zoomInstance, '_renderLargeImage'); - _renderControl.returnCallback = function(control) { - return jQuery('

      ', {'data-control': control}); - }; - - zoomInstance._render(); - assertTrue(_renderControl.callCount === 4); - assertTrue(zoomInstance.element.find('[data-control=track]').length > 0); - assertTrue(zoomInstance.element.find('[data-control=lens]').length > 0); - assertTrue(zoomInstance.element.find('[data-control=display]').length > 0); - assertTrue(zoomInstance.element.find('[data-control=notice]').length > 0); - assertTrue(_renderLargeImage.callCount === 1); -}; -ZoomTest.prototype.testToggleNotice = function() { - var zoomInstance = this.zoomCreate(), - getZoomRatio = jsunit.stub(zoomInstance, 'getZoomRatio'); - - zoomInstance.noticeOriginal = 'notice original'; - zoomInstance.options.controls.notice = { - text: 'test text' - }; - - zoomInstance.notice.text(''); - zoomInstance.largeImageSrc = 'image.large.jpg'; - zoomInstance.activated = false; - getZoomRatio.returnValue = 2; - zoomInstance._toggleNotice(); - assertEquals(zoomInstance.notice.text(), zoomInstance.options.controls.notice.text); - assertTrue(getZoomRatio.callCount === 1); - - zoomInstance.notice.text(''); - zoomInstance.largeImageSrc = null; - zoomInstance.activated = false; - getZoomRatio.returnValue = 2; - zoomInstance._toggleNotice(); - assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal); - - zoomInstance.notice.text(''); - zoomInstance.largeImageSrc = 'image.large.jpg'; - zoomInstance.activated = true; - getZoomRatio.returnValue = 2; - zoomInstance._toggleNotice(); - assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal); - - zoomInstance.notice.text(''); - zoomInstance.largeImageSrc = 'image.large.jpg'; - zoomInstance.activated = false; - getZoomRatio.returnValue = 0; - zoomInstance._toggleNotice(); - assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal); -}; - -ZoomTest.prototype.testRefresh = function() { - var zoomInstance = this.zoomCreate(), - _refreshControl = jsunit.stub(zoomInstance, '_refreshControl'); - - zoomInstance._refresh(); - assertTrue(_refreshControl.callCount === 3); - assertTrue(_refreshControl.callArgsStack[0][0] === 'display'); - assertTrue(_refreshControl.callArgsStack[1][0] === 'track'); - assertTrue(_refreshControl.callArgsStack[2][0] === 'lens'); -}; - -ZoomTest.prototype.testBind = function() { - var zoomInstance = this.zoomCreate(), - _on = jsunit.stub(zoomInstance, '_on'), - events = {}; - - zoomInstance.largeImage = jQuery('

      '); - zoomInstance._bind(); - assertTrue(_on.callCount > 0); - assertTrue( - _on.callArgsStack[0][0][ - zoomInstance.options.startZoomEvent + - ' ' + - zoomInstance.options.selectors.image - ] === 'show' - ); - assertTrue( - jQuery.type(_on.callArgsStack[0][0][ - zoomInstance.options.stopZoomEvent + - ' ' + - zoomInstance.options.selectors.track - ]) === 'function' - ); - assertTrue(_on.callArgsStack[0][0]['mousemove ' + zoomInstance.options.selectors.track] === '_move'); - assertTrue(_on.callArgsStack[0][0].imageupdated === '_onImageUpdated'); - assertTrue(_on.callArgsStack[1][0].is(zoomInstance.largeImage)); - assertTrue(_on.callArgsStack[1][1].load === '_largeImageLoaded'); -}; -ZoomTest.prototype.testEnable = function() { - var zoomInstance = this.zoomCreate(), - _onImageUpdated = jsunit.stub(zoomInstance, '_onImageUpdated'); - - zoomInstance.enable(); - assertTrue(_onImageUpdated.callCount === 1); -}; -ZoomTest.prototype.testDisable = function() { - var zoomInstance = this.zoomCreate(); - - zoomInstance.noticeOriginal = 'original notice'; - zoomInstance.notice.text(''); - zoomInstance.disable(); - assertEquals(zoomInstance.noticeOriginal, zoomInstance.notice.text()); -}; -ZoomTest.prototype.testShow = function() { - var zoomInstance = this.zoomCreate(), - e = { - preventDefault: jsunit.stub(), - stopImmediatePropagation: jsunit.stub() - }, - getZoomRatio = jsunit.stub(zoomInstance, 'getZoomRatio'), - _show = jsunit.stub(zoomInstance, '_show'), - _refresh = jsunit.stub(zoomInstance, '_refresh'), - _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'), - _trigger = jsunit.stub(zoomInstance, '_trigger'); - - getZoomRatio.returnValue = 0; - zoomInstance.show(e); - assertTrue(e.preventDefault.callCount === 1); - - e.preventDefault.reset(); - getZoomRatio.reset(); - getZoomRatio.returnValue = 2; - zoomInstance.largeImageSrc = 'image.large.jpg'; - zoomInstance.show(e); - assertTrue(e.preventDefault.callCount === 1); - assertTrue(e.stopImmediatePropagation.callCount === 1); - assertTrue(zoomInstance.activated); - assertTrue(_show.callCount > 0); - assertTrue(_refresh.callCount === 1); - assertTrue(_toggleNotice.callCount === 1); - assertTrue(_trigger.callCount === 1); - assertTrue(_trigger.lastCallArgs[0] === 'show'); -}; -ZoomTest.prototype.testHide = function() { - var zoomInstance = this.zoomCreate(), - _hide = jsunit.stub(zoomInstance, '_hide'), - _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'), - _trigger = jsunit.stub(zoomInstance, '_trigger'); - - zoomInstance.hide(); - assertTrue(_hide.callCount > 0); - assertTrue(_toggleNotice.callCount === 1); - assertTrue(_trigger.callCount === 1); - assertTrue(_trigger.lastCallArgs[0] === 'hide'); -}; -ZoomTest.prototype.testOnImageUpdated = function() { - var zoomInstance = this.zoomCreate(), - _setZoomData = jsunit.stub(zoomInstance, '_setZoomData'), - _refreshLargeImage = jsunit.stub(zoomInstance, '_refreshLargeImage'), - _refresh = jsunit.stub(zoomInstance, '_refresh'), - hide = jsunit.stub(zoomInstance, 'hide'), - testImage = jQuery('

      '); - - zoomInstance.options.selectors.image = "[data-role=test-image]"; - zoomInstance.element.append(testImage); - zoomInstance.image = testImage; - zoomInstance._onImageUpdated(); - assertNull(_setZoomData.callCount); - assertNull(_refreshLargeImage.callCount); - assertNull(_refresh.callCount); - assertNull(hide.callCount); - - zoomInstance.image = jQuery('

      '); - zoomInstance.largeImageSrc = null; - zoomInstance._onImageUpdated(); - assertTrue(_setZoomData.callCount === 1); - assertNull(_refreshLargeImage.callCount); - assertNull(_refresh.callCount); - assertTrue(hide.callCount === 1); - - _setZoomData.reset(); - hide.reset(); - zoomInstance.largeImageSrc = 'image.large.jpg'; - zoomInstance._onImageUpdated(); - assertTrue(_setZoomData.callCount === 1); - assertTrue(_refreshLargeImage.callCount === 1); - assertTrue(_refresh.callCount === 1); - assertNull(hide.callCount); -}; -ZoomTest.prototype.testLargeImageLoaded = function() { - var zoomInstance = this.zoomCreate(), - _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'), - _getAspectRatio = jsunit.stub(zoomInstance, '_getAspectRatio'), - _getWhiteBordersOffset = jsunit.stub(zoomInstance, '_getWhiteBordersOffset'), - processStopTriggered = false, - image = jQuery('

      '); - - _getWhiteBordersOffset.returnValue = 1; - zoomInstance.element.append(image); - zoomInstance.options.selectors.image = '[data-role=test-image]'; - zoomInstance.image = image; - _getAspectRatio.returnCallback = function(image) { - if (image.is(zoomInstance.image)) { - return 0; - } else { - return 1; - } - }; - - jQuery(zoomInstance.options.selectors.image).on('processStop', function() { - processStopTriggered = true; - }); - zoomInstance.ratio = 1; - - zoomInstance._largeImageLoaded(); - assertNull(zoomInstance.ratio); - assertTrue(_toggleNotice.callCount === 1); - assertTrue(processStopTriggered); - assertTrue(_getAspectRatio.callCount > 0); - assertTrue(_getWhiteBordersOffset.callCount === 1); - assertEquals(zoomInstance.whiteBordersOffset, _getWhiteBordersOffset.returnValue); -}; -ZoomTest.prototype.testRefreshLargeImage = function() { - var zoomInstance = this.zoomCreate(), - css = {top: 0, left: 0}; - zoomInstance.largeImage = jQuery(''); - zoomInstance.largeImageSrc = 'large.image.jpg'; - - zoomInstance._refreshLargeImage(); - assertNotUndefined(zoomInstance.largeImage.prop('src')); - assertEquals(zoomInstance.largeImage.css('top'), css.top + 'px'); - assertEquals(zoomInstance.largeImage.css('left'), css.left + 'px'); -}; -ZoomTest.prototype.testRenderLargeImage = function() { - var zoomInstance = this.zoomCreate(); - - zoomInstance.element.append(jQuery('

      ')); - zoomInstance.options.selectors.image = '[data-role=test-image]'; - - var image = zoomInstance._renderLargeImage(); - assertTrue(image.is('img')); - assertTrue(image.is(zoomInstance.largeImage)); -}; -ZoomTest.prototype.testGetZoomRatio = function() { - var zoomInstance = this.zoomCreate(), - imageSize = {width: 100, height: 100}, - largeImageSize = {width: 200, height: 200}; - - zoomInstance.ratio = null; - zoomInstance.image = jQuery('', imageSize); - zoomInstance.largeImageSize = largeImageSize; - var zoomRatio = zoomInstance.getZoomRatio(); - - assertEquals(zoomRatio, (largeImageSize.width / imageSize.width)); - zoomInstance.ratio = 100; - zoomRatio = zoomInstance.getZoomRatio(); - assertEquals(zoomRatio, zoomInstance.ratio); -}; -ZoomTest.prototype.testGetAspectRatio = function() { - var zoomInstance = this.zoomCreate(), - aspectRatio = zoomInstance._getAspectRatio(), - size = {width: 200, height: 100}; - assertNull(aspectRatio); - aspectRatio = zoomInstance._getAspectRatio(jQuery('

      ', size)); - assertEquals((Math.round((size.width / size.height) * 100) / 100), aspectRatio); -}; From 809ec050986fa3ddfeec4a715ce5ace1e41a4427 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 24 Jan 2018 13:42:18 -0600 Subject: [PATCH 225/277] magento/magento2#11460: [ISSUE-11140][BUGFIX] Skip store code admin from being detected in case of store code in url configured - fixed static tests --- app/code/Magento/Store/App/Request/PathInfoProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Store/App/Request/PathInfoProcessor.php b/app/code/Magento/Store/App/Request/PathInfoProcessor.php index 0afef45bbc2df..3fa78dc94aa35 100644 --- a/app/code/Magento/Store/App/Request/PathInfoProcessor.php +++ b/app/code/Magento/Store/App/Request/PathInfoProcessor.php @@ -43,7 +43,7 @@ public function process(\Magento\Framework\App\RequestInterface $request, $pathI } if ($store->isUseStoreInUrl()) { - if (!$request->isDirectAccessFrontendName($storeCode) && $storeCode != Store::ADMIN_CODE ) { + if (!$request->isDirectAccessFrontendName($storeCode) && $storeCode != Store::ADMIN_CODE) { $this->storeManager->setCurrentStore($store->getCode()); $pathInfo = '/' . (isset($pathParts[1]) ? $pathParts[1] : ''); return $pathInfo; From c85d82bc4c9e1e99112e04e3bb788b7b02546e10 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Wed, 24 Jan 2018 13:48:00 -0600 Subject: [PATCH 226/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix SortByIdDescendingActionGroup to account for sticky table header --- .../Backend/ActionGroup/SortByIdDescendingActionGroup.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml index b8b8a34c9b4f6..5c130df74b66c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/SortByIdDescendingActionGroup.xml @@ -9,10 +9,10 @@ - + - + From 74a53d90eaa2c6500f1cff2dd713298ec677dfb9 Mon Sep 17 00:00:00 2001 From: Dan Mooney Date: Wed, 24 Jan 2018 13:55:58 -0600 Subject: [PATCH 227/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Leave testCaseId blank --- .../AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 83ea2264371ca..2cbcee7c8c087 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -15,7 +15,7 @@ <description value="Create CMS Page With Widget Type: Catalog product list"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-"/> + <testCaseId value=""/> </annotations> <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> From 827d3d3bbd2dbf8932fb26e9bb657c2f6a1c1a99 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Wed, 24 Jan 2018 14:28:59 -0600 Subject: [PATCH 228/277] MAGETWO-85421: Build Stabilization - fix static test failures --- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index bc0b44a7fc748..54ef81746277b 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -57,7 +57,7 @@ tinymce.create('tinymce.plugins.magentovariable', { */ onPostRender: function () { var _this = this, - + /** * Toggle active state of Insert Variable button. * From 1dc15e3e47d9fb6e2c1ef0e1705a578853867f3c Mon Sep 17 00:00:00 2001 From: Cari Spruiell <cspruiell@magento.com> Date: Wed, 24 Jan 2018 14:33:39 -0600 Subject: [PATCH 229/277] Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-42047-banner-MFTF-updated # Conflicts: # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGCatalogCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminAddImageToWYSIWYGProductCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateCategoryCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminCreateSimpleProductCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/AdminEditTextEditorProductAttributeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyDefaultWYSIWYGToolbarOnProducCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGBlockCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddImageToWYSIWYGCMSCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGBlockCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddVariableToWYSIWYGCMSCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGBlockCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/AdminSwitchWYSIWYGOptionsCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Metadata/block-meta.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddImageToWYSIWYGNewsletterCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddVariableToWYSIWYGNewsletterCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/AdminAddWidgetToWYSIWYGNewsletterCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Cest/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule-meta.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserData.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml # dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/Data/VariableData.xml --- dev/tests/acceptance/composer.lock | 175 +++++++++--------- .../StorefrontProductActionSection.xml | 4 +- .../AdminAddImageToWYSIWYGProductCest.xml | 5 +- ...dminEditTextEditorProductAttributeCest.xml | 2 + ...erifyDefaultWYSIWYGToolbarOnProducCest.xml | 2 + ...yTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml | 24 +-- ...yTinyMCEv4IsNativeWYSIWYGOnProductCest.xml | 11 +- .../CatalogRule/Data/CatalogRuleData.xml | 4 +- .../Metadata/catalog-rule-meta.xml | 4 +- .../VerifyMediaGalleryActionGroup.xml | 6 +- .../ActionGroup/VerifyTinyMCEActionGroup.xml | 6 +- .../Cms/Section/TinyMCESection.xml | 4 +- .../Test/AdminAddImageToWYSIWYGBlockCest.xml | 68 +++---- .../Test/AdminAddImageToWYSIWYGCMSCest.xml | 52 +++--- .../AdminAddVariableToWYSIWYGBlockCest.xml | 30 +-- .../Test/AdminAddVariableToWYSIWYGCMSCest.xml | 8 +- .../Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 21 ++- ...WidgetToWYSIWYGWithCMSPageLinkTypeCest.xml | 7 +- ...getToWYSIWYGWithCMSStaticBlockTypeCest.xml | 18 +- ...WYSIWYGWithCatalogCategoryLinkTypeCest.xml | 7 +- ...oWYSIWYGWithCatalogProductLinkTypeCest.xml | 8 +- ...oWYSIWYGWithCatalogProductListTypeCest.xml | 11 +- ...YGWithRecentlyComparedProductsTypeCest.xml | 11 +- ...IWYGWithRecentlyViewedProductsTypeCest.xml | 8 +- .../Test/AdminSwitchWYSIWYGOptionsCest.xml | 9 +- ...ifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 56 +++--- ...yTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml | 29 +-- .../AdminAddImageToWYSIWYGNewsletterCest.xml | 56 +++--- .../AdminAddWidgetToWYSIWYGNewsletterCest.xml | 2 +- ...nyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml | 22 +-- .../SalesRule/Data/SalesRuleCouponData.xml | 4 +- .../SalesRule/Data/SalesRuleData.xml | 4 +- .../Metadata/sales_rule_coupon-meta.xml | 4 +- .../SalesRule/Section/DiscountSection.xml | 4 +- .../AdminCreateStoreViewActionGroup.xml | 7 +- .../Store/Page/AdminSystemStoreViewPage.xml | 6 +- .../AdminNewStoreViewActionsSection.xml | 4 +- .../Store/Test/AdminCreateStoreGroupTest.xml | 1 + .../AdminCreateUserActionGroup.xml | 7 +- .../AdminCreateUserRoleActionGroup.xml | 7 +- .../FunctionalTest/User/Data/UserRoleData.xml | 6 +- .../User/Page/AdminEditRolePage.xml | 6 +- .../User/Page/AdminRolesPage.xml | 6 +- .../User/Section/AdminEditRoleInfoSection.xml | 4 +- .../Section/AdminEditRoleResourcesSection.xml | 4 +- .../User/Section/AdminEditUserRoleSection.xml | 4 +- .../User/Section/AdminRoleGridSection.xml | 4 +- .../User/Test/AdminCreateUserCest.xml | 42 ++--- .../User/Test/AdminCreateUserRoleCest.xml | 36 ++-- 49 files changed, 401 insertions(+), 429 deletions(-) diff --git a/dev/tests/acceptance/composer.lock b/dev/tests/acceptance/composer.lock index bec049ab58e6a..2fa1cf5159852 100644 --- a/dev/tests/acceptance/composer.lock +++ b/dev/tests/acceptance/composer.lock @@ -4,6 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], + "hash": "915b03849df36fc07440088c27242658", "content-hash": "d3546529b85b537be76f5b4a60087830", "packages": [ { @@ -55,7 +56,7 @@ "steps", "testing" ], - "time": "2017-03-30T09:01:00+00:00" + "time": "2017-03-30 09:01:00" }, { "name": "allure-framework/allure-php-api", @@ -107,7 +108,7 @@ "php", "report" ], - "time": "2016-12-07T12:15:46+00:00" + "time": "2016-12-07 12:15:46" }, { "name": "behat/gherkin", @@ -166,7 +167,7 @@ "gherkin", "parser" ], - "time": "2016-10-30T11:50:56+00:00" + "time": "2016-10-30 11:50:56" }, { "name": "codeception/codeception", @@ -262,7 +263,7 @@ "functional testing", "unit testing" ], - "time": "2017-12-12T04:22:17+00:00" + "time": "2017-12-12 04:22:17" }, { "name": "consolidation/annotated-command", @@ -313,7 +314,7 @@ } ], "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2017-11-29T16:23:23+00:00" + "time": "2017-11-29 16:23:23" }, { "name": "consolidation/config", @@ -367,7 +368,7 @@ } ], "description": "Provide configuration services for a commandline tool.", - "time": "2017-12-22T17:28:19+00:00" + "time": "2017-12-22 17:28:19" }, { "name": "consolidation/log", @@ -415,7 +416,7 @@ } ], "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2017-11-29T01:44:16+00:00" + "time": "2017-11-29 01:44:16" }, { "name": "consolidation/output-formatters", @@ -464,7 +465,7 @@ } ], "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2017-11-29T15:25:38+00:00" + "time": "2017-11-29 15:25:38" }, { "name": "consolidation/robo", @@ -541,7 +542,7 @@ } ], "description": "Modern task runner", - "time": "2017-12-29T06:48:35+00:00" + "time": "2017-12-29 06:48:35" }, { "name": "container-interop/container-interop", @@ -572,7 +573,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14T19:40:03+00:00" + "time": "2017-02-14 19:40:03" }, { "name": "dflydev/dot-access-data", @@ -631,7 +632,7 @@ "dot", "notation" ], - "time": "2017-01-20T21:14:22+00:00" + "time": "2017-01-20 21:14:22" }, { "name": "doctrine/annotations", @@ -699,7 +700,7 @@ "docblock", "parser" ], - "time": "2017-02-24T16:22:25+00:00" + "time": "2017-02-24 16:22:25" }, { "name": "doctrine/collections", @@ -766,7 +767,7 @@ "collections", "iterator" ], - "time": "2017-01-03T10:49:41+00:00" + "time": "2017-01-03 10:49:41" }, { "name": "doctrine/instantiator", @@ -820,7 +821,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2015-06-14 21:17:01" }, { "name": "doctrine/lexer", @@ -874,7 +875,7 @@ "lexer", "parser" ], - "time": "2014-09-09T13:34:57+00:00" + "time": "2014-09-09 13:34:57" }, { "name": "epfremme/swagger-php", @@ -920,7 +921,7 @@ } ], "description": "Library for parsing swagger documentation into PHP entities for use in testing and code generation", - "time": "2016-09-26T17:24:17+00:00" + "time": "2016-09-26 17:24:17" }, { "name": "facebook/webdriver", @@ -975,7 +976,7 @@ "selenium", "webdriver" ], - "time": "2017-11-15T11:08:09+00:00" + "time": "2017-11-15 11:08:09" }, { "name": "flow/jsonpath", @@ -1016,7 +1017,7 @@ } ], "description": "JSONPath implementation for parsing, searching and flattening arrays", - "time": "2016-09-06T17:43:18+00:00" + "time": "2016-09-06 17:43:18" }, { "name": "fzaninotto/faker", @@ -1066,7 +1067,7 @@ "faker", "fixtures" ], - "time": "2017-08-15T16:48:10+00:00" + "time": "2017-08-15 16:48:10" }, { "name": "grasmash/expander", @@ -1113,7 +1114,7 @@ } ], "description": "Expands internal property references in PHP arrays file.", - "time": "2017-12-21T22:14:55+00:00" + "time": "2017-12-21 22:14:55" }, { "name": "grasmash/yaml-expander", @@ -1161,7 +1162,7 @@ } ], "description": "Expands internal property references in a yaml file.", - "time": "2017-12-16T16:06:03+00:00" + "time": "2017-12-16 16:06:03" }, { "name": "guzzlehttp/guzzle", @@ -1226,7 +1227,7 @@ "rest", "web service" ], - "time": "2017-06-22T18:50:49+00:00" + "time": "2017-06-22 18:50:49" }, { "name": "guzzlehttp/promises", @@ -1277,7 +1278,7 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "time": "2016-12-20 10:07:11" }, { "name": "guzzlehttp/psr7", @@ -1342,7 +1343,7 @@ "uri", "url" ], - "time": "2017-03-20T17:10:46+00:00" + "time": "2017-03-20 17:10:46" }, { "name": "henrikbjorn/lurker", @@ -1401,7 +1402,7 @@ "resource", "watching" ], - "time": "2016-03-16T15:22:20+00:00" + "time": "2016-03-16 15:22:20" }, { "name": "jms/metadata", @@ -1452,7 +1453,7 @@ "xml", "yaml" ], - "time": "2016-12-05T10:18:33+00:00" + "time": "2016-12-05 10:18:33" }, { "name": "jms/parser-lib", @@ -1487,7 +1488,7 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18T18:08:43+00:00" + "time": "2012-11-18 18:08:43" }, { "name": "jms/serializer", @@ -1572,7 +1573,7 @@ "serialization", "xml" ], - "time": "2017-11-30T18:23:40+00:00" + "time": "2017-11-30 18:23:40" }, { "name": "league/container", @@ -1637,7 +1638,7 @@ "provider", "service" ], - "time": "2017-05-10T09:20:27+00:00" + "time": "2017-05-10 09:20:27" }, { "name": "magento/magento2-functional-testing-framework", @@ -1698,7 +1699,7 @@ "magento", "testing" ], - "time": "2018-01-17T12:02:50+00:00" + "time": "2018-01-17 12:02:50" }, { "name": "moontoast/math", @@ -1747,7 +1748,7 @@ "bcmath", "math" ], - "time": "2017-02-16T16:54:46+00:00" + "time": "2017-02-16 16:54:46" }, { "name": "mustache/mustache", @@ -1793,7 +1794,7 @@ "mustache", "templating" ], - "time": "2017-07-11T12:54:05+00:00" + "time": "2017-07-11 12:54:05" }, { "name": "myclabs/deep-copy", @@ -1838,7 +1839,7 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2017-10-19 19:58:43" }, { "name": "paragonie/random_compat", @@ -1886,7 +1887,7 @@ "pseudorandom", "random" ], - "time": "2017-09-27T21:40:39+00:00" + "time": "2017-09-27 21:40:39" }, { "name": "phar-io/manifest", @@ -1941,7 +1942,7 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "time": "2017-03-05 18:14:27" }, { "name": "phar-io/version", @@ -1988,7 +1989,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "time": "2017-03-05 17:38:23" }, { "name": "phpcollection/phpcollection", @@ -2036,7 +2037,7 @@ "sequence", "set" ], - "time": "2015-05-17T12:39:23+00:00" + "time": "2015-05-17 12:39:23" }, { "name": "phpdocumentor/reflection-common", @@ -2090,7 +2091,7 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2017-09-11 18:02:19" }, { "name": "phpdocumentor/reflection-docblock", @@ -2141,7 +2142,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-27T17:38:31+00:00" + "time": "2017-11-27 17:38:31" }, { "name": "phpdocumentor/type-resolver", @@ -2188,7 +2189,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2017-07-14 14:27:02" }, { "name": "phpoption/phpoption", @@ -2238,7 +2239,7 @@ "php", "type" ], - "time": "2015-07-25T16:39:46+00:00" + "time": "2015-07-25 16:39:46" }, { "name": "phpspec/prophecy", @@ -2301,7 +2302,7 @@ "spy", "stub" ], - "time": "2017-11-24T13:59:53+00:00" + "time": "2017-11-24 13:59:53" }, { "name": "phpunit/php-code-coverage", @@ -2364,7 +2365,7 @@ "testing", "xunit" ], - "time": "2017-12-06T09:29:45+00:00" + "time": "2017-12-06 09:29:45" }, { "name": "phpunit/php-file-iterator", @@ -2411,7 +2412,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2017-11-27 13:52:08" }, { "name": "phpunit/php-text-template", @@ -2452,7 +2453,7 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", @@ -2501,7 +2502,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2017-02-26 11:10:40" }, { "name": "phpunit/php-token-stream", @@ -2550,7 +2551,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2017-11-27 05:48:46" }, { "name": "phpunit/phpunit", @@ -2634,7 +2635,7 @@ "testing", "xunit" ], - "time": "2017-11-08T11:26:09+00:00" + "time": "2017-11-08 11:26:09" }, { "name": "phpunit/phpunit-mock-objects", @@ -2693,7 +2694,7 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2017-08-03 14:08:16" }, { "name": "psr/container", @@ -2742,7 +2743,7 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2017-02-14 16:28:37" }, { "name": "psr/http-message", @@ -2792,7 +2793,7 @@ "request", "response" ], - "time": "2016-08-06T14:39:51+00:00" + "time": "2016-08-06 14:39:51" }, { "name": "psr/log", @@ -2839,20 +2840,20 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2016-10-10 12:19:37" }, { "name": "ramsey/uuid", - "version": "3.7.2", + "version": "3.7.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d" + "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/bba83ad77bb9deb6d3c352a7361b818e415b221d", - "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76", + "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76", "shasum": "" }, "require": { @@ -2863,17 +2864,15 @@ "rhumsaa/uuid": "self.version" }, "require-dev": { - "apigen/apigen": "^4.1", "codeception/aspect-mock": "^1.0 | ~2.0.0", "doctrine/annotations": "~1.2.0", "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", - "mockery/mockery": "^0.9.4", + "mockery/mockery": "^0.9.9", "moontoast/math": "^1.1", "php-mock/php-mock-phpunit": "^0.3|^1.1", "phpunit/phpunit": "^4.7|^5.0", - "satooshi/php-coveralls": "^0.6.1", "squizlabs/php_codesniffer": "^2.3" }, "suggest": { @@ -2921,7 +2920,7 @@ "identifier", "uuid" ], - "time": "2018-01-13T22:22:03+00:00" + "time": "2018-01-20 00:28:24" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2966,7 +2965,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "time": "2017-03-04 06:30:41" }, { "name": "sebastian/comparator", @@ -3030,7 +3029,7 @@ "compare", "equality" ], - "time": "2018-01-12T06:34:42+00:00" + "time": "2018-01-12 06:34:42" }, { "name": "sebastian/diff", @@ -3082,7 +3081,7 @@ "keywords": [ "diff" ], - "time": "2017-08-03T08:09:46+00:00" + "time": "2017-08-03 08:09:46" }, { "name": "sebastian/environment", @@ -3132,7 +3131,7 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2017-07-01 08:51:00" }, { "name": "sebastian/exporter", @@ -3199,7 +3198,7 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2017-04-03 13:19:02" }, { "name": "sebastian/global-state", @@ -3250,7 +3249,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2017-04-27 15:39:26" }, { "name": "sebastian/object-enumerator", @@ -3297,7 +3296,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "time": "2017-08-03 12:35:26" }, { "name": "sebastian/object-reflector", @@ -3342,7 +3341,7 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "time": "2017-03-29 09:07:27" }, { "name": "sebastian/recursion-context", @@ -3395,7 +3394,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "time": "2017-03-03 06:23:57" }, { "name": "sebastian/resource-operations", @@ -3437,7 +3436,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2015-07-28 20:34:47" }, { "name": "sebastian/version", @@ -3480,7 +3479,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "time": "2016-10-03 07:35:21" }, { "name": "symfony/browser-kit", @@ -3537,7 +3536,7 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/config", @@ -3599,7 +3598,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/console", @@ -3668,7 +3667,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/css-selector", @@ -3721,7 +3720,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/debug", @@ -3777,7 +3776,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:14:19+00:00" + "time": "2018-01-03 17:14:19" }, { "name": "symfony/dom-crawler", @@ -3833,7 +3832,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/event-dispatcher", @@ -3896,7 +3895,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/filesystem", @@ -3945,7 +3944,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/finder", @@ -3994,7 +3993,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "symfony/http-foundation", @@ -4048,7 +4047,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:14:19+00:00" + "time": "2018-01-03 17:14:19" }, { "name": "symfony/polyfill-mbstring", @@ -4107,7 +4106,7 @@ "portable", "shim" ], - "time": "2017-10-11T12:05:26+00:00" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/polyfill-php70", @@ -4166,7 +4165,7 @@ "portable", "shim" ], - "time": "2017-10-11T12:05:26+00:00" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/process", @@ -4215,7 +4214,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:11+00:00" + "time": "2018-01-03 07:37:11" }, { "name": "symfony/yaml", @@ -4273,7 +4272,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03 07:37:34" }, { "name": "theseer/tokenizer", @@ -4313,7 +4312,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2017-04-07 12:08:54" }, { "name": "vlucas/phpdotenv", @@ -4363,7 +4362,7 @@ "env", "environment" ], - "time": "2016-09-01T10:05:43+00:00" + "time": "2016-09-01 10:05:43" }, { "name": "webmozart/assert", @@ -4413,7 +4412,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2016-11-23 20:04:58" } ], "packages-dev": [], diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml index a3b3a4c1453cc..976bd2adac217 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml @@ -5,9 +5,9 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="StorefrontProductActionSection"> <element name="addToCart" type="button" selector="#product-addtocart-button"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml index 3868909a24b4b..6f37d99507ac0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml @@ -16,7 +16,6 @@ <description value="Admin should be able to add image to WYSIWYG Editor on Product Page"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84375"/> - <group value="skip"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> @@ -29,6 +28,7 @@ <fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> <fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> <fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <scrollTo selector="{{AdminProductFormSection.productQuantity}}" stepKey="scrollToQty" /> <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitForDescription" /> <click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon1" /> @@ -69,7 +69,7 @@ <fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight1" /> <click selector="{{ProductDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="clickOkBtn1" /> <waitForPageLoad stepKey="waitForPageLoad3"/> - + <scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="scrollToTinyMCE4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon2" /> <waitForPageLoad stepKey="waitForPageLoad4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" /> @@ -99,6 +99,7 @@ <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="clickOkBtn2" /> <waitForPageLoad stepKey="waitForPageLoad6"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading13" /> <amOnPage url="{{_defaultProduct.name}}.html" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> <seeElement selector="{{StorefrontProductInfoMainSection.mediaDescription}}" stepKey="assertMediaDescription"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml index 9b91f5a923f60..2b2c9ed2d6190 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml @@ -46,6 +46,7 @@ <dontSeeElement selector="{{ProductAttributeWYSIWYGSection.TinyMCE4($$myProductAttributeCreation.attribute_code$$)}}" stepKey="dontSeeTinyMCE4" /> <fillField selector="{{ProductAttributeWYSIWYGSection.TextArea($$myProductAttributeCreation.attribute_code$$)}}" userInput="Text Area" stepKey="fillContentTextarea" /> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading1"/> <!-- Go to storefront product page, assert product content --> <amOnPage url="{{_defaultProduct.name}}.html" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForPageLoad5"/> @@ -68,6 +69,7 @@ <waitForPageLoad stepKey="waitForPageLoad10" /> <seeElement selector="{{ProductAttributeWYSIWYGSection.TinyMCE4($$myProductAttributeCreation.attribute_code$$)}}" stepKey="waitForPageLoad11"/> <after> + <deleteData createDataKey="myProductAttributeCreation" stepKey="deletePreReqProductAttribute" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml index bf8c55ae76357..90005bcb6df97 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml @@ -25,6 +25,7 @@ </before> <amOnPage url="{{AdminProductEditPage(simple)}}" stepKey="navigateToProduct"/> <waitForPageLoad stepKey="wait"/> + <scrollTo selector="{{AdminProductFormSection.productQuantity}}" stepKey="scrollToQty" /> <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitforTinyMCE4Visible1"/> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="TinyMCE4Description" /> @@ -63,6 +64,7 @@ </before> <amOnPage url="{{AdminProductEditPage(simple)}}" stepKey="navigateToProduct"/> <waitForPageLoad stepKey="wait"/> + <scrollTo selector="{{AdminProductFormSection.productQuantity}}" stepKey="scrollToQty" /> <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitforTinyMCE4Visible2"/> <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="TinyMCE4ShortDescription" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml index be281d02c29d3..cddc997b304fa 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml @@ -31,30 +31,18 @@ <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab"/> <waitForElementVisible selector="{{CatalogWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4" /> <seeElement selector="{{CatalogWYSIWYGSection.ShowHideBtn}}" stepKey="seeShowHideBtn" /> - <seeElement selector="{{CatalogWYSIWYGSection.TinyMCE4}}" stepKey="TinyMCE4" /> - <seeElement selector="{{CatalogWYSIWYGSection.Style}}" stepKey="assertInfo2"/> - <seeElement selector="{{CatalogWYSIWYGSection.Bold}}" stepKey="assertInfo3"/> - <seeElement selector="{{CatalogWYSIWYGSection.Italic}}" stepKey="assertInfo4"/> - <seeElement selector="{{CatalogWYSIWYGSection.Underline}}" stepKey="assertInfo5"/> - <seeElement selector="{{CatalogWYSIWYGSection.AlignLeft}}" stepKey="assertInfo6"/> - <seeElement selector="{{CatalogWYSIWYGSection.AlignCenter}}" stepKey="assertInfo7"/> - <seeElement selector="{{CatalogWYSIWYGSection.AlignRight}}" stepKey="assertInfo8"/> - <seeElement selector="{{CatalogWYSIWYGSection.Numlist}}" stepKey="assertInfo9"/> - <seeElement selector="{{CatalogWYSIWYGSection.Bullet}}" stepKey="assertInfo10"/> - <seeElement selector="{{CatalogWYSIWYGSection.InsertLink}}" stepKey="assertInfo11"/> - <seeElement selector="{{CatalogWYSIWYGSection.InsertImage}}" stepKey="assertInf12"/> - <seeElement selector="{{CatalogWYSIWYGSection.InsertTable}}" stepKey="assertInfo13"/> - <seeElement selector="{{CatalogWYSIWYGSection.SpecialCharacter}}" stepKey="assertInfo14"/> + <actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyTinyMCE4"/> <executeJS function="tinyMCE.get('category_form_description').setContent('Hello World!');" stepKey="executeJSFillContent"/> <click selector="{{CatalogWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.InsertImageBtn}}" stepKey="waitForInsertImage" /> - <seeElement selector="{{CmsWYSIWYGSection.InsertImageBtn}}" stepKey="insertImage"/> - <dontSee selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="insertWidget" /> - <dontSee selector="{{CmsWYSIWYGSection.InsertVariableBtn}}" stepKey="insertVariable" /> + <waitForElementVisible selector="{{TinyMCESection.InsertImageBtn}}" stepKey="waitForInsertImage" /> + <seeElement selector="{{TinyMCESection.InsertImageBtn}}" stepKey="insertImage"/> + <dontSee selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="insertWidget" /> + <dontSee selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="insertVariable" /> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCatalog"/> <!-- Go to storefront product page, assert product content --> <amOnPage url="/{{SimpleSubCategory.name_lwr}}.html" stepKey="goToCategoryFrontPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.CatalogDescription}}" stepKey="waitForDesVisible" /> <see userInput="Hello World!" selector="{{StorefrontCategoryMainSection.CatalogDescription}}" stepKey="assertCatalogDescription"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml index 0a2fb2ee041dc..3a2855346f603 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml @@ -28,6 +28,7 @@ <fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/> <fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/> <fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/> + <scrollTo selector="{{AdminProductFormSection.productQuantity}}" stepKey="scrollToQty" /> <click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitForDescription" /> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="TinyMCE4Description" /> @@ -38,17 +39,19 @@ <click selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="clickShowHideBtn1" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" stepKey="waitForInsertImage1" /> <see selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage1"/> - <dontSee selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="insertWidget1" /> - <dontSee selector="{{CmsWYSIWYGSection.InsertVariableBtn}}" stepKey="insertVariable1" /> + <dontSee selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="insertWidget1" /> + <dontSee selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="insertVariable1" /> + <scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="scrollToDesShowHideBtn" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="clickShowHideBtn2" /> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" stepKey="waitForInsertImage2" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage2"/> - <dontSee selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="insertWidget2" /> - <dontSee selector="{{CmsWYSIWYGSection.InsertVariableBtn}}" stepKey="insertVariable2" /> + <dontSee selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="insertWidget2" /> + <dontSee selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="insertVariable2" /> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> <!-- Go to storefront product page, assert product content --> <amOnPage url="{{_defaultProduct.name}}.html" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> + <scrollTo selector="{{StorefrontProductInfoMainSection.stock}}" stepKey="scrollToStock"/> <see userInput="Hello World!" selector="{{StorefrontProductInfoMainSection.productDescription}}" stepKey="assertProductDescription"/> <see userInput="Hello World! Short Content" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> <after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml index 289513ca14454..bf750bc3c9944 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Data/CatalogRuleData.xml @@ -6,7 +6,7 @@ */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="_defaultCatalogRule" type="catalogRule"> <data key="name" unique="suffix">CatalogPriceRule</data> @@ -21,4 +21,4 @@ <data key="simple_action">by_percent</data> <data key="discount_amount">10</data> </entity> -</config> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml index 83bfd0070a2cc..e404e4471ba45 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogRule/Metadata/catalog-rule-meta.xml @@ -7,7 +7,7 @@ */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> <operation name="createCatalogRule" dataType="catalogRule" type="create" auth="adminFormKey" url="/catalog_rule/promo_catalog/save/" method="POST"> @@ -24,4 +24,4 @@ <field key="simple_action">string</field> <field key="discount_amount">string</field> </operation> -</config> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml index 6785f691fd385..b674bfdd134c1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml @@ -5,9 +5,9 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="VerifyMediaGalleryActionGroup"> </actionGroup> -</config> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml index a5f47667c9d80..f3c2f31270f33 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyTinyMCEActionGroup.xml @@ -5,8 +5,8 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="VerifyTinyMCEActionGroup"> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> <seeElement selector="{{TinyMCESection.TinyMCE4}}" stepKey="seeTinyMCE4" /> @@ -28,4 +28,4 @@ <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="assertInfo15"/> <seeElement selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="assertInfo16"/> </actionGroup> -</config> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml index 398dbf3cfd668..dbedf129c3757 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml @@ -6,7 +6,7 @@ */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="TinyMCESection"> <element name="checkIfContentTabOpen" type="button" selector="//span[text()='Content']/parent::strong/parent::*[@data-state-collapsible='closed']"/> @@ -106,4 +106,4 @@ <element name="AcceptClear" type="button" selector=".action-primary.action-accept" /> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index c7683d847eda3..d323d49c4a368 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -16,7 +16,6 @@ <description value="You should be able to add image to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84376"/> - <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> @@ -29,51 +28,55 @@ <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <click selector="{{BlockWYSIWYGSection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad2" /> - <click selector="{{BlockWYSIWYGSection.Browse}}" stepKey="clickBrowse" /> + <click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse" /> <waitForPageLoad stepKey="waitForPageLoad3" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading1" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading2" /> - <waitForElement selector="{{BlockWYSIWYGSection.CancelBtn}}" stepKey="waitForContent" /> - <see selector="{{BlockWYSIWYGSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> - <see selector="{{BlockWYSIWYGSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> - <see selector="{{BlockWYSIWYGSection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> - <click selector="{{BlockWYSIWYGSection.CreateFolder}}" stepKey="createFolder"/> - <waitForElementVisible selector="{{BlockWYSIWYGSection.FolderName}}" stepKey="waitForPopUp" /> - <fillField selector="{{BlockWYSIWYGSection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> - <waitForElement selector="{{BlockWYSIWYGSection.AcceptFolderName}}" stepKey="waitForAcceptBtn" /> + <waitForElement selector="{{MediaGallerySection.CancelBtn}}" stepKey="waitForContent" /> + <see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> + <see selector="{{MediaGallerySection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> + <see selector="{{MediaGallerySection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> + <click selector="{{MediaGallerySection.CreateFolder}}" stepKey="createFolder"/> + <waitForElementVisible selector="{{MediaGallerySection.FolderName}}" stepKey="waitForPopUp" /> + <fillField selector="{{MediaGallerySection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> + <waitForElement selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="waitForAcceptBtn" /> <wait time="3" stepKey="wait"/> - <click selector="{{BlockWYSIWYGSection.AcceptFolderName}}" stepKey="acceptFolderName" /> + <click selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="acceptFolderName" /> <waitForPageLoad stepKey="waitForPageLoad4" /> - <conditionalClick selector="{{BlockWYSIWYGSection.StorageRootArrow}}" dependentSelector="{{BlockWYSIWYGSection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> + <conditionalClick selector="{{MediaGallerySection.StorageRootArrow}}" dependentSelector="{{MediaGallerySection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> - <attachFile selector="{{BlockWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading4" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> - <seeElement selector="{{BlockWYSIWYGSection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> - <see selector="{{BlockWYSIWYGSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> - <click selector="{{BlockWYSIWYGSection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> + <seeElement selector="{{MediaGallerySection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> + <see selector="{{MediaGallerySection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> + <click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> <waitForText userInput="OK" stepKey="waitForConfirm" /> - <click selector="{{BlockWYSIWYGSection.confirmDelete}}" stepKey="confirmDelete" /> - <waitForElementNotVisible selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> - <dontSeeElement selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> - <attachFile selector="{{BlockWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> + <click selector="{{MediaGallerySection.confirmDelete}}" stepKey="confirmDelete" /> + <waitForElementNotVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> + <dontSeeElement selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading5" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> - <click selector="{{BlockWYSIWYGSection.InsertFile}}" stepKey="clickInsertBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> + <click selector="{{MediaGallerySection.InsertFile}}" stepKey="clickInsertBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading6" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.OkBtn}}" stepKey="waitForOkBtn" /> - <fillField selector="{{BlockWYSIWYGSection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> - <fillField selector="{{BlockWYSIWYGSection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> - <click selector="{{BlockWYSIWYGSection.OkBtn}}" stepKey="clickOkBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.OkBtn}}" stepKey="waitForOkBtn" /> + <fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> + <fillField selector="{{MediaGallerySection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> + <click selector="{{MediaGallerySection.OkBtn}}" stepKey="clickOkBtn" /> <waitForPageLoad stepKey="waitForPageLoad5"/> <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad6"/> + <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> + <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> + <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> @@ -81,9 +84,9 @@ <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> <waitForPageLoad stepKey="waitForPageLoad7" /> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad8" /> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Static Block" stepKey="selectCMSStaticBlock" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> @@ -103,6 +106,7 @@ <!--see image on Storefront--> <seeElement selector="{{StorefrontBlockSection.mediaDescription}}" stepKey="assertMediaDescription"/> <after> + <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml index 0fee3bc8686ec..ed6b6fc7d7319 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml @@ -26,44 +26,44 @@ <waitForPageLoad stepKey="wait"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContent"/> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4" /> - <click selector="{{CmsWYSIWYGSection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4" /> + <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> - <click selector="{{CmsWYSIWYGSection.Browse}}" stepKey="clickBrowse" /> + <click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse" /> <waitForPageLoad stepKey="waitForPageLoad1" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading1" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading2" /> - <see selector="{{CmsWYSIWYGSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> - <see selector="{{CmsWYSIWYGSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> - <see selector="{{CmsWYSIWYGSection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> - <click selector="{{CmsWYSIWYGSection.CreateFolder}}" stepKey="createFolder"/> - <waitForElementVisible selector="{{CmsWYSIWYGSection.FolderName}}" stepKey="waitForPopUp" /> - <fillField selector="{{CmsWYSIWYGSection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> - <click selector="{{CmsWYSIWYGSection.AcceptFolderName}}" stepKey="acceptFolderName" /> + <see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> + <see selector="{{MediaGallerySection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> + <see selector="{{MediaGallerySection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> + <click selector="{{MediaGallerySection.CreateFolder}}" stepKey="createFolder"/> + <waitForElementVisible selector="{{MediaGallerySection.FolderName}}" stepKey="waitForPopUp" /> + <fillField selector="{{MediaGallerySection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> + <click selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="acceptFolderName" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> - <conditionalClick selector="{{CmsWYSIWYGSection.StorageRootArrow}}" dependentSelector="{{CmsWYSIWYGSection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> + <conditionalClick selector="{{MediaGallerySection.StorageRootArrow}}" dependentSelector="{{MediaGallerySection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading5" /> - <attachFile selector="{{CmsWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading6" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> - <seeElement selector="{{CmsWYSIWYGSection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> - <see selector="{{CmsWYSIWYGSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> - <click selector="{{CmsWYSIWYGSection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> + <seeElement selector="{{MediaGallerySection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> + <see selector="{{MediaGallerySection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> + <click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> <waitForText userInput="OK" stepKey="waitForConfirm" /> - <click selector="{{CmsWYSIWYGSection.confirmDelete}}" stepKey="confirmDelete" /> - <waitForElementNotVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> - <dontSeeElement selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> - <attachFile selector="{{CmsWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> + <click selector="{{MediaGallerySection.confirmDelete}}" stepKey="confirmDelete" /> + <waitForElementNotVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> + <dontSeeElement selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> - <click selector="{{CmsWYSIWYGSection.InsertFile}}" stepKey="clickInsertBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> + <click selector="{{MediaGallerySection.InsertFile}}" stepKey="clickInsertBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.OkBtn}}" stepKey="waitForOkBtn" /> - <fillField selector="{{CmsWYSIWYGSection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> - <fillField selector="{{CmsWYSIWYGSection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> - <click selector="{{CmsWYSIWYGSection.OkBtn}}" stepKey="clickOkBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.OkBtn}}" stepKey="waitForOkBtn" /> + <fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> + <fillField selector="{{MediaGallerySection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> + <click selector="{{MediaGallerySection.OkBtn}}" stepKey="clickOkBtn" /> <waitForPageLoad stepKey="wait3"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_defaultCmsPage.identifier}}" stepKey="fillFieldUrlKey"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 77ac3ed328935..80e418ea4bf22 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -11,7 +11,7 @@ <annotations> <features value="Add Variable to WYSIWYG Block"/> <stories value="Add Variable to WYSIWYG MAGETWO-42158"/> - <group value="variableBLock"/> + <group value="variableBlock"/> <title value="You should be able to add variable to WYSIWYG Editor of Block"/> <description value="You should be able to add variable to WYSIWYG Editor Block"/> <testCaseId value="MAGETWO-84378"/> @@ -38,9 +38,9 @@ <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <seeElement selector="{{BlockWYSIWYGSection.InsertVariableIcon}}" stepKey="seeInsertVariableIcon" /> - <click selector="{{BlockWYSIWYGSection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon1" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <seeElement selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="seeInsertVariableIcon" /> + <click selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon1" /> <waitForText userInput="Insert Variable" stepKey="waitForSlideOutOpen"/> <waitForLoadingMaskToDisappear stepKey="waitForPageLoad3"/> <!--see Insert Variable button disabled--> @@ -56,8 +56,9 @@ <click selector="{{VariableSection.Radio('city')}}" stepKey="selectDefaultVariable"/> <see selector="{{VariableSection.InsertVariableBtnEnabled}}" userInput="Insert Variable" stepKey="seeInsertVarialeEnabled" /> <click selector="{{VariableSection.InsertVariableBtnEnabled}}" stepKey="save1" /> - <waitForPageLoad stepKey="waitForPageLoad10" /> - <click selector="{{BlockWYSIWYGSection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon2" /> + <scrollTo selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" stepKey="scrollToBlockTitle" /> + <waitForElementNotVisible selector="{{VariableSection.VariableTitle}}" stepKey="waitForSlideoutCloses" /> + <click selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon2" /> <waitForPageLoad stepKey="waitForPageLoad4"/> <!--see custom variable--> <see userInput="{{customVariable.code}}" stepKey="seeCustomVariable"/> @@ -73,21 +74,23 @@ <click selector="{{VariableSection.InsertVariableBtnEnabled}}" stepKey="save2" /> <waitForElementNotVisible selector="{{VariableSection.VariableTitle}}" stepKey="waitForSlideOutClose" /> <click selector="{{BlockWYSIWYGSection.ShowHideBtn}}" stepKey="clickShow/HideBtn"/> - <waitForElementVisible selector="{{BlockWYSIWYGSection.InsertVariableBtn}}" stepKey="waitForInsertVariableBtn" /> - <seeElement selector="{{BlockWYSIWYGSection.InsertVariableBtn}}" stepKey="InsertVariableBtn" /> + <waitForElementVisible selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="waitForInsertVariableBtn" /> + <seeElement selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="InsertVariableBtn" /> <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad7"/> - <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> + <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> + <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> + <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading2" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> <waitForPageLoad stepKey="waitForPageLoad8" /> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad9" /> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Static Block" stepKey="selectCMSStaticBlock" /> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" /> @@ -116,6 +119,7 @@ <!--see custom variable blank--> <dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" /> <after> + <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index 6867fa376a632..26c0416e93356 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -37,10 +37,10 @@ <waitForPageLoad stepKey="waitForPageLoad2"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertVariableIcon}}" stepKey="seeInsertVariableIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon1" /> + <seeElement selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="seeInsertVariableIcon" /> + <click selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon1" /> <waitForLoadingMaskToDisappear stepKey="waitForPageLoad3"/> <waitForText userInput="Insert Variable" stepKey="waitForSlideOutOpen"/> <!--see Insert Variable button disabled--> @@ -57,7 +57,7 @@ <see selector="{{VariableSection.InsertVariableBtnEnabled}}" userInput="Insert Variable" stepKey="seeInsertVarialeEnabled" /> <click selector="{{VariableSection.InsertVariableBtnEnabled}}" stepKey="save1" /> <waitForPageLoad stepKey="waitForPageLoad8" /> - <click selector="{{CmsWYSIWYGSection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon2" /> + <click selector="{{TinyMCESection.InsertVariableIcon}}" stepKey="clickInsertVariableIcon2" /> <waitForPageLoad stepKey="waitForPageLoad4"/> <!--see custom variable--> <see userInput="{{customVariable.code}}" stepKey="seeCustomVariable"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 998649c7c78c3..0cee7454fedf6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -11,12 +11,11 @@ <annotations> <features value="Add Widget to WYSIWYG of Block"/> <stories value="Apply new WYSIWYG in Block-MAGETWO-47309"/> - <group value="widgetBLock"/> + <group value="widgetBlock"/> <title value="You should be able to add widget to WYSIWYG Editor of Block"/> <description value="You should be able to add widget to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84654"/> - <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> @@ -29,8 +28,8 @@ <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <click selector="{{BlockWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon1" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon1" /> <wait time="10" stepKey="waitForPageLoad2" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Page Link" stepKey="selectCMSPageLink" /> @@ -47,16 +46,18 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad3"/> - <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> + <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> + <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> + <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> <waitForPageLoad stepKey="waitForPageLoad4" /> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon2" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon2" /> <waitForPageLoad stepKey="waitForPageLoad5" /> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Static Block" stepKey="selectCMSStaticBlock" /> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear2" /> @@ -74,7 +75,7 @@ <waitForPageLoad stepKey="waitForPageLoad7" /> <see userInput="Home page" stepKey="seeHomePageCMSPage"/> <after> - <!--<deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage" />--> + <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml index 9c88502e207e1..76630b6a64800 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml @@ -28,10 +28,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="wait2"/> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <!--see Insert Widget button disabled--> @@ -46,6 +46,7 @@ <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> <!--<waitForLoadingMaskToDisappear stepKey="wait3"/>--> <waitForElementVisible selector="{{WidgetSection.CMSPage}}" stepKey="waitForPageVisible" /> + <scrollTo selector="{{WidgetSection.CMSPage}}" stepKey="scrollToCMSName" /> <click selector="{{WidgetSection.CMSPage}}" stepKey="selectPreCreateCMS" /> <waitForElementNotVisible selector="{{WidgetSection.SelectPageTitle}}" stepKey="waitForSlideOutCloses" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidget" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 6b2cbdc24ae2c..91833da997459 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -14,12 +14,12 @@ <stories value="Widgets in WYSIWYG"/> <group value="CMSStaticBlock"/> <title value="Create CMS Page With Widget Type:CMS Static Block"/> - <description value="Create CMS Page With Widget Type:CMS Static Blocl"/> + <description value="Create CMS Page With Widget Type:CMS Static Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83787"/> </annotations> <before> - <createData entity="_defaultBlock" stepKey="createPreBlock" /> + <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> <actionGroup ref="LoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> @@ -29,10 +29,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <!--see Insert Widget button disabled--> @@ -47,8 +47,9 @@ <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> <waitForLoadingMaskToDisappear stepKey="wait3"/> - <waitForElementVisible selector="{{WidgetSection.BlockPage($$createPreBlock.identifier$$)}}" stepKey="waitForSlideoutOpens" /> - <click selector="{{WidgetSection.BlockPage($$createPreBlock.identifier$$)}}" stepKey="selectPreCreateBlock" /> + <waitForElementVisible selector="{{WidgetSection.BlockPage($$createPreReqBlock.identifier$$)}}" stepKey="waitForSlideoutOpens" /> + <scrollTo selector="{{WidgetSection.BlockPage($$createPreReqBlock.identifier$$)}}" stepKey="scrollToBlockIdentifier" /> + <click selector="{{WidgetSection.BlockPage($$createPreReqBlock.identifier$$)}}" stepKey="selectPreCreateBlock" /> <waitForElementNotVisible selector="{{WidgetSection.SelectBlockTitle}}" stepKey="waitForSlideoutCloses" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidget" /> <waitForLoadingMaskToDisappear stepKey="waitingForLoading" /> @@ -61,8 +62,9 @@ <waitForPageLoad stepKey="wait5" /> <!--see widget on Storefront--> <see userInput="Hello CMS Page!" stepKey="seeContent"/> - <see userInput="$$createPreBlock.content$$" stepKey="seeBlockLink"/> + <see userInput="$$createPreReqBlock.content$$" stepKey="seeBlockLink"/> <after> + <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 9e4a77ad1ef06..29717ae41f532 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -28,10 +28,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="wait2"/> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <!--see Insert Widget button disabled--> @@ -60,6 +60,7 @@ <!--see widget on Storefront--> <see userInput="$$createPreReqCategory.name$$" stepKey="seeCategoryLink"/> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml index da09d2512315d..886e80c2af6e4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml @@ -32,10 +32,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="wait2"/> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <waitForPageLoad stepKey="wait3"/> @@ -68,6 +68,8 @@ <see userInput="Hello CMS Page!" stepKey="seeContent"/> <see userInput="$$createPreReqProduct.name$$" stepKey="seeProductLink"/> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 83ea2264371ca..131dac25abd53 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -15,7 +15,7 @@ <title value="Create CMS Page With Widget Type: Catalog product list"/> <description value="Create CMS Page With Widget Type: Catalog product list"/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-"/> + <testCaseId value="MAGETWO-67091"/> </annotations> <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> @@ -34,10 +34,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad1" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <!--see Insert Widget button disabled--> @@ -73,6 +73,9 @@ <see userInput="$$createPreReqProduct1.name$$" stepKey="seeProductLink1"/> <see userInput="$$createPreReqProduct2.name$$" stepKey="seeProductLink2"/> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> + <deleteData createDataKey="createPreReqProduct1" stepKey="deletePreReqProduct1" /> + <deleteData createDataKey="createPreReqProduct2" stepKey="deletePreReqProduct2" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 7dedac0e843be..178901129543a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -17,7 +17,6 @@ <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83792"/> - <group value="skip" /> </annotations> <!--Main test--> <before> @@ -33,10 +32,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <waitForPageLoad stepKey="wait2"/> @@ -76,9 +75,11 @@ <!--see widget on Storefront--> <see userInput="Hello CMS Page!" stepKey="seeContent"/> <waitForPageLoad stepKey="wait6" /> - <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waiForProductVisible" /> + <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waitForProductVisible" /> <see userInput="$$createPreReqProduct.name$$" stepKey="seeProductName" /> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml index eb96c3047bf15..d55ddd6c51263 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml @@ -32,10 +32,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <!--see Insert Widget button disabled--> @@ -68,6 +68,8 @@ <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waitForProductVisible" /> <see userInput="$$createPreReqProduct.name$$" stepKey="seeProductName" /> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index 11cec94b91b54..8f0a834ff3069 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -17,7 +17,6 @@ <description value="Admin are able to switch between versions of TinyMCE."/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-82936"/> - <group value="skip" /> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> @@ -35,8 +34,8 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle1"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab1" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> - <seeElement selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="seeTinyMCE4" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <seeElement selector="{{TinyMCESection.TinyMCE4}}" stepKey="seeTinyMCE4" /> <executeJS function="tinyMCE.activeEditor.setContent('Hello TinyMCE4!');" stepKey="executeJSFillContent1"/> <click selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn1" /> <scrollTo selector="{{CmsNewPagePageSeoSection.header}}" stepKey="scrollToSearchEngineTab1" /> @@ -60,8 +59,8 @@ <waitForPageLoad stepKey="wait2"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE3}}" stepKey="waitForTinyMCE3"/> - <seeElement selector="{{CmsWYSIWYGSection.TinyMCE3}}" stepKey="seeTinyMCE3" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE3}}" stepKey="waitForTinyMCE3"/> + <seeElement selector="{{TinyMCESection.TinyMCE3}}" stepKey="seeTinyMCE3" /> <executeJS function="tinyMCE.activeEditor.setContent('Hello TinyMCE3!');" stepKey="executeJSFillContent2"/> <click selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn2" /> <scrollTo selector="{{CmsNewPagePageSeoSection.header}}" stepKey="scrollToSearchEngineTab2" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 15c0b8c8e6639..10599ab90e00d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -17,10 +17,9 @@ <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84184 "/> - <group value="skip" /> </annotations> <before> - <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> + <createData entity="_defaultCmsPage" stepKey="createPreReqCMSPage" /> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> @@ -30,50 +29,42 @@ <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <seeElement selector="{{BlockWYSIWYGSection.TinyMCE4}}" stepKey="seeTinyMCE4" /> - <seeElement selector="{{BlockWYSIWYGSection.Style}}" stepKey="assertInfo2"/> - <seeElement selector="{{BlockWYSIWYGSection.Bold}}" stepKey="assertInfo3"/> - <seeElement selector="{{BlockWYSIWYGSection.Italic}}" stepKey="assertInfo4"/> - <seeElement selector="{{BlockWYSIWYGSection.Underline}}" stepKey="assertInfo5"/> - <seeElement selector="{{BlockWYSIWYGSection.AlignLeft}}" stepKey="assertInfo6"/> - <seeElement selector="{{BlockWYSIWYGSection.AlignCenter}}" stepKey="assertInfo7"/> - <seeElement selector="{{BlockWYSIWYGSection.AlignRight}}" stepKey="assertInfo8"/> - <seeElement selector="{{BlockWYSIWYGSection.Numlist}}" stepKey="assertInfo9"/> - <seeElement selector="{{BlockWYSIWYGSection.Bullet}}" stepKey="assertInfo10"/> - <seeElement selector="{{BlockWYSIWYGSection.InsertLink}}" stepKey="assertInfo11"/> - <seeElement selector="{{BlockWYSIWYGSection.InsertImageIcon}}" stepKey="assertInf12"/> - <seeElement selector="{{BlockWYSIWYGSection.InsertTable}}" stepKey="assertInfo13"/> - <seeElement selector="{{BlockWYSIWYGSection.SpecialCharacter}}" stepKey="assertInfo14"/> - <seeElement selector="{{BlockWYSIWYGSection.InsertWidgetIcon}}" stepKey="assertInfo15"/> - <seeElement selector="{{BlockWYSIWYGSection.InsertVariableIcon}}" stepKey="assertInfo16"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyTinyMCE4"/> + <actionGroup ref="VerifyMagentoEntityActionGroup" stepKey="verifyMagentoEntities"/> <executeJS function="tinyMCE.get('cms_block_form_content').setContent('Hello Block Page!');" stepKey="executeJSFillContent"/> <click selector="{{BlockWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn1" /> - <waitForElementVisible selector="{{BlockWYSIWYGSection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> - <see selector="{{BlockWYSIWYGSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="assertInf17"/> - <see selector="{{BlockWYSIWYGSection.InsertWidgetBtn}}" userInput="Insert Widget..." stepKey="assertInfo18"/> - <see selector="{{BlockWYSIWYGSection.InsertVariableBtn}}" userInput="Insert Variable..." stepKey="assertInfo19"/> + <waitForElementVisible selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> + <see selector="{{TinyMCESection.InsertImageBtn}}" userInput="Insert Image..." stepKey="assertInf17"/> + <see selector="{{TinyMCESection.InsertWidgetBtn}}" userInput="Insert Widget..." stepKey="assertInfo18"/> + <see selector="{{TinyMCESection.InsertVariableBtn}}" userInput="Insert Variable..." stepKey="assertInfo19"/> <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> - <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> - <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> - <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> - <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> - <click selector="{{CmsPagesPageActionsSection.edit('$$createCMSPage.identifier$$')}}" stepKey="clickEdit" /> + <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> + <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createPreReqCMSPage.identifier$$" stepKey="fillOutURLKey" /> + <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> + <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createPreReqCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> + <scrollTo selector="{{CmsPagesPageActionsSection.select('$$createPreReqCMSPage.identifier$$')}}" stepKey="scrollToCMSPage" /> + <click selector="{{CmsPagesPageActionsSection.select('$$createPreReqCMSPage.identifier$$')}}" stepKey="clickSelect" /> + <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit('$$createPreReqCMSPage.identifier$$')}}" stepKey="waitForEditLink" /> + <click selector="{{CmsPagesPageActionsSection.edit('$$createPreReqCMSPage.identifier$$')}}" stepKey="clickEdit" /> <waitForPageLoad stepKey="waitForPageLoad3" /> + <scrollTo selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" stepKey="scrollToPageTitle" /> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="waitforShowHideBtn" /> <click selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn2"/> - <waitForElementVisible selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="waitForInsertInsertWidgetBtn" /> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="widgetBtn" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="clickInsertWidgetBtn"/> + <waitForElementVisible selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="waitForInsertInsertWidgetBtn" /> + <seeElement selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="widgetBtn" /> + <click selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="clickInsertWidgetBtn"/> <waitForPageLoad stepKey="waitForPageLoad4"/> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Static Block" stepKey="selectCMSStaticBlock" /> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockCode" /> + <scrollTo selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="scrollToBlockIdentifier" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidget" /> @@ -81,11 +72,12 @@ <waitForPageLoad stepKey="waitForPageLoad5" /> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> - <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage"/> + <amOnPage url="$$createPreReqCMSPage.identifier$$" stepKey="amOnPageTestPage"/> <waitForPageLoad stepKey="waitForPageLoad6" /> <!--see content of Block on Storefront--> <see userInput="Hello Block Page!" stepKey="seeContent"/> <after> + <deleteData createDataKey="createPreReqCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml index b3879563e6d68..af6f165162649 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml @@ -29,32 +29,19 @@ <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContent"/> <fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{_defaultCmsPage.content_heading}}" stepKey="fillFieldContentHeading"/> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <seeElement selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="seeTinyMCE4" /> - <seeElement selector="{{CmsWYSIWYGSection.Style}}" stepKey="assertInfo2"/> - <seeElement selector="{{CmsWYSIWYGSection.Bold}}" stepKey="assertInfo3"/> - <seeElement selector="{{CmsWYSIWYGSection.Italic}}" stepKey="assertInfo4"/> - <seeElement selector="{{CmsWYSIWYGSection.Underline}}" stepKey="assertInfo5"/> - <seeElement selector="{{CmsWYSIWYGSection.AlignLeft}}" stepKey="assertInfo6"/> - <seeElement selector="{{CmsWYSIWYGSection.AlignCenter}}" stepKey="assertInfo7"/> - <seeElement selector="{{CmsWYSIWYGSection.AlignRight}}" stepKey="assertInfo8"/> - <seeElement selector="{{CmsWYSIWYGSection.Numlist}}" stepKey="assertInfo9"/> - <seeElement selector="{{CmsWYSIWYGSection.Bullet}}" stepKey="assertInfo10"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertLink}}" stepKey="assertInfo11"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertImageIcon}}" stepKey="assertInf12"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertTable}}" stepKey="assertInfo13"/> - <seeElement selector="{{CmsWYSIWYGSection.SpecialCharacter}}" stepKey="assertInfo14"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="assertInfo15"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertVariableIcon}}" stepKey="assertInfo16"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyTinyMCE4"/> + <actionGroup ref="VerifyMagentoEntityActionGroup" stepKey="verifyMagentoEntities"/> <executeJS function="tinyMCE.get('cms_page_form_content').setContent('Hello World!');" stepKey="executeJSFillContent"/> <click selector="{{CmsWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> - <see selector="{{CmsWYSIWYGSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="assertInf17"/> - <see selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" userInput="Insert Widget..." stepKey="assertInfo18"/> - <see selector="{{CmsWYSIWYGSection.InsertVariableBtn}}" userInput="Insert Variable..." stepKey="assertInfo19"/> + <waitForElementVisible selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> + <see selector="{{TinyMCESection.InsertImageBtn}}" userInput="Insert Image..." stepKey="assertInf17"/> + <see selector="{{TinyMCESection.InsertWidgetBtn}}" userInput="Insert Widget..." stepKey="assertInfo18"/> + <see selector="{{TinyMCESection.InsertVariableBtn}}" userInput="Insert Variable..." stepKey="assertInfo19"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_defaultCmsPage.identifier}}" stepKey="fillFieldUrlKey"/> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoading" /> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> <amOnPage url="{{_defaultCmsPage.identifier}}" stepKey="amOnPageTestPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml index cdd62ac97de09..3528a22d88cd8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml @@ -11,7 +11,7 @@ <annotations> <features value="Add Image to WYSIWYG of Newsletter"/> <stories value="Apply new WYSIWYG in Newsletter-MAGETWO-47309"/> - <group value="newsletter"/> + <group value="newsletterImage"/> <title value="You should be able to add image to WYSIWYG Editor of Newsletter"/> <description value="You should be able to add image to WYSIWYG Editor Newsletter"/> <severity value="CRITICAL"/> @@ -29,45 +29,45 @@ <fillField selector="{{BasicFieldNewsletterSection.senderName}}" userInput="{{_defaultNewsletter.senderName}}" stepKey="fillSenderName" /> <fillField selector="{{BasicFieldNewsletterSection.senderEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillSenderEmail" /> <waitForElementVisible selector="{{NewsletterWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> - <click selector="{{CmsWYSIWYGSection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> + <click selector="{{TinyMCESection.InsertImageIcon}}" stepKey="clickInsertImageIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> - <click selector="{{CmsWYSIWYGSection.Browse}}" stepKey="clickBrowse" /> - <waitForElement selector="{{CmsWYSIWYGSection.CancelBtn}}" stepKey="waitForCancelBtn" /> + <click selector="{{MediaGallerySection.Browse}}" stepKey="clickBrowse" /> + <waitForElement selector="{{MediaGallerySection.CancelBtn}}" stepKey="waitForCancelBtn" /> <waitForPageLoad stepKey="waitForPageLoad2" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading1" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading2" /> - <waitForElement selector="{{CmsWYSIWYGSection.StorageRootArrow}}" stepKey="waitForStorageFoot" /> - <see selector="{{CmsWYSIWYGSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> - <see selector="{{CmsWYSIWYGSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> - <see selector="{{CmsWYSIWYGSection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> - <click selector="{{CmsWYSIWYGSection.CreateFolder}}" stepKey="createFolder"/> - <waitForElementVisible selector="{{CmsWYSIWYGSection.FolderName}}" stepKey="waitForPopUp" /> - <fillField selector="{{CmsWYSIWYGSection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> - <click selector="{{CmsWYSIWYGSection.AcceptFolderName}}" stepKey="acceptFolderName" /> + <waitForElement selector="{{MediaGallerySection.StorageRootArrow}}" stepKey="waitForStorageFoot" /> + <see selector="{{MediaGallerySection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn" /> + <see selector="{{MediaGallerySection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn" /> + <see selector="{{MediaGallerySection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn" /> + <click selector="{{MediaGallerySection.CreateFolder}}" stepKey="createFolder"/> + <waitForElementVisible selector="{{MediaGallerySection.FolderName}}" stepKey="waitForPopUp" /> + <fillField selector="{{MediaGallerySection.FolderName}}" userInput="{{ImageFolder.name}}" stepKey="fillFolderName" /> + <click selector="{{MediaGallerySection.AcceptFolderName}}" stepKey="acceptFolderName" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> - <conditionalClick selector="{{CmsWYSIWYGSection.StorageRootArrow}}" dependentSelector="{{CmsWYSIWYGSection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> + <conditionalClick selector="{{MediaGallerySection.StorageRootArrow}}" dependentSelector="{{MediaGallerySection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading5" /> - <attachFile selector="{{CmsWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading6" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> - <seeElement selector="{{CmsWYSIWYGSection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> - <see selector="{{CmsWYSIWYGSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> - <click selector="{{CmsWYSIWYGSection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> + <seeElement selector="{{MediaGallerySection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected" /> + <see selector="{{MediaGallerySection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn"/> + <click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected" /> <waitForText userInput="OK" stepKey="waitForConfirm" /> - <click selector="{{CmsWYSIWYGSection.confirmDelete}}" stepKey="confirmDelete" /> - <waitForElementNotVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> - <dontSeeElement selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> - <attachFile selector="{{CmsWYSIWYGSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> + <click selector="{{MediaGallerySection.confirmDelete}}" stepKey="confirmDelete" /> + <waitForElementNotVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted" /> + <dontSeeElement selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="dontSeeImage" /> + <attachFile selector="{{MediaGallerySection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> - <click selector="{{CmsWYSIWYGSection.InsertFile}}" stepKey="clickInsertBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> + <click selector="{{MediaGallerySection.InsertFile}}" stepKey="clickInsertBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.OkBtn}}" stepKey="waitForOkBtn" /> - <fillField selector="{{CmsWYSIWYGSection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> - <fillField selector="{{CmsWYSIWYGSection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> - <click selector="{{CmsWYSIWYGSection.OkBtn}}" stepKey="clickOkBtn" /> + <waitForElementVisible selector="{{MediaGallerySection.OkBtn}}" stepKey="waitForOkBtn" /> + <fillField selector="{{MediaGallerySection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription" /> + <fillField selector="{{MediaGallerySection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight" /> + <click selector="{{MediaGallerySection.OkBtn}}" stepKey="clickOkBtn" /> <waitForPageLoad stepKey="waitForPageLoad8"/> <!--Go to Storefront--> <click selector="{{BasicFieldNewsletterSection.save}}" stepKey="clickSaveTemplate"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml index 105a543733442..328ffbcc07ffa 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -28,7 +28,7 @@ <fillField selector="{{BasicFieldNewsletterSection.templateSubject}}" userInput="{{_defaultNewsletter.subject}}" stepKey="fillTemplateSubject" /> <fillField selector="{{BasicFieldNewsletterSection.senderName}}" userInput="{{_defaultNewsletter.senderName}}" stepKey="fillSenderName" /> <fillField selector="{{BasicFieldNewsletterSection.senderEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillSenderEmail" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> <click selector="{{NewsletterWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <wait time="10" stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml index 5c2a126a63d5c..447744e9744c9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml @@ -28,26 +28,12 @@ <fillField selector="{{BasicFieldNewsletterSection.templateSubject}}" userInput="{{_defaultNewsletter.subject}}" stepKey="fillTemplateSubject" /> <fillField selector="{{BasicFieldNewsletterSection.senderName}}" userInput="{{_defaultNewsletter.senderName}}" stepKey="fillSenderName" /> <fillField selector="{{BasicFieldNewsletterSection.senderEmail}}" userInput="{{_defaultNewsletter.senderEmail}}" stepKey="fillSenderEmail" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE" /> - <seeElement selector="{{NewsletterWYSIWYGSection.TinyMCE4}}" stepKey="seeTinyMCE4" /> - <seeElement selector="{{NewsletterWYSIWYGSection.Style}}" stepKey="assertInfo2"/> - <seeElement selector="{{NewsletterWYSIWYGSection.Bold}}" stepKey="assertInfo3"/> - <seeElement selector="{{NewsletterWYSIWYGSection.Italic}}" stepKey="assertInfo4"/> - <seeElement selector="{{NewsletterWYSIWYGSection.Underline}}" stepKey="assertInfo5"/> - <seeElement selector="{{NewsletterWYSIWYGSection.AlignLeft}}" stepKey="assertInfo6"/> - <seeElement selector="{{NewsletterWYSIWYGSection.AlignCenter}}" stepKey="assertInfo7"/> - <seeElement selector="{{NewsletterWYSIWYGSection.AlignRight}}" stepKey="assertInfo8"/> - <seeElement selector="{{NewsletterWYSIWYGSection.Numlist}}" stepKey="assertInfo9"/> - <seeElement selector="{{NewsletterWYSIWYGSection.Bullet}}" stepKey="assertInfo10"/> - <seeElement selector="{{NewsletterWYSIWYGSection.InsertLink}}" stepKey="assertInfo11"/> - <seeElement selector="{{NewsletterWYSIWYGSection.InsertImageIcon}}" stepKey="assertInf12"/> - <seeElement selector="{{NewsletterWYSIWYGSection.InsertTable}}" stepKey="assertInfo13"/> - <seeElement selector="{{NewsletterWYSIWYGSection.SpecialCharacter}}" stepKey="assertInfo14"/> - <seeElement selector="{{NewsletterWYSIWYGSection.InsertWidgetIcon}}" stepKey="assertInfo15"/> - <seeElement selector="{{NewsletterWYSIWYGSection.InsertVariableIcon}}" stepKey="assertInfo16"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE" /> + <actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyTinyMCE4"/> + <actionGroup ref="VerifyMagentoEntityActionGroup" stepKey="verifyMagentoEntities"/> <executeJS function="tinyMCE.get('text').setContent('Hello World From Newsletter Template!');" stepKey="executeJSFillContent"/> <click selector="{{NewsletterWYSIWYGSection.ShowHideBtn}}" stepKey="clickShowHideBtn2" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> + <waitForElementVisible selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="waitForInsertWidget" /> <see selector="{{NewsletterWYSIWYGSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="assertInf17"/> <see selector="{{NewsletterWYSIWYGSection.InsertWidgetBtn}}" userInput="Insert Widget..." stepKey="assertInfo18"/> <see selector="{{NewsletterWYSIWYGSection.InsertVariableBtn}}" userInput="Insert Variable..." stepKey="assertInfo19"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml index 109e1974d6cfc..b2e9f3d61abff 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleCouponData.xml @@ -5,11 +5,11 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="SimpleSalesRuleCoupon" type="SalesRuleCoupon"> <var key="rule_id" entityKey="rule_id" entityType="SalesRule"/> <data key="code" unique="suffix">Code</data> <data key="is_primary">1</data> </entity> -</config> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml index b4c8a2ceede14..f26ce7dea1ece 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesRuleData.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="SimpleSalesRule" type="SalesRule"> <data key="name" unique="suffix">SimpleSalesRule</data> @@ -21,4 +21,4 @@ <item>1</item> </array> </entity> -</config> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml index 55e05c92eb4b1..4debb7b2e4a2a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Metadata/sales_rule_coupon-meta.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> <operation name="CreateSalesRuleCoupon" dataType="SalesRuleCoupon" type="create" auth="adminOauth" url="/V1/coupons" method="POST"> <contentType>application/json</contentType> @@ -24,4 +24,4 @@ <operation name="DeleteSalesRuleCoupon" dataType="SalesRuleCoupon" type="delete" auth="adminOauth" url="/V1/coupons/{coupon_id}" method="DELETE"> <contentType>application/json</contentType> </operation> -</config> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml index 4a8770f72686e..853e8f75a217b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/DiscountSection.xml @@ -5,11 +5,11 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="DiscountSection"> <element name="DiscountTab" type="button" selector="//strong[text()='Apply Discount Code']"/> <element name="CouponInput" type="input" selector="#coupon_code"/> <element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index 60aa97e85be00..9a1f177b568f3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -6,12 +6,13 @@ */ --> <!-- Test XML Example --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateStoreViewActionGroup"> <arguments> <argument name="StoreGroup" defaultValue="_defaultStoreGroup"/> </arguments> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_store/newStore" stepKey="navigateToNewStoreView"/> + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="navigateToNewStoreView"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <!--Create Store View--> <selectOption selector="{{AdminNewStoreSection.storeGrpDropdown}}" userInput="{{StoreGroup.name}}" stepKey="selectStore" /> @@ -25,4 +26,4 @@ <waitForPageLoad stepKey="waitForPageLoad2"/> <see userInput="You saved the store view." stepKey="seeSavedMessage" /> </actionGroup> -</config> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml index 8ee5be44c8169..6c62481d473a9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml @@ -5,9 +5,9 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="AdminSystemStorePage" url="/{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_store/newStore" module="Store"> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminSystemStoreViewPage" url="admin/system_store/newStore" module="Store" area="admin"> <section name="AdminNewStoreViewMainActionsSection"/> <section name="AdminNewStoreSection"/> </page> -</config> +</pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml index 5c2a04b034e5a..5c731682e427c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminNewStoreViewActionsSection.xml @@ -5,10 +5,10 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminNewStoreViewActionsSection"> <element name="backButton" type="button" selector="#back"/> <element name="resetButton" type="button" selector="#reset"/> <element name="saveButton" type="button" selector="#save"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Test/AdminCreateStoreGroupTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Test/AdminCreateStoreGroupTest.xml index d8766dff9a0c3..58867227d08da 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Test/AdminCreateStoreGroupTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Test/AdminCreateStoreGroupTest.xml @@ -26,6 +26,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <amOnPage stepKey="s9" url="{{AdminSystemStorePage.url}}"/> + <waitForPageLoad stepKey="waitForPageLoad" /> <click stepKey="s11" selector="{{AdminStoresGridSection.resetButton}}"/> <waitForPageLoad stepKey="s15" time="10"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml index 286d3cc2e9cd5..55ae71469e4ee 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml @@ -5,12 +5,13 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateUserActionGroup"> <arguments> <argument name="role"/> </arguments> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user/new" stepKey="navigateToNewUser"/> + <amOnPage url="{{AdminEditUserPage.url}}" stepKey="navigateToNewUser"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{admin2.username}}" stepKey="enterUserName" /> <fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{admin2.firstName}}" stepKey="enterFirstName" /> @@ -29,4 +30,4 @@ <waitForPageLoad stepKey="waitForPageLoad2" /> <see userInput="You saved the user." stepKey="seeSuccessMessage" /> </actionGroup> -</config> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml index e461aa5de962b..85ff1d922c441 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml @@ -5,12 +5,13 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateUserRoleActionGroup"> <arguments> <argument name="role" /> </arguments> - <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user_role/editrole" stepKey="navigateToNewRole"/> + <amOnPage url="{{AdminEditRolePage.url}}" stepKey="navigateToNewRole"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <fillField selector="{{AdminEditRoleInfoSection.roleName}}" userInput="{{role.name}}" stepKey="fillRoleName" /> <fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterPassword" /> @@ -21,4 +22,4 @@ <waitForPageLoad stepKey="waitForPageLoad2" /> <see userInput="You saved the role." stepKey="seeSuccessMessage" /> </actionGroup> -</config> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml index 900f948d3f8e0..26df4b7afec65 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml @@ -6,11 +6,11 @@ */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> <entity name="adminRole" type="role"> <data key="name" unique="suffix">adminRole</data> <data key="scope">1</data> <data key="access">1</data> </entity> -</config> \ No newline at end of file +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml index 9ad319d1b953d..e75a5a6aa2e9f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml @@ -5,9 +5,9 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="AdminEditRolePage" url="/admin/admin/user_role/editrole" module="Magento_User"> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminEditRolePage" url="admin/user_role/editrole" module="Magento_User" area="admin"> <section name="AdminEditRoleInfoSection"/> <section name="AdminEditRoleResourcesSection"/> </page> -</config> +</pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml index bde3493347825..c056261ccbc4e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminRolesPage.xml @@ -5,8 +5,8 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="AdminRolesPage" url="/admin/admin/user_role/" module="Magento_User"> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="AdminRolesPage" url="admin/user_role/" module="Magento_User" area="admin"> <section name="AdminRoleGridSection"/> </page> -</config> +</pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml index 7a917112f0559..3e5b4ac6ecc88 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminEditRoleInfoSection"> <element name="roleName" type="input" selector="#role_name"/> <element name="password" type="input" selector="#current_password"/> @@ -14,4 +14,4 @@ <element name="resetButton" type="button" selector="button[title='Reset']"/> <element name="saveButton" type="button" selector="button[title='Save Role']"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml index 0e75aafdce452..358ab65a97e4f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml @@ -5,10 +5,10 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminEditRoleResourcesSection"> <element name="roleScopes" type="select" selector="#gws_is_all"/> <element name="resourceAccess" type="select" selector="#all"/> <element name="resources" type="checkbox" selector="#role_info_tabs_account"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml index 7329044114075..857c36f9d71de 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditUserRoleSection.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminEditUserRoleSection"> <element name="usernameTextField" type="input" selector="#user_username"/> <element name="roleNameFilterTextField" type="input" selector="#permissionsUserRolesGrid_filter_role_name"/> @@ -14,4 +14,4 @@ <element name="roleNameInFirstRow" type="text" selector=".col-role_name"/> <element name="searchResultFirstRow" type="text" selector=".data-grid>tbody>tr"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml index 61af0186f3546..9b91f4e1dd2a9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminRoleGridSection.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="AdminRoleGridSection"> <element name="idFilterTextField" type="input" selector="#roleGrid_filter_role_id"/> <element name="roleNameFilterTextField" type="input" selector="#roleGrid_filter_role_name"/> @@ -14,4 +14,4 @@ <element name="roleNameInFirstRow" type="text" selector=".col-role_name"/> <element name="searchResultFirstRow" type="text" selector=".data-grid>tbody>tr"/> </section> -</config> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml index 2f5573171eabb..59570a5cd3260 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml @@ -5,33 +5,27 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <cest name="AdminCreateUserCest"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminCreateUserWithNewAdminRoleTest"> <annotations> - <env value="chrome"/> - <env value="firefox"/> + <title value="Create a user in admin"/> + <description value="Create a user in admin"/> <group value="user"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> </before> - <test name="AdminCreateUserWithNewAdminRoleTest"> - <annotations> - <title value="Create a user in admin"/> - <description value="Create a user in admin"/> - </annotations> - <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createNewAdminUserRole"> - <argument name="role" value="adminRole"/> - </actionGroup> - <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> - <argument name="role" value="adminRole"/> - </actionGroup> - <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToRoleGrid" /> - <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin2.username}}" stepKey="filterByUserName" /> - <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch" /> - <waitForPageLoad stepKey="waitForPageLoad2" /> - <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin2.username}}" stepKey="seeNewRole" /> - </test> - </cest> -</config> + <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createNewAdminUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> + <argument name="role" value="adminRole"/> + </actionGroup> + <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToRoleGrid" /> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin2.username}}" stepKey="filterByUserName" /> + <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin2.username}}" stepKey="seeNewRole" /> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml index 0bbf8bfd2ec72..9f2db26e10ebd 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml @@ -5,30 +5,24 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <cest name="AdminCreateUserRoleCest"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminCreateUserRoleTest"> <annotations> - <env value="chrome"/> - <env value="firefox"/> + <title value="Create a user role in admin"/> + <description value="Create a user role in admin"/> <group value="userRole"/> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="login"/> </before> - <test name="AdminCreateUserRoleTest"> - <annotations> - <title value="Create a user role in admin"/> - <description value="Create a user role in admin"/> - </annotations> - <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createUserRole"> - <argument name="role" value="adminRole"/> - </actionGroup> - <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToRoleGrid" /> - <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminRoleGridSection.roleNameFilterTextField}}" userInput="{{adminRole.name}}" stepKey="enterRoleName" /> - <click selector="{{AdminRoleGridSection.searchButton}}" stepKey="clickSearch" /> - <waitForPageLoad stepKey="waitForPageLoad2" /> - <see selector="{{AdminRoleGridSection.roleNameInFirstRow}}" userInput="{{adminRole.name}}" stepKey="seeNewRole" /> - </test> - </cest> -</config> + <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToRoleGrid" /> + <waitForPageLoad stepKey="waitForPageLoad1" /> + <fillField selector="{{AdminRoleGridSection.roleNameFilterTextField}}" userInput="{{adminRole.name}}" stepKey="enterRoleName" /> + <click selector="{{AdminRoleGridSection.searchButton}}" stepKey="clickSearch" /> + <waitForPageLoad stepKey="waitForPageLoad2" /> + <see selector="{{AdminRoleGridSection.roleNameInFirstRow}}" userInput="{{adminRole.name}}" stepKey="seeNewRole" /> + </test> +</tests> From ed6bfda1935db2de7ec8973e9edb9dcbdbf3fcc7 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 14:43:03 -0600 Subject: [PATCH 230/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix static js failures --- .../Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 2 +- .../Magento/Ui/view/base/web/js/form/element/wysiwyg.js | 4 +--- lib/web/mage/adminhtml/events.js | 3 ++- .../tiny_mce/plugins/magentovariable/editor_plugin.js | 5 +++-- .../tiny_mce/plugins/magentowidget/editor_plugin.js | 4 ++-- .../mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index d0f2d7236ee32..fd5e9628fecdb 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -249,7 +249,7 @@ define([ }, /** - * @return {string|null} + * @return {String|null} */ getId: function () { return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 57f54f14a40c1..4dba6dfe6e6e1 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -3,8 +3,6 @@ * See COPYING.txt for license details. */ -/* global varienGlobalEvents */ - /** * @api */ @@ -15,7 +13,7 @@ define([ 'ko', './abstract', 'mage/adminhtml/events', - 'Magento_Variable/variables', + 'Magento_Variable/variables' ], function (wysiwyg, $, _, ko, Abstract, varienGlobalEvents) { 'use strict'; diff --git a/lib/web/mage/adminhtml/events.js b/lib/web/mage/adminhtml/events.js index 9404f12400c3d..67e04c5ca9c15 100644 --- a/lib/web/mage/adminhtml/events.js +++ b/lib/web/mage/adminhtml/events.js @@ -188,5 +188,6 @@ define([ }; window.varienGlobalEvents = new varienEvents(); //jscs:ignore requireCapitalizedConstructors - return varienGlobalEvents; + + return window.varienGlobalEvents; }); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 5c8db0af4ac3c..85a73c219cfc1 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -114,7 +114,8 @@ define([ magentoVariables = JSON.parse(config.placeholders); if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'default') { - imageHtml = '<span id="%id" class="magento-variable magento-placeholder mceNonEditable">%s</span>'; + imageHtml = '<span id="%id" class="magento-variable magento-placeholder mceNonEditable">' + + '%s</span>'; imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']); } else { imageHtml = '<span id="%id" class="' + @@ -126,7 +127,7 @@ define([ } return imageHtml.replace('%id', Base64.idEncode(path)); - }.bind(this)); + }); content = content.gsub(/\{\{customVar code=([^\}\"]+)\}\}/i, function (match) { var path = match[1], diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index 1d793675a7c46..d9a2f8eba095e 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -3,7 +3,7 @@ * See COPYING.txt for license details. */ -/* global tinymce, widgetTools, jQuery, varienGlobalEvents, Base64 */ +/* global tinymce, widgetTools, jQuery, Base64 */ /* eslint-disable strict */ define([ 'wysiwygAdapter', @@ -231,4 +231,4 @@ define([ // Register plugin tinymce.PluginManager.add('magentowidget', tinymce.plugins.magentowidget); }; -}); \ No newline at end of file +}); diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 57fe1c7d1236c..ef2e56b2ef66c 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -3,17 +3,17 @@ * See COPYING.txt for license details. */ -/* global varienGlobalEvents, popups, tinyMceEditors, MediabrowserUtility, Base64 */ +/* global popups, tinyMceEditors, MediabrowserUtility, Base64 */ /* eslint-disable strict */ define([ 'jquery', 'underscore', 'tinymce4', + 'mage/adminhtml/events', 'mage/translate', 'prototype', - 'mage/adminhtml/events', 'jquery/ui' -], function (jQuery, _, tinyMCE4) { +], function (jQuery, _, tinyMCE4, varienGlobalEvents) { 'use strict'; var tinyMce4Wysiwyg = Class.create(); @@ -280,7 +280,7 @@ define([ }, /** - * @return {string|null} + * @return {String|null} */ getId: function () { return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id; From 2818cb7c56f658d1aec31726a81d5f4c3330928d Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 15:13:27 -0600 Subject: [PATCH 231/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix wysiwyg id resolution --- .../wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index d9a2f8eba095e..ccb643d9371c3 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -92,7 +92,7 @@ define([ * Attach event handler for when popups associated with wysiwyg are about to be closed */ varienGlobalEvents.attachEventHandler('wysiwygClosePopups', function () { - wysiwyg.closeEditorPopup('widget_window' + self.constructor.adapter.id); + wysiwyg.closeEditorPopup('widget_window' + wysiwyg.getId()); }); }, From 67c6d4d731d33111392d08887f154054230fe18e Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Wed, 24 Jan 2018 15:30:14 -0600 Subject: [PATCH 232/277] MAGETWO-85423: Create or update functional tests - Updated action groups for creating user, user role and store group, store view --- .../ActionGroup/VerifyMediaGalleryActionGroup.xml | 13 ------------- .../ActionGroup/AdminCreateStoreViewActionGroup.xml | 4 ++-- .../User/ActionGroup/AdminCreateUserActionGroup.xml | 1 + .../ActionGroup/AdminCreateUserRoleActionGroup.xml | 5 ++++- .../FunctionalTest/User/Data/UserRoleData.xml | 2 +- .../User/Section/AdminEditRoleResourcesSection.xml | 1 + 6 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml deleted file mode 100644 index 6785f691fd385..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/VerifyMediaGalleryActionGroup.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <actionGroup name="VerifyMediaGalleryActionGroup"> - - </actionGroup> -</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index 60aa97e85be00..09f5847b5e0ec 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -19,9 +19,9 @@ <fillField selector="{{AdminNewStoreSection.storeCodeTextField}}" userInput="{{customStore.code}}" stepKey="enterStoreViewCode" /> <selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="Enabled" stepKey="setStatus" /> <click selector="{{AdminNewStoreViewActionsSection.saveButton}}" stepKey="clickSaveStoreView" /> - <waitForElementVisible selector="//*[@id='html-body']/div[4]/aside[2]/div[2]/footer/button[2]" stepKey="waitForModal" /> + <waitForElementVisible selector=".action-primary.action-accept" stepKey="waitForModal" /> <seeInSource html="'Warning message'" stepKey="seeWarning" /> - <click selector="//*[@id='html-body']/div[4]/aside[2]/div[2]/footer/button[2]" stepKey="dismissModal" /> + <click selector=".action-primary.action-accept" stepKey="dismissModal" /> <waitForPageLoad stepKey="waitForPageLoad2"/> <see userInput="You saved the store view." stepKey="seeSavedMessage" /> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml index 286d3cc2e9cd5..6e8009b44be21 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserActionGroup.xml @@ -9,6 +9,7 @@ <actionGroup name="AdminCreateUserActionGroup"> <arguments> <argument name="role"/> + <argument name="User" defaultValue="admin2"/> </arguments> <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user/new" stepKey="navigateToNewUser"/> <waitForPageLoad stepKey="waitForPageLoad1" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml index e461aa5de962b..9c69177554398 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml @@ -9,13 +9,16 @@ <actionGroup name="AdminCreateUserRoleActionGroup"> <arguments> <argument name="role" /> + <argument name="StoreGroup" defaultValue="_defaultStoreGroup"/> </arguments> <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/user_role/editrole" stepKey="navigateToNewRole"/> <waitForPageLoad stepKey="waitForPageLoad1" /> <fillField selector="{{AdminEditRoleInfoSection.roleName}}" userInput="{{role.name}}" stepKey="fillRoleName" /> <fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterPassword" /> <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> - <selectOption selector="{{AdminEditRoleResourcesSection.roleScopes}}" userInput="{{role.scope}}" stepKey="selectScope" /> + <waitForElementVisible selector="{{AdminEditRoleResourcesSection.roleScopes}}" stepKey="waitForScopeSelection" /> + <selectOption selector="{{AdminEditRoleResourcesSection.roleScopes}}" userInput="Custom" stepKey="selectScope" /> + <click selector="{{AdminEditRoleResourcesSection.storeName(StoreGroup.name)}}" stepKey="selectCreatedStoreGroup" /> <selectOption selector="{{AdminEditRoleResourcesSection.resourceAccess}}" userInput="{{role.access}}" stepKey="selectAccess" /> <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" /> <waitForPageLoad stepKey="waitForPageLoad2" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml index 900f948d3f8e0..ab4292779de5b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Data/UserRoleData.xml @@ -13,4 +13,4 @@ <data key="scope">1</data> <data key="access">1</data> </entity> -</config> \ No newline at end of file +</config> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml index 0e75aafdce452..f68d0993cb5f0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml @@ -10,5 +10,6 @@ <element name="roleScopes" type="select" selector="#gws_is_all"/> <element name="resourceAccess" type="select" selector="#all"/> <element name="resources" type="checkbox" selector="#role_info_tabs_account"/> + <element name="storeName" type="checkbox" selector="//label[contains(text(),'{{var1}}')]" parameterized="true"/> </section> </config> From ef6615785fd978a7e88f58adbe2c4273f8a1a1be Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 15:58:52 -0600 Subject: [PATCH 233/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Add wysiwygAdapter.test.js --- .../tests/lib/mage/wysiwygAdapter.test.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js diff --git a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js new file mode 100644 index 0000000000000..0d64b483df7d9 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js @@ -0,0 +1,25 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'wysiwygAdapter' +], function (wysiwyg) { + 'use strict'; + var decodedHtml = '<p><img src="{{media url="wysiwyg/banana.jpg"}}" alt="" width="612" height="459"></p>', + encodedHtml = '<p>' + + '<img src="http://magento2.vagrant154/admin/cms/wysiwyg/directive/' + + '___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmFuYW5hLmpwZyJ9fQ%2C%2C" alt="" width="612" height="459">' + + '</p>'; + + describe('wysiwygAdapter', function () { + it('encodes directives properly', function () { + wysiwyg.encodeDirectives(decodedHtml).toEqual(encodedHtml); + }); + + it('decodes directives properly', function () { + expect(wysiwyg.decodeDirectives(encodedHtml)).toEqual(decodedHtml); + }); + }); +}); From 33b79d90afa6f4c113c6c8ddbee4d591a6ae87f5 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 16:33:00 -0600 Subject: [PATCH 234/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix JS Static tests --- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 2 +- .../wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 85a73c219cfc1..eb28c9aa931e0 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -150,7 +150,7 @@ define([ } return imageHtml.replace('%id', Base64.idEncode(path)); - }.bind(this)); + }); return content; }, diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index ccb643d9371c3..988756ba573a1 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -30,7 +30,7 @@ define([ widgetTools.openDialog( config['window_url'] + 'widget_target_id/' + editor.getElement().id + '/' ); - }.bind(this)); + }); // Register Widget plugin button editor.addButton('magentowidget', { From b0e2896dd83d1b1d775d58df7da797476c0873d0 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Wed, 24 Jan 2018 17:35:18 -0600 Subject: [PATCH 235/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Fix JSUnit test --- dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js index 0d64b483df7d9..89ce1e9ff5281 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js @@ -13,9 +13,11 @@ define([ '___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmFuYW5hLmpwZyJ9fQ%2C%2C" alt="" width="612" height="459">' + '</p>'; + wysiwyg.config = {'directives_url': 'http://magento2.vagrant154/admin/cms/wysiwyg/directive/'}; + describe('wysiwygAdapter', function () { it('encodes directives properly', function () { - wysiwyg.encodeDirectives(decodedHtml).toEqual(encodedHtml); + expect(wysiwyg.encodeDirectives(decodedHtml)).toEqual(encodedHtml); }); it('decodes directives properly', function () { From c13970815257aff4a93738b6cd764e76518892d6 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 09:20:58 -0600 Subject: [PATCH 236/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Change 'Home Page' text assertion to 'Home page' --- .../Cms/Section/CmsNewPagePageContentSection.xml | 3 +-- .../Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 2 +- .../Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml index e103ec98a82f9..a5cf2abc5930c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml @@ -87,7 +87,7 @@ <element name="WidgetType" type="button" selector="#select_widget_type"/> <element name="WidgetTemplate" type="button" selector="select[name='parameters[template]']"/> <element name="BtnChooser" type="button" selector=".btn-chooser"/> - <element name="CMSPage" type="text" selector="//td[contains(text(),'Home Page')]"/> + <element name="CMSPage" type="text" selector="//td[contains(text(),'Home page')]"/> <element name="BlockPage" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/> <element name="PreCreateCategory" type="text" selector=" //span[contains(text(),'{{var1}}')]" parameterized="true"/> <element name="PreCreateProduct" type="text" selector="//td[contains(text(),'{{var1}}')]" parameterized="true"/> @@ -107,6 +107,5 @@ <element name="CompareBtn" type="button" selector=".action.tocompare"/> <element name="ClearCompare" type="button" selector="#compare-clear-all"/> <element name="AcceptClear" type="button" selector=".action-primary.action-accept" /> - </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index c02b3480908eb..7329bc95ede2c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -73,7 +73,7 @@ <see userInput="You saved the page." stepKey="seeSuccessMessage"/> <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage1"/> <waitForPageLoad stepKey="waitForPageLoad7" /> - <see userInput="Home Page" stepKey="seeHomePageCMSPage"/> + <see userInput="Home page" stepKey="seeHomePageCMSPage"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml index ba67a5e28e32b..105a543733442 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -49,7 +49,7 @@ <switchToWindow stepKey="switchToWindow" userInput="action_window"/> <switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" /> <waitForPageLoad stepKey="waitForPageLoad9"/> - <see userInput="Home Page" stepKey="seeHomePageCMSPage"/> + <see userInput="Home page" stepKey="seeHomePageCMSPage"/> <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> From 119ff957f7acdb37f2a64731251e2dde30e161a1 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 09:44:35 -0600 Subject: [PATCH 237/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery JS Static test fixes --- dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js | 2 ++ .../wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js index 89ce1e9ff5281..2775798bd1fc7 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js @@ -7,6 +7,8 @@ define([ 'wysiwygAdapter' ], function (wysiwyg) { 'use strict'; + + var decodedHtml = '<p><img src="{{media url="wysiwyg/banana.jpg"}}" alt="" width="612" height="459"></p>', encodedHtml = '<p>' + '<img src="http://magento2.vagrant154/admin/cms/wysiwyg/directive/' + diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index 988756ba573a1..8ee8967224f2d 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -154,7 +154,7 @@ define([ return imageHtml; } - }.bind(this)); + }); }, /** From 10ecf0931c9c641e3265931917716ec6cf147fbe Mon Sep 17 00:00:00 2001 From: Tommy Wiebell <twiebell@magento.com> Date: Thu, 25 Jan 2018 09:44:41 -0600 Subject: [PATCH 238/277] MAGETWO-86864: Stabilize functional tests - Update MFTF tests to be compliant with new version - Remove references to other modules in PublicCodeTest --- .../FunctionalTest/Cms/Page/CmsNewBlockPage.xml | 2 +- .../Section/CmsNewBlockBlockBasicFieldsSection.xml | 2 +- .../Magento/Test/Integrity/PublicCodeTest.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsNewBlockPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsNewBlockPage.xml index 20332ee4cf073..5cccbf2943114 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsNewBlockPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsNewBlockPage.xml @@ -8,7 +8,7 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="CmsNewBlock" url="admin/cms/block/new" area="admin" module="Magento_Cms"> + <page name="CmsNewBlock" area="admin" url="/cms/block/new" module="Magento_Cms"> <section name="CmsNewBlockBlockActionsSection"/> <section name="CmsNewBlockBlockBasicFieldsSection"/> </page> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewBlockBlockBasicFieldsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewBlockBlockBasicFieldsSection.xml index c7446d798d7d4..78d9dad4eedd6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewBlockBlockBasicFieldsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewBlockBlockBasicFieldsSection.xml @@ -11,6 +11,6 @@ <section name="CmsNewBlockBlockBasicFieldsSection"> <element name="title" type="input" selector="input[name=title]"/> <element name="identifier" type="input" selector="input[name=identifier]"/> - <element name="wysiwyg_hr_element" type="input" selector="#cms_block_form_content_hr"/> + <element name="content_textarea" type="input" selector="#cms_block_form_content"/> </section> </sections> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php index 22ac7a34ce81e..56d00bc725dbd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php @@ -31,13 +31,24 @@ class PublicCodeTest extends \PHPUnit\Framework\TestCase */ public function testAllBlocksReferencedInLayoutArePublic($layoutFile) { + // A block can be whitelisted and thus not be required to be public + $whiteListFiles = str_replace('\\', '/', realpath(__DIR__)) + . '/_files/whitelist/public_code*.txt'; + $whiteListBlocks = []; + foreach (glob($whiteListFiles) as $fileName) { + $whiteListBlocks = array_merge( + $whiteListBlocks, + file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) + ); + } + $nonPublishedBlocks = []; $xml = simplexml_load_file($layoutFile); $elements = $xml->xpath('//block | //referenceBlock') ?: []; /** @var $node \SimpleXMLElement */ foreach ($elements as $node) { $class = (string) $node['class']; - if ($class && \class_exists($class)) { + if ($class && \class_exists($class) && !in_array($class, $whiteListBlocks)) { $reflection = (new \ReflectionClass($class)); if (strpos($reflection->getDocComment(), '@api') === false) { $nonPublishedBlocks[] = $class; From c384301225252bafca1b44ab64536759a2d7c67d Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Thu, 25 Jan 2018 10:25:21 -0600 Subject: [PATCH 239/277] MAGETWO-85423: Create or update functional tests --- .../Action Group}/ConfigWYSIWYGActionGroup.xml | 0 .../ActionGroup => Config/Action Group}/SwitcherActionGroup.xml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{Catalog/ActionGroup => Config/Action Group}/ConfigWYSIWYGActionGroup.xml (100%) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{Catalog/ActionGroup => Config/Action Group}/SwitcherActionGroup.xml (100%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/ConfigWYSIWYGActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/ConfigWYSIWYGActionGroup.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/ConfigWYSIWYGActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/ConfigWYSIWYGActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/SwitcherActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/SwitcherActionGroup.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/SwitcherActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/SwitcherActionGroup.xml From d1cf8ef7e2dbe7e0f0bd07f161a9ee65861704e6 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 11:11:39 -0600 Subject: [PATCH 240/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery More JS Static test fixes --- dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js | 5 +++-- .../wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js index 2775798bd1fc7..585bae2a50c95 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js @@ -8,14 +8,15 @@ define([ ], function (wysiwyg) { 'use strict'; - var decodedHtml = '<p><img src="{{media url="wysiwyg/banana.jpg"}}" alt="" width="612" height="459"></p>', encodedHtml = '<p>' + '<img src="http://magento2.vagrant154/admin/cms/wysiwyg/directive/' + '___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmFuYW5hLmpwZyJ9fQ%2C%2C" alt="" width="612" height="459">' + '</p>'; - wysiwyg.config = {'directives_url': 'http://magento2.vagrant154/admin/cms/wysiwyg/directive/'}; + wysiwyg.config = { + 'directives_url': 'http://magento2.vagrant154/admin/cms/wysiwyg/directive/' + }; describe('wysiwygAdapter', function () { it('encodes directives properly', function () { diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js index 8ee8967224f2d..73fd8658854f2 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js @@ -178,7 +178,7 @@ define([ } return match[0]; - }.bind(this) + } ); }, From c3dc5932773ab0ca18e644532a2fa2bccf861283 Mon Sep 17 00:00:00 2001 From: Aki Ojalehto <aki@ojalehto.eu> Date: Thu, 25 Jan 2018 19:47:54 +0200 Subject: [PATCH 241/277] Fix typo in phpdocs --- .../Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php index 11805a00d03cc..c75112fee8605 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php @@ -345,7 +345,7 @@ protected function preparePrice() } /** - * Preparation weather product 'Is Virtual'. + * Preparation whether product 'Is Virtual'. * * @return void */ From 6fc655363e8762d23200e99704bbc6b2f2e953d2 Mon Sep 17 00:00:00 2001 From: Cari Spruiell <cspruiell@magento.com> Date: Thu, 25 Jan 2018 13:34:42 -0600 Subject: [PATCH 242/277] MAGETWO-85423: Create or update functional tests - revert erroneous changes --- dev/tests/acceptance/composer.lock | 175 +++++++++++++++-------------- 1 file changed, 88 insertions(+), 87 deletions(-) diff --git a/dev/tests/acceptance/composer.lock b/dev/tests/acceptance/composer.lock index 2fa1cf5159852..bec049ab58e6a 100644 --- a/dev/tests/acceptance/composer.lock +++ b/dev/tests/acceptance/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "915b03849df36fc07440088c27242658", "content-hash": "d3546529b85b537be76f5b4a60087830", "packages": [ { @@ -56,7 +55,7 @@ "steps", "testing" ], - "time": "2017-03-30 09:01:00" + "time": "2017-03-30T09:01:00+00:00" }, { "name": "allure-framework/allure-php-api", @@ -108,7 +107,7 @@ "php", "report" ], - "time": "2016-12-07 12:15:46" + "time": "2016-12-07T12:15:46+00:00" }, { "name": "behat/gherkin", @@ -167,7 +166,7 @@ "gherkin", "parser" ], - "time": "2016-10-30 11:50:56" + "time": "2016-10-30T11:50:56+00:00" }, { "name": "codeception/codeception", @@ -263,7 +262,7 @@ "functional testing", "unit testing" ], - "time": "2017-12-12 04:22:17" + "time": "2017-12-12T04:22:17+00:00" }, { "name": "consolidation/annotated-command", @@ -314,7 +313,7 @@ } ], "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2017-11-29 16:23:23" + "time": "2017-11-29T16:23:23+00:00" }, { "name": "consolidation/config", @@ -368,7 +367,7 @@ } ], "description": "Provide configuration services for a commandline tool.", - "time": "2017-12-22 17:28:19" + "time": "2017-12-22T17:28:19+00:00" }, { "name": "consolidation/log", @@ -416,7 +415,7 @@ } ], "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2017-11-29 01:44:16" + "time": "2017-11-29T01:44:16+00:00" }, { "name": "consolidation/output-formatters", @@ -465,7 +464,7 @@ } ], "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2017-11-29 15:25:38" + "time": "2017-11-29T15:25:38+00:00" }, { "name": "consolidation/robo", @@ -542,7 +541,7 @@ } ], "description": "Modern task runner", - "time": "2017-12-29 06:48:35" + "time": "2017-12-29T06:48:35+00:00" }, { "name": "container-interop/container-interop", @@ -573,7 +572,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "dflydev/dot-access-data", @@ -632,7 +631,7 @@ "dot", "notation" ], - "time": "2017-01-20 21:14:22" + "time": "2017-01-20T21:14:22+00:00" }, { "name": "doctrine/annotations", @@ -700,7 +699,7 @@ "docblock", "parser" ], - "time": "2017-02-24 16:22:25" + "time": "2017-02-24T16:22:25+00:00" }, { "name": "doctrine/collections", @@ -767,7 +766,7 @@ "collections", "iterator" ], - "time": "2017-01-03 10:49:41" + "time": "2017-01-03T10:49:41+00:00" }, { "name": "doctrine/instantiator", @@ -821,7 +820,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "doctrine/lexer", @@ -875,7 +874,7 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "epfremme/swagger-php", @@ -921,7 +920,7 @@ } ], "description": "Library for parsing swagger documentation into PHP entities for use in testing and code generation", - "time": "2016-09-26 17:24:17" + "time": "2016-09-26T17:24:17+00:00" }, { "name": "facebook/webdriver", @@ -976,7 +975,7 @@ "selenium", "webdriver" ], - "time": "2017-11-15 11:08:09" + "time": "2017-11-15T11:08:09+00:00" }, { "name": "flow/jsonpath", @@ -1017,7 +1016,7 @@ } ], "description": "JSONPath implementation for parsing, searching and flattening arrays", - "time": "2016-09-06 17:43:18" + "time": "2016-09-06T17:43:18+00:00" }, { "name": "fzaninotto/faker", @@ -1067,7 +1066,7 @@ "faker", "fixtures" ], - "time": "2017-08-15 16:48:10" + "time": "2017-08-15T16:48:10+00:00" }, { "name": "grasmash/expander", @@ -1114,7 +1113,7 @@ } ], "description": "Expands internal property references in PHP arrays file.", - "time": "2017-12-21 22:14:55" + "time": "2017-12-21T22:14:55+00:00" }, { "name": "grasmash/yaml-expander", @@ -1162,7 +1161,7 @@ } ], "description": "Expands internal property references in a yaml file.", - "time": "2017-12-16 16:06:03" + "time": "2017-12-16T16:06:03+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1227,7 +1226,7 @@ "rest", "web service" ], - "time": "2017-06-22 18:50:49" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -1278,7 +1277,7 @@ "keywords": [ "promise" ], - "time": "2016-12-20 10:07:11" + "time": "2016-12-20T10:07:11+00:00" }, { "name": "guzzlehttp/psr7", @@ -1343,7 +1342,7 @@ "uri", "url" ], - "time": "2017-03-20 17:10:46" + "time": "2017-03-20T17:10:46+00:00" }, { "name": "henrikbjorn/lurker", @@ -1402,7 +1401,7 @@ "resource", "watching" ], - "time": "2016-03-16 15:22:20" + "time": "2016-03-16T15:22:20+00:00" }, { "name": "jms/metadata", @@ -1453,7 +1452,7 @@ "xml", "yaml" ], - "time": "2016-12-05 10:18:33" + "time": "2016-12-05T10:18:33+00:00" }, { "name": "jms/parser-lib", @@ -1488,7 +1487,7 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18 18:08:43" + "time": "2012-11-18T18:08:43+00:00" }, { "name": "jms/serializer", @@ -1573,7 +1572,7 @@ "serialization", "xml" ], - "time": "2017-11-30 18:23:40" + "time": "2017-11-30T18:23:40+00:00" }, { "name": "league/container", @@ -1638,7 +1637,7 @@ "provider", "service" ], - "time": "2017-05-10 09:20:27" + "time": "2017-05-10T09:20:27+00:00" }, { "name": "magento/magento2-functional-testing-framework", @@ -1699,7 +1698,7 @@ "magento", "testing" ], - "time": "2018-01-17 12:02:50" + "time": "2018-01-17T12:02:50+00:00" }, { "name": "moontoast/math", @@ -1748,7 +1747,7 @@ "bcmath", "math" ], - "time": "2017-02-16 16:54:46" + "time": "2017-02-16T16:54:46+00:00" }, { "name": "mustache/mustache", @@ -1794,7 +1793,7 @@ "mustache", "templating" ], - "time": "2017-07-11 12:54:05" + "time": "2017-07-11T12:54:05+00:00" }, { "name": "myclabs/deep-copy", @@ -1839,7 +1838,7 @@ "object", "object graph" ], - "time": "2017-10-19 19:58:43" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "paragonie/random_compat", @@ -1887,7 +1886,7 @@ "pseudorandom", "random" ], - "time": "2017-09-27 21:40:39" + "time": "2017-09-27T21:40:39+00:00" }, { "name": "phar-io/manifest", @@ -1942,7 +1941,7 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05 18:14:27" + "time": "2017-03-05T18:14:27+00:00" }, { "name": "phar-io/version", @@ -1989,7 +1988,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05 17:38:23" + "time": "2017-03-05T17:38:23+00:00" }, { "name": "phpcollection/phpcollection", @@ -2037,7 +2036,7 @@ "sequence", "set" ], - "time": "2015-05-17 12:39:23" + "time": "2015-05-17T12:39:23+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2091,7 +2090,7 @@ "reflection", "static analysis" ], - "time": "2017-09-11 18:02:19" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -2142,7 +2141,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-27 17:38:31" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2189,7 +2188,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14 14:27:02" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpoption/phpoption", @@ -2239,7 +2238,7 @@ "php", "type" ], - "time": "2015-07-25 16:39:46" + "time": "2015-07-25T16:39:46+00:00" }, { "name": "phpspec/prophecy", @@ -2302,7 +2301,7 @@ "spy", "stub" ], - "time": "2017-11-24 13:59:53" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2365,7 +2364,7 @@ "testing", "xunit" ], - "time": "2017-12-06 09:29:45" + "time": "2017-12-06T09:29:45+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2412,7 +2411,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27 13:52:08" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -2453,7 +2452,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -2502,7 +2501,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -2551,7 +2550,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27 05:48:46" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", @@ -2635,7 +2634,7 @@ "testing", "xunit" ], - "time": "2017-11-08 11:26:09" + "time": "2017-11-08T11:26:09+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2694,7 +2693,7 @@ "mock", "xunit" ], - "time": "2017-08-03 14:08:16" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "psr/container", @@ -2743,7 +2742,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/http-message", @@ -2793,7 +2792,7 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "psr/log", @@ -2840,20 +2839,20 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", - "version": "3.7.3", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76" + "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/bba83ad77bb9deb6d3c352a7361b818e415b221d", + "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d", "shasum": "" }, "require": { @@ -2864,15 +2863,17 @@ "rhumsaa/uuid": "self.version" }, "require-dev": { + "apigen/apigen": "^4.1", "codeception/aspect-mock": "^1.0 | ~2.0.0", "doctrine/annotations": "~1.2.0", "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", - "mockery/mockery": "^0.9.9", + "mockery/mockery": "^0.9.4", "moontoast/math": "^1.1", "php-mock/php-mock-phpunit": "^0.3|^1.1", "phpunit/phpunit": "^4.7|^5.0", + "satooshi/php-coveralls": "^0.6.1", "squizlabs/php_codesniffer": "^2.3" }, "suggest": { @@ -2920,7 +2921,7 @@ "identifier", "uuid" ], - "time": "2018-01-20 00:28:24" + "time": "2018-01-13T22:22:03+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2965,7 +2966,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04 06:30:41" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", @@ -3029,7 +3030,7 @@ "compare", "equality" ], - "time": "2018-01-12 06:34:42" + "time": "2018-01-12T06:34:42+00:00" }, { "name": "sebastian/diff", @@ -3081,7 +3082,7 @@ "keywords": [ "diff" ], - "time": "2017-08-03 08:09:46" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", @@ -3131,7 +3132,7 @@ "environment", "hhvm" ], - "time": "2017-07-01 08:51:00" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", @@ -3198,7 +3199,7 @@ "export", "exporter" ], - "time": "2017-04-03 13:19:02" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", @@ -3249,7 +3250,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27 15:39:26" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", @@ -3296,7 +3297,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03 12:35:26" + "time": "2017-08-03T12:35:26+00:00" }, { "name": "sebastian/object-reflector", @@ -3341,7 +3342,7 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29 09:07:27" + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", @@ -3394,7 +3395,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03 06:23:57" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -3436,7 +3437,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -3479,7 +3480,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/browser-kit", @@ -3536,7 +3537,7 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/config", @@ -3598,7 +3599,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/console", @@ -3667,7 +3668,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/css-selector", @@ -3720,7 +3721,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/debug", @@ -3776,7 +3777,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03 17:14:19" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/dom-crawler", @@ -3832,7 +3833,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/event-dispatcher", @@ -3895,7 +3896,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/filesystem", @@ -3944,7 +3945,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/finder", @@ -3993,7 +3994,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/http-foundation", @@ -4047,7 +4048,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-01-03 17:14:19" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4106,7 +4107,7 @@ "portable", "shim" ], - "time": "2017-10-11 12:05:26" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-php70", @@ -4165,7 +4166,7 @@ "portable", "shim" ], - "time": "2017-10-11 12:05:26" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/process", @@ -4214,7 +4215,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:11" + "time": "2018-01-03T07:37:11+00:00" }, { "name": "symfony/yaml", @@ -4272,7 +4273,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "theseer/tokenizer", @@ -4312,7 +4313,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07 12:08:54" + "time": "2017-04-07T12:08:54+00:00" }, { "name": "vlucas/phpdotenv", @@ -4362,7 +4363,7 @@ "env", "environment" ], - "time": "2016-09-01 10:05:43" + "time": "2016-09-01T10:05:43+00:00" }, { "name": "webmozart/assert", @@ -4412,7 +4413,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:58" + "time": "2016-11-23T20:04:58+00:00" } ], "packages-dev": [], From e9df290f35fac6febb6d572c3d991a0b54d6c97e Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Thu, 25 Jan 2018 13:45:06 -0600 Subject: [PATCH 243/277] MAGETWO-85423: Create or update functional tests --- dev/tests/acceptance/composer.lock | 163 +++++++++--------- .../ConfigWYSIWYGActionGroup.xml | 0 .../SwitcherActionGroup.xml | 0 .../LoginToStorefrontActionGroup.xml | 19 ++ .../ApplyCartRuleOnStorefrontActionGroup.xml | 27 +++ 5 files changed, 127 insertions(+), 82 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/{Action Group => ActionGroup}/ConfigWYSIWYGActionGroup.xml (100%) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/{Action Group => ActionGroup}/SwitcherActionGroup.xml (100%) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/LoginToStorefrontActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml diff --git a/dev/tests/acceptance/composer.lock b/dev/tests/acceptance/composer.lock index 2fa1cf5159852..75292bbbc89c7 100644 --- a/dev/tests/acceptance/composer.lock +++ b/dev/tests/acceptance/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "915b03849df36fc07440088c27242658", "content-hash": "d3546529b85b537be76f5b4a60087830", "packages": [ { @@ -56,7 +55,7 @@ "steps", "testing" ], - "time": "2017-03-30 09:01:00" + "time": "2017-03-30T09:01:00+00:00" }, { "name": "allure-framework/allure-php-api", @@ -108,7 +107,7 @@ "php", "report" ], - "time": "2016-12-07 12:15:46" + "time": "2016-12-07T12:15:46+00:00" }, { "name": "behat/gherkin", @@ -167,7 +166,7 @@ "gherkin", "parser" ], - "time": "2016-10-30 11:50:56" + "time": "2016-10-30T11:50:56+00:00" }, { "name": "codeception/codeception", @@ -263,7 +262,7 @@ "functional testing", "unit testing" ], - "time": "2017-12-12 04:22:17" + "time": "2017-12-12T04:22:17+00:00" }, { "name": "consolidation/annotated-command", @@ -314,7 +313,7 @@ } ], "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2017-11-29 16:23:23" + "time": "2017-11-29T16:23:23+00:00" }, { "name": "consolidation/config", @@ -368,7 +367,7 @@ } ], "description": "Provide configuration services for a commandline tool.", - "time": "2017-12-22 17:28:19" + "time": "2017-12-22T17:28:19+00:00" }, { "name": "consolidation/log", @@ -416,7 +415,7 @@ } ], "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2017-11-29 01:44:16" + "time": "2017-11-29T01:44:16+00:00" }, { "name": "consolidation/output-formatters", @@ -465,7 +464,7 @@ } ], "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2017-11-29 15:25:38" + "time": "2017-11-29T15:25:38+00:00" }, { "name": "consolidation/robo", @@ -542,7 +541,7 @@ } ], "description": "Modern task runner", - "time": "2017-12-29 06:48:35" + "time": "2017-12-29T06:48:35+00:00" }, { "name": "container-interop/container-interop", @@ -573,7 +572,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "dflydev/dot-access-data", @@ -632,7 +631,7 @@ "dot", "notation" ], - "time": "2017-01-20 21:14:22" + "time": "2017-01-20T21:14:22+00:00" }, { "name": "doctrine/annotations", @@ -700,7 +699,7 @@ "docblock", "parser" ], - "time": "2017-02-24 16:22:25" + "time": "2017-02-24T16:22:25+00:00" }, { "name": "doctrine/collections", @@ -767,7 +766,7 @@ "collections", "iterator" ], - "time": "2017-01-03 10:49:41" + "time": "2017-01-03T10:49:41+00:00" }, { "name": "doctrine/instantiator", @@ -821,7 +820,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "doctrine/lexer", @@ -875,7 +874,7 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "epfremme/swagger-php", @@ -921,7 +920,7 @@ } ], "description": "Library for parsing swagger documentation into PHP entities for use in testing and code generation", - "time": "2016-09-26 17:24:17" + "time": "2016-09-26T17:24:17+00:00" }, { "name": "facebook/webdriver", @@ -976,7 +975,7 @@ "selenium", "webdriver" ], - "time": "2017-11-15 11:08:09" + "time": "2017-11-15T11:08:09+00:00" }, { "name": "flow/jsonpath", @@ -1017,7 +1016,7 @@ } ], "description": "JSONPath implementation for parsing, searching and flattening arrays", - "time": "2016-09-06 17:43:18" + "time": "2016-09-06T17:43:18+00:00" }, { "name": "fzaninotto/faker", @@ -1067,7 +1066,7 @@ "faker", "fixtures" ], - "time": "2017-08-15 16:48:10" + "time": "2017-08-15T16:48:10+00:00" }, { "name": "grasmash/expander", @@ -1114,7 +1113,7 @@ } ], "description": "Expands internal property references in PHP arrays file.", - "time": "2017-12-21 22:14:55" + "time": "2017-12-21T22:14:55+00:00" }, { "name": "grasmash/yaml-expander", @@ -1162,7 +1161,7 @@ } ], "description": "Expands internal property references in a yaml file.", - "time": "2017-12-16 16:06:03" + "time": "2017-12-16T16:06:03+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1227,7 +1226,7 @@ "rest", "web service" ], - "time": "2017-06-22 18:50:49" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -1278,7 +1277,7 @@ "keywords": [ "promise" ], - "time": "2016-12-20 10:07:11" + "time": "2016-12-20T10:07:11+00:00" }, { "name": "guzzlehttp/psr7", @@ -1343,7 +1342,7 @@ "uri", "url" ], - "time": "2017-03-20 17:10:46" + "time": "2017-03-20T17:10:46+00:00" }, { "name": "henrikbjorn/lurker", @@ -1402,7 +1401,7 @@ "resource", "watching" ], - "time": "2016-03-16 15:22:20" + "time": "2016-03-16T15:22:20+00:00" }, { "name": "jms/metadata", @@ -1453,7 +1452,7 @@ "xml", "yaml" ], - "time": "2016-12-05 10:18:33" + "time": "2016-12-05T10:18:33+00:00" }, { "name": "jms/parser-lib", @@ -1488,7 +1487,7 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18 18:08:43" + "time": "2012-11-18T18:08:43+00:00" }, { "name": "jms/serializer", @@ -1573,7 +1572,7 @@ "serialization", "xml" ], - "time": "2017-11-30 18:23:40" + "time": "2017-11-30T18:23:40+00:00" }, { "name": "league/container", @@ -1638,7 +1637,7 @@ "provider", "service" ], - "time": "2017-05-10 09:20:27" + "time": "2017-05-10T09:20:27+00:00" }, { "name": "magento/magento2-functional-testing-framework", @@ -1699,7 +1698,7 @@ "magento", "testing" ], - "time": "2018-01-17 12:02:50" + "time": "2018-01-17T12:02:50+00:00" }, { "name": "moontoast/math", @@ -1748,7 +1747,7 @@ "bcmath", "math" ], - "time": "2017-02-16 16:54:46" + "time": "2017-02-16T16:54:46+00:00" }, { "name": "mustache/mustache", @@ -1794,7 +1793,7 @@ "mustache", "templating" ], - "time": "2017-07-11 12:54:05" + "time": "2017-07-11T12:54:05+00:00" }, { "name": "myclabs/deep-copy", @@ -1839,7 +1838,7 @@ "object", "object graph" ], - "time": "2017-10-19 19:58:43" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "paragonie/random_compat", @@ -1887,7 +1886,7 @@ "pseudorandom", "random" ], - "time": "2017-09-27 21:40:39" + "time": "2017-09-27T21:40:39+00:00" }, { "name": "phar-io/manifest", @@ -1942,7 +1941,7 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05 18:14:27" + "time": "2017-03-05T18:14:27+00:00" }, { "name": "phar-io/version", @@ -1989,7 +1988,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05 17:38:23" + "time": "2017-03-05T17:38:23+00:00" }, { "name": "phpcollection/phpcollection", @@ -2037,7 +2036,7 @@ "sequence", "set" ], - "time": "2015-05-17 12:39:23" + "time": "2015-05-17T12:39:23+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2091,7 +2090,7 @@ "reflection", "static analysis" ], - "time": "2017-09-11 18:02:19" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -2142,7 +2141,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-27 17:38:31" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2189,7 +2188,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14 14:27:02" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpoption/phpoption", @@ -2239,7 +2238,7 @@ "php", "type" ], - "time": "2015-07-25 16:39:46" + "time": "2015-07-25T16:39:46+00:00" }, { "name": "phpspec/prophecy", @@ -2302,7 +2301,7 @@ "spy", "stub" ], - "time": "2017-11-24 13:59:53" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2365,7 +2364,7 @@ "testing", "xunit" ], - "time": "2017-12-06 09:29:45" + "time": "2017-12-06T09:29:45+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2412,7 +2411,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27 13:52:08" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -2453,7 +2452,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -2502,7 +2501,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -2551,7 +2550,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27 05:48:46" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", @@ -2635,7 +2634,7 @@ "testing", "xunit" ], - "time": "2017-11-08 11:26:09" + "time": "2017-11-08T11:26:09+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2694,7 +2693,7 @@ "mock", "xunit" ], - "time": "2017-08-03 14:08:16" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "psr/container", @@ -2743,7 +2742,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/http-message", @@ -2793,7 +2792,7 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "psr/log", @@ -2840,7 +2839,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -2920,7 +2919,7 @@ "identifier", "uuid" ], - "time": "2018-01-20 00:28:24" + "time": "2018-01-20T00:28:24+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2965,7 +2964,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04 06:30:41" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", @@ -3029,7 +3028,7 @@ "compare", "equality" ], - "time": "2018-01-12 06:34:42" + "time": "2018-01-12T06:34:42+00:00" }, { "name": "sebastian/diff", @@ -3081,7 +3080,7 @@ "keywords": [ "diff" ], - "time": "2017-08-03 08:09:46" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", @@ -3131,7 +3130,7 @@ "environment", "hhvm" ], - "time": "2017-07-01 08:51:00" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", @@ -3198,7 +3197,7 @@ "export", "exporter" ], - "time": "2017-04-03 13:19:02" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", @@ -3249,7 +3248,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27 15:39:26" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", @@ -3296,7 +3295,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03 12:35:26" + "time": "2017-08-03T12:35:26+00:00" }, { "name": "sebastian/object-reflector", @@ -3341,7 +3340,7 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29 09:07:27" + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", @@ -3394,7 +3393,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03 06:23:57" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -3436,7 +3435,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -3479,7 +3478,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/browser-kit", @@ -3536,7 +3535,7 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/config", @@ -3598,7 +3597,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/console", @@ -3667,7 +3666,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/css-selector", @@ -3720,7 +3719,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/debug", @@ -3776,7 +3775,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03 17:14:19" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/dom-crawler", @@ -3832,7 +3831,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/event-dispatcher", @@ -3895,7 +3894,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/filesystem", @@ -3944,7 +3943,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/finder", @@ -3993,7 +3992,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/http-foundation", @@ -4047,7 +4046,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-01-03 17:14:19" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4106,7 +4105,7 @@ "portable", "shim" ], - "time": "2017-10-11 12:05:26" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-php70", @@ -4165,7 +4164,7 @@ "portable", "shim" ], - "time": "2017-10-11 12:05:26" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/process", @@ -4214,7 +4213,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:11" + "time": "2018-01-03T07:37:11+00:00" }, { "name": "symfony/yaml", @@ -4272,7 +4271,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-01-03 07:37:34" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "theseer/tokenizer", @@ -4312,7 +4311,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07 12:08:54" + "time": "2017-04-07T12:08:54+00:00" }, { "name": "vlucas/phpdotenv", @@ -4362,7 +4361,7 @@ "env", "environment" ], - "time": "2016-09-01 10:05:43" + "time": "2016-09-01T10:05:43+00:00" }, { "name": "webmozart/assert", @@ -4412,7 +4411,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:58" + "time": "2016-11-23T20:04:58+00:00" } ], "packages-dev": [], diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/ConfigWYSIWYGActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigWYSIWYGActionGroup.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/ConfigWYSIWYGActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigWYSIWYGActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/SwitcherActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/SwitcherActionGroup.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Action Group/SwitcherActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/SwitcherActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/LoginToStorefrontActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/LoginToStorefrontActionGroup.xml new file mode 100644 index 0000000000000..ee455a4c03984 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/LoginToStorefrontActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + <actionGroup name="LoginToStorefrontActionGroup"> + <arguments> + <argument name="Customer"/> + </arguments> + <amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/> + <fillField stepKey="fillEmail" userInput="{{Customer.email}}" selector="{{StorefrontCustomerSignInFormSection.emailField}}"/> + <fillField stepKey="fillPassword" userInput="{{Customer.password}}" selector="{{StorefrontCustomerSignInFormSection.passwordField}}"/> + <click stepKey="clickSignInAccountButton" selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}"/> + </actionGroup> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml new file mode 100644 index 0000000000000..0ede83ac9b0ee --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + <actionGroup name="ApplyCartRuleOnStorefrontActionGroup"> + <arguments> + <argument name="Product" defaultValue="_defaultProduct"/> + <argument name="Coupon" defaultValue="SimpleSalesRuleCoupon"/> + </arguments> + <amOnPage url="{{Product.name}}.html" stepKey="navigateToProductPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart" /> + <waitForText userInput="You added {{Product.name}} to your shopping cart." stepKey="waitForAddedBtn"/> + <amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <click selector="{{DiscountSection.DiscountTab}}" stepKey="scrollToDiscountTab" /> + <fillField selector="{{DiscountSection.CouponInput}}" userInput="{{Coupon.code}}" stepKey="fillCouponCode" /> + <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="applyCode"/> + <waitForText userInput="You used coupon code" stepKey="waitForText"/> + <see userInput="You used coupon code" stepKey="assertText"/> + </actionGroup> +</actionGroups> From 1710dbc9c88a9708c3b31c0696b2c79b776f1f60 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Thu, 25 Jan 2018 15:09:30 -0600 Subject: [PATCH 244/277] MAGETWO-85421: Build Stabilization - fix static test failures --- app/code/Magento/Cms/Helper/Wysiwyg/Images.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index b7a53233cc807..d453e171944b2 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -9,6 +9,7 @@ /** * Wysiwyg Images Helper + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Images extends \Magento\Framework\App\Helper\AbstractHelper { From 44b9b6242b64e7696333d7dcda42c2a9df5f814d Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 15:22:00 -0600 Subject: [PATCH 245/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Accommodate prototype.js methods clobbering JS types in tests --- .../view/frontend/web/js/storage-manager.js | 4 ++- .../base/js/grid/columns/multiselect.test.js | 28 +++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js b/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js index fcba9e8dcf468..e3f5e04bdcb1b 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js @@ -161,7 +161,9 @@ define([ */ initUpdateStorageDataListener: function () { _.each(this.storagesNamespace, function (name) { - this[name].data.subscribe(this.updateDataHandler.bind(this, name)); + if (this[name].data) { + this[name].data.subscribe(this.updateDataHandler.bind(this, name)); + } }.bind(this)); }, diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js index ca2509c4ea707..de3387e31af88 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js @@ -43,8 +43,8 @@ define([ }); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([]); - expect(multiSelect.selected()).toEqual([]); + expect(multiSelect.excluded().toString()).toEqual(''); + expect(multiSelect.selected().toString()).toEqual(''); }); it('Select specific several rows on several pages', function () { @@ -52,8 +52,8 @@ define([ multiSelect.selected.push(5); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([]); - expect(multiSelect.selected()).toEqual([4, 5]); + expect(multiSelect.excluded().toString()).toEqual(''); + expect(multiSelect.selected().toString()).toEqual('4,5'); }); it('Select all rows on several pages', function () { @@ -71,8 +71,8 @@ define([ multiSelect.selectPage(); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([]); - expect(multiSelect.selected()).toEqual([1, 2, 3, 4]); + expect(multiSelect.excluded().toString()).toEqual(''); + expect(multiSelect.selected().toString()).toEqual('1,2,3,4'); }); it('Select all rows on current page with some specific rows on another page', function () { @@ -94,8 +94,8 @@ define([ }]); multiSelect.selected.push(6); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([5]); - expect(multiSelect.selected()).toEqual([3, 4, 6]); + expect(multiSelect.excluded().toString()).toEqual('5'); + expect(multiSelect.selected().toString()).toEqual('3,4,6'); }); it('Select all rows on several pages without some specific rows', function () { @@ -113,8 +113,8 @@ define([ multiSelect.selected.remove(4); // remove second expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([4]); - expect(multiSelect.selected()).toEqual([3]); + expect(multiSelect.excluded().toString()).toEqual('4'); + expect(multiSelect.selected().toString()).toEqual('3'); }); it('Select all rows all over the Grid', function () { @@ -131,8 +131,8 @@ define([ }]); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([]); - expect(multiSelect.selected()).toEqual([3, 4, 1, 2]); + expect(multiSelect.excluded().toString()).toEqual(''); + expect(multiSelect.selected().toString()).toEqual('3,4,1,2'); }); it('Select all rows all over the Grid without all rows on current page but with specific rows on another page', @@ -156,8 +156,8 @@ define([ }]); expect(multiSelect.allSelected()).toBeFalsy(); - expect(multiSelect.excluded()).toEqual([3, 4]); - expect(multiSelect.selected()).toEqual([5, 6]); + expect(multiSelect.excluded().toString()).toEqual('3,4'); + expect(multiSelect.selected().toString()).toEqual('5,6'); }); }); }); From 79da2c5fa493fc90c60b97d38618fac19129a354 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 16:05:22 -0600 Subject: [PATCH 246/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Add expectations on next tick --- .../jasmine/tests/lib/mage/backend/bootstrap.test.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/backend/bootstrap.test.js b/dev/tests/js/jasmine/tests/lib/mage/backend/bootstrap.test.js index 538c7e60b60fd..834a6df75843f 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/backend/bootstrap.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/backend/bootstrap.test.js @@ -20,14 +20,19 @@ define([ }); }); describe('"sendPostponeRequest" method', function () { - it('should insert "Error" notification if request failed', function () { + it('should insert "Error" notification if request failed', function (done) { jQuery('<div class="page-main-actions"></div>').appendTo('body'); jQuery('body').notification(); jQuery.ajax().abort(); - expect(jQuery('.message-error').length).toBe(1); - expect(jQuery('body:contains("A technical problem with the server created an error")').length).toBe(1); + setTimeout(function () { + expect(jQuery('.message-error').length).toBe(1); + expect( + jQuery('body:contains("A technical problem with the server created an error")').length + ).toBe(1); + done(); + }, 1); }); }); }); From 087c8919ddfb4020a1a12daf823584809a0471a3 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Thu, 25 Jan 2018 17:03:25 -0600 Subject: [PATCH 247/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Temporarily remove wysiwygAdapter.test.js to test travis build stabilization --- .../tests/lib/mage/wysiwygAdapter.test.js | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js diff --git a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js deleted file mode 100644 index 585bae2a50c95..0000000000000 --- a/dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -define([ - 'wysiwygAdapter' -], function (wysiwyg) { - 'use strict'; - - var decodedHtml = '<p><img src="{{media url="wysiwyg/banana.jpg"}}" alt="" width="612" height="459"></p>', - encodedHtml = '<p>' + - '<img src="http://magento2.vagrant154/admin/cms/wysiwyg/directive/' + - '___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmFuYW5hLmpwZyJ9fQ%2C%2C" alt="" width="612" height="459">' + - '</p>'; - - wysiwyg.config = { - 'directives_url': 'http://magento2.vagrant154/admin/cms/wysiwyg/directive/' - }; - - describe('wysiwygAdapter', function () { - it('encodes directives properly', function () { - expect(wysiwyg.encodeDirectives(decodedHtml)).toEqual(encodedHtml); - }); - - it('decodes directives properly', function () { - expect(wysiwyg.decodeDirectives(encodedHtml)).toEqual(decodedHtml); - }); - }); -}); From 80d9a5cc326c33439812bbb93643e91782c196a1 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Thu, 25 Jan 2018 17:23:10 -0600 Subject: [PATCH 248/277] MAGETWO-85421: Build Stabilization - mftf tests stabilization --- .../AdminCreateUserRoleActionGroup.xml | 28 ------------------- .../User/Page/AdminEditRolePage.xml | 1 - .../Section/AdminEditRoleResourcesSection.xml | 15 ---------- 3 files changed, 44 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml deleted file mode 100644 index cfb0820d31614..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/ActionGroup/AdminCreateUserRoleActionGroup.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCreateUserRoleActionGroup"> - <arguments> - <argument name="role" /> - <argument name="StoreGroup" defaultValue="_defaultStoreGroup"/> - </arguments> - <amOnPage url="{{AdminEditRolePage.url}}" stepKey="navigateToNewRole"/> - <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminEditRoleInfoSection.roleName}}" userInput="{{role.name}}" stepKey="fillRoleName" /> - <fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterPassword" /> - <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> - <waitForElementVisible selector="{{AdminEditRoleResourcesSection.roleScopes}}" stepKey="waitForScopeSelection" /> - <selectOption selector="{{AdminEditRoleResourcesSection.roleScopes}}" userInput="Custom" stepKey="selectScope" /> - <click selector="{{AdminEditRoleResourcesSection.storeName(StoreGroup.name)}}" stepKey="selectCreatedStoreGroup" /> - <selectOption selector="{{AdminEditRoleResourcesSection.resourceAccess}}" userInput="{{role.access}}" stepKey="selectAccess" /> - <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" /> - <waitForPageLoad stepKey="waitForPageLoad2" /> - <see userInput="You saved the role." stepKey="seeSuccessMessage" /> - </actionGroup> -</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml index e75a5a6aa2e9f..58dfad7f34263 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Page/AdminEditRolePage.xml @@ -8,6 +8,5 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> <page name="AdminEditRolePage" url="admin/user_role/editrole" module="Magento_User" area="admin"> <section name="AdminEditRoleInfoSection"/> - <section name="AdminEditRoleResourcesSection"/> </page> </pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml deleted file mode 100644 index 3e0719606a5ca..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleResourcesSection.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> - <section name="AdminEditRoleResourcesSection"> - <element name="roleScopes" type="select" selector="#gws_is_all"/> - <element name="resourceAccess" type="select" selector="#all"/> - <element name="resources" type="checkbox" selector="#role_info_tabs_account"/> - <element name="storeName" type="checkbox" selector="//label[contains(text(),'{{var1}}')]" parameterized="true"/> - </section> -</sections> From 903fad1d5d5bc36a060a69acc43c1c44a3688227 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Thu, 25 Jan 2018 17:28:31 -0600 Subject: [PATCH 249/277] MAGETWO-85423: Create or update functional tests --- dev/tests/acceptance/tests/_suite/sampleSuite.xml | 12 ++++++------ .../Test/AdminAddImageToWYSIWYGCatalogCest.xml | 6 +++--- .../Test/AdminAddImageToWYSIWYGProductCest.xml | 6 +++--- .../Test/AdminEditTextEditorProductAttributeCest.xml | 6 +++--- .../Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml | 6 +++--- .../VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml | 6 +++--- .../VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml | 6 +++--- .../Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml | 10 +++++----- .../Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml | 10 +++++----- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 11 +++++------ .../Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml | 11 +++++------ .../Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 10 +++++----- ...dminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml | 6 +++--- ...nAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml | 6 +++--- ...idgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml | 10 +++++----- ...WidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml | 6 +++--- ...WidgetToWYSIWYGWithCatalogProductListTypeCest.xml | 6 +++--- ...ToWYSIWYGWithRecentlyComparedProductsTypeCest.xml | 6 +++--- ...etToWYSIWYGWithRecentlyViewedProductsTypeCest.xml | 6 +++--- .../Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 6 +++--- .../VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml | 6 +++--- .../VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml | 6 +++--- .../Test/AdminAddImageToWYSIWYGNewsletterCest.xml | 10 +++++----- .../Test/AdminAddVariableToWYSIWYGNewsletterCest.xml | 10 +++++----- .../Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml | 6 +++--- ...erifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml | 6 +++--- 26 files changed, 97 insertions(+), 99 deletions(-) diff --git a/dev/tests/acceptance/tests/_suite/sampleSuite.xml b/dev/tests/acceptance/tests/_suite/sampleSuite.xml index c3a3e93b7d8f1..372dc19b13663 100644 --- a/dev/tests/acceptance/tests/_suite/sampleSuite.xml +++ b/dev/tests/acceptance/tests/_suite/sampleSuite.xml @@ -31,8 +31,8 @@ <module name="Catalog" /> </include> <exclude> - <cest name="AdminCreateCategoryCest"/> - <cest name="AdminCreateSimpleProductCest"/> + <test name="AdminCreateCategoryCest"/> + <test name="AdminCreateSimpleProductCest"/> </exclude> </suite> <suite name="Cms"> @@ -40,7 +40,7 @@ <module name="Cms" /> </include> <exclude> - <cest name="AdminCreateCmsPageCest"/> + <test name="AdminCreateCmsPageCest"/> </exclude> </suite> <suite name="Newsletter"> @@ -55,9 +55,9 @@ <module name="Newsletter" /> </include> <exclude> - <cest name="AdminCreateCmsPageCest"/> - <cest name="AdminCreateCategoryCest"/> - <cest name="AdminCreateSimpleProductCest"/> + <test name="AdminCreateCmsPageCest"/> + <test name="AdminCreateCategoryCest"/> + <test name="AdminCreateSimpleProductCest"/> </exclude> </suite> </suites> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml index db132158d0255..62adf4573999b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml @@ -14,9 +14,9 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <annotations> - <features value="Add Image to WYSIWYG on Catalog Page"/> - <stories value="Default WYSIWYG toolbar configuration with Magento Media Gallery-MAGETWO-42041"/> - <group value="addImageCatalog"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42041-Default WYSIWYG toolbar configuration with Magento Media Gallery"/> + <group value="Catalog"/> <title value="Admin should be able to add image to WYSIWYG Editor on Catalog Page"/> <description value="Admin should be able to add image to WYSIWYG Editor on Catalog Page"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml index 6f37d99507ac0..aaa3f95d8775b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddImageToWYSIWYGProductEditor"> <annotations> - <features value="Add Image to WYSIWYG on Product Page"/> - <stories value="Default WYSIWYG toolbar configuration with Magento Media Gallery-MAGETWO-42041"/> - <group value="addImageProduct"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42041-Default WYSIWYG toolbar configuration with Magento Media Gallery"/> + <group value="Catalog"/> <title value="Admin should be able to add image to WYSIWYG Editor on Product Page"/> <description value="Admin should be able to add image to WYSIWYG Editor on Product Page"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml index 2b2c9ed2d6190..cbd221cf88db7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="EditTextEditorProductAttributeCest"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Input type configuration for custom Product Attributes-MAGETWO-51484"/> - <group value="editProductAttribute"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-51484-Input type configuration for custom Product Attributes"/> + <group value="Catalog"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Product Page"/> <description value="Admin should be able to switch between 2 version of Tinymce in the admin back-end."/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml index 90005bcb6df97..07af48562d3b9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProducCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="Verifydefaultcontrolsonproductdescription"> <annotations> - <features value="Default WYSIWYG toolbar configuration in Magento"/> - <stories value="Default toolbar configuration in Magento-MAGETWO-70412"/> - <group value="WYSIWYG"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-70412-Default toolbar configuration in Magento"/> + <group value="Catalog"/> <title value="You should be able to see default toolbar display on Description content area"/> <description value="You should be able to see default toolbar display on Description content area"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml index cddc997b304fa..4aa6be2c41595 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="DefaultTinyMCEv4onCatalogPage"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Apply new WYSIWYG on Categories Page-MAGETWO-72137"/> - <group value="WYSIWYG"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-72137-Apply new WYSIWYG on Categories Page"/> + <group value="Catalog"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Catalog Page"/> <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Catalog Page"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml index 3a2855346f603..a8641640432f2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="DefaultTinyMCEv4onProductPage"> <annotations> - <features value="TinyMCEv4"/> - <stories value="TinyMCE v4.6 as a native WYSIWYG editor extension-MAGETWO-72114"/> - <group value="WYSIWYG"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-72114-TinyMCE v4.6 as a native WYSIWYG editor"/> + <group value="Catalog"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Product Page"/> <description value="Admin should be able to switch between 2 version of Tinymce in the admin back-end."/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index d323d49c4a368..6fc88675f1d5e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddImageToWYSIWYGEditorBlock"> <annotations> - <features value="Add Image to WYSIWYG Block"/> - <stories value="Default WYSIWYG toolbar configuration with Magento Media Gallery-MAGETWO-42041"/> - <group value="addImageBlock"/> - <title value="You should be able to add image to WYSIWYG EditorBlock"/> - <description value="You should be able to add image to WYSIWYG Editor Block"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42041-Default WYSIWYG toolbar configuration with Magento Media Gallery"/> + <group value="Cms"/> + <title value="Admin should be able to add image to WYSIWYG content of Block"/> + <description value="Admin should be able to add image to WYSIWYG content of Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84376"/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml index ed6b6fc7d7319..0136ae7171d49 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddImageToWYSIWYGEditorCMS"> <annotations> - <features value="Add Image to WYSIWYG CMS"/> - <stories value="Default WYSIWYG toolbar configuration with Magento Media Gallery-MAGETWO-42041"/> - <group value="addImageCMS"/> - <title value="You should be able to add image to WYSIWYG Editor CMS"/> - <description value="You should be able to add image to WYSIWYG Editor CMS"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42041-Default WYSIWYG toolbar configuration with Magento Media Gallery"/> + <group value="Cms"/> + <title value="Admin should be able to add image to WYSIWYG content of CMS Page"/> + <description value="Admin should be able to add image to WYSIWYG content of CMS Page"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-85825 "/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 80e418ea4bf22..6d8708da7fa92 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -9,13 +9,12 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddVariableToBlock"> <annotations> - <features value="Add Variable to WYSIWYG Block"/> - <stories value="Add Variable to WYSIWYG MAGETWO-42158"/> - <group value="variableBlock"/> - <title value="You should be able to add variable to WYSIWYG Editor of Block"/> - <description value="You should be able to add variable to WYSIWYG Editor Block"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42158-Variable with WYSIWYG"/> + <group value="Cms"/> + <title value="Admin should be able to add variable to WYSIWYG content of Block"/> + <description value="You should be able to add variable to WYSIWYG content Block"/> <testCaseId value="MAGETWO-84378"/> - <group value="skip"/> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index 26c0416e93356..23384f1c04a73 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -9,14 +9,13 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="InsertDefaultMagentoVariableIntoWYSIWYGOnPages"> <annotations> - <features value="Add Variable to WYSIWYG"/> - <stories value="Add Variable to WYSIWYG MAGETWO-42158"/> - <group value="addVariableToCMS"/> - <title value="Insert default Magento variable into content of WYSIWYG on Pages"/> - <description value="Insert default Magento variable into content of WYSIWYG on Pages"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42158-Variable with WYSIWYG "/> + <group value="Cms"/> + <title value="Insert default Magento variable into content of WYSIWYG on CMS Pages"/> + <description value="Insert default Magento variable into content of WYSIWYG on CMS Pages"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83504"/> - <group value="skip" /> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 0cee7454fedf6..adc9541f8d139 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToBlock"> <annotations> - <features value="Add Widget to WYSIWYG of Block"/> - <stories value="Apply new WYSIWYG in Block-MAGETWO-47309"/> - <group value="widgetBlock"/> - <title value="You should be able to add widget to WYSIWYG Editor of Block"/> - <description value="You should be able to add widget to WYSIWYG Editor Block"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Apply new WYSIWYG in Block"/> + <group value="Cms"/> + <title value="Admin should be able to add widget to WYSIWYG content of Block"/> + <description value="Admin should be able to add widget to WYSIWYG content Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84654"/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml index 76630b6a64800..3e50ce671cd3c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfCMSPageLink"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="CMSPageLink"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type:CMS page link"/> <description value="Create CMS Page With Widget Type:CMS page link"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml index 91833da997459..458cb13c4906b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfCMSStaticBlock"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="CMSStaticBlock"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type:CMS Static Block"/> <description value="Create CMS Page With Widget Type:CMS Static Block"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 29717ae41f532..69b1eff280506 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfCatalogCategoryLink"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="categoryLink"/> - <title value="Insert default Magento widget into content of WYSIWYG on CMS Pages"/> - <description value="Insert default Magento widget into content of WYSIWYG on CMS Pages"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> + <title value="Create CMS Page With Widget Type: Catalog category link"/> + <description value="Create CMS Page With Widget Type: Catalog category link"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83611"/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml index 886e80c2af6e4..622d29ebb196c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfCatalogProductLink"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="productLink"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type: Catalog product link"/> <description value="Create CMS Page With Widget Type: Catalog product link"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml index 131dac25abd53..e21a77b25e6e0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfCatalogProductList"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="productList"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type: Catalog product list"/> <description value="Create CMS Page With Widget Type: Catalog product list"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 178901129543a..5e8b000a266a6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfRecentlyComparedProducts"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="recentlyCompared"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type: Recently Compared Products"/> <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml index d55ddd6c51263..143033c98e9f6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfRecentlyViewedProducts"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="recentlyViewed"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type: Recently Viewed Products"/> <description value="Create CMS Page With Widget Type: Recently Viewed Products"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index 8f0a834ff3069..b477928c55421 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminSwitchWYSIWYGOptionsCest"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Admin are able to switch between TinyMCE versions MAGETWO-51829"/> - <group value="switcher"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-51829-Extensible list of WYSIWYG editors available in Magento"/> + <group value="Cms"/> <title value="Admin are able to switch between versions of TinyMCE."/> <description value="Admin are able to switch between versions of TinyMCE."/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index 10599ab90e00d..a14e90f7548de 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="DefaultTinyMCEv4onBlockPage"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Apply new WYSIWYG on Block Page-MAGETWO-42046"/> - <group value="blockWYSIWYG"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42046-Apply new WYSIWYG on CMS Page and Block"/> + <group value="Cms"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Block"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml index af6f165162649..7978faec189db 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml @@ -10,9 +10,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="DefaultTinyMCEv4onCMSPage"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Apply new WYSIWYG on CMS Page-MAGETWO-42046"/> - <group value="cmsWYSIWYG"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42046-Apply new WYSIWYG on CMS Page"/> + <group value="Cms"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on CMS Page"/> <description value="Admin see TinyMCEv4.6 is native WYSIWYG on CMS Page"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml index 3528a22d88cd8..a8e08bccec8c4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddImageToNewsletter"> <annotations> - <features value="Add Image to WYSIWYG of Newsletter"/> - <stories value="Apply new WYSIWYG in Newsletter-MAGETWO-47309"/> - <group value="newsletterImage"/> - <title value="You should be able to add image to WYSIWYG Editor of Newsletter"/> - <description value="You should be able to add image to WYSIWYG Editor Newsletter"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-47309-Apply new WYSIWYG in Newsletter"/> + <group value="Newsletter"/> + <title value="Admin should be able to add image to WYSIWYG content of Newsletter"/> + <description value="Admin should be able to add image to WYSIWYG content Newsletter"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84377"/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml index 2c9c0066a6622..6baf9707a73c1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddVariableToNewsletter"> <annotations> - <features value="Add Variable to WYSIWYG Newsletter"/> - <stories value="Add Variable to WYSIWYG MAGETWO-42158"/> - <group value="newsletter"/> - <title value="You should be able to add variable to WYSIWYG Editor of Newsletter"/> - <description value="You should be able to add variable to WYSIWYG Editor Newsletter"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42158-Variables with WYSIWYG"/> + <group value="Newsletter"/> + <title value="Admin should be able to add variable to WYSIWYG Editor of Newsletter"/> + <description value="Admin should be able to add variable to WYSIWYG Editor Newsletter"/> <testCaseId value="MAGETWO-84379"/> <group value="skip"/> </annotations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml index 328ffbcc07ffa..85ba7e6fcc9c3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToNewsletter"> <annotations> - <features value="Add Widget to WYSIWYG of Newsletter"/> - <stories value="Apply new WYSIWYG in Newsletter-MAGETWO-47309"/> - <group value="newsletter"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-47309-Apply new WYSIWYG in Newsletter"/> + <group value="Newsletter"/> <title value="You should be able to add widget to WYSIWYG Editor of Newsletter"/> <description value="You should be able to add widget to WYSIWYG Editor Newsletter"/> <severity value="CRITICAL"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml index 447744e9744c9..f9571a6e7477e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="DefaultTinyMCEv4onNewsletter"> <annotations> - <features value="TinyMCEv4"/> - <stories value="Apply new WYSIWYG in Newsletter-MAGETWO-47309"/> - <group value="newsletter"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-47309-Apply new WYSIWYG in Newsletter"/> + <group value="Newsletter"/> <title value="Admin see TinyMCEv4.6 is native WYSIWYG on Newsletter"/> <description value="Admin see TinyMCEv4.6 is native WYSIWYG on Newsletter"/> <severity value="CRITICAL"/> From 74d626735aed2858ef19a8aa04552c57632c8e1c Mon Sep 17 00:00:00 2001 From: Tommy Wiebell <twiebell@magento.com> Date: Thu, 25 Jan 2018 17:42:39 -0600 Subject: [PATCH 250/277] MAGETWO-86865: Stabilize functional tests on Jenkins - Mark randomly failing tests as skipped so we can investigate further --- .../Analytics/Test/AdminConfigurationBlankIndustryCest.xml | 1 + .../Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml index 359b6a54a52f7..6f2f7b5782342 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml @@ -16,6 +16,7 @@ <severity value="NORMAL"/> <testCaseId value="MAGETWO-63981"/> <group value="analytics"/> + <group value="skip"/> </annotations> <after> <amOnPage stepKey="amOnLogoutPage" url="admin/admin/auth/logout/"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml index cdd62ac97de09..be17bfbcccf1d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml @@ -12,6 +12,7 @@ <features value="Add Image to WYSIWYG of Newsletter"/> <stories value="Apply new WYSIWYG in Newsletter-MAGETWO-47309"/> <group value="newsletter"/> + <group value="skip"/> <title value="You should be able to add image to WYSIWYG Editor of Newsletter"/> <description value="You should be able to add image to WYSIWYG Editor Newsletter"/> <severity value="CRITICAL"/> From 375bb3b40059b5939d53d7e8a8ed0937bbc12003 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Thu, 25 Jan 2018 19:36:33 -0600 Subject: [PATCH 251/277] MAGETWO-85423: Create or update functional tests --- .../User/Test/AdminCreateUserCest.xml | 31 ------------------- .../User/Test/AdminCreateUserRoleCest.xml | 28 ----------------- 2 files changed, 59 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml deleted file mode 100644 index 59570a5cd3260..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserCest.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminCreateUserWithNewAdminRoleTest"> - <annotations> - <title value="Create a user in admin"/> - <description value="Create a user in admin"/> - <group value="user"/> - </annotations> - <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> - </before> - <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createNewAdminUserRole"> - <argument name="role" value="adminRole"/> - </actionGroup> - <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> - <argument name="role" value="adminRole"/> - </actionGroup> - <amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToRoleGrid" /> - <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{admin2.username}}" stepKey="filterByUserName" /> - <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch" /> - <waitForPageLoad stepKey="waitForPageLoad2" /> - <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{admin2.username}}" stepKey="seeNewRole" /> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml deleted file mode 100644 index 9f2db26e10ebd..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Test/AdminCreateUserRoleCest.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminCreateUserRoleTest"> - <annotations> - <title value="Create a user role in admin"/> - <description value="Create a user role in admin"/> - <group value="userRole"/> - </annotations> - <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> - </before> - <actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createUserRole"> - <argument name="role" value="adminRole"/> - </actionGroup> - <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToRoleGrid" /> - <waitForPageLoad stepKey="waitForPageLoad1" /> - <fillField selector="{{AdminRoleGridSection.roleNameFilterTextField}}" userInput="{{adminRole.name}}" stepKey="enterRoleName" /> - <click selector="{{AdminRoleGridSection.searchButton}}" stepKey="clickSearch" /> - <waitForPageLoad stepKey="waitForPageLoad2" /> - <see selector="{{AdminRoleGridSection.roleNameInFirstRow}}" userInput="{{adminRole.name}}" stepKey="seeNewRole" /> - </test> -</tests> From df608f6447d5813c4aa4a21024aa7c62b865fe82 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Thu, 25 Jan 2018 22:06:30 -0600 Subject: [PATCH 252/277] MAGETWO-85421: Build Stabilization --- .../Test/AdminAddVariableToWYSIWYGBlockCest.xml | 1 + .../Test/AdminAddVariableToWYSIWYGCMSCest.xml | 1 + ...IWYGWithRecentlyComparedProductsTypeCest.xml | 17 ++++++++--------- .../Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 6d8708da7fa92..4a1c519a1501b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -15,6 +15,7 @@ <title value="Admin should be able to add variable to WYSIWYG content of Block"/> <description value="You should be able to add variable to WYSIWYG content Block"/> <testCaseId value="MAGETWO-84378"/> + <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index 23384f1c04a73..dcfc528c1098d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -16,6 +16,7 @@ <description value="Insert default Magento variable into content of WYSIWYG on CMS Pages"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83504"/> + <group value="skip" /> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 5e8b000a266a6..7dedac0e843be 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -10,13 +10,14 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfRecentlyComparedProducts"> <annotations> - <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> - <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> - <group value="Cms"/> + <features value="Add Widget to WYSIWYG"/> + <stories value="Widgets in WYSIWYG"/> + <group value="recentlyCompared"/> <title value="Create CMS Page With Widget Type: Recently Compared Products"/> <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83792"/> + <group value="skip" /> </annotations> <!--Main test--> <before> @@ -32,10 +33,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <waitForPageLoad stepKey="wait2"/> @@ -75,11 +76,9 @@ <!--see widget on Storefront--> <see userInput="Hello CMS Page!" stepKey="seeContent"/> <waitForPageLoad stepKey="wait6" /> - <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waitForProductVisible" /> + <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waiForProductVisible" /> <see userInput="$$createPreReqProduct.name$$" stepKey="seeProductName" /> <after> - <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> - <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index b477928c55421..eea60fe775a0f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -48,7 +48,6 @@ <!--see widget on Storefront--> <see userInput="Hello TinyMCE4!" stepKey="seeContent1"/> <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage2"/> - <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="expandWYSIWYGOptions2" /> <waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2" /> <uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/> <waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown2" /> From 98ff613d6786410accd27df2b20319b69a5c78da Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 08:47:21 -0600 Subject: [PATCH 253/277] MAGETWO-85421: Build Stabilization --- ...WYGWithRecentlyComparedProductsTypeCest.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 7dedac0e843be..66ae4a5d1cc53 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -7,12 +7,12 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AddWidgetToWYSIWYGWithTypeOfRecentlyComparedProducts"> <annotations> - <features value="Add Widget to WYSIWYG"/> - <stories value="Widgets in WYSIWYG"/> - <group value="recentlyCompared"/> + <features value="MAGETWO-36659-[CMS] WYSIWYG update"/> + <stories value="MAGETWO-42156-Widgets in WYSIWYG"/> + <group value="Cms"/> <title value="Create CMS Page With Widget Type: Recently Compared Products"/> <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> @@ -33,10 +33,10 @@ <waitForPageLoad stepKey="wait1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> - <waitForElementVisible selector="{{CmsWYSIWYGSection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> + <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> <executeJS function="tinyMCE.activeEditor.setContent('Hello CMS Page!');" stepKey="executeJSFillContent"/> - <seeElement selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> - <click selector="{{CmsWYSIWYGSection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> + <seeElement selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="seeWidgetIcon" /> + <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad" /> <see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" /> <waitForPageLoad stepKey="wait2"/> @@ -76,9 +76,11 @@ <!--see widget on Storefront--> <see userInput="Hello CMS Page!" stepKey="seeContent"/> <waitForPageLoad stepKey="wait6" /> - <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waiForProductVisible" /> + <waitForText userInput="$$createPreReqProduct.name$$" stepKey="waitForProductVisible" /> <see userInput="$$createPreReqProduct.name$$" stepKey="seeProductName" /> <after> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> </after> From 663a82d8f8f83965266db11f482f410a0f6c2697 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 09:36:30 -0600 Subject: [PATCH 254/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery --- ...inAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml | 1 + .../FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 411b9cb64e308..7dedac0e843be 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -17,6 +17,7 @@ <description value="Create CMS Page With Widget Type: Recently Compared Products"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83792"/> + <group value="skip" /> </annotations> <!--Main test--> <before> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index 76e79e06bf435..f4e0b7ac1af85 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -48,7 +48,7 @@ <!--see widget on Storefront--> <see userInput="Hello TinyMCE4!" stepKey="seeContent1"/> <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage2"/> - <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="expandWYSIWYGOptions2" /> + <conditionalClick stepKey="expandWYSIWYGOptions" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true" /> <waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2" /> <uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/> <waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown2" /> From 0276cb67b589a4ec5e7d61eaa5fe74d957e77cf9 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 10:37:58 -0600 Subject: [PATCH 255/277] MAGETWO-85421: Build Stabilization --- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 1 + .../FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml | 1 + .../FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 1 + 3 files changed, 3 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 4a1c519a1501b..54b24cff8b0c6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -16,6 +16,7 @@ <description value="You should be able to add variable to WYSIWYG content Block"/> <testCaseId value="MAGETWO-84378"/> <group value="skip" /> + <!--Bug link MAGETWO-86383--> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index dcfc528c1098d..afc1166d9ee56 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -17,6 +17,7 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-83504"/> <group value="skip" /> + <!--Bug link MAGETWO-86383--> </annotations> <before> <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index eea60fe775a0f..139d45ac04c34 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -48,6 +48,7 @@ <!--see widget on Storefront--> <see userInput="Hello TinyMCE4!" stepKey="seeContent1"/> <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage2"/> + <conditionalClick stepKey="expandWYSIWYGOptions" selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.CheckIfTabExpand}}" visible="true" /> <waitForElementVisible selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="waitForCheckbox2" /> <uncheckOption selector="{{ContentManagementSection.SwitcherSystemValue}}" stepKey="uncheckUseSystemValue2"/> <waitForElementVisible selector="{{ContentManagementSection.Switcher}}" stepKey="waitForSwitcherDropdown2" /> From e5d2fc6f7bc482f4f02187ee94f798e44854ab30 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 10:58:59 -0600 Subject: [PATCH 256/277] MAGETWO-85421: Build Stabilization --- .../Store/ActionGroup/AdminCreateStoreViewActionGroup.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml index b7b3bb4785faf..4cf0e64ed467e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml @@ -24,6 +24,7 @@ <seeInSource html="'Warning message'" stepKey="seeWarning" /> <click selector=".action-primary.action-accept" stepKey="dismissModal" /> <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReolad"/> <see userInput="You saved the store view." stepKey="seeSavedMessage" /> </actionGroup> </actionGroups> From e219d85c9816f8d4d13890b74bc3483dfe12c326 Mon Sep 17 00:00:00 2001 From: Dan Mooney <dmooney@magento.com> Date: Fri, 26 Jan 2018 11:54:51 -0600 Subject: [PATCH 257/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery Add waitForPageLoadAfterSaveCmsPage in AdminAddVariableToWYSIWYGBlockCest.xml --- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index f13587431e2e5..ad65e2d6284d8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -101,6 +101,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading" /> <waitForPageLoad stepKey="waitForPageLoad10" /> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> + <waitForPageLoad stepKey="waitForPageLoadAfterSaveCmsPage" /> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage1"/> <waitForPageLoad stepKey="waitForPageLoad11" /> From 4b96d23289195c64077660ad78a9afa71ef0b384 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 13:12:18 -0600 Subject: [PATCH 258/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery --- .../Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index ad65e2d6284d8..89d8ac1c81cc8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -100,6 +100,7 @@ <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidgetBtn" /> <waitForLoadingMaskToDisappear stepKey="waitForLoading" /> <waitForPageLoad stepKey="waitForPageLoad10" /> + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="waitForSaveButtonVisible"/> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <waitForPageLoad stepKey="waitForPageLoadAfterSaveCmsPage" /> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> From 2ed8b1494597797c3cea4ee3d9033f6c5d6d8ff7 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 14:08:11 -0600 Subject: [PATCH 259/277] MAGETWO-86367: Sprint 6 Build Stabilization & PR Delivery --- .../FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index 7329bc95ede2c..d285ef41eb8d5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -16,6 +16,7 @@ <description value="You should be able to add widget to WYSIWYG Editor Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84654"/> + <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> From c2cc6d1b0ee9b49687c1424e5940937d18078fcc Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 14:11:46 -0600 Subject: [PATCH 260/277] MAGETWO-85421: Build Stabilization --- .../FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index adc9541f8d139..56a2e30af84bb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -16,6 +16,7 @@ <description value="Admin should be able to add widget to WYSIWYG content Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84654"/> + <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> From 65a40996680ce42a5390f8250553deaac3fbf850 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Fri, 26 Jan 2018 15:02:03 -0600 Subject: [PATCH 261/277] MAGETWO-85423: Create or update functional tests --- .../FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml | 1 + .../ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml index 139d45ac04c34..56edb80d7f759 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml @@ -72,6 +72,7 @@ <waitForPageLoad stepKey="wait4" /> <!--see widget on Storefront--> <see userInput="Hello TinyMCE3!" stepKey="seeContent2"/> + <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml index 0ede83ac9b0ee..06318f5080943 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/ApplyCartRuleOnStorefrontActionGroup.xml @@ -21,6 +21,7 @@ <click selector="{{DiscountSection.DiscountTab}}" stepKey="scrollToDiscountTab" /> <fillField selector="{{DiscountSection.CouponInput}}" userInput="{{Coupon.code}}" stepKey="fillCouponCode" /> <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="applyCode"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> <waitForText userInput="You used coupon code" stepKey="waitForText"/> <see userInput="You used coupon code" stepKey="assertText"/> </actionGroup> From 038c8189b8cd49df4a8af846536a0a29e61356c2 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 15:03:08 -0600 Subject: [PATCH 262/277] MAGETWO-85421: Build Stabilization --- .../FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index 6fc88675f1d5e..012d2212d4669 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -16,6 +16,7 @@ <description value="Admin should be able to add image to WYSIWYG content of Block"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-84376"/> + <group value="skip" /> </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> From 6f79a9f7fd554e0575f91e78b1a52e5a4b0860c5 Mon Sep 17 00:00:00 2001 From: Eric Bohanon <ebohanon@magento.com> Date: Fri, 26 Jan 2018 15:07:09 -0600 Subject: [PATCH 263/277] MAGETWO-87010: Create GraphQL Error Handling Framework - Create GraphQL Exception handling in framework - Add new exceptions to existing resolvers - Add tests --- .../Model/Resolver/Products.php | 12 +- .../Model/Resolver/Customer.php | 13 +- .../Customer/CustomerDataProvider.php | 2 + .../Resolver/CustomAttributeMetadata.php | 68 ++++++-- .../Magento/GraphQl/Controller/GraphQl.php | 7 +- app/code/Magento/GraphQl/etc/graphql.xml | 4 +- .../TestFramework/TestCase/GraphQl/Client.php | 9 ++ .../ExceptionFormatterDefaultModeTest.php | 145 ++++++++++++++++++ .../GraphQl/Catalog/ProductSearchTest.php | 33 ++++ .../GraphQl/Eav/ExceptionFormatterTest.php | 77 ++++++++++ .../GraphQl/UrlRewrite/UrlResolverTest.php | 38 +++++ .../GraphQlAuthorizationException.php | 53 +++++++ .../Exception/GraphQlInputException.php | 4 +- .../GraphQlNoSuchEntityException.php | 53 +++++++ .../Framework/GraphQl/ExceptionFormatter.php | 55 ++++++- .../Framework/GraphQl/QueryProcessor.php | 18 ++- .../GraphQl/Type/Input/InputObjectType.php | 46 +++++- 17 files changed, 609 insertions(+), 28 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ExceptionFormatterDefaultModeTest.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Eav/ExceptionFormatterTest.php create mode 100644 lib/internal/Magento/Framework/GraphQl/Exception/GraphQlAuthorizationException.php create mode 100644 lib/internal/Magento/Framework/GraphQl/Exception/GraphQlNoSuchEntityException.php diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php index 6b99d86ddf19f..bfa7964601148 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php @@ -55,7 +55,11 @@ public function resolve(array $args, ResolverContextInterface $context) { $searchCriteria = $this->searchCriteriaBuilder->build($args); - if (isset($args['search'])) { + if (!isset($args['search']) && !isset($args['filter'])) { + throw new GraphQlInputException( + __("One of 'search' or 'filter' input arguments needs to be specified in products request.") + ); + } elseif (isset($args['search'])) { $searchResult = $this->searchQuery->getResult($searchCriteria); } else { $searchResult = $this->filterQuery->getResult($searchCriteria); @@ -67,8 +71,10 @@ public function resolve(array $args, ResolverContextInterface $context) } else { $maxPages = 0; } + + $currentPage = $searchCriteria->getCurrentPage(); if ($searchCriteria->getCurrentPage() > $maxPages && $searchResult->getTotalCount() > 0) { - throw new GraphQlInputException( + $currentPage = new GraphQlInputException( __( 'The value specified in the currentPage attribute is greater than the number' . ' of pages available (%1).', @@ -82,7 +88,7 @@ public function resolve(array $args, ResolverContextInterface $context) 'items' => $searchResult->getProductsSearchResult(), 'page_info' => [ 'page_size' => $searchCriteria->getPageSize(), - 'current_page' => $searchCriteria->getCurrentPage() + 'current_page' => $currentPage ] ]; } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer.php index e2a1301baa1f1..770f75bf5f0e1 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer.php @@ -6,6 +6,8 @@ namespace Magento\CustomerGraphQl\Model\Resolver; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\GraphQl\Model\ResolverInterface; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\GraphQl\Model\ResolverContextInterface; @@ -36,10 +38,17 @@ public function resolve(array $args, ResolverContextInterface $context) { if ((!$context->getUserId()) || $context->getUserType() == 4) { throw new GraphQlInputException( - __('Current customer does not have access to the resource "%1"', 'customer') + __( + 'Current customer does not have access to the resource "%1"', + [\Magento\Customer\Model\Customer::ENTITY] + ) ); } - return $this->customerResolver->getCustomerById($context->getUserId()); + try { + return $this->customerResolver->getCustomerById($context->getUserId()); + } catch (NoSuchEntityException $exception) { + return new GraphQlNoSuchEntityException(__('Customer id %1 does not exist.', [$context->getUserId()])); + } } } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php index 2601dff5f3b9e..e8c6a7195a73f 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php @@ -7,6 +7,7 @@ namespace Magento\CustomerGraphQl\Model\Resolver\Customer; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Webapi\ServiceOutputProcessor; @@ -51,6 +52,7 @@ public function __construct( * * @param int $customerId * @return array|null + * @throws NoSuchEntityException|LocalizedException */ public function getCustomerById(int $customerId) { diff --git a/app/code/Magento/EavGraphQl/Model/Resolver/CustomAttributeMetadata.php b/app/code/Magento/EavGraphQl/Model/Resolver/CustomAttributeMetadata.php index be2af5d5b0a54..47b20e35a3788 100644 --- a/app/code/Magento/EavGraphQl/Model/Resolver/CustomAttributeMetadata.php +++ b/app/code/Magento/EavGraphQl/Model/Resolver/CustomAttributeMetadata.php @@ -6,9 +6,12 @@ namespace Magento\EavGraphQl\Model\Resolver; +use Magento\Framework\Exception\InputException; +use Magento\Framework\GraphQl\Argument\ArgumentValueInterface; use Magento\Framework\GraphQl\ArgumentInterface; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\GraphQl\Model\ResolverInterface; -use Magento\Framework\Exception\InputException; use \Magento\GraphQl\Model\ResolverContextInterface; use Magento\EavGraphQl\Model\Resolver\Query\Type; @@ -35,25 +38,64 @@ public function __construct(Type $type) */ public function resolve(array $args, ResolverContextInterface $context) { - if (!isset($args['attributes']) || empty($args['attributes'])) { - throw new InputException(__('Missing arguments for correct type resolution.')); - } - $attributes['items'] = null; /** @var ArgumentInterface $attributeInputs */ $attributeInputs = $args['attributes']; foreach ($attributeInputs->getValue() as $attribute) { - $type = $this->type->getType($attribute['attribute_code'], $attribute['entity_type']); - - if (!empty($type)) { - $attributes['items'][] = [ - 'attribute_code' => $attribute['attribute_code'], - 'entity_type' => $attribute['entity_type'], - 'attribute_type' => ucfirst($type) - ]; + if (!isset($attribute['attribute_code']) || !isset($attribute['entity_type'])) { + $attributes['items'][] = $this->createInputException($attribute); + continue; } + try { + $type = $this->type->getType($attribute['attribute_code'], $attribute['entity_type']); + } catch (InputException $exception) { + $attributes['items'][] = new GraphQlNoSuchEntityException( + __( + 'Attribute code %1 of entity type %2 not configured to have a type.', + [$attribute['attribute_code'], $attribute['entity_type']] + ) + ); + continue; + } + + if (empty($type)) { + continue; + } + + $attributes['items'][] = [ + 'attribute_code' => $attribute['attribute_code'], + 'entity_type' => $attribute['entity_type'], + 'attribute_type' => ucfirst($type) + ]; } return $attributes; } + + /** + * Create GraphQL input exception for an invalid AttributeInput ArgumentValueInterface + * + * @param array $attribute + * @return GraphQlInputException + */ + private function createInputException(array $attribute) + { + $isCodeSet = isset($attribute['attribute_code']); + $isEntitySet = isset($attribute['entity_type']); + $messagePart = !$isCodeSet ? 'attribute_code' : 'entity_type'; + $messagePart .= !$isCodeSet && !$isEntitySet ? '/entity_type' : ''; + $identifier = "Empty AttributeInput"; + if ($isCodeSet) { + $identifier = 'attribute_code: ' . $attribute['attribute_code']; + } elseif ($isEntitySet) { + $identifier = 'entity_type: ' . $attribute['entity_type']; + } + + return new GraphQlInputException( + __( + 'Attribute input does not contain %1 for the input %2.', + [$messagePart, $identifier] + ) + ); + } } diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 5b9419cdf6e63..b8bdeabf39fc7 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -93,6 +93,7 @@ public function __construct( */ public function dispatch(RequestInterface $request) { + $statusCode = 200; try { /** @var Http $request */ $this->requestProcessor->processHeaders($request); @@ -106,12 +107,14 @@ public function dispatch(RequestInterface $request) isset($data['variables']) ? $data['variables'] : [] ); } catch (\Exception $error) { - $result['extensions']['exception'] = $this->graphQlError->create($error); + $result['errors'] = isset($result) && isset($result['errors']) ? $result['errors'] : []; + $result['errors'][] = $this->graphQlError->create($error); + $statusCode = ExceptionFormatter::HTTP_GRAPH_QL_SCHEMA_ERROR_STATUS; } $this->response->setBody($this->jsonSerializer->serialize($result))->setHeader( 'Content-Type', 'application/json' - ); + )->setHttpResponseCode($statusCode); return $this->response; } } diff --git a/app/code/Magento/GraphQl/etc/graphql.xml b/app/code/Magento/GraphQl/etc/graphql.xml index fe75c702748f6..99c33f6adfda8 100644 --- a/app/code/Magento/GraphQl/etc/graphql.xml +++ b/app/code/Magento/GraphQl/etc/graphql.xml @@ -7,7 +7,7 @@ <type xsi:type="OutputType" name="Query" /> <type xsi:type="InputType" name="FilterTypeInput"> <field xsi:type="ScalarInputField" name="eq" type="String"/> - <field xsi:type="ObjectArrayInputField" name="finset" itemType="AttributeInput"/> + <field xsi:type="ScalarArrayInputField" name="finset" itemType="String"/> <field xsi:type="ScalarInputField" name="from" type="String"/> <field xsi:type="ScalarInputField" name="gt" type="String"/> <field xsi:type="ScalarInputField" name="gteq" type="String"/> @@ -30,4 +30,4 @@ <item name="asc">ASC</item> <item name="desc">DESC</item> </type> -</config> \ No newline at end of file +</config> diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php index 7cea3c2f6ee30..a7ed424323c24 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php @@ -9,6 +9,7 @@ use Magento\TestFramework\TestCase\HttpClient\CurlClient; use Magento\TestFramework\Helper\JsonSerializer; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; /** * Curl client for GraphQL @@ -27,6 +28,9 @@ class Client /** @var JsonSerializer */ private $json; + /** @var TestCase */ + private $testCase; + /** * CurlClient constructor. * @@ -73,7 +77,12 @@ public function postQuery(string $query, array $variables = [], string $operatio if (isset($error['message'])) { $errorMessage .= $error['message'] . PHP_EOL; } + if (isset($error['trace'])) { + $traceString = $error['trace']; + TestCase::assertNotEmpty($traceString, "trace is empty"); + } } + throw new \Exception('GraphQL response contains errors: ' . $errorMessage); } throw new \Exception('GraphQL responded with an unknown error: ' . $responseBody); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ExceptionFormatterDefaultModeTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ExceptionFormatterDefaultModeTest.php new file mode 100644 index 0000000000000..135131c88f4a8 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ExceptionFormatterDefaultModeTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\GraphQl\Catalog; + +use Magento\TestFramework\TestCase\GraphQlAbstract; + +class ExceptionFormatterDefaultModeTest extends GraphQlAbstract +{ + public function testInvalidEntityTypeExceptionInDefaultMode() + { + if (!$this->cleanCache()) { + $this->fail('Cache could not be cleaned properly.'); + } + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + attribute_code:"sku" + entity_type:"invalid" + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + + $this->expectExceptionMessage('GraphQL response contains errors: Attribute code' . ' ' . + 'sku of entity type invalid not configured to have a type.'); + + $this->graphQlQuery($query); + } + + public function testDuplicateEntityTypeException() + { + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + entity_type:"catalog_category" + entity_type:"catalog_product" + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: There' . ' ' . + 'can be only one input field named "entity_type"'); + $this->graphQlQuery($query); + } + + public function testEmptyAttributeInputException() + { + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: Attribute' . ' ' . + 'input does not contain attribute_code/entity_type for the input Empty AttributeInput.'); + + $this->graphQlQuery($query); + } + public function testAttributeWithNoEntityTypeInputException() + { + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + attribute_code:"sku" + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: Attribute input' . ' ' . + 'does not contain entity_type for the input attribute_code: sku.'); + + $this->graphQlQuery($query); + } + + public function testAttributeWithNoAttributeCodeInputException() + { + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + entity_type:"catalog_category" + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: Attribute input' . ' ' . + 'does not contain attribute_code for the input entity_type: catalog_category.'); + + $this->graphQlQuery($query); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php index 5413e9ec91a1d..43d3e71935405 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php @@ -624,6 +624,39 @@ public function testQueryPageOutOfBoundException() $this->graphQlQuery($query); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testQueryWithNoSearchOrFilterArgumentException() + { + $query + = <<<QUERY +{ + products(pageSize:1) + { + items{ + id + attribute_set_id + created_at + name + sku + type_id + updated_at + weight + category_ids + + } + } + +} +QUERY; + + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors: One' .' ' . + 'of \'search\' or \'filter\' input arguments needs to be specified in products request.'); + $this->graphQlQuery($query); + } + /** * Asserts the different fields of items returned after search query is executed * diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Eav/ExceptionFormatterTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Eav/ExceptionFormatterTest.php new file mode 100644 index 0000000000000..821ce909afcad --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Eav/ExceptionFormatterTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\GraphQl\Eav; + +use Magento\Framework\App\State; +use Magento\TestFramework\ObjectManager; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +class ExceptionFormatterTest extends GraphQlAbstract +{ + /** @var string */ + private $mageMode; + + /** + * @var \Magento\TestFramework\ObjectManager + */ + private $objectManager; + + protected function setUp() + { + parent::setUp(); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $this->mageMode = $this->objectManager->get(State::class)->getMode(); + } + + protected function tearDown() + { + $this->objectManager->get(State::class)->setMode($this->mageMode); + } + + /** + * @param string $mageMode + */ + private function setDeveloperMode($mageMode = State::MODE_DEVELOPER) + { + $this->objectManager->get(State::class)->setMode($mageMode); + echo 'mageMode:'. $mageMode; + } + + public function testInvalidEntityTypeExceptionInDeveloperMode($mageMode = State::MODE_DEVELOPER) + { + $this->setDeveloperMode(); + $this->objectManager->get(State::class)->setMode($mageMode); + + if (!$this->cleanCache()) { + $this->fail('Cache could not be cleaned properly.'); + } + $query + = <<<QUERY + { + customAttributeMetadata(attributes:[ + { + attribute_code:"sku" + entity_type:"invalid" + } + ]) + { + items{ + attribute_code + attribute_type + entity_type + } + } + } +QUERY; + $this->expectException(\Exception::class); + + $this->expectExceptionMessage('GraphQL response contains errors: Attribute' . ' ' . + 'code sku of entity type invalid not configured to have a type.'); + + $this->graphQlQuery($query); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/UrlRewrite/UrlResolverTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/UrlRewrite/UrlResolverTest.php index dfd235320fe9d..4c0825e7e3243 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/UrlRewrite/UrlResolverTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/UrlRewrite/UrlResolverTest.php @@ -8,6 +8,8 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator; +use Magento\CmsUrlRewrite\Model\CmsPageUrlRewriteGenerator; use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -160,6 +162,42 @@ public function testCategoryUrlResolver() $this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']); } + /** + * @magentoApiDataFixture Magento/Cms/_files/pages.php + */ + public function testCMSPageUrlResolver() + { + /** @var \Magento\Cms\Model\Page $page */ + $page = $this->objectManager->get(\Magento\Cms\Model\Page::class); + $page->load('page100'); + $cmsPageId = $page->getId(); + $requestPath = $page->getIdentifier(); + + /** @var \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator $urlPathGenerator */ + $urlPathGenerator = $this->objectManager->get(\Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator::class); + + /** @param \Magento\Cms\Api\Data\PageInterface $page */ + $targetPath = $urlPathGenerator->getCanonicalUrlPath($page); + $expectedEntityType = CmsPageUrlRewriteGenerator::ENTITY_TYPE; + + $query + = <<<QUERY +{ + urlResolver(url:"{$requestPath}") + { + id + canonical_url + type + } + +} +QUERY; + $response = $this->graphQlQuery($query); + $this->assertEquals($cmsPageId, $response['urlResolver']['id']); + $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']); + $this->assertEquals(strtoupper(str_replace('-', '_', $expectedEntityType)), $response['urlResolver']['type']); + } + /** * Tests the use case where the url_key of the existing product is changed * diff --git a/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlAuthorizationException.php b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlAuthorizationException.php new file mode 100644 index 0000000000000..1cc47bb0db12e --- /dev/null +++ b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlAuthorizationException.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\GraphQl\Exception; + +use Magento\Framework\Phrase; +use Magento\Framework\Exception\AuthorizationException; + +/** + * Class GraphQlAuthorizationException + */ +class GraphQlAuthorizationException extends AuthorizationException implements \GraphQL\Error\ClientAware +{ + const EXCEPTION_CATEGORY = 'graphql-authorization'; + + /** + * @var boolean + */ + private $isSafe; + + /** + * Initialize object + * + * @param Phrase $phrase + * @param \Exception $cause + * @param int $code + * @param boolean $isSafe + */ + public function __construct(Phrase $phrase, \Exception $cause = null, $code = 0, $isSafe = true) + { + $this->isSafe = $isSafe; + parent::__construct($phrase, $cause, $code); + } + + /** + * {@inheritDoc} + */ + public function isClientSafe() + { + return $this->isSafe; + } + + /** + * {@inheritDoc} + */ + public function getCategory() + { + return self::EXCEPTION_CATEGORY; + } +} diff --git a/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlInputException.php b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlInputException.php index a72a70bb5035b..b05120f47938a 100644 --- a/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlInputException.php +++ b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlInputException.php @@ -14,6 +14,8 @@ */ class GraphQlInputException extends InputException implements \GraphQL\Error\ClientAware { + const EXCEPTION_CATEGORY = 'graphql-input'; + /** * @var boolean */ @@ -46,6 +48,6 @@ public function isClientSafe() */ public function getCategory() { - return 'graphql-input'; + return self::EXCEPTION_CATEGORY; } } diff --git a/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlNoSuchEntityException.php b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlNoSuchEntityException.php new file mode 100644 index 0000000000000..26bfddecc3376 --- /dev/null +++ b/lib/internal/Magento/Framework/GraphQl/Exception/GraphQlNoSuchEntityException.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\GraphQl\Exception; + +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Phrase; + +/** + * Class GraphQlNoSuchEntityException + */ +class GraphQlNoSuchEntityException extends NoSuchEntityException implements \GraphQL\Error\ClientAware +{ + const EXCEPTION_CATEGORY = 'graphql-no-such-entity'; + + /** + * @var boolean + */ + private $isSafe; + + /** + * Initialize object + * + * @param Phrase $phrase + * @param \Exception $cause + * @param int $code + * @param boolean $isSafe + */ + public function __construct(Phrase $phrase, \Exception $cause = null, $code = 0, $isSafe = true) + { + $this->isSafe = $isSafe; + parent::__construct($phrase, $cause, $code); + } + + /** + * {@inheritDoc} + */ + public function isClientSafe() + { + return $this->isSafe; + } + + /** + * {@inheritDoc} + */ + public function getCategory() + { + return self::EXCEPTION_CATEGORY; + } +} diff --git a/lib/internal/Magento/Framework/GraphQl/ExceptionFormatter.php b/lib/internal/Magento/Framework/GraphQl/ExceptionFormatter.php index ac7f62f70cf03..02e636e82061b 100644 --- a/lib/internal/Magento/Framework/GraphQl/ExceptionFormatter.php +++ b/lib/internal/Magento/Framework/GraphQl/ExceptionFormatter.php @@ -6,11 +6,38 @@ namespace Magento\Framework\GraphQl; +use Magento\Framework\App\State; +use Magento\Framework\Webapi\ErrorProcessor; +use Psr\Log\LoggerInterface; + /** * Wrapper for GraphQl Exception Formatter */ class ExceptionFormatter { + const HTTP_GRAPH_QL_SCHEMA_ERROR_STATUS = 500; + + /** + * @var State + */ + private $appState; + + /** + * @var LoggerInterface + */ + private $logger; + + /** + * @param State $appState + * @param ErrorProcessor $errorProcessor + */ + public function __construct(State $appState, ErrorProcessor $errorProcessor, LoggerInterface $logger) + { + $this->appState = $appState; + $errorProcessor->registerShutdownFunction(); + $this->logger = $logger; + } + /** * Format a GraphQL error from an exception by converting it to array to conform to GraphQL spec. * @@ -18,13 +45,35 @@ class ExceptionFormatter * (or when debug flags are passed). * * @param \Throwable $exception - * @param bool|int $debug * @param string $internalErrorMessage * @return array * @throws \Throwable */ - public function create(\Throwable $exception, $debug = false, $internalErrorMessage = null) + public function create(\Throwable $exception, $internalErrorMessage = null) + { + if (!$this->shouldShowDetail()) { + $reportId = uniqid("graph-ql-"); + $message = "Report ID: {$reportId}; Message: {$exception->getMessage()}"; + $code = $exception->getCode(); + $loggedException = new \Exception($message, $code, $exception); + $this->logger->critical($loggedException); + } + + return \GraphQL\Error\FormattedError::createFromException( + $exception, + $this->shouldShowDetail() + ? \GraphQL\Error\Debug::INCLUDE_DEBUG_MESSAGE | \GraphQL\Error\Debug::INCLUDE_TRACE : false, + $internalErrorMessage + ); + } + + /** + * Return true if detailed error message should be displayed to client, false otherwise. + * + * @return bool + */ + public function shouldShowDetail() { - return \GraphQL\Error\FormattedError::createFromException($exception, $debug, $internalErrorMessage); + return $this->appState->getMode() === State::MODE_DEVELOPER; } } diff --git a/lib/internal/Magento/Framework/GraphQl/QueryProcessor.php b/lib/internal/Magento/Framework/GraphQl/QueryProcessor.php index 1b55208ba4533..33578c25455c7 100644 --- a/lib/internal/Magento/Framework/GraphQl/QueryProcessor.php +++ b/lib/internal/Magento/Framework/GraphQl/QueryProcessor.php @@ -13,6 +13,19 @@ */ class QueryProcessor { + /** + * @var ExceptionFormatter + */ + private $exceptionFormatter; + + /** + * @param ExceptionFormatter $exceptionFormatter + */ + public function __construct(ExceptionFormatter $exceptionFormatter) + { + $this->exceptionFormatter = $exceptionFormatter; + } + /** * Process a GraphQl query according to defined schema * @@ -32,13 +45,16 @@ public function process( $variableValues = null, $operationName = null ) { - return \GraphQL\GraphQL::execute( + return \GraphQL\GraphQL::executeQuery( $schema, $source, $rootValue, $contextValue, $variableValues, $operationName + )->toArray( + $this->exceptionFormatter->shouldShowDetail() ? + \GraphQL\Error\Debug::INCLUDE_DEBUG_MESSAGE | \GraphQL\Error\Debug::INCLUDE_TRACE : false ); } } diff --git a/lib/internal/Magento/Framework/GraphQl/Type/Input/InputObjectType.php b/lib/internal/Magento/Framework/GraphQl/Type/Input/InputObjectType.php index ff0bf69d5ebfb..cc85a9e9fb752 100644 --- a/lib/internal/Magento/Framework/GraphQl/Type/Input/InputObjectType.php +++ b/lib/internal/Magento/Framework/GraphQl/Type/Input/InputObjectType.php @@ -6,17 +6,28 @@ namespace Magento\Framework\GraphQl\Type\Input; +use GraphQL\Type\Definition\InputType; +use Magento\Framework\GraphQl\Config\Data\Field; use Magento\Framework\GraphQl\Config\Data\Type as TypeStructure; +use Magento\Framework\GraphQl\Type\Definition\TypeInterface; +use Magento\Framework\GraphQl\TypeFactory; /** * Class InputObjectType */ class InputObjectType extends \GraphQL\Type\Definition\InputObjectType { + /** + * @var TypeFactory + */ + private $typeFactory; + public function __construct( InputMapper $inputMapper, - TypeStructure $structure + TypeStructure $structure, + TypeFactory $typeFactory ) { + $this->typeFactory = $typeFactory; $config = [ 'name' => $structure->getName(), 'description' => $structure->getDescription() @@ -29,6 +40,9 @@ public function __construct( } else { $type = $inputMapper->getFieldRepresentation($field->getType()); } + + $type = $this->processIsNullable($field, $this->processIsList($field, $type)); + $config['fields'][$field->getName()] = [ 'name' => $field->getName(), 'type' => $type @@ -36,4 +50,34 @@ public function __construct( } parent::__construct($config); } + + /** + * Return passed in type wrapped as a non null type if definition determines necessary. + * + * @param Field $field + * @param InputType $object + * @return TypeInterface|\GraphQL\Type\Definition\Type + */ + private function processIsNullable(Field $field, InputType $object) + { + if ($field->isRequired()) { + return $this->typeFactory->createNonNull($object); + } + return $object; + } + + /** + * Return passed in type wrapped as a list if definition determines necessary. + * + * @param Field $field + * @param InputType $object + * @return TypeInterface|\GraphQL\Type\Definition\Type + */ + private function processIsList(Field $field, InputType $object) + { + if ($field->isList()) { + return $this->typeFactory->createList($object); + } + return $object; + } } From 14841302191670d99c160a5ba40ddc9ce4e0e6e3 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 16:05:38 -0600 Subject: [PATCH 264/277] MAGETWO-85421: Build Stabilization --- .../Analytics/Test/AdminConfigurationTimeToSendDataCest.xml | 2 ++ .../Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml index 30fb9d3ce1db8..bde91098fcf1a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml @@ -17,6 +17,8 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-66464"/> <group value="analytics"/> + <group value="skip"/> + <!--random failure on Jenkins MAGETWO-87216--> </annotations> <after> <amOnPage stepKey="amOnLogoutPage" url="admin/admin/auth/logout/"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml index 234cfb200b6c3..bbbb282c17678 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml @@ -33,6 +33,7 @@ <fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{_defaultCmsPage.content}}" stepKey="fillFieldContent"/> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_defaultCmsPage.identifier}}" stepKey="fillFieldUrlKey"/> + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="waitForSaveButtonVisible"/> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> <amOnPage url="{{_defaultCmsPage.identifier}}" stepKey="amOnPageTestPage"/> From 3d9f45a10889f561aaa4ded7a99f9b4565e36eec Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Fri, 26 Jan 2018 17:37:40 -0600 Subject: [PATCH 265/277] MAGETWO-85423: Create or update functional tests --- .../ConfigAminAccountSharingActionGroup.xml | 21 +++++++++++++++++++ .../Config/Section/AdminSection.xml | 16 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml new file mode 100644 index 0000000000000..b3a38129ca887 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> +<actionGroup name="ConfigAminAccountSharingActionGroup"> + <amOnPage url="admin/admin/system_config/edit/section/admin/" stepKey="navigateToConfigurationPage" /> + <waitForPageLoad stepKey="wait1"/> + <conditionalClick stepKey="expandSecurityTab" selector="{{AdminSection.SecurityTab}}" dependentSelector="{{AdminSection.CheckIfTabExpand}}" visible="true" /> + <waitForElementVisible selector="{{AdminSection.AdminAccountSharing}}" stepKey="waitForAdminAccountSharingDrpDown" /> + <selectOption selector="{{AdminSection.AdminAccountSharing}}" userInput="Yes" stepKey="selectYes"/> + <click selector="{{AdminSection.SecurityTab}}" stepKey="clollapseSecurityTab" /> + <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" /> +</actionGroup> +</actionGroups> + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml new file mode 100644 index 0000000000000..c1aaaa144c19c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="AdminSection"> + <element name="CheckIfTabExpand" type="button" selector="#admin_security-head:not(.open)"/> + <element name="SecurityTab" type="button" selector="#admin_security-head"/> + <element name="AdminAccountSharing" type="button" selector="#admin_security_admin_account_sharing"/> + </section> +</sections> From 47549fef02a9a408bc45a0484d7ddf80e23a6e61 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 17:45:38 -0600 Subject: [PATCH 266/277] MAGETWO-85421: Build Stabilization --- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index ce7059ad54135..e6f12a2e51acf 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -55,7 +55,7 @@ define([ * Highlight or dismiss Insert Variable button when variable is selected or deselected. */ onPostRender: function () { - var _this = this; + var _this = this, /** * Toggle active state of Insert Variable button. From 92d2c4a2a810dd192be899246a954156d1d9c0b7 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Fri, 26 Jan 2018 17:52:07 -0600 Subject: [PATCH 267/277] MAGETWO-85423: Create or update functional tests --- .../AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml | 1 + .../Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 69b1eff280506..268e2005bb9c8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -22,6 +22,7 @@ <actionGroup ref="LoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> + <actionGroup ref="ConfigAminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> </before> <!--Main test--> <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml index b3a38129ca887..b6abafe790e24 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <actionGroup name="ConfigAminAccountSharingActionGroup"> - <amOnPage url="admin/admin/system_config/edit/section/admin/" stepKey="navigateToConfigurationPage" /> + <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_config/edit/section/admin/" stepKey="navigateToConfigurationPage" /> <waitForPageLoad stepKey="wait1"/> <conditionalClick stepKey="expandSecurityTab" selector="{{AdminSection.SecurityTab}}" dependentSelector="{{AdminSection.CheckIfTabExpand}}" visible="true" /> <waitForElementVisible selector="{{AdminSection.AdminAccountSharing}}" stepKey="waitForAdminAccountSharingDrpDown" /> From e6c33f0b49fb76f33f35ba56cba606e770f7a817 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Fri, 26 Jan 2018 17:56:17 -0600 Subject: [PATCH 268/277] MAGETWO-85423: Create or update functional tests --- .../AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml | 2 +- ...ActionGroup.xml => ConfigAdminAccountSharingActionGroup.xml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/{ConfigAminAccountSharingActionGroup.xml => ConfigAdminAccountSharingActionGroup.xml} (95%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml index 268e2005bb9c8..03b9499a2a962 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> - <actionGroup ref="ConfigAminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> + <actionGroup ref="ConfigAdminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> </before> <!--Main test--> <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml similarity index 95% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml index b6abafe790e24..d71656bd6f243 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAminAccountSharingActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> -<actionGroup name="ConfigAminAccountSharingActionGroup"> +<actionGroup name="ConfigAdminAccountSharingActionGroup"> <amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/system_config/edit/section/admin/" stepKey="navigateToConfigurationPage" /> <waitForPageLoad stepKey="wait1"/> <conditionalClick stepKey="expandSecurityTab" selector="{{AdminSection.SecurityTab}}" dependentSelector="{{AdminSection.CheckIfTabExpand}}" visible="true" /> From 1327cf65f56f34e08db26e8499c1b8175ccb4088 Mon Sep 17 00:00:00 2001 From: Kieu Phan <kphan@magento.com> Date: Fri, 26 Jan 2018 19:02:39 -0600 Subject: [PATCH 269/277] MAGETWO-85423: Create or update functional tests --- .../Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml | 1 + .../Magento/FunctionalTest/Config/Section/AdminSection.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml index d71656bd6f243..efd6574e7f4af 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/ActionGroup/ConfigAdminAccountSharingActionGroup.xml @@ -13,6 +13,7 @@ <waitForPageLoad stepKey="wait1"/> <conditionalClick stepKey="expandSecurityTab" selector="{{AdminSection.SecurityTab}}" dependentSelector="{{AdminSection.CheckIfTabExpand}}" visible="true" /> <waitForElementVisible selector="{{AdminSection.AdminAccountSharing}}" stepKey="waitForAdminAccountSharingDrpDown" /> + <uncheckOption selector="{{AdminSection.EnableSystemValue}}" stepKey="uncheckUseSystemValue"/> <selectOption selector="{{AdminSection.AdminAccountSharing}}" userInput="Yes" stepKey="selectYes"/> <click selector="{{AdminSection.SecurityTab}}" stepKey="clollapseSecurityTab" /> <click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml index c1aaaa144c19c..294f08326f63b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Section/AdminSection.xml @@ -12,5 +12,6 @@ <element name="CheckIfTabExpand" type="button" selector="#admin_security-head:not(.open)"/> <element name="SecurityTab" type="button" selector="#admin_security-head"/> <element name="AdminAccountSharing" type="button" selector="#admin_security_admin_account_sharing"/> + <element name="EnableSystemValue" type="button" selector="#admin_security_admin_account_sharing_inherit"/> </section> </sections> From 53e4b4c71368500bcacddbd5d3adbc455b80db6c Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@magento.com> Date: Fri, 26 Jan 2018 21:14:23 -0600 Subject: [PATCH 270/277] MAGETWO-85421: Build Stabilization --- .../Ui/view/base/web/js/form/element/wysiwyg.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 4dba6dfe6e6e1..ad82879bcd115 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -106,12 +106,16 @@ define([ this.$wysiwygEditorButton.removeProp('disabled'); } - if (wysiwyg && disabled) { - wysiwyg.setEnabledStatus(false); - wysiwyg.getPluginButtons().prop('disabled', 'disabled'); - } else if (wysiwyg) { - wysiwyg.setEnabledStatus(true); - wysiwyg.getPluginButtons().removeProp('disabled'); + /* eslint-disable no-undef */ + if (typeof wysiwyg !== 'undefined' && wysiwyg.activeEditor()) { + + if (wysiwyg && disabled) { + wysiwyg.setEnabledStatus(false); + wysiwyg.getPluginButtons().prop('disabled', 'disabled'); + } else if (wysiwyg) { + wysiwyg.setEnabledStatus(true); + wysiwyg.getPluginButtons().removeProp('disabled'); + } } } }); From b4333c10fa0ac49e826b438913bb26571378b904 Mon Sep 17 00:00:00 2001 From: Eric Bohanon <ebohanon@magento.com> Date: Sat, 27 Jan 2018 13:12:21 -0600 Subject: [PATCH 271/277] MAGETWO-87010: Create GraphQL Error Handling Framework - Fix static failure --- .../Magento/TestFramework/TestCase/GraphQl/Client.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php index a7ed424323c24..6f43cfa5fff1e 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQl/Client.php @@ -28,9 +28,6 @@ class Client /** @var JsonSerializer */ private $json; - /** @var TestCase */ - private $testCase; - /** * CurlClient constructor. * From 6e50ae79667dfec327b9857586376dae1995dc80 Mon Sep 17 00:00:00 2001 From: ByteCreation <wabbit42@gmail.com> Date: Thu, 25 Jan 2018 23:36:36 +0000 Subject: [PATCH 272/277] Doc block edit - Edited doc block of the walk method in a Collection to reflect that this method will accept a callback --- lib/internal/Magento/Framework/Data/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php index b0b31fa3751a8..f8b82d3122234 100644 --- a/lib/internal/Magento/Framework/Data/Collection.php +++ b/lib/internal/Magento/Framework/Data/Collection.php @@ -492,7 +492,7 @@ public function clear() * * Returns array with results of callback for each item * - * @param string $callback + * @param callable $callback * @param array $args * @return array */ From e62a7a2cf265aecc138e1da381d45bd4ff5bc1dc Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov <isentiabov@magento.com> Date: Tue, 16 Jan 2018 16:50:36 +0200 Subject: [PATCH 273/277] - Removed `each()` function usage - Updated static test to check `each()` usage --- .../Model/ResourceModel/AbstractResource.php | 3 +- .../Entity/Collection/AbstractCollection.php | 2 +- .../ResourceModel/Product/CollectionTest.php | 25 +++++++++ .../Model/ResourceModel/ProductTest.php | 52 +++++++++++++++++++ .../Test/Integrity/CircularDependencyTest.php | 4 +- .../Magento/Test/Integrity/ComposerTest.php | 3 +- .../Test/Legacy/_files/obsolete_methods.php | 3 +- setup/src/Magento/Setup/Model/Installer.php | 3 +- 8 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/ProductTest.php diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index a97a3dcdd2164..3cf342cbbd990 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -571,8 +571,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) } if (is_array($attributesData) && sizeof($attributesData) == 1) { - $_data = each($attributesData); - $attributesData = $_data[1]; + $attributesData = array_shift($attributesData); } return $attributesData === false ? false : $attributesData; diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 312b40239d61e..904f35c56fc3d 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -803,7 +803,7 @@ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType { $tableAlias = null; if (is_array($table)) { - list($tableAlias, $tableName) = each($table); + list($tableAlias, $tableName) = [key($table), current($table)]; } else { $tableName = $table; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php index da47201fe6e38..d6786b6869db2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php @@ -124,4 +124,29 @@ public function testGetProductsWithTierPrice() $this->assertEquals(50, $tierPrices[2]->getExtensionAttributes()->getPercentageValue()); $this->assertEquals(5, $tierPrices[2]->getValue()); } + + /** + * Checks a case if table for join specified as an array. + * + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function testJoinTable() + { + $this->collection->joinTable( + ['alias' => 'url_rewrite'], + 'entity_id = entity_id', + ['request_path'], + '{{table}}.entity_type = \'product\'', + 'left' + ); + $sql = (string) $this->collection->getSelect(); + $productTable = $this->collection->getTable('catalog_product_entity'); + $urlRewriteTable = $this->collection->getTable('url_rewrite'); + + $expected = 'SELECT `e`.*, `alias`.`request_path` FROM `' . $productTable . '` AS `e`' + . ' LEFT JOIN `' . $urlRewriteTable . '` AS `alias` ON (alias.entity_id =e.entity_id)' + . ' AND (alias.entity_type = \'product\')'; + + self::assertContains($expected, str_replace(PHP_EOL, '', $sql)); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/ProductTest.php new file mode 100644 index 0000000000000..7954e2c36227f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/ProductTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\ResourceModel; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +class ProductTest extends TestCase +{ + /** + * @var Product + */ + private $model; + + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + + $this->model = $this->objectManager->get(Product::class); + } + + /** + * Checks a possibility to retrieve product raw attribute value. + * + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testGetAttributeRawValue() + { + $sku = 'simple'; + $attribute = 'name'; + + /** @var ProductRepositoryInterface $productRepository */ + $productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $product = $productRepository->get($sku); + + $actual = $this->model->getAttributeRawValue($product->getId(), $attribute, null); + self::assertEquals($product->getName(), $actual); + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php index deed829838936..e62c4112553b6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php @@ -44,9 +44,9 @@ protected function buildModulesDependencies() $moduleName = str_replace('/', '_', $moduleName[1]); $config = simplexml_load_file($configFile); $result = $config->xpath("/config/module/depends/module") ?: []; - while (list(, $node) = each($result)) { + foreach ($result as $node) { /** @var \SimpleXMLElement $node */ - $this->moduleDependencies[$moduleName][] = (string)$node['name']; + $this->moduleDependencies[$moduleName][] = (string) $node['name']; } } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index 6752a98e38080..add61e6722227 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -336,7 +336,8 @@ public function testComponentPathsInRoot() "If there are any component paths specified, then they must be reflected in 'replace' section" ); $flat = $this->getFlatPathsInfo(self::$rootJson['extra']['component_paths']); - while (list(, list($component, $path)) = each($flat)) { + foreach ($flat as $item) { + list($component, $path) = $item; $this->assertFileExists( self::$root . '/' . $path, "Missing or invalid component path: {$component} -> {$path}" diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 2d115b29a42f0..7c0329153d6e0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -2526,5 +2526,6 @@ ['getDataFormTab', 'Magento\Backend\Test\Block\Widget\Tab', 'Magento\Ui\Test\Block\Adminhtml\AbstractContainer::getFieldsData'], ['getBunchImages', 'Magento\CatalogImportExport\Model\Import\Product'], ['_isAttributeValueEmpty', 'Magento\Catalog\Model\ResourceModel\AbstractResource'], - ['var_dump', ''] + ['var_dump', ''], + ['each', ''], ]; diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 60cf85efc40ca..63584151fd7ba 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -337,7 +337,8 @@ public function install($request) $this->log->log('Starting Magento installation:'); - while (list(, list($message, $method, $params)) = each($script)) { + foreach ($script as $item) { + list($message, $method, $params) = $item; $this->log->log($message); call_user_func_array([$this, $method], $params); $this->logProgress(); From daac09dfb1cc8a8ea952d6ec690df9490516bc24 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Wed, 31 Jan 2018 14:31:01 -0600 Subject: [PATCH 274/277] MAGETWO-87333: Broken Mainline Test Magento\Paypal\Controller\ExpressTest::testReturnAction - isolated the test --- .../testsuite/Magento/Paypal/Controller/ExpressTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index 157999224d7b8..94ba4a7d1476c 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -145,6 +145,7 @@ public function testStartActionCustomerToQuote() */ public function testReturnAction() { + $this->markTestSkipped('MAGETWO-87333'); $quote = $this->_objectManager->create(Quote::class); $quote->load('test_cart_with_configurable', 'reserved_order_id'); From 835156f307ab750be4717a8b949faf86c5810cf4 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Wed, 31 Jan 2018 15:22:55 -0600 Subject: [PATCH 275/277] MAGETWO-87333: Broken Mainline Test Magento\Paypal\Controller\ExpressTest::testReturnAction - isolated the test --- .../testsuite/Magento/Paypal/Controller/ExpressTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index 94ba4a7d1476c..9f7d29e18cd43 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -141,7 +141,8 @@ public function testStartActionCustomerToQuote() /** * Test return action with configurable product. * - * @magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php + * Skipped due to MAGETWO-87333 + * #@magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php */ public function testReturnAction() { From fce58fc03b65518c7d7f6b306fd5d835c2f3a6c7 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Wed, 31 Jan 2018 16:01:13 -0600 Subject: [PATCH 276/277] MAGETWO-87333: Broken Mainline Test Magento\Paypal\Controller\ExpressTest::testReturnAction - isolated the test --- .../Magento/Paypal/Controller/ExpressTest.php | 176 +++++++++--------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index 9f7d29e18cd43..d3c3e6bc9b81e 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -138,92 +138,92 @@ public function testStartActionCustomerToQuote() ); } - /** - * Test return action with configurable product. - * - * Skipped due to MAGETWO-87333 - * #@magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php - */ - public function testReturnAction() - { - $this->markTestSkipped('MAGETWO-87333'); - $quote = $this->_objectManager->create(Quote::class); - $quote->load('test_cart_with_configurable', 'reserved_order_id'); - - $payment = $quote->getPayment(); - $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS) - ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123); - - $quote->save(); - - $this->_objectManager->removeSharedInstance(Session::class); - $session = $this->_objectManager->get(Session::class); - $session->setQuoteId($quote->getId()); - - $nvpMethods = [ - 'setToken', - 'setPayerId', - 'setAmount', - 'setPaymentAction', - 'setNotifyUrl', - 'setInvNum', - 'setCurrencyCode', - 'setPaypalCart', - 'setIsLineItemsEnabled', - 'setAddress', - 'setBillingAddress', - 'callDoExpressCheckoutPayment', - 'callGetExpressCheckoutDetails', - 'getExportedBillingAddress' - ]; - - $nvpMock = $this->getMockBuilder(Nvp::class) - ->setMethods($nvpMethods) - ->disableOriginalConstructor() - ->getMock(); - - foreach ($nvpMethods as $method) { - $nvpMock->method($method) - ->willReturnSelf(); - } - - $apiFactoryMock = $this->getMockBuilder(ApiFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - - $apiFactoryMock->method('create') - ->with(Nvp::class) - ->willReturn($nvpMock); - - $this->_objectManager->addSharedInstance($apiFactoryMock, ApiFactory::class); - - $sessionMock = $this->getMockBuilder(GenericSession::class) - ->setMethods(['getExpressCheckoutToken']) - ->setConstructorArgs( - [ - $this->_objectManager->get(\Magento\Framework\App\Request\Http::class), - $this->_objectManager->get(\Magento\Framework\Session\SidResolverInterface::class), - $this->_objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class), - $this->_objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class), - $this->_objectManager->get(\Magento\Framework\Session\ValidatorInterface::class), - $this->_objectManager->get(\Magento\Framework\Session\StorageInterface::class), - $this->_objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class), - $this->_objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class), - $this->_objectManager->get(\Magento\Framework\App\State::class), - ] - ) - ->getMock(); - - $sessionMock->method('getExpressCheckoutToken') - ->willReturn(true); - - $this->_objectManager->addSharedInstance($sessionMock, PaypalSession::class); - - $this->dispatch('paypal/express/returnAction'); - $this->assertRedirect($this->stringContains('checkout/onepage/success')); - - $this->_objectManager->removeSharedInstance(ApiFactory::class); - $this->_objectManager->removeSharedInstance(PaypalSession::class); - } +// /** +// * Test return action with configurable product. +// * +// * Skipped due to MAGETWO-87333 +// * #@magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php +// */ +// public function testReturnAction() +// { +// $this->markTestSkipped('MAGETWO-87333'); +// $quote = $this->_objectManager->create(Quote::class); +// $quote->load('test_cart_with_configurable', 'reserved_order_id'); +// +// $payment = $quote->getPayment(); +// $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS) +// ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123); +// +// $quote->save(); +// +// $this->_objectManager->removeSharedInstance(Session::class); +// $session = $this->_objectManager->get(Session::class); +// $session->setQuoteId($quote->getId()); +// +// $nvpMethods = [ +// 'setToken', +// 'setPayerId', +// 'setAmount', +// 'setPaymentAction', +// 'setNotifyUrl', +// 'setInvNum', +// 'setCurrencyCode', +// 'setPaypalCart', +// 'setIsLineItemsEnabled', +// 'setAddress', +// 'setBillingAddress', +// 'callDoExpressCheckoutPayment', +// 'callGetExpressCheckoutDetails', +// 'getExportedBillingAddress' +// ]; +// +// $nvpMock = $this->getMockBuilder(Nvp::class) +// ->setMethods($nvpMethods) +// ->disableOriginalConstructor() +// ->getMock(); +// +// foreach ($nvpMethods as $method) { +// $nvpMock->method($method) +// ->willReturnSelf(); +// } +// +// $apiFactoryMock = $this->getMockBuilder(ApiFactory::class) +// ->disableOriginalConstructor() +// ->setMethods(['create']) +// ->getMock(); +// +// $apiFactoryMock->method('create') +// ->with(Nvp::class) +// ->willReturn($nvpMock); +// +// $this->_objectManager->addSharedInstance($apiFactoryMock, ApiFactory::class); +// +// $sessionMock = $this->getMockBuilder(GenericSession::class) +// ->setMethods(['getExpressCheckoutToken']) +// ->setConstructorArgs( +// [ +// $this->_objectManager->get(\Magento\Framework\App\Request\Http::class), +// $this->_objectManager->get(\Magento\Framework\Session\SidResolverInterface::class), +// $this->_objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class), +// $this->_objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class), +// $this->_objectManager->get(\Magento\Framework\Session\ValidatorInterface::class), +// $this->_objectManager->get(\Magento\Framework\Session\StorageInterface::class), +// $this->_objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class), +// $this->_objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class), +// $this->_objectManager->get(\Magento\Framework\App\State::class), +// ] +// ) +// ->getMock(); +// +// $sessionMock->method('getExpressCheckoutToken') +// ->willReturn(true); +// +// $this->_objectManager->addSharedInstance($sessionMock, PaypalSession::class); +// +// $this->dispatch('paypal/express/returnAction'); +// $this->assertRedirect($this->stringContains('checkout/onepage/success')); +// +// $this->_objectManager->removeSharedInstance(ApiFactory::class); +// $this->_objectManager->removeSharedInstance(PaypalSession::class); +// } } From 618ba2254262fad1b1dcb3c36451bca7a72cb80a Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <okorshenko@magento.com> Date: Wed, 31 Jan 2018 16:26:57 -0600 Subject: [PATCH 277/277] MAGETWO-87333: Broken Mainline Test Magento\Paypal\Controller\ExpressTest::testReturnAction - isolated the test --- .../Magento/Paypal/Controller/ExpressTest.php | 175 +++++++++--------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index d3c3e6bc9b81e..3d30f8366598a 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -138,92 +138,91 @@ public function testStartActionCustomerToQuote() ); } -// /** -// * Test return action with configurable product. -// * -// * Skipped due to MAGETWO-87333 -// * #@magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php -// */ -// public function testReturnAction() -// { -// $this->markTestSkipped('MAGETWO-87333'); -// $quote = $this->_objectManager->create(Quote::class); -// $quote->load('test_cart_with_configurable', 'reserved_order_id'); -// -// $payment = $quote->getPayment(); -// $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS) -// ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123); -// -// $quote->save(); -// -// $this->_objectManager->removeSharedInstance(Session::class); -// $session = $this->_objectManager->get(Session::class); -// $session->setQuoteId($quote->getId()); -// -// $nvpMethods = [ -// 'setToken', -// 'setPayerId', -// 'setAmount', -// 'setPaymentAction', -// 'setNotifyUrl', -// 'setInvNum', -// 'setCurrencyCode', -// 'setPaypalCart', -// 'setIsLineItemsEnabled', -// 'setAddress', -// 'setBillingAddress', -// 'callDoExpressCheckoutPayment', -// 'callGetExpressCheckoutDetails', -// 'getExportedBillingAddress' -// ]; -// -// $nvpMock = $this->getMockBuilder(Nvp::class) -// ->setMethods($nvpMethods) -// ->disableOriginalConstructor() -// ->getMock(); -// -// foreach ($nvpMethods as $method) { -// $nvpMock->method($method) -// ->willReturnSelf(); -// } -// -// $apiFactoryMock = $this->getMockBuilder(ApiFactory::class) -// ->disableOriginalConstructor() -// ->setMethods(['create']) -// ->getMock(); -// -// $apiFactoryMock->method('create') -// ->with(Nvp::class) -// ->willReturn($nvpMock); -// -// $this->_objectManager->addSharedInstance($apiFactoryMock, ApiFactory::class); -// -// $sessionMock = $this->getMockBuilder(GenericSession::class) -// ->setMethods(['getExpressCheckoutToken']) -// ->setConstructorArgs( -// [ -// $this->_objectManager->get(\Magento\Framework\App\Request\Http::class), -// $this->_objectManager->get(\Magento\Framework\Session\SidResolverInterface::class), -// $this->_objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class), -// $this->_objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class), -// $this->_objectManager->get(\Magento\Framework\Session\ValidatorInterface::class), -// $this->_objectManager->get(\Magento\Framework\Session\StorageInterface::class), -// $this->_objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class), -// $this->_objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class), -// $this->_objectManager->get(\Magento\Framework\App\State::class), -// ] -// ) -// ->getMock(); -// -// $sessionMock->method('getExpressCheckoutToken') -// ->willReturn(true); -// -// $this->_objectManager->addSharedInstance($sessionMock, PaypalSession::class); -// -// $this->dispatch('paypal/express/returnAction'); -// $this->assertRedirect($this->stringContains('checkout/onepage/success')); -// -// $this->_objectManager->removeSharedInstance(ApiFactory::class); -// $this->_objectManager->removeSharedInstance(PaypalSession::class); -// } + /** + * Test return action with configurable product. + */ + public function testReturnAction() + { + // Skipped due to MAGETWO-87333 + //@magentoDataFixture Magento/Paypal/_files/quote_express_configurable.php + $this->markTestSkipped('MAGETWO-87333'); + $quote = $this->_objectManager->create(Quote::class); + $quote->load('test_cart_with_configurable', 'reserved_order_id'); + + $payment = $quote->getPayment(); + $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS) + ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123); + + $quote->save(); + + $this->_objectManager->removeSharedInstance(Session::class); + $session = $this->_objectManager->get(Session::class); + $session->setQuoteId($quote->getId()); + + $nvpMethods = [ + 'setToken', + 'setPayerId', + 'setAmount', + 'setPaymentAction', + 'setNotifyUrl', + 'setInvNum', + 'setCurrencyCode', + 'setPaypalCart', + 'setIsLineItemsEnabled', + 'setAddress', + 'setBillingAddress', + 'callDoExpressCheckoutPayment', + 'callGetExpressCheckoutDetails', + 'getExportedBillingAddress' + ]; + + $nvpMock = $this->getMockBuilder(Nvp::class) + ->setMethods($nvpMethods) + ->disableOriginalConstructor() + ->getMock(); + + foreach ($nvpMethods as $method) { + $nvpMock->method($method) + ->willReturnSelf(); + } + + $apiFactoryMock = $this->getMockBuilder(ApiFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $apiFactoryMock->method('create') + ->with(Nvp::class) + ->willReturn($nvpMock); + + $this->_objectManager->addSharedInstance($apiFactoryMock, ApiFactory::class); + + $sessionMock = $this->getMockBuilder(GenericSession::class) + ->setMethods(['getExpressCheckoutToken']) + ->setConstructorArgs( + [ + $this->_objectManager->get(\Magento\Framework\App\Request\Http::class), + $this->_objectManager->get(\Magento\Framework\Session\SidResolverInterface::class), + $this->_objectManager->get(\Magento\Framework\Session\Config\ConfigInterface::class), + $this->_objectManager->get(\Magento\Framework\Session\SaveHandlerInterface::class), + $this->_objectManager->get(\Magento\Framework\Session\ValidatorInterface::class), + $this->_objectManager->get(\Magento\Framework\Session\StorageInterface::class), + $this->_objectManager->get(\Magento\Framework\Stdlib\CookieManagerInterface::class), + $this->_objectManager->get(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class), + $this->_objectManager->get(\Magento\Framework\App\State::class), + ] + ) + ->getMock(); + + $sessionMock->method('getExpressCheckoutToken') + ->willReturn(true); + + $this->_objectManager->addSharedInstance($sessionMock, PaypalSession::class); + + $this->dispatch('paypal/express/returnAction'); + $this->assertRedirect($this->stringContains('checkout/onepage/success')); + + $this->_objectManager->removeSharedInstance(ApiFactory::class); + $this->_objectManager->removeSharedInstance(PaypalSession::class); + } }