diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c8d6eb268a7f..1d71c2d727423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,147 @@ +2.2.5 +============= +* GitHub issues: + * [#7720](https://github.com/magento/magento2/issues/7720) -- Product Repository saves attribute values for existing product always on "Default Store Level" (fixed in [magento-engcom/magento2ce#967](https://github.com/magento-engcom/magento2ce/pull/967)) + * [#12186](https://github.com/magento/magento2/issues/12186) -- Custom attributes values not updated (fixed in [magento-engcom/magento2ce#967](https://github.com/magento-engcom/magento2ce/pull/967)) + * [#12395](https://github.com/magento/magento2/issues/12395) -- Custom Magento CLI command has incorrect current store id. (fixed in [magento-engcom/magento2ce#967](https://github.com/magento-engcom/magento2ce/pull/967)) + * [#12792](https://github.com/magento/magento2/issues/12792) -- [2.1.10] No order confirmation email after paying with PayPal Express (fixed in [magento/magento2#13898](https://github.com/magento/magento2/pull/13898)) + * [#13778](https://github.com/magento/magento2/issues/13778) -- Braintree Paypal Method No Order Confirmation Email Sent (fixed in [magento/magento2#13898](https://github.com/magento/magento2/pull/13898)) + * [#13556](https://github.com/magento/magento2/issues/13556) -- Sorting in Product Listing via Quantity not work (fixed in [magento/magento2#13691](https://github.com/magento/magento2/pull/13691)) + * [#13769](https://github.com/magento/magento2/issues/13769) -- Order Email Sender (fixed in [magento/magento2#13878](https://github.com/magento/magento2/pull/13878)) + * [#12405](https://github.com/magento/magento2/issues/12405) -- Magento 2.2.1 - Impossible to create a new storeview (fixed in [magento/magento2#13943](https://github.com/magento/magento2/pull/13943)) + * [#12421](https://github.com/magento/magento2/issues/12421) -- 'Requested store is not found' when trying to create a store view in the back end (fixed in [magento/magento2#13943](https://github.com/magento/magento2/pull/13943)) + * [#13804](https://github.com/magento/magento2/issues/13804) -- Invoice grid shows wrong subtotal for partial items invoice. It shows order's subtotal instead if invoiced item's subtotal (fixed in [magento/magento2#13855](https://github.com/magento/magento2/pull/13855)) + * [#7372](https://github.com/magento/magento2/issues/7372) -- Product images gets removed from "Images And Videos" after validation alert. (fixed in [magento-engcom/magento2ce#1140](https://github.com/magento-engcom/magento2ce/pull/1140)) + * [#13385](https://github.com/magento/magento2/issues/13385) -- SQL query is printed into browser in case of exception (fixed in [magento/magento2#13607](https://github.com/magento/magento2/pull/13607)) + * [#13117](https://github.com/magento/magento2/issues/13117) -- Swatch Attribute is not getting save while deleting a swatch row with empty admin scope text (fixed in [magento/magento2#13717](https://github.com/magento/magento2/pull/13717)) + * [#3483](https://github.com/magento/magento2/issues/3483) -- Default country selection issue while creating new customer from backend (fixed in [magento/magento2#13024](https://github.com/magento/magento2/pull/13024)) + * [#13231](https://github.com/magento/magento2/issues/13231) -- Default State or Province is not pre-selected in the Estimate Shipping and Tax (fixed in [magento-engcom/magento2ce#1258](https://github.com/magento-engcom/magento2ce/pull/1258)) + * [#10559](https://github.com/magento/magento2/issues/10559) -- Extending swatch functionality using javascript mixins does not work in Safari and MS Edge (fixed in [magento/magento2#12929](https://github.com/magento/magento2/pull/12929)) + * [#5463](https://github.com/magento/magento2/issues/5463) -- The ability to store passwords using different hashing algorithms is limited (fixed in [magento/magento2#13884](https://github.com/magento/magento2/pull/13884)) + * [#13988](https://github.com/magento/magento2/issues/13988) -- Mini search field looses focus after its JavaScript is initialized (fixed in [magento/magento2#13989](https://github.com/magento/magento2/pull/13989)) + * [#13820](https://github.com/magento/magento2/issues/13820) -- IE11 minicart not updating on configurable product page (ES6) (fixed in [magento/magento2#14105](https://github.com/magento/magento2/pull/14105)) + * [#14010](https://github.com/magento/magento2/issues/14010) -- Why Report Bugs link not open in new tab? (fixed in [magento/magento2#14121](https://github.com/magento/magento2/pull/14121)) + * [#12205](https://github.com/magento/magento2/issues/12205) -- Stock inventory reindex bug (fixed in [magento-engcom/magento2ce#1134](https://github.com/magento-engcom/magento2ce/pull/1134)) + * [#8168](https://github.com/magento/magento2/issues/8168) -- Configurable product on wishlist shows parent image instead variation image (fixed in [magento-engcom/magento2ce#1031](https://github.com/magento-engcom/magento2ce/pull/1031)) + * [#14138](https://github.com/magento/magento2/issues/14138) -- Outdated package after upgrade sjparkinson/static-review is abandoned (fixed in [magento/magento2#14091](https://github.com/magento/magento2/pull/14091)) + * [#14109](https://github.com/magento/magento2/issues/14109) -- `MAX_NUM_COOKIES` doesn't follow the open-closed principle (fixed in [magento/magento2#14128](https://github.com/magento/magento2/pull/14128)) + * [#13704](https://github.com/magento/magento2/issues/13704) -- Category\Collection::joinUrlRewrite should use the store set on the collection (fixed in [magento/magento2#13716](https://github.com/magento/magento2/pull/13716)) + * [#13992](https://github.com/magento/magento2/issues/13992) -- Incorrect phpdoc should be Shipment\Item not Invoice\Item (fixed in [magento/magento2#14303](https://github.com/magento/magento2/pull/14303)) + * [#14089](https://github.com/magento/magento2/issues/14089) -- Malaysian (Malaysia) missing from locale list (fixed in [magento/magento2#14306](https://github.com/magento/magento2/pull/14306)) + * [#7428](https://github.com/magento/magento2/issues/7428) -- Multiline fields in forms have no visible label (fixed in [magento/magento2#14317](https://github.com/magento/magento2/pull/14317)) + * [#10057](https://github.com/magento/magento2/issues/10057) -- Editing order with backordered items results in new order not correctly marking order items as backordered (fixed in [magento/magento2#14327](https://github.com/magento/magento2/pull/14327)) + * [#10700](https://github.com/magento/magento2/issues/10700) -- Magento 2 Admin panel show loading on each page (fixed in [magento/magento2#14361](https://github.com/magento/magento2/pull/14361)) + * [#11930](https://github.com/magento/magento2/issues/11930) -- setup:di:compile's generated cache files inaccessible by the web-server user (fixed in [magento/magento2#14361](https://github.com/magento/magento2/pull/14361)) + * [#14072](https://github.com/magento/magento2/issues/14072) -- Change zip code validation pattern for Japan (fixed in [magento/magento2#14299](https://github.com/magento/magento2/pull/14299)) + * [#7816](https://github.com/magento/magento2/issues/7816) -- Customer_account.xml file abused (fixed in [magento/magento2#14325](https://github.com/magento/magento2/pull/14325)) + * [#10650](https://github.com/magento/magento2/issues/10650) -- Cron starts when it's already running (fixed in [magento/magento2#12497](https://github.com/magento/magento2/pull/12497)) + * [#14307](https://github.com/magento/magento2/issues/14307) -- Possible to press the "Previous" button while in the first step of the installation (fixed in [magento/magento2#14309](https://github.com/magento/magento2/pull/14309)) + * [#14249](https://github.com/magento/magento2/issues/14249) -- Priduct page price is using the hardcoded digits in js (fixed in [magento/magento2#14350](https://github.com/magento/magento2/pull/14350)) + * [#13582](https://github.com/magento/magento2/issues/13582) -- Magento 2.1.11 minimum quantity validation message not showing (fixed in [magento/magento2#13942](https://github.com/magento/magento2/pull/13942)) + * [#8837](https://github.com/magento/magento2/issues/8837) -- Google Analytics code being placed in body instead of head (fixed in [magento/magento2#14293](https://github.com/magento/magento2/pull/14293)) + * [#13010](https://github.com/magento/magento2/issues/13010) -- Write a Review page works on multistore for products that are not assigned to that store (fixed in [magento/magento2#14360](https://github.com/magento/magento2/pull/14360)) + * [#14049](https://github.com/magento/magento2/issues/14049) -- Retrieve session information from another customer under /customer/section/load/sections=&update_section_id=true (fixed in [magento/magento2#14176](https://github.com/magento/magento2/pull/14176)) + * [#6879](https://github.com/magento/magento2/issues/6879) -- Unable to change country of manufacture default label value (fixed in [magento/magento2#14319](https://github.com/magento/magento2/pull/14319)) + * [#14572](https://github.com/magento/magento2/issues/14572) -- Specify the table when adding field to filter for the collection Eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php (fixed in [magento/magento2#14599](https://github.com/magento/magento2/pull/14599)) + * [#9666](https://github.com/magento/magento2/issues/9666) -- Magento 2.1.6 - Invoice PDF doesn't support Thai (fixed in [magento/magento2#13016](https://github.com/magento/magento2/pull/13016)) + * [#12323](https://github.com/magento/magento2/issues/12323) -- Magento 2.1.3 - Invoice and shipment PDF doesn't support Arabic (fixed in [magento/magento2#13016](https://github.com/magento/magento2/pull/13016)) + * [#14035](https://github.com/magento/magento2/issues/14035) -- Magento REST API, wrong condition for product list category filter (fixed in [magento/magento2#14048](https://github.com/magento/magento2/pull/14048)) + * [#14465](https://github.com/magento/magento2/issues/14465) -- [Indexes] Product 'version_id' lost last 'auro_increment' value after MySQL restart. (fixed in [magento/magento2#14635](https://github.com/magento/magento2/pull/14635)) + * [#13652](https://github.com/magento/magento2/issues/13652) -- Issue in product title with special chars in mini cart (fixed in [magento/magento2#14681](https://github.com/magento/magento2/pull/14681)) +* GitHub pull requests: + * [magento/magento2#13898](https://github.com/magento/magento2/pull/13898) -- Send order email for Braintree Paypal orders (by @pmclain) + * [magento/magento2#13956](https://github.com/magento/magento2/pull/13956) -- Use event object in 'ajax:addToCart' trigger when adding a product to the cart (by @koenner01) + * [magento/magento2#13691](https://github.com/magento/magento2/pull/13691) -- Fix for Issue-13556 - Sorting in Product Listing via Quantity not work (by @nuzil) + * [magento/magento2#13878](https://github.com/magento/magento2/pull/13878) -- Issues 13769. Fix wrong info about sent email in order sender. (by @pawcioma) + * [magento/magento2#13943](https://github.com/magento/magento2/pull/13943) -- magento/magento2#12405: Impossible to create a new storeview (by @hostep) + * [magento/magento2#13173](https://github.com/magento/magento2/pull/13173) -- Performance: remove count() form the condition section of a loop (by @Coderimus) + * [magento/magento2#13855](https://github.com/magento/magento2/pull/13855) -- Invoice grid shows wrong subtotal for partial items invoice. It shows order's subtotal instead if invoiced item's subtotal (by @ankurvr) + * [magento/magento2#14011](https://github.com/magento/magento2/pull/14011) -- Added alias to block 'product.info.description' (by @chedaroo) + * [magento/magento2#14013](https://github.com/magento/magento2/pull/14013) -- Use `^1.4` for `composer/composer` (by @sandermangel) + * [magento/magento2#14026](https://github.com/magento/magento2/pull/14026) -- [FIX] Remove not used variable in template (by @Coderimus) + * [magento/magento2#14030](https://github.com/magento/magento2/pull/14030) -- [FIX] Remove not used and empty template (by @Coderimus) + * [magento/magento2#11376](https://github.com/magento/magento2/pull/11376) -- [Backport 2.2-develop] PHP Livecodetest testCodeStyle() method does not use whitelist files (by @adrian-martinez-interactiv4) + * [magento/magento2#13977](https://github.com/magento/magento2/pull/13977) -- Backport of PR-10748 for Magento 2.2: Always use https for Vimeo vide… (by @hostep) + * [magento/magento2#14028](https://github.com/magento/magento2/pull/14028) -- [FIX] small refactoring and removing not using variable from templates (by @Coderimus) + * [magento/magento2#13607](https://github.com/magento/magento2/pull/13607) -- SQL query is printed into browser in case of exception (by @shyamranpara) + * [magento/magento2#13717](https://github.com/magento/magento2/pull/13717) -- [Backport 2.2] Solve problem saving empty swatches in admin (by @enriquei4) + * [magento/magento2#13807](https://github.com/magento/magento2/pull/13807) -- [Backport 2.2] Add quoting for base path in DI compile command (by @simpleadm) + * [magento/magento2#13024](https://github.com/magento/magento2/pull/13024) -- resolved default country selection issue while creating new customer … (by @pradeep-wagento) + * [magento/magento2#14044](https://github.com/magento/magento2/pull/14044) -- Make scope parameters of methods to save/delete config optional (by @avstudnitz) + * [magento/magento2#12929](https://github.com/magento/magento2/pull/12929) -- Issues #10559 - Extend swatch using mixins (M2.2) (by @srenon) + * [magento/magento2#13884](https://github.com/magento/magento2/pull/13884) -- #5463 - Use specified hashing algo in \Magento\Framework\Encryption\Encryptor::getHash (by @k4emic) + * [magento/magento2#13894](https://github.com/magento/magento2/pull/13894) -- Fix cache issue for currencies with no symbol (by @evgk) + * [magento/magento2#13989](https://github.com/magento/magento2/pull/13989) -- Act better on existing input focus instead of removing it (by @krzksz) + * [magento/magento2#14029](https://github.com/magento/magento2/pull/14029) -- Fix $useCache for container child blocks (by @tdgroot) + * [magento/magento2#14042](https://github.com/magento/magento2/pull/14042) -- Improve array output format for etc.php and config.php (by @avstudnitz) + * [magento/magento2#14062](https://github.com/magento/magento2/pull/14062) -- Typo in SSL port number (by @jasperzeinstra) + * [magento/magento2#14083](https://github.com/magento/magento2/pull/14083) -- Fix product attribute ordering when more than 10 attributes. (by @RandeKnight) + * [magento/magento2#14105](https://github.com/magento/magento2/pull/14105) -- magento/magento2#13820: IE11 minicart not updating on configurable pr… (by @Frodigo) + * [magento/magento2#14121](https://github.com/magento/magento2/pull/14121) -- [Backport] Open link "Report an Issue" in a new tab (by @sidolov) + * [magento/magento2#14041](https://github.com/magento/magento2/pull/14041) -- Removed unnecessary protected member variables. (by @Yogeshks) + * [magento/magento2#14106](https://github.com/magento/magento2/pull/14106) -- [FIX] several fixes for sales and tax module: not used imports, variables and legacy code (by @Coderimus) + * [magento/magento2#14136](https://github.com/magento/magento2/pull/14136) -- Added mage/translate component to customers's ajax login (by @ccasciotti) + * [magento/magento2#14154](https://github.com/magento/magento2/pull/14154) -- catalog:images:resize CLI command fix (by @nfourteen) + * [magento/magento2#14189](https://github.com/magento/magento2/pull/14189) -- fix incorrect phpdoc return type (by @EliasZ) + * [magento/magento2#11707](https://github.com/magento/magento2/pull/11707) -- UPS Option to include TAX in rate (by @gwharton) + * [magento/magento2#14156](https://github.com/magento/magento2/pull/14156) -- Add website- and storeview-code in stores admin grid (by @aschrammel) + * [magento/magento2#12893](https://github.com/magento/magento2/pull/12893) -- Improvement: Magento\Sales\Helper\Guest refactoring and bugfix (by @Coderimus) + * [magento/magento2#13653](https://github.com/magento/magento2/pull/13653) -- Update Store getConfig() to respect valid false return value (by @JeroenVanLeusden) + * [magento/magento2#14091](https://github.com/magento/magento2/pull/14091) -- Remove sjparkinson/static-review and other obsolete tools (by @orlangur) + * [magento/magento2#14128](https://github.com/magento/magento2/pull/14128) -- ISSUE-14109: Allow modification of cookies via extension (by @brideo) + * [magento/magento2#13716](https://github.com/magento/magento2/pull/13716) -- Category\Collection::joinUrlRewrite should use the store set on the collection (by @alepane21) + * [magento/magento2#14230](https://github.com/magento/magento2/pull/14230) -- Fix for broken navigation menu on IE11 (by @cstergianos) + * [magento/magento2#14306](https://github.com/magento/magento2/pull/14306) -- [#14089] Add Malaysian Locale Code (by @osrecio) + * [magento/magento2#14303](https://github.com/magento/magento2/pull/14303) -- Resolves PHPdoc issue in ticket #13992 (by @cream-julian) + * [magento/magento2#14317](https://github.com/magento/magento2/pull/14317) -- FR#7428 - Multiline fields in forms have no visible label (by @crisdiaz) + * [magento/magento2#14358](https://github.com/magento/magento2/pull/14358) -- Format code (by @mageprince) + * [magento/magento2#13414](https://github.com/magento/magento2/pull/13414) -- Add getters to product image builder (by @VincentMarmiesse) + * [magento/magento2#14308](https://github.com/magento/magento2/pull/14308) -- Added language translation, make proper sentence and removed unused delete html container (by @Yogeshks) + * [magento/magento2#14327](https://github.com/magento/magento2/pull/14327) -- magento/magento2#10057 (by @swnsma) + * [magento/magento2#14347](https://github.com/magento/magento2/pull/14347) -- [Backport 2.2] Add json and xml support to the post method in socket client (by @simpleadm) + * [magento/magento2#14361](https://github.com/magento/magento2/pull/14361) -- Removed cache backend option which explicitly set file permissions (by @xtremeperf) + * [magento/magento2#14388](https://github.com/magento/magento2/pull/14388) -- [FIX] Remove duplicated case statement (by @Coderimus) + * [magento/magento2#14060](https://github.com/magento/magento2/pull/14060) -- Disable add to cart button when redirect to cart enabled (by @ihor-sviziev) + * [magento/magento2#14299](https://github.com/magento/magento2/pull/14299) -- [#14072 2.2] Add Zip Pattern for Japan JP (by @osrecio) + * [magento/magento2#14325](https://github.com/magento/magento2/pull/14325) -- #7816: Customer_account.xml file abused (2.2) (by @mikewhitby) + * [magento/magento2#12497](https://github.com/magento/magento2/pull/12497) -- Prevent running again already running cron group (by @paveq) + * [magento/magento2#14288](https://github.com/magento/magento2/pull/14288) -- Fill visibility in AdminCreateConfigurableProductTest.xml (by @tdgroot) + * [magento/magento2#14385](https://github.com/magento/magento2/pull/14385) -- Remove improper unit test (by @orlangur) + * [magento/magento2#14309](https://github.com/magento/magento2/pull/14309) -- Disable "Back" button on the first step of the setup (by @ArjenMiedema) + * [magento/magento2#14350](https://github.com/magento/magento2/pull/14350) -- precision for price overriding by js (by @cdiacon) + * [magento/magento2#14403](https://github.com/magento/magento2/pull/14403) -- test command inside if/then clause broke before install script (by @edie-pasek) + * [magento/magento2#14440](https://github.com/magento/magento2/pull/14440) -- Removed extra backslash from comment block (by @Yogeshks) + * [magento/magento2#13942](https://github.com/magento/magento2/pull/13942) -- Issue #13582 show message for qty minAllowed, maxAllowed, qtyIncremen… (by @bordeo) + * [magento/magento2#14293](https://github.com/magento/magento2/pull/14293) -- Moved Google Analytics block code to head tag #8837 (by @KravetsAndriy) + * [magento/magento2#14439](https://github.com/magento/magento2/pull/14439) -- Update process-reviews.js (by @sanderjongsma) + * [magento/magento2#14445](https://github.com/magento/magento2/pull/14445) -- [FIX] Simplify ternary operators for catalog module (by @Coderimus) + * [magento/magento2#14455](https://github.com/magento/magento2/pull/14455) -- Fix button color on hover in email template (by @Karlasa) + * [magento/magento2#14452](https://github.com/magento/magento2/pull/14452) -- Remove else statements from \Magento\Framework\Session\SessionManager (by @adrian-martinez-interactiv4) + * [magento/magento2#14466](https://github.com/magento/magento2/pull/14466) -- Correct function return statement. (by @NamrataChangani) + * [magento/magento2#14473](https://github.com/magento/magento2/pull/14473) -- Added spanish Bolivia locale to allowedLocales list (by @JDavidVR) + * [magento/magento2#13808](https://github.com/magento/magento2/pull/13808) -- [Backport 2.2] Configurable product price options by store (by @simpleadm) + * [magento/magento2#14360](https://github.com/magento/magento2/pull/14360) -- Fix issue #13010. Check if product is assigned to current website. (by @afirlejczyk) + * [magento/magento2#14457](https://github.com/magento/magento2/pull/14457) -- [Backport 2.2] Return status in console commands (by @simpleadm) + * [magento/magento2#14498](https://github.com/magento/magento2/pull/14498) -- fix translation issue with rating stars (by @Karlasa) + * [magento/magento2#14504](https://github.com/magento/magento2/pull/14504) -- Check if store id is not null instead of empty (by @quisse) + * [magento/magento2#13629](https://github.com/magento/magento2/pull/13629) -- Fix translate issue (by @Corefix) + * [magento/magento2#13831](https://github.com/magento/magento2/pull/13831) -- Fixed comparison with 0 bug for TableRate shipping carrier (by @irs) + * [magento/magento2#14176](https://github.com/magento/magento2/pull/14176) -- Replace the existing headers with the no cache headers (by @joost-florijn-kega) + * [magento/magento2#14319](https://github.com/magento/magento2/pull/14319) -- 6879 - Unable to change country of manufacture default label value (by @MateuszChrapek) + * [magento/magento2#13257](https://github.com/magento/magento2/pull/13257) -- [FIX]: Recent orders are not filtered per store at the customer account page (by @Coderimus) + * [magento/magento2#14559](https://github.com/magento/magento2/pull/14559) -- Fix for Issue #13950 - Cache issue with configurable products related to currency-conversions (by @nuzil) + * [magento/magento2#14552](https://github.com/magento/magento2/pull/14552) -- Allow to configure min and max dates for date picker component (by @tkotosz) + * [magento/magento2#14599](https://github.com/magento/magento2/pull/14599) -- Specify the table when adding field to filter (by @PierreLeMaguer) + * [magento/magento2#13016](https://github.com/magento/magento2/pull/13016) -- Fix for sales PDFs to support more characters (by @rossmc) + * [magento/magento2#14048](https://github.com/magento/magento2/pull/14048) -- Fix for GitHub issue #14035. (by @kamilszewczyk) + * [magento/magento2#14629](https://github.com/magento/magento2/pull/14629) -- Refactor Code for Mass Order Unhold (by @AnshuMishra17) + * [magento/magento2#14635](https://github.com/magento/magento2/pull/14635) -- [Forwardport] magento/magento2#14465 Fix empty changelog tables after MySQL restart. (by @ihor-sviziev) + * [magento/magento2#14668](https://github.com/magento/magento2/pull/14668) -- Added hyphenation, cutting edge to cutting-edge. (by @surya07081995) + * [magento/magento2#14678](https://github.com/magento/magento2/pull/14678) -- Checkout page - Fix tooltip position on mobile devices (by @ihor-sviziev) + * [magento/magento2#14681](https://github.com/magento/magento2/pull/14681) -- [Backport] Fix #13652. Mini cart - fix issue in product title with special chars. (by @ihor-sviziev) + * [magento/magento2#14688](https://github.com/magento/magento2/pull/14688) -- Translate Action Label (by @net32) + * [magento/magento2#14696](https://github.com/magento/magento2/pull/14696) -- [Backport] Eliminate usage of "else" statements (by @ihor-sviziev) + 2.2.4 ============= * GitHub issues: @@ -3349,7 +3493,7 @@ Tests: * [#686](https://github.com/magento/magento2/issues/686) -- Product save validation errors in the admin don't hide the overlay * [#702](https://github.com/magento/magento2/issues/702) -- Base table or view not found * [#652](https://github.com/magento/magento2/issues/652) -- Multishipping checkout not to change the Billing address js issue - * [#648](https://github.com/magento/magento2/issues/648) -- An equal (=) sign in the hash of the product page to to break the tabs functionality + * [#648](https://github.com/magento/magento2/issues/648) -- An equal (=) sign in the hash of the product page to break the tabs functionality * Service Contracts: * Refactored usage of new API of the Customer module * Implemented Service Contracts for the Sales module diff --git a/README.md b/README.md index 99fe14cbe33df..82c830e860742 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ To learn more about issue gate labels click [here](https://github.com/magento/ma

Reporting security issues

-To report security vulnerabilities in Magento software or web sites, please e-mail security@magento.com. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our encryption key if it includes sensitive information. Learn more about reporting security issues here. +To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account there to submit and follow-up your issue. Learn more about reporting security issues here. Stay up-to-date on the latest security news and patches for Magento by signing up for Security Alert Notifications. diff --git a/app/bootstrap.php b/app/bootstrap.php index e77c6d432c816..70b632537a75b 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -54,12 +54,16 @@ && isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false ) { - $profilerFlag = isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER']) + $profilerConfig = isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER']) ? $_SERVER['MAGE_PROFILER'] : trim(file_get_contents(BP . '/var/profiler.flag')); - \Magento\Framework\Profiler::applyConfig( - $profilerFlag, + if ($profilerConfig) { + $profilerConfig = json_decode($profilerConfig, true) ?: $profilerConfig; + } + + Magento\Framework\Profiler::applyConfig( + $profilerConfig, BP, !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ); diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php index 79f69ab5da88d..6b5e0681139cf 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php @@ -28,11 +28,11 @@ public function execute() )->markAsRead( $notificationId ); - $this->messageManager->addSuccess(__('The message has been marked as Read.')); + $this->messageManager->addSuccessMessage(__('The message has been marked as Read.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("We couldn't mark the notification as Read because of an error.") ); diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php index 9e61b8ff4b83c..9ae4a7cdac0b9 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php @@ -23,7 +23,7 @@ public function execute() { $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $this->messageManager->addError(__('Please select messages.')); + $this->messageManager->addErrorMessage(__('Please select messages.')); } else { try { foreach ($ids as $id) { @@ -32,13 +32,13 @@ public function execute() $model->setIsRead(1)->save(); } } - $this->messageManager->addSuccess( + $this->messageManager->addSuccessMessage( __('A total of %1 record(s) have been marked as Read.', count($ids)) ); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("We couldn't mark the notification as Read because of an error.") ); diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php index 94c7d955f592b..f4cafa09c7e45 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php @@ -23,7 +23,7 @@ public function execute() { $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $this->messageManager->addError(__('Please select messages.')); + $this->messageManager->addErrorMessage(__('Please select messages.')); } else { try { foreach ($ids as $id) { @@ -32,11 +32,12 @@ public function execute() $model->setIsRemove(1)->save(); } } - $this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids))); + $this->messageManager->addSuccessMessage(__('Total of %1 record(s) have been removed.', count($ids))); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); + $this->messageManager + ->addExceptionMessage($e, __("We couldn't remove the messages because of an error.")); } } $this->_redirect('adminhtml/*/'); diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php index 17f911339cb61..bec101fc27d48 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php @@ -31,11 +31,12 @@ public function execute() try { $model->setIsRemove(1)->save(); - $this->messageManager->addSuccess(__('The message has been removed.')); + $this->messageManager->addSuccessMessage(__('The message has been removed.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); + $this->messageManager + ->addExceptionMessage($e, __("We couldn't remove the messages because of an error.")); } $this->_redirect('adminhtml/*/'); diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdminNotification/LICENSE.txt b/app/code/Magento/AdminNotification/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdminNotification/LICENSE.txt rename to app/code/Magento/AdminNotification/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdminNotification/LICENSE_AFL.txt b/app/code/Magento/AdminNotification/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdminNotification/LICENSE_AFL.txt rename to app/code/Magento/AdminNotification/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/AdminNotification/Test/Mftf/README.md b/app/code/Magento/AdminNotification/Test/Mftf/README.md new file mode 100644 index 0000000000000..33f88ba74200a --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Admin Notification Functional Tests + +The Functional Test Module for **Magento Admin Notification** module. diff --git a/app/code/Magento/AdminNotification/Test/Mftf/composer.json b/app/code/Magento/AdminNotification/Test/Mftf/composer.json new file mode 100644 index 0000000000000..3389ce971f4cc --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Mftf/composer.json @@ -0,0 +1,20 @@ +{ + "name": "magento/functional-test-module-admin-notification", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/functional-test-module-media-storage": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0", + "magento/functional-test-module-ui": "100.0.0-dev" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php index 2fbfc43aa8775..f49911c3e7a93 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php @@ -62,6 +62,9 @@ public function testGetIdentity($expectedSum, $cacheTypes) $this->assertEquals($expectedSum, $this->_messageModel->getIdentity()); } + /** + * @return array + */ public function getIdentityDataProvider() { $cacheTypeMock1 = $this->createPartialMock(\stdClass::class, ['getCacheType']); @@ -95,6 +98,9 @@ public function testIsDisplayed($expected, $allowed, $cacheTypes) $this->assertEquals($expected, $this->_messageModel->isDisplayed()); } + /** + * @return array + */ public function isDisplayedDataProvider() { $cacheTypesMock = $this->createPartialMock(\stdClass::class, ['getCacheType']); diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php index 2c259db868851..b490efd8e9683 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php @@ -72,6 +72,9 @@ public function testIsDisplayed($expectedFirstRun, $data) $this->assertEquals($expectedFirstRun, $model->isDisplayed()); } + /** + * @return array + */ public function isDisplayedDataProvider() { return [ diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php index 1e71570a5e30b..c6f61fee862ba 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php @@ -76,6 +76,9 @@ public function testIsDisplayed($expectedResult, $cached, $response) $this->assertEquals($expectedResult, $this->_messageModel->isDisplayed()); } + /** + * @return array + */ public function isDisplayedDataProvider() { return [ diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index c0c6be46ce769..0ecdca6bb1d05 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -11,7 +11,7 @@ "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.2", + "version": "100.2.3", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index d654504a41e5c..0448daaf17644 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -23,7 +23,7 @@ { "[data-role=system_messages_list]": { "Magento_AdminNotification/js/system/messages/popup": { - class: 'modal-system-messages ui-popup-message' + "class":"modal-system-messages ui-popup-message" } } } diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js b/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js index f3f6a5fb1a123..39c61d6e07d29 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js +++ b/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js @@ -1,24 +1,26 @@ /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. -*/ + */ define([ 'jquery', 'Magento_Ui/js/modal/modal' -], function ($) { +], function ($, modal) { 'use strict'; return function (data, element) { - if (this.modal) { - this.modal.html($(element).html()); + + if (modal.modal) { + modal.modal.html($(element).html()); } else { - this.modal = $(element).modal({ + modal.modal = $(element).modal({ modalClass: data.class, type: 'popup', buttons: [] }); } - this.modal.modal('openModal'); + + modal.modal.modal('openModal'); }; }); diff --git a/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php b/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php index 02413a1899cd7..818bcda1da65f 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php +++ b/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php @@ -37,10 +37,10 @@ public function execute() ); return $resultLayout; } catch (\Exception $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } } else { - $this->messageManager->addError(__('Please correct the data sent.')); + $this->messageManager->addErrorMessage(__('Please correct the data sent.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php index 62a7aefa77550..3122a0a7ee648 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php @@ -103,7 +103,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product * @param \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer * @param ImportProduct\StoreResolver $storeResolver * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository - * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -192,6 +191,7 @@ protected function initTypeModels() * Export process * * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ public function export() { @@ -461,6 +461,7 @@ protected function getTierPrices(array $productLinksIds, $table) * * @param int $websiteId * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ protected function _getWebsiteCode(int $websiteId): string { @@ -491,6 +492,8 @@ protected function _getWebsiteCode(int $websiteId): string * @param int $customerGroupId * @param int $allGroups * @return string + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ protected function _getCustomerGroupById( int $customerGroupId, diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index 0e8acb37104e6..754f5fd6c8c20 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -8,7 +8,6 @@ use Magento\CatalogImportExport\Model\Import\Product as ImportProduct; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; -use Magento\Framework\App\ResourceConnection; /** * Class AdvancedPricing @@ -619,6 +618,7 @@ protected function processCountNewPrices(array $tierPrices) * Get product entity link field * * @return string + * @throws \Exception */ private function getProductEntityLinkField() { diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator.php index 25a9fc244fe51..d939a3f7c392e 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator.php @@ -28,6 +28,7 @@ public function __construct($validators = []) * * @param array $value * @return bool + * @throws \Zend_Validate_Exception */ public function isValid($value) { diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdvancedPricingImportExport/LICENSE.txt b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdvancedPricingImportExport/LICENSE.txt rename to app/code/Magento/AdvancedPricingImportExport/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdvancedPricingImportExport/LICENSE_AFL.txt b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/AdvancedPricingImportExport/LICENSE_AFL.txt rename to app/code/Magento/AdvancedPricingImportExport/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/README.md b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/README.md new file mode 100644 index 0000000000000..7b4d0f3f0b12b --- /dev/null +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Advanced Pricing Import Export Functional Tests + +The Functional Test Module for **Magento Advanced Pricing Import Export** module. diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/composer.json b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/composer.json new file mode 100644 index 0000000000000..3fe88ad6f6443 --- /dev/null +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Mftf/composer.json @@ -0,0 +1,23 @@ +{ + "name": "magento/functional-test-module-advanced-pricing-import-export", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-catalog": "100.0.0-dev", + "magento/functional-test-module-catalog-inventory": "100.0.0-dev", + "magento/functional-test-module-eav": "100.0.0-dev", + "magento/functional-test-module-import-export": "100.0.0-dev", + "magento/functional-test-module-catalog-import-export": "100.0.0-dev", + "magento/functional-test-module-customer": "100.0.0-dev", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php index 48b4c58918740..c927aad6ac714 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php @@ -213,7 +213,7 @@ protected function setUp() '_getCustomerGroupById', 'correctExportData' ]); - $this->advancedPricing = $this->getMockbuilder( + $this->advancedPricing = $this->getMockBuilder( \Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing::class ) ->setMethods($mockMethods) @@ -347,6 +347,7 @@ protected function tearDown() * @param $object * @param $property * @return mixed + * @throws \ReflectionException */ protected function getPropertyValue($object, $property) { @@ -362,6 +363,8 @@ protected function getPropertyValue($object, $property) * @param $object * @param $property * @param $value + * @return mixed + * @throws \ReflectionException */ protected function setPropertyValue(&$object, $property, $value) { diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php index bb64acb558320..2c930237da831 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php @@ -181,6 +181,9 @@ public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGr $this->tierPrice->isValid($value); } + /** + * @return array + */ public function isValidResultFalseDataProvider() { return [ @@ -286,6 +289,9 @@ public function isValidResultFalseDataProvider() ]; } + /** + * @return array + */ public function isValidAddMessagesCallDataProvider() { return [ @@ -340,6 +346,7 @@ public function isValidAddMessagesCallDataProvider() * @param object $object * @param string $property * @return mixed + * @throws \ReflectionException */ protected function getPropertyValue($object, $property) { @@ -357,6 +364,7 @@ protected function getPropertyValue($object, $property) * @param string $property * @param mixed $value * @return object + * @throws \ReflectionException */ protected function setPropertyValue(&$object, $property, $value) { 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 9a380ff75da24..b46e286e75007 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 @@ -114,6 +114,9 @@ public function testGetAllWebsitesValue() $this->assertEquals($expectedResult, $result); } + /** + * @return array + */ public function isValidReturnDataProvider() { return [ diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php index d9fce98826105..5ca534284a48d 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php @@ -77,6 +77,9 @@ public function testInit() $this->validator->init(null); } + /** + * @return array + */ public function isValidDataProvider() { return [ diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php index 6d130d93ee6a5..15a3ae3a22d4a 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php +++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php @@ -209,6 +209,10 @@ public function testGetEntityTypeCode() * Test method validateRow against its result. * * @dataProvider validateRowResultDataProvider + * @param array $rowData + * @param string|null $behavior + * @param bool $expectedResult + * @throws \ReflectionException */ public function testValidateRowResult($rowData, $behavior, $expectedResult) { @@ -234,6 +238,10 @@ public function testValidateRowResult($rowData, $behavior, $expectedResult) * Test method validateRow whether AddRowError is called. * * @dataProvider validateRowAddRowErrorCallDataProvider + * @param array $rowData + * @param string|null $behavior + * @param string $error + * @throws \ReflectionException */ public function testValidateRowAddRowErrorCall($rowData, $behavior, $error) { @@ -324,6 +332,13 @@ public function testSaveAdvancedPricing() * Take into consideration different data and check relative internal calls. * * @dataProvider saveAndReplaceAdvancedPricesAppendBehaviourDataProvider + * @param array $data + * @param string $tierCustomerGroupId + * @param string $groupCustomerGroupId + * @param string $tierWebsiteId + * @param string $groupWebsiteId + * @param array $expectedTierPrices + * @throws \ReflectionException */ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls( $data, @@ -768,6 +783,9 @@ public function testSaveProductPrices($priceData, $oldSkus, $priceIn, $callNum) $this->invokeMethod($this->advancedPricing, 'saveProductPrices', [$priceData, 'table']); } + /** + * @return array + */ public function saveProductPricesDataProvider() { return [ @@ -839,6 +857,9 @@ public function testDeleteProductTierPrices( ); } + /** + * @return array + */ public function deleteProductTierPricesDataProvider() { return [ @@ -921,6 +942,9 @@ public function testProcessCountExistingPrices( $this->invokeMethod($this->advancedPricing, 'processCountExistingPrices', [$prices, 'table']); } + /** + * @return array + */ public function processCountExistingPricesDataProvider() { return [ @@ -947,6 +971,7 @@ public function processCountExistingPricesDataProvider() * @param $object * @param $property * @return mixed + * @throws \ReflectionException */ protected function getPropertyValue($object, $property) { @@ -963,6 +988,8 @@ protected function getPropertyValue($object, $property) * @param $object * @param $property * @param $value + * @return mixed + * @throws \ReflectionException */ protected function setPropertyValue(&$object, $property, $value) { @@ -981,7 +1008,8 @@ protected function setPropertyValue(&$object, $property, $value) * @param string $method * @param array $args * - * @return mixed the method result. + * @return mixed + * @throws \ReflectionException */ private function invokeMethod($object, $method, $args = []) { @@ -998,6 +1026,7 @@ private function invokeMethod($object, $method, $args = []) * @param array $methods * * @return \PHPUnit_Framework_MockObject_MockObject + * @throws \ReflectionException */ private function getAdvancedPricingMock($methods = []) { diff --git a/app/code/Magento/AdvancedPricingImportExport/composer.json b/app/code/Magento/AdvancedPricingImportExport/composer.json index a3d6e36e66a0f..49a6f5379d1c0 100644 --- a/app/code/Magento/AdvancedPricingImportExport/composer.json +++ b/app/code/Magento/AdvancedPricingImportExport/composer.json @@ -13,7 +13,7 @@ "magento/framework": "101.0.*" }, "type": "magento2-module", - "version": "100.2.2", + "version": "100.2.3", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Analytics/ReportXml/ReportProvider.php b/app/code/Magento/Analytics/ReportXml/ReportProvider.php index 3ebe5941108bc..247be5fa8e4ca 100644 --- a/app/code/Magento/Analytics/ReportXml/ReportProvider.php +++ b/app/code/Magento/Analytics/ReportXml/ReportProvider.php @@ -57,7 +57,7 @@ public function __construct( private function getIteratorName(Query $query) { $config = $query->getConfig(); - return isset($config['iterator']) ? $config['iterator'] : null; + return $config['iterator'] ?? null; } /** diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/LICENSE.txt b/app/code/Magento/Analytics/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/LICENSE.txt rename to app/code/Magento/Analytics/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/LICENSE_AFL.txt b/app/code/Magento/Analytics/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/LICENSE_AFL.txt rename to app/code/Magento/Analytics/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/Analytics/Test/Mftf/README.md b/app/code/Magento/Analytics/Test/Mftf/README.md new file mode 100644 index 0000000000000..cdeb48941e6a4 --- /dev/null +++ b/app/code/Magento/Analytics/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Analytics Functional Tests + +The Functional Test Module for **Magento Analytics** module. diff --git a/app/code/Magento/Analytics/Test/Mftf/composer.json b/app/code/Magento/Analytics/Test/Mftf/composer.json new file mode 100644 index 0000000000000..86afb4e675a04 --- /dev/null +++ b/app/code/Magento/Analytics/Test/Mftf/composer.json @@ -0,0 +1,20 @@ +{ + "name": "magento/functional-test-module-analytics", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/functional-test-module-config": "100.0.0-dev", + "magento/functional-test-module-integration": "100.0.0-dev", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/AdditionalCommentTest.php b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/AdditionalCommentTest.php index cbf06264096ac..407e323aeaae6 100644 --- a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/AdditionalCommentTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/AdditionalCommentTest.php @@ -65,11 +65,11 @@ public function testRender() ->method('getLabel') ->willReturn('Comment label'); $html = $this->additionalComment->render($this->abstractElementMock); - $this->assertRegexp( + $this->assertRegExp( "/New comment/", $html ); - $this->assertRegexp( + $this->assertRegExp( "/Comment label/", $html ); diff --git a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php index a652cf6b3d548..54612076a757f 100644 --- a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php @@ -73,7 +73,7 @@ public function testRender() $this->abstractElementMock->expects($this->any()) ->method('getComment') ->willReturn('Eastern Standard Time (America/New_York)'); - $this->assertRegexp( + $this->assertRegExp( "/Eastern Standard Time \(America\/New_York\)/", $this->collectionTimeLabel->render($this->abstractElementMock) ); diff --git a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/SubscriptionStatusLabelTest.php b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/SubscriptionStatusLabelTest.php index 09e753e4ac8aa..0806187ebac01 100644 --- a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/SubscriptionStatusLabelTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/SubscriptionStatusLabelTest.php @@ -77,7 +77,7 @@ public function testRender() $this->abstractElementMock->expects($this->any()) ->method('getComment') ->willReturn('Subscription status: Enabled'); - $this->assertRegexp( + $this->assertRegExp( "/Subscription status: Enabled/", $this->subscriptionStatusLabel->render($this->abstractElementMock) ); diff --git a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/VerticalTest.php b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/VerticalTest.php index abce48c36c86a..6a0cecc781062 100644 --- a/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/VerticalTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/VerticalTest.php @@ -65,7 +65,7 @@ public function testRender() ->method('getHint') ->willReturn('New hint'); $html = $this->vertical->render($this->abstractElementMock); - $this->assertRegexp( + $this->assertRegExp( "/New comment/", $html ); diff --git a/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryTest.php b/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryTest.php index a4b08a9ce5e0a..fd924abdd9f44 100644 --- a/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryTest.php +++ b/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryTest.php @@ -49,7 +49,7 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->selectHydratorMock = $this->getMockBuilder(selectHydrator::class) + $this->selectHydratorMock = $this->getMockBuilder(SelectHydrator::class) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Analytics/composer.json b/app/code/Magento/Analytics/composer.json index 2e9b4bf158321..f69960e082f84 100644 --- a/app/code/Magento/Analytics/composer.json +++ b/app/code/Magento/Analytics/composer.json @@ -10,7 +10,7 @@ "magento/framework": "101.0.*" }, "type": "magento2-module", - "version": "100.2.1", + "version": "100.2.2", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Analytics/etc/adminhtml/system.xml b/app/code/Magento/Analytics/etc/adminhtml/system.xml index 889517e629e04..4e21648d00ce8 100644 --- a/app/code/Magento/Analytics/etc/adminhtml/system.xml +++ b/app/code/Magento/Analytics/etc/adminhtml/system.xml @@ -17,14 +17,14 @@ Your reports can be accessed securely on a personalized dashboard outside of the admin panel by clicking on the "Go to Advanced Reporting" link.
For more information, see our terms and conditions.]]> - + Magento\Config\Model\Config\Source\Enabledisable Magento\Analytics\Model\Config\Backend\Enabled Magento\Analytics\Block\Adminhtml\System\Config\SubscriptionStatusLabel analytics/subscription/enabled - + Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel Magento\Analytics\Model\Config\Backend\CollectionTime diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorization/LICENSE.txt b/app/code/Magento/Authorization/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorization/LICENSE.txt rename to app/code/Magento/Authorization/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorization/LICENSE_AFL.txt b/app/code/Magento/Authorization/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorization/LICENSE_AFL.txt rename to app/code/Magento/Authorization/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/Authorization/Test/Mftf/README.md b/app/code/Magento/Authorization/Test/Mftf/README.md new file mode 100644 index 0000000000000..1d44ab2e73052 --- /dev/null +++ b/app/code/Magento/Authorization/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Authorization Functional Tests + +The Functional Test Module for **Magento Authorization** module. diff --git a/app/code/Magento/Authorization/Test/Mftf/composer.json b/app/code/Magento/Authorization/Test/Mftf/composer.json new file mode 100644 index 0000000000000..3f9189dfcf360 --- /dev/null +++ b/app/code/Magento/Authorization/Test/Mftf/composer.json @@ -0,0 +1,17 @@ +{ + "name": "magento/functional-test-module-authorization", + "description": "Authorization module provides access to Magento ACL functionality.", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php b/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php index bd1a3616a746e..58720ad9c9f5c 100644 --- a/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php +++ b/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php @@ -78,6 +78,9 @@ public function testGetAllowedResourcesByUser() ); } + /** + * @return AclRetriever + */ protected function createAclRetriever() { $this->roleMock = $this->createPartialMock(\Magento\Authorization\Model\Role::class, ['getId', '__wakeup']); diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index 22483b7961841..a3f9f5da95a04 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -7,7 +7,7 @@ "magento/framework": "101.0.*" }, "type": "magento2-module", - "version": "100.2.0", + "version": "100.2.1", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index de567a8895f7e..9186acce83b4c 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -814,10 +814,14 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = '' { try { $response = $this->getResponse(); - if ($voidPayment && $response->getXTransId() && strtoupper($response->getXType()) - == self::REQUEST_TYPE_AUTH_ONLY + if ($voidPayment + && $response->getXTransId() + && strtoupper($response->getXType()) == self::REQUEST_TYPE_AUTH_ONLY ) { - $order->getPayment()->setTransactionId(null)->setParentTransactionId($response->getXTransId())->void(); + $order->getPayment() + ->setTransactionId(null) + ->setParentTransactionId($response->getXTransId()) + ->void($response); } $order->registerCancellation($message)->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Request.php b/app/code/Magento/Authorizenet/Model/Directpost/Request.php index d9a403e5c991e..fc78d836b6080 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Request.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Request.php @@ -112,50 +112,50 @@ public function setDataFromOrder( sprintf('%.2F', $order->getBaseShippingAmount()) ); - //need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript, + //need to use (string) because NULL values IE6-8 decodes as "null" in JSON in JavaScript, //but we need "" for null values. $billing = $order->getBillingAddress(); if (!empty($billing)) { - $this->setXFirstName(strval($billing->getFirstname())) - ->setXLastName(strval($billing->getLastname())) - ->setXCompany(strval($billing->getCompany())) - ->setXAddress(strval($billing->getStreetLine(1))) - ->setXCity(strval($billing->getCity())) - ->setXState(strval($billing->getRegion())) - ->setXZip(strval($billing->getPostcode())) - ->setXCountry(strval($billing->getCountryId())) - ->setXPhone(strval($billing->getTelephone())) - ->setXFax(strval($billing->getFax())) - ->setXCustId(strval($billing->getCustomerId())) - ->setXCustomerIp(strval($order->getRemoteIp())) - ->setXCustomerTaxId(strval($billing->getTaxId())) - ->setXEmail(strval($order->getCustomerEmail())) - ->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer'))) - ->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email'))); + $this->setXFirstName((string)$billing->getFirstname()) + ->setXLastName((string)$billing->getLastname()) + ->setXCompany((string)$billing->getCompany()) + ->setXAddress((string)$billing->getStreetLine(1)) + ->setXCity((string)$billing->getCity()) + ->setXState((string)$billing->getRegion()) + ->setXZip((string)$billing->getPostcode()) + ->setXCountry((string)$billing->getCountryId()) + ->setXPhone((string)$billing->getTelephone()) + ->setXFax((string)$billing->getFax()) + ->setXCustId((string)$billing->getCustomerId()) + ->setXCustomerIp((string)$order->getRemoteIp()) + ->setXCustomerTaxId((string)$billing->getTaxId()) + ->setXEmail((string)$order->getCustomerEmail()) + ->setXEmailCustomer((string)$paymentMethod->getConfigData('email_customer')) + ->setXMerchantEmail((string)$paymentMethod->getConfigData('merchant_email')); } $shipping = $order->getShippingAddress(); if (!empty($shipping)) { $this->setXShipToFirstName( - strval($shipping->getFirstname()) + (string)$shipping->getFirstname() )->setXShipToLastName( - strval($shipping->getLastname()) + (string)$shipping->getLastname() )->setXShipToCompany( - strval($shipping->getCompany()) + (string)$shipping->getCompany() )->setXShipToAddress( - strval($shipping->getStreetLine(1)) + (string)$shipping->getStreetLine(1) )->setXShipToCity( - strval($shipping->getCity()) + (string)$shipping->getCity() )->setXShipToState( - strval($shipping->getRegion()) + (string)$shipping->getRegion() )->setXShipToZip( - strval($shipping->getPostcode()) + (string)$shipping->getPostcode() )->setXShipToCountry( - strval($shipping->getCountryId()) + (string)$shipping->getCountryId() ); } - $this->setXPoNum(strval($payment->getPoNumber())); + $this->setXPoNum((string)$payment->getPoNumber()); return $this; } diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorizenet/LICENSE.txt b/app/code/Magento/Authorizenet/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorizenet/LICENSE.txt rename to app/code/Magento/Authorizenet/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorizenet/LICENSE_AFL.txt b/app/code/Magento/Authorizenet/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Authorizenet/LICENSE_AFL.txt rename to app/code/Magento/Authorizenet/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/Authorizenet/Test/Mftf/README.md b/app/code/Magento/Authorizenet/Test/Mftf/README.md new file mode 100644 index 0000000000000..9391126a85c94 --- /dev/null +++ b/app/code/Magento/Authorizenet/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Authorizenet Functional Tests + +The Functional Test Module for **Magento Authorizenet** module. diff --git a/app/code/Magento/Authorizenet/Test/Mftf/composer.json b/app/code/Magento/Authorizenet/Test/Mftf/composer.json new file mode 100644 index 0000000000000..68bf6b42ac8f1 --- /dev/null +++ b/app/code/Magento/Authorizenet/Test/Mftf/composer.json @@ -0,0 +1,25 @@ +{ + "name": "magento/functional-test-module-authorizenet", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-sales": "100.0.0-dev", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/functional-test-module-quote": "100.0.0-dev", + "magento/functional-test-module-checkout": "100.0.0-dev", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/functional-test-module-payment": "100.0.0-dev", + "magento/functional-test-module-catalog": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "suggest": { + "magento/functional-test-module-config": "100.0.0-dev" + }, + "type": "magento2-test", + "license": [ + "proprietary" + ] +} diff --git a/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ResponseTest.php b/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ResponseTest.php index 6e5d55e52675e..b4274e87401ca 100644 --- a/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ResponseTest.php +++ b/app/code/Magento/Authorizenet/Test/Unit/Model/Directpost/ResponseTest.php @@ -37,6 +37,9 @@ public function testGenerateHash($merchantMd5, $merchantApiLogin, $amount, $amou ); } + /** + * @return array + */ public function generateHashDataProvider() { return [ @@ -57,6 +60,14 @@ public function generateHashDataProvider() ]; } + /** + * @param $merchantMd5 + * @param $merchantApiLogin + * @param $amount + * @param $transactionId + * + * @return string + */ protected function generateHash($merchantMd5, $merchantApiLogin, $amount, $transactionId) { return strtoupper(md5($merchantMd5 . $merchantApiLogin . $transactionId . $amount)); diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index c389a1c6c4dfa..0046ba01adbe8 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -16,7 +16,7 @@ "magento/module-config": "101.0.*" }, "type": "magento2-module", - "version": "100.2.0", + "version": "100.2.1", "license": [ "proprietary" ], diff --git a/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js index 8edc38dce6f60..8c4c90bf111de 100644 --- a/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js +++ b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js @@ -6,7 +6,8 @@ var config = { map: { '*': { - transparent: 'Magento_Payment/transparent' + transparent: 'Magento_Payment/js/transparent', + 'Magento_Payment/transparent': 'Magento_Payment/js/transparent' } } }; diff --git a/app/code/Magento/Backend/App/AbstractAction.php b/app/code/Magento/Backend/App/AbstractAction.php index 99ee86b2b6407..3f658ee90bf4e 100644 --- a/app/code/Magento/Backend/App/AbstractAction.php +++ b/app/code/Magento/Backend/App/AbstractAction.php @@ -217,6 +217,7 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request) $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false); $this->_view->renderLayout(); $this->_request->setDispatched(true); + return $this->_response; } @@ -226,6 +227,11 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request) $this->_processLocaleSettings(); + // Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510) + if ($this->_auth->isLoggedIn()) { + $this->_auth->getAuthStorage()->isFirstPageAfterLogin(); + } + return parent::dispatch($request); } diff --git a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php index 68506a521c1cf..4b25e9921e404 100644 --- a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php @@ -160,7 +160,7 @@ protected function _processNotLoggedInUser(\Magento\Framework\App\RequestInterfa } else { $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true); $this->_response->setRedirect($this->_url->getCurrentUrl()); - $this->messageManager->addError(__('Invalid Form Key. Please refresh the page.')); + $this->messageManager->addErrorMessage(__('Invalid Form Key. Please refresh the page.')); $isRedirectNeeded = true; } } @@ -205,7 +205,7 @@ protected function _performLogin(\Magento\Framework\App\RequestInterface $reques $this->_auth->login($username, $password); } catch (AuthenticationException $e) { if (!$request->getParam('messageSent')) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $request->setParam('messageSent', true); $outputValue = false; } diff --git a/app/code/Magento/Backend/App/Config.php b/app/code/Magento/Backend/App/Config.php index bb60a1e69dd47..e0983139a690d 100644 --- a/app/code/Magento/Backend/App/Config.php +++ b/app/code/Magento/Backend/App/Config.php @@ -68,6 +68,6 @@ public function isSetFlag($path) if ($path) { $configPath .= '/' . $path; } - return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath); + return (bool)$this->appConfig->get(System::CONFIG_TYPE, $configPath); } } diff --git a/app/code/Magento/Backend/App/DefaultPath.php b/app/code/Magento/Backend/App/DefaultPath.php index df8b718389741..b790a2edc3fab 100644 --- a/app/code/Magento/Backend/App/DefaultPath.php +++ b/app/code/Magento/Backend/App/DefaultPath.php @@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config) */ public function getPart($code) { - return isset($this->_parts[$code]) ? $this->_parts[$code] : null; + return $this->_parts[$code] ?? null; } } diff --git a/app/code/Magento/Backend/Block/Dashboard/Bar.php b/app/code/Magento/Backend/Block/Dashboard/Bar.php index 29557f12c1093..7ccb2d51ccd1b 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Bar.php +++ b/app/code/Magento/Backend/Block/Dashboard/Bar.php @@ -38,14 +38,6 @@ public function getTotals() */ public function addTotal($label, $value, $isQuantity = false) { - /*if (!$isQuantity) { - $value = $this->format($value); - $decimals = substr($value, -2); - $value = substr($value, 0, -2); - } else { - $value = ($value != '')?$value:0; - $decimals = ''; - }*/ if (!$isQuantity) { $value = $this->format($value); } diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 4987cb248bd0b..7e1ad03470720 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -3,8 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Backend\Block\Media; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Image\Adapter\ConfigInterface; + /** * Adminhtml media library uploader * @api @@ -27,17 +33,34 @@ class Uploader extends \Magento\Backend\Block\Widget */ protected $_fileSizeService; + /** + * @var Json + */ + private $jsonEncoder; + + /** + * @var ConfigInterface + */ + private $imageConfig; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\File\Size $fileSize * @param array $data + * @param Json $jsonEncoder + * @param ConfigInterface $imageConfig */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\File\Size $fileSize, - array $data = [] + array $data = [], + Json $jsonEncoder = null, + ConfigInterface $imageConfig = null ) { $this->_fileSizeService = $fileSize; + $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); + $this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(ConfigInterface::class); + parent::__construct($context, $data); } @@ -79,6 +102,26 @@ public function getFileSizeService() return $this->_fileSizeService; } + /** + * Get Image Upload Maximum Width Config + * + * @return int + */ + public function getImageUploadMaxWidth() + { + return $this->imageConfig->getMaxWidth(); + } + + /** + * Get Image Upload Maximum Height Config + * + * @return int + */ + public function getImageUploadMaxHeight() + { + return $this->imageConfig->getMaxHeight(); + } + /** * Prepares layout and set element renderer * @@ -107,7 +150,7 @@ public function getJsObjectName() */ public function getConfigJson() { - return $this->_coreData->jsonEncode($this->getConfig()->getData()); + return $this->jsonEncoder->encode($this->getConfig()->getData()); } /** diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php index 723deab1e9f7e..eff49c3b75ab2 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php @@ -124,14 +124,18 @@ protected function _toHtml() if (!$this->_depends) { return ''; } - return ''; + + $params = $this->_getDependsJson(); + + if ($this->_configOptions) { + $params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions); + } + + return ""; } /** diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php index a5e4a34389671..1d8d658267020 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php @@ -26,7 +26,6 @@ public function getValue($index = null) { if ($index) { if ($data = $this->getData('value', 'orig_' . $index)) { - // date('Y-m-d', strtotime($data)); return $data; } return null; @@ -154,7 +153,7 @@ public function getEscapedValue($index = null) if (is_string($value)) { return $this->escapeHtml($value); } - + return $value; } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php index b8a2e283b29a0..9df8c532adfdd 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php @@ -58,7 +58,7 @@ public function render(DataObject $row) $result .= $this->getColumn()->getEditOnly() ? '' : '' . $this->_getValue($row) . ''; - return $result . $this->_getInputValueElement($row) . '' ; + return $result . $this->_getInputValueElement($row) . ''; } return $this->_getValue($row); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php index ff0399e4f507f..03566bce3fc34 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php @@ -68,10 +68,7 @@ public function __construct( $this->_storeManager = $storeManager; $this->_currencyLocator = $currencyLocator; $this->_localeCurrency = $localeCurrency; - $defaultBaseCurrencyCode = $this->_scopeConfig->getValue( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, - 'default' - ); + $defaultBaseCurrencyCode = $currencyLocator->getDefaultCurrency($this->_request); $this->_defaultBaseCurrency = $currencyFactory->create()->load($defaultBaseCurrencyCode); } @@ -85,7 +82,7 @@ public function render(\Magento\Framework\DataObject $row) { if ($data = (string)$this->_getValue($row)) { $currency_code = $this->_getCurrencyCode($row); - $data = floatval($data) * $this->_getRate($row); + $data = (float)$data * $this->_getRate($row); $sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : ''; $data = sprintf("%f", $data); $data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data); @@ -121,10 +118,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float)$rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float)$rate; } return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row)); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php index e4300c63485f5..9da23af83f036 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php @@ -60,7 +60,7 @@ public function render(\Magento\Framework\DataObject $row) return $data; } - $data = floatval($data) * $this->_getRate($row); + $data = (float)$data * $this->_getRate($row); $data = sprintf("%f", $data); $data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data); return $data; @@ -94,10 +94,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float)$rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float)$rate; } return 1; } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index e790cbfa69d8a..99b9bb41ba1a1 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -276,13 +276,13 @@ public function getGridIdsJson() } /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); - + if ($this->getMassactionIdField()) { $massActionIdField = $this->getMassactionIdField(); } else { $massActionIdField = $this->getParentBlock()->getMassactionIdField(); } - + $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); if (!empty($gridIds)) { return join(",", $gridIds); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php index eae1a137e927d..ca9799f390120 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php @@ -273,13 +273,13 @@ public function getGridIdsJson() /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); - + if ($this->getMassactionIdField()) { $massActionIdField = $this->getMassactionIdField(); } else { $massActionIdField = $this->getParentBlock()->getMassactionIdField(); } - + $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); if (!empty($gridIds)) { diff --git a/app/code/Magento/Backend/Block/Widget/Tabs.php b/app/code/Magento/Backend/Block/Widget/Tabs.php index ec3628d2fcb43..f913098378634 100644 --- a/app/code/Magento/Backend/Block/Widget/Tabs.php +++ b/app/code/Magento/Backend/Block/Widget/Tabs.php @@ -117,6 +117,7 @@ public function addTab($tabId, $tab) if (empty($tabId)) { throw new \Exception(__('Please correct the tab configuration and try again. Tab Id should be not empty')); } + if (is_array($tab)) { $this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab); } elseif ($tab instanceof \Magento\Framework\DataObject) { @@ -126,6 +127,7 @@ public function addTab($tabId, $tab) } } elseif (is_string($tab)) { $this->_addTabByName($tab, $tabId); + if (!$this->_tabs[$tabId] instanceof TabInterface) { unset($this->_tabs[$tabId]); return $this; @@ -133,6 +135,7 @@ public function addTab($tabId, $tab) } else { throw new \Exception(__('Please correct the tab configuration and try again.')); } + if ($this->_tabs[$tabId]->getUrl() === null) { $this->_tabs[$tabId]->setUrl('#'); } @@ -143,10 +146,7 @@ public function addTab($tabId, $tab) $this->_tabs[$tabId]->setId($tabId); $this->_tabs[$tabId]->setTabId($tabId); - - if ($this->_activeTab === null) { - $this->_activeTab = $tabId; - } + if (true === $this->_tabs[$tabId]->getActive()) { $this->setActiveTab($tabId); } @@ -235,33 +235,108 @@ protected function _setActiveTab($tabId) */ protected function _beforeToHtml() { + $this->_tabs = $this->reorderTabs(); + if ($activeTab = $this->getRequest()->getParam('active_tab')) { $this->setActiveTab($activeTab); } elseif ($activeTabId = $this->_authSession->getActiveTabId()) { $this->_setActiveTab($activeTabId); } - $_new = []; + if ($this->_activeTab === null && !empty($this->_tabs)) { + /** @var TabInterface $tab */ + $this->_activeTab = (reset($this->_tabs))->getId(); + } + + $this->assign('tabs', $this->_tabs); + return parent::_beforeToHtml(); + } + + /** + * Reorder the tabs. + * + * @return array + */ + private function reorderTabs() + { + $orderByIdentity = []; + $orderByPosition = []; + $position = 100; + + /** + * Set the initial positions for each tab. + * + * @var string $key + * @var TabInterface $tab + */ foreach ($this->_tabs as $key => $tab) { - foreach ($this->_tabs as $k => $t) { - if ($t->getAfter() == $key) { - $_new[$key] = $tab; - $_new[$k] = $t; - } else { - if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($this->_tabs))) { - $_new[$key] = $tab; - } - } - } + $tab->setPosition($position); + + $orderByIdentity[$key] = $tab; + $orderByPosition[$position] = $tab; + + $position += 100; } - $this->_tabs = $_new; - unset($_new); + return $this->applyTabsCorrectOrder($orderByPosition, $orderByIdentity); + } + + /** + * @param array $orderByPosition + * @param array $orderByIdentity + * + * @return array + */ + private function applyTabsCorrectOrder(array $orderByPosition, array $orderByIdentity) + { + $positionFactor = 1; + + /** + * Rearrange the positions by using the after tag for each tab. + * + * @var integer $position + * @var TabInterface $tab + */ + foreach ($orderByPosition as $position => $tab) { + if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($orderByIdentity))) { + $positionFactor = 1; + continue; + } + + $grandPosition = $orderByIdentity[$tab->getAfter()]->getPosition(); + $newPosition = $grandPosition + $positionFactor; - $this->assign('tabs', $this->_tabs); - return parent::_beforeToHtml(); + unset($orderByPosition[$position]); + $orderByPosition[$newPosition] = $tab; + $tab->setPosition($newPosition); + + $positionFactor++; + } + + return $this->finalTabsSortOrder($orderByPosition); } + /** + * Apply the last sort order to tabs. + * + * @param array $orderByPosition + * + * @return array + */ + private function finalTabsSortOrder(array $orderByPosition) + { + ksort($orderByPosition); + + $ordered = []; + + /** @var TabInterface $tab */ + foreach ($orderByPosition as $tab) { + $ordered[$tab->getId()] = $tab; + } + + return $ordered; + } + /** * @return string */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php index 41e32c929287a..e55c449a0e5bb 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php @@ -16,7 +16,7 @@ class Logout extends \Magento\Backend\Controller\Adminhtml\Auth public function execute() { $this->_auth->logout(); - $this->messageManager->addSuccess(__('You have logged out.')); + $this->messageManager->addSuccessMessage(__('You have logged out.')); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php index 7a926b1c09c3e..888ce11313b8a 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php @@ -28,11 +28,11 @@ public function execute() try { $this->_objectManager->create(\Magento\Catalog\Model\Product\Image::class)->clearCache(); $this->_eventManager->dispatch('clean_catalog_images_cache_after'); - $this->messageManager->addSuccess(__('The image cache was cleaned.')); + $this->messageManager->addSuccessMessage(__('The image cache was cleaned.')); } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while clearing the image cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while clearing the image cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php index 72f23ab65cf8a..5df0a7779c4c1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php @@ -28,11 +28,12 @@ public function execute() try { $this->_objectManager->get(\Magento\Framework\View\Asset\MergeService::class)->cleanMergedJsCss(); $this->_eventManager->dispatch('clean_media_cache_after'); - $this->messageManager->addSuccess(__('The JavaScript/CSS cache has been cleaned.')); + $this->messageManager->addSuccessMessage(__('The JavaScript/CSS cache has been cleaned.')); } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while clearing the JavaScript/CSS cache.')); + $this->messageManager + ->addExceptionMessage($e, __('An error occurred while clearing the JavaScript/CSS cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php index 27ae2fc31e150..489eb5799a5e7 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php @@ -26,7 +26,7 @@ public function execute() { $this->_objectManager->get(\Magento\Framework\App\State\CleanupFiles::class)->clearMaterializedViewFiles(); $this->_eventManager->dispatch('clean_static_files_cache_after'); - $this->messageManager->addSuccess(__('The static files cache has been cleaned.')); + $this->messageManager->addSuccessMessage(__('The static files cache has been cleaned.')); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php index ca89ea58fa6f3..a2f18b4baf53d 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php @@ -27,7 +27,7 @@ public function execute() foreach ($this->_cacheFrontendPool as $cacheFrontend) { $cacheFrontend->getBackend()->clean(); } - $this->messageManager->addSuccess(__("You flushed the cache storage.")); + $this->messageManager->addSuccessMessage(__("You flushed the cache storage.")); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php index f0fed159e0f22..90ed3432fa87b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php @@ -27,7 +27,7 @@ public function execute() $cacheFrontend->clean(); } $this->_eventManager->dispatch('adminhtml_cache_flush_system'); - $this->messageManager->addSuccess(__("The Magento cache storage has been flushed.")); + $this->messageManager->addSuccessMessage(__("The Magento cache storage has been flushed.")); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php index 2bfa937b06b77..03b88ca1d3f47 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php @@ -67,12 +67,12 @@ private function disableCache() } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->messageManager->addSuccess(__("%1 cache type(s) disabled.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) disabled.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while disabling cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while disabling cache.')); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php index 113e0f2d8961b..1b98a00d4bf35 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php @@ -66,12 +66,12 @@ private function enableCache() } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->messageManager->addSuccess(__("%1 cache type(s) enabled.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) enabled.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while enabling cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while enabling cache.')); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php index 3843b030afb3d..bde211debcf72 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php @@ -37,12 +37,12 @@ public function execute() $updatedTypes++; } if ($updatedTypes > 0) { - $this->messageManager->addSuccess(__("%1 cache type(s) refreshed.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) refreshed.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while refreshing cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while refreshing cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php index f831fa67f4bb0..c10d1a77997b7 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php @@ -34,9 +34,9 @@ public function execute() foreach ($collectionsNames as $collectionName) { $this->_objectManager->create($collectionName)->aggregate(); } - $this->messageManager->addSuccess(__('We updated lifetime statistic.')); + $this->messageManager->addSuccessMessage(__('We updated lifetime statistic.')); } catch (\Exception $e) { - $this->messageManager->addError(__('We can\'t refresh lifetime statistics.')); + $this->messageManager->addErrorMessage(__('We can\'t refresh lifetime statistics.')); $this->logger->critical($e); } 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 1b10c151a9d21..d95b0541c2c76 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php @@ -76,12 +76,12 @@ public function execute() $errors = $user->validate(); if ($errors !== true && !empty($errors)) { foreach ($errors as $error) { - $this->messageManager->addError($error); + $this->messageManager->addErrorMessage($error); } } else { $user->save(); $user->sendNotificationEmailsIfRequired(); - $this->messageManager->addSuccess(__('You saved the account.')); + $this->messageManager->addSuccessMessage(__('You saved the account.')); } } catch (UserLockedException $e) { $this->_auth->logout(); @@ -91,12 +91,12 @@ public function execute() } catch (ValidatorException $e) { $this->messageManager->addMessages($e->getMessages()); if ($e->getMessage()) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addError(__('An error occurred while saving account.')); + $this->messageManager->addErrorMessage(__('An error occurred while saving account.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php index 76402169f269e..21f28188cf874 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php @@ -19,11 +19,11 @@ public function execute() try { $design->delete(); - $this->messageManager->addSuccess(__('You deleted the design change.')); + $this->messageManager->addSuccessMessage(__('You deleted the design change.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __("You can't delete the design change.")); + $this->messageManager->addExceptionMessage($e, __("You can't delete the design change.")); } } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php index 1f478604ced7d..0228b48f7f11e 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php @@ -50,9 +50,9 @@ public function execute() try { $design->save(); $this->_eventManager->dispatch('theme_save_after'); - $this->messageManager->addSuccess(__('You saved the design change.')); + $this->messageManager->addSuccessMessage(__('You saved the design change.')); } catch (\Exception $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $this->_objectManager->get(\Magento\Backend\Model\Session::class)->setDesignData($data); return $resultRedirect->setPath('adminhtml/*/', ['id' => $design->getId()]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index 4fbae6abb423a..0beeb5168b6d1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -103,12 +103,12 @@ protected function _backupDatabase() ->setType('db') ->setPath($filesystem->getDirectoryRead(DirectoryList::VAR_DIR)->getAbsolutePath('backups')); $backupDb->createBackup($backup); - $this->messageManager->addSuccess(__('The database was backed up.')); + $this->messageManager->addSuccessMessage(__('The database was backed up.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); return false; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __('We can\'t create a backup right now. Please try again later.') ); @@ -125,7 +125,7 @@ protected function _backupDatabase() */ protected function _addDeletionNotice($typeTitle) { - $this->messageManager->addNotice( + $this->messageManager->addNoticeMessage( __( 'Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.)' . ', but the %1 will not be able to be restored. It is suggested that you create a database backup ' diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php index 925ae4c69ee8e..4e323be709ae1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php @@ -15,13 +15,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Group::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php index b6fbd88c7669c..23364aac1f0ab 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php @@ -21,11 +21,11 @@ public function execute() $redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Group::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $model->getId()]); } @@ -35,12 +35,12 @@ public function execute() try { $model->delete(); - $this->messageManager->addSuccess(__('You deleted the store.')); + $this->messageManager->addSuccessMessage(__('You deleted the store.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the store. Please try again later.')); + $this->messageManager->addExceptionMessage($e, __('Unable to delete the store. Please try again later.')); } return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php index b31de6cacc5ff..c340b1ec53aa5 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php @@ -15,13 +15,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Store::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store view cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store view cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php index ac470238e588f..8146bfdd41e40 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php @@ -22,11 +22,11 @@ public function execute() /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Store::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store view cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store view cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $model->getId()]); } @@ -37,14 +37,13 @@ public function execute() try { $model->delete(); - $this->_eventManager->dispatch('store_delete', ['store' => $model]); - - $this->messageManager->addSuccess(__('You deleted the store view.')); + $this->messageManager->addSuccessMessage(__('You deleted the store view.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the store view. Please try again later.')); + $this->messageManager + ->addExceptionMessage($e, __('Unable to delete the store view. Please try again later.')); } return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php index 1f2ec4b2ba4b1..d86f57daa396c 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php @@ -15,13 +15,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Website::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This website cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This website cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editWebsite', ['website_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php index c2d24b8c41a8c..1fca5a896e050 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php @@ -23,11 +23,11 @@ public function execute() $redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!$model) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This website cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This website cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editWebsite', ['website_id' => $model->getId()]); } @@ -37,12 +37,12 @@ public function execute() try { $model->delete(); - $this->messageManager->addSuccess(__('You deleted the website.')); + $this->messageManager->addSuccessMessage(__('You deleted the website.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the website. Please try again later.')); + $this->messageManager->addExceptionMessage($e, __('Unable to delete the website. Please try again later.')); } return $redirectResult->setPath('*/*/editWebsite', ['website_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php index cbc068a480865..a8651984cfa63 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php @@ -57,7 +57,7 @@ public function execute() if ($model->getId() || $this->_coreRegistry->registry('store_action') == 'add') { $this->_coreRegistry->register('store_data', $model); if ($this->_coreRegistry->registry('store_action') == 'edit' && $codeBase && !$model->isReadOnly()) { - $this->messageManager->addNotice($codeBase); + $this->messageManager->addNoticeMessage($codeBase); } $resultPage = $this->createPage(); if ($this->_coreRegistry->registry('store_action') == 'add') { @@ -71,7 +71,7 @@ public function execute() )); return $resultPage; } else { - $this->messageManager->addError($notExists); + $this->messageManager->addErrorMessage($notExists); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*/'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php index 1d6862a6ff845..910511c2b275e 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php @@ -32,7 +32,7 @@ private function processWebsiteSave($postData) } $websiteModel->save(); - $this->messageManager->addSuccess(__('You saved the website.')); + $this->messageManager->addSuccessMessage(__('You saved the website.')); return $postData; } @@ -46,7 +46,6 @@ private function processWebsiteSave($postData) */ private function processStoreSave($postData) { - $eventName = 'store_edit'; /** @var \Magento\Store\Model\Store $storeModel */ $storeModel = $this->_objectManager->create(\Magento\Store\Model\Store::class); $postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']); @@ -56,7 +55,6 @@ private function processStoreSave($postData) $storeModel->setData($postData['store']); if ($postData['store']['store_id'] == '') { $storeModel->setId(null); - $eventName = 'store_add'; } $groupModel = $this->_objectManager->create( \Magento\Store\Model\Group::class @@ -70,9 +68,7 @@ private function processStoreSave($postData) ); } $storeModel->save(); - $this->_objectManager->get(\Magento\Store\Model\StoreManager::class)->reinitStores(); - $this->_eventManager->dispatch($eventName, ['store' => $storeModel]); - $this->messageManager->addSuccess(__('You saved the store view.')); + $this->messageManager->addSuccessMessage(__('You saved the store view.')); return $postData; } @@ -102,8 +98,7 @@ private function processGroupSave($postData) ); } $groupModel->save(); - $this->_eventManager->dispatch('store_group_save', ['group' => $groupModel]); - $this->messageManager->addSuccess(__('You saved the store.')); + $this->messageManager->addSuccessMessage(__('You saved the store.')); return $postData; } @@ -139,10 +134,10 @@ public function execute() $redirectResult->setPath('adminhtml/*/'); return $redirectResult; } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $this->_getSession()->setPostData($postData); } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __('Something went wrong while saving. Please review the error log.') ); diff --git a/app/code/Magento/Backend/Helper/Dashboard/Order.php b/app/code/Magento/Backend/Helper/Dashboard/Order.php index 9fc2c2cdb4e6f..c19c28b6e33eb 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Order.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Order.php @@ -13,7 +13,7 @@ * @api * @since 100.0.2 */ -class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard +class Order extends AbstractDashboard { /** * @var \Magento\Reports\Model\ResourceModel\Order\Collection @@ -29,32 +29,25 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection + \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection, + \Magento\Store\Model\StoreManagerInterface $storeManager = null ) { $this->_orderCollection = $orderCollection; - parent::__construct($context); - } + $this->_storeManager = $storeManager ?: ObjectManager::getInstance() + ->get(\Magento\Store\Model\StoreManagerInterface::class); - /** - * The getter function to get the new StoreManager dependency - * - * @return \Magento\Store\Model\StoreManagerInterface - * - * @deprecated 100.1.0 - */ - private function getStoreManager() - { - if ($this->_storeManager === null) { - $this->_storeManager = ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class); - } - return $this->_storeManager; + parent::__construct($context); } /** * @return void + * + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ protected function _initCollection() { @@ -65,15 +58,15 @@ protected function _initCollection() if ($this->getParam('store')) { $this->_collection->addFieldToFilter('store_id', $this->getParam('store')); } elseif ($this->getParam('website')) { - $storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds(); + $storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif ($this->getParam('group')) { - $storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds(); + $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif (!$this->_collection->isLive()) { $this->_collection->addFieldToFilter( 'store_id', - ['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()] + ['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()] ); } $this->_collection->load(); diff --git a/app/code/Magento/Backend/Model/Menu/Builder.php b/app/code/Magento/Backend/Model/Menu/Builder.php index ae572deab53d9..1c6e900bc5cfc 100644 --- a/app/code/Magento/Backend/Model/Menu/Builder.php +++ b/app/code/Magento/Backend/Model/Menu/Builder.php @@ -102,6 +102,6 @@ public function getResult(\Magento\Backend\Model\Menu $menu) */ protected function _getParam($params, $paramName, $defaultValue = null) { - return isset($params[$paramName]) ? $params[$paramName] : $defaultValue; + return $params[$paramName] ?? $defaultValue; } } diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/BackendActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/BackendActionGroup.xml similarity index 79% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/BackendActionGroup.xml rename to app/code/Magento/Backend/Test/Mftf/ActionGroup/BackendActionGroup.xml index 2776abea58fab..93d2ea7fc8d2f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/BackendActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/BackendActionGroup.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml similarity index 77% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginActionGroup.xml rename to app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml index 4367214edbc1b..bcff329d79dad 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml similarity index 80% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml rename to app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml index e9f8d4a3f2b18..7a8b1244c1512 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml new file mode 100644 index 0000000000000..aabc83bec50b7 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml new file mode 100644 index 0000000000000..b7b63c5d9a62e --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/Data/BackendData.xml b/app/code/Magento/Backend/Test/Mftf/Data/BackendData.xml new file mode 100644 index 0000000000000..0eeca081fcbd2 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Data/BackendData.xml @@ -0,0 +1,13 @@ + + + + + + data + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/LICENSE.txt b/app/code/Magento/Backend/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/LICENSE.txt rename to app/code/Magento/Backend/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/LICENSE_AFL.txt b/app/code/Magento/Backend/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/LICENSE_AFL.txt rename to app/code/Magento/Backend/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml new file mode 100644 index 0000000000000..05073acff3ca9 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml @@ -0,0 +1,17 @@ + + + + + +
+ + +
+ + diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml new file mode 100644 index 0000000000000..8eb7c3f897768 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml @@ -0,0 +1,13 @@ + + + + + +
+ + diff --git a/app/code/Magento/Backend/Test/Mftf/README.md b/app/code/Magento/Backend/Test/Mftf/README.md new file mode 100644 index 0000000000000..ed8a3a3bc2c49 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Backend Functional Tests + +The Functional Test Module for **Magento Backend** module. diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Section/AdminConfirmationModalSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml similarity index 77% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Section/AdminConfirmationModalSection.xml rename to app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml index f7b2f246b55be..dc512e66528ac 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Section/AdminConfirmationModalSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml new file mode 100644 index 0000000000000..3e8f8a8f2e412 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml @@ -0,0 +1,14 @@ + + + + +
+ +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml new file mode 100644 index 0000000000000..92b06878ab87f --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml @@ -0,0 +1,14 @@ + + + + +
+ +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml new file mode 100644 index 0000000000000..b65a969e334c4 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml @@ -0,0 +1,16 @@ + + + + +
+ + + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml new file mode 100644 index 0000000000000..f8d259cc8e490 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml new file mode 100644 index 0000000000000..84709e92d9bbd --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminPromptModalSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminPromptModalSection.xml new file mode 100644 index 0000000000000..ec351e0d98fe5 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminPromptModalSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Test/AdminLoginTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml similarity index 87% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Test/AdminLoginTest.xml rename to app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml index 9387b8da659ef..1eb455937f89b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Test/AdminLoginTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/composer.json b/app/code/Magento/Backend/Test/Mftf/composer.json new file mode 100644 index 0000000000000..c77f5a21f37fd --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/composer.json @@ -0,0 +1,34 @@ +{ + "name": "magento/functional-test-module-backend", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/functional-test-module-directory": "100.0.0-dev", + "magento/functional-test-module-developer": "100.0.0-dev", + "magento/functional-test-module-eav": "100.0.0-dev", + "magento/functional-test-module-reports": "100.0.0-dev", + "magento/functional-test-module-sales": "100.0.0-dev", + "magento/functional-test-module-quote": "100.0.0-dev", + "magento/functional-test-module-catalog": "100.0.0-dev", + "magento/functional-test-module-user": "100.0.0-dev", + "magento/functional-test-module-security": "100.0.0-dev", + "magento/functional-test-module-backup": "100.0.0-dev", + "magento/functional-test-module-customer": "100.0.0-dev", + "magento/functional-test-module-translation": "100.0.0-dev", + "magento/functional-test-module-require-js": "100.0.0-dev", + "magento/functional-test-module-config": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "suggest": { + "magento/functional-test-module-theme": "100.0.0-dev" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/AuthenticationTest.php b/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/AuthenticationTest.php index 7e4c426de9452..88b994a6b93b7 100644 --- a/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/AuthenticationTest.php +++ b/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/AuthenticationTest.php @@ -146,6 +146,9 @@ public function testProcessNotLoggedInUser($isIFrameParam, $isAjaxParam, $isForw $this->assertEquals($expectedResult, $this->plugin->aroundDispatch($subject, $proceed, $request)); } + /** + * @return array + */ public function processNotLoggedInUserDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/MassactionKeyTest.php b/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/MassactionKeyTest.php index 2f808eaf2d1b8..d793a80cdeacf 100644 --- a/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/MassactionKeyTest.php +++ b/app/code/Magento/Backend/Test/Unit/App/Action/Plugin/MassactionKeyTest.php @@ -74,6 +74,9 @@ public function testBeforeDispatchWhenMassactionPrepareKeyRequestExists($postDat $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); } + /** + * @return array + */ public function beforeDispatchDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/App/Action/Stub/ActionStub.php b/app/code/Magento/Backend/Test/Unit/App/Action/Stub/ActionStub.php index 4eff6218961af..2d60bef3f3e8c 100644 --- a/app/code/Magento/Backend/Test/Unit/App/Action/Stub/ActionStub.php +++ b/app/code/Magento/Backend/Test/Unit/App/Action/Stub/ActionStub.php @@ -8,6 +8,9 @@ class ActionStub extends \Magento\Backend\App\Action { + /** + * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|void + */ public function execute() { // Empty method stub for test diff --git a/app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php b/app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php index bc7dce6f20bac..642c6283decae 100644 --- a/app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php +++ b/app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php @@ -118,6 +118,9 @@ public function testIsHostBackend($url, $host, $useCustomAdminUrl, $customAdminU $this->assertEquals($this->model->isHostBackend(), $expectedValue); } + /** + * @return array + */ public function hostsDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/App/ConfigTest.php b/app/code/Magento/Backend/Test/Unit/App/ConfigTest.php index 114c57867badf..53640a81e722f 100644 --- a/app/code/Magento/Backend/Test/Unit/App/ConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/App/ConfigTest.php @@ -70,6 +70,9 @@ public function testIsSetFlag($configPath, $configValue, $expectedResult) $this->assertEquals($expectedResult, $this->model->isSetFlag($configPath)); } + /** + * @return array + */ public function isSetFlagDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/AnchorRendererTest.php b/app/code/Magento/Backend/Test/Unit/Block/AnchorRendererTest.php index f52f4ab337712..eccb08e788a95 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/AnchorRendererTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/AnchorRendererTest.php @@ -141,6 +141,9 @@ public function testRenderAnchorLevelIsNotOne($hasTarget) ); } + /** + * @return array + */ public function targetDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Cache/AdditionalTest.php b/app/code/Magento/Backend/Test/Unit/Block/Cache/AdditionalTest.php index 160cfe609f85f..7a56536eaef44 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Cache/AdditionalTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Cache/AdditionalTest.php @@ -88,6 +88,9 @@ public function testIsInProductionMode($mode, $expected) $this->assertEquals($expected, $this->additonalBlock->isInProductionMode()); } + /** + * @return array + */ public function isInProductionModeDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/GlobalSearchTest.php b/app/code/Magento/Backend/Test/Unit/Block/GlobalSearchTest.php index 0010ffad87524..f08a0098578b9 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/GlobalSearchTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/GlobalSearchTest.php @@ -103,6 +103,9 @@ public function testGetEntitiesToShow(array $results, int $expectedEntitiesQty) $this->assertSame($expectedEntitiesQty, count($this->globalSearch->getEntitiesToShow())); } + /** + * @return array + */ public function getEntitiesToShowDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/MenuItemCheckerTest.php b/app/code/Magento/Backend/Test/Unit/Block/MenuItemCheckerTest.php index a79050faeb84a..aca719b2e65e9 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/MenuItemCheckerTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/MenuItemCheckerTest.php @@ -74,6 +74,9 @@ public function testIsItemActiveLevelNotZero() ); } + /** + * @return array + */ public function dataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php index bcf5d1adbc12b..e64d1a97af4ae 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php @@ -61,6 +61,9 @@ public function testGetAttributesHtml($data, $expect) $this->assertRegExp($expect, $attributes); } + /** + * @return array + */ public function getAttributesHtmlDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php index 35e21d7d194aa..81f104dbb636b 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php @@ -54,6 +54,9 @@ public function testRender(array $rowData, $expectedResult) $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\DataObject($rowData))); } + /** + * @return array + */ public function renderDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php index 67ead0ddd8f35..6f838634c6bed 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/RadioTest.php @@ -63,6 +63,9 @@ public function testRender(array $rowData, $expectedResult) $this->assertEquals($expectedResult, $this->_object->render(new \Magento\Framework\DataObject($rowData))); } + /** + * @return array + */ public function renderDataProvider() { return [ 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 c5c56fd75fbe7..2e6bed4783e7f 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 @@ -86,6 +86,9 @@ public function testGetSortable($value) $this->assertFalse($this->_block->getSortable()); } + /** + * @return array + */ public function getSortableDataProvider() { return ['zero' => ['0'], 'false' => [false], 'null' => [null]]; @@ -374,6 +377,9 @@ public function testColumnIsGrouped($groupedData, $expected) $this->assertEquals($expected, $block->isGrouped()); } + /** + * @return array + */ public function columnGroupedDataProvider() { return [[[], false], [['grouped' => 0], false], [['grouped' => 1], true]]; diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Massaction/ExtendedTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Massaction/ExtendedTest.php index 4525de1fee542..f81928c4540ba 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Massaction/ExtendedTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Massaction/ExtendedTest.php @@ -152,6 +152,9 @@ public function testGetGridIdsJsonWithUseSelectAll(array $items, $result) $this->assertEquals($result, $this->_block->getGridIdsJson()); } + /** + * @return array + */ public function dataProviderGetGridIdsJsonWithUseSelectAll() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php index 29ce448a04ecb..e8143b5f6b43a 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php @@ -243,6 +243,9 @@ public function testSelected($param, $expectedJson, $expected) $this->assertEquals($expected, $this->_block->getSelected()); } + /** + * @return array + */ public function selectedDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Block/Widget/TabTest.php b/app/code/Magento/Backend/Test/Unit/Block/Widget/TabTest.php index 1670233324f8e..ad7c6fa99afd2 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Widget/TabTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Widget/TabTest.php @@ -34,6 +34,9 @@ public function testGetters($method, $field, $value, $expected) $this->assertEquals($expected, $object->{$method}()); } + /** + * @return array + */ public function dataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php index b1911da024227..ac0f4a2f467c8 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php @@ -38,7 +38,7 @@ public function testExecute() $messageManagerParams = $helper->getConstructArguments(\Magento\Framework\Message\Manager::class); $messageManagerParams['exceptionMessageFactory'] = $exceptionMessageFactory; $messageManager = $this->getMockBuilder(\Magento\Framework\Message\Manager::class) - ->setMethods(['addSuccess']) + ->setMethods(['addSuccessMessage']) ->setConstructorArgs($messageManagerParams) ->getMock(); @@ -86,7 +86,7 @@ public function testExecute() $mergeService->expects($this->once())->method('cleanMergedJsCss'); $messageManager->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('The JavaScript/CSS cache has been cleaned.'); $valueMap = [ diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php index 40d9ca1aa8996..fc457cd9681e6 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php @@ -76,7 +76,7 @@ public function testExecute() ->with('clean_static_files_cache_after'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('The static files cache has been cleaned.'); $resultRedirect = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Redirect::class) diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php index 556db311748bd..9a42d0acdba89 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php @@ -155,7 +155,7 @@ public function testExecuteInvalidTypeCache() ->willReturn(['someCache']); $this->messageManagerMock->expects($this->once()) - ->method('addError') + ->method('addErrorMessage') ->with('Specified cache type(s) don\'t exist: someCache') ->willReturnSelf(); @@ -175,7 +175,7 @@ public function testExecuteWithException() ->willThrowException($exception); $this->messageManagerMock->expects($this->once()) - ->method('addException') + ->method('addExceptionMessage') ->with($exception, 'An error occurred while disabling cache.') ->willReturnSelf(); @@ -215,7 +215,7 @@ public function testExecuteSuccess() ->method('persist'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('1 cache type(s) disabled.') ->willReturnSelf(); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php index ad622ca69757a..23cf6a9a0a70a 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php @@ -155,7 +155,7 @@ public function testExecuteInvalidTypeCache() ->willReturn(['someCache']); $this->messageManagerMock->expects($this->once()) - ->method('addError') + ->method('addErrorMessage') ->with('Specified cache type(s) don\'t exist: someCache') ->willReturnSelf(); @@ -175,7 +175,7 @@ public function testExecuteWithException() ->willThrowException($exception); $this->messageManagerMock->expects($this->once()) - ->method('addException') + ->method('addExceptionMessage') ->with($exception, 'An error occurred while enabling cache.') ->willReturnSelf(); @@ -215,7 +215,7 @@ public function testExecuteSuccess() ->method('persist'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('1 cache type(s) enabled.') ->willReturnSelf(); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php index dbd1cbe5ec8ec..6049ef76fb183 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php @@ -21,8 +21,7 @@ protected function assertExecute($controllerName, $blockName) { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $outPut = "data"; - $resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents']) - ; + $resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents']); $resultRawFactoryMock = $this->createPartialMock(\Magento\Framework\Controller\Result\RawFactory::class, ['create']); $layoutFactoryMock = $this->createPartialMock(\Magento\Framework\View\LayoutFactory::class, ['create']); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php index e8dcc00345fc6..a985681919f0b 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php @@ -107,7 +107,7 @@ public function testExecute() $this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect); $this->messageManager->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with(__('We updated lifetime statistic.')); $this->objectManager->expects($this->any()) diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php index 844a821df1c20..a8490d6ba2e58 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php @@ -71,7 +71,7 @@ protected function setUp() ->getMock(); $this->_messagesMock = $this->getMockBuilder(\Magento\Framework\Message\Manager::class) ->disableOriginalConstructor() - ->setMethods(['addSuccess']) + ->setMethods(['addSuccessMessage']) ->getMockForAbstractClass(); $this->_authSessionMock = $this->getMockBuilder(\Magento\Backend\Model\Auth\Session::class) @@ -221,7 +221,7 @@ public function testSaveAction() $this->_requestMock->setParams($requestParams); - $this->_messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage)); + $this->_messagesMock->expects($this->once())->method('addSuccessMessage')->with($this->equalTo($testedMessage)); $this->_controller->execute(); } diff --git a/app/code/Magento/Backend/Test/Unit/Helper/DataTest.php b/app/code/Magento/Backend/Test/Unit/Helper/DataTest.php index b7a33ab883b69..50c3a8571b48f 100644 --- a/app/code/Magento/Backend/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Backend/Test/Unit/Helper/DataTest.php @@ -60,6 +60,9 @@ public function testPrepareFilterStringValues(array $inputString, array $expecte $this->assertEquals($expected, $actual); } + /** + * @return array + */ public function getPrepareFilterStringValuesDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php b/app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php index 391deac5a1f4e..f1a4bc355b08e 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php @@ -120,6 +120,9 @@ public function testRefreshAcl($isUserPassedViaParams) $this->assertSame($aclMock, $this->session->getAcl()); } + /** + * @return array + */ public function refreshAclDataProvider() { return [ @@ -234,6 +237,9 @@ public function testIsAllowed($isUserDefined, $isAclDefined, $isAllowed, $expect $this->assertEquals($expectedResult, $this->session->isAllowed('resource')); } + /** + * @return array + */ public function isAllowedDataProvider() { return [ @@ -254,6 +260,9 @@ public function testFirstPageAfterLogin($isFirstPageAfterLogin) $this->assertEquals($isFirstPageAfterLogin, $this->session->isFirstPageAfterLogin()); } + /** + * @return array + */ public function firstPageAfterLoginDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php b/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php index 2f0102ffd410d..4695ef00d5d05 100755 --- a/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php @@ -28,6 +28,9 @@ public function testBeforeSave($value, $errorMessage = null) $this->assertEquals($model, $object); } + /** + * @return array + */ public function adminSessionLifetimeDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Model/Menu/ConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/Menu/ConfigTest.php index bc18bd44f4be4..a6b728ceb392f 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Menu/ConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Menu/ConfigTest.php @@ -140,6 +140,9 @@ public function testGetMenuExceptionLogged($expectedException) $this->model->getMenu(); } + /** + * @return array + */ public function getMenuExceptionLoggedDataProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Model/Menu/Item/ValidatorTest.php b/app/code/Magento/Backend/Test/Unit/Model/Menu/Item/ValidatorTest.php index 3c1f1e43900be..dec85f4b98e3d 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Menu/Item/ValidatorTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Menu/Item/ValidatorTest.php @@ -79,6 +79,9 @@ public function testValidateWithMissingRequiredParamThrowsException($requiredPar } } + /** + * @return array + */ public function requiredParamsProvider() { return [['id'], ['title'], ['resource']]; @@ -102,6 +105,9 @@ public function testValidateWithNonValidPrimitivesThrowsException($param, $inval } } + /** + * @return array + */ public function invalidParamsProvider() { return [ diff --git a/app/code/Magento/Backend/Test/Unit/Model/MenuBuilderTest.php b/app/code/Magento/Backend/Test/Unit/Model/MenuBuilderTest.php index 23d1ed5da1425..5d026a2b1fc32 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/MenuBuilderTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/MenuBuilderTest.php @@ -35,6 +35,9 @@ public function testAfterGetResult($isPub, $times) ); } + /** + * @return array + */ public function afterGetResultDataProvider() { return [[true, 1], [false, 0],]; diff --git a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php index 49fcdf4fc8770..00ae8c2f44a69 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php @@ -136,6 +136,9 @@ public function testSetSessionSettingsByConstructor($secureRequest) $this->assertSame($secureRequest, $adminConfig->getCookieSecure()); } + /** + * @return array + */ public function requestSecureDataProvider() { return [[true], [false]]; diff --git a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/ParserTest.php b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/ParserTest.php index 569c5ffc16c9c..98f1965477b2c 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/ParserTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Widget/Grid/ParserTest.php @@ -58,6 +58,9 @@ public function testIsOperation($operation, $expected) $this->assertEquals($expected, $this->_model->isOperation($operation)); } + /** + * @return array + */ public function isOperationDataProvider() { return [ diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index a1aa348712626..4494e51b9337c 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -24,7 +24,7 @@ "magento/module-theme": "100.2.*" }, "type": "magento2-module", - "version": "100.2.4", + "version": "100.2.5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 1f642293214fe..0e76031c9b75e 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -181,7 +181,7 @@ - + Magento\Config\Model\Config\Source\Image\Adapter Magento\Config\Model\Config\Backend\Image\Adapter @@ -298,11 +298,11 @@ Magento\Config\Model\Config\Source\Yesno - + For Windows server only. - + For Windows server only. @@ -319,6 +319,19 @@ + + + + + validate-greater-than-zero validate-number required-entry + Maximum allowed width for uploaded image. + + + + validate-greater-than-zero validate-number required-entry + Maximum allowed height for uploaded image. + +
@@ -416,10 +429,10 @@ Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Store - Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]> + Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]> - + Magento\Config\Model\Config\Source\Web\Redirect I.e. redirect from http://example.com/store/ to http://www.example.com/store/ @@ -432,7 +445,7 @@ Magento\Config\Model\Config\Source\Yesno - + Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. http://example.com/magento/ @@ -440,7 +453,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{unsecure_base_url}} placeholder. @@ -450,13 +463,13 @@ Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{unsecure_base_url}} placeholder. - + Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. https://example.com/magento/ @@ -464,7 +477,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{secure_base_url}} or {{unsecure_base_url}} placeholder. @@ -474,24 +487,24 @@ Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure Enter https protocol to use Secure URLs on Storefront. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure Enter https protocol to use Secure URLs in Admin. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure @@ -501,7 +514,7 @@ 1 - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index b7aaf8bf20dba..45d283ad3ff22 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -28,6 +28,10 @@ 1 + + 1920 + 1200 + diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 57e00489391f2..8e79c16a73d2d 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -9,6 +9,7 @@ + diff --git a/app/code/Magento/Backend/i18n/en_US.csv b/app/code/Magento/Backend/i18n/en_US.csv index aa28a670b9205..ac3c36e0e8f82 100644 --- a/app/code/Magento/Backend/i18n/en_US.csv +++ b/app/code/Magento/Backend/i18n/en_US.csv @@ -405,9 +405,9 @@ Web,Web "Url Options","Url Options" "Add Store Code to Urls","Add Store Code to Urls" " - Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.). + Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.). "," - Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.). + Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.). " "Auto-redirect to Base URL","Auto-redirect to Base URL" "Search Engine Optimization","Search Engine Optimization" @@ -447,7 +447,7 @@ Tags,Tags "

404 Error

Page not found.

","

404 Error

Page not found.

" "Community Edition","Community Edition" "Default Theme","Default Theme" -"If no value is specified, the system default is used. The system default may be modified by third party extensions.","If no value is specified, the system default is used. The system default may be modified by third party extensions." +"If no value is specified, the system default is used. The system default may be modified by third-party extensions.","If no value is specified, the system default is used. The system default may be modified by third-party extensions." "Applied Theme","Applied Theme" "Design Rule","Design Rule" "User Agent Rules","User Agent Rules" diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 1e14dd837634a..966372773f295 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -13,8 +13,8 @@ data-mage-init='{ "Magento_Backend/js/media-uploader" : { "maxFileSize": getFileSizeService()->getMaxFileSize() ?>, - "maxWidth": , - "maxHeight": + "maxWidth":getImageUploadMaxWidth() ?> , + "maxHeight": getImageUploadMaxHeight() ?> } }' > 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 8feccc9cf1b8f..f952001f5e2ff 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -17,7 +17,7 @@ class="logo"> <?= $block->escapeHtml(__('Magento Admin Panel')) ?> + alt="escapeHtml(__('Magento Admin Panel')) ?>" title="escapeHtml(__('Magento Admin Panel')) ?>"/> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml index 4f8d9a56a38a3..e11c0efc123ff 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml @@ -34,7 +34,7 @@ getValues()->getAttributeBackend()->getImageTypes() as $type): ?> - <?= /* @escapeNotVerified */ $image->getValue() ?>
+ <?= /* @escapeNotVerified */ $image->getValue() ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml index 19a4ab1388006..79c987383299f 100644 --- a/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml @@ -12,7 +12,7 @@ - If no value is specified, the system default is used. The system default may be modified by third party extensions. + If no value is specified, the system default is used. The system default may be modified by third-party extensions. text theme_theme_id @@ -92,7 +92,7 @@ - + false diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php index 0bd7ef3d82ade..65ea398b74c42 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php @@ -82,7 +82,7 @@ public function execute() $backupManager->create(); - $this->messageManager->addSuccess($successMessage); + $this->messageManager->addSuccessMessage($successMessage); $response->setRedirectUrl($this->getUrl('*/*/index')); } catch (\Magento\Framework\Backup\Exception\NotEnoughFreeSpace $e) { diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php index 04292d2759093..90657fc2490ba 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/MassDelete.php @@ -49,13 +49,13 @@ public function execute() $resultData->setIsSuccess(true); if ($allBackupsDeleted) { - $this->messageManager->addSuccess(__('You deleted the selected backup(s).')); + $this->messageManager->addSuccessMessage(__('You deleted the selected backup(s).')); } else { throw new \Exception($deleteFailMessage); } } catch (\Exception $e) { $resultData->setIsSuccess(false); - $this->messageManager->addError($deleteFailMessage); + $this->messageManager->addErrorMessage($deleteFailMessage); } return $this->_redirect('backup/*/index'); diff --git a/app/code/Magento/Backup/Helper/Data.php b/app/code/Magento/Backup/Helper/Data.php index 3d60bf9d9c9cf..b0bc292ffe926 100644 --- a/app/code/Magento/Backup/Helper/Data.php +++ b/app/code/Magento/Backup/Helper/Data.php @@ -110,7 +110,7 @@ public function getBackupsDir() public function getExtensionByType($type) { $extensions = $this->getExtensions(); - return isset($extensions[$type]) ? $extensions[$type] : ''; + return $extensions[$type] ?? ''; } /** diff --git a/app/code/Magento/Backup/Model/ResourceModel/Db.php b/app/code/Magento/Backup/Model/ResourceModel/Db.php index f50a3c5b091ad..57748a979c08f 100644 --- a/app/code/Magento/Backup/Model/ResourceModel/Db.php +++ b/app/code/Magento/Backup/Model/ResourceModel/Db.php @@ -115,7 +115,7 @@ public function getTableForeignKeysSql($tableName = null) } /** - * Return triggers fro table(s) + * Return triggers for table(s) * * @param string|null $tableName * @param bool $addDropIfExists diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backup/LICENSE.txt b/app/code/Magento/Backup/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backup/LICENSE.txt rename to app/code/Magento/Backup/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backup/LICENSE_AFL.txt b/app/code/Magento/Backup/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backup/LICENSE_AFL.txt rename to app/code/Magento/Backup/Test/Mftf/LICENSE_AFL.txt diff --git a/app/code/Magento/Backup/Test/Mftf/README.md b/app/code/Magento/Backup/Test/Mftf/README.md new file mode 100644 index 0000000000000..6951acdf41400 --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Backup Functional Tests + +The Functional Test Module for **Magento Backup** module. diff --git a/app/code/Magento/Backup/Test/Mftf/composer.json b/app/code/Magento/Backup/Test/Mftf/composer.json new file mode 100644 index 0000000000000..4468e4cdf7436 --- /dev/null +++ b/app/code/Magento/Backup/Test/Mftf/composer.json @@ -0,0 +1,19 @@ +{ + "name": "magento/functional-test-module-backup", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/functional-test-module-store": "100.0.0-dev", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/functional-test-module-cron": "100.0.0-dev", + "magento/magento2-functional-testing-framework": "2.2.0" + }, + "type": "magento2-test", + "license": [ + "OSL-3.0", + "AFL-3.0" + ] +} diff --git a/app/code/Magento/Backup/Test/Unit/Model/DbTest.php b/app/code/Magento/Backup/Test/Unit/Model/DbTest.php new file mode 100644 index 0000000000000..0cab5f0ad1e99 --- /dev/null +++ b/app/code/Magento/Backup/Test/Unit/Model/DbTest.php @@ -0,0 +1,243 @@ +dbResourceMock = $this->getMockBuilder(DbResource::class) + ->disableOriginalConstructor() + ->getMock(); + $this->connectionResourceMock = $this->getMockBuilder(ResourceConnection::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->objectManager = new ObjectManager($this); + $this->dbModel = $this->objectManager->getObject( + Db::class, + [ + 'resourceDb' => $this->dbResourceMock, + 'resource' => $this->connectionResourceMock + ] + ); + } + + public function testGetResource() + { + self::assertEquals($this->dbResourceMock, $this->dbModel->getResource()); + } + + public function testGetTables() + { + $tables = []; + $this->dbResourceMock->expects($this->once()) + ->method('getTables') + ->willReturn($tables); + + self::assertEquals($tables, $this->dbModel->getTables()); + } + + public function testGetTableCreateScript() + { + $tableName = 'some_table'; + $script = 'script'; + $this->dbResourceMock->expects($this->once()) + ->method('getTableCreateScript') + ->with($tableName, false) + ->willReturn($script); + + self::assertEquals($script, $this->dbModel->getTableCreateScript($tableName, false)); + } + + public function testGetTableDataDump() + { + $tableName = 'some_table'; + $dump = 'dump'; + $this->dbResourceMock->expects($this->once()) + ->method('getTableDataDump') + ->with($tableName) + ->willReturn($dump); + + self::assertEquals($dump, $this->dbModel->getTableDataDump($tableName)); + } + + public function testGetHeader() + { + $header = 'header'; + $this->dbResourceMock->expects($this->once()) + ->method('getHeader') + ->willReturn($header); + + self::assertEquals($header, $this->dbModel->getHeader()); + } + + public function testGetFooter() + { + $footer = 'footer'; + $this->dbResourceMock->expects($this->once()) + ->method('getFooter') + ->willReturn($footer); + + self::assertEquals($footer, $this->dbModel->getFooter()); + } + + public function testRenderSql() + { + $header = 'header'; + $script = 'script'; + $tableName = 'some_table'; + $tables = [$tableName, $tableName]; + $dump = 'dump'; + $footer = 'footer'; + + $this->dbResourceMock->expects($this->once()) + ->method('getTables') + ->willReturn($tables); + $this->dbResourceMock->expects($this->once()) + ->method('getHeader') + ->willReturn($header); + $this->dbResourceMock->expects($this->exactly(2)) + ->method('getTableCreateScript') + ->with($tableName, true) + ->willReturn($script); + $this->dbResourceMock->expects($this->exactly(2)) + ->method('getTableDataDump') + ->with($tableName) + ->willReturn($dump); + $this->dbResourceMock->expects($this->once()) + ->method('getFooter') + ->willReturn($footer); + + self::assertEquals( + $header . $script . $dump . $script . $dump . $footer, + $this->dbModel->renderSql() + ); + } + + public function testCreateBackup() + { + /** @var BackupInterface|\PHPUnit_Framework_MockObject_MockObject $backupMock */ + $backupMock = $this->getMockBuilder(BackupInterface::class)->getMock(); + /** @var DataObject $tableStatus */ + $tableStatus = new DataObject(); + + $tableName = 'some_table'; + $tables = [$tableName]; + $header = 'header'; + $footer = 'footer'; + $dropSql = 'drop_sql'; + $createSql = 'create_sql'; + $beforeSql = 'before_sql'; + $afterSql = 'after_sql'; + $dataSql = 'data_sql'; + $foreignKeysSql = 'foreign_keys'; + $triggersSql = 'triggers_sql'; + $rowsCount = 2; + $dataLength = 1; + + $this->dbResourceMock->expects($this->once()) + ->method('beginTransaction'); + $this->dbResourceMock->expects($this->once()) + ->method('commitTransaction'); + $this->dbResourceMock->expects($this->once()) + ->method('getTables') + ->willReturn($tables); + $this->dbResourceMock->expects($this->once()) + ->method('getTableDropSql') + ->willReturn($dropSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableCreateSql') + ->with($tableName, false) + ->willReturn($createSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableDataBeforeSql') + ->with($tableName) + ->willReturn($beforeSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableDataAfterSql') + ->with($tableName) + ->willReturn($afterSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableDataSql') + ->with($tableName, $rowsCount, 0) + ->willReturn($dataSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableStatus') + ->with($tableName) + ->willReturn($tableStatus); + $this->dbResourceMock->expects($this->once()) + ->method('getTables') + ->willReturn($createSql); + $this->dbResourceMock->expects($this->once()) + ->method('getHeader') + ->willReturn($header); + $this->dbResourceMock->expects($this->once()) + ->method('getTableHeader') + ->willReturn($header); + $this->dbResourceMock->expects($this->once()) + ->method('getFooter') + ->willReturn($footer); + $this->dbResourceMock->expects($this->once()) + ->method('getTableForeignKeysSql') + ->willReturn($foreignKeysSql); + $this->dbResourceMock->expects($this->once()) + ->method('getTableTriggersSql') + ->willReturn($triggersSql); + $backupMock->expects($this->once()) + ->method('open'); + $backupMock->expects($this->once()) + ->method('close'); + + $tableStatus->setRows($rowsCount); + $tableStatus->setDataLength($dataLength); + + $backupMock->expects($this->any()) + ->method('write') + ->withConsecutive( + [$this->equalTo($header)], + [$this->equalTo($header . $dropSql . "\n")], + [$this->equalTo($createSql . "\n")], + [$this->equalTo($beforeSql)], + [$this->equalTo($dataSql)], + [$this->equalTo($afterSql)], + [$this->equalTo($foreignKeysSql)], + [$this->equalTo($triggersSql)], + [$this->equalTo($footer)] + ); + + $this->dbModel->createBackup($backupMock); + } +} diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index f286c8a6b5ba5..b45fc8d2a2bef 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -9,7 +9,7 @@ "magento/framework": "101.0.*" }, "type": "magento2-module", - "version": "100.2.3", + "version": "100.2.4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Braintree/Gateway/Config/Config.php b/app/code/Magento/Braintree/Gateway/Config/Config.php index 01bb32fbb1a7e..b56021c402263 100644 --- a/app/code/Magento/Braintree/Gateway/Config/Config.php +++ b/app/code/Magento/Braintree/Gateway/Config/Config.php @@ -131,7 +131,7 @@ public function getCountryAvailableCardTypes($country, $storeId = null) */ public function isCvvEnabled($storeId = null) { - return (bool) $this->getValue(self::KEY_USE_CVV, $storeId); + return (bool)$this->getValue(self::KEY_USE_CVV, $storeId); } /** @@ -142,7 +142,7 @@ public function isCvvEnabled($storeId = null) */ public function isVerify3DSecure($storeId = null) { - return (bool) $this->getValue(self::KEY_VERIFY_3DSECURE, $storeId); + return (bool)$this->getValue(self::KEY_VERIFY_3DSECURE, $storeId); } /** @@ -233,7 +233,7 @@ public function getSdkUrl() */ public function hasFraudProtection($storeId = null) { - return (bool) $this->getValue(Config::FRAUD_PROTECTION, $storeId); + return (bool)$this->getValue(Config::FRAUD_PROTECTION, $storeId); } /** @@ -244,7 +244,7 @@ public function hasFraudProtection($storeId = null) */ public function isActive($storeId = null) { - return (bool) $this->getValue(self::KEY_ACTIVE, $storeId); + return (bool)$this->getValue(self::KEY_ACTIVE, $storeId); } /** diff --git a/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php b/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php index e7d8724082fb3..0854ae2d1e363 100644 --- a/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php +++ b/app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php @@ -60,7 +60,7 @@ public function __construct( */ public function isActive() { - return (bool) $this->getValue(self::KEY_ACTIVE); + return (bool)$this->getValue(self::KEY_ACTIVE); } /** @@ -68,7 +68,7 @@ public function isActive() */ public function isDisplayShoppingCart() { - return (bool) $this->getValue(self::KEY_DISPLAY_ON_SHOPPING_CART); + return (bool)$this->getValue(self::KEY_DISPLAY_ON_SHOPPING_CART); } /** @@ -78,7 +78,7 @@ public function isDisplayShoppingCart() */ public function isAllowToEditShippingAddress() { - return (bool) $this->getValue(self::KEY_ALLOW_TO_EDIT_SHIPPING_ADDRESS); + return (bool)$this->getValue(self::KEY_ALLOW_TO_EDIT_SHIPPING_ADDRESS); } /** @@ -117,7 +117,7 @@ public function getTitle() */ public function isSkipOrderReview() { - return (bool) $this->getValue('skip_order_review'); + return (bool)$this->getValue('skip_order_review'); } /** diff --git a/app/code/Magento/Braintree/Gateway/Request/MerchantAccountDataBuilder.php b/app/code/Magento/Braintree/Gateway/Request/MerchantAccountDataBuilder.php new file mode 100644 index 0000000000000..6dc40e76322df --- /dev/null +++ b/app/code/Magento/Braintree/Gateway/Request/MerchantAccountDataBuilder.php @@ -0,0 +1,64 @@ +config = $config; + $this->subjectReader = $subjectReader; + } + + /** + * @inheritdoc + */ + public function build(array $buildSubject): array + { + $paymentDO = $this->subjectReader->readPayment($buildSubject); + $order = $paymentDO->getOrder(); + + $result = []; + $merchantAccountId = $this->config->getMerchantAccountId($order->getStoreId()); + if (!empty($merchantAccountId)) { + $result[self::$merchantAccountId] = $merchantAccountId; + } + + return $result; + } +} diff --git a/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php b/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php index 85a0c64451398..fe75ce86cca2f 100644 --- a/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php +++ b/app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php @@ -6,8 +6,8 @@ namespace Magento\Braintree\Gateway\Request; use Magento\Braintree\Gateway\Config\Config; -use Magento\Braintree\Observer\DataAssignObserver; use Magento\Braintree\Gateway\SubjectReader; +use Magento\Braintree\Observer\DataAssignObserver; use Magento\Payment\Gateway\Request\BuilderInterface; use Magento\Payment\Helper\Formatter; @@ -36,9 +36,8 @@ class PaymentDataBuilder implements BuilderInterface const PAYMENT_METHOD_NONCE = 'paymentMethodNonce'; /** - * The merchant account ID used to create a transaction. - * Currency is also determined by merchant account ID. - * If no merchant account ID is specified, Braintree will use your default merchant account. + * @deprecated + * @see \Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder */ const MERCHANT_ACCOUNT_ID = 'merchantAccountId'; @@ -47,25 +46,18 @@ class PaymentDataBuilder implements BuilderInterface */ const ORDER_ID = 'orderId'; - /** - * @var Config - */ - private $config; - /** * @var SubjectReader */ private $subjectReader; /** - * Constructor - * * @param Config $config * @param SubjectReader $subjectReader + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct(Config $config, SubjectReader $subjectReader) { - $this->config = $config; $this->subjectReader = $subjectReader; } @@ -87,11 +79,6 @@ public function build(array $buildSubject) self::ORDER_ID => $order->getOrderIncrementId() ]; - $merchantAccountId = $this->config->getMerchantAccountId($order->getStoreId()); - if (!empty($merchantAccountId)) { - $result[self::MERCHANT_ACCOUNT_ID] = $merchantAccountId; - } - return $result; } } diff --git a/app/code/Magento/Braintree/Gateway/Response/CardDetailsHandler.php b/app/code/Magento/Braintree/Gateway/Response/CardDetailsHandler.php index e89e604867baa..32abeac4c8ffb 100644 --- a/app/code/Magento/Braintree/Gateway/Response/CardDetailsHandler.php +++ b/app/code/Magento/Braintree/Gateway/Response/CardDetailsHandler.php @@ -85,7 +85,7 @@ public function handle(array $handlingSubject, array $response) private function getCreditCardType($type) { $replaced = str_replace(' ', '-', strtolower($type)); - $mapper = $this->config->getCctypesMapper(); + $mapper = $this->config->getCcTypesMapper(); return $mapper[$replaced]; } diff --git a/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php b/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php index 89bf7f14692b0..ca46e3b0ab93c 100644 --- a/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php +++ b/app/code/Magento/Braintree/Gateway/Response/VaultDetailsHandler.php @@ -156,7 +156,7 @@ private function convertDetailsToJSON($details) private function getCreditCardType($type) { $replaced = str_replace(' ', '-', strtolower($type)); - $mapper = $this->config->getCctypesMapper(); + $mapper = $this->config->getCcTypesMapper(); return $mapper[$replaced]; } diff --git a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php index 6ab69923760ce..5c4a1c9598d1d 100644 --- a/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/ConfigProvider.php @@ -70,7 +70,7 @@ public function getConfig() self::CODE => [ 'isActive' => $this->config->isActive($storeId), 'clientToken' => $this->getClientToken(), - 'ccTypesMapper' => $this->config->getCctypesMapper(), + 'ccTypesMapper' => $this->config->getCcTypesMapper(), 'sdkUrl' => $this->config->getSdkUrl(), 'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig($storeId), 'availableCardTypes' => $this->config->getAvailableCardTypes($storeId), diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Data/BraintreeData.xml b/app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml similarity index 92% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Data/BraintreeData.xml rename to app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml index d5904edd94e9a..6e669a1b8bf4b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Data/BraintreeData.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> SampleTitle SamplePaymentAction diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/LICENSE.txt b/app/code/Magento/Braintree/Test/Mftf/LICENSE.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/LICENSE.txt rename to app/code/Magento/Braintree/Test/Mftf/LICENSE.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/LICENSE_AFL.txt b/app/code/Magento/Braintree/Test/Mftf/LICENSE_AFL.txt similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/LICENSE_AFL.txt rename to app/code/Magento/Braintree/Test/Mftf/LICENSE_AFL.txt diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Metadata/braintree_config-meta.xml b/app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml similarity index 91% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Metadata/braintree_config-meta.xml rename to app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml index dc3e8e6c5dac1..e4d02a58b5bf4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Braintree/Metadata/braintree_config-meta.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> diff --git a/app/code/Magento/Braintree/Test/Mftf/README.md b/app/code/Magento/Braintree/Test/Mftf/README.md new file mode 100644 index 0000000000000..6ee177a9cdcd2 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/README.md @@ -0,0 +1,3 @@ +# Braintree Functional Tests + +The Functional Test Module for **Magento Braintree** module. diff --git a/app/code/Magento/Braintree/Test/Mftf/composer.json b/app/code/Magento/Braintree/Test/Mftf/composer.json new file mode 100644 index 0000000000000..4b110f1bbdf3e --- /dev/null +++ b/app/code/Magento/Braintree/Test/Mftf/composer.json @@ -0,0 +1,33 @@ +{ + "name": "magento/functional-test-module-braintree", + "description": "N/A", + "config": { + "sort-packages": true + }, + "require": { + "php": "~7.0.13|~7.1.0", + "magento/magento2-functional-testing-framework": "2.2.0", + "magento/magento-composer-installer": "100.0.0-dev", + "magento/functional-test-module-config": "100.0.0-dev", + "magento/functional-test-module-directory": "100.0.0-dev", + "magento/functional-test-module-payment": "100.0.0-dev", + "magento/functional-test-module-checkout": "100.0.0-dev", + "magento/functional-test-module-sales": "100.0.0-dev", + "magento/functional-test-module-backend": "100.0.0-dev", + "magento/functional-test-module-vault": "100.0.0-dev", + "magento/functional-test-module-instant-purchase": "100.0.0-dev", + "magento/functional-test-module-customer": "100.0.0-dev", + "magento/functional-test-module-catalog": "100.0.0-dev", + "magento/functional-test-module-quote": "100.0.0-dev", + "magento/functional-test-module-paypal": "100.0.0-dev", + "magento/functional-test-module-ui": "100.0.0-dev" + }, + "suggest": { + "magento/functional-test-module-checkout-agreements": "100.0.0-dev", + "magento/functional-test-module-theme": "100.0.0-dev" + }, + "type": "magento2-test", + "license": [ + "proprietary" + ] +} diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Config/ConfigTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Config/ConfigTest.php index 7b9d59a5bc482..36ea3aea465dd 100644 --- a/app/code/Magento/Braintree/Test/Unit/Gateway/Config/ConfigTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Config/ConfigTest.php @@ -142,7 +142,7 @@ public function testGetCcTypesMapper($value, $expected) static::assertEquals( $expected, - $this->model->getCctypesMapper() + $this->model->getCcTypesMapper() ); } diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php new file mode 100644 index 0000000000000..038687d8821d7 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php @@ -0,0 +1,89 @@ +getMockForAbstractClass(LoggerInterface::class); + /** @var Logger|\PHPUnit_Framework_MockObject_MockObject $loggerMock */ + $loggerMock = $this->getMockBuilder(Logger::class) + ->disableOriginalConstructor() + ->getMock(); + $this->adapterMock = $this->getMockBuilder(BraintreeAdapter::class) + ->disableOriginalConstructor() + ->getMock(); + /** @var BraintreeAdapterFactory|MockObject $adapterFactoryMock */ + $adapterFactoryMock = $this->getMockBuilder(BraintreeAdapterFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $adapterFactoryMock->method('create') + ->willReturn($this->adapterMock); + + $this->transactionRefundModel = new TransactionRefund($criticalLoggerMock, $loggerMock, $adapterFactoryMock); + } + + /** + * @throws ClientException + * @throws ConverterException + */ + public function testRefundRequestWithStoreId() + { + $transactionId = '11223344'; + $refundAmount = 10; + $data = [ + 'store_id' => 0, + 'transaction_id' => $transactionId, + PaymentDataBuilder::AMOUNT => $refundAmount + ]; + $successfulResponse = new Successful(); + + /** @var TransferInterface|\PHPUnit_Framework_MockObject_MockObject $transferObjectMock */ + $transferObjectMock = $this->createMock(TransferInterface::class); + $transferObjectMock->method('getBody') + ->willReturn($data); + $this->adapterMock->expects($this->once()) + ->method('refund') + ->with($transactionId, $refundAmount) + ->willReturn($successfulResponse); + + $response = $this->transactionRefundModel->placeRequest($transferObjectMock); + + self::assertEquals($successfulResponse, $response['object']); + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionVoidTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionVoidTest.php new file mode 100644 index 0000000000000..8291806d2a6e0 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Http/Client/TransactionVoidTest.php @@ -0,0 +1,86 @@ +getMockForAbstractClass(LoggerInterface::class); + /** @var Logger|\PHPUnit_Framework_MockObject_MockObject $loggerMock */ + $loggerMock = $this->getMockBuilder(Logger::class) + ->disableOriginalConstructor() + ->getMock(); + $this->adapterMock = $this->getMockBuilder(BraintreeAdapter::class) + ->disableOriginalConstructor() + ->getMock(); + /** @var BraintreeAdapterFactory|MockObject $adapterFactoryMock */ + $adapterFactoryMock = $this->getMockBuilder(BraintreeAdapterFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $adapterFactoryMock->method('create') + ->willReturn($this->adapterMock); + + $this->transactionVoidModel = new TransactionVoid($criticalLoggerMock, $loggerMock, $adapterFactoryMock); + } + + /** + * @throws ClientException + * @throws ConverterException + */ + public function testVoidRequestWithStoreId() + { + $transactionId = '11223344'; + $data = [ + 'store_id' => 0, + 'transaction_id' => $transactionId + ]; + $successfulResponse = new Successful(); + + /** @var TransferInterface|\PHPUnit_Framework_MockObject_MockObject $transferObjectMock */ + $transferObjectMock = $this->createMock(TransferInterface::class); + $transferObjectMock->method('getBody') + ->willReturn($data); + $this->adapterMock->expects($this->once()) + ->method('void') + ->with($transactionId) + ->willReturn($successfulResponse); + + $response = $this->transactionVoidModel->placeRequest($transferObjectMock); + + self::assertEquals($successfulResponse, $response['object']); + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php index 16f11559f73cc..62ef402e9ca9f 100644 --- a/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php @@ -5,14 +5,14 @@ */ namespace Magento\Braintree\Test\Unit\Gateway\Request; -use Magento\Braintree\Gateway\Config\Config; -use Magento\Braintree\Gateway\SubjectReader; use Magento\Braintree\Gateway\Request\PaymentDataBuilder; +use Magento\Braintree\Gateway\SubjectReader; use Magento\Braintree\Observer\DataAssignObserver; use Magento\Payment\Gateway\Data\OrderAdapterInterface; use Magento\Payment\Gateway\Data\PaymentDataObjectInterface; use Magento\Sales\Model\Order\Payment; use PHPUnit_Framework_MockObject_MockObject as MockObject; +use Magento\Braintree\Gateway\Config\Config; /** * Class PaymentDataBuilderTest @@ -29,11 +29,6 @@ class PaymentDataBuilderTest extends \PHPUnit\Framework\TestCase */ private $builder; - /** - * @var Config|MockObject - */ - private $config; - /** * @var Payment|MockObject */ @@ -52,15 +47,16 @@ class PaymentDataBuilderTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->paymentDO = $this->createMock(PaymentDataObjectInterface::class); - $this->config = $this->getMockBuilder(Config::class) - ->disableOriginalConstructor() - ->getMock(); $this->payment = $this->getMockBuilder(Payment::class) ->disableOriginalConstructor() ->getMock(); $this->order = $this->createMock(OrderAdapterInterface::class); - $this->builder = new PaymentDataBuilder($this->config, new SubjectReader()); + $config = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->builder = new PaymentDataBuilder($config, new SubjectReader()); } /** @@ -98,8 +94,7 @@ public function testBuild() $expectedResult = [ PaymentDataBuilder::AMOUNT => 10.00, PaymentDataBuilder::PAYMENT_METHOD_NONCE => self::PAYMENT_METHOD_NONCE, - PaymentDataBuilder::ORDER_ID => '000000101', - PaymentDataBuilder::MERCHANT_ACCOUNT_ID => self::MERCHANT_ACCOUNT_ID, + PaymentDataBuilder::ORDER_ID => '000000101' ]; $buildSubject = [ @@ -111,9 +106,6 @@ public function testBuild() ->method('getAdditionalInformation') ->willReturnMap($additionalData); - $this->config->method('getMerchantAccountId') - ->willReturn(self::MERCHANT_ACCOUNT_ID); - $this->paymentDO->method('getPayment') ->willReturn($this->payment); diff --git a/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/AvailabilityCheckerTest.php b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/AvailabilityCheckerTest.php new file mode 100644 index 0000000000000..2248aab1aad2e --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/AvailabilityCheckerTest.php @@ -0,0 +1,70 @@ +configMock = $this->createMock(Config::class); + $this->availabilityChecker = new AvailabilityChecker($this->configMock); + } + + /** + * Test isAvailable method + * + * @dataProvider isAvailableDataProvider + * + * @param bool $isVerify3DSecure + * @param bool $expected + * + * @return void + */ + public function testIsAvailable(bool $isVerify3DSecure, bool $expected) + { + $this->configMock->expects($this->once())->method('isVerify3DSecure')->willReturn($isVerify3DSecure); + $actual = $this->availabilityChecker->isAvailable(); + self::assertEquals($expected, $actual); + } + + /** + * Data provider for isAvailable method test + * + * @return array + */ + public function isAvailableDataProvider() + { + return [ + [true, false], + [false, true], + ]; + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/TokenFormatterTest.php b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/TokenFormatterTest.php new file mode 100644 index 0000000000000..a5c7cd743d85f --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/CreditCard/TokenFormatterTest.php @@ -0,0 +1,119 @@ + 'visa', + 'maskedCC' => '1111************9999', + 'expirationDate' => '01-01-2020' + ]; + + /** + * Set Up + * + * @return void + */ + protected function setUp() + { + $this->paymentTokenMock = $this->getMockBuilder(PaymentTokenInterface::class) + ->getMockForAbstractClass(); + + $this->creditCardTokenFormatter = new CreditCardTokenFormatter(); + } + + /** + * Testing the payment format with a known credit card type + * + * @return void + */ + public function testFormatPaymentTokenWithKnownCardType() + { + $this->tokenDetails['type'] = key(CreditCardTokenFormatter::$baseCardTypes); + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + + $formattedString = sprintf( + '%s: %s, %s: %s (%s: %s)', + __('Credit Card'), + reset(CreditCardTokenFormatter::$baseCardTypes), + __('ending'), + $this->tokenDetails['maskedCC'], + __('expires'), + $this->tokenDetails['expirationDate'] + ); + + self::assertEquals( + $formattedString, + $this->creditCardTokenFormatter->formatPaymentToken($this->paymentTokenMock) + ); + } + + /** + * Testing the payment format with a unknown credit card type + * + * @return void + */ + public function testFormatPaymentTokenWithUnknownCardType() + { + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + + $formattedString = sprintf( + '%s: %s, %s: %s (%s: %s)', + __('Credit Card'), + $this->tokenDetails['type'], + __('ending'), + $this->tokenDetails['maskedCC'], + __('expires'), + $this->tokenDetails['expirationDate'] + ); + + self::assertEquals( + $formattedString, + $this->creditCardTokenFormatter->formatPaymentToken($this->paymentTokenMock) + ); + } + + /** + * Testing the payment format with wrong card data + * + * @return void + */ + public function testFormatPaymentTokenWithWrongData() + { + unset($this->tokenDetails['type']); + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + self::expectException('\InvalidArgumentException'); + + $this->creditCardTokenFormatter->formatPaymentToken($this->paymentTokenMock); + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PayPal/TokenFormatterTest.php b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PayPal/TokenFormatterTest.php new file mode 100644 index 0000000000000..e552f4f39f1c4 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PayPal/TokenFormatterTest.php @@ -0,0 +1,92 @@ + 'visa', + 'maskedCC' => '4444************9999', + 'expirationDate' => '07-07-2025' + ]; + + protected function setUp() + { + $this->paymentTokenMock = $this->getMockBuilder(PaymentTokenInterface::class) + ->getMockForAbstractClass(); + + $this->paypalTokenFormatter = new PaypalTokenFormatter(); + } + + public function testFormatPaymentTokenWithKnownCardType() + { + $this->tokenDetails['type'] = key(PaypalTokenFormatter::$baseCardTypes); + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + + $formattedString = sprintf( + '%s: %s, %s: %s (%s: %s)', + __('Credit Card'), + reset(PaypalTokenFormatter::$baseCardTypes), + __('ending'), + $this->tokenDetails['maskedCC'], + __('expires'), + $this->tokenDetails['expirationDate'] + ); + + self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock)); + } + + public function testFormatPaymentTokenWithUnknownCardType() + { + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + + $formattedString = sprintf( + '%s: %s, %s: %s (%s: %s)', + __('Credit Card'), + $this->tokenDetails['type'], + __('ending'), + $this->tokenDetails['maskedCC'], + __('expires'), + $this->tokenDetails['expirationDate'] + ); + + self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock)); + } + + public function testFormatPaymentTokenWithWrongData() + { + unset($this->tokenDetails['type']); + + $this->paymentTokenMock->expects($this->once()) + ->method('getTokenDetails') + ->willReturn(json_encode($this->tokenDetails)); + self::expectException('\InvalidArgumentException'); + + $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock); + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PaymentAdditionalInformationProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PaymentAdditionalInformationProviderTest.php new file mode 100644 index 0000000000000..2631fcbe5f5b5 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/InstantPurchase/PaymentAdditionalInformationProviderTest.php @@ -0,0 +1,83 @@ +getPaymentNonceCommandMock = $this->createMock(GetPaymentNonceCommand::class); + $this->paymentTokenMock = $this->createMock(PaymentTokenInterface::class); + $this->arrayResultMock = $this->createMock(ArrayResult::class); + $this->paymentAdditionalInformationProvider = new PaymentAdditionalInformationProvider( + $this->getPaymentNonceCommandMock + ); + } + + /** + * Test getAdditionalInformation method + * + * @return void + */ + public function testGetAdditionalInformation() + { + $customerId = 15; + $publicHash = '3n4b7sn48g'; + $paymentMethodNonce = 'test'; + + $this->paymentTokenMock->expects($this->once())->method('getCustomerId')->willReturn($customerId); + $this->paymentTokenMock->expects($this->once())->method('getPublicHash')->willReturn($publicHash); + $this->getPaymentNonceCommandMock->expects($this->once())->method('execute')->with([ + PaymentTokenInterface::CUSTOMER_ID => $customerId, + PaymentTokenInterface::PUBLIC_HASH => $publicHash, + ])->willReturn($this->arrayResultMock); + $this->arrayResultMock->expects($this->once())->method('get') + ->willReturn(['paymentMethodNonce' => $paymentMethodNonce]); + + $expected = [ + 'payment_method_nonce' => $paymentMethodNonce, + ]; + $actual = $this->paymentAdditionalInformationProvider->getAdditionalInformation($this->paymentTokenMock); + self::assertEquals($expected, $actual); + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/LocaleResolverTest.php b/app/code/Magento/Braintree/Test/Unit/Model/LocaleResolverTest.php new file mode 100644 index 0000000000000..b6ef534c55c29 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/LocaleResolverTest.php @@ -0,0 +1,138 @@ +configMock = $this->createMock(Config::class); + $this->resolverMock = $this->createMock(ResolverInterface::class); + $this->localeResolver = new LocaleResolver($this->resolverMock, $this->configMock); + } + + /** + * Test getDefaultLocalePath method + * + * @return void + */ + public function testGetDefaultLocalePath() + { + $expected = 'general/locale/code'; + $this->resolverMock->expects($this->once())->method('getDefaultLocalePath')->willReturn($expected); + $actual = $this->localeResolver->getDefaultLocalePath(); + self::assertEquals($expected, $actual); + } + + /** + * Test setDefaultLocale method + * + * @return void + */ + public function testSetDefaultLocale() + { + $defaultLocale = 'en_US'; + $this->resolverMock->expects($this->once())->method('setDefaultLocale')->with($defaultLocale); + $this->localeResolver->setDefaultLocale($defaultLocale); + } + + /** + * Test getDefaultLocale method + * + * @return void + */ + public function testGetDefaultLocale() + { + $expected = 'fr_FR'; + $this->resolverMock->expects($this->once())->method('getDefaultLocale')->willReturn($expected); + $actual = $this->localeResolver->getDefaultLocale(); + self::assertEquals($expected, $actual); + } + + /** + * Test setLocale method + * + * @return void + */ + public function testSetLocale() + { + $locale = 'en_GB'; + $this->resolverMock->expects($this->once())->method('setLocale')->with($locale); + $this->localeResolver->setLocale($locale); + } + + /** + * Test getLocale method + * + * @return void + */ + public function testGetLocale() + { + $locale = 'en_TEST'; + $allowedLocales = 'en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,nl_NL'; + $this->resolverMock->expects($this->once())->method('getLocale')->willReturn($locale); + $this->configMock->expects($this->once())->method('getValue')->with('supported_locales') + ->willReturn($allowedLocales); + + $expected = 'en_US'; + $actual = $this->localeResolver->getLocale(); + self::assertEquals($expected, $actual); + } + + /** + * Test emulate method + * + * @return void + */ + public function testEmulate() + { + $scopeId = 12; + $this->resolverMock->expects($this->once())->method('emulate')->with($scopeId); + $this->localeResolver->emulate($scopeId); + } + + /** + * Test revert method + * + * @return void + */ + public function testRevert() + { + $this->resolverMock->expects($this->once())->method('revert'); + $this->localeResolver->revert(); + } +} diff --git a/app/code/Magento/Braintree/composer.json b/app/code/Magento/Braintree/composer.json index 9c8e980f7b360..8af2198949f1c 100644 --- a/app/code/Magento/Braintree/composer.json +++ b/app/code/Magento/Braintree/composer.json @@ -25,7 +25,7 @@ "magento/module-theme": "100.2.*" }, "type": "magento2-module", - "version": "100.2.4", + "version": "100.2.5", "license": [ "proprietary" ], diff --git a/app/code/Magento/Braintree/etc/adminhtml/di.xml b/app/code/Magento/Braintree/etc/adminhtml/di.xml index bb5763469cad3..cd449c8bce76d 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/di.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/di.xml @@ -29,6 +29,7 @@ Magento\Braintree\Gateway\Request\VaultDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder @@ -41,6 +42,7 @@ Magento\Braintree\Gateway\Request\AddressDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder diff --git a/app/code/Magento/Braintree/etc/adminhtml/system.xml b/app/code/Magento/Braintree/etc/adminhtml/system.xml index f46da366b64a3..5215dbc00b7ef 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/system.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/system.xml @@ -44,7 +44,7 @@ http://docs.magento.com/m2/ce/user_guide/payment/braintree.html Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint - + 1 Magento\Config\Block\System\Config\Form\Fieldset @@ -77,25 +77,25 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Config\Block\System\Config\Form\Fieldset payment/braintree_cc_vault/title - + If you don't specify the merchant account to use to process a transaction, Braintree will process it using your default merchant account. payment/braintree/merchant_account_id - + Magento\Config\Model\Config\Source\Yesno Be sure to Enable Advanced Fraud Protection in Your Braintree Account in Settings/Processing Section payment/braintree/fraudprotection - + accounts@braintreepayments.com to setup your Kount account.]]> @@ -108,7 +108,7 @@ Magento\Config\Model\Config\Source\Yesno payment/braintree/debug - + Magento\Config\Model\Config\Source\Yesno Be sure to Enable AVS and/or CVV in Your Braintree Account in Settings/Processing Section. @@ -125,7 +125,7 @@ payment/braintree/sort_order - + Magento\Config\Block\System\Config\Form\Fieldset @@ -146,10 +146,10 @@ payment/braintree/countrycreditcard - + Magento\Config\Block\System\Config\Form\Fieldset - + payment/braintree_paypal/title It is recommended to set this value to "PayPal" per store views. @@ -187,7 +187,7 @@ 1 payment/braintree_paypal/specificcountry - + Magento\Config\Model\Config\Source\Yesno payment/braintree_paypal/require_billing_address @@ -203,7 +203,7 @@ Magento\Config\Model\Config\Source\Yesno payment/braintree_paypal/debug - + Magento\Config\Model\Config\Source\Yesno payment/braintree_paypal/display_on_shopping_cart @@ -215,7 +215,7 @@ payment/braintree_paypal/skip_order_review - + Magento\Config\Block\System\Config\Form\Fieldset @@ -239,14 +239,14 @@ payment/braintree/verify_specific_countries - + Braintree Support.]]> Magento\Config\Block\System\Config\Form\Fieldset - + payment/braintree/descriptor_name @@ -254,14 +254,14 @@ and the product descriptor can be up to 18, 14, or 9 characters respectively (with an * in between for a total descriptor name of 22 characters). - + payment/braintree/descriptor_phone The value in the phone number field of a customer's statement. Phone must be 10-14 characters and can only contain numbers, dashes, parentheses and periods. - + payment/braintree/descriptor_url diff --git a/app/code/Magento/Braintree/etc/di.xml b/app/code/Magento/Braintree/etc/di.xml index f4e6e17bfca76..c5440db1889f4 100644 --- a/app/code/Magento/Braintree/etc/di.xml +++ b/app/code/Magento/Braintree/etc/di.xml @@ -233,6 +233,7 @@ Magento\Braintree\Gateway\Request\KountPaymentDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder @@ -291,6 +292,7 @@ Magento\Braintree\Gateway\Request\KountPaymentDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder @@ -325,6 +327,7 @@ Magento\Braintree\Gateway\Request\VaultCaptureDataBuilder Magento\Braintree\Gateway\Request\SettlementDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder @@ -347,6 +350,7 @@ Magento\Braintree\Gateway\Request\PayPal\DeviceDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder @@ -380,6 +384,7 @@ Magento\Braintree\Gateway\Request\AddressDataBuilder Magento\Braintree\Gateway\Request\DescriptorDataBuilder Magento\Braintree\Gateway\Request\StoreConfigBuilder + Magento\Braintree\Gateway\Request\MerchantAccountDataBuilder diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js index 9c95b79196e9d..ab01565d7f1e5 100644 --- a/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js +++ b/app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js @@ -24,6 +24,7 @@ define([ scriptLoaded: false, braintree: null, selectedCardType: null, + checkout: null, imports: { onActiveChange: 'active' } @@ -147,6 +148,12 @@ define([ this.disableEventListeners(); + if (self.checkout) { + self.checkout.teardown(function () { + self.checkout = null; + }); + } + self.braintree.setup(self.clientToken, 'custom', { id: self.selector, hostedFields: self.getHostedFields(), @@ -154,7 +161,8 @@ define([ /** * Triggered when sdk was loaded */ - onReady: function () { + onReady: function (checkout) { + self.checkout = checkout; $('body').trigger('processStop'); self.enableEventListeners(); }, diff --git a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml index 1d60d19458a28..c1ef461ecae7c 100644 --- a/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml +++ b/app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml @@ -29,6 +29,7 @@ $config = [ class="action-braintree-paypal-logo" disabled> Pay with PayPal + alt="escapeHtml(__('Pay with PayPal')) ?>" + title="escapeHtml(__('Pay with PayPal')) ?>"/> diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html index f5c8c15c8f3ba..e1f6a1b4c25ce 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html @@ -12,7 +12,7 @@ data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />