diff --git a/CHANGELOG.md b/CHANGELOG.md index efe5e58b320ea3465191f46c83ecf23556444609..7adb137e5586baa40c7e85da83344c94320b6d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,72 @@ +0.74.0-beta5 +============= +* Various + * Added the new methods/fields in the Catalog Product Data Object + * Improved the Nginx configuration sample file for better web-server responsiveness and security + * Implemented the new look & feel for Create New Order page + * Removed the redundant DB constraints for cascade operations related to order management + * Implemented the mechanism of asynchronous email notifications after creation of Orders, Invoices, Shipments and Credit Memos + * Moved the join logic on application level in order to make DB separation possible in Reports component + * Implemented the TTL and event approaches of cache invalidation, introduced the full and the partial Varnish Cache flush + * Moved all Setup commands to Magento CLI + * Exposed CMS API as Web API +* Fixed bugs: + * Unexpected response for API "/V1/customers/password" service + * Can’t include a third-party link to frontend section via layout + * Specified details for Grouped product are lost after adding to wishlist + * Impossible to configure products in customer wishlist in Admin Panel + * Adding the product from wishlist to cart if more than one store view exists + * Specified product field custom options is not displayed in wishlist in Admin Panel + * Checkout doesn't work with JS bundling enabled in production mode + * Issue with price excluding tax when selecting downloadable links + * Undefined index warning in case the frontend cache information is missing in configuration file + * "New Order" email is not sent to customer after placing order via API service + * 503 error when placing order with multiple shipping addresses if mail transport doesn't exist + * Broken words for fields with long labels all over the Admin Panel + * Issue with saving 'is_virtual' flag in quote + * "Void" button available after "Deny Payment" operation + * Uninstall logic did not clean cache properly + * Obsolete code tests did not cover Tests folders + * Random fail of Magento\Log\Test\Unit\Model\VisitorTest +* GitHub issues: + * [#1149] (https://github.com/magento/magento2/issues/1149) -- Checkout Grand Total amount miscalculation + * [#1165] (https://github.com/magento/magento2/pull/1165) -- Fix typos + * [#1182] (https://github.com/magento/magento2/pull/1182) -- Update system.xml for 'fix' sortOrder in adminhtml + * [#1186] (https://github.com/magento/magento2/pull/1186) -- SalesSequence: Fixed composer installer dependency + 0.74.0-beta4 ============= * Various - * Implemented the getDefaultResult method, to be able to catch exceptions in FrontController and redirect user to the correct page - * The getDefaultResult method is invoked to return default result of action execution within controllers. It can be used to generate the ‘execute’ method result in action controllers - * Eliminated the unused exceptions. Exceptions that weren't linked to any logic were also eliminated and replaced with LocalizedException or its child classes - * Refactored all controllers where possible: the default exception handling logic moved to FrontController. Controllers that cannot be refactored do not conflict with the new logic + * Implemented the getDefaultResult method, to be able to catch exceptions in FrontController and redirect user to the correct page + * The getDefaultResult method is invoked to return default result of action execution within controllers. It can be used to generate the ‘execute’ method result in action controllers + * Eliminated the unused exceptions. Exceptions that weren't linked to any logic were also eliminated and replaced with LocalizedException or its child classes + * Refactored all controllers where possible: the default exception handling logic moved to FrontController. Controllers that cannot be refactored do not conflict with the new logic * Framework: - * Created Magento Console to perform CLI actions - * Introduced a new SalesSequence module that is responsible for documents numeration management across the Order Management System - * Implemented the mechanism of asynchronous indexing of sales entities grids + * Created Magento Console to perform CLI actions + * Introduced a new SalesSequence module that is responsible for documents numeration management across the Order Management System + * Implemented the mechanism of asynchronous indexing of sales entities grids * Setup - * Added the ConfigOption and ConfigOptionsList classes to be used by modules to manage deployment configuration - * Moved all existing segments logic to new classes - * Added the config:set command, which enables deployment configuration management - * Removed the old 'install-configuration' tool + * Added the ConfigOption and ConfigOptionsList classes to be used by modules to manage deployment configuration + * Moved all existing segments logic to new classes + * Added the config:set command, which enables deployment configuration management + * Removed the old 'install-configuration' tool * Functional tests: - * Fixed functional test for order placement from backend - * Replaced the end-to-end test for a product with MAP with an injectable test + * Fixed functional test for order placement from backend + * Replaced the end-to-end test for a product with MAP with an injectable test * Design - * Updated the Blank and Luma themes to enable theme (not only library) variables overriding in the _theme.less file of any inherited theme. Included LESS code standards to the UI Library documentation + * Updated the Blank and Luma themes to enable theme (not only library) variables overriding in the _theme.less file of any inherited theme. Included LESS code standards to the UI Library documentation * Fixed bugs: - * Fixed an issue where composite products could not be added to the order from the Recently Viewed Products section - * Fixed an issue where not all .js files were added to a bundle - * Fixed an issue where it was possible to save an incorrect IP value in the Developer Client Restriction field - * Fixed an issue where a raw DB error was thrown when trying to enter a custom variable with duplicated variable code + * Fixed an issue where composite products could not be added to the order from the Recently Viewed Products section + * Fixed an issue where not all .js files were added to a bundle + * Fixed an issue where it was possible to save an incorrect IP value in the Developer Client Restriction field + * Fixed an issue where a raw DB error was thrown when trying to enter a custom variable with duplicated variable code 0.74.0-beta3 ============= * API - * The orders were extended with the gift messages - * The page and block data and repository interfaces - * Updated the public API list + * The orders were extended with the gift messages + * The page and block data and repository interfaces + * Updated the public API list * Framework improvements * Improved the profile generator * Introduced the new environment for Jasmine tests @@ -54,7 +90,7 @@ * Fixed the Navigation Menu items on Admin Area * Various unit and integration tests bugs * GitHub issues and requests - [#675] (https://github.com/magento/magento2/issues/675) -- Fix for Textarea element cols and rows #675 + * [#675] (https://github.com/magento/magento2/issues/675) -- Fix for Textarea element cols and rows #675 0.74.0-beta2 ============= diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index 7e5a4bdb5cacaf241131af12c69b3e05cc85c758..a3420f351b9588fbbdcaecd0c03e5ed4dafe1ef3 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index cb7aecdfeeddfaaedc824324f3e847ea866fac55..7e73256be4e784c664a74d31269a01cc2ac551d2 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index 5b734aadea7a945a15231731e879d4c9a22dd4ba..b6bf9931bf462f34dac09df561c6b74514caecbe 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-developer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-user": "0.74.0-beta4", - "magento/module-backup": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-translation": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-developer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-user": "0.74.0-beta5", + "magento/module-backup": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-translation": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index a24b41c3b8bd79936342ab1601d03716f09122bd..6c0ab82327295bb0ca7c5ef74b812b144f4259c5 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 6838ab7155d141c5a9e853f45cc8687406b30a78..8873d0536f9e9cdb8c708d4657998186c26256ff 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta4" + "magento/module-webapi": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CacheInvalidate/Model/Observer.php b/app/code/Magento/CacheInvalidate/Model/Observer.php new file mode 100644 index 0000000000000000000000000000000000000000..6deb4f50aac511b57fc7bf5cf920a6f172bad351 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/Model/Observer.php @@ -0,0 +1,99 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CacheInvalidate\Model; + +/** + * Class Observer + */ +class Observer +{ + /** + * Application config object + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $_config; + + /** + * @var \Magento\PageCache\Helper\Data + */ + protected $_helper; + + /** + * @var \Magento\Framework\HTTP\Adapter\Curl + */ + protected $_curlAdapter; + + /** + * Constructor + * + * @param \Magento\PageCache\Model\Config $config + * @param \Magento\PageCache\Helper\Data $helper + * @param \Magento\Framework\HTTP\Adapter\Curl $curlAdapter + */ + public function __construct( + \Magento\PageCache\Model\Config $config, + \Magento\PageCache\Helper\Data $helper, + \Magento\Framework\HTTP\Adapter\Curl $curlAdapter + ) { + $this->_config = $config; + $this->_helper = $helper; + $this->_curlAdapter = $curlAdapter; + } + + /** + * If Varnish caching is enabled it collects array of tags + * of incoming object and asks to clean cache. + * + * @param \Magento\Framework\Event\Observer $observer + * @return void + */ + public function invalidateVarnish(\Magento\Framework\Event\Observer $observer) + { + if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) { + $object = $observer->getEvent()->getObject(); + if ($object instanceof \Magento\Framework\Object\IdentityInterface) { + $tags = []; + $pattern = "((^|,)%s(,|$))"; + foreach ($object->getIdentities() as $tag) { + $tags[] = sprintf($pattern, preg_replace("~_\\d+$~", '', $tag)); + $tags[] = sprintf($pattern, $tag); + } + $this->sendPurgeRequest(implode('|', array_unique($tags))); + } + } + } + + /** + * Flash Varnish cache + * + * @param \Magento\Framework\Event\Observer $observer + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function flushAllCache(\Magento\Framework\Event\Observer $observer) + { + if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) { + $this->sendPurgeRequest('.*'); + } + } + + /** + * Send curl purge request + * to invalidate cache by tags pattern + * + * @param string $tagsPattern + * @return void + */ + protected function sendPurgeRequest($tagsPattern) + { + $headers = ["X-Magento-Tags-Pattern: {$tagsPattern}"]; + $this->_curlAdapter->setOptions([CURLOPT_CUSTOMREQUEST => 'PURGE']); + $this->_curlAdapter->write('', $this->_helper->getUrl('*'), '1.1', $headers); + $this->_curlAdapter->read(); + $this->_curlAdapter->close(); + } +} diff --git a/app/code/Magento/CacheInvalidate/README.md b/app/code/Magento/CacheInvalidate/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6cca6ffec03e45b5b7c09ba7d6e8a6543e14eb00 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/README.md @@ -0,0 +1,2 @@ +The CacheInvalidate module is used to invalidate the Varnish cache if it is configured. +It listens for events that request the cache to be flushed or cause the cache to be invalid, then sends Varnish a purge request using cURL. \ No newline at end of file diff --git a/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1abf5d45605acb48f111f7126ab58dcae9c9e540 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php @@ -0,0 +1,138 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CacheInvalidate\Test\Unit\Model; + +class ObserverTest extends \PHPUnit_Framework_TestCase +{ + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\CacheInvalidate\Model\Observer */ + protected $_model; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\Observer */ + protected $_observerMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\HTTP\Adapter\Curl */ + protected $_curlMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\PageCache\Model\Config */ + protected $_configMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\PageCache\Helper\Data */ + protected $_helperMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\ */ + protected $_observerObject; + + /** + * Set up all mocks and data for test + */ + public function setUp() + { + $this->_configMock = $this->getMock( + 'Magento\PageCache\Model\Config', + ['getType', 'isEnabled'], + [], + '', + false + ); + $this->_helperMock = $this->getMock('Magento\PageCache\Helper\Data', ['getUrl'], [], '', false); + $this->_curlMock = $this->getMock( + '\Magento\Framework\HTTP\Adapter\Curl', + ['setOptions', 'write', 'read', 'close'], + [], + '', + false + ); + $this->_model = new \Magento\CacheInvalidate\Model\Observer( + $this->_configMock, + $this->_helperMock, + $this->_curlMock + ); + $this->_observerMock = $this->getMock( + 'Magento\Framework\Event\Observer', + ['getEvent'], + [], + '', + false + ); + $this->_observerObject = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + } + + /** + * Test case for cache invalidation + */ + public function testInvalidateVarnish() + { + $tags = ['cache_1', 'cache_group']; + $pattern = '((^|,)cache(,|$))|((^|,)cache_1(,|$))|((^|,)cache_group(,|$))'; + + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::VARNISH) + ); + $eventMock = $this->getMock('Magento\Framework\Event', ['getObject'], [], '', false); + $eventMock->expects($this->once())->method('getObject')->will($this->returnValue($this->_observerObject)); + $this->_observerMock->expects($this->once())->method('getEvent')->will($this->returnValue($eventMock)); + $this->_observerObject->expects($this->once())->method('getIdentities')->will($this->returnValue($tags)); + $this->sendPurgeRequest($pattern); + + $this->_model->invalidateVarnish($this->_observerMock); + } + + /** + * Test case for flushing all the cache + */ + public function testFlushAllCache() + { + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::VARNISH) + ); + + $this->sendPurgeRequest('.*'); + $this->_model->flushAllCache($this->_observerMock); + } + + /** + * @param string $tags + */ + protected function sendPurgeRequest($tags) + { + $url = 'http://mangento.index.php'; + $httpVersion = '1.1'; + $headers = ["X-Magento-Tags-Pattern: {$tags}"]; + $this->_helperMock->expects( + $this->any() + )->method( + 'getUrl' + )->with( + $this->equalTo('*'), + [] + )->will( + $this->returnValue($url) + ); + $this->_curlMock->expects($this->once())->method('setOptions')->with([CURLOPT_CUSTOMREQUEST => 'PURGE']); + $this->_curlMock->expects( + $this->once() + )->method( + 'write' + )->with( + $this->equalTo(''), + $this->equalTo($url), + $httpVersion, + $this->equalTo($headers) + ); + $this->_curlMock->expects($this->once())->method('read'); + $this->_curlMock->expects($this->once())->method('close'); + } +} diff --git a/app/code/Magento/CacheInvalidate/composer.json b/app/code/Magento/CacheInvalidate/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..85636ed03a214e287940522cc1dad44b1eb30d67 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/composer.json @@ -0,0 +1,24 @@ +{ + "name": "magento/module-cache-invalidate", + "description": "N/A", + "require": { + "php": "~5.5.0|~5.6.0", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/magento-composer-installer": "*" + }, + "type": "magento2-module", + "version": "0.74.0-beta5", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "extra": { + "map": [ + [ + "*", + "Magento/CacheInvalidate" + ] + ] + } +} diff --git a/app/code/Magento/CacheInvalidate/etc/events.xml b/app/code/Magento/CacheInvalidate/etc/events.xml new file mode 100644 index 0000000000000000000000000000000000000000..d4ba3665ee66fb4e1e1eee75045302c199bf2985 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/etc/events.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> + <event name="clean_cache_by_tags"> + <observer name="invalidate_varnish" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="adminhtml_cache_flush_system"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="clean_media_cache_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="clean_catalog_images_cache_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="assigned_theme_changed"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="catalogrule_after_apply"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="adminhtml_cache_refresh_type"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="adminhtml_cache_flush_all"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="assign_theme_to_stores_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_currency_saveRates"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_config_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_catalog_product_action_attribute_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_catalog_product_massStatus"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_currencysymbol_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> +</config> diff --git a/app/code/Magento/CacheInvalidate/etc/module.xml b/app/code/Magento/CacheInvalidate/etc/module.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca87df877a43a93eb2be450fa10b0013d099eff9 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/etc/module.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> + <module name="Magento_CacheInvalidate" setup_version="2.0.0"> + <sequence> + <module name="Magento_Store"/> + </sequence> + </module> +</config> diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 6e9a81a004a19d00e0b7c93aa1a6b75d1594e0f7..95638b5822e5f4dc0018ca232f89f0e52d998735 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php old mode 100644 new mode 100755 index da907bde71f75ca5ef9f2147cfc89c3070ef8c41..ca1e3038e03909c756d7b793669393f78457656e --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -139,14 +139,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * Processing object before save data * * @return \Magento\Framework\Model\AbstractModel - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function beforeSave() { try { $this->attrLockValidator->validate($this); } catch (\Magento\Framework\Exception\LocalizedException $exception) { - throw new \Magento\Eav\Exception(__($exception->getMessage())); + throw new \Magento\Framework\Exception\LocalizedException(__($exception->getMessage())); } $this->setData('modulePrefix', self::MODULE_NAME); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php old mode 100644 new mode 100755 index 2272520c1a4fdfdadc63791d8fb4d8451f104481..5d21012f3964f7798aea8822c425192146d9481d --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -44,7 +44,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * * @param Product $object * @return bool - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\LocalizedException */ public function validate($object) @@ -52,7 +52,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if ($this->getAttribute()->getIsRequired() && strlen($value) === 0) { - throw new \Magento\Eav\Exception(__('The value of attribute "%1" must be set', $attrCode)); + throw new \Magento\Framework\Exception\LocalizedException(__('The value of attribute "%1" must be set', $attrCode)); } if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index f1f80f7701c0cf8e260892361e90110616656a31..21a1ecedb1f403f2bbe222e6b2e5542348ab1368 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -181,6 +181,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...) * @return $this * @throws LocalizedException + * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function validateUserValue($values) @@ -222,9 +223,6 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $value = $this->validatorFile->setProduct($this->getProduct()) ->validate($this->_getProcessingParams(), $option); $this->setUserValue($value); - } catch (\Magento\Framework\Exception\File\LargeSizeException $largeSizeException) { - $this->setIsValid(false); - throw new LocalizedException(__($largeSizeException->getMessage())); } catch (ProductException $e) { switch ($this->getProcessMode()) { case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL: @@ -236,7 +234,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } } catch (\Magento\Framework\Validator\Exception $e) { $this->setUserValue(null); - } catch (\Magento\Framework\Exception\File\ValidatorException $e) { + } catch (LocalizedException $e) { $this->setIsValid(false); throw new LocalizedException(__($e->getMessage())); } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index beb1b3d2f8da1b5421b751aab1ee24d36de49c63..9f8c3c955c96e7e08e580c5de60f5fcb3c3c77f1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -9,6 +9,7 @@ namespace Magento\Catalog\Model\Product\Option\Type\File; use Magento\Catalog\Model\Product; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Catalog\Model\Product\Exception as ProductException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -89,10 +90,12 @@ class ValidatorFile extends Validator * @param \Magento\Framework\Object $processingParams * @param \Magento\Catalog\Model\Product\Option $option * @return array - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Zend_File_Transfer_Exception + * @throws LocalizedException + * @throws ProductException + * @throws \Exception + * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Validator\Exception - * @throws \Magento\Catalog\Model\Product\Exception + * @throws \Zend_File_Transfer_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -116,7 +119,7 @@ class ValidatorFile extends Validator // when file exceeds the upload_max_filesize, $_FILES is empty if ($this->validateContentLength()) { $value = $this->fileSize->getMaxFileSizeInMb(); - throw new \Magento\Framework\Exception\File\LargeSizeException( + throw new LocalizedException( __('The file you uploaded is larger than %1 Megabytes allowed by server', $value) ); } else { @@ -188,12 +191,10 @@ class ValidatorFile extends Validator $errors = $this->getValidatorErrors($upload->getErrors(), $fileInfo, $option); if (count($errors) > 0) { - throw new \Magento\Framework\Exception\File\ValidatorException(__(implode("\n", $errors))); + throw new LocalizedException(__(implode("\n", $errors))); } } else { - throw new \Magento\Framework\Exception\File\ValidatorException( - __('Please specify the product\'s required option(s).') - ); + throw new LocalizedException(__('Please specify the product\'s required option(s).')); } return $userValue; } diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index a17501b92fba48a0137473e875a019f8a5596152..ff1d9af0f319ce435b778507018f44d1bf92f526 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,37 +3,37 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-log": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-product-alert": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-log": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-product-alert": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 895c374992a5c7413d5bdd883e27bbc7714673f7..ea1dd5d998620505acfee1def2956798f4793866 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index 6f54f4d56c5274996dbcab3542e7ca9079c56888..8740b2ea137f6385daf408aa4fa61c820d5b8e94 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php old mode 100644 new mode 100755 index a2cfaba45a1e0ccdf826cce274ad17864eb00ca7..af1dee02649e9bb3fdcf56a7d40404b79a7c65f7 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -562,7 +562,7 @@ class IndexBuilder * @param int $websiteId * @param int|null $productId * @return \Zend_Db_Statement_Interface - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ protected function getRuleProductsStmt($websiteId, $productId = null) { diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index 2c39aa0001cf71ef677a0e496c4d2d5ffa13d85f..352835339794eddfb3d2dabc82ef7cda88bc6e78 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index 3e0bd9ed81ccbc94febd4ed726ca4de507cb545c..0a988ba3be2b861d5508ef2582e21f8a697bd09d 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-search": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-search": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 32f42f29d03b7acf1281238e5632e84b56ae44db..cc49b31047ff20939f65f08a266450791b29792f 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json index 2fdbad2eecd8068f9441484a3ad2f24bc3e9915e..7804885f1155dc5cf7b2885140ccbab81812bae5 100644 --- a/app/code/Magento/CatalogWidget/composer.json +++ b/app/code/Magento/CatalogWidget/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index 91cddc22bffdff2cef320c3ad1bd2febf97c3dfd..f6c1b2a6459cbcdebea1ae76ce0927355218606c 100644 --- a/app/code/Magento/Centinel/composer.json +++ b/app/code/Magento/Centinel/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 2877afcf85ed8820a084c34cd72c03874baf4996..3ff8bfdb0e1e152992f8a393859817f6fc9ad865 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,32 +3,32 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 0cbd42b9a33de770f239b024e69a8566c6d32500..2df471b27277a34a6fe4fe297f57adce503fea55 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 9d7f128e467d96a985ad917388d9b783663be082..fdec1f9aabe0043a939d82a4733de8d4e65a872f 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 6d12114d02e995e4c3cae99c335fc8ca89b9236c..427b28143c9d1d9b8f0f4bbfe20f5d732430ea77 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index 6ad118d0eb543e2418defaf768a66bd07f250a35..0e2c50498195b943caa93504a716c734e711b04e 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index c02fc5ab42fa2b350e886cc8ee62c11b3d27e180..b316df5f4500302cb6b6a72a185d41468df54f1c 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-configurable-product": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-configurable-product": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 2cc6c39ef2a720b371828d8e55fd1236fc879ce7..d7a6e4738064976fcbc4d905dd033f51a6e1a232 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta4" + "magento/module-webapi": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index ca39cef892d13513e9d48d6013066c022d0b424a..ac2fdff06e047a7756a76fbe87f93d13348ef5aa 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json index 1fbe865788b3e7f8b8d640614720dff283fabf2c..a9cf290b513184022ee15e1519efd17024b822f9 100644 --- a/app/code/Magento/Cookie/composer.json +++ b/app/code/Magento/Cookie/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-backend": "0.74.0-beta4" + "magento/module-backend": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index 59f4ab2d4721e99fbb81ea062d0e47434614d4a2..ef1fa3050a934823fb612caf437be5ca8712edfb 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index c2b0fa9cf6f0f0c782c12e830a670b53975b436f..722aef23ea946acd5c43ec20ee850ea702e7ddf0 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index f8dc83a634288b02d6b6a7238df504d63f8607c6..43d57a0229b6424f94f719b15ed7960ca14c6688 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-newsletter": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-review": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-newsletter": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-review": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index edcbf4a31a26e40315da50a4b77b187b69d49391..cab754cc3457e624a37dfeede79d2b7210833e31 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index 96c6b08ef61fc7146066ed82353ce97ea8e682b6..f913fe9609962f88c00152fc389f1fe4e360ead6 100644 --- a/app/code/Magento/DesignEditor/composer.json +++ b/app/code/Magento/DesignEditor/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-translation": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-translation": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/Model/View/Layout/Plugin.php b/app/code/Magento/Developer/Model/View/Layout/Plugin.php new file mode 100644 index 0000000000000000000000000000000000000000..4f4f059813d58552730aea52894ce610ce327799 --- /dev/null +++ b/app/code/Magento/Developer/Model/View/Layout/Plugin.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Developer\Model\View\Layout; + +use Magento\Framework\App\State; +use Magento\Framework\Exception\LocalizedException; +use Psr\Log\LoggerInterface as Logger; + +/** + * Layout plugin that handle exceptions + */ +class Plugin +{ + /** + * @var State + */ + protected $appState; + + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * @param State $appState + * @param Logger $logger + */ + public function __construct( + State $appState, + Logger $logger + ) { + $this->appState = $appState; + $this->logger = $logger; + } + + /** + * @param \Magento\Framework\View\Layout $subject + * @param callable $proceed + * @param string $name + * @return string + * @throws \Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundRenderNonCachedElement(\Magento\Framework\View\Layout $subject, \Closure $proceed, $name) + { + $result = ''; + try { + $result = $proceed($name); + } catch (\Exception $e) { + if ($this->appState->getMode() === State::MODE_DEVELOPER) { + throw $e; + } + $message = ($e instanceof LocalizedException) ? $e->getLogMessage() : $e->getMessage(); + $this->logger->critical($message); + } + return $result; + } +} diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json index f37c4cf749ba8e1849a49df486235c50b0095dd0..1684bd8ce8cb42e5d07f74d8524c479fa9c02926 100644 --- a/app/code/Magento/Developer/composer.json +++ b/app/code/Magento/Developer/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index d923b3d55553d83da4bd4d54defdd00bf2baf8d6..1a21f191e09094fc0f9275ddabd632807fbdc1ff 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -10,6 +10,9 @@ <type name="Magento\Framework\View\TemplateEngineFactory"> <plugin name="debug_hints" type="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints" sortOrder="10"/> </type> + <type name="Magento\Framework\View\Layout"> + <plugin name="exception_handler" type="Magento\Developer\Model\View\Layout\Plugin" sortOrder="10"/> + </type> <type name="Magento\Framework\View\Result\Page"> <arguments> <argument name="pageConfigRendererFactory" xsi:type="object">Magento\Developer\Model\View\Page\Config\RendererFactory</argument> diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index a0cd2d031e30120b94510e53be7d29f587795780..9058fc5e562ad74ba84cc36c8336a5ea2db87ba5 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index ec04012d5549bc8763750e86976313bd31e92290..eb90b0170052f76bd3e75919e2b3a2ab8e4a67a0 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index c73fbe1b106ee42cfb9d12f610894d56de73a842..cabce5bc9cce6d05f8d2d2ff274610968d89882f 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Eav/Exception.php b/app/code/Magento/Eav/Exception.php deleted file mode 100644 index ed5a6dd53d7140f8088c4cbc8e32d4a8c8a18ad7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Eav/Exception.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Eav; - -class Exception extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php old mode 100644 new mode 100755 index cc3d3950d01b2d66fe48129d35506daa3a967a91..ac8c5805f4b72f8727d09a4a4cbc71a0f05c2258 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -14,7 +14,7 @@ use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; use Magento\Framework\App\Config\Element; use Magento\Framework\Model\AbstractModel; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Model\Resource\Db\ObjectRelationProcessor; use Magento\Framework\Model\Resource\Db\TransactionManagerInterface; @@ -334,12 +334,12 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract * Retrieve current entity config * * @return Type - * @throws EavException + * @throws LocalizedException */ public function getEntityType() { if (empty($this->_type)) { - throw new EavException(__('Entity is not initialized')); + throw new LocalizedException(__('Entity is not initialized')); } return $this->_type; } @@ -372,7 +372,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract * * @param array|string|null $attributes * @return $this - * @throws EavException + * @throws LocalizedException */ public function unsetAttributes($attributes = null) { @@ -387,7 +387,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract } if (!is_array($attributes)) { - throw new EavException(__('Unknown parameter')); + throw new LocalizedException(__('Unknown parameter')); } foreach ($attributes as $attrCode) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php old mode 100644 new mode 100755 index df877f97a92afdec4ea0cdb857e10d3a90f84ba9..5682724a47726b8504a4862eca31b2c8c75b2bfb --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -5,7 +5,7 @@ */ namespace Magento\Eav\Model\Entity; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Api\AttributeValueFactory; /** @@ -213,7 +213,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im * Prepare data for save * * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -221,7 +221,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im { // prevent overriding product data if (isset($this->_data['attribute_code']) && $this->reservedAttributeList->isReservedAttribute($this)) { - throw new EavException( + throw new LocalizedException( __( 'The attribute code \'%1\' is reserved by system. Please try another attribute code', $this->_data['attribute_code'] @@ -240,7 +240,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im ['max' => self::ATTRIBUTE_CODE_MAX_LENGTH] ) ) { - throw new EavException( + throw new LocalizedException( __('Maximum length of attribute code must be less than %1 symbols', self::ATTRIBUTE_CODE_MAX_LENGTH) ); } @@ -252,7 +252,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im $numberFormatter = new \NumberFormatter($this->_localeResolver->getLocale(), \NumberFormatter::DECIMAL); $defaultValue = $numberFormatter->parse($defaultValue); if ($defaultValue === false) { - throw new EavException(__('Invalid default decimal value')); + throw new LocalizedException(__('Invalid default decimal value')); } $this->setDefaultValue($defaultValue); } @@ -275,7 +275,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im $defaultValue = \IntlDateFormatter::formatObject(new \DateTime($defaultValue), $format); $this->setDefaultValue($defaultValue); } catch (\Exception $e) { - throw new EavException(__('Invalid default date')); + throw new LocalizedException(__('Invalid default date')); } } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php old mode 100644 new mode 100755 index e52ab0860e2022a332732b550391e45fabb5e305..9dbc048d711ecb5ddbcb936e1cdad322200c61c7 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Entity\Attribute; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Api\AttributeValueFactory; /** @@ -181,7 +181,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * @param string|int|\Magento\Eav\Model\Entity\Type $entityType * @param string $code * @return $this - * @throws EavException + * @throws LocalizedException */ public function loadByCode($entityType, $code) { @@ -195,7 +195,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens $entityTypeId = $entityType->getId(); } if (empty($entityTypeId)) { - throw new EavException(__('Invalid entity supplied')); + throw new LocalizedException(__('Invalid entity supplied')); } $this->_getResource()->loadByCode($this, $entityTypeId, $code); $this->_afterLoad(); @@ -461,7 +461,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * Retrieve backend instance * * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend - * @throws EavException + * @throws LocalizedException */ public function getBackend() { @@ -471,7 +471,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens } $backend = $this->_universalFactory->create($this->getBackendModel()); if (!$backend) { - throw new EavException(__('Invalid backend model specified: ' . $this->getBackendModel())); + throw new LocalizedException(__('Invalid backend model specified: ' . $this->getBackendModel())); } $this->_backend = $backend->setAttribute($this); } @@ -500,7 +500,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * Retrieve source instance * * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource - * @throws EavException + * @throws LocalizedException */ public function getSource() { @@ -510,7 +510,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens } $source = $this->_universalFactory->create($this->getSourceModel()); if (!$source) { - throw new EavException( + throw new LocalizedException( __( 'Source model "%1" not found for attribute "%2"', $this->getSourceModel(), diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php old mode 100644 new mode 100755 index 9950d293cba1937e72b4aa479aa579ef5ea1df16..aa010892c64957ff153888590e20f49987aa82e4 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -5,7 +5,7 @@ */ namespace Magento\Eav\Model\Entity\Attribute\Backend; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * Entity/Attribute/Model - attribute backend abstract @@ -214,7 +214,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba * * @param \Magento\Framework\Object $object * @return bool - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function validate($object) @@ -223,7 +223,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba $attrCode = $attribute->getAttributeCode(); $value = $object->getData($attrCode); if ($attribute->getIsVisible() && $attribute->getIsRequired() && $attribute->isValueEmpty($value)) { - throw new EavException(__('The value of attribute "%1" must be set', $attrCode)); + throw new LocalizedException(__('The value of attribute "%1" must be set', $attrCode)); } if ($attribute->getIsUnique() @@ -236,7 +236,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba if ($attribute->getIsUnique()) { if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) { $label = $attribute->getFrontend()->getLabel(); - throw new EavException(__('The value of attribute "%1" must be unique', $label)); + throw new LocalizedException(__('The value of attribute "%1" must be unique', $label)); } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php old mode 100644 new mode 100755 index 4145ac0a68cd95767a2ace6d48bda83048f00d73..147f1dcdd0bc845b871daaa2146b468438942d72 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -30,7 +30,7 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke * necessary for further process, else date string * * @param \Magento\Framework\Object $object - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @return $this */ public function beforeSave($object) @@ -41,7 +41,7 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke try { $value = $this->formatDate($object->getData($attributeName)); } catch (\Exception $e) { - throw new \Magento\Eav\Exception(__('Invalid date')); + throw new \Magento\Framework\Exception\LocalizedException(__('Invalid date')); } if (is_null($value)) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php old mode 100644 new mode 100755 index c8eb151622d4d235b8460fc548ac202d504b0e4a..446f4fd65a88ba119a7ad37caa67d681aa327ffd --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -19,7 +19,7 @@ */ namespace Magento\Eav\Model\Entity\Attribute; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Eav\Model\Entity\Type; use Magento\Framework\Api\AttributeValueFactory; @@ -255,17 +255,17 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements * Validate attribute set name * * @return bool - * @throws EavException + * @throws LocalizedException */ public function validate() { $attributeSetName = $this->getAttributeSetName(); if ($attributeSetName == '') { - throw new EavException(__('Attribute set name is empty.')); + throw new LocalizedException(__('Attribute set name is empty.')); } if (!$this->_getResource()->validate($this, $attributeSetName)) { - throw new EavException(__('An attribute set with the "%1" name already exists.', $attributeSetName)); + throw new LocalizedException(__('An attribute set with the "%1" name already exists.', $attributeSetName)); } return true; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php old mode 100644 new mode 100755 index 427000b106f5e6b743213ab967e33c1095a56ce9..6417cd0b506d865fcc95f1595f4845439a8500c4 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php @@ -30,7 +30,7 @@ class Config extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource /** * Retrieve all options for the source from configuration * - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @return array */ public function getAllOptions() @@ -39,7 +39,7 @@ class Config extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $this->_options = []; if (empty($this->_optionsData)) { - throw new \Magento\Eav\Exception(__('No options found.')); + throw new \Magento\Framework\Exception\LocalizedException(__('No options found.')); } foreach ($this->_optionsData as $option) { $this->_options[] = ['value' => $option['value'], 'label' => __($option['label'])]; diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php old mode 100644 new mode 100755 index 6cd6cf0e6d018dc745d1d4f66a73581ae593a915..72712e67c4406c2c2485649571e70ee145701992 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Entity\Collection; use Magento\Framework\DB\Select; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * Entity/Attribute/Model - collection abstract @@ -225,7 +225,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param \Magento\Eav\Model\Entity\AbstractEntity $entity * @return $this - * @throws EavException + * @throws LocalizedException */ public function setEntity($entity) { @@ -234,7 +234,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } elseif (is_string($entity) || $entity instanceof \Magento\Framework\App\Config\Element) { $this->_entity = $this->_eavEntityFactory->create()->setType($entity); } else { - throw new EavException(__('Invalid entity supplied: %1', print_r($entity, 1))); + throw new LocalizedException(__('Invalid entity supplied: %1', print_r($entity, 1))); } return $this; } @@ -243,12 +243,12 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * Get collection's entity object * * @return \Magento\Eav\Model\Entity\AbstractEntity - * @throws EavException + * @throws LocalizedException */ public function getEntity() { if (empty($this->_entity)) { - throw new EavException(__('Entity is not initialized')); + throw new LocalizedException(__('Entity is not initialized')); } return $this->_entity; } @@ -284,12 +284,12 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param \Magento\Framework\Object $object * @return $this - * @throws EavException + * @throws LocalizedException */ public function addItem(\Magento\Framework\Object $object) { if (!$object instanceof $this->_itemObjectClass) { - throw new EavException(__('Attempt to add an invalid object')); + throw new LocalizedException(__('Attempt to add an invalid object')); } return parent::addItem($object); } @@ -449,7 +449,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param array|string|integer|\Magento\Framework\App\Config\Element $attribute * @param bool|string $joinType flag for joining attribute * @return $this - * @throws EavException + * @throws LocalizedException */ public function addAttributeToSelect($attribute, $joinType = false) { @@ -474,7 +474,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attrInstance = $this->_eavConfig->getAttribute($this->getEntity()->getType(), $attribute); } if (empty($attrInstance)) { - throw new EavException(__('Invalid attribute requested: %1', (string)$attribute)); + throw new LocalizedException(__('Invalid attribute requested: %1', (string)$attribute)); } $this->_selectAttributes[$attrInstance->getAttributeCode()] = $attrInstance->getId(); } @@ -520,13 +520,13 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $expression * @param string $attribute * @return $this - * @throws EavException + * @throws LocalizedException */ public function addExpressionAttributeToSelect($alias, $expression, $attribute) { // validate alias if (isset($this->_joinFields[$alias])) { - throw new EavException(__('Joint field or attribute expression with this alias is already declared')); + throw new LocalizedException(__('Joint field or attribute expression with this alias is already declared')); } if (!is_array($attribute)) { $attribute = [$attribute]; @@ -622,7 +622,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $joinType inner|left * @param null $storeId * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -630,7 +630,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db { // validate alias if (isset($this->_joinAttributes[$alias])) { - throw new EavException(__('Invalid alias, already exists in joint attributes')); + throw new LocalizedException(__('Invalid alias, already exists in joint attributes')); } $bindAttribute = null; @@ -640,7 +640,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } if (!$bindAttribute || !$bindAttribute->isStatic() && !$bindAttribute->getId()) { - throw new EavException(__('Invalid foreign key')); + throw new LocalizedException(__('Invalid foreign key')); } // try to explode combined entity/attribute if supplied @@ -664,7 +664,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } } if (!$entity || !$entity->getTypeId()) { - throw new EavException(__('Invalid entity type')); + throw new LocalizedException(__('Invalid entity type')); } // cache entity @@ -677,7 +677,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attribute = $entity->getAttribute($attribute); } if (!$attribute) { - throw new EavException(__('Invalid attribute type')); + throw new LocalizedException(__('Invalid attribute type')); } if (empty($filter)) { @@ -712,13 +712,13 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string|array $cond "{{table}}.language_code='en'" OR array('language_code'=>'en') * @param string $joinType 'left' * @return $this - * @throws EavException + * @throws LocalizedException */ public function joinField($alias, $table, $field, $bind, $cond = null, $joinType = 'inner') { // validate alias if (isset($this->_joinFields[$alias])) { - throw new EavException(__('A joined field with this alias is already declared.')); + throw new LocalizedException(__('A joined field with this alias is already declared.')); } $table = $this->_resource->getTableName($table); @@ -774,7 +774,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param null|array $cond * @param string $joinType * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType = 'inner') @@ -793,11 +793,11 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db // validate fields and aliases if (!$fields) { - throw new EavException(__('Invalid joint fields')); + throw new LocalizedException(__('Invalid joint fields')); } foreach ($fields as $alias => $field) { if (isset($this->_joinFields[$alias])) { - throw new EavException(__('A joint field with this alias (%1) is already declared.', $alias)); + throw new LocalizedException(__('A joint field with this alias (%1) is already declared.', $alias)); } $this->_joinFields[$alias] = ['table' => $tableAlias, 'field' => $field]; } @@ -1100,7 +1100,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param bool $printQuery * @param bool $logQuery * @return $this - * @throws EavException + * @throws LocalizedException * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -1214,14 +1214,14 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param array $valueInfo * @return $this - * @throws EavException + * @throws LocalizedException */ protected function _setItemAttributeValue($valueInfo) { $entityIdField = $this->getEntity()->getEntityIdField(); $entityId = $valueInfo[$entityIdField]; if (!isset($this->_itemsById[$entityId])) { - throw new EavException(__('Data integrity: No header row found for attribute')); + throw new LocalizedException(__('Data integrity: No header row found for attribute')); } $attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes); if (!$attributeCode) { @@ -1255,7 +1255,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param string $attributeCode * @return string - * @throws EavException + * @throws LocalizedException */ protected function _getAttributeFieldName($attributeCode) { @@ -1273,7 +1273,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attribute = $this->getAttribute($attributeCode); if (!$attribute) { - throw new EavException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); } if ($attribute->isStatic()) { @@ -1295,7 +1295,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $attributeCode * @param string $joinType inner|left * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _addAttributeJoin($attributeCode, $joinType = 'inner') @@ -1333,7 +1333,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } if (!$attribute) { - throw new EavException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); } if ($attribute->getBackend()->isStatic()) { diff --git a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php old mode 100644 new mode 100755 index f413b900610a9cf62cfed7c286c4ec11447514b7..06c71132bf982a5e9eb9a7b03c225f8129c6b6f3 --- a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php +++ b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php @@ -31,7 +31,7 @@ class Alphanum extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement * Get next id * * @return string - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function getNextId() { @@ -52,7 +52,9 @@ class Alphanum extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement for ($i = $lid; $i >= 0; $i--) { $p = strpos($chars, $lastId[$i]); if (false === $p) { - throw new \Magento\Eav\Exception(__('Invalid character encountered in increment ID: %1', $lastId)); + throw new \Magento\Framework\Exception\LocalizedException( + __('Invalid character encountered in increment ID: %1', $lastId) + ); } if ($bumpNextChar) { $p++; diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php old mode 100644 new mode 100755 index 4e2a177f364bcb103cb8dc312a4f944c01a34385..cccb9d3b0286efc053a86b5fa752cc2a6f189577 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -10,7 +10,7 @@ use Magento\Eav\Model\Entity\Setup\PropertyMapperInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\App\CacheInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -247,7 +247,7 @@ class EavSetup * * @param int|string $entityTypeId * @return int - * @throws EavException + * @throws LocalizedException */ public function getEntityTypeId($entityTypeId) { @@ -255,7 +255,7 @@ class EavSetup $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); } if (!is_numeric($entityTypeId)) { - throw new EavException(__('Wrong entity ID')); + throw new LocalizedException(__('Wrong entity ID')); } return $entityTypeId; @@ -381,7 +381,7 @@ class EavSetup * @param int|string $entityTypeId * @param int|string $setId * @return int - * @throws EavException + * @throws LocalizedException */ public function getAttributeSetId($entityTypeId, $setId) { @@ -389,7 +389,7 @@ class EavSetup $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); } if (!is_numeric($setId)) { - throw new EavException(__('Wrong attribute set ID')); + throw new LocalizedException(__('Wrong attribute set ID')); } return $setId; @@ -598,7 +598,7 @@ class EavSetup * @param int|string $setId * @param int|string $groupId * @return $this - * @throws EavException + * @throws LocalizedException */ public function getAttributeGroupId($entityTypeId, $setId, $groupId) { @@ -611,7 +611,7 @@ class EavSetup } if (!is_numeric($groupId)) { - throw new EavException(__('Wrong attribute group ID')); + throw new LocalizedException(__('Wrong attribute group ID')); } return $groupId; } @@ -713,7 +713,7 @@ class EavSetup * * @param array $data * @return true - * @throws EavException + * @throws LocalizedException */ private function _validateAttributeData($data) { @@ -727,7 +727,7 @@ class EavSetup ['max' => $attributeCodeMaxLength] ) ) { - throw new EavException( + throw new LocalizedException( __('Maximum length of attribute code must be less than %1 symbols', $attributeCodeMaxLength) ); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php old mode 100644 new mode 100755 index 23d24c8edd47ffa94a603517f3303bf0e5c7581e..7a81bd55d364ff3423c2e2d4cb884827f4fa4c83 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php @@ -51,7 +51,7 @@ class SetTest extends \PHPUnit_Framework_TestCase { $this->_model->getResource()->expects($this->any())->method('validate')->will($this->returnValue(false)); - $this->setExpectedException('Magento\Eav\Exception', $exceptionMessage); + $this->setExpectedException('Magento\Framework\Exception\LocalizedException', $exceptionMessage); $this->_model->setAttributeSetName($attributeSetName); $this->_model->validate(); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php old mode 100644 new mode 100755 index bbf9f3b2535633f1ff7fd5a6756ef54ce5cfc5fc..23bd155a23f02b029c93edfcc26580d478f51ac1 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php @@ -54,7 +54,7 @@ class AlphanumTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Eav\Exception + * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Invalid character encountered in increment ID: ---wrong-id--- */ public function testGetNextIdThrowsExceptionIfIdContainsNotAllowedCharacters() diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index aee86f0c0bb1dcf6e82ee4b869f02923dc71ca0f..0c10785c21dc2ea3a16f8f44c5894cb6a74360d6 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 216d194849554f878ec6a21330f0b311159a55a5..734bedc62d4af7f6a88aa3bdd5739040ab2671ee 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 4e2a6767585aab94f821c5ebfcd1521f61fa688e..0e25a9cef9e08a1fb68bb4bd766907df267332d3 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index 5a6e0e322d63c8d982efb98e274b569016c99679..3b3f8bd3286e75382cfe29df8113150d353c8b51 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-multishipping": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-multishipping": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index e0e680f846dd0cbe7da3879e32f97d85a4f57ad7..4281f69da74682acc428f3a6378604d323802293 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 8fd519df491f0ffe4d2defa86b083081d6c4c7a1..465388ad322c19fc32b2c70780daa33e4c2a07ac 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-cookie": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-cookie": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 799d8a2a8e95b0f0036a39c55b199b422972bbc6..2b97a33986a56fc2a652b0b198c7393a6b0f1881 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-google-analytics": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-google-analytics": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index 18b2a1f41eae95eed341e35d32f34d5fa17e044b..691c21c5e5170582f692b3d8ff642d0f87a946cf 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index 3ad59320df924c910b7374ec8b5e81f703f295fe..6a7c82281d9845133e14500a6df7040ae028c074 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 5ed831d182a1ee3ecd967c9e2e1487425fdd3368..3374488e9aefe2d27165e2537d1179f99eb5a3b1 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index ca9683482f7aeea2280baeaab2f365f18f4ce62a..61c2c2b3db566f40ce5f5dcfec04e0d29d8e6488 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index 777190d5c6a20a6f211f585ec7913e81fe1968b5..8f8cb731492cbc26d2e9ae42e1daf0657889854b 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index e5d7d1526fa6e61694f1a2ae576df1128dab9a55..6d55a11affe41674b996715169b4742df04d9e7a 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-user": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-user": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index 0343cc36ead5f261199aabead8153cd95bba066a..7f68626650803f5cafd24ae952242a86a5b4e34f 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php index 79e8d2bee271fd48e1e5b4854aa768cfae68c73a..9e970f2c88c77e27dc2b866065d4ec62b617b610 100644 --- a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php +++ b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php @@ -122,13 +122,23 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function testGetFirstVisitAt() { $time = time(); - $this->assertEquals($time, $this->visitor->getFirstVisitAt()); + $this->assertEquals( + $time, + $this->visitor->getFirstVisitAt(), + 'VisitorTest failed to assert the time for the first visit within 5 seconds.', + 5 + ); } public function testGetLastVisitAt() { $time = time(); - $this->assertEquals($time, $this->visitor->getLastVisitAt()); + $this->assertEquals( + $time, + $this->visitor->getLastVisitAt(), + 'VisitorTest failed to assert the time for the last visit within 5 seconds.', + 5 + ); } public function testLogNewVisitor() diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 9a3c57a59a0b3c7ebfc1588d27e207adc652260e..acb3bafe61980ed0ddc61025239aadfc9264a67b 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json index ce826ad84af83b83aa339ff5dfacb27fd56abdfe..d451da9eea6a398b075e779ee2c936a41c8a9a17 100644 --- a/app/code/Magento/MediaStorage/composer.json +++ b/app/code/Magento/MediaStorage/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json index 6465657065e5a4d804f1d433f5639b16307c049d..2782d30f5999cfd7e1bf1c07825e97815639cac8 100644 --- a/app/code/Magento/Msrp/composer.json +++ b/app/code/Magento/Msrp/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-bundle": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-bundle": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 7359e5dc00845341f90db7fb07c68846a5c917f0..d2d41a10d762463f1a2f54c7dfd963496d5ca7d4 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -703,7 +703,7 @@ class Multishipping extends \Magento\Framework\Object $orders[] = $order; $this->_eventManager->dispatch( 'checkout_type_multishipping_create_orders_single', - ['order' => $order, 'address' => $address] + ['order' => $order, 'address' => $address, 'quote' => $this->getQuote()] ); } diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index d836336a7d88aee184ed0d729f7fa51889c9f115..cdce6dfcb3c5bc6a1cc4f819199b0f74aa00c371 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 407ad2de1463b3696f35c78f5c7c20e9d1747959..ae2c1141f0ac99c31210498329899b2e480ef485 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index eca86595e769565daef0c8ae2f52aa2cabb2e9ab..3f861432ea8e2dd449341f8821a9bf4ca94af463 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-payment": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-payment": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 21c1fc1cf75899ce1fdbb49c15e31c9865d57c32..b89948409ebd294999cae7f1d7224bf3a19972b7 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -5,6 +5,8 @@ */ namespace Magento\OfflineShipping\Model\Carrier; +use Magento\Framework\Exception\LocalizedException; + class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements \Magento\Shipping\Model\Carrier\CarrierInterface { @@ -197,7 +199,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen * @param string $type * @param string $code * @return array - * @throws \Magento\Shipping\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function getCode($type, $code = '') { @@ -215,7 +217,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen ]; if (!isset($codes[$type])) { - throw new \Magento\Shipping\Exception(__('Please correct Table Rate code type: %1.', $type)); + throw new LocalizedException(__('Please correct Table Rate code type: %1.', $type)); } if ('' === $code) { @@ -223,7 +225,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen } if (!isset($codes[$type][$code])) { - throw new \Magento\Shipping\Exception(__('Please correct Table Rate code for type %1: %2.', $type, $code)); + throw new LocalizedException(__('Please correct Table Rate code for type %1: %2.', $type, $code)); } return $codes[$type][$code]; diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index 5addaf40454af6dfe699153110419fc96ac1cc94..0f1aab96e650ba234876c0d41f03c170f913a38f 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index e8ea0a1f3d32804522d2453079ffebbe3e7441ba..3e62d64f6204c23c7da0c34924f3efd9299348c7 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index 5061f1511de4c95d735e5c6dba89369a1b84eb22..cd9e1d94cc5cd62404ef06fdad296b46074393e5 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-centinel": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-centinel": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 25abba1b5ac7eb13d1471d96f7fea162f09ac610..31b1a279ef4fd0bf45d9e5c72eab10f9269db1cd 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 83547bc81c04703c952ece152defd1631fddc081..62750ea8e688881021ad76e5fe7c1635bd86777a 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json index 173e239f796d8072845d23365a02360f0f45a16d..c28feaa41dcb842b926fa2925e7fdf88420d4bfc 100644 --- a/app/code/Magento/Quote/composer.json +++ b/app/code/Magento/Quote/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-sales-sequence": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-sales-sequence": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index cb2a9333fe01e3f67cc168067fc0fdc0a1bcc773..ea190558cac88646b628f4affaa5583f23f92d14 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -323,7 +323,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection * * @param array $productIds * @return array - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ protected function getProductData(array $productIds) { diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index aabd59fe60af0937968167b270d3772ab595f3c5..a163cc907cae09cb530314d2dbb1e857857df0ef 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-log": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-review": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-log": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-review": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index 3bdd116df217cb19613fd885737933763b3b5a5f..04d9a8ad8bd8d2a2e9cbadc47d67d6e3c7c3e99b 100644 --- a/app/code/Magento/RequireJs/composer.json +++ b/app/code/Magento/RequireJs/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index d4cf70a117e957764d7c480611352dafc9306fa4..9e92c92964afeb3b9f1fcfb78d2562bd321f6b94 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-newsletter": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-newsletter": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index 353dbf0cd9059722680694393d1eb1f6a13ec58a..d0c5619c78bfefd0f2fc524bfe560a87ad0f92f6 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index a4ddaf6d5145ff4a1ec140f982a44c036aa886c0..8c6f6962f7f3b5a815395dbac3db9fbb80f03bf2 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index f08be07d2c054df96d8548557fc6120723e4167b..42218c9ee39e9e58973e017fa00d2f89ad17e6e1 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,35 +3,35 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-sales-sequence": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-sales-sequence": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 585088a4f10e642d280aef2de25324692ba2224f..a01267d5dcfa082ed44316f04ff51fc716a86bc8 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json index da5dd3cbe32d26c5fd163586799d45cbe142642a..d4e0cd0f663e87a51a345eca909b8b3b99ff28ce 100644 --- a/app/code/Magento/SalesSequence/composer.json +++ b/app/code/Magento/SalesSequence/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json index 603a26e865c9d09b2b630ae141fb3a2c5af27582..9a03d940d7f599dd5b2bfcfa922710ee340d696e 100644 --- a/app/code/Magento/Search/composer.json +++ b/app/code/Magento/Search/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-search": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-search": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 7f3d863dc8a1a85844f17a47716660787d4f00d7..1ff658de4f55eada10dae594027a239584d8e37e 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Shipping/Exception.php b/app/code/Magento/Shipping/Exception.php deleted file mode 100755 index b140b961cf6d2bdf50fbc78e600517b55b8d3211..0000000000000000000000000000000000000000 --- a/app/code/Magento/Shipping/Exception.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Shipping; - -class Exception extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index 254e4868e2264e6b31fb21179a37a791458a6018..0278d3840231577af281bc46f387828b37ea7a6b 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-contact": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-contact": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-fedex": "0.74.0-beta4", - "magento/module-ups": "0.74.0-beta4" + "magento/module-fedex": "0.74.0-beta5", + "magento/module-ups": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index d02c8ce4a2f9c305e341968063e1a00aeaf7aafd..46098d8633ade3567d9300bdaf9ee109efdcf733 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index 0f697919aab8c962bb2e6f59433e90329576aa40..051797de489a84446cf95e0913dd6eb5b0a53196 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-directory": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-directory": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index b8f6dca3c66d2c73183843ac6fb6fc072a10bea8..5ad7a3d5645b31c665a2392f223f961d4d13990f 100644 --- a/app/code/Magento/Tax/composer.json +++ b/app/code/Magento/Tax/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json index 0c34d619a52deac67c7a68e53e36b69cbd5b2604..1948cd26ef6b3e105865d27f52a5f6a99f53b3b5 100644 --- a/app/code/Magento/TaxImportExport/composer.json +++ b/app/code/Magento/TaxImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-tax": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-tax": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index 306b732a8ba29f473f4473f8cb722d4c9e4112a4..04ea19e36e946cb8925ad0b651f2b27bb4b80e2f 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-translation": "0.74.0-beta4" + "magento/module-translation": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 95805c7c808a913fca7dc8b11ba06215c609a6f9..6e4f95813c4d7f71303486f41b8feafd8114627a 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-developer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-developer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json index 554855a2d50cbf76f413a1a73e23a8bc04830510..3d083a9bfc18f9c82ae46c24d1f1b1a458efead4 100644 --- a/app/code/Magento/Ui/composer.json +++ b/app/code/Magento/Ui/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index 1b0ed9ddfe26a098dbd11900385a151af05bb303..30e04c61293fb11c1d7c05abf6b9bd5a60e6ca2b 100644 --- a/app/code/Magento/Ups/composer.json +++ b/app/code/Magento/Ups/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index fb5a936db37d184d69aca56fa324be5d607efadd..6361324e7bbe9032406b54fd4195e906778f0e40 100644 --- a/app/code/Magento/UrlRewrite/composer.json +++ b/app/code/Magento/UrlRewrite/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-cms-url-rewrite": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-cms-url-rewrite": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index 577c27ba685e4ed81c654d62448ffa88c8a5d66a..adde1977addc39fecd13f8176d42f6b040298c39 100644 --- a/app/code/Magento/User/composer.json +++ b/app/code/Magento/User/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index 4c6201a4c81cd8b767c8f2062913b379f60d4c9f..d278fc22a7a3f54300f60fd08c12ace05d9a9fae 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json index 2480b529649cc03624b374cffbcadf038db7a984..b958c720516ab41bf854769a8c45a707813d4d78 100644 --- a/app/code/Magento/Variable/composer.json +++ b/app/code/Magento/Variable/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json index 577e9eafe37893adf97960f6bf4d3fbee4aad32d..17742ada0339c7cf4e7a908d3eeb2f5d3dab03e7 100644 --- a/app/code/Magento/Version/composer.json +++ b/app/code/Magento/Version/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index 3b557619403984b0a544ea4f0efedb0ccae04ed9..412e76b0ddbb081d369312e00100d2d5828afcd1 100644 --- a/app/code/Magento/Webapi/composer.json +++ b/app/code/Magento/Webapi/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-user": "0.74.0-beta4" + "magento/module-user": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index 141bd185bd9ae5fb6cefc8fa461ebb29da15ce60..d0de7a90f39df355a70183184a43a164c8a32013 100644 --- a/app/code/Magento/Weee/composer.json +++ b/app/code/Magento/Weee/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index 6cdf154bd8f2a4e2541acb72414ae8ab49af8a63..cc21bd787ce28ed3da0fb60c10341948ced643b1 100644 --- a/app/code/Magento/Widget/composer.json +++ b/app/code/Magento/Widget/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index a8b906b18a926527f1dfa1cc749ff1820fd77bb6..efca25e972d86be90c6784c2669e96805f71142f 100644 --- a/app/code/Magento/Wishlist/composer.json +++ b/app/code/Magento/Wishlist/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-rss": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-rss": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-configurable-product": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-bundle": "0.74.0-beta4", - "magento/module-cookie": "0.74.0-beta4" + "magento/module-configurable-product": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-bundle": "0.74.0-beta5", + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index f63967a044a77e63f610a42810f91990cb81c3e4..099609e696d4171594daaca42d3ff603da7de56b 100644 --- a/app/design/adminhtml/Magento/backend/composer.json +++ b/app/design/adminhtml/Magento/backend/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index 0310452342686164d2810d2e39e881e416c5b8cf..06b0de74a20117cdf9372ecbf1e5d1fafce4d487 100644 --- a/app/design/frontend/Magento/blank/composer.json +++ b/app/design/frontend/Magento/blank/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json index d37e25b11e2534ad335788f1a0d9de8df5f103c3..65cee41130caa2f8c59fed9819f74ecd48b77082 100644 --- a/app/design/frontend/Magento/luma/composer.json +++ b/app/design/frontend/Magento/luma/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/theme-frontend-blank": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/theme-frontend-blank": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json index 5e596f680a07b1410cd1068172cfccee343c867f..dcb3119da17cb3d01996b2d6e5381d371f8c3de3 100644 --- a/app/i18n/magento/de_de/composer.json +++ b/app/i18n/magento/de_de/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-de_de", "description": "German (Germany) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json index c36b99a652ae5b9f810145476d1605d42928b4a2..a6066570d9407c89c5458566a743cdb3dd324fb1 100644 --- a/app/i18n/magento/en_us/composer.json +++ b/app/i18n/magento/en_us/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-en_us", "description": "English (United States) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json index 8588126baa5e884fa3d68b19dd0c0e26849fbf6b..04c60c9a9d287558a54c1ece7d1cc567a7d9af2d 100644 --- a/app/i18n/magento/es_es/composer.json +++ b/app/i18n/magento/es_es/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-es_es", "description": "Spanish (Spain) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json index f51c27cfef8b7227ad59085a9ea43322bb8a5b84..4fb658f1943122d8aa49b9f893baa7562b5320b6 100644 --- a/app/i18n/magento/fr_fr/composer.json +++ b/app/i18n/magento/fr_fr/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-fr_fr", "description": "French (France) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json index 16880a05b0c94333f401dfa341a372cd35117601..d5a03c186958d03407f80deb84ded1bf53bf9d82 100644 --- a/app/i18n/magento/nl_nl/composer.json +++ b/app/i18n/magento/nl_nl/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-nl_nl", "description": "Dutch (Netherlands) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json index 744530a334afb482776c4892310dfbc8b52b0b55..ee226ddb36f77ae4efe8e11340d38ba1a8b71cd7 100644 --- a/app/i18n/magento/pt_br/composer.json +++ b/app/i18n/magento/pt_br/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-pt_br", "description": "Portuguese (Brazil) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json index b108d5b0f5c201a014576b24ba48084baffcc704..ddc25d3462fe46f5d2c34400a51328611871b7b7 100644 --- a/app/i18n/magento/zh_cn/composer.json +++ b/app/i18n/magento/zh_cn/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-zh_cn", "description": "Chinese (China) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/bin/magento b/bin/magento old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json index 744db43b2056a1f63d01f11a7e39f2fd8ae9326b..93c1f2b024685ab26c8bf8fc467f2aa3a71c868f 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2ce", "description": "Magento 2 (Community Edition)", "type": "project", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" @@ -63,6 +63,7 @@ "magento/module-backend": "self.version", "magento/module-backup": "self.version", "magento/module-bundle": "self.version", + "magento/module-cache-invalidate": "self.version", "magento/module-captcha": "self.version", "magento/module-catalog": "self.version", "magento/module-catalog-import-export": "self.version", diff --git a/composer.lock b/composer.lock index 27b3af87d33fc7269fe9fbf85f1bcc1af3026ccc..036da6915e82470dc348beffecb1a07f394215b4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "73c3707aae368f82882dc4631278e2c0", + "hash": "986eef2b3ae742a365a8a886f0babdd6", "packages": [ { "name": "composer/composer", @@ -2016,16 +2016,16 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.6.1", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "14f802b2c00b672676d55612e3c0d03465b69bf6" + "reference": "a574ba148953fea1f78428d4b7c6843e759711f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/14f802b2c00b672676d55612e3c0d03465b69bf6", - "reference": "14f802b2c00b672676d55612e3c0d03465b69bf6", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/a574ba148953fea1f78428d4b7c6843e759711f3", + "reference": "a574ba148953fea1f78428d4b7c6843e759711f3", "shasum": "" }, "require": { @@ -2065,7 +2065,7 @@ } ], "description": "A script to automatically fix Symfony Coding Standard", - "time": "2015-04-09 19:10:26" + "time": "2015-04-13 21:33:33" }, { "name": "league/climate", diff --git a/dev/tests/api-functional/config/install-config-mysql.php.dist b/dev/tests/api-functional/config/install-config-mysql.php.dist index 96949ee5bf8ab889adceb33e4a1d353e73dc3dac..535cfb7232e8f1ef2a58a98916fe49b98bea5d6a 100644 --- a/dev/tests/api-functional/config/install-config-mysql.php.dist +++ b/dev/tests/api-functional/config/install-config-mysql.php.dist @@ -12,7 +12,7 @@ return [ 'db_host' => 'localhost', 'db_name' => 'magento_functional_tests', 'db_user' => 'root', - 'db_pass' => '', + 'db_password' => '', 'backend_frontname' => 'backend', 'base_url' => 'http://localhost/', 'use_secure' => '0', @@ -20,7 +20,7 @@ return [ 'admin_lastname' => 'Admin', 'admin_firstname' => 'Admin', 'admin_email' => 'admin@example.com', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => '123123q', 'admin_use_security_key' => '0', /* PayPal has limitation for order number - 20 characters. 10 digits prefix + 8 digits number is good enough */ diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php b/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php index 0695e5fbe7dd5b3dc5349d9bd9fc029cbec26229..56936fa716784c7ea003afd93e87ab31da048817 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php @@ -33,7 +33,7 @@ class WebApiApplication extends Application /* Install application */ if ($installOptions) { - $installCmd = 'php -f ' . BP . '/setup/index.php install'; + $installCmd = 'php -f ' . BP . '/bin/magento setup:install'; $installArgs = []; foreach ($installOptions as $optionName => $optionValue) { if (is_bool($optionValue)) { diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index 5f5074addbc3975433141b19987cf6e9df6a55e1..efe7c5458aabed79e36e4a3ffaa646832910f8f9 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc22", + "magento/mtf": "1.0.0-rc23", "php": "~5.5.0|~5.6.0", "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2", diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php index bd53879a52018d712e7ef1bdc5ef38e59caa8022..dbc8efa6e71ccd62e5fdeaf17c86b749c2e44f0f 100755 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php @@ -13,11 +13,8 @@ use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Fixture\InjectableFixture; use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Client\Element\SimpleElement; -use Magento\Mtf\Util\Iterator\File; -use Magento\Mtf\Util\XmlConverter; /** - * Class FormTabs * Is used to represent any form with tabs on the page * * @SuppressWarnings(PHPMD.NumberOfChildren) @@ -30,11 +27,6 @@ class FormTabs extends Form */ protected $tabs = []; - /** - * @var XmlConverter - */ - protected $xmlConverter; - /** * Fields which aren't assigned to any tab * @@ -48,7 +40,6 @@ class FormTabs extends Form * @param Mapper $mapper * @param BlockFactory $blockFactory * @param BrowserInterface $browser - * @param XmlConverter $xmlConverter * @param array $config */ public function __construct( @@ -56,46 +47,17 @@ class FormTabs extends Form Mapper $mapper, BlockFactory $blockFactory, BrowserInterface $browser, - XmlConverter $xmlConverter, array $config = [] ) { - $this->xmlConverter = $xmlConverter; parent::__construct($element, $blockFactory, $mapper, $browser, $config); } /** * Initialize block */ - protected function _init() + protected function init() { - $this->tabs = $this->getTabs(); - } - - /** - * Get all tabs on the form - * - * @return array - */ - protected function getTabs() - { - $result = []; - - $paths = glob( - MTF_TESTS_PATH . preg_replace('/Magento\/\w+/', '*/*', str_replace('\\', '/', get_class($this))) . '.xml' - ); - $files = new File($paths); - - foreach ($files as $file) { - $presetXml = simplexml_load_string($file); - if ($presetXml instanceof \SimpleXMLElement) { - $array = $this->xmlConverter->convert($presetXml); - if (is_array($array)) { - $result = array_replace_recursive($result, $array); - } - } - } - - return $result; + $this->tabs = $this->getFormMapping(); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php index 78e8c9965593fd9adc49af1d4885e8320472dab5..7147f86db8877e960013a314798fcd795f1b7f9a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php @@ -15,7 +15,6 @@ use Magento\Mtf\Client\Element; use Magento\Mtf\Client\Element\SimpleElement; use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Util\XmlConverter; /** * Edit attribute form on catalog product edit page. @@ -49,7 +48,6 @@ class AttributeForm extends FormTabs * @param Mapper $mapper * @param BlockFactory $blockFactory * @param BrowserInterface $browser - * @param XmlConverter $xmlConverter * @param array $config */ public function __construct( @@ -57,10 +55,9 @@ class AttributeForm extends FormTabs Mapper $mapper, BlockFactory $blockFactory, BrowserInterface $browser, - XmlConverter $xmlConverter, array $config = [] ) { - parent::__construct($element, $mapper, $blockFactory, $browser, $xmlConverter, $config); + parent::__construct($element, $mapper, $blockFactory, $browser, $config); $this->browser->switchToFrame(new Locator($this->iFrame)); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml index 2a4163d237a8b8ceb913303ba10463ca8a789db5..ff3443eee0b503bc7c5d17caed6389d4b8226690 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml @@ -6,19 +6,16 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CatalogProductView" area="Product" mca="catalog/product/view" module="Magento_Catalog"> - <block name="viewBlock" class="Magento\Catalog\Test\Block\Product\View" locator="#maincontent" strategy="css selector"/> - <block name="additionalInformationBlock" class="Magento\Catalog\Test\Block\Product\Additional" locator="#additional" strategy="css selector"/> - <block name="customOptionsBlock" class="Magento\Catalog\Test\Block\Product\View\CustomOptions" locator="#product-options-wrapper" strategy="css selector"/> - <block name="relatedProductBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Related" locator=".block.related" strategy="css selector"/> - <block name="upsellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Upsell" locator=".block.upsell" strategy="css selector"/> - <block name="crosssellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Crosssell" locator=".block.crosssell" strategy="css selector"/> - <block name="downloadableLinksBlock" class="Magento\Downloadable\Test\Block\Catalog\Product\View\Links" locator="[data-container-for=downloadable-links]" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector"/> - <block name="reviewSummary" class="Magento\Review\Test\Block\Product\View\Summary" locator=".product-reviews-summary" strategy="css selector"/> - <block name="customerReviewBlock" class="Magento\Review\Test\Block\Product\View" locator="#customer-reviews" strategy="css selector"/> - <block name="reviewFormBlock" class="Magento\Review\Test\Block\Form" locator="#review-form" strategy="css selector"/> - <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper h1.page-title .base" strategy="css selector"/> - <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".column.main .widget" strategy="css selector"/> - </page> + <page name="CatalogProductView" area="Product" mca="catalog/product/view" module="Magento_Catalog"> + <block name="viewBlock" class="Magento\Catalog\Test\Block\Product\View" locator="#maincontent" strategy="css selector" /> + <block name="additionalInformationBlock" class="Magento\Catalog\Test\Block\Product\Additional" locator="#additional" strategy="css selector" /> + <block name="customOptionsBlock" class="Magento\Catalog\Test\Block\Product\View\CustomOptions" locator="#product-options-wrapper" strategy="css selector" /> + <block name="relatedProductBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Related" locator=".block.related" strategy="css selector" /> + <block name="upsellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Upsell" locator=".block.upsell" strategy="css selector" /> + <block name="crosssellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Crosssell" locator=".block.crosssell" strategy="css selector" /> + <block name="downloadableLinksBlock" class="Magento\Downloadable\Test\Block\Catalog\Product\View\Links" locator="[data-container-for=downloadable-links]" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector" /> + <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper h1.page-title .base" strategy="css selector" /> + <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".column.main .widget" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml index 11c19fd14519b9b8fd6cb122f3214f981d06309a..0d8c49414fb80ba6fd05ed3c27f40f16fe79731f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml @@ -182,7 +182,6 @@ <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="issue" xsi:type="string">Bug: MAGETWO-33625</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php index 26135d5e646639ed286f07201c4272ae3b881fa1..6649d45ba0e6312653b5c6766ab1727f20786aed 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php @@ -33,7 +33,7 @@ class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest const TEST_TYPE = 'acceptance_test'; const MVP = 'yes'; const DOMAIN = 'MX'; - const TO_MAINTAIN = 'yes'; + const TO_MAINTAIN = 'yes'; // Selecting conditions in parallel mode /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php index 5d61be2bc1db1684505cf80daacf47325099a719..3bfb458f34130b1fe4b33f4d45b056c208a00aa4 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertOrderTotalOnReviewPage.php @@ -10,8 +10,7 @@ use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertOrderTotalOnReviewPage - * Assert that Order Grand Total is correct on checkoutOnePage + * Assert that Order Grand Total is correct on checkoutOnePage. */ class AssertOrderTotalOnReviewPage extends AbstractConstraint { @@ -19,18 +18,17 @@ class AssertOrderTotalOnReviewPage extends AbstractConstraint * Assert that Order Grand Total is correct on checkoutOnePage * * @param CheckoutOnepage $checkoutOnepage - * @param string $grandTotal + * @param array $prices * @return void */ - public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal) + public function processAssert(CheckoutOnepage $checkoutOnepage, array $prices) { $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal(); \PHPUnit_Framework_Assert::assertEquals( $checkoutReviewGrandTotal, - number_format($grandTotal, 2), - 'Grand Total price: \'' . $checkoutReviewGrandTotal - . '\' not equals with price from data set: \'' . $grandTotal . '\'' + number_format($prices['grandTotal'], 2), + "Grand Total price: $checkoutReviewGrandTotal not equals with price from data set: " . $prices['grandTotal'] ); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php index 7adfc7fc1ac63ea36b5a5eb242356dc80690ac82..f0c4143e4e91b985627ff89669da80783441f69c 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php @@ -12,41 +12,40 @@ use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; use Magento\Mtf\TestStep\TestStepInterface; /** - * Class PlaceOrderStep - * Place order in one page checkout + * Place order in one page checkout. */ class PlaceOrderStep implements TestStepInterface { /** - * Onepage checkout page + * Onepage checkout page. * * @var CheckoutOnepage */ protected $checkoutOnepage; /** - * Assert that Order Grand Total is correct on checkout page review block + * Assert that Order Grand Total is correct on checkout page review block. * * @var AssertOrderTotalOnReviewPage */ protected $assertOrderTotalOnReviewPage; /** - * One page checkout success page + * One page checkout success page. * * @var CheckoutOnepageSuccess */ protected $checkoutOnepageSuccess; /** - * Grand total price + * Price array. * * @var string */ - protected $grandTotal; + protected $prices; /** - * Checkout method + * Checkout method. * * @var string */ @@ -58,31 +57,31 @@ class PlaceOrderStep implements TestStepInterface * @param AssertOrderTotalOnReviewPage $assertOrderTotalOnReviewPage * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param string $checkoutMethod - * @param string|null $grandTotal + * @param array $prices */ public function __construct( CheckoutOnepage $checkoutOnepage, AssertOrderTotalOnReviewPage $assertOrderTotalOnReviewPage, CheckoutOnepageSuccess $checkoutOnepageSuccess, $checkoutMethod, - $grandTotal = null + array $prices = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertOrderTotalOnReviewPage = $assertOrderTotalOnReviewPage; - $this->grandTotal = $grandTotal; + $this->prices = $prices; $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; $this->checkoutMethod = $checkoutMethod; } /** - * Place order after checking order totals on review step + * Place order after checking order totals on review step. * * @return array */ public function run() { - if ($this->grandTotal !== null) { - $this->assertOrderTotalOnReviewPage->processAssert($this->checkoutOnepage, $this->grandTotal); + if (!empty($this->prices)) { + $this->assertOrderTotalOnReviewPage->processAssert($this->checkoutOnepage, $this->prices); } $this->checkoutOnepage->getReviewBlock()->placeOrder(); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml index eeea09970da769ab9eb00d22491aa9b4d6937999..3261040052d7dcff7d440a05031dc7e563d9eb03 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml @@ -55,17 +55,6 @@ <field name="gender" xsi:type="string">Male</field> </dataset> - <dataset name="johndoe_with_balance"> - <field name="firstname" xsi:type="string">John</field> - <field name="lastname" xsi:type="string">Doe</field> - <field name="email" xsi:type="string">JohnDoe_%isolation%@example.com</field> - <field name="password" xsi:type="string">123123q</field> - <field name="password_confirmation" xsi:type="string">123123q</field> - <field name="dob" xsi:type="string">01/01/1990</field> - <field name="gender" xsi:type="string">Male</field> - <field name="amount_delta" xsi:type="string">501</field> - </dataset> - <dataset name="defaultBackend"> <field name="website_id" xsi:type="string">Main Website</field> <field name="firstname" xsi:type="string">John</field> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml index a7697b5d62a60d863bf99a8b6c298cadb63b6f55..69a8cb56138fc5d25a46a3eb72ac00e5dd66be17 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml @@ -15,18 +15,9 @@ <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> <data name="product/data/downloadable_sample/preset" xsi:type="string">with_three_samples</data> <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> <data name="product/data/custom_options/preset" xsi:type="string">two_options</data> - <data name="product/data/special_price" xsi:type="string">-</data> <data name="isRequired" xsi:type="string">No</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> @@ -46,18 +37,8 @@ <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">50</data> <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> <data name="isRequired" xsi:type="string">No</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> @@ -71,20 +52,11 @@ <data name="product/data/price/value" xsi:type="string">9999</data> <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">123</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">No</data> <data name="product/data/stock_data/min_qty" xsi:type="string">123</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> <data name="isRequired" xsi:type="string">No</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> @@ -100,18 +72,9 @@ <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> <data name="product/data/category" xsi:type="string">Default Category</data> <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> <data name="isRequired" xsi:type="string">No</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> @@ -127,18 +90,11 @@ <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/special_price" xsi:type="string">-</data> <data name="isRequired" xsi:type="string">Yes</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> @@ -159,16 +115,6 @@ <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="product/data/is_virtual" xsi:type="string">Yes</data> <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> <data name="product/data/special_price" xsi:type="string">40</data> <data name="isRequired" xsi:type="string">No</data> <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/CheckoutData.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/CheckoutData.php index 2871ec912db01ef8020b14699f62d95c6f7299ac..5c45ad254c0b02f4444547e1b95ebba7fedf2727 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/CheckoutData.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/CheckoutData.php @@ -57,6 +57,39 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch ], ], ], + 'three_simple_products_default_qty' => [ + 'options' => [ + [ + 'name' => 'product_key_0', + 'qty' => 17, + ], + [ + 'name' => 'product_key_1', + 'qty' => 36 + ], + [ + 'name' => 'product_key_2', + 'qty' => 20 + ], + ], + 'cartItem' => [ + 'price' => [ + 'product_key_0' => 560, + 'product_key_1' => 40, + 'product_key_2' => 100, + ], + 'qty' => [ + 'product_key_0' => 17, + 'product_key_1' => 36, + 'product_key_2' => 20, + ], + 'subtotal' => [ + 'product_key_0' => 9520.00, + 'product_key_1' => 1440.00, + 'product_key_2' => 2000.00, + ], + ], + ], ]; return isset($presets[$name]) ? $presets[$name] : null; } diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml index cd0bc02b3df4ccab18c34b1876eef98e775af553..fbf4305699a447b37e9a8d1bd756caec8f1f569e 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml @@ -117,5 +117,34 @@ <item name="preset" xsi:type="string">three_simple_products</item> </field> </dataset> + + <dataset name="three_simple_products_default_qty"> + <field name="name" xsi:type="string">Grouped product %isolation%</field> + <field name="sku" xsi:type="string">grouped_product_%isolation%</field> + <field name="category_ids" xsi:type="array"> + <item name="presets" xsi:type="string">default</item> + </field> + <field name="associated" xsi:type="array"> + <item name="preset" xsi:type="string">three_simple_products</item> + </field> + <field name="status" xsi:type="string">Product online</field> + <field name="visibility" xsi:type="string">Catalog, Search</field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="url_key" xsi:type="string">test-grouped-product-%isolation%</field> + <field name="quantity_and_stock_status" xsi:type="array"> + <item name="is_in_stock" xsi:type="string">In Stock</item> + </field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="checkout_data" xsi:type="array"> + <item name="preset" xsi:type="string">three_simple_products_default_qty</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php index 74ec107e09a60690f1292e847fbc0a5c289f41b0..fbfb262f1206d798a750dcfede4c913b96eed3c5 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php @@ -90,7 +90,7 @@ class InstallTest extends Injectable { $magentoBaseDir = dirname(dirname(dirname(MTF_BP))); // Uninstall Magento. - shell_exec("php -f $magentoBaseDir/setup/index.php uninstall"); + shell_exec("php -f $magentoBaseDir/bin/magento setup:uninstall -n"); $this->installPage = $installPage; $this->homePage = $homePage; } diff --git a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml index 068ba800210194b403fb71f6770fe927ce707690..8cdbbc48f92df79fe9ed26fb4b4dacd751c923c9 100644 --- a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml @@ -103,12 +103,6 @@ </dataset> <dataset name="checkmo_specificcountry_gb_rollback"> - <field name="payment/checkmo/active" xsi:type="array"> - <item name="scope" xsi:type="string">payment</item> - <item name="scope_id" xsi:type="number">1</item> - <item name="label" xsi:type="string">No</item> - <item name="value" xsi:type="number">0</item> - </field> <field name="payment/checkmo/allowspecific" xsi:type="array"> <item name="scope" xsi:type="string">payment</item> <item name="scope_id" xsi:type="number">1</item> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/ReviewForm.php old mode 100755 new mode 100644 similarity index 98% rename from dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.php rename to dev/tests/functional/tests/app/Magento/Review/Test/Block/ReviewForm.php index 449bc91419bbdd368b4451d28887e03ed3661e56..ae9ad57029992bccbd9fdab092443967b673161e --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/ReviewForm.php @@ -16,7 +16,7 @@ use Magento\Mtf\Block\Form as AbstractForm; /** * Review form on frontend. */ -class Form extends AbstractForm +class ReviewForm extends AbstractForm { /** * Legend selector. diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Block/ReviewForm.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/functional/tests/app/Magento/Review/Test/Block/Form.xml rename to dev/tests/functional/tests/app/Magento/Review/Test/Block/ReviewForm.xml diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Product/CatalogProductView.xml new file mode 100644 index 0000000000000000000000000000000000000000..4e80f240eb1210acb7a23f17991390c3368ee5a9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Product/CatalogProductView.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CatalogProductView" area="Product" mca="catalog/product/view" module="Magento_Catalog"> + <block name="reviewSummary" class="Magento\Review\Test\Block\Product\View\Summary" locator=".product-reviews-summary" strategy="css selector" /> + <block name="customerReviewBlock" class="Magento\Review\Test\Block\Product\View" locator="#customer-reviews" strategy="css selector" /> + <block name="reviewFormBlock" class="Magento\Review\Test\Block\ReviewForm" locator="#review-form" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Coupons.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Coupons.php new file mode 100644 index 0000000000000000000000000000000000000000..e118bac1958fb0b3c9d0906bdafe181e157a9a7b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Coupons.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\Create; + +use Magento\Backend\Test\Block\Widget\Form; +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\Client\Locator; + +/** + * Adminhtml sales order create coupons block. + */ +class Coupons extends Form +{ + /** + * Fill discount code input selector. + * + * @var string + */ + protected $couponCode = 'input[name="coupon_code"]'; + + /** + * Click apply button selector. + * + * @var string + */ + protected $applyButton = '//*[@id="coupons:code"]/following-sibling::button'; + + /** + * Enter discount code and click apply button. + * + * @param SalesRuleInjectable $code + * @return void + */ + public function applyCouponCode(SalesRuleInjectable $code) + { + $this->_rootElement->find($this->couponCode)->setValue($code->getCouponCode()); + $this->_rootElement->find($this->applyButton, Locator::SELECTOR_XPATH)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php index f9c089f1a25d99465df54d38fdc02023c7916d3f..f11fc5fce5417a63c7aee70db7ba264f8dc38190 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities/Sidebar.php @@ -29,15 +29,15 @@ abstract class Sidebar extends Block protected $addToOrderProductName = '//tr/td[.="%s"]'; /** - * Add product to order by name. + * Add productz to order. * - * @param string|array $names + * @param array $products * @return void */ - public function addToOrderByName($names) + public function addProductsToOrder(array $products) { - $names = is_array($names) ? $names : [$names]; - foreach ($names as $name) { + foreach ($products as $product) { + $name = $product->getName(); $this->_rootElement->find(sprintf($this->addToOrderProductName, $name), Locator::SELECTOR_XPATH)->click(); $this->_rootElement->click(); $this->_rootElement->find(sprintf($this->addToOrder, $name), Locator::SELECTOR_XPATH, 'checkbox') diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Items.php index 7d2aec9dd17a3a28781cb7bdaeedffc277252f1b..03481f3e5b9eeaa0799429519d06796eb6b69ccd 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Items.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Items.php @@ -11,31 +11,30 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Class Items - * Adminhtml sales order create items block + * Adminhtml sales order create items block. */ class Items extends Block { /** - * 'Add Products' button + * 'Add Products' button. * * @var string */ protected $addProducts = "//button[span='Add Products']"; /** - * Item product + * Item product. * * @var string */ protected $itemProduct = '//tr[td//*[normalize-space(text())="%s"]]'; /** - * Product names + * Product names. * * @var string */ - protected $productNames = '//td[@class="col-product"]//span'; + protected $productNames = '//td[@class="col-product"]/span'; /** * Selector for template block. @@ -45,7 +44,7 @@ class Items extends Block protected $template = './ancestor::body'; /** - * Click 'Add Products' button + * Click 'Add Products' button. * * @return void */ @@ -63,7 +62,7 @@ class Items extends Block } /** - * Get item product block + * Get item product block. * * @param string $name * @return \Magento\Sales\Test\Block\Adminhtml\Order\Create\Items\ItemProduct diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..47e544da94f09bc336e7f58cb40ef84b443c192a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo; + +use Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm; +use Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items; + +/** + * Credit memo create form. + */ +class Form extends AbstractForm +{ + /** + * Items block css selector. + * + * @var string + */ + protected $items = '#creditmemo_item_container'; + + /** + * Get items block. + * + * @return Items + */ + public function getItemsBlock() + { + return $this->blockFactory->create( + 'Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items', + ['element' => $this->_rootElement->find($this->items)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.xml new file mode 100644 index 0000000000000000000000000000000000000000..7e75ac518b8e7a2e66c38e5d9798c220d281e39f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <wrapper>creditmemo</wrapper> + <fields> + <comment_text /> + <shipping_amount /> + <adjustment_positive /> + <adjustment_negative /> + <comment_customer_notify> + <input>checkbox</input> + </comment_customer_notify> + <send_email> + <input>checkbox</input> + </send_email> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php new file mode 100644 index 0000000000000000000000000000000000000000..c97952243ea70985dd0690237b1e66ca5cdf0419 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form; + +use Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product; +use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Credit Memo Items block on Credit Memo new page. + */ +class Items extends Block +{ + /** + * Item product. + * + * @var string + */ + protected $productItems = '//tr[contains(.,"%s")]'; + + /** + * 'Update Qty's' button css selector. + * + * @var string + */ + protected $updateQty = '.update-button'; + + /** + * Get item product block. + * + * @param FixtureInterface $product + * @return Product + */ + public function getItemProductBlock(FixtureInterface $product) + { + $selector = sprintf($this->productItems, $product->getSku()); + return $this->blockFactory->create( + 'Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product', + ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Click update qty button. + * + * @return void + */ + public function clickUpdateQty() + { + $this->_rootElement->find($this->updateQty)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.php new file mode 100644 index 0000000000000000000000000000000000000000..bf367ef4339cc3cd06fbd943698c8a478ae0c47b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items; + +/** + * Item product form on credit memo items block. + */ +class Product extends \Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm\Product +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.xml new file mode 100644 index 0000000000000000000000000000000000000000..afde45a79835db8a6c029b9980af9a9685a3ad99 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items/Product.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <fields> + <qty> + <selector>[name$="[qty]"]</selector> + </qty> + <back_to_stock> + <selector>[name$="[back_to_stock]"]</selector> + <input>checkbox</input> + </back_to_stock> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php new file mode 100644 index 0000000000000000000000000000000000000000..a974bbb8b9aadb6739b31e79682eafb491b74e13 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo; + +use Magento\Mtf\Client\Locator; + +/** + * Invoice totals block. + */ +class Totals extends \Magento\Sales\Test\Block\Adminhtml\Order\Totals +{ + /** + * Submit invoice button selector. + * + * @var string + */ + protected $submit = '[data-ui-id="order-items-submit-button"]'; + + /** + * Capture amount select selector. + * + * @var string + */ + protected $capture = '[name="invoice[capture_case]"]'; + + /** + * Submit invoice. + * + * @return void + */ + public function submit() + { + $browser = $this->_rootElement; + $selector = $this->submit . '.disabled'; + $strategy = Locator::SELECTOR_CSS; + $browser->waitUntil( + function () use ($browser, $selector, $strategy) { + $element = $browser->find($selector, $strategy); + return $element->isVisible() == false ? true : null; + } + ); + $this->_rootElement->find($this->submit)->click(); + } + + /** + * Set Capture amount option: + * Capture Online|Capture Offline|Not Capture + * + * @param string $option + * @return void + */ + public function setCaptureOption($option) + { + $this->_rootElement->find($this->capture, Locator::SELECTOR_CSS, 'select')->setValue($option); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Grid.php index 8b43fc9c27ba44de78336999a4abb55aa4278999..7895c39a3a07399c78144d6f96ac6491d794eac0 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Grid.php @@ -9,14 +9,14 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Invoice; use Magento\Backend\Test\Block\Widget\Grid as GridInterface; /** - * Class Grid - * Sales order grid - * + * Sales order grid. */ class Grid extends GridInterface { /** - * {@inheritdoc} + * Filters array mapping. + * + * @var array */ protected $filters = [ 'id' => [ @@ -25,50 +25,42 @@ class Grid extends GridInterface ]; /** - * Invoice amount + * Invoice amount. * * @var string */ protected $invoiceAmount = 'td.col-qty.col-base_grand_total'; /** - * An element locator which allows to select entities in grid + * An element locator which allows to select entities in grid. * * @var string */ protected $selectItem = 'tbody tr .col-invoice-number'; /** - * Get first invoice amount + * Get first invoice amount. * - * @return array|string + * @return string */ public function getInvoiceAmount() { - $invoiceAmount = $this->getInvoiceAmountElement()->getText(); + $invoiceAmount = $this->_rootElement->find($this->invoiceAmount)->getText(); return $this->escapeCurrency($invoiceAmount); } /** - * Click the first invoice amount + * Click the first invoice amount. * * @return void */ public function clickInvoiceAmount() { - $this->getInvoiceAmountElement()->click(); - } - - /** - * @return mixed|\Magento\Mtf\Client\Element - */ - private function getInvoiceAmountElement() - { - return $this->_rootElement->find($this->invoiceAmount); + $this->_rootElement->find($this->invoiceAmount)->click(); } /** - * Method that escapes currency symbols + * Method that escapes currency symbols. * * @param string $price * @return string|null diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php index 377cd4ba869dcf5fe606ce367a5b690f946c0442..f0fa33ca3a36d6e9e94681be8617915cee97c5f8 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php @@ -7,13 +7,12 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order; /** - * Class StatusGrid - * Backend sales order's status management grid + * Backend sales order's status management grid. */ class StatusGrid extends \Magento\Backend\Test\Block\Widget\Grid { /** - * Filters array mapping + * Filters array mapping. */ protected $filters = [ 'label' => [ @@ -28,7 +27,7 @@ class StatusGrid extends \Magento\Backend\Test\Block\Widget\Grid ]; /** - * Locator value for link in action column + * Locator value for link in action column. * * @var string */ @@ -42,7 +41,7 @@ class StatusGrid extends \Magento\Backend\Test\Block\Widget\Grid protected $unassignLink = '[data-column="unassign"] a'; /** - * Search custom status and unassign it + * Search custom status and unassign it. * * @param array $filter * @throws \Exception diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php index aac809e587dc15dec3869fd4730c4313dedb74b0..2cff2dad1f87ba3907482716c35b7f6953b78044 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php @@ -7,36 +7,12 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab; use Magento\Mtf\Block\Block; -use Magento\Mtf\Client\Locator; /** - * Class Info - * Order information tab block - * + * Order information tab block. */ class Info extends Block { - /** - * 3D Secure Verification Result - * - * @var string - */ - protected $_verificationResult = '//tr[normalize-space(th)="3D Secure Verification Result:"]/td'; - - /** - * 3D Secure Cardholder Validation - * - * @var string - */ - protected $_cardholderValidation = '//tr[normalize-space(th)="3D Secure Cardholder Validation:"]/td'; - - /** - * 3D Secure Electronic Commerce Indicator - * - * @var string - */ - protected $_eCommerceIndicator = '//tr[normalize-space(th)="3D Secure Electronic Commerce Indicator:"]/td'; - /** * Order status selector * @@ -44,36 +20,6 @@ class Info extends Block */ protected $orderStatus = '#order_status'; - /** - * Get 3D Secure Verification Result - * - * @return array|string - */ - public function getVerificationResult() - { - return $this->_rootElement->find($this->_verificationResult, Locator::SELECTOR_XPATH)->getText(); - } - - /** - * Get 3D Secure Verification Result - * - * @return array|string - */ - public function getCardholderValidation() - { - return $this->_rootElement->find($this->_cardholderValidation, Locator::SELECTOR_XPATH)->getText(); - } - - /** - * Get 3D Secure Electronic Commerce Indicator - * - * @return array|string - */ - public function getEcommerceIndicator() - { - return $this->_rootElement->find($this->_eCommerceIndicator, Locator::SELECTOR_XPATH)->getText(); - } - /** * Get order status from info block * diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php index bacbfe439e5591e8d9439d13d450d8a73fb6f504..0a2f39e06c7ac7e1db5aadec37d8f9b259b8b55f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php @@ -27,7 +27,7 @@ class History extends Block * * @var string */ - protected $itemOrder = '//tr[td[contains(@class, "id") and normalize-space(.)="%d"]]'; + protected $itemOrder = '//tr[td[contains(@class, "id") and normalize-space(.)="%s"]]'; /** * Order total css selector. diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View.php index c8cb4a49db99ea30bfb4df35c1188ab72cef5c2f..04424257520c5c3fb7b7870add0d646c437c1ed5 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View.php @@ -155,6 +155,7 @@ class View extends Block public function openLinkByName($name) { $this->_rootElement->find(sprintf($this->link, $name), Locator::SELECTOR_XPATH)->click(); + sleep(3); // TODO: remove after resolving an issue with ajax on Frontend. } /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View/ActionsToolbar.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View/ActionsToolbar.php index 4c5756fecffd692f2951fa4f406f36b5de2ce106..bee100f5630759b0c4471635a4e3ec82de5be052 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View/ActionsToolbar.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/View/ActionsToolbar.php @@ -23,6 +23,9 @@ class ActionsToolbar extends Block /** * Click link on this page. + * + * @param string $linkName + * @throws \Exception */ public function clickLink($linkName) { diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..8f12c2710722401f17d38ac9354f56511f53da80 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Block\Widget\Guest; + +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Customer\Test\Fixture\Customer; + +/** + * Orders and Returns form search block. + */ +class Form extends \Magento\Mtf\Block\Form +{ + /** + * Search button selector. + * + * @var string + */ + protected $searchButtonSelector = '.action.submit'; + + /** + * Selector for loads form. + * + * @var string + */ + protected $loadsForm = 'div[id*=oar] input'; + + /** + * Fill the form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @param bool $isSearchByEmail [optional] + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null, $isSearchByEmail = true) + { + if ($fixture instanceof InjectableFixture) { + /** @var OrderInjectable $fixture */ + /** @var Customer $customer */ + $customer = $fixture->getDataFieldConfig('customer_id')['source']->getCustomer(); + $data = [ + 'order_id' => $fixture->getId(), + 'billing_last_name' => $customer->getLastname(), + ]; + + if ($isSearchByEmail) { + $data['find_order_by'] = 'Email'; + $data['email_address'] = $customer->getEmail(); + } else { + $data['find_order_by'] = 'ZIP Code'; + $data['billing_zip_code'] = $fixture->getDataFieldConfig('billing_address_id')['source']->getPostcode(); + } + } else { + $data = $fixture->getData(); + } + $fields = isset($data['fields']) ? $data['fields'] : $data; + $mapping = $this->dataMapping($fields); + + $this->waitLoadForm(); + $this->_fill($mapping, $element); + + return $this; + } + + /** + * Wait while form is loading. + * + * @return void + */ + protected function waitLoadForm() + { + $rootElement = $this->_rootElement; + $selector = $this->loadsForm; + $this->browser->waitUntil( + function () use ($rootElement, $selector) { + $inputs = $rootElement->getElements($selector); + $i = 0; + foreach ($inputs as $input) { + if ($input->isVisible()) { + ++$i; + } + } + return $i == 1 ? true : null; + } + ); + } + + /** + * Submit search form. + * + * @return void + */ + public function submit() + { + $this->_rootElement->find($this->searchButtonSelector, Locator::SELECTOR_CSS)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.xml new file mode 100644 index 0000000000000000000000000000000000000000..dcbdad87eeb4d8c7d6c5790a9402e91d509ebae6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <fields> + <order_id> + <selector>[name='oar_order_id']</selector> + </order_id> + <billing_last_name> + <selector>[name='oar_billing_lastname']</selector> + </billing_last_name> + <find_order_by> + <selector>[name='oar_type']</selector> + <input>select</input> + </find_order_by> + <email_address> + <selector>[name='oar_email']</selector> + </email_address> + <billing_zip_code> + <selector>[name='oar_zip']</selector> + </billing_zip_code> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderButtonsAvailable.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderButtonsAvailable.php index 676561e9aa8e9ac374bf226d5b3873677a665967..f2b7260f8930604b3eaebddbb5ffc0640bf8d3d0 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderButtonsAvailable.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderButtonsAvailable.php @@ -6,27 +6,26 @@ namespace Magento\Sales\Test\Constraint; -use Magento\Sales\Test\Page\SalesOrder; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertOrderButtonsAvailable - * Assert that specified in data set buttons exist on order page in backend + * Assert that specified in data set buttons exist on order page in backend. */ class AssertOrderButtonsAvailable extends AbstractConstraint { /** - * Assert that specified in data set buttons exist on order page in backend + * Assert that specified in data set buttons exist on order page in backend. * - * @param SalesOrder $salesOrder + * @param SalesOrderView $salesOrderView * @param string $orderButtonsAvailable * @return void */ - public function processAssert(SalesOrder $salesOrder, $orderButtonsAvailable) + public function processAssert(SalesOrderView $salesOrderView, $orderButtonsAvailable) { $buttons = explode(',', $orderButtonsAvailable); $absentButtons = []; - $actionsBlock = $salesOrder->getOrderActionsBlock(); + $actionsBlock = $salesOrderView->getPageActions(); foreach ($buttons as $button) { $button = trim($button); @@ -42,7 +41,7 @@ class AssertOrderButtonsAvailable extends AbstractConstraint } /** - * Returns string representation of successful assertion + * Returns string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php index 1630e60c334d05e41de2d4e4f2b0aa5003330ceb..2e88c267f38b0603d81edb6fa8a38dd2f81ac266 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php @@ -26,14 +26,14 @@ class AssertOrderCommentsHistory extends AbstractConstraint * @param SalesOrderView $salesOrderView * @param OrderIndex $salesOrder * @param string $orderId - * @param string $grandTotal + * @param array $prices * @return void */ public function processAssert( SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, - $grandTotal + array $prices ) { $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); @@ -41,7 +41,7 @@ class AssertOrderCommentsHistory extends AbstractConstraint $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory(); \PHPUnit_Framework_Assert::assertContains( - self::AUTHORIZED_AMOUNT . $grandTotal, + self::AUTHORIZED_AMOUNT . $prices['grandTotal'], $actualAuthorizedAmount, 'Incorrect authorized amount value for the order #' . $orderId ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php index d5ba1959297105811209aa3dbbd30321748bfcdd..f0a84298aaa2108f02e364065b1505ad426bc86b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderGrandTotal.php @@ -21,20 +21,20 @@ class AssertOrderGrandTotal extends AbstractConstraint * @param SalesOrderView $salesOrderView * @param string $orderId * @param OrderIndex $salesOrder - * @param string $grandTotal + * @param array $prices * @return void */ public function processAssert( SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, - $grandTotal + array $prices ) { $salesOrder->open(); $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); \PHPUnit_Framework_Assert::assertEquals( - $grandTotal, + $prices['grandTotal'], $salesOrderView->getOrderTotalsBlock()->getGrandTotal(), 'Grand Total price does not equal to price from data set.' ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderNotVisibleOnMyAccount.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderNotVisibleOnMyAccount.php index 7967bf579874021a78f52deb2df10e49afab26e7..cd1d86ea1740c7c0588f3c4eb9c239c1f2b3e7b8 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderNotVisibleOnMyAccount.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderNotVisibleOnMyAccount.php @@ -11,24 +11,17 @@ use Magento\Customer\Test\Page\CustomerAccountIndex; use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Sales\Test\Page\OrderHistory; use Magento\Mtf\Constraint\AbstractConstraint; -use Magento\Mtf\ObjectManager; /** - * Class AssertOrderNotVisibleOnMyAccount - * Assert order is not visible in customer account on frontend + * Assert order is not visible in customer account on frontend. */ class AssertOrderNotVisibleOnMyAccount extends AbstractConstraint { - /* tags */ - const SEVERITY = 'low'; - /* end tags */ - /** * Assert order is not visible in customer account on frontend * * @param OrderInjectable $order * @param Customer $customer - * @param ObjectManager $objectManager * @param CustomerAccountIndex $customerAccountIndex * @param OrderHistory $orderHistory * @param string $status @@ -37,7 +30,6 @@ class AssertOrderNotVisibleOnMyAccount extends AbstractConstraint public function processAssert( OrderInjectable $order, Customer $customer, - ObjectManager $objectManager, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory, $status @@ -46,14 +38,14 @@ class AssertOrderNotVisibleOnMyAccount extends AbstractConstraint 'id' => $order->getId(), 'status' => $status, ]; - $customerLogin = $objectManager->create( + $this->objectManager->create( 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', ['customer' => $customer] - ); - $customerLogin->run(); + )->run(); $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders'); \PHPUnit_Framework_Assert::assertFalse( - $orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), + $orderHistory->getOrderHistoryBlock()->isVisible() + && $orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), 'Order with following data \'' . implode(', ', $filter) . '\' is present in Orders block on frontend.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertSalesPrintOrderGrandTotal.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertSalesPrintOrderGrandTotal.php index 8c6e930acbf77be7370b1f6b4743fb3c0d44e457..7369b9449d31a91767112e44fa822c12b4c7c8aa 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertSalesPrintOrderGrandTotal.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertSalesPrintOrderGrandTotal.php @@ -18,13 +18,13 @@ class AssertSalesPrintOrderGrandTotal extends AbstractConstraint * Assert that Grand Total price was printed correctly on sales guest print page. * * @param SalesGuestPrint $salesGuestPrint - * @param string $grandTotal + * @param array $prices * @return void */ - public function processAssert(SalesGuestPrint $salesGuestPrint, $grandTotal) + public function processAssert(SalesGuestPrint $salesGuestPrint, array $prices) { \PHPUnit_Framework_Assert::assertEquals( - $grandTotal, + $prices['grandTotal'], $salesGuestPrint->getViewBlock()->getItemBlock()->getGrandTotal(), "Grand total was printed incorrectly." ); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f26f0a213fffc903b7e364b16f3b79f286ea36f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml @@ -0,0 +1,618 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="orderInjectable" module="Magento_Sales" type="flat" entity_type="sales_order" collection="Magento\Sales\Model\Resource\Order\Collection" identifier="" repository_class="Magento\Sales\Test\Repository\OrderInjectable" handler_interface="Magento\Sales\Test\Handler\OrderInjectable\OrderInjectableInterface" class="Magento\Sales\Test\Fixture\OrderInjectable"> + <dataset name="default"> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="base_currency_code" xsi:type="boolean">false</field> + <field name="order_currency_code" xsi:type="string">USD</field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + </dataset> + <field name="entity_id" is_required="1" source="Magento\Sales\Test\Fixture\OrderInjectable\EntityId" group="null"> + <default_value xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </default_value> + </field> + <field name="state" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="status" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="coupon_code" is_required="" source="Magento\Sales\Test\Fixture\OrderInjectable\CouponCode" group="null"> + <default_value xsi:type="null" /> + </field> + <field name="protect_code" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_description" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="is_virtual" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="store_id" is_required="" source="Magento\Sales\Test\Fixture\OrderInjectable\StoreId" group="null"> + <default_value xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </default_value> + </field> + <field name="customer_id" is_required="" source="Magento\Sales\Test\Fixture\OrderInjectable\CustomerId" group="null"> + <default_value xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </default_value> + </field> + <field name="base_discount_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_discount_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_discount_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_discount_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_grand_total" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_subtotal" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_subtotal_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_subtotal_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_subtotal_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_tax_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_to_global_rate" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_to_order_rate" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_invoiced_cost" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_offline_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_online_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_paid" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_qty_ordered" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="discount_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="discount_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="discount_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="discount_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="grand_total" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="store_to_base_rate" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="store_to_order_rate" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="subtotal" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="subtotal_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="subtotal_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="subtotal_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="tax_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_canceled" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_offline_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_online_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_paid" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_qty_ordered" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="can_ship_partially" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="can_ship_partially_item" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_is_guest" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_note_notify" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="billing_address_id" is_required="" source="Magento\Sales\Test\Fixture\OrderInjectable\BillingAddressId"> + <default_value xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </default_value> + </field> + <field name="customer_group_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="edit_increment" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="email_sent" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="forced_shipment_with_invoice" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="payment_auth_expiration" is_required=""> + <default_value xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </default_value> + </field> + <field name="quote_address_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="quote_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_address_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="adjustment_negative" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="adjustment_positive" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_adjustment_negative" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_adjustment_positive" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_discount_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_subtotal_incl_tax" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_total_due" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="payment_authorization_amount" is_required=""> + <default_value xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </default_value> + </field> + <field name="shipping_discount_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="subtotal_incl_tax" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_due" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="weight" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_dob" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="increment_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="applied_rule_ids" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_currency_code" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_email" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_firstname" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_lastname" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_middlename" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_prefix" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_suffix" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_taxvat" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="discount_description" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="ext_customer_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="ext_order_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="global_currency_code" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="hold_before_state" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="hold_before_status" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="order_currency_code" is_required=""> + <default_value xsi:type="string">USD</default_value> + </field> + <field name="original_increment_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="relation_child_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="relation_child_real_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="relation_parent_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="relation_parent_real_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="remote_ip" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_method" is_required=""> + <default_value xsi:type="string">flatrate_flatrate</default_value> + </field> + <field name="store_currency_code" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="store_name" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="x_forwarded_for" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_note" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="created_at" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="updated_at" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="total_item_count" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="customer_gender" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="hidden_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_hidden_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_hidden_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_hidden_tax_amnt" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="hidden_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_hidden_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="hidden_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_hidden_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="shipping_incl_tax" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_shipping_incl_tax" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="coupon_rule_name" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_customer_balance_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_balance_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_customer_balance_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_balance_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_customer_balance_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_balance_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="bs_customer_bal_total_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="customer_bal_total_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gift_cards" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_gift_cards_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gift_cards_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_gift_cards_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gift_cards_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="base_gift_cards_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gift_cards_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gift_message_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_id" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_allow_gift_receipt" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_add_card" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_price" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_tax_amount" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_price_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_tax_amount_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_tax_amount_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_tax_invoiced" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_price_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_base_tax_amount_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_tax_amount_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_base_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_items_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_base_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="gw_card_tax_refunded" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="id" /> + <field name="price" is_required="1" group="null" source="Magento\Sales\Test\Fixture\OrderInjectable\Price" /> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/BillingAddressId.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/BillingAddressId.php new file mode 100644 index 0000000000000000000000000000000000000000..8aaa2b0cc381d1df3bdd37aa7e590a2f5d75e433 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/BillingAddressId.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +use Magento\Customer\Test\Fixture\Address; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * Billing address data. + */ +class BillingAddressId extends DataSource +{ + /** + * Current preset. + * + * @var string + */ + protected $currentPreset; + + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $data + * @param array $params [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $data, array $params = []) + { + $this->params = $params; + if (isset($data['value'])) { + $this->data = $data['value']; + return; + } + if (isset($data['dataSet'])) { + $addresses = $fixtureFactory->createByCode('address', ['dataSet' => $data['dataSet']]); + $this->data = $addresses->getData(); + $this->data['street'] = [$this->data['street']]; + } + if (isset($data['billingAddress']) && $data['billingAddress'] instanceof Address) { + /** @var Address $address */ + $address = $data['billingAddress']; + $this->data = $address->getData(); + $this->data['street'] = [$this->data['street']]; + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CouponCode.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CouponCode.php new file mode 100644 index 0000000000000000000000000000000000000000..b3d081c56d4c759fe4728523de1732c42f1477d0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CouponCode.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * Coupon code data. + */ +class CouponCode extends DataSource +{ + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $data + * @param array $params [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $data, array $params = []) + { + $this->params = $params; + if (isset($data['value']) && $data['value'] instanceof SalesRuleInjectable) { + $this->data = $data['value']; + return; + } + if (isset($data['dataSet'])) { + $salesRule = $fixtureFactory->createByCode('salesRuleInjectable', ['dataSet' => $data['dataSet']]); + $salesRule->persist(); + $this->data = $salesRule; + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CustomerId.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CustomerId.php new file mode 100644 index 0000000000000000000000000000000000000000..b970afcd0d1ab5e7b87175dabe52324ba57d2d2f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/CustomerId.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +use Magento\Customer\Test\Fixture\Customer; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * Prepare CustomerId for order list. + */ +class CustomerId extends DataSource +{ + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->params = $params; + if (isset($data['customer']) && $data['customer'] instanceof Customer) { + $this->data = $data['customer']; + return; + } + if (isset($data['dataSet'])) { + $customer = $fixtureFactory->createByCode('customer', ['dataSet' => $data['dataSet']]); + if ($customer->hasData('id') === false) { + $customer->persist(); + } + $this->data = $customer; + } + } + + /** + * Get customer fixture. + * + * @return Customer + */ + public function getCustomer() + { + return $this->data; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/EntityId.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/EntityId.php new file mode 100644 index 0000000000000000000000000000000000000000..7b99bad4281b90281275c27b779155d1c97cd53f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/EntityId.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * EntityId data. + */ +class EntityId extends DataSource +{ + /** + * Current preset. + * + * @var string + */ + protected $currentPreset; + + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $data + * @param array $params [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $data, array $params = []) + { + $this->params = $params; + + if (isset($data['value'])) { + $this->data = $data['value']; + return; + } + + if (!isset($data['products'])) { + return; + } + if (is_string($data['products'])) { + $products = explode(',', $data['products']); + foreach ($products as $product) { + list($fixture, $dataSet) = explode('::', trim($product)); + $product = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]); + $product->persist(); + $this->data['products'][] = $product; + } + } elseif (is_array($data['products'])) { + $this->data['products'] = $data['products']; + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/Price.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/Price.php new file mode 100644 index 0000000000000000000000000000000000000000..0de14ee47f836ac21ef905568ff4d19fe4a8857c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/Price.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +/** + * Data keys: + * - preset (Price data verification preset name) + */ +class Price extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Price +{ + /** + * @constructor + * @param array $params + * @param array $data + */ + public function __construct(array $params, array $data = []) + { + $this->params = $params; + if (isset($data['preset'])) { + $this->currentPreset = $data['preset']; + $this->data = $this->getPreset(); + } + } + + /** + * Get preset array + * + * @return array|null + */ + public function getPreset() + { + $presets = [ + 'default_with_discount' => [ + 'subtotal' => 560, + 'discount' => 280, + ], + 'full_invoice' => [ + [ + 'grand_order_total' => 565, + 'grand_invoice_total' => 565, + ], + ], + 'partial_invoice' => [ + [ + 'grand_order_total' => 210, + 'grand_invoice_total' => 110, + ], + ], + 'full_refund' => [ + [ + 'grand_creditmemo_total' => 565, + ], + ], + 'full_refund_with_zero_shipping_refund' => [ + [ + 'grand_creditmemo_total' => 555, + ], + ], + 'partial_refund' => [ + [ + 'grand_creditmemo_total' => 110, + ], + ], + ]; + if (!isset($presets[$this->currentPreset])) { + return null; + } + return $presets[$this->currentPreset]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/StoreId.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/StoreId.php new file mode 100644 index 0000000000000000000000000000000000000000..11579ab84e9e8502d143e5c285f4774f271415c9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable/StoreId.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Fixture\OrderInjectable; + +use Magento\Store\Test\Fixture\Store; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * Prepare StoreId for Store Group. + */ +class StoreId extends DataSource +{ + /** + * Store fixture. + * + * @var Store + */ + public $store; + + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $data + * @param array $params [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $data, array $params = []) + { + $this->params = $params; + + $storeData = isset($data['dataSet']) ? ['dataSet' => $data['dataSet']] : []; + if (isset($data['data'])) { + $storeData = array_replace_recursive($storeData, $data); + } + + if ($storeData) { + $store = $fixtureFactory->createByCode('store', $storeData); + /** @var Store $store */ + if (!$store->getStoreId()) { + $store->persist(); + } + $this->store = $store; + $this->data = $store->getName(); + } + } + + /** + * Return Store fixture. + * + * @return Store + */ + public function getStore() + { + return $this->store; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderStatus.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderStatus.xml new file mode 100644 index 0000000000000000000000000000000000000000..b86502663dbd5b42802155a742536c492ab9d278 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderStatus.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="orderStatus" module="Magento_Sales" type="composite" collection="Magento\Sales\Model\Resource\Order\Status\Collection" repository_class="Magento\Sales\Test\Repository\OrderStatus" handler_interface="Magento\Sales\Test\Handler\OrderStatus\OrderStatusInterface" class="Magento\Sales\Test\Fixture\OrderStatus"> + <dataset name="default"> + <field name="status" xsi:type="string">order_status%isolation%</field> + <field name="label" xsi:type="string">orderLabel%isolation%</field> + </dataset> + <field name="status" is_required="1"> + <default_value xsi:type="string">order_status%isolation%</default_value> + </field> + <field name="label" is_required=""> + <default_value xsi:type="string">orderLabel%isolation%</default_value> + </field> + <field name="state" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="is_default" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="visible_on_front" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Curl.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Curl.php new file mode 100644 index 0000000000000000000000000000000000000000..e98f4ba0afff567f479384c0c7eaecef6543505d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Curl.php @@ -0,0 +1,375 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Handler\OrderInjectable; + +use Magento\Bundle\Test\Fixture\BundleProduct; +use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Downloadable\Test\Fixture\DownloadableProduct; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Handler\Curl as AbstractCurl; +use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Create new order via curl. + */ +class Curl extends AbstractCurl implements OrderInjectableInterface +{ + /** + * Customer fixture. + * + * @var Customer + */ + protected $customer; + + /** + * Customer fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Mapping values for data. + * + * @var array + */ + protected $mappingData = [ + 'region_id' => [ + 'California' => '12', + ], + 'country_id' => [ + 'United States' => 'US', + ], + ]; + + /** + * Steps for create order on backend. + * + * @var array + */ + protected $steps = [ + 'customer_choice' => 'header,data', + 'products_choice' => 'search,items,shipping_method,totals,giftmessage,billing_method', + 'apply_coupon_code' => 'items,shipping_method,totals,billing_method', + 'shipping_data_address' => 'shipping_method,billing_method,shipping_address,totals,giftmessage', + 'shipping_data_method_get' => 'shipping_method,totals', + 'shipping_data_method_set' => 'shipping_method,totals,billing_method', + ]; + + /** + * Post request for creating order. + * + * @param FixtureInterface|null $fixture [optional] + * @return array + */ + public function persist(FixtureInterface $fixture = null) + { + $this->order = $fixture; + $this->customer = $fixture->getDataFieldConfig('customer_id')['source']->getCustomer(); + $data = $this->replaceMappingData($this->prepareData($fixture)); + return ['id' => $this->createOrder($data)]; + } + + /** + * Prepare POST data for creating product request. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture) + { + $result = []; + $data = $fixture->getData(); + $result['customer_choice'] = $this->prepareCustomerData($data); + $result['products_choice'] = $this->prepareProductsData($data['entity_id']); + if (isset($data['coupon_code'])) { + $result['apply_coupon_code'] = $this->prepareCouponCode($data['coupon_code']); + } + $result['order_data'] = $this->prepareOrderData($data); + $result['shipping_data_address'] = $this->prepareShippingData($result['order_data']); + $result['shipping_data_method_get'] = [ + 'payment' => $data['payment_auth_expiration'], + 'collect_shipping_rates' => 1, + ]; + $result['shipping_data_method_set'] = [ + 'order' => ['shipping_method' => $result['order_data']['order']['shipping_method']], + 'payment' => $data['payment_auth_expiration'], + ]; + + return $result; + } + + /** + * Prepare coupon data. + * + * @param SalesRuleInjectable $data + * @return array + */ + protected function prepareCouponCode(SalesRuleInjectable $data) + { + return ['order' => ['coupon' => ['code' => $data->getCouponCode()]]]; + } + + /** + * Prepare shipping data. + * + * @param array $data + * @return array + */ + protected function prepareShippingData(array $data) + { + $result = [ + 'order' => [ + 'billing_address' => $data['billing_address'], + ], + 'payment' => $this->order->getPaymentAuthExpiration(), + 'reset_shipping' => 1, + 'shipping_as_billing' => 1, + ]; + return $result; + } + + /** + * Prepare products data. + * + * @param array $data + * @return array + */ + protected function prepareProductsData(array $data) + { + $result['item'] = []; + foreach ($data['products'] as $value) { + if (!$value->hasData('checkout_data')) { + continue; + } + $methodName = 'prepare' . ucfirst($value->getDataConfig()['type_id']) . 'Data'; + if (!method_exists($this, $methodName)) { + $methodName = 'prepareSimpleData'; + } + $result['item'][$value->getId()] = $this->$methodName($value); + } + return $result; + } + + /** + * Prepare data for configurable product. + * + * @param ConfigurableProduct $product + * @return array + */ + protected function prepareConfigurableData(ConfigurableProduct $product) + { + $result = []; + $checkoutData = $product->getCheckoutData(); + $result['qty'] = $checkoutData['qty']; + $attributesData = $product->hasData('configurable_attributes_data') + ? $product->getDataFieldConfig('configurable_attributes_data')['source']->getAttributesData() + : null; + if ($attributesData == null) { + return $result; + } + foreach ($checkoutData['options']['configurable_options'] as $option) { + $attributeId = $attributesData[$option['title']]['attribute_id']; + $optionId = $attributesData[$option['title']]['options'][$option['value']]['id']; + $result['super_attribute'][$attributeId] = $optionId; + } + + return $result; + } + + /** + * Prepare data for bundle product. + * + * @param BundleProduct $product + * @return array + * + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + protected function prepareBundleData(BundleProduct $product) + { + $result = []; + $checkoutData = $product->getCheckoutData(); + $bundleOptions = isset($checkoutData['options']['bundle_options']) + ? $checkoutData['options']['bundle_options'] + : []; + $bundleSelections = $product->getBundleSelections(); + $bundleSelectionsData = []; + $result['qty'] = $checkoutData['qty']; + + foreach ($bundleSelections['bundle_options'] as $option) { + foreach ($option['assigned_products'] as $productData) { + $productName = $productData['search_data']['name']; + $bundleSelectionsData[$productName] = [ + 'selection_id' => $productData['selection_id'], + 'option_id' => $productData['option_id'], + ]; + } + } + + foreach ($bundleOptions as $option) { + $productName = $option['value']['name']; + foreach ($bundleSelectionsData as $fullProductName => $value) { + if (null !== strpos($fullProductName, $productName)) { + $productName = $fullProductName; + } + } + + if (isset($bundleSelectionsData[$productName])) { + $optionId = $bundleSelectionsData[$productName]['option_id']; + $selectionId = $bundleSelectionsData[$productName]['selection_id']; + $result['bundle_option'][$optionId] = $selectionId; + } + } + + return $result; + } + + /** + * Prepare data for downloadable product. + * + * @param DownloadableProduct $product + * @return array + */ + protected function prepareDownloadableData(DownloadableProduct $product) + { + $result = []; + $checkoutData = $product->getCheckoutData(); + foreach ($checkoutData['options']['links'] as $link) { + $result['links'][] = $link['id']; + } + + return $result; + } + + /** + * Prepare data for simple product. + * + * @param FixtureInterface $product + * @return array + */ + protected function prepareSimpleData(FixtureInterface $product) + { + return ['qty' => $product->getCheckoutData()['qty']]; + } + + /** + * Prepare order data. + * + * @param array $data + * @return array + */ + protected function prepareOrderData(array $data) + { + $customerGroupId = $this->customer->hasData('group_id') + ? $this->customer->getDataFieldConfig('group_id')['source']->getCustomerGroup()->getCustomerGroupId() + : 1; + $result = [ + 'name' => $this->customer->getFirstname(), + 'order' => [ + 'currency' => $data['order_currency_code'], + 'account' => [ + 'group_id' => $customerGroupId, + 'email' => $this->customer->getEmail(), + ], + 'shipping_method' => isset($data['shipping_method']) ? $data['shipping_method'] : '', + ], + 'item' => $this->prepareOrderProductsData($data['entity_id']), + 'billing_address' => $this->prepareBillingAddress($data['billing_address_id']), + 'shipping_same_as_billing' => 'on', + 'payment' => $data['payment_auth_expiration'], + + ]; + + return $result; + } + + /** + * Prepare customer data. + * + * @param array $data + * @return array + */ + protected function prepareCustomerData(array $data) + { + return [ + 'currency_id' => $data['base_currency_code'], + 'customer_id' => $this->customer->getData('id'), + 'payment' => $data['payment_authorization_amount'], + 'store_id' => $this->order->getDataFieldConfig('store_id')['source']->store->getStoreId() + ]; + } + + /** + * Prepare order products data. + * + * @param array $data + * @return array + */ + protected function prepareOrderProductsData(array $data) + { + $result = []; + foreach ($data['products'] as $value) { + if (isset($value->getCheckoutData()['qty'])) { + $result[$value->getId()] = ['qty' => ['qty' => $value->getCheckoutData()['qty']]]; + } + } + + return $result; + } + + /** + * Prepare billing address data. + * + * @param array $data + * @return array + */ + protected function prepareBillingAddress(array $data) + { + $result = $data; + $result['firstname'] = $this->customer->getFirstname(); + $result['lastname'] = $this->customer->getLastname(); + + return $result; + } + + /** + * Create product via curl. + * + * @param array $data + * @return int|null + * @throws \Exception + */ + protected function createOrder(array $data) + { + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + foreach ($this->steps as $key => $step) { + if (!isset($data[$key])) { + continue; + } + $url = $_ENV['app_backend_url'] . 'sales/order_create/loadBlock/block/' . $step . '?isAjax=true'; + $curl->write(CurlInterface::POST, $url, '1.1', [], $data[$key]); + $curl->read(); + } + $url = $_ENV['app_backend_url'] . 'sales/order_create/save'; + $curl->addOption(CURLOPT_HEADER, 1); + $curl->write(CurlInterface::POST, $url, '1.1', [], $data['order_data']); + $response = $curl->read(); + $curl->close(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Order creation by curl handler was not successful! Response: $response"); + } + preg_match("~<h1 class=\"page-title\">#(.*)</h1>~", $response, $matches); + + return isset($matches[1]) ? $matches[1] : null; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/OrderInjectableInterface.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/OrderInjectableInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..e08ecf55e8570d79b4ea4b06e403089e7130bd38 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/OrderInjectableInterface.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Handler\OrderInjectable; + +use Magento\Mtf\Handler\HandlerInterface; + +/** + * Interface OrderInjectableInterface + */ +interface OrderInjectableInterface extends HandlerInterface +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/Curl.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/Curl.php new file mode 100644 index 0000000000000000000000000000000000000000..1ff9f0d8de366f274313dff361ab2b728bfac8de --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/Curl.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Handler\OrderStatus; + +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Handler\Curl as AbstractCurl; +use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Curl handler for creating OrderStatus. + */ +class Curl extends AbstractCurl implements OrderStatusInterface +{ + /** + * Default attribute values for fixture. + * + * @var array + */ + protected $defaultAttributeValues = [ + 'is_new' => 1, + 'store_labels[1]' => '', + ]; + + /** + * Mapping values for data. + * + * @var array + */ + protected $mappingData = [ + 'state' => [ + 'Pending' => 'new', + ], + 'is_default' => [ + 'Yes' => 1, + 'No' => 0, + ], + 'visible_on_front' => [ + 'Yes' => 1, + 'No' => 0, + ], + ]; + + /** + * Post request for creating OrderStatus. + * + * @param FixtureInterface $fixture + * @return void + * @throws \Exception + */ + public function persist(FixtureInterface $fixture = null) + { + $url = $_ENV['app_backend_url'] . 'sales/order_status/save/'; + $data = array_merge($this->defaultAttributeValues, $fixture->getData()); + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + $curl->write(CurlInterface::POST, $url, '1.1', [], $data); + $response = $curl->read(); + $curl->close(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("OrderStatus entity creating by curl handler was not successful! Response: $response"); + } + + if (isset($data['state'])) { + $url = $_ENV['app_backend_url'] . 'sales/order_status/assignPost/'; + $data = $this->replaceMappingData($data); + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + $curl->write(CurlInterface::POST, $url, '1.1', [], $data); + $response = $curl->read(); + $curl->close(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception( + "Assigning OrderStatus entity by curl handler was not successful! Response: $response" + ); + } + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/OrderStatusInterface.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/OrderStatusInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..8bdff4f5546f34f6eca1d29afeafe7eb7b655fbe --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderStatus/OrderStatusInterface.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Handler\OrderStatus; + +use Magento\Mtf\Handler\HandlerInterface; + +/** + * Interface OrderStatusInterface + */ +interface OrderStatusInterface extends HandlerInterface +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml new file mode 100644 index 0000000000000000000000000000000000000000..e0ac81201f8b3b611057687c771d69964ca835fd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml @@ -0,0 +1,235 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Sales\Test\Repository\OrderInjectable"> + <dataset name="default"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="two_simple_product"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="virtual_product"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductVirtual::default</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="downloadable_product"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">downloadableProduct::with_two_bought_links</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="two_downloadable_product"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">downloadableProduct::with_two_bought_links, downloadableProduct::with_two_bought_links</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="with_coupon"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + <field name="coupon_code" xsi:type="array"> + <item name="dataSet" xsi:type="string">active_sales_rule_for_all_groups</item> + </field> + <field name="price" xsi:type="array"> + <item name="preset" xsi:type="string">default_with_discount</item> + </field> + </dataset> + + <dataset name="with_coupon"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + <field name="coupon_code" xsi:type="array"> + <item name="dataSet" xsi:type="string">active_sales_rule_for_all_groups</item> + </field> + <field name="price" xsi:type="array"> + <item name="preset" xsi:type="string">default_with_discount</item> + </field> + </dataset> + + <dataset name="simple_big_qty"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::simple_big_qty</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">johndoe_unique</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + + <dataset name="virtual_big_qty"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::virtual_big_qty</item> + </field> + <field name="customer_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">johndoe_unique</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderStatus.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderStatus.xml new file mode 100644 index 0000000000000000000000000000000000000000..9391fbb88435c4005376699cb3081ac07675e6c6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderStatus.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Sales\Test\Repository\OrderStatus"> + <dataset name="default"> + <field name="status" xsi:type="string">order_status%isolation%</field> + <field name="label" xsi:type="string">orderLabel%isolation%</field> + </dataset> + + <dataset name="assign_to_pending"> + <field name="status" xsi:type="string">order_status%isolation%</field> + <field name="label" xsi:type="string">orderLabel%isolation%</field> + <field name="state" xsi:type="string">Pending</field> + <field name="is_default" xsi:type="string">Yes</field> + <field name="visible_on_front" xsi:type="string">Yes</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php new file mode 100644 index 0000000000000000000000000000000000000000..148ccff6b0733ec95672421561ba0b04eab3525f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.php @@ -0,0 +1,167 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Constraint\AssertOrderStatusSuccessAssignMessage; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Fixture\OrderStatus; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusAssign; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Custom Order Status is created. + * + * Steps: + * 1. Log in as admin. + * 2. Navigate to the Stores > Settings > Order Status. + * 3. Click on "Assign Status to State. + * 4. Fill in all data according to data set. + * 5. Save Status Assignment. + * 6. Call assert assertOrderStatusSuccessAssignMessage. + * 7. Create Order. + * 8. Perform all assertions from dataSet. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29382 + */ +class AssignCustomOrderStatusTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Order Status Index page. + * + * @var OrderStatusIndex + */ + protected $orderStatusIndex; + + /** + * Order Status Assign page. + * + * @var OrderStatusAssign + */ + protected $orderStatusAssign; + + /** + * Order Index page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * OrderStatus Fixture. + * + * @var OrderStatus + */ + protected $orderStatus; + + /** + * OrderInjectable Fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Prepare data. + * + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Inject pages. + * + * @param OrderStatusIndex $orderStatusIndex + * @param OrderStatusAssign $orderStatusAssign + * @param OrderIndex $orderIndex + * @return void + */ + public function __inject( + OrderStatusIndex $orderStatusIndex, + OrderStatusAssign $orderStatusAssign, + OrderIndex $orderIndex + ) { + $this->orderStatusIndex = $orderStatusIndex; + $this->orderStatusAssign = $orderStatusAssign; + $this->orderIndex = $orderIndex; + } + + /** + * Run Assign Custom OrderStatus. + * + * @param OrderStatus $orderStatus + * @param OrderInjectable $order + * @param array $orderStatusState + * @param AssertOrderStatusSuccessAssignMessage $assertion + * @return array + */ + public function test( + OrderStatus $orderStatus, + OrderInjectable $order, + array $orderStatusState, + AssertOrderStatusSuccessAssignMessage $assertion + ) { + // Preconditions: + $orderStatus->persist(); + /** @var OrderStatus $orderStatus */ + $orderStatus = $this->fixtureFactory->createByCode( + 'orderStatus', + ['data' => array_merge($orderStatus->getData(), $orderStatusState)] + ); + + // Steps: + $this->orderStatusIndex->open(); + $this->orderStatusIndex->getGridPageActions()->assignStatusToState(); + $this->orderStatusAssign->getAssignForm()->fill($orderStatus); + $this->orderStatusAssign->getPageActionsBlock()->save(); + $assertion->processAssert($this->orderStatusIndex); + + $order->persist(); + + // Prepare data for tear down + $this->orderStatus = $orderStatus; + $this->order = $order; + + return [ + 'orderId' => $order->getId(), + 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), + 'status' => $orderStatus->getLabel() + ]; + } + + /** + * Change created order status and unassign custom order status + * + * @return void + */ + public function tearDown() + { + $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel'); + $filter = ['label' => $this->orderStatus->getLabel()]; + $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..295a0103799502586f3c49783973c38eb5cc6983 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/AssignCustomOrderStatusTest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\AssignCustomOrderStatusTest"> + <variation name="AssignCustomOrderStatusTestVariation1"> + <data name="orderStatusState/state" xsi:type="string">Pending</data> + <data name="orderStatusState/is_default" xsi:type="string">No</data> + <data name="orderStatusState/visible_on_front" xsi:type="string">Yes</data> + <data name="statusToCheck" xsi:type="string">Pending</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="AssignCustomOrderStatusTestVariation2"> + <data name="orderStatusState/state" xsi:type="string">Pending</data> + <data name="orderStatusState/is_default" xsi:type="string">Yes</data> + <data name="orderStatusState/visible_on_front" xsi:type="string">No</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderNotVisibleOnMyAccount" /> + </variation> + <variation name="AssignCustomOrderStatusTestVariation3"> + <data name="orderStatusState/state" xsi:type="string">Pending</data> + <data name="orderStatusState/is_default" xsi:type="string">Yes</data> + <data name="orderStatusState/visible_on_front" xsi:type="string">Yes</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ae747237cf2f89bac2cd70a58fa4609e2d55da77 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Enable payment method "Check/Money Order". + * 2. Enable shipping method one of "Flat Rate". + * 3. Create order + * + * Steps: + * 1. Login to backend. + * 2. Sales > Orders. + * 3. Open the created order. + * 4. Do cancel Order. + * 5. Perform all assetions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28191 + */ +class CancelCreatedOrderTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * Enable "Check/Money Order" and "Flat Rate" in configuration. + * + * @return void + */ + public function __prepare() + { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'checkmo, flatrate', 'rollback' => true] + )->run(); + } + + /** + * Inject pages + * + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @return void + */ + public function __inject(OrderIndex $orderIndex, SalesOrderView $salesOrderView) + { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + } + + /** + * Cancel created order. + * + * @param OrderInjectable $order + * @return array + */ + public function test(OrderInjectable $order) + { + // Preconditions + $order->persist(); + + // Steps + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); + $this->salesOrderView->getPageActions()->cancel(); + + return [ + 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..b5c195908cc8140a1b75fd84fc4c8f55549123c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\CancelCreatedOrderTest"> + <variation name="CancelCreatedOrderTestVariation1"> + <data name="description" xsi:type="string">cancel order and check status on the frontend</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <data name="status" xsi:type="string">Canceled</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderCancelSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f54fc41993282a7ae85effedd6b33161aa14df37 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.php @@ -0,0 +1,126 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Enable payment method "Check/Money Order". + * 2. Enable shipping method one of "Flat Rate/Free Shipping". + * 3. Create order. + * 4. Create Invoice. + * + * Steps: + * 1. Go to Sales > Orders > find out placed order and open. + * 2. Click 'Credit Memo' button. + * 3. Fill data from dataSet. + * 4. On order's page click 'Refund offline' button. + * 5. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29116 + */ +class CreateCreditMemoEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const STABLE = 'no'; // Backend customer form load + /* end tags */ + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Skip fields for create product fixture. + * + * @var array + */ + protected $skipFields = [ + 'attribute_set_id', + 'website_ids', + 'checkout_data', + 'type_id', + 'price', + ]; + + /** + * Set up configuration. + * + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $this->fixtureFactory = $fixtureFactory; + + $setupConfigurationStep = $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'checkmo, flatrate'] + ); + $setupConfigurationStep->run(); + } + + /** + * Create credit memo. + * + * @param OrderInjectable $order + * @param array $data + * @return array + */ + public function test(OrderInjectable $order, array $data) + { + // Preconditions + $order->persist(); + $this->objectManager->create('Magento\Sales\Test\TestStep\CreateInvoiceStep', ['order' => $order])->run(); + + // Steps + $createCreditMemoStep = $this->objectManager->create( + 'Magento\Sales\Test\TestStep\CreateCreditMemoStep', + ['order' => $order, 'data' => $data] + ); + $result = $createCreditMemoStep->run(); + + return [ + 'ids' => ['creditMemoIds' => $result['creditMemoIds']], + 'product' => $this->getProduct($order, $data), + 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer() + ]; + } + + /** + * Get product's fixture. + * + * @param OrderInjectable $order + * @param array $data + * @param int $index [optional] + * @return FixtureInterface + */ + protected function getProduct(OrderInjectable $order, array $data, $index = 0) + { + if (!isset($data['items_data'][$index]['back_to_stock']) + || $data['items_data'][$index]['back_to_stock'] != 'Yes' + ) { + return $order->getEntityId()['products'][$index]; + } + $product = $order->getEntityId()['products'][$index]; + $productData = $product->getData(); + $checkoutDataQty = $productData['checkout_data']['qty']; + $productData['quantity_and_stock_status']['qty'] -= ($checkoutDataQty - $data['items_data'][$index]['qty']); + $productData = array_diff_key($productData, array_flip($this->skipFields)); + + return $this->fixtureFactory->create(get_class($product), ['data' => $productData]); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d730f56e5bbcc70863d71c20ca7f9ddc99b4d7c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCreditMemoEntityTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\CreateCreditMemoEntityTest"> + <variation name="CreateCreditMemoEntityTestVariation1"> + <data name="description" xsi:type="string">Assert items return to stock (partial refund)</data> + <data name="data/items_data/0/back_to_stock" xsi:type="string">Yes</data> + <data name="data/items_data/0/qty" xsi:type="string">1</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::product_100_dollar</data> + <data name="order/data/price/preset" xsi:type="string">partial_refund</data> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertCreditMemoButton" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundInRefundsGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundedGrandTotalOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Sales\Test\Constraint\AssertCreditMemoItems" /> + </variation> + <variation name="CreateCreditMemoEntityTestVariation2"> + <data name="description" xsi:type="string">Assert 0 shipping refund</data> + <data name="data/items_data/0/qty" xsi:type="string">1</data> + <data name="data/form_data/shipping_amount" xsi:type="string">0</data> + <data name="data/form_data/adjustment_positive" xsi:type="string">5</data> + <data name="data/form_data/adjustment_negative" xsi:type="string">10</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default</data> + <data name="order/data/price/preset" xsi:type="string">full_refund_with_zero_shipping_refund</data> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertCreditMemoButton" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundInRefundsGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertRefundedGrandTotalOnFrontend" /> + <constraint name="Magento\Sales\Test\Constraint\AssertCreditMemoItems" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a16471097cef29fc08be51ec17988b56d724c5a9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderStatus; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusIndex; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Steps: + * 1. Log in as admin. + * 2. Navigate to the Stores > Settings > Order Status. + * 3. Click on "Create New Status" button. + * 4. Fill in all data according to data set. + * 5. Save order status. + * 6. Verify created order status. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-23412 + */ +class CreateCustomOrderStatusEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Order staus page. + * + * @var OrderStatusIndex + */ + protected $orderStatusIndexPage; + + /** + * Create order status page. + * + * @var OrderStatusNew + */ + protected $orderStatusNewPage; + + /** + * Inject pages. + * + * @param OrderStatusIndex $orderStatusIndexPage + * @param OrderStatusNew $orderStatusNewPage + * @return void + */ + public function __inject( + OrderStatusIndex $orderStatusIndexPage, + OrderStatusNew $orderStatusNewPage + ) { + $this->orderStatusIndexPage = $orderStatusIndexPage; + $this->orderStatusNewPage = $orderStatusNewPage; + } + + /** + * Run Create Order Status test. + * + * @param OrderStatus $orderStatus + * @return void + */ + public function testCreateOrderStatus(OrderStatus $orderStatus) + { + // Steps + $this->orderStatusIndexPage->open(); + $this->orderStatusIndexPage->getGridPageActions()->addNew(); + $this->orderStatusNewPage->getOrderStatusForm()->fill($orderStatus); + $this->orderStatusNewPage->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2de5caa7940d118fdcb2e9d83811f32f4a675ec5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateCustomOrderStatusEntityTest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\CreateCustomOrderStatusEntityTest"> + <variation name="CreateCustomOrderStatusEntityTestVariation1"> + <data name="orderStatus/data/status" xsi:type="string">order_status%isolation%</data> + <data name="orderStatus/data/label" xsi:type="string">orderLabel%isolation%</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + </variation> + <variation name="CreateCustomOrderStatusEntityTestVariation2"> + <data name="orderStatus/data/status" xsi:type="string">pending</data> + <data name="orderStatus/data/label" xsi:type="string">orderLabel%isolation%</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusDuplicateStatus" /> + </variation> + <variation name="CreateCustomOrderStatusEntityTestVariation3"> + <data name="orderStatus/data/status" xsi:type="string">order_status%isolation%</data> + <data name="orderStatus/data/label" xsi:type="string">Processing</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1c490060364c978df658f645025826b5f2335f0f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Enable payment method "Check/Money Order". + * 2. Enable shipping method one of "Flat Rate/Free Shipping". + * 3. Create order. + * + * Steps: + * 1. Go to Sales > Orders. + * 2. Select created order in the grid and open it. + * 3. Click 'Invoice' button. + * 4. Fill data according to dataSet. + * 5. Click 'Submit Invoice' button. + * 6. Perform assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28209 + */ +class CreateInvoiceEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Set up configuration. + * + * @return void + */ + public function __prepare() + { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'checkmo, flatrate'] + )->run(); + } + + /** + * Create invoice. + * + * @param OrderInjectable $order + * @param array $data + * @return array + */ + public function test(OrderInjectable $order, array $data) + { + // Preconditions + $order->persist(); + + // Steps + $result = $this->objectManager->create( + 'Magento\Sales\Test\TestStep\CreateInvoiceStep', + ['order' => $order, 'data' => $data] + )->run(); + + return [ + 'ids' => [ + 'invoiceIds' => $result['invoiceIds'], + 'shipmentIds' => isset($result['shipmentIds']) ? $result['shipmentIds'] : null, + ] + ]; + } + + /** + * Log out. + * + * @return void + */ + public function tearDown() + { + $this->objectManager->create('Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep')->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..43b018bc8b8c2d6a7f689c61dd5e96aa9761aac1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\CreateInvoiceEntityTest"> + <variation name="CreateInvoiceEntityTestVariation1"> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/price/preset" xsi:type="string">full_invoice</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default</data> + <data name="order/data/total_qty_ordered/0" xsi:type="string">1</data> + <data name="data/items_data/0/qty" xsi:type="string">-</data> + <data name="data/form_data/do_shipment" xsi:type="string">Yes</data> + <data name="data/form_data/comment_text" xsi:type="string">comments</data> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceWithShipmentSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertNoInvoiceButton" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesTab" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoicedAmountOnFrontend" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertNoShipButton" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsTab" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceItems" /> + </variation> + <variation name="CreateInvoiceEntityTestVariation2"> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/price/preset" xsi:type="string">partial_invoice</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::product_100_dollar</data> + <data name="order/data/total_qty_ordered/0" xsi:type="string">-</data> + <data name="data/items_data/0/qty" xsi:type="string">1</data> + <data name="data/form_data/do_shipment" xsi:type="string">No</data> + <data name="data/form_data/comment_text" xsi:type="string">comments</data> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesTab" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceItems" /> + <constraint name="Magento\Sales\Test\Constraint\AssertInvoicedAmountOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php new file mode 100644 index 0000000000000000000000000000000000000000..67700cfedc82feb577c88a8b86f66ffd30bac571 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create product. + * + * Steps: + * 1. Open Backend. + * 2. Open Sales -> Orders. + * 3. Click Create New Order. + * 4. Select Customer created in preconditions. + * 5. Add Product. + * 6. Fill data according dataSet. + * 7. Click Update Product qty. + * 8. Fill data according dataSet. + * 9. Click Get Shipping Method and rates. + * 10. Fill data according dataSet. + * 11. Submit Order. + * 12. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28696 + */ +class CreateOrderBackendTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TEST_TYPE = 'acceptance_test'; + /* end tags */ + + /** + * Runs sales order on backend. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } + + /** + * Disable enabled config after test. + * + * @return void + */ + public function tearDown() + { + if (isset($this->currentVariation['arguments']['configData'])) { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => $this->currentVariation['arguments']['configData'], 'rollback' => true] + )->run(); + } + $this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run(); + $this->objectManager->create('Magento\Tax\Test\TestStep\DeleteAllTaxRulesStep')->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8328baab4af1305a8f77e86a412dc67fdc3f4ba --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\CreateOrderBackendTest"> + <variation name="CreateOrderBackendTestVariation1"> + <data name="description" xsi:type="string">Create order with simple product for registered US customer using Fixed shipping method and Cash on Delivery payment method</data> + <data name="products" xsi:type="string">catalogProductSimple::default</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="saveAddress" xsi:type="string">No</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">565.00</item> + </data> + <data name="payment/method" xsi:type="string">cashondelivery</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Notification, Hold, Invoice, Ship, Edit</data> + <data name="configData" xsi:type="string">cashondelivery</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="CreateOrderBackendTestVariation2"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36210</data> + <data name="description" xsi:type="string">Create order with virtual product for registered UK customer using Check/Money Order payment method</data> + <data name="products" xsi:type="string">catalogProductVirtual::default</data> + <data name="customer/dataSet" xsi:type="string">customer_UK</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_UK</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">10.00</item> + </data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="configData" xsi:type="string">checkmo_specificcountry_gb</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="CreateOrderBackendTestVariation3"> + <data name="description" xsi:type="string">Create order with simple product for registered US customer using Fixed shipping method and Bank Transfer payment method</data> + <data name="products" xsi:type="string">catalogProductSimple::default</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="saveAddress" xsi:type="string">No</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">565.00</item> + </data> + <data name="payment/method" xsi:type="string">banktransfer</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Reorder, Invoice, Edit</data> + <data name="configData" xsi:type="string">banktransfer</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="CreateOrderBackendTestVariation4"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="description" xsi:type="string">Create order with virtual product for registered UK customer using Bank Transfer payment method</data> + <data name="products" xsi:type="string">catalogProductVirtual::default</data> + <data name="customer/dataSet" xsi:type="string">customer_UK</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_UK</data> + <data name="saveAddress" xsi:type="string">No</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">10.00</item> + </data> + <data name="payment/method" xsi:type="string">banktransfer</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="configData" xsi:type="string">freeshipping_specificcountry_gb, banktransfer</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="CreateOrderBackendTestVariation5"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="description" xsi:type="string">Create order with simple product for registered US customer using Fixed shipping method and Purchase Order payment method</data> + <data name="products" xsi:type="string">catalogProductSimple::default</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="saveAddress" xsi:type="string">No</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">565.00</item> + </data> + <data name="payment/method" xsi:type="string">purchaseorder</data> + <data name="payment/po_number" xsi:type="string">123456</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Reorder, Edit</data> + <data name="configData" xsi:type="string">purchaseorder</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + <variation name="CreateOrderBackendTestVariation6"> + <data name="description" xsi:type="string">MAGETWO-12395 - Create Offline Order for Registered Customer in Admin</data> + <data name="products" xsi:type="string">catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="saveAddress" xsi:type="string">No</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">32.73</item> + </data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + </variation> + <variation name="CreateOrderBackendTestVariation7"> + <data name="description" xsi:type="string">MAGETWO-12520 - Create Order for New Customer in Admin with Offline Payment Method</data> + <data name="products" xsi:type="string">catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option</data> + <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="saveAddress" xsi:type="string">Yes</data> + <data name="checkoutMethod" xsi:type="string">register</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">32.73</item> + </data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="tag" xsi:type="string">test_type:acceptance_test, to_maintain:yes</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerForm" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c0c57982c726f90a33f1d94b028b2a040bded26a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Enable payment method "Check/Money Order". + * 2. Enable shipping method one of "Flat Rate". + * 3. Create order. + * + * Steps: + * 1. Login to backend. + * 2. Go to Sales > Orders. + * 3. Open the created order. + * 4. Do 'Hold' for Order. + * 5. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28214 + */ +class HoldCreatedOrderTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * Enable "Check/Money Order" and "Flat Rate" in configuration. + * + * @return void + */ + public function __prepare() + { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'checkmo, flatrate', 'rollback' => true] + )->run(); + } + + /** + * Inject pages. + * + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @return void + */ + public function __inject(OrderIndex $orderIndex, SalesOrderView $salesOrderView) + { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + } + + /** + * Put created order on hold. + * + * @param OrderInjectable $order + * @return array + */ + public function test(OrderInjectable $order) + { + // Preconditions + $order->persist(); + + // Steps + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); + $this->salesOrderView->getPageActions()->hold(); + + return [ + 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..962f0262f34f2714a8bc06325a8926069115d57e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/HoldCreatedOrderTest.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\HoldCreatedOrderTest"> + <variation name="HoldCreatedOrderTestVariation1"> + <data name="description" xsi:type="string">hold order and check status on the front in my account</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <data name="orderButtonsUnavailable" xsi:type="string">Invoice,Cancel,Reorder,Ship,Edit</data> + <data name="status" xsi:type="string">On Hold</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderOnHoldSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsUnavailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertUnholdButton" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..264f392cf0123e8e85c8579d9593506bab5bb04d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.php @@ -0,0 +1,140 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Precondition: + * 1. Create orders. + * + * Steps: + * 1. Navigate to backend. + * 2. Go to Sales > Orders. + * 3. Select Mass Action according to dataSet. + * 4. Submit. + * 5. Perform Asserts. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-27897 + */ +class MassOrdersUpdateTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Order index page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Injection data. + * + * @param OrderIndex $orderIndex + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __inject(OrderIndex $orderIndex, FixtureFactory $fixtureFactory) + { + $this->orderIndex = $orderIndex; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Mass orders update. + * + * @param string $steps + * @param int $ordersCount + * @param string $action + * @param string $resultStatuses + * @return array + */ + public function test($steps, $ordersCount, $action, $resultStatuses) + { + // Preconditions + $orders = $this->createOrders($ordersCount, $steps); + $items = $this->prepareFilter($orders); + + // Steps + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->massaction($items, $action); + + return ['orders' => $orders, 'orderStatuses' => explode(',', $resultStatuses)]; + } + + /** + * Create orders. + * + * @param int $count + * @param string $steps + * @return array + */ + protected function createOrders($count, $steps) + { + $orders = []; + $steps = explode('|', $steps); + for ($i = 0; $i < $count; $i++) { + /** @var OrderInjectable $order */ + $order = $this->fixtureFactory->createByCode('orderInjectable', ['dataSet' => 'default']); + $order->persist(); + $orders[$i] = $order; + $this->processSteps($order, $steps[$i]); + } + + return $orders; + } + + /** + * Process which step to take for order. + * + * @param OrderInjectable $order + * @param string $steps + * @return void + */ + protected function processSteps(OrderInjectable $order, $steps) + { + $steps = array_diff(explode(',', $steps), ['-']); + foreach ($steps as $step) { + $action = str_replace(' ', '', ucwords($step)); + $methodAction = (($action != 'OnHold') ? 'Create' : '') . $action . 'Step'; + $path = 'Magento\Sales\Test\TestStep'; + $processStep = $this->objectManager->create($path . '\\' . $methodAction, ['order' => $order]); + $processStep->run(); + } + } + + /** + * Prepare filter. + * + * @param OrderInjectable[] $orders + * @return array + */ + protected function prepareFilter(array $orders) + { + $items = []; + foreach ($orders as $order) { + $items[] = ['id' => $order->getId()]; + } + + return $items; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c9c529d4ae07bebf8cf83fa3fb22575c2509fd47 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MassOrdersUpdateTest"> + <variation name="MassOrdersUpdateTestVariation1"> + <data name="description" xsi:type="string">cancel orders in status Pending and Processing</data> + <data name="steps" xsi:type="string">-</data> + <data name="action" xsi:type="string">Cancel</data> + <data name="ordersCount" xsi:type="string">1</data> + <data name="resultStatuses" xsi:type="string">Canceled</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderCancelMassActionSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation2"> + <data name="description" xsi:type="string">try to cancel orders in status Complete, Closed</data> + <data name="steps" xsi:type="string">invoice, shipment|invoice, credit memo</data> + <data name="action" xsi:type="string">Cancel</data> + <data name="ordersCount" xsi:type="string">2</data> + <data name="resultStatuses" xsi:type="string">Complete,Closed</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderCancelMassActionFailMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation3"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="description" xsi:type="string">try to cancel orders in status Pending, Closed</data> + <data name="steps" xsi:type="string">invoice|invoice, credit memo</data> + <data name="action" xsi:type="string">Cancel</data> + <data name="ordersCount" xsi:type="string">2</data> + <data name="resultStatuses" xsi:type="string">Processing,Closed</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderCancelMassActionFailMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation4"> + <data name="description" xsi:type="string">Put orders in statuses Pending, Processing on Hold</data> + <data name="steps" xsi:type="string">-|invoice</data> + <data name="action" xsi:type="string">Hold</data> + <data name="ordersCount" xsi:type="string">2</data> + <data name="resultStatuses" xsi:type="string">On Hold,On Hold</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderOnHoldSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation5"> + <data name="description" xsi:type="string">Try to put order in statuse Complete on Hold</data> + <data name="steps" xsi:type="string">invoice, shipment</data> + <data name="action" xsi:type="string">Hold</data> + <data name="ordersCount" xsi:type="string">1</data> + <data name="resultStatuses" xsi:type="string">Complete</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderOnHoldFailMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation6"> + <data name="description" xsi:type="string">Release order in statuse On Hold</data> + <data name="steps" xsi:type="string">on hold</data> + <data name="action" xsi:type="string">Unhold</data> + <data name="ordersCount" xsi:type="string">1</data> + <data name="resultStatuses" xsi:type="string">Pending</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderReleaseSuccessMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + <variation name="MassOrdersUpdateTestVariation7"> + <data name="description" xsi:type="string">try to Release order in status Pending</data> + <data name="steps" xsi:type="string">-</data> + <data name="action" xsi:type="string">Unhold</data> + <data name="ordersCount" xsi:type="string">1</data> + <data name="resultStatuses" xsi:type="string">Pending</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderReleaseFailMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrdersInOrdersGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4a66d441d4fc9221cf5b1d0f349f1b6af332d518 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create product. + * 3. Create order with this product. + * + * Steps: + * 1. Open Customers > All Customers. + * 2. Search and open customer from preconditions. + * 3. Click Create Order. + * 4. Check product in Last Ordered Items section. + * 5. Click Update Changes. + * 6. Perform all assertions. + * + * @group Customers_(CS), Order_Management_(CS) + * @ZephyrId MAGETWO-27640 + */ +class MoveLastOrderedProductsOnOrderPageTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Order create index page. + * + * @var OrderCreateIndex + */ + protected $orderCreateIndex; + + /** + * Customer index page. + * + * @var CustomerIndex + */ + protected $customerIndex; + + /** + * Customer index edit page. + * + * @var CustomerIndexEdit + */ + protected $customerIndexEdit; + + /** + * Inject pages. + * + * @param OrderCreateIndex $orderCreateIndex + * @param CustomerIndex $customerIndex + * @param CustomerIndexEdit $customerIndexEdit + * @return void + */ + public function __inject( + OrderCreateIndex $orderCreateIndex, + CustomerIndex $customerIndex, + CustomerIndexEdit $customerIndexEdit + ) { + $this->orderCreateIndex = $orderCreateIndex; + $this->customerIndex = $customerIndex; + $this->customerIndexEdit = $customerIndexEdit; + } + + /** + * Move last ordered products on order page. + * + * @param OrderInjectable $order + * @return array + */ + public function test(OrderInjectable $order) + { + // Preconditions: + $order->persist(); + $customer = $order->getDataFieldConfig('customer_id')['source']->getCustomer(); + + // Steps: + $this->customerIndex->open(); + $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]); + $this->customerIndexEdit->getPageActionsBlock()->createOrder(); + $this->orderCreateIndex->getStoreBlock()->selectStoreView(); + $products = $order->getEntityId()['products']; + $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock(); + $activitiesBlock->getLastOrderedItemsBlock()->addProductsToOrder($products); + $activitiesBlock->updateChanges(); + + return ['products' => $products]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..db32b31002732a1c3df2362d9af163e1c64e0321 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MoveLastOrderedProductsOnOrderPageTest"> + <variation name="MoveLastOrderedProductsOnOrderPageTestVariation1"> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + <variation name="MoveLastOrderedProductsOnOrderPageTestVariation2"> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..65eb1855623eea37ff73dfa9fd3a4647423dec7c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.php @@ -0,0 +1,171 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Catalog\Test\Page\Product\CatalogProductCompare; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; +use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create products. + * 3. Add products to compare list. + * + * Steps: + * 1. Open Customers -> All Customers. + * 2. Search and open customer from preconditions. + * 3. Click 'Create Order'. + * 4. Check product in comparison list section. + * 5. Click 'Update Changes'. + * 6. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28050 + */ +class MoveProductsInComparedOnOrderPageTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Cms index page. + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Browser instance. + * + * @var BrowserInterface + */ + protected $browser; + + /** + * Catalog product page. + * + * @var CatalogProductView + */ + protected $catalogProductView; + + /** + * Order create index page. + * + * @var OrderCreateIndex + */ + protected $orderCreateIndex; + + /** + * Customer index page. + * + * @var CustomerIndex + */ + protected $customerIndex; + + /** + * Customer index edit page. + * + * @var CustomerIndexEdit + */ + protected $customerIndexEdit; + + /** + * Catalog product compare page. + * + * @var CatalogProductCompare + */ + protected $catalogProductCompare; + + /** + * Create customer. + * + * @param Customer $customer + * @param BrowserInterface $browser + * @return array + */ + public function __prepare(Customer $customer, BrowserInterface $browser) + { + $customer->persist(); + $this->browser = $browser; + + return ['customer' => $customer]; + } + + /** + * Inject pages. + * + * @param CmsIndex $cmsIndex + * @param CatalogProductView $catalogProductView + * @param OrderCreateIndex $orderCreateIndex + * @param CustomerIndex $customerIndex + * @param CustomerIndexEdit $customerIndexEdit + * @param CatalogProductCompare $catalogProductCompare + * @return void + */ + public function __inject( + CmsIndex $cmsIndex, + CatalogProductView $catalogProductView, + OrderCreateIndex $orderCreateIndex, + CustomerIndex $customerIndex, + CustomerIndexEdit $customerIndexEdit, + CatalogProductCompare $catalogProductCompare + ) { + $this->cmsIndex = $cmsIndex; + $this->catalogProductView = $catalogProductView; + $this->orderCreateIndex = $orderCreateIndex; + $this->customerIndex = $customerIndex; + $this->customerIndexEdit = $customerIndexEdit; + $this->catalogProductCompare = $catalogProductCompare; + } + + /** + * Move compare products on order page. + * + * @param Customer $customer + * @param string $products + * @return array + */ + public function test(Customer $customer, $products) + { + // Preconditions + // Create products + $products = $this->objectManager->create( + '\Magento\Catalog\Test\TestStep\CreateProductsStep', + ['products' => $products] + )->run()['products']; + // Login under customer + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + // Add products to compare + foreach ($products as $itemProduct) { + $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html'); + $this->catalogProductView->getViewBlock()->clickAddToCompare(); + } + + // Steps + $this->customerIndex->open(); + $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]); + $this->customerIndexEdit->getPageActionsBlock()->createOrder(); + $this->orderCreateIndex->getStoreBlock()->selectStoreView(); + $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock(); + $activitiesBlock->getProductsInComparisonBlock()->addProductsToOrder($products); + $activitiesBlock->updateChanges(); + + return ['products' => $products, 'productsIsConfigured' => false]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..28946b2dfd52d04182904397f556dfeae39e71df --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MoveProductsInComparedOnOrderPageTest"> + <variation name="MoveProductsInComparedOnOrderPageTestVariation1"> + <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + <variation name="MoveProductsInComparedOnOrderPageTestVariation2"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="products" xsi:type="string">configurableProduct::default,configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fa3bf369cad5c5e0a9a47303538f760912cdf2fe --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.php @@ -0,0 +1,173 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Catalog\Test\Page\Product\CatalogProductCompare; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; +use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create products. + * 3. Add products to compare list. + * 4. Clear compare list. + * + * Steps: + * 1. Open Customers > All Customers. + * 2. Search and open customer from preconditions. + * 3. Click 'Create Order'. + * 4. Check product in 'Recently compared List' section. + * 5. Click 'Update Changes'. + * 6. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28109 + */ +class MoveRecentlyComparedProductsOnOrderPageTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Cms index page. + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Browser instance. + * + * @var BrowserInterface + */ + protected $browser; + + /** + * Catalog product page. + * + * @var CatalogProductView + */ + protected $catalogProductView; + + /** + * Order create index page. + * + * @var OrderCreateIndex + */ + protected $orderCreateIndex; + + /** + * Customer index page. + * + * @var CustomerIndex + */ + protected $customerIndex; + + /** + * Customer index edit page. + * + * @var CustomerIndexEdit + */ + protected $customerIndexEdit; + + /** + * Catalog product compare page. + * + * @var CatalogProductCompare + */ + protected $catalogProductCompare; + + /** + * Create customer. + * + * @param Customer $customer + * @param BrowserInterface $browser + * @return array + */ + public function __prepare(Customer $customer, BrowserInterface $browser) + { + $customer->persist(); + $this->browser = $browser; + + return ['customer' => $customer]; + } + + /** + * Inject pages. + * + * @param CmsIndex $cmsIndex + * @param CatalogProductView $catalogProductView + * @param OrderCreateIndex $orderCreateIndex + * @param CustomerIndex $customerIndex + * @param CustomerIndexEdit $customerIndexEdit + * @param CatalogProductCompare $catalogProductCompare + * @return void + */ + public function __inject( + CmsIndex $cmsIndex, + CatalogProductView $catalogProductView, + OrderCreateIndex $orderCreateIndex, + CustomerIndex $customerIndex, + CustomerIndexEdit $customerIndexEdit, + CatalogProductCompare $catalogProductCompare + ) { + $this->cmsIndex = $cmsIndex; + $this->catalogProductView = $catalogProductView; + $this->orderCreateIndex = $orderCreateIndex; + $this->customerIndex = $customerIndex; + $this->customerIndexEdit = $customerIndexEdit; + $this->catalogProductCompare = $catalogProductCompare; + } + + /** + * Move recently compared products on order page. + * + * @param Customer $customer + * @param string $products + * @return array + */ + public function test(Customer $customer, $products) + { + // Preconditions + // Create product + $products = $this->objectManager->create( + '\Magento\Catalog\Test\TestStep\CreateProductsStep', + ['products' => $products] + )->run()['products']; + // Login under customer + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + foreach ($products as $itemProduct) { + $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html'); + $this->catalogProductView->getViewBlock()->clickAddToCompare(); + } + $this->cmsIndex->getLinksBlock()->openLink("Compare Products"); + $this->catalogProductCompare->getCompareProductsBlock()->removeAllProducts(); + + // Steps: + $this->customerIndex->open(); + $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]); + $this->customerIndexEdit->getPageActionsBlock()->createOrder(); + $this->orderCreateIndex->getStoreBlock()->selectStoreView(); + $activitiesBlock = $this->orderCreateIndex->getCustomerActivitiesBlock(); + $activitiesBlock->getRecentlyComparedProductsBlock()->addProductsToOrder($products); + $activitiesBlock->updateChanges(); + + return ['products' => $products, 'productsIsConfigured' => false]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c392c0ed4648acf34955412584f8679b15bb700e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MoveRecentlyComparedProductsOnOrderPageTest"> + <variation name="MoveRecentlyComparedProductsOnOrderPageTestVariation1"> + <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + <variation name="MoveRecentlyComparedProductsOnOrderPageTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" method="test"> + <data name="products" xsi:type="string">configurableProduct::default,configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..31fd3de31d59505404cb4f90d48fd0987adbf77a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create product. + * 3. Open product on frontend. + * + * Steps: + * 1. Login in to Backend. + * 2. Open Customers > All Customers. + * 3. Search and open customer from preconditions. + * 4. Click Create Order. + * 5. Check product in Recently Viewed Products section. + * 6. Click Update Changes. + * 7. Click Configure. + * 8. Fill data from dataSet. + * 9. Click OK. + * 10. Click Update Items and Qty's button. + * 11. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29723 + */ +class MoveRecentlyViewedProductsOnOrderPageTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Runs Move Recently Viewed Products On Order Page. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..7bd0a534e1993380d2719d2a38d53d8e0bddeee2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MoveRecentlyViewedProductsOnOrderPageTest"> + <variation name="MoveRecentlyViewedProductsOnOrderPageTestVariation1"> + <data name="products" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + <variation name="MoveRecentlyViewedProductsOnOrderPageTestVariation2"> + <data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php new file mode 100644 index 0000000000000000000000000000000000000000..36637b0a89863b410d7db2f3d1fbc30c7de15e62 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.php @@ -0,0 +1,169 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; +use Magento\Customer\Test\Page\CustomerAccountLogout; +use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create customer. + * 2. Create product. + * 3. Add product to cart. + * + * Steps: + * 1. Open Customers > All Customers. + * 2. Search and open customer from preconditions. + * 3. Click Create Order. + * 4. Check product in Shopping Cart section. + * 5. Click Update Changes. + * 6. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28540 + */ +class MoveShoppingCartProductsOnOrderPageTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Customer logout page + * + * @var CustomerAccountLogout + */ + protected $customerAccountLogout; + + /** + * Browser instance + * + * @var BrowserInterface + */ + protected $browser; + + /** + * Catalog product page + * + * @var CatalogProductView + */ + protected $catalogProductView; + + /** + * Customer index page + * + * @var CustomerIndex + */ + protected $customerIndex; + + /** + * Customer index edit page + * + * @var CustomerIndexEdit + */ + protected $customerIndexEdit; + + /** + * Order create index page + * + * @var OrderCreateIndex + */ + protected $orderCreateIndex; + + /** + * Prepare data. + * + * @param Customer $customer + * @return array + */ + public function __prepare(Customer $customer) + { + $customer->persist(); + + return ['customer' => $customer]; + } + + /** + * Inject pages. + * + * @param CustomerAccountLogout $customerAccountLogout + * @param CatalogProductView $catalogProductView + * @param CustomerIndex $customerIndex + * @param CustomerIndexEdit $customerIndexEdit + * @param BrowserInterface $browser + * @param OrderCreateIndex $orderCreateIndex + * @return void + */ + public function __inject( + CustomerAccountLogout $customerAccountLogout, + CatalogProductView $catalogProductView, + CustomerIndex $customerIndex, + CustomerIndexEdit $customerIndexEdit, + BrowserInterface $browser, + OrderCreateIndex $orderCreateIndex + ) { + $this->customerAccountLogout = $customerAccountLogout; + $this->catalogProductView = $catalogProductView; + $this->customerIndex = $customerIndex; + $this->customerIndexEdit = $customerIndexEdit; + $this->browser = $browser; + $this->orderCreateIndex = $orderCreateIndex; + } + + /** + * Create order from customer page (cartActions). + * + * @param Customer $customer + * @param string $product + * @return array + */ + public function test(Customer $customer, $product) + { + //Preconditions + // Create product + $product = $this->objectManager->create( + '\Magento\Catalog\Test\TestStep\CreateProductStep', + ['product' => $product] + )->run()['product']; + // Login under customer + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->catalogProductView->getViewBlock()->addToCart($product); + + //Steps + $this->customerIndex->open(); + $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]); + $this->customerIndexEdit->getPageActionsBlock()->createOrder(); + $this->orderCreateIndex->getStoreBlock()->selectStoreView(); + $this->orderCreateIndex->getCustomerActivitiesBlock()->getShoppingCartItemsBlock() + ->addProductsToOrder([$product]); + $this->orderCreateIndex->getCustomerActivitiesBlock()->updateChanges(); + + return ['products' => [$product]]; + } + + /** + * Log out after test. + * + * @return void + */ + public function tearDown() + { + $this->customerAccountLogout->open(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..60887adfe898c5620a78e453d395a8d3c2ef22c5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\MoveShoppingCartProductsOnOrderPageTest"> + <variation name="MoveShoppingCartProductsOnOrderPageTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> + </variation> + <variation name="MoveShoppingCartProductsOnOrderPageTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" method="test"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1e7e13da8b55aa384852be9ec86a09d943bb2df8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Create products. + * 2. Enable all Gift Options. + * 3. Create Gift Card Account with Balance = 1. + * 4. Create Customer Account. + * 5. Place order with options according to dataSet. + * + * Steps: + * 1. Find the Order on frontend. + * 2. Navigate to: Orders and Returns. + * 3. Fill the form with correspondent Order data. + * 4. Click on the "Continue" button. + * 5. Click on the "Print Order" button. + * 6. Perform appropriate assertions.v + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-30253 + */ +class PrintOrderFrontendGuestTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Browser. + * + * @var BrowserInterface + */ + protected $browser; + + /** + * Prepare data. + * + * @param BrowserInterface $browser + */ + public function __prepare(BrowserInterface $browser) + { + $this->browser = $browser; + } + + /** + * Runs print order on frontend. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } + + /** + * Close browser. + * + * @return void + */ + public function tearDown() + { + $this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run(); + $this->browser->closeWindow(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c5bce1d33a76dc478e09ee229b777fff8e2345b3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\PrintOrderFrontendGuestTest"> + <variation name="PrintOrderFrontendGuestTestVariation1"> + <data name="customer" xsi:type="array"> + <item name="dataSet" xsi:type="string">johndoe_with_addresses"</item> + </data> + <data name="billingAddress" xsi:type="array"> + <item name="dataSet" xsi:type="string">customer_US"</item> + </data> + <data name="payment" xsi:type="array"> + <item name="method" xsi:type="string">checkmo"</item> + </data> + <data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product, configurableProduct::default, downloadableProduct::default</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">723.00</item> + </data> + <data name="paymentMethod" xsi:type="string">Check / Money order</data> + <data name="salesRule" xsi:type="string">active_sales_rule_with_fixed_price_discount_coupon</data> + <data name="salesRuleDiscount" xsi:type="string">300.00</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <constraint name="Magento\Sales\Test\Constraint\AssertSalesPrintOrderBillingAddress" /> + <constraint name="Magento\Sales\Test\Constraint\AssertSalesPrintOrderGrandTotal" /> + <constraint name="Magento\Sales\Test\Constraint\AssertSalesPrintOrderPaymentMethod" /> + <constraint name="Magento\Sales\Test\Constraint\AssertSalesPrintOrderProducts" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertSalesRuleOnPrintOrder" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShippingMethodOnPrintOrder" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2706971f12810aad500a1c8cee168296420b5384 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Mtf\TestCase\Scenario; + +/** + * Preconditions: + * 1. Create two products. + * 2. Create a customer. + * 3. Create order. + * + * Steps: + * 1. Go to backend. + * 2. Open Sales > Orders. + * 3. Open the created order. + * 4. Do 'Reorder' for placed order. + * 5. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29007 + */ +class ReorderOrderEntityTest extends Scenario +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Reorder created order. + * + * @return void + */ + public function test() + { + $this->executeScenario(); + } + + /** + * Disable enabled config after test. + * + * @return void + */ + public function tearDown() + { + if (isset($this->currentVariation['arguments']['configData'])) { + $setConfigStep = $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => $this->currentVariation['arguments']['configData'], 'rollback' => true] + ); + $setConfigStep->run(); + } + $this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..200b45de0adb16a93d2c5343434e3038d064973d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\ReorderOrderEntityTest"> + <variation name="ReorderOrderEntityTestVariation1"> + <data name="description" xsi:type="string">Reorder placed order (update products, billing address).</data> + <data name="order/dataSet" xsi:type="string">two_simple_product</data> + <data name="salesRule" xsi:type="string">active_sales_rule_with_fixed_price_discount_coupon</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="prices" xsi:type="array"> + <item name="grandTotal" xsi:type="string">1,030.00</item> + </data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="previousOrderStatus" xsi:type="string">Pending</data> + <data name="status" xsi:type="string">Pending</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Notification, Hold, Invoice, Ship, Edit</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertReorderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php new file mode 100644 index 0000000000000000000000000000000000000000..05813d46b2d8b1850062a97c3401775e4290d93a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderStatus; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Custom Order Status is created. + * 2. Order Status assigned to State. + * + * Steps: + * 1. Log in to backend. + * 2. Navigate to the Stores > Settings > Order Status. + * 3. Click "Unassign" for appropriate status. + * 4. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29450 + */ +class UnassignCustomOrderStatusTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Order Status Index page. + * + * @var OrderStatusIndex + */ + protected $orderStatusIndex; + + /** + * Injection data. + * + * @param OrderStatusIndex $orderStatusIndex + * @return void + */ + public function __inject(OrderStatusIndex $orderStatusIndex) + { + $this->orderStatusIndex = $orderStatusIndex; + } + + /** + * Run Unassign Custom OrderStatus test. + * + * @param OrderStatus $orderStatus + * @return void + */ + public function test(OrderStatus $orderStatus) + { + // Preconditions: + $orderStatus->persist(); + + // Steps: + $orderStatusLabel = $orderStatus->getLabel(); + $this->orderStatusIndex->open(); + $this->orderStatusIndex->getOrderStatusGrid()->searchAndUnassign(['label' => $orderStatusLabel]); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c429fc46730d9b6983b05843d316b1f6a9586c1e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UnassignCustomOrderStatusTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\UnassignCustomOrderStatusTest"> + <variation name="UnassignCustomOrderStatusTestVariation1"> + <data name="description" xsi:type="string">unassign order status</data> + <data name="orderStatus/dataSet" xsi:type="string">assign_to_pending</data> + <data name="defaultState" xsi:type="string">Pending</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusSuccessUnassignMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusNotAssigned" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1ddf03146ceeee32abf630ad2166ac73b2f7f1c4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.php @@ -0,0 +1,159 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Fixture\OrderStatus; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusEdit; +use Magento\Sales\Test\Page\Adminhtml\OrderStatusIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Custom Order Status is created. + * 2. New order should be created if orderExist=Yes. + * + * Steps: + * 1. Log in as admin. + * 2. Navigate to the Stores > Settings > Order Status. + * 3. Click on Custom Order Status from grid. + * 4. Fill in all data according to data set. + * 5. Save order status. + * 6. Perform all assertions. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-29868 + */ +class UpdateCustomOrderStatusTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Order Status Index page. + * + * @var OrderStatusIndex + */ + protected $orderStatusIndex; + + /** + * Order Status Edit page. + * + * @var OrderStatusEdit + */ + protected $orderStatusEdit; + + /** + * Order Index page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * OrderStatus Fixture. + * + * @var OrderStatus + */ + protected $orderStatus; + + /** + * OrderStatus Fixture. + * + * @var OrderStatus + */ + protected $orderStatusInitial; + + /** + * OrderInjectable Fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Injection data. + * + * @param OrderStatusIndex $orderStatusIndex + * @param OrderStatusEdit $orderStatusEdit + * @param OrderIndex $orderIndex + * @return void + */ + public function __inject( + OrderStatusIndex $orderStatusIndex, + OrderStatusEdit $orderStatusEdit, + OrderIndex $orderIndex + ) { + $this->orderStatusIndex = $orderStatusIndex; + $this->orderStatusEdit = $orderStatusEdit; + $this->orderIndex = $orderIndex; + } + + /** + * Run Update Custom OrderStatus Test. + * + * @param OrderStatus $orderStatusInitial + * @param OrderStatus $orderStatus + * @param OrderInjectable $order + * @param FixtureFactory $fixtureFactory + * @param string $orderExist + * @return array + */ + public function test( + OrderStatus $orderStatusInitial, + OrderStatus $orderStatus, + OrderInjectable $order, + FixtureFactory $fixtureFactory, + $orderExist + ) { + // Preconditions: + $orderStatusInitial->persist(); + if ($orderExist == 'Yes') { + $order->persist(); + } + // Steps: + $this->orderStatusIndex->open(); + $this->orderStatusIndex->getOrderStatusGrid()->searchAndOpen(['label' => $orderStatusInitial->getLabel()]); + $this->orderStatusEdit->getOrderStatusForm()->fill($orderStatus); + $this->orderStatusEdit->getFormPageActions()->save(); + + // Configuring orderStatus for asserts. + $orderStatus = $fixtureFactory->createByCode( + 'orderStatus', + ['data' => array_merge($orderStatusInitial->getData(), $orderStatus->getData())] + ); + + // Prepare data for tear down + $this->orderStatus = $orderStatus; + $this->orderStatusInitial = $orderStatusInitial; + $this->order = $order; + + return [ + 'orderStatus' => $orderStatus, + 'status' => $orderStatus->getLabel(), + 'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer() + ]; + } + + /** + * Change created order status and unassign custom order status if order was created. + * + * @return void + */ + public function tearDown() + { + if ($this->order->hasData('id')) { + $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel'); + $filter = ['label' => $this->orderStatus->getLabel(), 'status' => $this->orderStatusInitial->getStatus()]; + $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..3db975b7ed80ef2a51bca736ad384f19ec914aa5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/UpdateCustomOrderStatusTest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Sales\Test\TestCase\UpdateCustomOrderStatusTest"> + <variation name="UpdateCustomOrderStatusTestVariation1"> + <data name="description" xsi:type="string">change status label to existed</data> + <data name="orderStatusInitial/dataSet" xsi:type="string">default</data> + <data name="orderExist" xsi:type="string">No</data> + <data name="orderStatus/data/label" xsi:type="string">Processing</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + </variation> + <variation name="UpdateCustomOrderStatusTestVariation2"> + <data name="description" xsi:type="string">change status label to new and check orderStatus for order with changed orderStatus</data> + <data name="orderStatusInitial/dataSet" xsi:type="string">assign_to_pending</data> + <data name="orderExist" xsi:type="string">Yes</data> + <data name="orderStatus/data/label" xsi:type="string">orderLabel%isolation%</data> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusSuccessCreateMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusInGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddRecentlyViewedProductsToCartStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddRecentlyViewedProductsToCartStep.php index d995a2c78298b4d2932cf9836377407933f321eb..c642f0e5ccee6a3e86fdf0dc7768440222d3dac1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddRecentlyViewedProductsToCartStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/AddRecentlyViewedProductsToCartStep.php @@ -47,21 +47,7 @@ class AddRecentlyViewedProductsToCartStep implements TestStepInterface public function run() { $recentlyBlock = $this->orderCreateIndex->getCustomerActivitiesBlock(); - $recentlyBlock->getRecentlyViewedItemsBlock()->addToOrderByName($this->extractProductNames()); + $recentlyBlock->getRecentlyViewedItemsBlock()->addProductsToOrder($this->products); $recentlyBlock->updateChanges(); } - - /** - * Extract products name. - * - * @return array - */ - protected function extractProductNames() - { - $result = []; - foreach ($this->products as $product) { - $result[] = $product->getName(); - } - return $result; - } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php new file mode 100644 index 0000000000000000000000000000000000000000..fa43917e81db2e7454503c886f21e2dc7550ecdc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderCreditMemoNew; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Create credit memo from order on backend. + */ +class CreateCreditMemoStep implements TestStepInterface +{ + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * OrderCreditMemoNew Page. + * + * @var OrderCreditMemoNew + */ + protected $orderCreditMemoNew; + + /** + * OrderInjectable fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Credit memo data. + * + * @var array|null + */ + protected $data; + + /** + * @construct + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @param OrderInjectable $order + * @param OrderCreditMemoNew $orderCreditMemoNew + * @param array|null $data [optional] + */ + public function __construct( + OrderIndex $orderIndex, + SalesOrderView $salesOrderView, + OrderInjectable $order, + OrderCreditMemoNew $orderCreditMemoNew, + $data = null + ) { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + $this->order = $order; + $this->orderCreditMemoNew = $orderCreditMemoNew; + $this->data = $data; + } + + /** + * Create credit memo from order on backend. + * + * @return array + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + $this->salesOrderView->getPageActions()->orderCreditMemo(); + if (!empty($this->data)) { + $this->orderCreditMemoNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + $this->orderCreditMemoNew->getFormBlock()->updateQty(); + } + $this->orderCreditMemoNew->getFormBlock()->submit(); + + return ['creditMemoIds' => $this->getCreditMemoIds()]; + } + + /** + * Get credit memo ids. + * + * @return array + */ + protected function getCreditMemoIds() + { + $this->salesOrderView->getOrderForm()->openTab('creditmemos'); + return $this->salesOrderView->getOrderForm()->getTabElement('creditmemos')->getGridBlock()->getIds(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateInvoiceStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateInvoiceStep.php new file mode 100644 index 0000000000000000000000000000000000000000..304f58063a029496d5b50dfb06dab0cdb02a4d9b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateInvoiceStep.php @@ -0,0 +1,146 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceNew; +use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceView; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Shipping\Test\Page\Adminhtml\OrderShipmentView; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Create invoice from order on backend. + */ +class CreateInvoiceStep implements TestStepInterface +{ + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * Order New Invoice Page. + * + * @var OrderInvoiceNew + */ + protected $orderInvoiceNew; + + /** + * Order invoice view page. + * + * @var OrderInvoiceView + */ + protected $orderInvoiceView; + + /** + * Order shipment view page. + * + * @var OrderShipmentView + */ + protected $orderShipmentView; + + /** + * OrderInjectable fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Invoice data. + * + * @var array|null + */ + protected $data; + + /** + * @construct + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @param OrderInvoiceNew $orderInvoiceNew + * @param OrderInvoiceView $orderInvoiceView + * @param OrderInjectable $order + * @param OrderShipmentView $orderShipmentView + * @param array|null $data[optional] + */ + public function __construct( + OrderIndex $orderIndex, + SalesOrderView $salesOrderView, + OrderInvoiceNew $orderInvoiceNew, + OrderInvoiceView $orderInvoiceView, + OrderInjectable $order, + OrderShipmentView $orderShipmentView, + $data = null + ) { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + $this->orderInvoiceNew = $orderInvoiceNew; + $this->orderInvoiceView = $orderInvoiceView; + $this->order = $order; + $this->orderShipmentView = $orderShipmentView; + $this->data = $data; + } + + /** + * Create invoice (with shipment optionally) for order on backend. + * + * @return array + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + $this->salesOrderView->getPageActions()->invoice(); + if (!empty($this->data)) { + $this->orderInvoiceNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + $this->orderInvoiceNew->getFormBlock()->updateQty(); + } + $this->orderInvoiceNew->getFormBlock()->submit(); + $invoiceIds = $this->getInvoiceIds(); + if (!empty($this->data)) { + $shipmentIds = $this->getShipmentIds(); + } + + return [ + 'invoiceIds' => $invoiceIds, + 'shipmentIds' => isset($shipmentIds) ? $shipmentIds : null, + ]; + } + + /** + * Get invoice ids. + * + * @return array + */ + protected function getInvoiceIds() + { + $this->salesOrderView->getOrderForm()->openTab('invoices'); + return $this->salesOrderView->getOrderForm()->getTabElement('invoices')->getGridBlock()->getIds(); + } + + /** + * Get shipment ids. + * + * @return array + */ + protected function getShipmentIds() + { + $this->salesOrderView->getOrderForm()->openTab('shipments'); + return $this->salesOrderView->getOrderForm()->getTabElement('shipments')->getGridBlock()->getIds(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOrderStep.php new file mode 100644 index 0000000000000000000000000000000000000000..5373d0da6c99781491bf2ad6d7d2f0ed23e1f808 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOrderStep.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Step for create order. + */ +class CreateOrderStep implements TestStepInterface +{ + /** + * Order. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Preparing step properties. + * + * @constructor + * @param OrderInjectable $order + */ + public function __construct(OrderInjectable $order) + { + $this->order = $order; + } + + /** + * Create order. + * + * @return array + */ + public function run() + { + $this->order->persist(); + + return ['products' => $this->order->getEntityId()['products'], 'order' => $this->order]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php new file mode 100644 index 0000000000000000000000000000000000000000..1ea259d0e05cd8bab3aa9ffdbb4130114a86562d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php @@ -0,0 +1,116 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Shipping\Test\Page\Adminhtml\OrderShipmentNew; +use Magento\Shipping\Test\Page\Adminhtml\OrderShipmentView; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Create shipping from order on backend. + */ +class CreateShipmentStep implements TestStepInterface +{ + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * New Order Shipment Page. + * + * @var OrderShipmentNew + */ + protected $orderShipmentNew; + + /** + * Order shipment view page. + * + * @var OrderShipmentView + */ + protected $orderShipmentView; + + /** + * OrderInjectable fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * Invoice data. + * + * @var array|null + */ + protected $data; + + /** + * @construct + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @param OrderShipmentNew $orderShipmentNew + * @param OrderShipmentView $orderShipmentView + * @param OrderInjectable $order + * @param array|null $data [optional] + */ + public function __construct( + OrderIndex $orderIndex, + SalesOrderView $salesOrderView, + OrderShipmentNew $orderShipmentNew, + OrderShipmentView $orderShipmentView, + OrderInjectable $order, + $data = null + ) { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + $this->orderShipmentNew = $orderShipmentNew; + $this->orderShipmentView = $orderShipmentView; + $this->order = $order; + $this->data = $data; + } + + /** + * Create shipping for order on backend. + * + * @return array + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + $this->salesOrderView->getPageActions()->ship(); + if (!empty($this->data)) { + $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + } + $this->orderShipmentNew->getFormBlock()->submit(); + + return ['shipmentIds' => $this->getShipmentIds()]; + } + + /** + * Get shipment id. + * + * @return array + */ + public function getShipmentIds() + { + $this->salesOrderView->getOrderForm()->openTab('shipments'); + return $this->salesOrderView->getOrderForm()->getTabElement('shipments')->getGridBlock()->getIds(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OnHoldStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OnHoldStep.php new file mode 100644 index 0000000000000000000000000000000000000000..ede5372c7f4bdb1cd91b42a5ee7eb2a68bf74b2d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OnHoldStep.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * On hold order on backend. + */ +class OnHoldStep implements TestStepInterface +{ + /** + * Orders Page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order View Page. + * + * @var SalesOrderView + */ + protected $salesOrderView; + + /** + * OrderInjectable fixture. + * + * @var OrderInjectable + */ + protected $order; + + /** + * @construct + * @param OrderIndex $orderIndex + * @param SalesOrderView $salesOrderView + * @param OrderInjectable $order + */ + public function __construct(OrderIndex $orderIndex, SalesOrderView $salesOrderView, OrderInjectable $order) + { + $this->orderIndex = $orderIndex; + $this->salesOrderView = $salesOrderView; + $this->order = $order; + } + + /** + * On hold order on backend. + * + * @return void + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + $this->salesOrderView->getPageActions()->hold(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenOrderStep.php new file mode 100644 index 0000000000000000000000000000000000000000..d82b38e263d797a526c9f8bad5c39b213c8457c4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenOrderStep.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\Adminhtml\OrderIndex; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Open order step. + */ +class OpenOrderStep implements TestStepInterface +{ + /** + * Sales order index page. + * + * @var OrderIndex + */ + protected $orderIndex; + + /** + * Order instance. + * + * @var OrderInjectable + */ + protected $order; + + /** + * @constructor + * @param OrderInjectable $order + * @param OrderIndex $orderIndex + */ + public function __construct(OrderInjectable $order, OrderIndex $orderIndex) + { + $this->orderIndex = $orderIndex; + $this->order = $order; + } + + /** + * Open order. + * + * @return void + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenSalesOrderOnFrontendForGuestStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenSalesOrderOnFrontendForGuestStep.php new file mode 100644 index 0000000000000000000000000000000000000000..783f7e0f37c7c60f4325508d6410b046b4a98ead --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/OpenSalesOrderOnFrontendForGuestStep.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\TestStep; + +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Page\CustomerAccountLogout; +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Sales\Test\Page\SalesGuestForm; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Open sales order page on frontend for guest. + */ +class OpenSalesOrderOnFrontendForGuestStep implements TestStepInterface +{ + /** + * Customer log out page. + * + * @var CustomerAccountLogout + */ + protected $customerAccountLogout; + + /** + * Cms index page. + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Sales guest page. + * + * @var SalesGuestForm + */ + protected $salesGuestForm; + + /** + * Fixture order. + * + * @var OrderInjectable + */ + protected $order; + + /** + * @constructor + * @param CustomerAccountLogout $customerAccountLogout + * @param CmsIndex $cmsIndex + * @param SalesGuestForm $salesGuestForm + * @param OrderInjectable $order + */ + public function __construct( + CustomerAccountLogout $customerAccountLogout, + CmsIndex $cmsIndex, + SalesGuestForm $salesGuestForm, + OrderInjectable $order + ) { + $this->customerAccountLogout = $customerAccountLogout; + $this->cmsIndex = $cmsIndex; + $this->salesGuestForm = $salesGuestForm; + $this->order = $order; + } + + /** + * Run step. + * + * @return void + */ + public function run() + { + $this->customerAccountLogout->open(); + $this->cmsIndex->getFooterBlock()->clickLink('Orders and Returns'); + $this->salesGuestForm->getSearchForm()->fill($this->order); + $this->salesGuestForm->getSearchForm()->submit(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index 4e5838f04aecf4c22d2ccb9ab95d93a37ffd415e..4e7817f293e701d2d0254be667ed8be7eadba345 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -35,11 +35,7 @@ </scenario> <scenario name="MoveRecentlyViewedProductsOnOrderPageTest" firstStep="createProducts"> <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> - <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"> - <item name="customer"> - <item name="dataSet" value="default" /> - </item> - </step> + <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend" /> <step name="loginCustomerOnFrontend" module="Magento_Customer" next="openProductsOnFrontend" /> <step name="openProductsOnFrontend" module="Magento_Catalog" next="openCustomerOnBackend" /> <step name="openCustomerOnBackend" module="Magento_Customer" next="createOrderFromCustomerAccount" /> @@ -50,26 +46,14 @@ </scenario> <scenario name="PrintOrderFrontendGuestTest" firstStep="createProducts"> <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> - <item name="customer"> - <item name="dataSet" value="johndoe_with_addresses" /> - </item> - </step> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders" /> <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> <step name="selectStore" module="Magento_Sales" next="addProducts" /> <step name="addProducts" module="Magento_Sales" next="fillBillingAddress" /> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"> - <item name="billingAddress"> - <item name="dataSet" value="customer_US" /> - </item> - </step> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"> - <item name="payment"> - <item name="method" value="checkmo" /> - </item> - </step> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> <step name="submitOrder" module="Magento_Sales" next="openSalesOrderOnFrontendForGuest" /> <step name="openSalesOrderOnFrontendForGuest" module="Magento_Sales" next="printOrderOnFrontend" /> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Grid.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Grid.php new file mode 100644 index 0000000000000000000000000000000000000000..02d2e2652fad958f5dbde7807cc33c1b6ae18e10 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Grid.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Block\Adminhtml\Promo; + +use Magento\Mtf\Client\Locator; + +/** + * Backend sales rule grid. + */ +class Grid extends \Magento\Backend\Test\Block\Widget\Grid +{ + /** + * Id of a row selector. + * + * @var string + */ + protected $rowIdSelector = 'td.col-rule_id'; + + /** + * Locator for promo quote form. + * + * @var string + */ + protected $promoQuoteFormSelector = 'div#promo_catalog_edit_tabs'; + + /** + * First row selector + * + * @var string + */ + protected $firstRowSelector = '//tr[1]/td[@data-column="name"]'; + + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'rule_id' => [ + 'selector' => '#promo_quote_grid_filter_rule_id', + ], + 'name' => [ + 'selector' => 'input[name="name"]', + ], + ]; + + /** + * Locator value for link in sales rule name column. + * + * @var string + */ + protected $editLink = 'td[class*=col-name]'; + + /** + * An element locator which allows to select entities in grid. + * + * @var string + */ + protected $selectItem = 'tbody tr .col-name'; + + /** + * Return the id of the row that matched the search filter. + * + * @param $filter + * @param bool $isSearchable + * @return array|int|string + */ + public function getIdOfRow($filter, $isSearchable = true) + { + $rid = -1; + $this->search($filter, $isSearchable); + $rowItem = $this->_rootElement->find($this->rowItem, Locator::SELECTOR_CSS); + if ($rowItem->isVisible()) { + $idElement = $rowItem->find($this->rowIdSelector); + $rid = $idElement->getText(); + } + return $rid; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.php new file mode 100644 index 0000000000000000000000000000000000000000..9a2b007711a0dde54bb0dbb61aa80122318f7e79 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit; + +use Magento\Backend\Test\Block\Widget\FormTabs; + +/** + * Sales rule edit form. + */ +class PromoQuoteForm extends FormTabs +{ + /** + * Selector of element to wait for. If set by child will wait for element after action + * + * @var string + */ + protected $waitForSelector = 'div#promo_catalog_edit_tabs'; + + /** + * Wait for should be for visibility or not? + * + * @var boolean + */ + protected $waitForSelectorVisible = false; +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml new file mode 100644 index 0000000000000000000000000000000000000000..756e14f274fa065bdd3ce9914a5d41d6e778841d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tabs> + <rule_information> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#promo_catalog_edit_tabs_main_section</selector> + <strategy>css selector</strategy> + <fields> + <name /> + <description /> + <is_active> + <input>select</input> + </is_active> + <website_ids> + <selector>[name="website_ids[]"]</selector> + <input>multiselect</input> + </website_ids> + <customer_group_ids> + <selector>[name="customer_group_ids[]"]</selector> + <input>multiselect</input> + </customer_group_ids> + <coupon_type> + <input>select</input> + </coupon_type> + <coupon_code /> + <uses_per_coupon /> + <uses_per_customer /> + <from_date /> + <to_date /> + <sort_order /> + <is_rss> + <input>select</input> + </is_rss> + </fields> + </rule_information> + <conditions> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#promo_catalog_edit_tabs_conditions_section</selector> + <strategy>css selector</strategy> + <fields> + <conditions_serialized> + <selector>#rule_conditions_fieldset</selector> + <input>conditions</input> + </conditions_serialized> + </fields> + </conditions> + <actions> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#promo_catalog_edit_tabs_actions_section</selector> + <strategy>css selector</strategy> + <fields> + <simple_action> + <input>select</input> + </simple_action> + <discount_amount /> + <discount_qty /> + <discount_step /> + <apply_to_shipping> + <input>select</input> + </apply_to_shipping> + <stop_rules_processing> + <input>select</input> + </stop_rules_processing> + <simple_free_shipping> + <input>select</input> + </simple_free_shipping> + <actions_serialized> + <selector>#rule_actions_fieldset</selector> + <input>conditions</input> + </actions_serialized> + </fields> + </actions> + <labels> + <class>\Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Tab\Labels</class> + <selector>#promo_catalog_edit_tabs_labels_section</selector> + <strategy>css selector</strategy> + </labels> +</tabs> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php new file mode 100644 index 0000000000000000000000000000000000000000..35ad53e038c1c94d20ee093d83b640ce7d590390 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Tab; + +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Backend\Test\Block\Widget\Tab; + +/** + * Sales rule condition tab. + */ +class Conditions extends Tab +{ + /** + * Field Prefix Constant + */ + const FIELD_PREFIX = '#conditions__1__'; + + /** + * Set the mapping and fill the form. + * + * @param array $fields + * @param SimpleElement|null $element + * @return $this + * + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function fillFormTab(array $fields, SimpleElement $element = null) + { + foreach ($fields as $key => $value) { + $this->mapping[$key] = self::FIELD_PREFIX . $key; + } + return parent::fillFormTab($fields, $element); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php new file mode 100644 index 0000000000000000000000000000000000000000..7805f1ec94f6ac91cdf3075d5f8f546626cdc407 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Tab; + +use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Backend sales rule label tab. + */ +class Labels extends Tab +{ + /** + * Store label field name. + */ + const STORE_LABEL_NAME = '[name="store_labels[%s]"]'; + + /** + * Fill data to labels fields on labels tab. + * + * @param array $fields + * @param SimpleElement|null $element + * @return $this + */ + public function fillFormTab(array $fields, SimpleElement $element = null) + { + if (isset($fields['store_labels'])) { + $count = 0; + foreach ($fields['store_labels']['value'] as $storeLabel) { + $element->find(sprintf(self::STORE_LABEL_NAME, $count))->setValue($storeLabel); + ++$count; + } + } + + return $this; + } + + /** + * Get data of labels tab. + * + * @param array|null $fields + * @param SimpleElement|null $element + * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getDataFormTab($fields = null, SimpleElement $element = null) + { + $context = $element === null ? $this->_rootElement : $element; + $storeLabels = []; + $count = 0; + $field = $context->find(sprintf(self::STORE_LABEL_NAME, $count)); + while ($field->isVisible()) { + $fieldValue = $field->getValue(); + if ($fieldValue != '') { + $storeLabels[$count] = $fieldValue; + } + ++$count; + $field = $context->find(sprintf(self::STORE_LABEL_NAME, $count)); + } + + return ['store_labels' => $storeLabels]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/Items.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/Items.php new file mode 100644 index 0000000000000000000000000000000000000000..5914551482f6ab10db655f07b811b185723865bc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/Items.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Block\Order; + +/** + * Items block on order's view page. + */ +class Items extends \Magento\Sales\Test\Block\Order\Items +{ + /** + * Sales Rule selector. + * + * @var string + */ + protected $salesRuleSelector = '.discount > .amount > span.price'; + + /** + * Get sales rule discount. + * + * @return string + */ + public function getSalesRuleDiscount() + { + return $this->escapeCurrency($this->_rootElement->find($this->salesRuleSelector)->getText()); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/View.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/View.php new file mode 100644 index 0000000000000000000000000000000000000000..58c533220c5140b2dee350de44ae27ffb3292390 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Order/View.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Block\Order; + +use Magento\Mtf\Client\Locator; + +/** + * View block on order's view page. + */ +class View extends \Magento\Sales\Test\Block\Order\View +{ + /** + * Get item block. + * + * @param int $id [optional] + * @return Items + */ + public function getItemBlock($id = null) + { + $selector = ($id === null) ? $this->content : sprintf($this->itemBlock, $id) . $this->content; + return $this->blockFactory->create( + 'Magento\SalesRule\Test\Block\Order\Items', + ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleApplying.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleApplying.php new file mode 100644 index 0000000000000000000000000000000000000000..1b573901d93ca029d529bf6c812e436b43d0ee05 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleApplying.php @@ -0,0 +1,209 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Checkout\Test\Page\CheckoutCart; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Address; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\CustomerAccountLogin; +use Magento\Customer\Test\Page\CustomerAccountLogout; +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Abstract class for implementing assert applying. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +abstract class AssertCartPriceRuleApplying extends AbstractConstraint +{ + /** + * Page CheckoutCart. + * + * @var CheckoutCart + */ + protected $checkoutCart; + + /** + * Page CmsIndex. + * + * @var CmsIndex + */ + protected $cmsIndex; + + /** + * Page CustomerAccountLogin. + * + * @var CustomerAccountLogin + */ + protected $customerAccountLogin; + + /** + * Page CustomerAccountLogout. + * + * @var CustomerAccountLogout + */ + protected $customerAccountLogout; + + /** + * Page CatalogCategoryView. + * + * @var CatalogCategoryView + */ + protected $catalogCategoryView; + + /** + * Page CatalogProductView. + * + * @var CatalogProductView + */ + protected $catalogProductView; + + /** + * Customer from precondition. + * + * @var Customer + */ + protected $customer; + + /** + * First product from precondition. + * + * @var CatalogProductSimple + */ + protected $productForSalesRule1; + + /** + * Second product from precondition. + * + * @var CatalogProductSimple + */ + protected $productForSalesRule2; + + /** + * Implementation assert. + * + * @return void + */ + abstract protected function assert(); + + /** + * 1. Navigate to frontend + * 2. If "Log Out" link is visible and "isLoggedIn" empty + * - makes logout + * 3. If "isLoggedIn" not empty + * - login as customer + * 4. Clear shopping cart + * 5. Add test product(s) to shopping cart with specify quantity + * 6. If "salesRule/data/coupon_code" not empty: + * - fill "Enter your code" input in Dіscount Codes + * - click "Apply Coupon" button + * 7. If "address/data/country_id" not empty: + * On Estimate Shipping and Tax: + * - fill Country, State/Province, Zip/Postal Code + * - click 'Get a Quote' button + * - select 'Flat Rate' shipping + * - click 'Update Total' button + * 8. Implementation assert + * + * @param CheckoutCart $checkoutCart + * @param CmsIndex $cmsIndex + * @param CustomerAccountLogin $customerAccountLogin + * @param CustomerAccountLogout $customerAccountLogout + * @param CatalogCategoryView $catalogCategoryView + * @param CatalogProductView $catalogProductView + * @param Customer $customer + * @param SalesRuleInjectable $salesRule + * @param SalesRuleInjectable $salesRuleOrigin + * @param array $productQuantity + * @param CatalogProductSimple $productForSalesRule1 + * @param CatalogProductSimple $productForSalesRule2 + * @param Address $address + * @param int|null $isLoggedIn + * @param array $shipping + * @return void + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function processAssert( + CheckoutCart $checkoutCart, + CmsIndex $cmsIndex, + CustomerAccountLogin $customerAccountLogin, + CustomerAccountLogout $customerAccountLogout, + CatalogCategoryView $catalogCategoryView, + CatalogProductView $catalogProductView, + Customer $customer, + SalesRuleInjectable $salesRule, + SalesRuleInjectable $salesRuleOrigin, + array $productQuantity, + CatalogProductSimple $productForSalesRule1, + CatalogProductSimple $productForSalesRule2 = null, + Address $address = null, + $isLoggedIn = null, + array $shipping = [] + ) { + $this->checkoutCart = $checkoutCart; + $this->cmsIndex = $cmsIndex; + $this->customerAccountLogin = $customerAccountLogin; + $this->customerAccountLogout = $customerAccountLogout; + $this->catalogCategoryView = $catalogCategoryView; + $this->catalogProductView = $catalogProductView; + $this->customer = $customer; + $this->productForSalesRule1 = $productForSalesRule1; + $this->productForSalesRule2 = $productForSalesRule2; + $isLoggedIn ? $this->login() : $this->customerAccountLogout->open(); + $this->checkoutCart->open()->getCartBlock()->clearShoppingCart(); + $this->addProductsToCart($productQuantity); + $this->checkoutCart->open(); + if ($address !== null) { + $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address); + $this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping); + } + if ($salesRule->getCouponCode() || $salesRuleOrigin->getCouponCode()) { + $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode( + $salesRule->getCouponCode() ? $salesRule->getCouponCode() : $salesRuleOrigin->getCouponCode() + ); + } + $this->assert(); + } + + /** + * LogIn customer. + * + * @return void + */ + protected function login() + { + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $this->customer] + )->run(); + } + + /** + * Add products to cart. + * + * @param array $productQuantity + * @return void + */ + protected function addProductsToCart(array $productQuantity) + { + foreach ($productQuantity as $product => $quantity) { + if ($quantity > 0) { + $categoryName = $this->$product->getCategoryIds()[0]; + $this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName); + $this->catalogCategoryView->getListProductBlock()->getProductItem($this->$product)->open(); + $this->catalogProductView->getViewBlock()->setQtyAndClickAddToCart($quantity); + $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); + } + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsApplied.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsApplied.php new file mode 100644 index 0000000000000000000000000000000000000000..55a3450a6e108f56d86c72c681135232309b0c5f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsApplied.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +/** + * Check that shopping cart subtotal not equals with grand total(excluding shipping price if exist). + */ +class AssertCartPriceRuleConditionIsApplied extends AssertCartPriceRuleApplying +{ + /** + * Assert that shopping cart subtotal not equals with grand total. + * + * @return void + */ + protected function assert() + { + $subTotal = $this->checkoutCart->getTotalsBlock()->getSubtotal(); + $grandTotal = $this->checkoutCart->getTotalsBlock()->getGrandTotal(); + + if ($this->checkoutCart->getTotalsBlock()->isVisibleShippingPriceBlock()) { + $shippingPrice = $this->checkoutCart->getTotalsBlock()->getShippingPrice(); + $grandTotal = number_format(($grandTotal - $shippingPrice), 2); + } + \PHPUnit_Framework_Assert::assertNotEquals( + $subTotal, + $grandTotal, + 'Shopping cart subtotal: \'' . $subTotal . '\' equals with grand total: \'' . $grandTotal . '\'' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return "Shopping cart subtotal doesn't equal to grand total - price rule has been applied."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsNotApplied.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsNotApplied.php new file mode 100644 index 0000000000000000000000000000000000000000..b1c0efdbff284fe2b9e48a8ceab0f85a9afa77f8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleConditionIsNotApplied.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +/** + * Check that shopping cart subtotal equals with grand total (excluding shipping price if exist). + */ +class AssertCartPriceRuleConditionIsNotApplied extends AssertCartPriceRuleApplying +{ + /** + * Assert that shopping cart subtotal equals with grand total. + * + * @return void + */ + protected function assert() + { + $subTotal = $this->checkoutCart->getTotalsBlock()->getSubtotal(); + $grandTotal = $this->checkoutCart->getTotalsBlock()->getGrandTotal(); + + if ($this->checkoutCart->getTotalsBlock()->isVisibleShippingPriceBlock()) { + $shippingPrice = $this->checkoutCart->getTotalsBlock()->getShippingPrice(); + $grandTotal = number_format(($grandTotal - $shippingPrice), 2); + } + \PHPUnit_Framework_Assert::assertEquals( + $subTotal, + $grandTotal, + 'Shopping cart subtotal: \'' . $subTotal . '\' not equals with grand total: \'' . $grandTotal . '\'' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return "Shopping cart subtotal equals to grand total - price rule has not been applied."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php new file mode 100644 index 0000000000000000000000000000000000000000..ccd77f877ced270b43d7bcc9f2081422676f0b58 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleForm.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteEdit; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert sales rule form. + */ +class AssertCartPriceRuleForm extends AbstractConstraint +{ + /** + * Skipped fields for verify data. + * + * @var array + */ + protected $skippedFields = [ + 'conditions_serialized', + 'actions_serialized', + 'from_date', + 'to_date', + 'id' + ]; + + /** + * Assert that displayed sales rule data on edit page(backend) equals passed from fixture. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteEdit $promoQuoteEdit + * @param SalesRuleInjectable $salesRule + * @param SalesRuleInjectable $salesRuleOrigin + * @return void + */ + public function processAssert( + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteEdit $promoQuoteEdit, + SalesRuleInjectable $salesRule, + SalesRuleInjectable $salesRuleOrigin = null + ) { + $filter = [ + 'name' => $salesRule->hasData('name') ? $salesRule->getName() : $salesRuleOrigin->getName(), + ]; + + $promoQuoteIndex->open(); + $promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter); + $formData = $promoQuoteEdit->getSalesRuleForm()->getData(); + $fixtureData = $salesRuleOrigin != null + ? array_merge($salesRuleOrigin->getData(), $salesRule->getData()) + : $salesRule->getData(); + $dataDiff = $this->verify($fixtureData, $formData); + \PHPUnit_Framework_Assert::assertTrue( + empty($dataDiff), + 'Sales rule data on edit page(backend) not equals to passed from fixture.' + . "\nFailed values:\n " . implode(";\n ", $dataDiff) + ); + } + + /** + * Verify data in form equals to passed from fixture. + * + * @param array $fixtureData + * @param array $formData + * @return array + */ + protected function verify(array $fixtureData, array $formData) + { + $errorMessage = []; + + foreach ($fixtureData as $key => $value) { + if (is_array($value)) { + $diff = array_diff($value, $formData[$key]); + $diff = array_merge($diff, array_diff($formData[$key], $value)); + if (!empty($diff)) { + $errorMessage[] = "Data in " . $key . " field is not equal." + . "\nExpected: " . implode(", ", $value) + . "\nActual: " . implode(", ", $formData[$key]); + } + } else { + if (!in_array($key, $this->skippedFields) && $value !== $formData[$key]) { + $errorMessage[] = "Data in " . $key . " field not equal." + . "\nExpected: " . $value + . "\nActual: " . $formData[$key]; + } + } + } + + return $errorMessage; + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Displayed sales rule data on edit page(backend) equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleFreeShippingIsApplied.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleFreeShippingIsApplied.php new file mode 100644 index 0000000000000000000000000000000000000000..92814e0453ba21253a61e4d22b288a8ac8b418d5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleFreeShippingIsApplied.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +/** + * Check that shopping cart free shipping is applied. + */ +class AssertCartPriceRuleFreeShippingIsApplied extends AssertCartPriceRuleApplying +{ + const FREE_SHIPPING_PRICE = '0.00'; + + /** + * Assert that free shipping is applied in shopping cart. + * + * @return void + */ + protected function assert() + { + $shippingPrice = $this->checkoutCart->getTotalsBlock()->getShippingPrice(); + + \PHPUnit_Framework_Assert::assertEquals( + $shippingPrice, + self::FREE_SHIPPING_PRICE, + 'Current shipping price: \'' . $shippingPrice + . '\' not equals with free shipping price: \'' . self::FREE_SHIPPING_PRICE . '\'' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Free shipping is applied.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleIsNotPresentedInGrid.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleIsNotPresentedInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..4c2fd8856a08fdd1af69c5594124fef9443166f4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleIsNotPresentedInGrid.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert if sales rule is absent in grid. + */ +class AssertCartPriceRuleIsNotPresentedInGrid extends AbstractConstraint +{ + /** + * Assert that sales rule is not present in cart price rules grid. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @param SalesRuleInjectable $salesRule + * @return void + */ + public function processAssert(PromoQuoteIndex $promoQuoteIndex, SalesRuleInjectable $salesRule) + { + \PHPUnit_Framework_Assert::assertFalse( + $promoQuoteIndex->getPromoQuoteGrid()->isRowVisible(['name' => $salesRule->getName()]), + 'Sales rule \'' . $salesRule->getName() . '\' is present in cart price rules grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Sales rule is not present in cart price rules grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..4c507b9605f409dbf1132308e66021b54ee994e3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessDeleteMessage.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert sales rule delte message. + */ +class AssertCartPriceRuleSuccessDeleteMessage extends AbstractConstraint +{ + /* tags */ + const SEVERITY = 'low'; + /* end tags */ + + const SUCCESS_DELETE_MESSAGE = 'The rule has been deleted.'; + + /** + * Assert that success message is displayed after sales rule delete. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @return void + */ + public function processAssert(PromoQuoteIndex $promoQuoteIndex) + { + $actualMessage = $promoQuoteIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Sales rule success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessSaveMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..409498a592682a5890945a2a9d979c631502f762 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertCartPriceRuleSuccessSaveMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert sales rule save message. + */ +class AssertCartPriceRuleSuccessSaveMessage extends AbstractConstraint +{ + const SUCCESS_MESSAGE = 'The rule has been saved.'; + + /** + * Assert that success message is displayed after sales rule save. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @return void + */ + public function processAssert(PromoQuoteIndex $promoQuoteIndex) + { + $actualMessage = $promoQuoteIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Sales rule success save message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertSalesRuleOnPrintOrder.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertSalesRuleOnPrintOrder.php new file mode 100644 index 0000000000000000000000000000000000000000..6c2afcd79bdc35b145038c8cd5311a3625c06e70 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Constraint/AssertSalesRuleOnPrintOrder.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Constraint; + +use Magento\Sales\Test\Page\SalesGuestPrint; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that sales rule amount printed correctly on sales guest print page. + */ +class AssertSalesRuleOnPrintOrder extends AbstractConstraint +{ + /** + * Assert that sales rule amount printed correctly on sales guest print page. + * + * @param SalesGuestPrint $salesGuestPrint + * @param string $salesRuleDiscount + * @return void + */ + public function processAssert(SalesGuestPrint $salesGuestPrint, $salesRuleDiscount) + { + \PHPUnit_Framework_Assert::assertEquals( + $salesRuleDiscount, + $salesGuestPrint->getViewSalesRule()->getItemBlock()->getSalesRuleDiscount(), + "Sales rule amount not equals." + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Sales rule amount was printed correctly."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable.xml new file mode 100644 index 0000000000000000000000000000000000000000..25f432794e8432456a08e315988cfe84f60525fb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="salesRuleInjectable" module="Magento_SalesRule" type="flat" entity_type="salesrule" collection="Magento\SalesRule\Model\Resource\Rule\Collection" repository_class="Magento\SalesRule\Test\Repository\SalesRuleInjectable" handler_interface="Magento\SalesRule\Test\Handler\SalesRuleInjectable\SalesRuleInjectableInterface" class="Magento\SalesRule\Test\Fixture\SalesRuleInjectable"> + <dataset name="default"> + <field name="name" xsi:type="string">Default price rule %isolation%</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + <item name="2" xsi:type="string">Wholesale</item> + <item name="3" xsi:type="string">Retailer</item> + </field> + <field name="coupon_type" xsi:type="string">No Coupon</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + </dataset> + <field name="rule_id" is_required="1" /> + <field name="name" group="rule_information"> + <default_value xsi:type="string">Default price rule %isolation%</default_value> + </field> + <field name="description" group="rule_information" /> + <field name="from_date" group="rule_information" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="to_date" group="rule_information" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="uses_per_customer" group="rule_information"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="is_active" group="rule_information"> + <default_value xsi:type="string">Active</default_value> + </field> + <field name="conditions_serialized" group="conditions" source="Magento\SalesRule\Test\Fixture\SalesRuleInjectable\ConditionsSerialized" /> + <field name="actions_serialized" group="actions" /> + <field name="stop_rules_processing" group="actions"> + <default_value xsi:type="string">1</default_value> + </field> + <field name="is_advanced"> + <default_value xsi:type="string">1</default_value> + </field> + <field name="product_ids" /> + <field name="sort_order" group="rule_information"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="simple_action" group="actions"> + <default_value xsi:type="string">Percent of product price discount</default_value> + </field> + <field name="discount_amount" group="actions"> + <default_value xsi:type="number">50</default_value> + </field> + <field name="discount_qty" group="actions" /> + <field name="discount_step" group="actions" /> + <field name="apply_to_shipping" group="actions"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="times_used"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="is_rss" group="rule_information"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="coupon_type" group="rule_information"> + <default_value xsi:type="string">No Coupon</default_value> + </field> + <field name="use_auto_generation" group="rule_information"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="uses_per_coupon" group="rule_information"> + <default_value xsi:type="number">0</default_value> + </field> + <field name="simple_free_shipping" group="actions" /> + <field name="id" /> + <field name="website_ids" group="rule_information"> + <default_value xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </default_value> + </field> + <field name="customer_group_ids" group="rule_information"> + <default_value xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + <item name="2" xsi:type="string">Wholesale</item> + <item name="3" xsi:type="string">Retailer</item> + </default_value> + </field> + <field name="store_labels" group="labels" /> + <field name="coupon_code" group="rule_information" /> + <field name="rule" /> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable/ConditionsSerialized.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable/ConditionsSerialized.php new file mode 100644 index 0000000000000000000000000000000000000000..4d9c65cff5333e179f7dc06f72f857f5da9baf54 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Fixture/SalesRuleInjectable/ConditionsSerialized.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Fixture\SalesRuleInjectable; + +use Magento\Mtf\Fixture\DataSource; + +/** + * Source for conditions serialized. + */ +class ConditionsSerialized extends DataSource +{ + /** + * Path to chooser grid class + * + * @var array + */ + protected $chooserGrid = []; + + /** + * Path to additional chooser grid class + * + * @var array + */ + protected $additionalChooserGrid = []; + + /** + * @constructor + * @param array $params + * @param string $data + */ + public function __construct(array $params, $data) + { + $this->chooserGrid = array_merge($this->chooserGrid, $this->additionalChooserGrid); + $this->params = $params; + foreach ($this->chooserGrid as $conditionsType => $chooserGrid) { + $data = preg_replace( + '#(' . preg_quote($conditionsType) . '\|.*?\|)([^\d].*?)#', + '${1}%' . $chooserGrid['class'] . '#' . $chooserGrid['field'] . '%${2}', + $data + ); + } + $this->data = $data; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/Curl.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/Curl.php new file mode 100644 index 0000000000000000000000000000000000000000..2543ccdf8197195b9cdbdc2bdb6444ef5903a784 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/Curl.php @@ -0,0 +1,195 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Handler\SalesRuleInjectable; + +use Magento\Backend\Test\Handler\Conditions; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Curl handler for creating sales rule. + */ +class Curl extends Conditions implements SalesRuleInjectableInterface +{ + /** + * Map of type parameter. + * + * @var array + */ + protected $mapTypeParams = [ + 'Subtotal' => [ + 'type' => 'Magento\SalesRule\Model\Rule\Condition\Address', + 'attribute' => 'base_subtotal', + ], + 'Conditions combination' => [ + 'type' => 'Magento\SalesRule\Model\Rule\Condition\Combine', + 'aggregator' => 'all', + 'value' => '1', + ], + 'Shipping Country' => [ + 'type' => 'Magento\SalesRule\Model\Rule\Condition\Address', + 'attribute' => 'country_id', + ], + 'Shipping Postcode' => [ + 'type' => 'Magento\SalesRule\Model\Rule\Condition\Address', + 'attribute' => 'postcode', + ], + 'Category' => [ + 'type' => 'Magento\SalesRule\Model\Rule\Condition\Product', + 'attribute' => 'category_ids', + ] + ]; + + /** + * Map of type additional parameter. + * + * @var array + */ + protected $additionalMapTypeParams = []; + + /** + * Mapping values for data. + * + * @var array + */ + protected $mappingData = [ + 'is_active' => [ + 'Active' => 1, + 'Inactive' => 0, + ], + 'coupon_type' => [ + 'No Coupon' => 1, + 'Specific Coupon' => 2, + 'Auto' => 3, + ], + 'is_rss' => [ + 'Yes' => 1, + 'No' => 2, + ], + 'simple_action' => [ + 'Percent of product price discount' => 'by_percent', + 'Fixed amount discount' => 'by_fixed', + 'Fixed amount discount for whole cart' => 'cart_fixed', + 'Buy X get Y free (discount amount is Y)' => 'buy_x_get_y', + ], + 'apply_to_shipping' => [ + 'Yes' => 1, + 'No' => 2, + ], + 'stop_rules_processing' => [ + 'Yes' => 1, + 'No' => 2, + ], + 'simple_free_shipping' => [ + 'No' => 0, + 'For matching items only' => 1, + 'For shipment with matching items' => 2, + ], + ]; + + /** + * Mapping values for Websites. + * + * @var array + */ + protected $websiteIds = [ + 'Main Website' => 1, + ]; + + /** + * Mapping values for customer group. + * + * @var array + */ + protected $customerIds = [ + 'NOT LOGGED IN' => 0, + 'General' => 1, + 'Wholesale' => 2, + 'Retailer' => 3, + ]; + + /** + * Post request for creating sales rule. + * + * @param FixtureInterface $fixture + * @return array + * @throws \Exception + */ + public function persist(FixtureInterface $fixture = null) + { + $this->mapTypeParams = array_merge($this->mapTypeParams, $this->additionalMapTypeParams); + $url = $_ENV['app_backend_url'] . 'sales_rule/promo_quote/save/'; + $data = $this->replaceMappingData($fixture->getData()); + $data['rule'] = []; + if (isset($data['conditions_serialized'])) { + $data['rule']['conditions'] = $this->prepareCondition($data['conditions_serialized']); + unset($data['conditions_serialized']); + } + + $data['website_ids'] = $this->prepareWebsites($data); + $data['customer_group_ids'] = $this->prepareCustomerGroup($data); + + if (isset($data['actions_serialized'])) { + $this->mapTypeParams['Conditions combination']['type'] = + 'Magento\SalesRule\Model\Rule\Condition\Product\Combine'; + $data['rule']['actions'] = $this->prepareCondition($data['actions_serialized']); + unset($data['actions_serialized']); + } + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + $curl->close(); + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Sales rule entity creating by curl handler was not successful! Response: $response"); + } + + preg_match('`<tr.*title=".*sales_rule\/promo_quote\/edit\/id\/([\d]+)`ims', $response, $matches); + if (empty($matches)) { + throw new \Exception('Cannot find Sales Rule id'); + } + + return ['id' => $matches[1]]; + } + + /** + * Prepare website data for curl. + * + * @param array $data + * @return array + */ + protected function prepareWebsites(array $data) + { + $websiteIds = []; + if (!empty($data['website_ids'])) { + foreach ($data['website_ids'] as $name) { + $websiteIds[] = isset($this->websiteIds[$name]) ? $this->websiteIds[$name] : $name; + } + } + + return $websiteIds; + } + + /** + * Prepare customer group data for curl. + * + * @param array $data + * @return array + */ + protected function prepareCustomerGroup(array $data) + { + $groupIds = []; + if (!empty($data['customer_group_ids'])) { + foreach ($data['customer_group_ids'] as $name) { + $groupIds[] = isset($this->customerIds[$name]) ? $this->customerIds[$name] : $name; + } + } + + return $groupIds; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/SalesRuleInjectableInterface.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/SalesRuleInjectableInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..0a9c2598e8c49b16841c1efd0fda60e4d1d1d248 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Handler/SalesRuleInjectable/SalesRuleInjectableInterface.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\Handler\SalesRuleInjectable; + +use Magento\Mtf\Handler\HandlerInterface; + +/** + * Interface SalesRuleInterface. + */ +interface SalesRuleInjectableInterface extends HandlerInterface +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteEdit.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteEdit.xml new file mode 100644 index 0000000000000000000000000000000000000000..23b3fe8d67b3aa5d93acb24f2f156893daff2730 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteEdit.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="PromoQuoteEdit" area="Adminhtml" mca="sales_rule/promo_quote/edit" module="Magento_SalesRule"> + <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="salesRuleForm" class="Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\PromoQuoteForm" locator="[id='page:main-container']" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteIndex.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteIndex.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c65c8a4ced63aff55114c7e1a47188d2539f65d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteIndex.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="PromoQuoteIndex" area="Adminhtml" mca="sales_rule/promo_quote/index" module="Magento_SalesRule"> + <block name="promoQuoteGrid" class="Magento\SalesRule\Test\Block\Adminhtml\Promo\Grid" locator="#promo_quote_grid" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" /> + <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="systemMessageDialog" class="Magento\AdminNotification\Test\Block\System\Messages" locator='[role="dialog"].ui-popup-message' strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteNew.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteNew.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b2fa68cfa4f2d53f2babbba07dc8a99fe829bc0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/Adminhtml/PromoQuoteNew.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="PromoQuoteNew" area="Adminhtml" mca="sales_rule/promo_quote/new" module="Magento_SalesRule"> + <block name="salesRuleForm" class="Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\PromoQuoteForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/SalesGuestPrint.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/SalesGuestPrint.xml new file mode 100644 index 0000000000000000000000000000000000000000..db17a5c1271975c0e2da482d7173f9d90e527724 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Page/SalesGuestPrint.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="SalesGuestPrint" mca="sales/guest/print"> + <block name="viewSalesRule" class="Magento\SalesRule\Test\Block\Order\View" locator=".order-details-items" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRuleInjectable.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRuleInjectable.xml new file mode 100644 index 0000000000000000000000000000000000000000..02d81f565a253de17ec04662a14bf162c330b256 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRuleInjectable.xml @@ -0,0 +1,176 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\SalesRule\Test\Repository\SalesRuleInjectable"> + <dataset name="active_sales_rule_with_percent_price_discount_coupon"> + <field name="name" xsi:type="string">Shopping Cart Price Rule with Specific Coupon %isolation%</field> + <field name="description" xsi:type="string">Description for Cart Price Rule</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + </field> + <field name="coupon_type" xsi:type="string">Specific Coupon</field> + <field name="coupon_code" xsi:type="string">123-abc-ABC-987-%isolation%</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + <field name="store_labels" xsi:type="array"> + <item name="0" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + <item name="1" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + </field> + </dataset> + + <dataset name="active_sales_rule_with_coupon_10"> + <field name="name" xsi:type="string">10% Off Coupon</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + </field> + <field name="coupon_type" xsi:type="string">Specific Coupon</field> + <field name="coupon_code" xsi:type="string">1234</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">10</field> + </dataset> + + <dataset name="active_sales_rule_with_fixed_price_discount_coupon"> + <field name="name" xsi:type="string">Shopping Cart Price Rule with Specific Coupon %isolation%</field> + <field name="description" xsi:type="string">Description for Cart Price Rule</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + </field> + <field name="coupon_type" xsi:type="string">Specific Coupon</field> + <field name="coupon_code" xsi:type="string">123-abc-ABC-987-%isolation%</field> + <field name="simple_action" xsi:type="string">Fixed amount discount</field> + <field name="discount_amount" xsi:type="string">50</field> + <field name="store_labels" xsi:type="array"> + <item name="0" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + <item name="1" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + </field> + </dataset> + + <dataset name="active_sales_rule_for_retailer"> + <field name="name" xsi:type="string">Shopping Cart Price Rule %isolation%</field> + <field name="description" xsi:type="string">Description for Cart Price Rule</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">Retailer</item> + </field> + <field name="coupon_type" xsi:type="string">No Coupon</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + <field name="stop_rules_processing" xsi:type="string">Yes</field> + </dataset> + + <dataset name="active_sales_rule_with_complex_conditions"> + <field name="name" xsi:type="string">Shopping Cart Price Rule with with complex conditions %isolation%</field> + <field name="description" xsi:type="string">Shopping Cart Price Rule with with complex conditions</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + <item name="2" xsi:type="string">Wholesale</item> + <item name="3" xsi:type="string">Retailer</item> + </field> + <field name="coupon_type" xsi:type="string">Specific Coupon</field> + <field name="coupon_code" xsi:type="string">123-abc-ABC-987-%isolation%</field> + <field name="uses_per_coupon" xsi:type="string">13</field> + <field name="uses_per_customer" xsi:type="string">63</field> + <field name="from_date" xsi:type="array"> + <item name="pattern" xsi:type="string">3/25/2014</item> + </field> + <field name="to_date" xsi:type="array"> + <item name="pattern" xsi:type="string">6/29/2024</item> + </field> + <field name="sort_order" xsi:type="string">1</field> + <field name="is_rss" xsi:type="string">Yes</field> + <field name="conditions_serialized" xsi:type="string">[Subtotal|is|300]{Conditions combination:[[Shipping Country|is|United States][Shipping Postcode|is|123456789a]]}</field> + <field name="actions_serialized" xsi:type="string">[Category|is|2]</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + <field name="discount_step" xsi:type="string">0</field> + <field name="apply_to_shipping" xsi:type="string">Yes</field> + <field name="stop_rules_processing" xsi:type="string">Yes</field> + <field name="simple_free_shipping" xsi:type="string">For matching items only</field> + <field name="store_labels" xsi:type="array"> + <item name="0" xsi:type="string">Shopping Cart Price Rule with with complex conditions</item> + <item name="1" xsi:type="string">Shopping Cart Price Rule with with complex conditions</item> + </field> + </dataset> + + <dataset name="inactive_sales_rule"> + <field name="name" xsi:type="string">Inactive Cart Price Rule %isolation%</field> + <field name="is_active" xsi:type="string">Inactive</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + </field> + <field name="coupon_type" xsi:type="string">No Coupon</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + </dataset> + + <dataset name="active_sales_rule_for_all_groups"> + <field name="name" xsi:type="string">Shopping Cart Price Rule with Specific Coupon %isolation%</field> + <field name="description" xsi:type="string">Description for Cart Price Rule</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + <item name="2" xsi:type="string">Wholesale</item> + <item name="3" xsi:type="string">Retailer</item> + </field> + <field name="coupon_type" xsi:type="string">Specific Coupon</field> + <field name="coupon_code" xsi:type="string">123-abc-ABC-987-%isolation%</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + <field name="store_labels" xsi:type="array"> + <item name="0" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + <item name="1" xsi:type="string">Shopping Cart price Rule with Specific Coupon</item> + </field> + </dataset> + + <dataset name="active_sales_rule_for_all_groups_no_coupon"> + <field name="name" xsi:type="string">Shopping Cart Price Rule with Specific Coupon %isolation%</field> + <field name="description" xsi:type="string">Description for Cart Price Rule</field> + <field name="is_active" xsi:type="string">Active</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="customer_group_ids" xsi:type="array"> + <item name="0" xsi:type="string">NOT LOGGED IN</item> + <item name="1" xsi:type="string">General</item> + <item name="2" xsi:type="string">Wholesale</item> + <item name="3" xsi:type="string">Retailer</item> + </field> + <field name="coupon_type" xsi:type="string">No Coupon</field> + <field name="simple_action" xsi:type="string">Percent of product price discount</field> + <field name="discount_amount" xsi:type="string">50</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..24bafea36fbe42b87673f83accf39b5a70ddc666 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.php @@ -0,0 +1,147 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestCase; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteEdit; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteNew; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Precondition: + * 1. 2 sub categories in Default Category are created. + * 2. 2 simple products are created and assigned to different subcategories by one for each. + * 3. Default customer are created. + * + * Steps: + * 1. Login to backend as admin. + * 2. Navigate to MARKETING > Cart Price Rule. + * 3. Create Cart Price rule according to dataset and click "Save" button. + * 4. Perform asserts. + * + * @group Shopping_Cart_Price_Rules_(CS) + * @ZephyrId MAGETWO-24855 + */ +class CreateSalesRuleEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Page PromoQuoteNew. + * + * @var PromoQuoteNew + */ + protected $promoQuoteNew; + + /** + * Page PromoQuoteEdit. + * + * @var PromoQuoteEdit + */ + protected $promoQuoteEdit; + + /** + * Page PromoQuoteIndex. + * + * @var PromoQuoteIndex + */ + protected $promoQuoteIndex; + + /** + * Sales rule name. + * + * @var string + */ + protected $salesRuleName; + + /** + * Inject pages. + * + * @param PromoQuoteNew $promoQuoteNew + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteEdit $promoQuoteEdit + * @return void + */ + public function __inject( + PromoQuoteNew $promoQuoteNew, + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteEdit $promoQuoteEdit + ) { + $this->promoQuoteNew = $promoQuoteNew; + $this->promoQuoteIndex = $promoQuoteIndex; + $this->promoQuoteEdit = $promoQuoteEdit; + } + + /** + * Create customer and 2 simple products with categories before run test. + * + * @param FixtureFactory $fixtureFactory + * @return array + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $customer = $fixtureFactory->createByCode('customer', ['dataSet' => 'default']); + $customer->persist(); + + $productForSalesRule1 = $fixtureFactory->createByCode( + 'catalogProductSimple', + ['dataSet' => 'simple_for_salesrule_1'] + ); + $productForSalesRule1->persist(); + + $productForSalesRule2 = $fixtureFactory->createByCode( + 'catalogProductSimple', + ['dataSet' => 'simple_for_salesrule_2'] + ); + $productForSalesRule2->persist(); + + return [ + 'customer' => $customer, + 'productForSalesRule1' => $productForSalesRule1, + 'productForSalesRule2' => $productForSalesRule2 + ]; + } + + /** + * Create Sales Rule Entity. + * + * @param SalesRuleInjectable $salesRule + * @return void + */ + public function testCreateSalesRule(SalesRuleInjectable $salesRule) + { + // Preconditions + $this->salesRuleName = $salesRule->getName(); + + // Steps + $this->promoQuoteNew->open(); + $this->promoQuoteNew->getSalesRuleForm()->fill($salesRule); + $this->promoQuoteNew->getFormPageActions()->save(); + } + + /** + * Delete current sales rule. + * + * @return void + */ + public function tearDown() + { + $filter = [ + 'name' => $this->salesRuleName, + ]; + + $this->promoQuoteIndex->open(); + $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter); + $this->promoQuoteEdit->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ff2064ad79fba1554e4e82552471a3c81422704 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml @@ -0,0 +1,264 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\SalesRule\Test\TestCase\CreateSalesRuleEntityTest"> + <variation name="CreateSalesRuleEntityTestVariation1"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule1 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Sales Cart Rule labels</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation2"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule2 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">Specific Coupon</data> + <data name="salesRule/data/coupon_code" xsi:type="string">1A2B3C-456-zxc-%isolation%</data> + <data name="salesRule/data/simple_action" xsi:type="string">Fixed amount discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">35</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Coupon code+fixed amount discount</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">2</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation3"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule3 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">Specific Coupon</data> + <data name="salesRule/data/coupon_code" xsi:type="string">Lorem ipsum dolor sit amet, consectetur adipiscing elit - %isolation%</data> + <data name="salesRule/data/simple_action" xsi:type="string">Fixed amount discount for whole cart</data> + <data name="salesRule/data/discount_amount" xsi:type="string">60</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Coupon code+Fixed amount discount for whole cart</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">3</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation4"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule4 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">Specific Coupon</data> + <data name="salesRule/data/coupon_code" xsi:type="string">1A2B3C-456-zxc-%isolation%</data> + <data name="salesRule/data/simple_action" xsi:type="string">Buy X get Y free (discount amount is Y)</data> + <data name="salesRule/data/discount_amount" xsi:type="string">1</data> + <data name="salesRule/data/discount_step" xsi:type="string">3</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Buy X get Y free</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">4</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation5"> + <data name="isLoggedIn" xsi:type="string">1</data> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule5 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">General</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/discount_qty" xsi:type="string">2</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">3</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation6"> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">95814</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule6 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">Yes</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Apply discount to Shipping Amount</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <data name="productQuantity/productForSalesRule2" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation7"> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">95814</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule7 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">For matching items only</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Free Shipping in conditions</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <data name="productQuantity/productForSalesRule2" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleFreeShippingIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation8"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule8 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">[Subtotal|is|150]</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Sales Cart Rule labels</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <data name="productQuantity/productForSalesRule2" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation9"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule9 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">[Subtotal|is|150]</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Subtotal Action-Condition test</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">2</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsNotApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation10"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule10 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">[Total Items Quantity|is|2]</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Total Items Quantity is 2</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">2</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation11"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule11 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">[Total Weight|is|150]</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Total Weight is 150</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <data name="productQuantity/productForSalesRule2" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation12"> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">95814</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule12 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">{Conditions combination:[[Shipping Method|is|\[flatrate\] Fixed][Shipping Postcode|is|95814][Shipping State/Province|is|California][Shipping Country|is|United States]]}</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Rule applied conditions combination</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <data name="productQuantity/productForSalesRule2" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + <variation name="CreateSalesRuleEntityTestVariation13"> + <data name="salesRule/data/name" xsi:type="string">Shopping Cart Price Rule13 %isolation%</data> + <data name="salesRule/data/description" xsi:type="string">Shopping Cart Price Rule Description %isolation%</data> + <data name="salesRule/data/is_active" xsi:type="string">Active</data> + <data name="salesRule/data/website_ids/website_0" xsi:type="string">Main Website</data> + <data name="salesRule/data/customer_group_ids/group_0" xsi:type="string">NOT LOGGED IN</data> + <data name="salesRule/data/coupon_type" xsi:type="string">No Coupon</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">{Product attribute combination:[Attribute Set|is|Default]}</data> + <data name="salesRule/data/simple_action" xsi:type="string">Percent of product price discount</data> + <data name="salesRule/data/discount_amount" xsi:type="string">50</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="salesRule/data/simple_free_shipping" xsi:type="string">No</data> + <data name="salesRule/data/store_labels/store_labels_0" xsi:type="string">Product attribute discount</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">1</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..49f3e7655790d8cf6ec4842d2861cc55692e5a72 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestCase; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteEdit; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Precondition: + * 1. Several Shopping Cart Price Rules are created. + * + * Steps: + * 1. Login to backend. + * 2. Navigate to MARKETING > Cart Price Rules. + * 3. Open from grid test Rule. + * 4. Click 'Delete' button. + * 5. Perform asserts. + * + * @group Shopping_Cart_Price_Rules_(CS) + * @ZephyrId MAGETWO-24985 + */ +class DeleteSalesRuleEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Page PromoQuoteEdit. + * + * @var PromoQuoteEdit + */ + protected $promoQuoteEdit; + + /** + * Page PromoQuoteIndex. + * + * @var PromoQuoteIndex + */ + protected $promoQuoteIndex; + + /** + * Inject pages. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteEdit $promoQuoteEdit + */ + public function __inject( + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteEdit $promoQuoteEdit + ) { + $this->promoQuoteIndex = $promoQuoteIndex; + $this->promoQuoteEdit = $promoQuoteEdit; + } + + /** + * Delete Sales Rule Entity. + * + * @param SalesRuleInjectable $salesRule + * @return void + */ + public function testDeleteSalesRule(SalesRuleInjectable $salesRule) + { + // Preconditions + $salesRule->persist(); + + // Steps + $this->promoQuoteIndex->open(); + $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen(['name' => $salesRule->getName()]); + $this->promoQuoteEdit->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2d76e09d87b8cdfb29e6b3b8b1ca4236a4a9a3dd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/DeleteSalesRuleEntityTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\SalesRule\Test\TestCase\DeleteSalesRuleEntityTest"> + <variation name="DeleteSalesRuleEntityTestVariation1"> + <data name="salesRule/dataSet" xsi:type="string">active_sales_rule_with_percent_price_discount_coupon</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessDeleteMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleIsNotPresentedInGrid" /> + </variation> + <variation name="DeleteSalesRuleEntityTestVariation2"> + <data name="salesRule/dataSet" xsi:type="string">active_sales_rule_with_complex_conditions</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessDeleteMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleIsNotPresentedInGrid" /> + </variation> + <variation name="DeleteSalesRuleEntityTestVariation3"> + <data name="salesRule/dataSet" xsi:type="string">inactive_sales_rule</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessDeleteMessage" /> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleIsNotPresentedInGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ed72d923f05b1911611a38244d9f5e2b79c5d669 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.php @@ -0,0 +1,132 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestCase; + +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteEdit; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Precondition: + * 1. Cart Price Rule is created. + * + * Steps: + * 1. Login to backend. + * 2. Navigate to MARKETING > Cart Price Rules. + * 3. Click Cart Price Rule from grid. + * 4. Edit test value(s) according to dataset. + * 5. Click 'Save' button. + * 6. Perform asserts. + * + * @group Shopping_Cart_Price_Rules_(CS) + * @ZephyrId MAGETWO-24860 + */ +class UpdateSalesRuleEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; + /* end tags */ + + /** + * Page PromoQuoteEdit. + * + * @var PromoQuoteEdit + */ + protected $promoQuoteEdit; + + /** + * Page PromoQuoteIndex. + * + * @var PromoQuoteIndex + */ + protected $promoQuoteIndex; + + /** + * Sales rule name. + * + * @var string + */ + protected $salesRuleName; + + /** + * Create simple product with category. + * + * @param FixtureFactory $fixtureFactory + * @return array + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $productForSalesRule1 = $fixtureFactory->createByCode( + 'catalogProductSimple', + ['dataSet' => 'simple_for_salesrule_1'] + ); + $productForSalesRule1->persist(); + return [ + 'productForSalesRule1' => $productForSalesRule1, + ]; + } + + /** + * Inject pages. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteEdit $promoQuoteEdit + * @return void + */ + public function __inject( + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteEdit $promoQuoteEdit + ) { + $this->promoQuoteIndex = $promoQuoteIndex; + $this->promoQuoteEdit = $promoQuoteEdit; + } + + /** + * Update Sales Rule Entity. + * + * @param SalesRuleInjectable $salesRule + * @param SalesRuleInjectable $salesRuleOrigin + * @return void + */ + public function testUpdateSalesRule( + SalesRuleInjectable $salesRule, + SalesRuleInjectable $salesRuleOrigin + ) { + // Preconditions + $salesRuleOrigin->persist(); + $filter = [ + 'name' => $salesRuleOrigin->getName(), + ]; + $this->salesRuleName = $salesRule->hasData('name') ? $salesRule->getName() : $salesRuleOrigin->getName(); + + // Steps + $this->promoQuoteIndex->open(); + $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter); + $this->promoQuoteEdit->getSalesRuleForm()->fill($salesRule); + $this->promoQuoteEdit->getFormPageActions()->save(); + } + + /** + * Delete current sales rule. + * + * @return void + */ + public function tearDown() + { + $filter = [ + 'name' => $this->salesRuleName, + ]; + + $this->promoQuoteIndex->open(); + $this->promoQuoteIndex->getPromoQuoteGrid()->searchAndOpen($filter); + $this->promoQuoteEdit->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f4f2c01eeccecd1c2ca4136cf63606d93f27d4ca --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/UpdateSalesRuleEntityTest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\SalesRule\Test\TestCase\UpdateSalesRuleEntityTest"> + <variation name="UpdateSalesRuleEntityTestVariation1"> + <data name="salesRuleOrigin/dataSet" xsi:type="string">active_sales_rule_with_complex_conditions</data> + <data name="salesRule/data/conditions_serialized" xsi:type="string">{Conditions combination:[[Shipping Method|is|\[flatrate\] Fixed][Shipping Postcode|is|95814][Shipping State/Province|is|California][Shipping Country|is|United States]]}</data> + <data name="salesRule/data/simple_action" xsi:type="string">Buy X get Y free (discount amount is Y)</data> + <data name="salesRule/data/discount_amount" xsi:type="string">1</data> + <data name="salesRule/data/discount_step" xsi:type="string">3</data> + <data name="salesRule/data/apply_to_shipping" xsi:type="string">No</data> + <data name="productQuantity/productForSalesRule1" xsi:type="string">4</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">95814</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleSuccessSaveMessage"/> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleForm"/> + <constraint name="Magento\SalesRule\Test\Constraint\AssertCartPriceRuleConditionIsApplied"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnBackendStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnBackendStep.php new file mode 100644 index 0000000000000000000000000000000000000000..7e193a4d0ab1cc570bbbebad6dedda8c57946c6d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnBackendStep.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestStep; + +use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Apply Sales Rule on backend. + */ +class ApplySalesRuleOnBackendStep implements TestStepInterface +{ + /** + * Order Create Index. + * + * @var OrderCreateIndex + */ + protected $orderCreateIndex; + + /** + * SalesRule fixture. + * + * @var SalesRuleInjectable + */ + protected $salesRule; + + /** + * @constructor + * @param OrderCreateIndex $orderCreateIndex + * @param SalesRuleInjectable $salesRule + */ + public function __construct(OrderCreateIndex $orderCreateIndex, SalesRuleInjectable $salesRule = null) + { + $this->orderCreateIndex = $orderCreateIndex; + $this->salesRule = $salesRule; + } + + /** + * Apply gift card before one page checkout. + * + * @return void + */ + public function run() + { + if ($this->salesRule !== null) { + $this->orderCreateIndex->getCouponsBlock()->applyCouponCode($this->salesRule); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php new file mode 100644 index 0000000000000000000000000000000000000000..6bff54ec11dee9b17a78f52478fff86e8652457d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestStep; + +use Magento\Checkout\Test\Page\CheckoutCart; +use Magento\SalesRule\Test\Fixture\SalesRuleInjectable; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Apply Sales Rule before one page checkout. + */ +class ApplySalesRuleOnFrontendStep implements TestStepInterface +{ + /** + * Checkout cart page. + * + * @var CheckoutCart + */ + protected $checkoutCart; + + /** + * SalesRule fixture. + * + * @var SalesRuleInjectable + */ + protected $salesRule; + + /** + * @constructor + * @param CheckoutCart $checkoutCart + * @param SalesRuleInjectable $salesRule + */ + public function __construct(CheckoutCart $checkoutCart, SalesRuleInjectable $salesRule = null) + { + $this->checkoutCart = $checkoutCart; + $this->salesRule = $salesRule; + } + + /** + * Apply coupon before one page checkout. + * + * @return void + */ + public function run() + { + if ($this->salesRule !== null) { + $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode()); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php new file mode 100644 index 0000000000000000000000000000000000000000..c458bed8659ad8e8b3d2d381a1601ecfade3e163 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestStep; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Creating sales rule. + */ +class CreateSalesRuleStep implements TestStepInterface +{ + /** + * Sales Rule coupon. + * + * @var string + */ + protected $salesRule; + + /** + * Factory for Fixture. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Preparing step properties. + * + * @constructor + * @param FixtureFactory $fixtureFactory + * @param string $salesRule + */ + public function __construct(FixtureFactory $fixtureFactory, $salesRule = null) + { + $this->fixtureFactory = $fixtureFactory; + $this->salesRule = $salesRule; + } + + /** + * Create sales rule. + * + * @return array + */ + public function run() + { + $result['salesRule'] = null; + if ($this->salesRule !== null) { + $salesRule = $this->fixtureFactory->createByCode( + 'salesRuleInjectable', + ['dataSet' => $this->salesRule] + ); + $salesRule->persist(); + $result['salesRule'] = $salesRule; + } + + return $result; + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/DeleteAllSalesRuleStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/DeleteAllSalesRuleStep.php new file mode 100644 index 0000000000000000000000000000000000000000..0141a0506fd6e926987234027c894c7462c01245 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/DeleteAllSalesRuleStep.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesRule\Test\TestStep; + +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteEdit; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Delete all Sales Rule on backend. + */ +class DeleteAllSalesRuleStep implements TestStepInterface +{ + /** + * Promo Quote index page. + * + * @var PromoQuoteIndex + */ + protected $promoQuoteIndex; + + /** + * Promo Quote edit page. + * + * @var PromoQuoteEdit + */ + protected $promoQuoteEdit; + + /** + * @construct + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteEdit $promoQuoteEdit + */ + public function __construct( + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteEdit $promoQuoteEdit + ) { + $this->promoQuoteIndex = $promoQuoteIndex; + $this->promoQuoteEdit = $promoQuoteEdit; + } + + /** + * Delete Sales Rule on backend. + * + * @return array + */ + public function run() + { + $this->promoQuoteIndex->open(); + while ($this->promoQuoteIndex->getPromoQuoteGrid()->isFirstRowVisible()) { + $this->promoQuoteIndex->getPromoQuoteGrid()->openFirstRow(); + $this->promoQuoteEdit->getFormPageActions()->delete(); + $this->promoQuoteIndex->getSystemMessageDialog()->closePopup(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/curl/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..2591249e9e02850c5123b9c66a0652a7bd5cfa00 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/curl/di.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="Magento\SalesRule\Test\Handler\SalesRuleInjectable\SalesRuleInjectableInterface" type="\Magento\SalesRule\Test\Handler\SalesRuleInjectable\Curl" /> +</config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml new file mode 100644 index 0000000000000000000000000000000000000000..ee5c69ad94715ea590bd880b56e73c54d815872e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> + <scenario name="OnePageCheckoutTest"> + <step name="createSalesRule" module="Magento_SalesRule" prev="estimateShippingAndTax" next="applySalesRuleOnFrontend"/> + <step name="applySalesRuleOnFrontend" module="Magento_SalesRule" prev="createSalesRule" next="proceedToCheckout"/> + </scenario> + <scenario name="ReorderOrderEntityTest"> + <step name="createSalesRule" module="Magento_SalesRule" next="applySalesRuleOnBackend"/> + <step name="applySalesRuleOnBackend" module="Magento_SalesRule" next="fillBillingAddress"/> + </scenario> + <scenario name="CreateOrderBackendTest"> + <step name="createSalesRule" module="Magento_SalesRule" next="applySalesRuleOnBackend"/> + <step name="applySalesRuleOnBackend" module="Magento_SalesRule" next="fillBillingAddress"/> + </scenario> + <scenario name="CreateOrderFromCustomerPageTest"> + <step name="createSalesRule" module="Magento_SalesRule" next="openCustomerOnBackend"/> + <step name="applySalesRuleOnBackend" module="Magento_SalesRule" next="fillBillingAddress"/> + </scenario> + <scenario name="PrintOrderFrontendGuestTest"> + <step name="createSalesRule" module="Magento_SalesRule" next="applySalesRuleOnBackend"/> + <step name="applySalesRuleOnBackend" module="Magento_SalesRule" next="fillBillingAddress"/> + </scenario> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..01c8abab19d6a8456a07e91145ce901957609c86 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Shipping\Test\Block\Adminhtml; + +use Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm; +use Magento\Shipping\Test\Block\Adminhtml\Form\Items; +use Magento\Shipping\Test\Block\Adminhtml\Order\Tracking; + +/** + * Shipment create form. + */ +class Form extends AbstractForm +{ + /** + * Items block css selector. + * + * @var string + */ + protected $items = '#ship_items_container'; + + /** + * Tracking block css selector. + * + * @var string + */ + protected $tracking = '#tracking_numbers_table'; + + /** + * Get items block. + * + * @return Items + */ + protected function getItemsBlock() + { + return $this->blockFactory->create( + 'Magento\Shipping\Test\Block\Adminhtml\Form\Items', + ['element' => $this->_rootElement->find($this->items)] + ); + } + + /** + * Get tracking block. + * + * @return Tracking + */ + protected function getTrackingBlock() + { + return $this->blockFactory->create( + 'Magento\Shipping\Test\Block\Adminhtml\Order\Tracking', + ['element' => $this->_rootElement->find($this->tracking)] + ); + } + + /** + * Fill form data. + * + * @param array $data + * @param array|null $products [optional] + * @return void + */ + public function fillData(array $data, $products = null) + { + $data = $this->prepareData($data); + if (isset($data['form_data'])) { + if (isset($data['form_data']['tracking'])) { + $this->getTrackingBlock()->fill($data['form_data']['tracking']); + unset($data['form_data']['tracking']); + } + $this->_fill($this->dataMapping($data['form_data'])); + } + if (isset($data['items_data']) && $products !== null) { + foreach ($products as $key => $product) { + $this->getItemsBlock()->getItemProductBlock($product)->fillProduct($data['items_data'][$key]); + } + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.xml b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.xml new file mode 100644 index 0000000000000000000000000000000000000000..7e75ac518b8e7a2e66c38e5d9798c220d281e39f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <wrapper>creditmemo</wrapper> + <fields> + <comment_text /> + <shipping_amount /> + <adjustment_positive /> + <adjustment_negative /> + <comment_customer_notify> + <input>checkbox</input> + </comment_customer_notify> + <send_email> + <input>checkbox</input> + </send_email> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php new file mode 100644 index 0000000000000000000000000000000000000000..64b61d1a5ef7bcf90f1bc0712c5101e16287d41c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Shipping\Test\Block\Adminhtml\Form; + +use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItemsNewBlock; +use Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product; +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Adminhtml items to ship block. + */ +class Items extends AbstractItemsNewBlock +{ + /** + * Get item product block. + * + * @param FixtureInterface $product + * @return Product + */ + public function getItemProductBlock(FixtureInterface $product) + { + $selector = sprintf($this->productItem, $product->getSku()); + return $this->blockFactory->create( + 'Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product', + ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.php new file mode 100644 index 0000000000000000000000000000000000000000..ea14abdae485087e28c4eb728e8273161fb426b7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Shipping\Test\Block\Adminhtml\Form\Items; + +/** + * Item product form on shipment items block. + */ +class Product extends \Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm\Product +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.xml b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.xml new file mode 100644 index 0000000000000000000000000000000000000000..c7fff42f107e3901ca16dc791b77a27194229976 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items/Product.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <fields> + <qty> + <selector>input.qty-item</selector> + </qty> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4391265ca5bb52050392431e47f82ae69c2fbd1c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Shipping\Test\TestCase; + +use Magento\Sales\Test\Fixture\OrderInjectable; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Enable payment method "Check/Money Order". + * 2. Enable shipping method one of "Flat Rate/Free Shipping". + * 3. Create order. + * + * Steps: + * 1. Go to Sales > Orders. + * 2. Select created order in the grid and open it. + * 3. Click 'Ship' button. + * 4. Fill data according to dataSet. + * 5. Click 'Submit Shipment' button. + * 6. Perform all asserts. + * + * @group Order_Management_(CS) + * @ZephyrId MAGETWO-28708 + */ +class CreateShipmentEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Set up configuration. + * + * @return void + */ + public function __prepare() + { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => "checkmo,flatrate"] + )->run(); + } + + /** + * Create shipment. + * + * @param OrderInjectable $order + * @param array $data + * @return array + */ + public function test(OrderInjectable $order, array $data) + { + // Preconditions + $order->persist(); + + // Steps + $createShipping = $this->objectManager->create( + 'Magento\Sales\Test\TestStep\CreateShipmentStep', + ['order' => $order, 'data' => $data] + ); + + return ['ids' => $createShipping->run()]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.xml b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..aeb61fe1fc158c20a7d238ef8487dd56417c255d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/TestCase/CreateShipmentEntityTest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Shipping\Test\TestCase\CreateShipmentEntityTest"> + <variation name="CreateShipmentEntityTestVariation1"> + <data name="description" xsi:type="string">shipment with tracking number</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default</data> + <data name="order/data/total_qty_ordered/0" xsi:type="string">1</data> + <data name="data/items_data/0/qty" xsi:type="string">-</data> + <data name="data/form_data/comment_text" xsi:type="string">comments for shipment</data> + <data name="data/form_data/tracking/0/carrier_code" xsi:type="string">Custom Value</data> + <data name="data/form_data/tracking/0/title" xsi:type="string">title</data> + <data name="data/form_data/tracking/0/number" xsi:type="string">199</data> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsTab" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsGrid" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentItems" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertNoShipButton" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipTotalQuantity" /> + </variation> + <variation name="CreateShipmentEntityTestVariation2"> + <data name="description" xsi:type="string">partial shipment</data> + <data name="order/dataSet" xsi:type="string">default</data> + <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::product_100_dollar</data> + <data name="order/data/total_qty_ordered/0" xsi:type="string">1</data> + <data name="data/items_data/0/qty" xsi:type="string">1</data> + <data name="data/form_data/comment_text" xsi:type="string">comments for shipment</data> + <data name="data/form_data/tracking/0/carrier_code" xsi:type="string">-</data> + <data name="data/form_data/tracking/0/title" xsi:type="string">-</data> + <data name="data/form_data/tracking/0/number" xsi:type="string">-</data> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsTab" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsGrid" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentItems" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipTotalQuantity" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php index 64ec7938f66cdaa860638795869c3e55997f3b49..227831ea819eae4d3844f1354e69a6dd8f79786e 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php @@ -10,8 +10,6 @@ use Magento\Checkout\Test\Fixture\Cart; use Magento\Customer\Test\Fixture\Customer; /** - * Test Flow: - * * Preconditions: * 1. Create customer and login to frontend * 2. Create products @@ -43,7 +41,6 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli */ public function test(Customer $customer, $products, $qty) { - $this->markTestIncomplete('Bug: MAGETWO-34757'); // Preconditions $customer->persist(); $this->loginCustomer($customer); @@ -71,11 +68,13 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli $productBlock = $this->wishlistIndex->getWishlistBlock()->getProductItemsBlock(); foreach ($products as $product) { $this->cmsIndex->getLinksBlock()->openLink("My Wish List"); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($qty != '-') { $productBlock->getItemProduct($product)->fillProduct(['qty' => $qty]); $this->wishlistIndex->getWishlistBlock()->clickUpdateWishlist(); } $productBlock->getItemProduct($product)->clickAddToCart(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if (!$this->wishlistIndex->getWishlistBlock()->isVisible()) { $this->catalogProductView->getViewBlock()->addToCart($product); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml index fe86f41997e58a8a52dbabf86db8742cbcf7c600..066996237682324629b01255adc02af4a05a67af 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml @@ -6,54 +6,59 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\AddProductsToCartFromCustomerWishlistOnFrontendTest"> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation1" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::product_100_dollar</data> - <data name="qty" xsi:type="string">2</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation2" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">catalogProductVirtual::product_50_dollar</data> - <data name="qty" xsi:type="string">1</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation3" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductVirtual::product_50_dollar,catalogProductSimple::default,catalogProductVirtual::product_50_dollar</data> - <data name="qty" xsi:type="string">-</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation4" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">groupedProduct::three_simple_products</data> - <data name="qty" xsi:type="string">-</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation5" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <data name="qty" xsi:type="string">-</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation6" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">configurableProduct::default</data> - <data name="qty" xsi:type="string">3</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation7" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <data name="qty" xsi:type="string">2</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation8" firstConstraint="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" method="test"> - <data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data> - <data name="qty" xsi:type="string">2</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\AddProductsToCartFromCustomerWishlistOnFrontendTest"> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation1"> + <data name="products" xsi:type="string">catalogProductSimple::product_100_dollar</data> + <data name="qty" xsi:type="string">2</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation2"> + <data name="products" xsi:type="string">catalogProductVirtual::product_50_dollar</data> + <data name="qty" xsi:type="string">1</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36215</data> + <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductVirtual::product_50_dollar,catalogProductSimple::default,catalogProductVirtual::product_50_dollar</data> + <data name="qty" xsi:type="string">-</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation4"> + <data name="products" xsi:type="string">groupedProduct::three_simple_products_default_qty</data> + <data name="qty" xsi:type="string">-</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation5"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36224</data> + <data name="products" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <data name="qty" xsi:type="string">-</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation6"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36224</data> + <data name="products" xsi:type="string">configurableProduct::default</data> + <data name="qty" xsi:type="string">3</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation7"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36224</data> + <data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <data name="qty" xsi:type="string">2</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="AddProductsToCartFromCustomerWishlistOnFrontendTestVariation8"> + <data name="issue" xsi:type="string">Bug: MAGETWO-36224</data> + <data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <data name="qty" xsi:type="string">2</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml index 3894fece0c5d382961acbf9d1c8cd52c88e46177..0c7a970f47d1b3d68bfc5295ef76dd55c8fcbc54 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml @@ -6,26 +6,26 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnBackendTest"> - <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation3" firstConstraint="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation4" firstConstraint="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation5" firstConstraint="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnBackendTest"> + <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation2"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation3"> + <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation4"> + <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnBackendTestVariation5"> + <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid" /> + </variation> + </testCase> </config> diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist index 391e1a7679b00c152b165b379be8bd5d9ea508bb..0d8fb591eb14454b4d3c46045e3606ab6e47dea3 100644 --- a/dev/tests/integration/etc/install-config-mysql.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.php.dist @@ -7,11 +7,11 @@ return [ 'db_host' => 'localhost', 'db_user' => 'root', - 'db_pass' => '', + 'db_password' => '', 'db_name' => 'magento_integration_tests', 'db_prefix' => '', 'backend_frontname' => 'backend', - 'admin_username' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, + 'admin_user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'admin_password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 'admin_email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 'admin_firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, diff --git a/dev/tests/integration/etc/install-config-mysql.travis.php.dist b/dev/tests/integration/etc/install-config-mysql.travis.php.dist index e91586f30315cc3503c109520869dfca388ac02d..a0e25fd80384beb21201843bca7e59a435a26c34 100644 --- a/dev/tests/integration/etc/install-config-mysql.travis.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.travis.php.dist @@ -7,11 +7,11 @@ return [ 'db_host' => '127.0.0.1', 'db_user' => 'travis', - 'db_pass' => '', + 'db_password' => '', 'db_name' => 'magento_integration_tests', 'db_prefix' => 'travis_', 'backend_frontname' => 'backend', - 'admin_username' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, + 'admin_user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'admin_password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 'admin_email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 'admin_firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 385e1a76b951607ec52a9ce1f6a8e383c2ae7952..d8aee09eb186a8a531ec1fb6f49790fc770d038d 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -174,7 +174,7 @@ class Application $installConfig = $this->getInstallConfig(); $host = $installConfig['db_host']; $user = $installConfig['db_user']; - $password = $installConfig['db_pass']; + $password = $installConfig['db_password']; $dbName = $installConfig['db_name']; } $this->_db = new Db\Mysql( @@ -371,12 +371,16 @@ class Application */ public function cleanup() { + $this->_ensureDirExists($this->installDir); + $this->_ensureDirExists($this->_configDir); + + $this->copyAppConfigFiles(); /** * @see \Magento\Setup\Mvc\Bootstrap\InitParamListener::BOOTSTRAP_PARAM */ $this->_shell->execute( - 'php -f %s uninstall --magento_init_params=%s', - [BP . '/setup/index.php', $this->getInitParamsQuery()] + 'php -f %s setup:uninstall -n --magento_init_params=%s', + [BP . '/bin/magento', $this->getInitParamsQuery()] ); } @@ -407,8 +411,8 @@ class Application // run install script $this->_shell->execute( - 'php -f %s install ' . implode(' ', array_keys($installParams)), - array_merge([BP . '/setup/index.php'], array_values($installParams)) + 'php -f %s setup:install ' . implode(' ', array_keys($installParams)), + array_merge([BP . '/bin/magento'], array_values($installParams)) ); // enable only specified list of caches diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php index 24f9e0bf8799f6f3e9e7a92eef545625cddf847a..c236ee4aa214ca8bf07112c729277d7aedd2f0db 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php @@ -16,7 +16,6 @@ class Configurator implements \Magento\Framework\ObjectManager\DynamicConfigInte { return [ 'preferences' => [ - 'Magento\Framework\Stdlib\Cookie' => 'Magento\TestFramework\Cookie', 'Magento\Framework\Stdlib\CookieManagerInterface' => 'Magento\TestFramework\CookieManager', ] ]; diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php index 8cebbc8f76dfcfe7677bb0c52a03950f3bdf9cac..e499e0d929ae159842558b2b45a4ece21bde8438 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php @@ -95,7 +95,6 @@ class ObjectManagerFactory extends \Magento\Framework\App\ObjectManagerFactory 'Magento\Framework\Stdlib\CookieManagerInterface' => 'Magento\TestFramework\CookieManager', 'Magento\Framework\ObjectManager\DynamicConfigInterface' => '\Magento\TestFramework\ObjectManager\Configurator', - 'Magento\Framework\Stdlib\Cookie' => 'Magento\TestFramework\Cookie', 'Magento\Framework\App\RequestInterface' => 'Magento\TestFramework\Request', 'Magento\Framework\App\Request\Http' => 'Magento\TestFramework\Request', 'Magento\Framework\App\ResponseInterface' => 'Magento\TestFramework\Response', diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index eb8ec06003ac4f24253b991563579c4818fe3335..96833ea6131be828d3511fcd39db17b0409c0d02 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php @@ -66,10 +66,10 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase /** * @return void */ - public function testLargeSizeException() + public function testLargeSizeFile() { $this->setExpectedException( - '\Magento\Framework\Exception\File\LargeSizeException', + '\Magento\Framework\Exception\LocalizedException', sprintf('The file you uploaded is larger than %s Megabytes allowed by server', $this->maxFileSizeInMb) ); $this->prepareEnv(); @@ -108,7 +108,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Framework\Exception\File\ValidatorException + * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Please specify the product's required option(s). * @return void */ @@ -131,7 +131,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase public function testInvalidateFile() { $this->setExpectedException( - '\Magento\Framework\Exception\File\ValidatorException', + '\Magento\Framework\Exception\LocalizedException', "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "Maximum allowed image size for 'MediaOption' is 2000x2000 px.\n" diff --git a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php index e9d78a0385a79b2f798f4fbb21ad8fc7b0881520..3591424ed146ec0e576106d5cd9bbb1203ffb7c2 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Module/Plugin/DbStatusValidatorTest.php @@ -15,7 +15,7 @@ class DbStatusValidatorTest extends \Magento\TestFramework\TestCase\AbstractCont /** * @magentoDbIsolation enabled * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please update your database + * @expectedExceptionMessage Please upgrade your database */ public function testValidationOutdatedDb() { diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php new file mode 100644 index 0000000000000000000000000000000000000000..0732a8e7916e7b6e9ca46a6a221a5dc56ea016b6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; +use Magento\Framework\View\LayoutInterface; + +class BrokenAction extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @param LayoutInterface $layout + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setLayout(LayoutInterface $layout) + { + return $this; + } + + /** + * @param string $action + * @throws LocalizedException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function initAction($action) + { + throw new LocalizedException(new Phrase('Init action problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with action problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php new file mode 100644 index 0000000000000000000000000000000000000000..b421b1f76d693fceff48282d953b097d552c233e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; + +class BrokenConstructor extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @throws LocalizedException + */ + public function __construct() + { + throw new LocalizedException(new Phrase('Construction problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with construction problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php new file mode 100644 index 0000000000000000000000000000000000000000..4673250a1cb08e29e0935e4f9dbf02c173a2e7c1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; +use Magento\Framework\View\LayoutInterface; + +class BrokenLayout extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @param LayoutInterface $layout + * @throws LocalizedException + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setLayout(LayoutInterface $layout) + { + throw new LocalizedException(new Phrase('Prepare layout problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with layout problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php new file mode 100644 index 0000000000000000000000000000000000000000..64d383ed99a249cd738ff1be87433ea241458f3e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View; + +use \Magento\Framework\App\State; + +class LayoutTestWithExceptions extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\View\Layout + */ + protected $layout; + + public function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $layoutFactory = $objectManager->get('Magento\Framework\View\LayoutFactory'); + $this->layout = $layoutFactory->create(); + $layoutElement = new \Magento\Framework\View\Layout\Element( + __DIR__ . '/_files/layout_with_exceptions/layout.xml', + 0, + true + ); + + $this->layout->setXml($layoutElement); + $objectManager->get('Magento\Framework\App\Cache\Type\Layout')->clean(); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Construction problem. + */ + public function testProcessWithExceptionsDeveloperMode() + { + $this->layout->generateElements(); + } + + /** + * @magentoAppIsolation enabled + */ + public function testProcessWithExceptions() + { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\State') + ->setMode(State::MODE_DEFAULT); + + $this->layout->generateElements(); + + $this->layout->addOutputElement('block.with.broken.constructor'); + $this->layout->addOutputElement('block.with.broken.layout'); + $this->layout->addOutputElement('block.with.broken.action'); + + $this->assertEmpty($this->layout->getOutput()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php index 2f43263c6989c9428586006bdd7c2a6dfa43f2ce..df662db1bd7af9e9b39ccca6ca0b0a963012bc26 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php @@ -104,6 +104,8 @@ class Layout 'cache' => $objectManager->get('Magento\Framework\App\Cache\Type\Layout'), 'readerContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Reader\ContextFactory'), 'generatorContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Generator\ContextFactory'), + 'appState' => $objectManager->get('Magento\Framework\App\State'), + 'logger' => $objectManager->get('Psr\Log\LoggerInterface'), ]; } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml new file mode 100644 index 0000000000000000000000000000000000000000..a52c0a6645cf38171cec6ded52f867f5ce5e5d37 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> + <body> + <referenceContainer name="root"> + <block class="Magento\Framework\View\Fixture\Block\BrokenConstructor" name="block.with.broken.constructor"/> + <block class="Magento\Framework\View\Fixture\Block\BrokenLayout" name="block.with.broken.layout"/> + <block class="Magento\Framework\View\Fixture\Block\BrokenAction" name="block.with.broken.action"> + <action method="initAction"> + <argument name="action" xsi:type="string">action</argument> + </action> + </block> + </referenceContainer> + </body> +</page> diff --git a/dev/tests/performance/config.php.dist b/dev/tests/performance/config.php.dist index 64c8f2f5c2ec30e6160500dc4b3a65d63b750ca3..e145b9768ffe2d8b6178edc2e718e0c8220d0770 100644 --- a/dev/tests/performance/config.php.dist +++ b/dev/tests/performance/config.php.dist @@ -16,14 +16,14 @@ return array( 'db_host' => 'localhost', 'db_name' => 'magento', 'db_user' => 'root', - 'db_pass' => '', + 'db_password' => '', 'use_secure' => '0', 'use_secure_admin' => '0', 'use_rewrites' => '0', 'admin_lastname' => 'Admin', 'admin_firstname' => 'Admin', 'admin_email' => 'admin@example.com', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => '123123q', 'admin_use_security_key' => '0', 'backend_frontname' => 'backend', diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index d3728db16b2fb43d6959c29772b3104c7a5d4647..d236858ef259a39473edec5fc8df71fdae81d41a 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -63,9 +63,9 @@ class Application \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Shell $shell ) { - $shellDir = $config->getApplicationBaseDir() . '/setup'; + $shellDir = $config->getApplicationBaseDir() . '/bin'; $this->_objectManager = $objectManager; - $this->_script = $this->_assertPath($shellDir . '/index.php'); + $this->_script = $this->_assertPath($shellDir . '/magento'); $this->_config = $config; $this->_shell = $shell; } @@ -130,7 +130,7 @@ class Application */ protected function _uninstall() { - $this->_shell->execute('php -f %s uninstall', [$this->_script]); + $this->_shell->execute('php -f %s setup:uninstall -n', [$this->_script]); $this->_isInstalled = false; $this->_fixtures = []; @@ -157,7 +157,7 @@ class Application // Populate install options with global options $baseUrl = 'http://' . $this->_config->getApplicationUrlHost() . $this->_config->getApplicationUrlPath(); $installOptions = array_merge($installOptions, ['base_url' => $baseUrl, 'base_url_secure' => $baseUrl]); - $installCmd = 'php -f %s install'; + $installCmd = 'php -f %s setup:install'; $installCmdArgs = [$this->_script]; foreach ($installOptions as $optionName => $optionValue) { $installCmd .= " --{$optionName}=%s"; diff --git a/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php b/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php index f0a6f141fad07c67e1da25ee39666e4c0bcc44da..bd01b881c6bb9bb427690147be710d7a21a1900f 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Performance/Config.php @@ -117,7 +117,7 @@ class Config } // Validate admin options data - $requiredAdminKeys = ['admin_username', 'admin_password', 'backend_frontname']; + $requiredAdminKeys = ['admin_user', 'admin_password', 'backend_frontname']; foreach ($requiredAdminKeys as $requiredKeyName) { if (empty($configData['application']['installation']['options'][$requiredKeyName])) { throw new \Magento\Framework\Exception\LocalizedException( @@ -278,7 +278,7 @@ class Config \Magento\TestFramework\Performance\Scenario::ARG_PATH => $this->getApplicationUrlPath(), \Magento\TestFramework\Performance\Scenario::ARG_BASEDIR => $this->getApplicationBaseDir(), \Magento\TestFramework\Performance\Scenario::ARG_BACKEND_FRONTNAME => $options['backend_frontname'], - \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_USERNAME => $options['admin_username'], + \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_USER => $options['admin_user'], \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_PASSWORD => $options['admin_password'], 'jmeter.save.saveservice.output_format' => 'xml', ]; diff --git a/dev/tests/performance/framework/Magento/TestFramework/Performance/Scenario.php b/dev/tests/performance/framework/Magento/TestFramework/Performance/Scenario.php index 8de697f07f641922b5c676589db8b1d6e754defd..ab19c64f5aebea70028fa971cd2b2c8a96995ee8 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Performance/Scenario.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Performance/Scenario.php @@ -24,7 +24,7 @@ class Scenario const ARG_BASEDIR = 'basedir'; - const ARG_ADMIN_USERNAME = 'admin_username'; + const ARG_ADMIN_USER = 'admin_user'; const ARG_ADMIN_PASSWORD = 'admin_password'; diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php index f6598461c8823a3e7bc721677b0532bb6c426471..1ae2bf1fbe1424a68c21aa0449f40fed380ebee7 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php @@ -49,7 +49,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $this->_fixtureDir = __DIR__ . '/Performance/_files'; $this->_fixtureConfigData = require $this->_fixtureDir . '/config_data.php'; - $this->_script = realpath($this->_fixtureDir . '/app_base_dir/setup/index.php'); + $this->_script = realpath($this->_fixtureDir . '/app_base_dir/bin/magento'); $this->_config = new \Magento\TestFramework\Performance\Config( $this->_fixtureConfigData, diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php index 7b2513aa5756a363d5c01953e33d2614a6829735..39685b58894125220e63fd532b39f5b0f54282ac 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/ConfigTest.php @@ -145,7 +145,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'option1' => 'value 1', 'option2' => 'value 2', 'backend_frontname' => 'backend', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => 'password1', ]; $this->assertEquals($expectedOptions, $this->_object->getInstallOptions()); @@ -174,7 +174,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Performance\Scenario::ARG_HOST => '127.0.0.1', \Magento\TestFramework\Performance\Scenario::ARG_PATH => '/', \Magento\TestFramework\Performance\Scenario::ARG_BACKEND_FRONTNAME => 'backend', - \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_USERNAME => 'admin', + \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_USER => 'admin', \Magento\TestFramework\Performance\Scenario::ARG_ADMIN_PASSWORD => 'password1', \Magento\TestFramework\Performance\Scenario::ARG_BASEDIR => $this->_getFixtureAppBaseDir(), 'arg1' => 'value 1', diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/setup/index.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/bin/magento old mode 100644 new mode 100755 similarity index 63% rename from dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/setup/index.php rename to dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/bin/magento index 05d5a3da741d1b858cb44e560f8d7943b3a37b61..977e41071374b98a96f51beca2295bccb6257f31 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/setup/index.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/app_base_dir/bin/magento @@ -1,7 +1,6 @@ +#!/usr/bin/env php <?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. - */ - -/* Magento console installer and uninstaller stub */ + */ \ No newline at end of file diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_dist/config.php.dist b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_dist/config.php.dist index 0cd631bf84000bc11af10f98f8c5323a8b9a4ffb..6db1c505bff49c76b7f1472e68c6f83022d73eb4 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_dist/config.php.dist +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_dist/config.php.dist @@ -11,7 +11,7 @@ return array( 'installation' => array( 'options' => array( 'backend_frontname' => 'backend', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => 'password1', ), ), diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php index 2b9ae184e4992ef733eea09018062572bf32aab3..463b896d34d68ed13d2a2b1dd7c1c70e1d8e9126 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php @@ -11,7 +11,7 @@ return [ 'installation' => [ 'options' => [ 'backend_frontname' => 'backend', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => 'password1', ], ], diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php.dist b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php.dist index 3683444b83ec9d789b85c0fb65de468d69470ea0..577aadcc45bac471f1262da433d3ae0decc30fd3 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php.dist +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/bootstrap/config_normal/config.php.dist @@ -11,7 +11,7 @@ return array( 'installation' => array( 'options' => array( 'backend_frontname' => 'backend', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => 'password1', ), ), diff --git a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/config_data.php b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/config_data.php index 71ccf65e663e82806a1a7ed62047427848b32367..eaa852c5e31a6ece36b932dfac4c552430aee3dd 100644 --- a/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/config_data.php +++ b/dev/tests/performance/framework/tests/unit/testsuite/Magento/Test/Performance/_files/config_data.php @@ -13,7 +13,7 @@ return [ 'option1' => 'value 1', 'option2' => 'value 2', 'backend_frontname' => 'backend', - 'admin_username' => 'admin', + 'admin_user' => 'admin', 'admin_password' => 'password1', ], ], diff --git a/dev/tests/performance/testsuite/backend.jmx b/dev/tests/performance/testsuite/backend.jmx index 676738bf52fca0704c7d0423b354fb8cc2677d68..fbf480529e8084e7895f66a1541972d697f9e046 100644 --- a/dev/tests/performance/testsuite/backend.jmx +++ b/dev/tests/performance/testsuite/backend.jmx @@ -25,9 +25,9 @@ <stringProp name="Argument.value">${__P(path,/)}${__P(backend_frontname,backend)}/</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="ADMIN_USERNAME" elementType="Argument"> - <stringProp name="Argument.name">ADMIN_USERNAME</stringProp> - <stringProp name="Argument.value">${__P(admin_username,admin)}</stringProp> + <elementProp name="ADMIN_USER" elementType="Argument"> + <stringProp name="Argument.name">ADMIN_USER</stringProp> + <stringProp name="Argument.value">${__P(admin_user,admin)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="ADMIN_PASSWORD" elementType="Argument"> diff --git a/dev/tests/performance/testsuite/checkout.jmx b/dev/tests/performance/testsuite/checkout.jmx index d456fecd95ab1f6b634fec4e1e95de92482da39c..5dda04cb25a9e0a66328da0833506d92c7f7a71a 100644 --- a/dev/tests/performance/testsuite/checkout.jmx +++ b/dev/tests/performance/testsuite/checkout.jmx @@ -45,9 +45,9 @@ <stringProp name="Argument.value">${__P(path,/)}${__P(backend_frontname,backend)}/</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="ADMIN_USERNAME" elementType="Argument"> - <stringProp name="Argument.name">ADMIN_USERNAME</stringProp> - <stringProp name="Argument.value">${__P(admin_username,admin)}</stringProp> + <elementProp name="ADMIN_USER" elementType="Argument"> + <stringProp name="Argument.name">ADMIN_USER</stringProp> + <stringProp name="Argument.value">${__P(admin_user,admin)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="ADMIN_PASSWORD" elementType="Argument"> diff --git a/dev/tests/performance/testsuite/product_edit.jmx b/dev/tests/performance/testsuite/product_edit.jmx index 67fb78717f44d4004e5a090a50f44c97f26b4403..199c36235c16396d48dcfed93ed116ec14dd5b72 100644 --- a/dev/tests/performance/testsuite/product_edit.jmx +++ b/dev/tests/performance/testsuite/product_edit.jmx @@ -35,9 +35,9 @@ <stringProp name="Argument.value">${__P(loops,1)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="ADMIN_USERNAME" elementType="Argument"> - <stringProp name="Argument.name">ADMIN_USERNAME</stringProp> - <stringProp name="Argument.value">${__P(admin_username,admin)}</stringProp> + <elementProp name="ADMIN_USER" elementType="Argument"> + <stringProp name="Argument.name">ADMIN_USER</stringProp> + <stringProp name="Argument.value">${__P(admin_user,admin)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="ADMIN_PASSWORD" elementType="Argument"> diff --git a/dev/tests/performance/testsuite/reusable/admin_login.jmx b/dev/tests/performance/testsuite/reusable/admin_login.jmx index 96d8b96335ba6781c68e07645844f0665bc4e80a..6d271217d8989d6d97eb0aaf52f9627c5ddcb9f8 100644 --- a/dev/tests/performance/testsuite/reusable/admin_login.jmx +++ b/dev/tests/performance/testsuite/reusable/admin_login.jmx @@ -10,7 +10,7 @@ <jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9 r1437961"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Admin - Login" enabled="true"> - <stringProp name="TestPlan.comments">Reusable scenario to log-in to admin backend. Needs: HOST, ADMIN_PATH, ADMIN_USERNAME, ADMIN_PASSWORD, Http Cookie Manager</stringProp> + <stringProp name="TestPlan.comments">Reusable scenario to log-in to admin backend. Needs: HOST, ADMIN_PATH, ADMIN_USER, ADMIN_PASSWORD, Http Cookie Manager</stringProp> <boolProp name="TestPlan.functional_mode">false</boolProp> <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> @@ -77,7 +77,7 @@ <collectionProp name="Arguments.arguments"> <elementProp name="login[username]" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">${ADMIN_USERNAME}</stringProp> + <stringProp name="Argument.value">${ADMIN_USER}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">login[username]</stringProp> @@ -110,7 +110,7 @@ <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert logged-in" enabled="true"> <collectionProp name="Asserion.test_strings"> - <stringProp name="934841248">${ADMIN_USERNAME}</stringProp> + <stringProp name="934841248">${ADMIN_USER}</stringProp> <stringProp name="-989788387">Account Setting</stringProp> <stringProp name="374398571">Sign Out</stringProp> </collectionProp> @@ -162,9 +162,9 @@ <stringProp name="Argument.value">${__P(path,/)}${__P(backend_frontname,backend)}/</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> - <elementProp name="ADMIN_USERNAME" elementType="Argument"> - <stringProp name="Argument.name">ADMIN_USERNAME</stringProp> - <stringProp name="Argument.value">${__P(admin_username,admin)}</stringProp> + <elementProp name="ADMIN_USER" elementType="Argument"> + <stringProp name="Argument.name">ADMIN_USER</stringProp> + <stringProp name="Argument.value">${__P(admin_user,admin)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="ADMIN_PASSWORD" elementType="Argument"> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index 0d5d3848cfe6a4cc34ec66e67c47b5dbe432755f..b190aee7f88acc5bd18af6e1f986472dd6c35627 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -69,7 +69,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase $this->_assertClassesExist($classes, $file); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } @@ -530,29 +530,11 @@ class ClassesTest extends \PHPUnit_Framework_TestCase { $files = \Magento\Framework\App\Utility\Files::init(); $errors = []; - $fileList = $files->getFiles( - [ - BP . '/dev/tests/integration', - BP . '/app/code/*/*/Test/Unit', - BP . '/lib/internal/*/*/*/Test/Unit', - BP . '/lib/internal/Magento/Framework/Test/Unit', - BP . '/dev/tools/Magento/Tools/*/Test/Unit', - BP . '/setup/src/Magento/Setup/Test/Unit', - ], - '*.php' - ); - foreach ($fileList as $file) { + foreach ($files->getFiles([BP . '/dev/tests/{integration,unit}'], '*') as $file) { $code = file_get_contents($file); - if (preg_match_all( - '/@covers(DefaultClass)?\s+([\w\\\\]+)(::([\w\\\\]+))?/', - $code, - $matchesAll, - PREG_SET_ORDER - )) { - foreach ($matchesAll as $matches) { - if ($this->isNonexistentEntityCovered($matches)) { - $errors[] = $file . ': ' . $matches[0]; - } + if (preg_match('/@covers(DefaultClass)?\s+([\w\\\\]+)(::([\w\\\\]+))?/', $code, $matches)) { + if ($this->isNonexistentEntityCovered($matches)) { + $errors[] = $file . ': ' . $matches[0]; } } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index 8ed450ec926d9b46f33524ecb020ea74f99288e5..834e90911948bcba3d3ecc1a6dd945fbd9ef8988 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -428,7 +428,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $files, $this->_prepareFiles( 'php', - \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, true), + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, true, false), true ) ); @@ -490,7 +490,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $pattern = '/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)\/Controller\/' . '(?<path>[\/\w]*).php/'; - $files = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false); + $files = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false, false); foreach ($files as $file) { if (preg_match($pattern, $file, $matches)) { $module = $matches['namespace'] . '\\' . $matches['module']; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b7fb0b8ae7a94fac791f68ba00a147f6bf138776 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Test\Integrity; + +use Magento\Framework\App\Utility\Files as UtilityFiles; + +/** + * Checks that all Exceptions inherit LocalizedException + */ +class ExceptionHierarchyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param \ReflectionClass $reflectionException + * @dataProvider isInheritedLocalizedExceptionDataProvider + */ + public function testIsInheritedLocalizedException(\ReflectionClass $reflectionException) + { + $this->assertTrue( + $reflectionException->isSubclassOf('Magento\Framework\Exception\LocalizedException'), + "{$reflectionException->name} is not inherited LocalizedException" + ); + } + + /** + * @return array + */ + public function isInheritedLocalizedExceptionDataProvider() + { + $files = UtilityFiles::init()->getClassFiles(true, false, false, true, false); + $blacklistExceptions = $this->getBlacklistExceptions(); + + $data = []; + foreach ($files as $file) { + $className = $this->convertPathToClassName($file); + try { + $reflectionClass = new \ReflectionClass($className); + if ($reflectionClass->isSubclassOf('Exception') && !in_array($className, $blacklistExceptions)) { + $data[$className] = [$reflectionClass]; + } + } catch (\Exception $e) { + $this->fail("File name and class name '{$className}' is not appropriate"); + } + } + return $data; + } + + /** + * @param string $filePath + * @return string + */ + protected function convertPathToClassName($filePath) + { + $className = str_replace('.php', "", substr($filePath, strpos($filePath, '/Magento'))); + $className = implode("\\", explode("/", $className)); + return $className; + } + + /** + * @return array + */ + protected function getBlacklistExceptions() + { + $blacklistFiles = str_replace('\\', '/', realpath(__DIR__)) . '/_files/blacklist/exception_hierarchy*.txt'; + $exceptions = []; + foreach (glob($blacklistFiles) as $fileName) { + $exceptions = array_merge($exceptions, file($fileName, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)); + } + return $exceptions; + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php index ea2765ce171036f64a88335bd242ad4ff7bdbea4..16c026a76a57eba3b88e91c1acac28b2bdf85d39 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php @@ -7,6 +7,8 @@ */ namespace Magento\Test\Integrity\Layout; +use Magento\Framework\App\Utility\Files; + class BlocksTest extends \PHPUnit_Framework_TestCase { /** @@ -24,7 +26,7 @@ class BlocksTest extends \PHPUnit_Framework_TestCase */ public static function setUpBeforeClass() { - foreach (\Magento\Framework\App\Utility\Files::init()->getLayoutFiles([], false) as $file) { + foreach (Files::init()->getLayoutFiles([], false) as $file) { $xml = simplexml_load_file($file); $elements = $xml->xpath('/layout//*[self::container or self::block]') ?: []; /** @var $node \SimpleXMLElement */ @@ -94,7 +96,7 @@ class BlocksTest extends \PHPUnit_Framework_TestCase public function getChildBlockDataProvider() { $result = []; - foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, true, false) as $file) { + foreach (Files::init()->getPhpFiles(true, false, true, false, false) as $file) { $aliases = \Magento\Framework\App\Utility\Classes::getAllMatches( file_get_contents($file), '/\->getChildBlock\(\'([^\']+)\'\)/x' diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php index 3f6f7bfc288ee5b93346a83c38095c467e60604c..8d6cfb9d34ced8af8e26a9f4dfab7a415ab610fa 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php @@ -85,7 +85,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase ); } }, - $files->getPhpFiles(false, true, false) + $files->getPhpFiles(false, true, false, true, false) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt new file mode 100644 index 0000000000000000000000000000000000000000..068e1ea553cbddd2adc20851f582c3188be8fda6 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt @@ -0,0 +1,4 @@ +\Magento\Framework\Exception\LocalizedException +\Magento\Framework\View\Asset\File\NotFoundException +\Magento\Framework\Config\Dom\ValidationException +\Magento\Framework\Gdata\Gshopping\HttpException diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php index 69688b876fff576a26792afe985d4c246b04e8b5..593dd9d1c16bc91581c77c4362c4f384e970e8f6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php @@ -22,7 +22,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses(file_get_contents($file)); $this->_assertNonFactoryName($classes, $file); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php index c1c8f263120d80a785bae0f27d3d3b4fbfe1e60d..6e99ef361a84dc2a1d2818e7f1a015f77d951639 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php @@ -32,7 +32,7 @@ class TableTest extends \PHPUnit_Framework_TestCase $message = $this->_composeFoundsMessage($legacyTables); $this->assertEmpty($message, $message); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php old mode 100644 new mode 100755 index 5087bd50216f4b22bcea2db7700716403ca29245..57cd1b6a4c81734430ee2dca24c68aa4ff61b623 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3126,6 +3126,11 @@ return [ ['Magento\Framework\App\DeploymentConfig\CacheConfig'], ['Magento\Setup\Model\DeploymentConfigMapper'], ['Magento\Framework\App\DeploymentConfig\EncryptConfig'], + ['Magento\Framework\Filesystem\Io\IoException'], + ['Magento\Framework\DB\DBException'], + ['Magento\Framework\DB\Tree\TreeException'], + ['Magento\Framework\DB\Tree\Node\NodeException'], + ['Magento\Framework\DB\Tree\NodeSet\NodeSetException'], ['Magento\Backup\Exception'], ['Magento\Catalog\Exception'], ['Magento\Reports\Exception'], @@ -3146,4 +3151,14 @@ return [ ['Magento\CatalogRule\CatalogRuleException'], ['Magento\Payment\Exception'], ['Magento\UrlRewrite\Model\Storage\DuplicateEntryException'], + ['Magento\Setup\Mvc\Console\RouteListener'], + ['Magento\Setup\Mvc\Console\RouteMatcher'], + ['Magento\Setup\Mvc\Console\VerboseValidator'], + ['Magento\Setup\Controller\ConsoleController'], + ['Magento\Setup\Model\UserConfigurationDataMapper', 'Magento\Setup\Model\StoreConfigurationDataMapper'], + ['Magento\Framework\App\State\Cleanup', 'Magento\Framework\App\State\CleanupFiles'], + ['Magento\Eav\Exception'], + ['Magento\Framework\Exception\File\ValidatorException'], + ['Magento\Framework\Filesystem\FilesystemException', 'Magento\Framework\Exception\FileSystemException'], + ['Magento\Shipping\Exception'], ]; diff --git a/dev/tools/Magento/Tools/Migration/factory_names.php b/dev/tools/Magento/Tools/Migration/factory_names.php index 9e17d616dbe8eeea9c9c7f7c2246ab46507f6b77..96b3dbe8c1b2ed15ca957706b2e1fb6159cc4306 100644 --- a/dev/tools/Magento/Tools/Migration/factory_names.php +++ b/dev/tools/Magento/Tools/Migration/factory_names.php @@ -8,7 +8,7 @@ require realpath(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) . '/dev/tests/static/framework/bootstrap.php'; // PHP code -foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, false) as $file) { +foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, false, false) as $file) { $content = file_get_contents($file); $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses($content); $factoryNames = array_filter($classes, 'isFactoryName'); diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names.php b/dev/tools/Magento/Tools/Migration/factory_table_names.php index f38c8a35c724b07349d98a5b7e63b5b6cded5eac..6dfaa0a8e22fde0b3778387594b800a9d47e316d 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names.php @@ -32,7 +32,7 @@ require realpath(dirname(dirname(dirname(__DIR__)))) . '/dev/tests/static/framew $tablesAssociation = getFilesCombinedArray(__DIR__ . '/FactoryTableNames', 'replace_*.php'); $blackList = getFilesCombinedArray(__DIR__ . '/FactoryTableNames', 'blacklist_*.php'); -$phpFiles = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false); +$phpFiles = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false, false); $replacementResult = false; if (!$isSearchTables || $isDryRunMode) { diff --git a/dev/tools/Magento/Tools/Migration/get_aliases_map.php b/dev/tools/Magento/Tools/Migration/get_aliases_map.php index 0db788c57f8900322e3de7c1d75c770c319717d6..d1abe748f9204b671afa01cb8fd07e8100f9b3bb 100644 --- a/dev/tools/Magento/Tools/Migration/get_aliases_map.php +++ b/dev/tools/Magento/Tools/Migration/get_aliases_map.php @@ -39,7 +39,7 @@ $utilityFiles = new Magento\Framework\App\Utility\Files($magentoBaseDir); $map = []; $compositeModules = getFilesCombinedArray(__DIR__ . '/aliases_map', '/^composite_modules_.*\.php$/'); // PHP code -foreach ($utilityFiles->getPhpFiles(true, true, true, false) as $file) { +foreach ($utilityFiles->getPhpFiles(true, true, true, false, false) as $file) { $content = file_get_contents($file); $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses($content); if ($classes) { diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index 2099ee76e92d7d14fdbf45bca1f4b20a61d48b45..aaf238eadacaa007b8a7abe560095b6125d99c40 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -274,11 +274,11 @@ class Bootstrap $isOn = $this->maintenance->isOn(isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''); if ($isOn && !$isExpected) { $this->errorCode = self::ERR_MAINTENANCE; - throw new \Exception('Unable to proceed: the maintenance mode is enabled.'); + throw new \Exception('Unable to proceed: the maintenance mode is enabled. '); } if (!$isOn && $isExpected) { $this->errorCode = self::ERR_MAINTENANCE; - throw new \Exception('Unable to proceed: the maintenance mode must be enabled first.'); + throw new \Exception('Unable to proceed: the maintenance mode must be enabled first. '); } } @@ -298,11 +298,11 @@ class Bootstrap $isInstalled = $this->isInstalled(); if (!$isInstalled && $isExpected) { $this->errorCode = self::ERR_IS_INSTALLED; - throw new \Exception('Application is not installed yet.'); + throw new \Exception('Error: Application is not installed yet. '); } if ($isInstalled && !$isExpected) { $this->errorCode = self::ERR_IS_INSTALLED; - throw new \Exception('Application is already installed.'); + throw new \Exception('Error: Application is already installed. '); } } @@ -406,7 +406,7 @@ class Bootstrap if ($this->isDeveloperMode()) { echo $e; } else { - $message = "An error has happened during application run. See debug log for details.\n"; + $message = "An error has happened during application run. See exception log for details.\n"; try { if (!$this->objectManager) { throw new \DomainException(); diff --git a/lib/internal/Magento/Framework/App/State/Cleanup.php b/lib/internal/Magento/Framework/App/State/CleanupFiles.php similarity index 50% rename from lib/internal/Magento/Framework/App/State/Cleanup.php rename to lib/internal/Magento/Framework/App/State/CleanupFiles.php index 2a832f611b739386b9a244621dfe14b489dd335c..5509d78d60dc0dc0c7832db3da324afdd31ea501 100644 --- a/lib/internal/Magento/Framework/App/State/Cleanup.php +++ b/lib/internal/Magento/Framework/App/State/CleanupFiles.php @@ -6,23 +6,15 @@ namespace Magento\Framework\App\State; -use Magento\Framework\App\Cache\Frontend\Pool; use Magento\Framework\Filesystem; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\View\Asset\Source; /** * A service for cleaning up application state */ -class Cleanup +class CleanupFiles { - /** - * Cache frontend pool - * - * @var Pool - */ - private $cachePool; - /** * File system * @@ -33,58 +25,60 @@ class Cleanup /** * Constructor * - * @param Pool $cachePool * @param Filesystem $filesystem */ - public function __construct(Pool $cachePool, Filesystem $filesystem) + public function __construct(Filesystem $filesystem) { - $this->cachePool = $cachePool; $this->filesystem = $filesystem; } - /** - * Clears all caches - * - * @return void - */ - public function clearCaches() - { - /** @var \Magento\Framework\Cache\FrontendInterface $frontend */ - foreach ($this->cachePool as $frontend) { - $frontend->clean(); - } - } - /** * Clears all files that are subject of code generation * - * @return void + * @return string[] */ public function clearCodeGeneratedFiles() { - $this->clearCodeGeneratedClasses(); - $this->clearMaterializedViewFiles(); + return array_merge( + $this->clearCodeGeneratedClasses(), + $this->clearMaterializedViewFiles() + ); } /** * Clears code-generated classes * - * @return void + * @return string[] */ public function clearCodeGeneratedClasses() { - $this->emptyDir(DirectoryList::GENERATION); + return $this->emptyDir(DirectoryList::GENERATION); } /** * Clears materialized static view files * - * @return void + * @return string[] */ public function clearMaterializedViewFiles() { - $this->emptyDir(DirectoryList::STATIC_VIEW); - $this->emptyDir(DirectoryList::VAR_DIR, DirectoryList::TMP_MATERIALIZATION_DIR); + return array_merge( + $this->emptyDir(DirectoryList::STATIC_VIEW), + $this->emptyDir(DirectoryList::VAR_DIR, DirectoryList::TMP_MATERIALIZATION_DIR) + ); + } + + /** + * Clears all files + * + * @return string[] + */ + public function clearAllFiles() + { + return array_merge( + $this->emptyDir(DirectoryList::STATIC_VIEW), + $this->emptyDir(DirectoryList::VAR_DIR) + ); } /** @@ -92,15 +86,29 @@ class Cleanup * * @param string $code * @param string|null $subPath - * @return void + * @return string[] */ private function emptyDir($code, $subPath = null) { + $messages = []; + $dir = $this->filesystem->getDirectoryWrite($code); + $dirPath = $dir->getAbsolutePath(); + if (!$dir->isExist()) { + $messages[] = "The directory '{$dirPath}' doesn't exist - skipping cleanup"; + return $messages; + } foreach ($dir->search('*', $subPath) as $path) { if (false === strpos($path, '.')) { - $dir->delete($path); + $messages[] = $dirPath . $path; + try { + $dir->delete($path); + } catch (FilesystemException $e) { + $messages[] = $e->getMessage(); + } } } + + return $messages; } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupTest.php b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php similarity index 57% rename from lib/internal/Magento/Framework/App/Test/Unit/State/CleanupTest.php rename to lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php index ad3740f90d515796723b9503609e734adf506a09..f1290dcc139bc8bef9d1efff92947d1e2f5d6a11 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/State/CleanupFilesTest.php @@ -6,63 +6,27 @@ namespace Magento\Framework\App\Test\Unit\State; -use \Magento\Framework\App\State\Cleanup; +use \Magento\Framework\App\State\CleanupFiles; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem\DriverPool; -class CleanupTest extends \PHPUnit_Framework_TestCase +class CleanupFilesTest extends \PHPUnit_Framework_TestCase { - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $cachePool; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject[] - */ - private $cache; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ private $filesystem; /** - * @var Cleanup + * @var CleanupFiles */ private $object; protected function setUp() { - $this->cachePool = $this->getMock('Magento\Framework\App\Cache\Frontend\Pool', [], [], '', false); - $this->cache = [ - $this->getMockForAbstractClass('Magento\Framework\Cache\FrontendInterface'), - $this->getMockForAbstractClass('Magento\Framework\Cache\FrontendInterface'), - ]; $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); - $this->object = new Cleanup($this->cachePool, $this->filesystem); - } - - public function testClearCaches() - { - $this->mockCachePoolIterator(); - $this->cache[0]->expects($this->once())->method('clean'); - $this->cache[1]->expects($this->once())->method('clean'); - $this->object->clearCaches(); - } - - /** - * Mocks cache pool iteration through 2 items - * - * @return void - */ - private function mockCachePoolIterator() - { - $this->cachePool->expects($this->any())->method('valid')->will($this->onConsecutiveCalls(true, true, false)); - $this->cachePool->expects($this->any()) - ->method('current') - ->will($this->onConsecutiveCalls($this->cache[0], $this->cache[1])); + $this->object = new CleanupFiles($this->filesystem); } public function testClearCodeGeneratedClasses() @@ -97,6 +61,7 @@ class CleanupTest extends \PHPUnit_Framework_TestCase $dir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); $dir->expects($this->once())->method('search')->with('*', $subPath)->willReturn(['one', 'two']); $dir->expects($this->exactly(2))->method('delete'); + $dir->expects($this->once())->method('isExist')->will($this->returnValue(true)); return $dir; } } diff --git a/lib/internal/Magento/Framework/App/Utility/Classes.php b/lib/internal/Magento/Framework/App/Utility/Classes.php index 6671bd6a0464da30ef79dd001742cd2ff6ad43ef..f49118641b3f4de5d3dd08e4cef4ddd9d46bef51 100644 --- a/lib/internal/Magento/Framework/App/Utility/Classes.php +++ b/lib/internal/Magento/Framework/App/Utility/Classes.php @@ -7,6 +7,8 @@ */ namespace Magento\Framework\App\Utility; +use Magento\Framework\App\Utility\Files; + class Classes { /** @@ -185,11 +187,11 @@ class Classes public static function collectModuleClasses($subTypePattern = '[A-Za-z]+') { $pattern = '/^' . preg_quote( - \Magento\Framework\App\Utility\Files::init()->getPathToSource(), + Files::init()->getPathToSource(), '/' ) . '\/app\/code\/([A-Za-z]+)\/([A-Za-z]+)\/(' . $subTypePattern . '\/.+)\.php$/'; $result = []; - foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false) as $file) { + foreach (Files::init()->getPhpFiles(true, false, false, false, false) as $file) { if (preg_match($pattern, $file, $matches)) { $module = "{$matches[1]}_{$matches[2]}"; $class = "{$module}" . '\\' . str_replace( @@ -214,7 +216,7 @@ class Classes if (!empty(self::$_virtualClasses)) { return self::$_virtualClasses; } - $configFiles = \Magento\Framework\App\Utility\Files::init()->getDiConfigs(); + $configFiles = Files::init()->getDiConfigs(); foreach ($configFiles as $fileName) { $configDom = new \DOMDocument(); $configDom->load($fileName); diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php index 15869c4be7c49c67c886bab1b14484c2f5b1b5ea..57fe340acda362fa1a17839ee8c54c515f5907cb 100644 --- a/lib/internal/Magento/Framework/App/Utility/Files.php +++ b/lib/internal/Magento/Framework/App/Utility/Files.php @@ -109,9 +109,10 @@ class Files * @param bool $otherCode non-application PHP-code (doesn't include "dev" directory) * @param bool $templates application PHTML-code * @param bool $asDataSet + * @param bool $tests tests folder * @return array */ - public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true) + public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true, $tests = true) { $key = __METHOD__ . "/{$this->_path}/{$appCode}/{$otherCode}/{$templates}"; if (!isset(self::$_cache[$key])) { @@ -137,6 +138,12 @@ class Files self::getFiles(["{$this->_path}/dev/tools/Magento/Tools/SampleData"], '*.php') ); } + if ($tests) { + $files = array_merge( + $files, + self::getFiles(["{$this->_path}/dev/tests"], '*.php') + ); + } if ($templates) { $files = array_merge($files, $this->getPhtmlFiles(false, false)); } diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index 8b705a12fe4825cc7b9b108f1ffd18a07e87a7eb..67e77a1191cb06fcd64edd0a0283184976913921 100644 --- a/lib/internal/Magento/Framework/AppInterface.php +++ b/lib/internal/Magento/Framework/AppInterface.php @@ -17,7 +17,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '0.74.0-beta4'; + const VERSION = '0.74.0-beta5'; /** * Launch application diff --git a/lib/internal/Magento/Framework/Archive/Helper/File.php b/lib/internal/Magento/Framework/Archive/Helper/File.php old mode 100644 new mode 100755 index 549c3b8849fe73ba906f1fe643e8f45d2fae37bd..eab51af7b2c87cbb6f8decc1e814af08645af7f6 --- a/lib/internal/Magento/Framework/Archive/Helper/File.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File.php @@ -11,7 +11,7 @@ */ namespace Magento\Framework\Archive\Helper; -use Magento\Framework\Exception\LocalizedException as MagentoException; +use Magento\Framework\Exception\LocalizedException; class File { @@ -87,7 +87,7 @@ class File * @param string $mode * @param int $chmod * @return void - * @throws MagentoException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function open($mode = 'w+', $chmod = 0666) @@ -96,13 +96,13 @@ class File if ($this->_isInWriteMode) { if (!is_writable($this->_fileLocation)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Permission denied to write to %1', [$this->_fileLocation]) ); } if (is_file($this->_filePath) && !is_writable($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase( "Can't open file %1 for writing. Permission denied.", [$this->_fileName] @@ -113,13 +113,13 @@ class File if ($this->_isReadableMode($mode) && (!is_file($this->_filePath) || !is_readable($this->_filePath))) { if (!is_file($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('File %1 does not exist', [$this->_filePath]) ); } if (!is_readable($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Permission denied to read file %1', [$this->_filePath]) ); } @@ -191,14 +191,14 @@ class File * * @param string $mode * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _open($mode) { $this->_fileHandler = @fopen($this->_filePath, $mode); if (false === $this->_fileHandler) { - throw new MagentoException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath])); + throw new LocalizedException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath])); } } @@ -207,14 +207,14 @@ class File * * @param string $data * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _write($data) { $result = @fwrite($this->_fileHandler, $data); if (false === $result) { - throw new MagentoException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath])); + throw new LocalizedException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath])); } } @@ -223,14 +223,14 @@ class File * * @param int $length * @return string - * @throws MagentoException + * @throws LocalizedException */ protected function _read($length) { $result = fread($this->_fileHandler, $length); if (false === $result) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Failed to read data from %1', [$this->_filePath]) ); } @@ -284,12 +284,12 @@ class File * Check whether file is opened * * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _checkFileOpened() { if (!$this->_fileHandler) { - throw new MagentoException(new \Magento\Framework\Phrase('File not opened')); + throw new LocalizedException(new \Magento\Framework\Phrase('File not opened')); } } } diff --git a/lib/internal/Magento/Framework/Config/ConfigGenerator.php b/lib/internal/Magento/Framework/Config/ConfigGenerator.php index 8930487dd35c7950364fbf994eab3a0715045517..c7f4ac934ae47cf91fd90dff233df5c24a611a3c 100644 --- a/lib/internal/Magento/Framework/Config/ConfigGenerator.php +++ b/lib/internal/Magento/Framework/Config/ConfigGenerator.php @@ -25,7 +25,7 @@ class ConfigGenerator ConfigOptionsList::INPUT_KEY_DB_HOST => ConfigOptionsList::KEY_HOST, ConfigOptionsList::INPUT_KEY_DB_NAME => ConfigOptionsList::KEY_NAME, ConfigOptionsList::INPUT_KEY_DB_USER => ConfigOptionsList::KEY_USER, - ConfigOptionsList::INPUT_KEY_DB_PASS => ConfigOptionsList::KEY_PASS, + ConfigOptionsList::INPUT_KEY_DB_PASSWORD => ConfigOptionsList::KEY_PASSWORD, ConfigOptionsList::INPUT_KEY_DB_PREFIX => ConfigOptionsList::KEY_PREFIX, ConfigOptionsList::INPUT_KEY_DB_MODEL => ConfigOptionsList::KEY_MODEL, ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS => ConfigOptionsList::KEY_INIT_STATEMENTS, @@ -152,7 +152,7 @@ class ConfigGenerator ConfigOptionsList::INPUT_KEY_DB_HOST, ConfigOptionsList::INPUT_KEY_DB_NAME, ConfigOptionsList::INPUT_KEY_DB_USER, - ConfigOptionsList::INPUT_KEY_DB_PASS, + ConfigOptionsList::INPUT_KEY_DB_PASSWORD, ConfigOptionsList::INPUT_KEY_DB_MODEL, ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS, ]; diff --git a/lib/internal/Magento/Framework/Config/ConfigOptionsList.php b/lib/internal/Magento/Framework/Config/ConfigOptionsList.php index 817835ed0d0fdb6460653e50c330fb2ec2743654..ac1a90652f40c07dc382b094e655a4cd289a5700 100644 --- a/lib/internal/Magento/Framework/Config/ConfigOptionsList.php +++ b/lib/internal/Magento/Framework/Config/ConfigOptionsList.php @@ -37,7 +37,7 @@ class ConfigOptionsList implements ConfigOptionsListInterface const INPUT_KEY_DB_HOST = 'db_host'; const INPUT_KEY_DB_NAME = 'db_name'; const INPUT_KEY_DB_USER = 'db_user'; - const INPUT_KEY_DB_PASS = 'db_pass'; + const INPUT_KEY_DB_PASSWORD = 'db_password'; const INPUT_KEY_DB_PREFIX = 'db_prefix'; const INPUT_KEY_DB_MODEL = 'db_model'; const INPUT_KEY_DB_INIT_STATEMENTS = 'db_init_statements'; @@ -62,7 +62,7 @@ class ConfigOptionsList implements ConfigOptionsListInterface const KEY_HOST = 'host'; const KEY_NAME = 'dbname'; const KEY_USER = 'username'; - const KEY_PASS = 'password'; + const KEY_PASSWORD = 'password'; const KEY_PREFIX = 'table_prefix'; const KEY_MODEL = 'model'; const KEY_INIT_STATEMENTS = 'initStatements'; @@ -155,9 +155,9 @@ class ConfigOptionsList implements ConfigOptionsListInterface 'root' ), new TextConfigOption( - self::INPUT_KEY_DB_PASS, + self::INPUT_KEY_DB_PASSWORD, TextConfigOption::FRONTEND_WIZARD_PASSWORD, - self::CONFIG_PATH_DB_CONNECTION_DEFAULT . self::KEY_PASS, + self::CONFIG_PATH_DB_CONNECTION_DEFAULT . self::KEY_PASSWORD, 'Database server password', '' ), diff --git a/lib/internal/Magento/Framework/Console/CommandList.php b/lib/internal/Magento/Framework/Console/CommandList.php index a75d096466bf0bc0a3aefc657cee7eae077cfe60..99519a396d16b66eeaa68481d31514fc85da65e1 100644 --- a/lib/internal/Magento/Framework/Console/CommandList.php +++ b/lib/internal/Magento/Framework/Console/CommandList.php @@ -6,12 +6,8 @@ namespace Magento\Framework\Console; -use Magento\Framework\ObjectManagerInterface; - /** * Class CommandList has a list of commands, which can be extended via DI configuration. - * - * @package Magento\Framework\Console */ class CommandList { diff --git a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php index ac5f33263ec03c3ac9452229a31c8d0d71690272..938cfe6a31ec26f0193059607e1a20ea68bba299 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php +++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php @@ -985,7 +985,7 @@ interface AdapterInterface * @param \Magento\Framework\DB\Select $select * @param int $stepCount * @return \Magento\Framework\DB\Select[] - * @throws \Magento\Framework\DB\DBException + * @throws \Magento\Framework\Exception\LocalizedException */ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100); diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index f3bf8e12d893c11bd321989e4786d1d65893976d..b4b07cd12e81494298dd43dea4a4156c8a684670 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -18,6 +18,7 @@ use Magento\Framework\DB\LoggerInterface; use Magento\Framework\DB\Profiler; use Magento\Framework\DB\Select; use Magento\Framework\DB\Statement\Parameter; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\String; @@ -3322,13 +3323,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * @param \Magento\Framework\DB\Select $select * @param int $stepCount * @return \Magento\Framework\DB\Select[] - * @throws \Magento\Framework\DB\DBException + * @throws LocalizedException */ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100) { $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); if (empty($fromSelect)) { - throw new \Magento\Framework\DB\DBException( + throw new LocalizedException( new \Magento\Framework\Phrase('Select object must have correct "FROM" part') ); } @@ -3380,7 +3381,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * @param Select $select * @param string|array $table * @return string - * @throws \Magento\Framework\DB\DBException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -3438,7 +3439,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface } if (!$columns) { - throw new \Magento\Framework\DB\DBException( + throw new LocalizedException( new \Magento\Framework\Phrase('The columns for UPDATE statement are not defined') ); } diff --git a/lib/internal/Magento/Framework/DB/DBException.php b/lib/internal/Magento/Framework/DB/DBException.php deleted file mode 100644 index 6af4e98427bbf852c39c0b4494e4a5bba23339b1..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/DBException.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB; - -/** - * TODO - * - * @author Magento Core Team <core@magentocommerce.com> - */ -class DBException extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php index 92e206b069b491c3717db2b9484b9e25c4cff263..b89a7d646d07823c7da54caaca77bfc7d4f300b3 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php @@ -93,7 +93,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => null, 'keys' => null, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty array of node information', ], [ @@ -101,7 +101,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => null, 'keys' => true, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty array of node information' ], [ @@ -109,7 +109,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => true, 'keys' => null, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty keys array' ] ]; diff --git a/lib/internal/Magento/Framework/DB/Tree.php b/lib/internal/Magento/Framework/DB/Tree.php index e2449c2bc8498fcd4758cc194862d3f78ee9742f..f06e9d291a89490355f627251548d701b66e36d9 100644 --- a/lib/internal/Magento/Framework/DB/Tree.php +++ b/lib/internal/Magento/Framework/DB/Tree.php @@ -10,13 +10,11 @@ namespace Magento\Framework\DB; \Zend_Loader::loadClass('\Magento\Framework\DB\Tree\NodeSet'); use Magento\Framework\DB\Tree\Node; use Magento\Framework\DB\Tree\NodeSet; -use Magento\Framework\DB\Tree\TreeException; +use Magento\Framework\Exception\LocalizedException; /** * Magento Library - */ -require_once 'Tree/TreeException.php'; -/** + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Tree @@ -79,7 +77,7 @@ class Tree /** * @param array $config - * @throws TreeException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -97,7 +95,7 @@ class Tree // make sure it's a \Zend_Db_Adapter if (!$connection instanceof \Zend_Db_Adapter_Abstract) { - throw new TreeException( + throw new LocalizedException( new \Magento\Framework\Phrase('db object does not implement \Zend_Db_Adapter_Abstract') ); } @@ -109,7 +107,7 @@ class Tree $conn->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); } } else { - throw new TreeException(new \Magento\Framework\Phrase('db object is not set in config')); + throw new LocalizedException(new \Magento\Framework\Phrase('db object is not set in config')); } if (!empty($config['table'])) { diff --git a/lib/internal/Magento/Framework/DB/Tree/Node.php b/lib/internal/Magento/Framework/DB/Tree/Node.php index e9ea215876818ab635f24972875564cc4dd82ef7..f3e353ba81a4dba8180416e1cd4f711d78edbc99 100644 --- a/lib/internal/Magento/Framework/DB/Tree/Node.php +++ b/lib/internal/Magento/Framework/DB/Tree/Node.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\DB\Tree; -use Magento\Framework\DB\Tree\Node\NodeException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.UnusedPrivateField) @@ -60,15 +60,15 @@ class Node /** * @param array $nodeData * @param array $keys - * @throws NodeException + * @throws LocalizedException */ public function __construct($nodeData, $keys) { if (empty($nodeData)) { - throw new NodeException(new \Magento\Framework\Phrase('Empty array of node information')); + throw new LocalizedException(new \Magento\Framework\Phrase('Empty array of node information')); } if (empty($keys)) { - throw new NodeException(new \Magento\Framework\Phrase('Empty keys array')); + throw new LocalizedException(new \Magento\Framework\Phrase('Empty keys array')); } $this->id = $nodeData[$keys['id']]; diff --git a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php b/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php deleted file mode 100644 index 6f3fa5edae5e2a478cf2c750c6a9950a169866fb..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree\Node; - -class NodeException extends \Magento\Framework\DB\Tree\TreeException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php b/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php deleted file mode 100644 index 62c7b9554b2665afc84dffc67bbcd1552e1acd56..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree\NodeSet; - -class NodeSetException extends \Magento\Framework\DB\Tree\TreeException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Tree/TreeException.php b/lib/internal/Magento/Framework/DB/Tree/TreeException.php deleted file mode 100644 index e462b47654bc44077946460d55dc8c9b350a9e72..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/TreeException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree; - -class TreeException extends \Magento\Framework\DB\DBException -{ -} diff --git a/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php b/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php deleted file mode 100644 index 73a22a65116e664f73531b2f34ed1612e5e803e3..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Exception\File; - -use Magento\Framework\Exception\LocalizedException; - -class LargeSizeException extends LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Exception/File/ValidatorException.php b/lib/internal/Magento/Framework/Exception/File/ValidatorException.php deleted file mode 100644 index a8f78f8aeb2668009a79ccdd4a0ced4ed55c5286..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Exception/File/ValidatorException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Exception\File; - -use Magento\Framework\Exception\LocalizedException; - -class ValidatorException extends LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index ed850baec96a9bb36bea2aaaa294ec3073394519..1f897eee69f0194cdc69fe580f9ee81a402e94d4 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Filesystem\Io; +use Magento\Framework\Phrase; +use Magento\Framework\Exception\LocalizedException; + /** * FTP client */ @@ -66,7 +69,7 @@ class Ftp extends AbstractIo * * @param array $args * @return true - * @throws IoException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -74,7 +77,7 @@ class Ftp extends AbstractIo { if (empty($args['host'])) { $this->_error = self::ERROR_EMPTY_HOST; - throw new IoException(new \Magento\Framework\Phrase('Empty host specified')); + throw new LocalizedException(new Phrase('Empty host specified')); } if (empty($args['port'])) { @@ -107,22 +110,20 @@ class Ftp extends AbstractIo } if (!$this->_conn) { $this->_error = self::ERROR_INVALID_CONNECTION; - throw new IoException( - new \Magento\Framework\Phrase('Could not establish FTP connection, invalid host or port') - ); + throw new LocalizedException(new Phrase('Could not establish FTP connection, invalid host or port')); } if (!@ftp_login($this->_conn, $this->_config['user'], $this->_config['password'])) { $this->_error = self::ERROR_INVALID_LOGIN; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid user name or password')); + throw new LocalizedException(new Phrase('Invalid user name or password')); } if (!empty($this->_config['path'])) { if (!@ftp_chdir($this->_conn, $this->_config['path'])) { $this->_error = self::ERROR_INVALID_PATH; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid path')); + throw new LocalizedException(new Phrase('Invalid path')); } } @@ -130,7 +131,7 @@ class Ftp extends AbstractIo if (!@ftp_pasv($this->_conn, true)) { $this->_error = self::ERROR_INVALID_MODE; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid file transfer mode')); + throw new LocalizedException(new Phrase('Invalid file transfer mode')); } } diff --git a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php b/lib/internal/Magento/Framework/Filesystem/Io/IoException.php deleted file mode 100644 index 3d94334dcae56b811afb12cc45fbe2deec95296f..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Filesystem\Io; - -/** - * Io exception - */ -class IoException extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php index e8ff84ee476765a4ef471c9bc92b3a8489a53e1c..16526b3fb40bfe1526aa06fd9d47080ff5fa318f 100644 --- a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php +++ b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php @@ -57,7 +57,8 @@ class DbStatusValidator $formattedErrors = $this->formatErrors($errors); throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase( - 'Please update your database: Run "php -f index.php update" from the Magento root/setup directory. %1The following modules are outdated:%2%3', + 'Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.' + . ' %1The following modules are outdated:%2%3', [PHP_EOL, PHP_EOL, implode(PHP_EOL, $formattedErrors)] ) ); diff --git a/lib/internal/Magento/Framework/Module/Status.php b/lib/internal/Magento/Framework/Module/Status.php index 0c93b19feec2989b781306be7cce4e43b997d3ee..897c7cc10eb1366ef242d9c3037f0ff2cc9ccd96 100644 --- a/lib/internal/Magento/Framework/Module/Status.php +++ b/lib/internal/Magento/Framework/Module/Status.php @@ -7,7 +7,6 @@ namespace Magento\Framework\Module; use Magento\Framework\App\DeploymentConfig\Writer; -use Magento\Framework\App\State\Cleanup; use Magento\Framework\Config\File\ConfigFilePool; /** @@ -38,13 +37,6 @@ class Status */ private $writer; - /** - * Application state cleanup service - * - * @var Cleanup - */ - private $cleanup; - /** * Dependency Checker * @@ -65,7 +57,6 @@ class Status * @param ModuleList\Loader $loader * @param ModuleList $list * @param Writer $writer - * @param Cleanup $cleanup * @param ConflictChecker $conflictChecker * @param DependencyChecker $dependencyChecker */ @@ -73,14 +64,12 @@ class Status ModuleList\Loader $loader, ModuleList $list, Writer $writer, - Cleanup $cleanup, ConflictChecker $conflictChecker, DependencyChecker $dependencyChecker ) { $this->loader = $loader; $this->list = $list; $this->writer = $writer; - $this->cleanup = $cleanup; $this->conflictChecker = $conflictChecker; $this->dependencyChecker = $dependencyChecker; } @@ -134,7 +123,7 @@ class Status foreach ($errorModulesConflict as $moduleName => $conflictingModules) { if (!empty($conflictingModules)) { - $errorMessages[] = "Cannot enable $moduleName, conflicting with other modules:"; + $errorMessages[] = "Cannot enable $moduleName because it conflicts with other modules:"; $errorMessages[] = implode("\n", $conflictingModules); } } @@ -163,8 +152,6 @@ class Status } } $this->writer->saveConfig([ConfigFilePool::APP_CONFIG => ['modules' => $result]], true); - $this->cleanup->clearCaches(); - $this->cleanup->clearCodeGeneratedFiles(); } /** @@ -239,9 +226,9 @@ class Status private function createVerboseErrorMessage($isEnabled, $moduleName, $missingDependencies) { if ($isEnabled) { - $errorMessages[] = "Cannot enable $moduleName, depending on disabled modules:"; + $errorMessages[] = "Cannot enable $moduleName because it depends on disabled modules:"; } else { - $errorMessages[] = "Cannot disable $moduleName, modules depending on it:"; + $errorMessages[] = "Cannot disable $moduleName because modules depend on it:"; } foreach ($missingDependencies as $errorModule => $path) { $errorMessages[] = "$errorModule: " . implode('->', $path); diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php index 10e21e701802b59a7be38144bb7fb5d1cbf684d6..b3b521a216ec13af3a473786bf6cb3787da43463 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/Plugin/DbStatusValidatorTest.php @@ -117,7 +117,7 @@ class DbStatusValidatorTest extends \PHPUnit_Framework_TestCase * * @dataProvider aroundDispatchExceptionDataProvider * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please update your database: + * @expectedExceptionMessage Please upgrade your database: */ public function testAroundDispatchException(array $dbVersionErrors) { diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/StatusTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/StatusTest.php index 697677f6b1044bb727462becdfe747a70278ebd9..dbdf293df705bd3e6adf44567ec67535334a7833 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/StatusTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/StatusTest.php @@ -26,11 +26,6 @@ class StatusTest extends \PHPUnit_Framework_TestCase */ private $writer; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $cleanup; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -51,14 +46,12 @@ class StatusTest extends \PHPUnit_Framework_TestCase $this->loader = $this->getMock('Magento\Framework\Module\ModuleList\Loader', [], [], '', false); $this->moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false); $this->writer = $this->getMock('Magento\Framework\App\DeploymentConfig\Writer', [], [], '', false); - $this->cleanup = $this->getMock('Magento\Framework\App\State\Cleanup', [], [], '', false); $this->conflictChecker = $this->getMock('Magento\Framework\Module\ConflictChecker', [], [], '', false); $this->dependencyChecker = $this->getMock('Magento\Framework\Module\DependencyChecker', [], [], '', false); $this->object = new Status( $this->loader, $this->moduleList, $this->writer, - $this->cleanup, $this->conflictChecker, $this->dependencyChecker ); @@ -95,13 +88,13 @@ class StatusTest extends \PHPUnit_Framework_TestCase )); $result = $this->object->checkConstraints(true, ['Module_Foo' => '', 'Module_Bar' => ''], [], false); $expect = [ - 'Cannot enable Module_Foo, depending on disabled modules:', + 'Cannot enable Module_Foo because it depends on disabled modules:', "Module_Baz: Module_Foo->Module_Baz", - 'Cannot enable Module_Bar, depending on disabled modules:', + 'Cannot enable Module_Bar because it depends on disabled modules:', "Module_Baz: Module_Bar->Module_Baz", - 'Cannot enable Module_Foo, conflicting with other modules:', + 'Cannot enable Module_Foo because it conflicts with other modules:', "Module_Bar", - 'Cannot enable Module_Bar, conflicting with other modules:', + 'Cannot enable Module_Bar because it conflicts with other modules:', "Module_Foo", ]; $this->assertEquals($expect, $result); @@ -124,9 +117,9 @@ class StatusTest extends \PHPUnit_Framework_TestCase $expect = [ 'Cannot enable Module_Foo', 'Cannot enable Module_Bar', - 'Cannot enable Module_Foo, conflicting with other modules:', + 'Cannot enable Module_Foo because it conflicts with other modules:', "Module_Bar", - 'Cannot enable Module_Bar, conflicting with other modules:', + 'Cannot enable Module_Bar because it conflicts with other modules:', "Module_Foo", ]; $this->assertEquals($expect, $result); @@ -153,9 +146,9 @@ class StatusTest extends \PHPUnit_Framework_TestCase )); $result = $this->object->checkConstraints(false, ['Module_Foo' => '', 'Module_Bar' => '']); $expect = [ - 'Cannot disable Module_Foo, modules depending on it:', + 'Cannot disable Module_Foo because modules depend on it:', "Module_Baz: Module_Baz->Module_Foo", - 'Cannot disable Module_Bar, modules depending on it:', + 'Cannot disable Module_Bar because modules depend on it:', "Module_Baz: Module_Baz->Module_Bar", ]; $this->assertEquals($expect, $result); @@ -171,8 +164,6 @@ class StatusTest extends \PHPUnit_Framework_TestCase $expectedModules = ['Module_Foo' => 1, 'Module_Bar' => 1, 'Module_Baz' => 0]; $this->writer->expects($this->once())->method('saveConfig') ->with([ConfigFilePool::APP_CONFIG => ['modules' => $expectedModules]]); - $this->cleanup->expects($this->once())->method('clearCaches'); - $this->cleanup->expects($this->once())->method('clearCodeGeneratedFiles'); $this->object->setIsEnabled(true, ['Module_Foo', 'Module_Bar']); } diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php new file mode 100644 index 0000000000000000000000000000000000000000..f848775a34b79ca17c1cc93d69071ab80a664a07 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Element; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; + +/** + * Class of a Exception Handler Block + * + * Block for default and maintenance mode. During layout loading process corrupted block (that throws exception) + * will be replaced with a "dummy" block. As result, page will be loaded without broken block. + * + * When calls from parent to child block occurred and the error appeared in the child block, + * all blocks chain would be removed. + */ +class ExceptionHandlerBlock implements BlockInterface +{ + /** + * @var string + */ + protected $blockName; + + /** + * @param string $blockName + */ + public function __construct($blockName = '') + { + $this->blockName = $blockName; + } + + /** + * Throws an exception when parent block calls corrupted child block method + * + * @param string $method + * @param array $args + * @return void + * @throws LocalizedException + */ + public function __call($method, $args) + { + throw new LocalizedException( + new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + ); + } + + /** + * Declared in BlockInterface and also throws an exception + * + * @throws LocalizedException + * @return void + */ + public function toHtml() + { + throw new LocalizedException( + new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + ); + } +} diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..522324c0ea22df2f5ffacfb7496d07127819d4cb --- /dev/null +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Element; + +/** + * Class ExceptionHandlerBlockFactory + * @package Magento\Framework\View\Element + */ +class ExceptionHandlerBlockFactory +{ + const DEFAULT_INSTANCE_NAME = 'Magento\Framework\View\Element\ExceptionHandlerBlock'; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + protected $objectManager; + + /** + * @var string + */ + protected $instanceName; + + /** + * @param \Magento\Framework\ObjectManagerInterface $objectManager + * @param string $instanceName + */ + public function __construct( + \Magento\Framework\ObjectManagerInterface $objectManager, + $instanceName = self::DEFAULT_INSTANCE_NAME + ) { + $this->objectManager = $objectManager; + $this->instanceName = $instanceName; + } + + /** + * Create exception handling block + * + * @param array $data + * @return \Magento\Framework\View\Element\BlockInterface + */ + public function create(array $data = []) + { + return $this->objectManager->create($this->instanceName, $data); + } +} diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index c2184cfff688e3f04e0863954a831e68b82b9ce2..6c857548d18ed329d6767bbc6f35684f8205e059 100644 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -148,9 +148,9 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra /** * @param Layout\ProcessorFactory $processorFactory - * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param ManagerInterface $eventManager * @param Layout\Data\Structure $structure - * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param MessageManagerInterface $messageManager * @param Design\Theme\ResolverInterface $themeResolver * @param Layout\ReaderPool $readerPool * @param Layout\GeneratorPool $generatorPool @@ -458,14 +458,7 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra { $this->build(); if (!isset($this->_renderElementCache[$name]) || !$useCache) { - if ($this->isUiComponent($name)) { - $result = $this->_renderUiComponent($name); - } elseif ($this->isBlock($name)) { - $result = $this->_renderBlock($name); - } else { - $result = $this->_renderContainer($name); - } - $this->_renderElementCache[$name] = $result; + $this->_renderElementCache[$name] = $this->renderNonCachedElement($name); } $this->_renderingOutput->setData('output', $this->_renderElementCache[$name]); $this->_eventManager->dispatch( @@ -475,6 +468,24 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra return $this->_renderingOutput->getData('output'); } + /** + * Render non cached element + * + * @param string $name + * @return string + */ + public function renderNonCachedElement($name) + { + if ($this->isUiComponent($name)) { + $result = $this->_renderUiComponent($name); + } elseif ($this->isBlock($name)) { + $result = $this->_renderBlock($name); + } else { + $result = $this->_renderContainer($name); + } + return $result; + } + /** * Gets HTML of block element * diff --git a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php index 1bd30ebe9ca8c29dfedb2a98423306a3174266d4..d6b0a5b5a11f35c268155d40e59312ece89c7fae 100644 --- a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php +++ b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\View\Layout\Generator; +use Magento\Framework\App\State; use Magento\Framework\ObjectManager\Config\Reader\Dom; use Magento\Framework\View\Layout; @@ -49,6 +50,16 @@ class Block implements Layout\GeneratorInterface */ protected $scopeResolver; + /** + * @var State + */ + protected $appState; + + /** + * @var \Magento\Framework\View\Element\ExceptionHandlerBlock + */ + protected $exceptionHandlerBlockFactory; + /** * @param \Magento\Framework\View\Element\BlockFactory $blockFactory * @param \Magento\Framework\Data\Argument\InterpreterInterface $argumentInterpreter @@ -56,6 +67,8 @@ class Block implements Layout\GeneratorInterface * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver + * @param \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory + * @param State $appState */ public function __construct( \Magento\Framework\View\Element\BlockFactory $blockFactory, @@ -63,7 +76,9 @@ class Block implements Layout\GeneratorInterface \Magento\Framework\Event\ManagerInterface $eventManager, \Psr\Log\LoggerInterface $logger, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\App\ScopeResolverInterface $scopeResolver + \Magento\Framework\App\ScopeResolverInterface $scopeResolver, + \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory, + State $appState ) { $this->blockFactory = $blockFactory; $this->argumentInterpreter = $argumentInterpreter; @@ -71,6 +86,8 @@ class Block implements Layout\GeneratorInterface $this->logger = $logger; $this->scopeConfig = $scopeConfig; $this->scopeResolver = $scopeResolver; + $this->exceptionHandlerBlockFactory = $exceptionHandlerBlockFactory; + $this->appState = $appState; } /** @@ -89,6 +106,7 @@ class Block implements Layout\GeneratorInterface * @param Layout\Reader\Context $readerContext * @param Context $generatorContext * @return $this + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function process(Layout\Reader\Context $readerContext, Layout\Generator\Context $generatorContext) { @@ -102,34 +120,72 @@ class Block implements Layout\GeneratorInterface foreach ($scheduledStructure->getElements() as $elementName => $element) { list($type, $data) = $element; if ($type === self::TYPE) { - $block = $this->generateBlock($scheduledStructure, $structure, $elementName); - $blocks[$elementName] = $block; - $layout->setBlock($elementName, $block); - if (!empty($data['actions'])) { - $blockActions[$elementName] = $data['actions']; + try { + $block = $this->generateBlock($scheduledStructure, $structure, $elementName); + $blocks[$elementName] = $block; + $layout->setBlock($elementName, $block); + if (!empty($data['actions'])) { + $blockActions[$elementName] = $data['actions']; + } + } catch (\Exception $e) { + $this->handleRenderException($e); + unset($blocks[$elementName]); } } } // Set layout instance to all generated block (trigger _prepareLayout method) foreach ($blocks as $elementName => $block) { - $block->setLayout($layout); - $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]); + try { + $block->setLayout($layout); + $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]); + } catch (\Exception $e) { + $this->handleRenderException($e); + $layout->setBlock( + $elementName, + $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName]) + ); + unset($blockActions[$elementName]); + } $scheduledStructure->unsetElement($elementName); } // Run all actions after layout initialization foreach ($blockActions as $elementName => $actions) { - foreach ($actions as $action) { - list($methodName, $actionArguments, $configPath, $scopeType) = $action; - if (empty($configPath) - || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope()) - ) { - $this->generateAction($blocks[$elementName], $methodName, $actionArguments); + try { + foreach ($actions as $action) { + list($methodName, $actionArguments, $configPath, $scopeType) = $action; + if (empty($configPath) + || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope()) + ) { + $this->generateAction($blocks[$elementName], $methodName, $actionArguments); + } } + } catch (\Exception $e) { + $this->handleRenderException($e); + $layout->setBlock( + $elementName, + $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName]) + ); } } return $this; } + /** + * Handle exceptions during rendering process + * + * @param \Exception $cause + * @throws \Exception + * @return void + */ + protected function handleRenderException(\Exception $cause) + { + if ($this->appState->getMode() === State::MODE_DEVELOPER) { + throw $cause; + } + $message = ($cause instanceof LocalizedException) ? $cause->getLogMessage() : $cause->getMessage(); + $this->logger->critical($message); + } + /** * Create block and set related data * diff --git a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php index 7679ac3d2846e2f1a06c3dada1b988e275ea5de4..45effcf449e43c4e7a05dcc77d37003195069eea 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php @@ -26,11 +26,6 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ protected $processorFactoryMock; - /** - * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject - */ - protected $appStateMock; - /** * @var \Magento\Framework\View\Design\Theme\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 3b4455968232441ab79e3998be622b4d838f74fa..55a443c3ffaccff1df8157e147561ad3d84e0cb0 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -2,7 +2,7 @@ "name": "magento/framework", "description": "N/A", "type": "magento2-library", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/setup/config/application.config.php b/setup/config/application.config.php index 296854b1141211c1575e52fd11cd4f47c638d587..6bda9ee81bcb49d418ce8971ff28bf3c5f875877 100644 --- a/setup/config/application.config.php +++ b/setup/config/application.config.php @@ -18,7 +18,7 @@ return [ __DIR__ . '/autoload/{,*.}{global,local}.php', ], ], - 'listeners' => ['Magento\Setup\Mvc\Bootstrap\InitParamListener', 'Magento\Setup\Mvc\Console\RouteListener'], + 'listeners' => ['Magento\Setup\Mvc\Bootstrap\InitParamListener'], 'service_manager' => [ 'factories' => [ InitParamListener::BOOTSTRAP_PARAM => 'Magento\Setup\Mvc\Bootstrap\InitParamListener', diff --git a/setup/config/di.config.php b/setup/config/di.config.php index b6bd0b18ae50dd11e50e0928a619fc1d4c626931..8d0f258ba828764481e37cc435a4fbddddc63cff 100644 --- a/setup/config/di.config.php +++ b/setup/config/di.config.php @@ -20,7 +20,6 @@ return [ 'Magento\Setup\Controller\CreateAdminAccount', 'Magento\Setup\Controller\Install', 'Magento\Setup\Controller\Success', - 'Magento\Setup\Controller\ConsoleController', 'Magento\Setup\Controller\Modules', ], 'instance' => [ diff --git a/setup/config/router.config.php b/setup/config/router.config.php index 817ed642dd515824dd487d8ad57a3be0a890b26f..1a16b1c7d1cfa3f834d55f59ca96fa3b015e6fb0 100644 --- a/setup/config/router.config.php +++ b/setup/config/router.config.php @@ -4,7 +4,6 @@ * See COPYING.txt for license details. */ -use Magento\Setup\Controller\ConsoleController; return [ 'router' => [ @@ -36,5 +35,4 @@ return [ ], ], ], - 'console' => ['router' => ['routes' => ConsoleController::getRouterConfig()]], ]; diff --git a/setup/index.php b/setup/index.php index 7f06ced03ba339d9c93f355ebb048a9bcc7c36c0..7c7b069afc31cd45bff2c2e2cf69d7fbc37c877c 100644 --- a/setup/index.php +++ b/setup/index.php @@ -4,13 +4,15 @@ * See COPYING.txt for license details. */ +if (PHP_SAPI == 'cli') { + echo "You cannot run this from the command line." . PHP_EOL . + "Run \"php bin/magento\" instead." . PHP_EOL; + exit(1); +} try { require __DIR__ . '/../app/bootstrap.php'; } catch (\Exception $e) { - if (PHP_SAPI == 'cli') { - echo 'Autoload error: ' . $e->getMessage(); - } else { - echo <<<HTML + echo <<<HTML <div style="font:12px/1.35em arial, helvetica, sans-serif;"> <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"> <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;"> @@ -19,7 +21,6 @@ try { <p>{$e->getMessage()}</p> </div> HTML; - } exit(1); } \Zend\Mvc\Application::init(require __DIR__ . '/config/application.config.php')->run(); diff --git a/setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php b/setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..fab2e492b31e8dcebdfab023fc8f40612e19e493 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Magento\Framework\App\MaintenanceMode; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +abstract class AbstractMaintenanceCommand extends AbstractSetupCommand +{ + /** + * Names of input option + */ + const INPUT_KEY_IP = 'ip'; + + /** + * @var MaintenanceMode $maintenanceMode + */ + protected $maintenanceMode; + + /** + * Constructor + * + * @param MaintenanceMode $maintenanceMode + */ + public function __construct(MaintenanceMode $maintenanceMode) + { + $this->maintenanceMode = $maintenanceMode; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $options = [ + new InputOption( + self::INPUT_KEY_IP, + null, + InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, + 'Allowed IP addresses' + ), + ]; + $this->setDefinition($options); + parent::configure(); + } + + /** + * Get maintenance mode to set + * + * @return bool + */ + abstract protected function isEnable(); + + /** + * Get display string after mode is set + * + * @return string + */ + abstract protected function getDisplayString(); + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $addresses = $input->getOption(self::INPUT_KEY_IP); + $this->maintenanceMode->set($this->isEnable()); + $output->writeln($this->getDisplayString()); + + if (!empty($addresses)) { + $addresses = implode(',', $addresses); + $addresses = ('none' == $addresses) ? '' : $addresses; + $this->maintenanceMode->setAddresses($addresses); + $output->writeln( + '<info>Set exempt IP-addresses: ' . (implode(', ', $this->maintenanceMode->getAddressInfo()) ?: 'none') + . '</info>' + ); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php b/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..9777b233790617c6a2ad3d9b9941069b3d93ce82 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/AbstractModuleCommand.php @@ -0,0 +1,175 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Magento\Setup\Model\ObjectManagerProvider; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Abstract class for Enable and Disable commands to consolidate common logic + */ +abstract class AbstractModuleCommand extends AbstractSetupCommand +{ + /** + * Names of input arguments or options + */ + const INPUT_KEY_MODULES = 'module'; + const INPUT_KEY_ALL = 'all'; + const INPUT_KEY_FORCE = 'force'; + const INPUT_KEY_CLEAR_STATIC_CONTENT = 'clear-static-content'; + + /** + * Object manager provider + * + * @var ObjectManagerProvider + */ + private $objectManagerProvider; + + /** + * Inject dependencies + * + * @param ObjectManagerProvider $objectManagerProvider + */ + public function __construct(ObjectManagerProvider $objectManagerProvider) + { + $this->objectManagerProvider = $objectManagerProvider; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setDefinition([ + new InputArgument( + self::INPUT_KEY_MODULES, + InputArgument::IS_ARRAY | InputArgument::OPTIONAL, + 'Name of the module' + ), + new InputOption( + self::INPUT_KEY_CLEAR_STATIC_CONTENT, + 'c', + InputOption::VALUE_NONE, + 'Clear generated static view files. Necessary, if the module(s) have static view files' + ), + new InputOption( + self::INPUT_KEY_FORCE, + 'f', + InputOption::VALUE_NONE, + 'Bypass dependencies check' + ), + new InputOption( + self::INPUT_KEY_ALL, + null, + InputOption::VALUE_NONE, + ($this->isEnable() ? 'Enable' : 'Disable') . ' all modules' + ), + ]); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $isEnable = $this->isEnable(); + if ($input->getOption(self::INPUT_KEY_ALL)) { + /** @var \Magento\Framework\Module\FullModuleList $fullModulesList */ + $fullModulesList = $this->objectManagerProvider->get()->get('Magento\Framework\Module\FullModuleList'); + $modules = $fullModulesList->getNames(); + } else { + $modules = $input->getArgument(self::INPUT_KEY_MODULES); + } + if (empty($modules)) { + throw new \InvalidArgumentException( + 'No modules specified. Specify a space-separated list of modules or use the --all option' + ); + } + /** + * @var \Magento\Framework\Module\Status $status + */ + $status = $this->objectManagerProvider->get()->get('Magento\Framework\Module\Status'); + $modulesToChange = $status->getModulesToChange($isEnable, $modules); + if (!empty($modulesToChange)) { + $force = $input->getOption(self::INPUT_KEY_FORCE); + if (!$force) { + $constraints = $status->checkConstraints($isEnable, $modulesToChange); + if ($constraints) { + $output->writeln( + "<error>Unable to change status of modules because of the following constraints:</error>" + ); + $output->writeln('<error>' . implode("\n", $constraints) . '</error>'); + return; + } + } + $status->setIsEnabled($isEnable, $modulesToChange); + if ($isEnable) { + $output->writeln('<info>The following modules have been enabled:</info>'); + $output->writeln('<info>- ' . implode("\n- ", $modulesToChange) . '</info>'); + $output->writeln(''); + $output->writeln( + '<info>To make sure that the enabled modules are properly registered,' + . " run 'setup:upgrade'.</info>" + ); + } else { + $output->writeln('<info>The following modules have been disabled:</info>'); + $output->writeln('<info>- ' . implode("\n- ", $modulesToChange) . '</info>'); + $output->writeln(''); + } + $this->cleanup($input, $output); + if ($force) { + $output->writeln( + '<error>Alert: You used the --force option.' + . ' As a result, modules might not function properly.</error>' + ); + } + } else { + $output->writeln('<info>No modules were changed.</info>'); + } + } + + /** + * Is it "enable" or "disable" command + * + * @return bool + */ + abstract protected function isEnable(); + + /** + * Cleanup after updated modules status + * + * @param InputInterface $input + * @param OutputInterface $output + * @return void + */ + private function cleanup(InputInterface $input, OutputInterface $output) + { + $objectManager = $this->objectManagerProvider->get(); + /** @var \Magento\Framework\App\Cache $cache */ + $cache = $objectManager->get('Magento\Framework\App\Cache'); + $cache->clean(); + $output->writeln('Cache cleared successfully.'); + /** @var \Magento\Framework\App\State\CleanupFiles $cleanupFiles */ + $cleanupFiles = $objectManager->get('Magento\Framework\App\State\CleanupFiles'); + $cleanupFiles->clearCodeGeneratedClasses(); + $output->writeln('Generated classes cleared successfully.'); + if ($input->getOption(self::INPUT_KEY_CLEAR_STATIC_CONTENT)) { + $cleanupFiles->clearMaterializedViewFiles(); + $output->writeln('Generated static view files cleared successfully.'); + } else { + $output->writeln( + '<error>Alert: Generated static view files were not cleared.' + . ' You can clear them using the --' . self::INPUT_KEY_CLEAR_STATIC_CONTENT . ' option.' + . ' Failure to clear static view files might cause display issues in the Admin and storefront.' + ); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/AbstractSetupCommand.php b/setup/src/Magento/Setup/Console/Command/AbstractSetupCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..3b8975c02de354a3b9f94cd8763ce934429a4559 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/AbstractSetupCommand.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Magento\Setup\Mvc\Bootstrap\InitParamListener; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputOption; + +/** + * An abstract class for all Magento Setup command. + * It adds InitParamListener's magento_init_params option to all setup command. + */ +abstract class AbstractSetupCommand extends Command +{ + /** + * Initialize basic Magento Setup command + * + * @return void + */ + protected function configure() + { + $this->addOption( + InitParamListener::BOOTSTRAP_PARAM, + null, + InputOption::VALUE_REQUIRED, + 'Add to any command to customize Magento initialization parameters' . PHP_EOL . + "For example: 'MAGE_MODE=developer&MAGE_DIRS[base][path]" . + "=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache'" + ); + } +} diff --git a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..3dd27d09e0c5f080e697eff9867f49e434495a48 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Setup\Model\AdminAccount; +use Magento\Setup\Model\ConsoleLogger; +use Magento\Setup\Model\InstallerFactory; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class AdminUserCreateCommand extends AbstractSetupCommand +{ + /** + * @var InstallerFactory + */ + private $installerFactory; + + /** + * @param InstallerFactory $installerFactory + */ + public function __construct(InstallerFactory $installerFactory) + { + $this->installerFactory = $installerFactory; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('admin:user:create') + ->setDescription('Creates admin user') + ->setDefinition($this->getOptionsList()); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $errors = $this->validate($input); + if ($errors) { + throw new \InvalidArgumentException(implode("\n", $errors)); + } + $installer = $this->installerFactory->create(new ConsoleLogger($output)); + $installer->installAdminUser($input->getOptions()); + $output->writeln('<info>Created admin user ' . $input->getOption(AdminAccount::KEY_USER) . '</info>'); + } + + /** + * Get list of arguments for the command + * + * @return InputOption[] + */ + public function getOptionsList() + { + return [ + new InputOption(AdminAccount::KEY_USER, null, InputOption::VALUE_REQUIRED, 'Admin user'), + new InputOption(AdminAccount::KEY_PASSWORD, null, InputOption::VALUE_REQUIRED, 'Admin password'), + new InputOption(AdminAccount::KEY_EMAIL, null, InputOption::VALUE_REQUIRED, 'Admin email'), + new InputOption(AdminAccount::KEY_FIRST_NAME, null, InputOption::VALUE_REQUIRED, 'Admin first name'), + new InputOption(AdminAccount::KEY_LAST_NAME, null, InputOption::VALUE_REQUIRED, 'Admin last name'), + ]; + } + + /** + * Check if all admin options are provided + * + * @param InputInterface $input + * @return string[] + */ + public function validate(InputInterface $input) + { + $errors = []; + $required = [ + AdminAccount::KEY_USER, + AdminAccount::KEY_PASSWORD, + AdminAccount::KEY_EMAIL, + AdminAccount::KEY_FIRST_NAME, + AdminAccount::KEY_LAST_NAME, + ]; + foreach ($required as $key) { + if (!$input->getOption($key)) { + $errors[] = 'Missing option ' . $key; + } + } + return $errors; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php b/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php index 0a95ba642a39c1eaba8d578889b304afb88116be..6a86ee2ce9a8ab85b92442a104cf17c71e516ffc 100644 --- a/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php +++ b/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php @@ -9,11 +9,10 @@ namespace Magento\Setup\Console\Command; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\Module\ModuleList; use Magento\Setup\Model\ConfigModel; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class ConfigSetCommand extends Command +class ConfigSetCommand extends AbstractSetupCommand { /** * @var ConfigModel @@ -63,7 +62,7 @@ class ConfigSetCommand extends Command ->setDescription('Sets deployment configuration') ->setDefinition($options); - $this->ignoreValidationErrors(); + parent::configure(); } /** @@ -84,7 +83,7 @@ class ConfigSetCommand extends Command $dialog = $this->getHelperSet()->get('dialog'); if (!$dialog->askConfirmation( $output, - '<question>Overwrite the existing configuration for ' . $option->getName() . '?[Y|n]</question>' + '<question>Overwrite the existing configuration for ' . $option->getName() . '?[Y/n]</question>' )) { $inputOptions[$option->getName()] = null; } diff --git a/setup/src/Magento/Setup/Console/Command/DbDataUpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/DbDataUpgradeCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..b915fa2a83067e27757b3d24ba884edac8c671b3 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/DbDataUpgradeCommand.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Framework\App\DeploymentConfig; +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Model\ConsoleLogger; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for install and update of data in DB + */ +class DbDataUpgradeCommand extends AbstractSetupCommand +{ + /** + * Factory to create installer + * + * @var InstallerFactory + */ + private $installFactory; + + /** + * Deployment configuration + * + * @var DeploymentConfig + */ + private $deploymentConfig; + + /** + * Inject dependencies + * + * @param InstallerFactory $installFactory + * @param DeploymentConfig $deploymentConfig + */ + public function __construct(InstallerFactory $installFactory, DeploymentConfig $deploymentConfig) + { + $this->installFactory = $installFactory; + $this->deploymentConfig = $deploymentConfig; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('setup:db-data:upgrade')->setDescription('Installs and upgrades data in the DB'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if (!$this->deploymentConfig->isAvailable()) { + $output->writeln("<info>No information is available: the application is not installed.</info>"); + return; + } + $installer = $this->installFactory->create(new ConsoleLogger($output)); + $installer->installDataFixtures(); + } +} diff --git a/setup/src/Magento/Setup/Console/Command/DbSchemaUpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/DbSchemaUpgradeCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..fc3f5bd9888acbd89a44216d1f144650e6f4403d --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/DbSchemaUpgradeCommand.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Framework\App\DeploymentConfig; +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Model\ConsoleLogger; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for install and update of DB schema + */ +class DbSchemaUpgradeCommand extends AbstractSetupCommand +{ + /** + * Factory to create installer + * + * @var InstallerFactory + */ + private $installFactory; + + /** + * Deployment configuration + * + * @var DeploymentConfig + */ + private $deploymentConfig; + + /** + * Inject dependencies + * + * @param InstallerFactory $installFactory + * @param DeploymentConfig $deploymentConfig + */ + public function __construct(InstallerFactory $installFactory, DeploymentConfig $deploymentConfig) + { + $this->installFactory = $installFactory; + $this->deploymentConfig = $deploymentConfig; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('setup:db-schema:upgrade')->setDescription('Installs and upgrades the DB schema'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if (!$this->deploymentConfig->isAvailable()) { + $output->writeln("<info>No information is available: the application is not installed.</info>"); + return; + } + $installer = $this->installFactory->create(new ConsoleLogger($output)); + $installer->installSchema(); + } +} diff --git a/setup/src/Magento/Setup/Console/Command/DbStatusCommand.php b/setup/src/Magento/Setup/Console/Command/DbStatusCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..7d996aec45e7e2a928a44a14ce237557fc029a10 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/DbStatusCommand.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Composer\Package\Version\VersionParser; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\Module\DbVersionInfo; +use Magento\Setup\Model\ObjectManagerProvider; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for checking if DB version is in sync with the code base version + */ +class DbStatusCommand extends AbstractSetupCommand +{ + /** + * Object manager provider + * + * @var ObjectManagerProvider + */ + private $objectManagerProvider; + + /** + * Deployment configuration + * + * @var DeploymentConfig + */ + private $deploymentConfig; + + /** + * Inject dependencies + * + * @param ObjectManagerProvider $objectManagerProvider + * @param DeploymentConfig $deploymentConfig + */ + public function __construct(ObjectManagerProvider $objectManagerProvider, DeploymentConfig $deploymentConfig) + { + $this->objectManagerProvider = $objectManagerProvider; + $this->deploymentConfig = $deploymentConfig; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('setup:db:status') + ->setDescription('Checks if update of DB schema or data is required'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if (!$this->deploymentConfig->isAvailable()) { + $output->writeln("<info>No information is available: the application is not installed.</info>"); + return; + } + /** @var DbVersionInfo $dbVersionInfo */ + $dbVersionInfo = $this->objectManagerProvider->get() + ->get('Magento\Framework\Module\DbVersionInfo'); + $outdated = $dbVersionInfo->getDbVersionErrors(); + if (!empty($outdated)) { + $output->writeln("<info>The module code base doesn't match the DB schema and data.</info>"); + $versionParser = new VersionParser(); + $codebaseUpdateNeeded = false; + foreach ($outdated as $row) { + if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') { + // check if module code base update is needed + $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]); + $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]); + if ($requiredVersion->matches($currentVersion)) { + $codebaseUpdateNeeded = true; + }; + } + $output->writeln(sprintf( + "<info>%20s %10s: %11s -> %-11s</info>", + $row[DbVersionInfo::KEY_MODULE], + $row[DbVersionInfo::KEY_TYPE], + $row[DbVersionInfo::KEY_CURRENT], + $row[DbVersionInfo::KEY_REQUIRED] + )); + } + if ($codebaseUpdateNeeded) { + $output->writeln( + '<info>Some modules use code versions newer or older than the database. ' . + "First update the module code, then run 'setup:upgrade'.</info>" + ); + } else { + $output->writeln("<info>Run 'setup:upgrade' to update your DB schema and data.</info>"); + } + } else { + $output->writeln('<info>All modules are up to date.</info>'); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/InfoCurrencyListCommand.php b/setup/src/Magento/Setup/Console/Command/InfoCurrencyListCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..4e2aba2b3ab857521cbffda4cdcd20b09d94b0af --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/InfoCurrencyListCommand.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; +use Magento\Setup\Model\Lists; + +/** + * Command prints list of available currencies + */ +class InfoCurrencyListCommand extends Command +{ + /** + * List model provides lists of available options for currency, language locales, timezones + * + * @var Lists + */ + private $lists; + + /** + * @param Lists $lists + */ + public function __construct(Lists $lists) + { + $this->lists = $lists; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('info:currency:list') + ->setDescription('Prints list of available currencies'); + + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + foreach ($this->lists->getCurrencyList() as $key => $currency) { + $output->writeln($key . ' => ' . $currency); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/InfoLanguageListCommand.php b/setup/src/Magento/Setup/Console/Command/InfoLanguageListCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..6066baeadda4fb8f77bf45a3b893d33406d99894 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/InfoLanguageListCommand.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; +use Magento\Setup\Model\Lists; + +/** + * Command prints list of available language locales + */ +class InfoLanguageListCommand extends Command +{ + /** + * List model provides lists of available options for currency, language locales, timezones + * + * @var Lists + */ + private $lists; + + /** + * @param Lists $lists + */ + public function __construct(Lists $lists) + { + $this->lists = $lists; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('info:language:list') + ->setDescription('Prints list of available language locales'); + + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + foreach ($this->lists->getLocaleList() as $key => $locale) { + $output->writeln($key . ' => ' . $locale); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/InfoTimezoneListCommand.php b/setup/src/Magento/Setup/Console/Command/InfoTimezoneListCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..4cb013b4dfa07041a5c95f40f581a81ca9eeb735 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/InfoTimezoneListCommand.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; +use Magento\Setup\Model\Lists; + +/** + * Command prints list of available timezones + */ +class InfoTimezoneListCommand extends Command +{ + /** + * List model provides lists of available options for currency, language locales, timezones + * + * @var Lists + */ + private $lists; + + /** + * @param Lists $lists + */ + public function __construct(Lists $lists) + { + $this->lists = $lists; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('info:timezone:list') + ->setDescription('Prints list of available timezones'); + + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + foreach ($this->lists->getTimezoneList() as $key => $timezone) { + $output->writeln($key . ' => ' . $timezone); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..2601e45b7aa1e5eb9fa960670e7055e7c9ce433f --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php @@ -0,0 +1,144 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Model\ConsoleLogger; +use Symfony\Component\Console\Input\InputOption; +use Magento\Setup\Model\ConfigModel; + +/** + * Command to install Magento application + */ +class InstallCommand extends AbstractSetupCommand +{ + /** + * Parameter indicating command whether to cleanup database in the install routine + */ + const INPUT_KEY_CLEANUP_DB = 'cleanup_database'; + + /** + * Parameter to specify an order_increment_prefix + */ + const INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX = 'sales_order_increment_prefix'; + + /** + * Parameter indicating command whether to install Sample Data + */ + const INPUT_KEY_USE_SAMPLE_DATA = 'use_sample_data'; + + /** + * Installer service factory + * + * @var InstallerFactory + */ + private $installerFactory; + + /** + * @var ConfigModel + */ + protected $configModel; + + /** + * @var InstallStoreConfigurationCommand + */ + protected $userConfig; + + /** + * @var AdminUserCreateCommand + */ + protected $adminUser; + + /** + * Constructor + * + * @param InstallerFactory $installerFactory + * @param ConfigModel $configModel + * @param InstallStoreConfigurationCommand $userConfig + * @param AdminUserCreateCommand $adminUser + */ + public function __construct( + InstallerFactory $installerFactory, + ConfigModel $configModel, + InstallStoreConfigurationCommand $userConfig, + AdminUserCreateCommand $adminUser + ) { + $this->installerFactory = $installerFactory; + $this->configModel = $configModel; + $this->userConfig = $userConfig; + $this->adminUser = $adminUser; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $inputOptions = $this->configModel->getAvailableOptions(); + $inputOptions = array_merge($inputOptions, $this->userConfig->getOptionsList()); + $inputOptions = array_merge($inputOptions, $this->adminUser->getOptionsList()); + $inputOptions = array_merge($inputOptions, [ + new InputOption( + self::INPUT_KEY_CLEANUP_DB, + null, + InputOption::VALUE_NONE, + 'Cleanup the database before installation' + ), + new InputOption( + self::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX, + null, + InputOption::VALUE_REQUIRED, + 'Sales order number prefix' + ), + new InputOption( + self::INPUT_KEY_USE_SAMPLE_DATA, + null, + InputOption::VALUE_NONE, + 'Use sample data' + ) + ]); + $this->setName('setup:install') + ->setDescription('Installs Magento Application') + ->setDefinition($inputOptions); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $consoleLogger = new ConsoleLogger($output); + $installer = $this->installerFactory->create($consoleLogger); + $installer->install($input->getOptions()); + } + + /** + * {@inheritdoc} + */ + protected function initialize(InputInterface $input, OutputInterface $output) + { + $inputOptions = $input->getOptions(); + + $configOptionsToValidate = []; + foreach ($this->configModel->getAvailableOptions() as $option) { + if (array_key_exists($option->getName(), $inputOptions)) { + $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()]; + } + } + $errors = $this->configModel->validate($configOptionsToValidate); + $errors = array_merge($errors, $this->adminUser->validate($input)); + if (!empty($errors)) { + foreach ($errors as $error) { + $output->writeln("<error>$error</error>"); + } + throw new \InvalidArgumentException('Parameters validation is failed'); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php b/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..ae4eb99fa86c4c504ac4ab4d07ecb09ee1363173 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php @@ -0,0 +1,136 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Setup\Model\ConsoleLogger; +use Magento\Framework\App\DeploymentConfig; +use Magento\Setup\Model\InstallerFactory; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Setup\Model\StoreConfigurationDataMapper; + +class InstallStoreConfigurationCommand extends AbstractSetupCommand +{ + /** + * @var InstallerFactory + */ + private $installerFactory; + + /** + * Deployment configuration + * + * @var DeploymentConfig + */ + private $deploymentConfig; + + /** + * Inject dependencies + * + * @param InstallerFactory $installerFactory + * @param DeploymentConfig $deploymentConfig + */ + public function __construct( + InstallerFactory $installerFactory, + DeploymentConfig $deploymentConfig + ) { + $this->installerFactory = $installerFactory; + $this->deploymentConfig = $deploymentConfig; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('setup:store-config:set') + ->setDescription('Installs store configuration') + ->setDefinition($this->getOptionsList()); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if (!$this->deploymentConfig->isAvailable()) { + $output->writeln( + "<info>Store settings can't be saved because the Magento application is not installed.</info>" + ); + return; + } + $installer = $this->installerFactory->create(new ConsoleLogger($output)); + $installer->installUserConfig($input->getOptions()); + } + + /** + * Get list of options for the command + * + * @return InputOption[] + */ + public function getOptionsList() + { + return [ + new InputOption( + StoreConfigurationDataMapper::KEY_BASE_URL, + null, + InputOption::VALUE_REQUIRED, + 'URL the store is supposed to be available at' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_LANGUAGE, + null, + InputOption::VALUE_REQUIRED, + 'Default language code' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_TIMEZONE, + null, + InputOption::VALUE_REQUIRED, + 'Default time zone code' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_CURRENCY, + null, + InputOption::VALUE_REQUIRED, + 'Default currency code' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_USE_SEF_URL, + null, + InputOption::VALUE_REQUIRED, + 'Use rewrites' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_IS_SECURE, + null, + InputOption::VALUE_REQUIRED, + 'Use secure URLs. Enable this option only if SSL is available.' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_BASE_URL_SECURE, + null, + InputOption::VALUE_REQUIRED, + 'Base URL for SSL connection' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN, + null, + InputOption::VALUE_REQUIRED, + 'Run admin interface with SSL' + ), + new InputOption( + StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY, + null, + InputOption::VALUE_REQUIRED, + 'Whether to use a "security key" feature in Magento Admin URLs and forms' + ), + ]; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/MaintenanceAllowIpsCommand.php b/setup/src/Magento/Setup/Console/Command/MaintenanceAllowIpsCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..3aad4d09d16036e24d3dc9265cf0feca8ec4ba70 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/MaintenanceAllowIpsCommand.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Framework\App\MaintenanceMode; +use Magento\Framework\Module\ModuleList; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for setting allowed IPs in maintenance mode + */ +class MaintenanceAllowIpsCommand extends AbstractSetupCommand +{ + /** + * Names of input arguments or options + */ + const INPUT_KEY_IP = 'ip'; + const INPUT_KEY_NONE = 'none'; + + /** + * @var MaintenanceMode $maintenanceMode + */ + private $maintenanceMode; + + /** + * Constructor + * + * @param MaintenanceMode $maintenanceMode + */ + public function __construct(MaintenanceMode $maintenanceMode) + { + $this->maintenanceMode = $maintenanceMode; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $arguments = [ + new InputArgument( + self::INPUT_KEY_IP, + InputArgument::OPTIONAL | InputArgument::IS_ARRAY, + 'Allowed IP addresses' + ), + ]; + $options = [ + new InputOption( + self::INPUT_KEY_NONE, + null, + InputOption::VALUE_NONE, + 'Clear allowed IP addresses' + ), + ]; + $this->setName('maintenance:allow-ips') + ->setDescription('Sets maintenance mode exempt IPs') + ->setDefinition(array_merge($arguments, $options)); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if (!$input->getOption(self::INPUT_KEY_NONE)) { + $addresses = $input->getArgument(self::INPUT_KEY_IP); + if (!empty($addresses)) { + $this->maintenanceMode->setAddresses(implode(',', $addresses)); + $output->writeln( + '<info>Set exempt IP-addresses: ' . implode(', ', $this->maintenanceMode->getAddressInfo()) . + '</info>' + ); + } + } else { + $this->maintenanceMode->setAddresses(''); + $output->writeln('<info>Set exempt IP-addresses: none</info>'); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/MaintenanceDisableCommand.php b/setup/src/Magento/Setup/Console/Command/MaintenanceDisableCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..988c0628c4d86d02890f322b10af740d9ccd858b --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/MaintenanceDisableCommand.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +/** + * Command for disabling maintenance mode + */ +class MaintenanceDisableCommand extends AbstractMaintenanceCommand +{ + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('maintenance:disable')->setDescription('Disables maintenance mode'); + parent::configure(); + } + + /** + * Disable maintenance mode + * + * @return bool + */ + protected function isEnable() + { + return false; + } + + /** + * Get disabled maintenance mode display string + * + * @return string + */ + protected function getDisplayString() + { + return '<info>Disabled maintenance mode</info>'; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/MaintenanceEnableCommand.php b/setup/src/Magento/Setup/Console/Command/MaintenanceEnableCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..85c1579ce659fed69c63f5e71de46d83acb2c14c --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/MaintenanceEnableCommand.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +/** + * Command for enabling maintenance mode + */ +class MaintenanceEnableCommand extends AbstractMaintenanceCommand +{ + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('maintenance:enable')->setDescription('Enables maintenance mode'); + parent::configure(); + } + + /** + * Enable maintenance mode + * + * @return bool + */ + protected function isEnable() + { + return true; + } + + /** + * Get enabled maintenance mode display string + * + * @return string + */ + protected function getDisplayString() + { + return '<info>Enabled maintenance mode</info>'; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/MaintenanceStatusCommand.php b/setup/src/Magento/Setup/Console/Command/MaintenanceStatusCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..9ff1c2f97c23f822f676973a90e2938e1bdc0a4b --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/MaintenanceStatusCommand.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Magento\Framework\App\MaintenanceMode; +use Magento\Framework\Module\ModuleList; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for checking maintenance mode status + */ +class MaintenanceStatusCommand extends AbstractSetupCommand +{ + /** + * @var MaintenanceMode $maintenanceMode + */ + private $maintenanceMode; + + /** + * Constructor + * + * @param MaintenanceMode $maintenanceMode + */ + public function __construct(MaintenanceMode $maintenanceMode) + { + $this->maintenanceMode = $maintenanceMode; + parent::__construct(); + } + + /** + * Initialization of the command + * + * @return void + */ + protected function configure() + { + $this->setName('maintenance:status') + ->setDescription('Checks maintenance mode status'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln( + '<info>Status: maintenance mode is ' . + ($this->maintenanceMode->isOn() ? 'active' : 'not active') . '</info>' + ); + $addressInfo = $this->maintenanceMode->getAddressInfo(); + $addresses = implode(', ', $addressInfo); + $output->writeln('<info>List of exempt IP-addresses: ' . ($addresses ? $addresses : 'none') . '</info>'); + } +} diff --git a/setup/src/Magento/Setup/Console/Command/ModuleDisableCommand.php b/setup/src/Magento/Setup/Console/Command/ModuleDisableCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..4e12c46331fca12d966f9bc247b8e9fd4840d36f --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/ModuleDisableCommand.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +/** + * Command for disabling list or all of modules + */ +class ModuleDisableCommand extends AbstractModuleCommand +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('module:disable') + ->setDescription('Disables specified modules'); + parent::configure(); + } + + /** + * Disable modules + * + * @return bool + */ + protected function isEnable() + { + return false; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/ModuleEnableCommand.php b/setup/src/Magento/Setup/Console/Command/ModuleEnableCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..0efc1d8928aafd83fe8950a28d8ccf9b1af41224 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/ModuleEnableCommand.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +/** + * Command for enabling list or all of modules + */ +class ModuleEnableCommand extends AbstractModuleCommand +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('module:enable') + ->setDescription('Enables specified modules'); + parent::configure(); + } + + /** + * Enable modules + * + * @return bool + */ + protected function isEnable() + { + return true; + } +} diff --git a/setup/src/Magento/Setup/Console/Command/ModuleStatusCommand.php b/setup/src/Magento/Setup/Console/Command/ModuleStatusCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..4d802b17637f94495b1324ed723fc77a532ae630 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/ModuleStatusCommand.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Magento\Setup\Model\ObjectManagerProvider; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Command for displaying status of modules + */ +class ModuleStatusCommand extends AbstractSetupCommand +{ + /** + * Object manager provider + * + * @var ObjectManagerProvider + */ + private $objectManagerProvider; + + /** + * Inject dependencies + * + * @param ObjectManagerProvider $objectManagerProvider + */ + public function __construct(ObjectManagerProvider $objectManagerProvider) + { + $this->objectManagerProvider = $objectManagerProvider; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('module:status') + ->setDescription('Displays status of modules'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $moduleList = $this->objectManagerProvider->get()->create('Magento\Framework\Module\ModuleList'); + $output->writeln('<info>List of enabled modules:</info>'); + $enabledModules = $moduleList->getNames(); + if (count($enabledModules) === 0) { + $output->writeln('None'); + } else { + $output->writeln(join("\n", $enabledModules)); + } + $output->writeln(''); + + $fullModuleList = $this->objectManagerProvider->get()->create('Magento\Framework\Module\FullModuleList'); + $output->writeln("<info>List of disabled modules:</info>"); + $disabledModules = array_diff($fullModuleList->getNames(), $enabledModules); + if (count($disabledModules) === 0) { + $output->writeln('None'); + } else { + $output->writeln(join("\n", $disabledModules)); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/UninstallCommand.php b/setup/src/Magento/Setup/Console/Command/UninstallCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..0982c6381974d08b8fbd2663b2f9ef700580697b --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/UninstallCommand.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\ConfirmationQuestion; +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Model\ConsoleLogger; + +class UninstallCommand extends AbstractSetupCommand +{ + /** + * @var InstallerFactory + */ + private $installerFactory; + + /** + * @param InstallerFactory $installerFactory + */ + public function __construct(InstallerFactory $installerFactory) + { + $this->installerFactory = $installerFactory; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('setup:uninstall') + ->setDescription('Uninstalls Magento application'); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + $question = new ConfirmationQuestion('Are you sure you want to uninstall Magento?[y/N]', false); + + if ($helper->ask($input, $output, $question) || !$input->isInteractive()) { + $installer = $this->installerFactory->create(new ConsoleLogger($output)); + $installer->uninstall(); + } + } +} diff --git a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..2c7b54bd294f1ed79d6669ed737348d718bcf4f8 --- /dev/null +++ b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Console\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Model\ConsoleLogger; + +/** + * Command for updating installed application after the code base has changed + */ +class UpgradeCommand extends AbstractSetupCommand +{ + /** + * Installer service factory + * + * @var InstallerFactory + */ + private $installerFactory; + + /** + * Constructor + * + * @param InstallerFactory $installerFactory + */ + public function __construct(InstallerFactory $installerFactory) + { + $this->installerFactory = $installerFactory; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('setup:upgrade') + ->setDescription( + 'Upgrades installed application after the code base has changed, ' + . 'including DB schema and data' + ); + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $installer = $this->installerFactory->create(new ConsoleLogger($output)); + $installer->updateModulesSequence(); + $installer->installSchema(); + $installer->installDataFixtures(); + } +} diff --git a/setup/src/Magento/Setup/Console/CommandList.php b/setup/src/Magento/Setup/Console/CommandList.php index 0a4f4ef8f281ac3ba882013ed070677cb5968fae..a75ed3b3226553a09390a93911b076192422c820 100644 --- a/setup/src/Magento/Setup/Console/CommandList.php +++ b/setup/src/Magento/Setup/Console/CommandList.php @@ -10,8 +10,6 @@ use Zend\ServiceManager\ServiceManager; /** * Class CommandList contains predefined list of commands for Setup - * - * @package Magento\Setup\Console */ class CommandList { @@ -40,7 +38,25 @@ class CommandList protected function getCommandsClasses() { return [ + 'Magento\Setup\Console\Command\AdminUserCreateCommand', 'Magento\Setup\Console\Command\ConfigSetCommand', + 'Magento\Setup\Console\Command\DbDataUpgradeCommand', + 'Magento\Setup\Console\Command\DbSchemaUpgradeCommand', + 'Magento\Setup\Console\Command\DbStatusCommand', + 'Magento\Setup\Console\Command\InfoCurrencyListCommand', + 'Magento\Setup\Console\Command\InfoLanguageListCommand', + 'Magento\Setup\Console\Command\InfoTimezoneListCommand', + 'Magento\Setup\Console\Command\InstallCommand', + 'Magento\Setup\Console\Command\InstallStoreConfigurationCommand', + 'Magento\Setup\Console\Command\ModuleEnableCommand', + 'Magento\Setup\Console\Command\ModuleDisableCommand', + 'Magento\Setup\Console\Command\ModuleStatusCommand', + 'Magento\Setup\Console\Command\MaintenanceAllowIpsCommand', + 'Magento\Setup\Console\Command\MaintenanceDisableCommand', + 'Magento\Setup\Console\Command\MaintenanceEnableCommand', + 'Magento\Setup\Console\Command\MaintenanceStatusCommand', + 'Magento\Setup\Console\Command\UpgradeCommand', + 'Magento\Setup\Console\Command\UninstallCommand', ]; } diff --git a/setup/src/Magento/Setup/Controller/ConsoleController.php b/setup/src/Magento/Setup/Controller/ConsoleController.php deleted file mode 100644 index eb0ca1f1d1e79cd90eb74511a00aa934c9227a33..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Controller/ConsoleController.php +++ /dev/null @@ -1,689 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Controller; - -use Composer\Package\Version\VersionParser; -use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList; -use Magento\Framework\App\MaintenanceMode; -use Magento\Setup\Model\AdminAccount; -use Magento\Framework\Config\ConfigOptionsList as SetupConfigOptionsList; -use Magento\Setup\Model\ConsoleLogger; -use Magento\Setup\Model\Installer; -use Magento\Setup\Model\InstallerFactory; -use Magento\Setup\Model\Lists; -use Magento\Setup\Model\UserConfigurationDataMapper as UserConfig; -use Magento\Setup\Mvc\Bootstrap\InitParamListener; -use Zend\Console\Request as ConsoleRequest; -use Zend\EventManager\EventManagerInterface; -use Zend\Mvc\Controller\AbstractActionController; -use Magento\Setup\Model\ObjectManagerProvider; -use Magento\Framework\Module\DbVersionInfo; - -/** - * Controller that handles all setup commands via command line interface. - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class ConsoleController extends AbstractActionController -{ - /**#@+ - * Supported command types - */ - const CMD_HELP = 'help'; - const CMD_INSTALL = 'install'; - const CMD_INSTALL_CONFIG = 'install-configuration'; - const CMD_INSTALL_SCHEMA = 'install-schema'; - const CMD_INSTALL_DATA = 'install-data'; - const CMD_INSTALL_USER_CONFIG = 'install-user-configuration'; - const CMD_INSTALL_ADMIN_USER = 'install-admin-user'; - const CMD_UPDATE = 'update'; - const CMD_DB_STATUS = 'db-status'; - const CMD_UNINSTALL = 'uninstall'; - const CMD_MAINTENANCE = 'maintenance'; - const CMD_MODULE_ENABLE = 'module-enable'; - const CMD_MODULE_DISABLE = 'module-disable'; - /**#@- */ - - /** - * Help option for retrieving list of modules - */ - const HELP_LIST_OF_MODULES = 'module-list'; - - /** - * Map of controller actions exposed in CLI - * - * @var string[] - */ - private static $actions = [ - self::CMD_HELP => 'help', - self::CMD_INSTALL => 'install', - self::CMD_INSTALL_SCHEMA => 'installSchema', - self::CMD_INSTALL_DATA => 'installData', - self::CMD_INSTALL_USER_CONFIG => 'installUserConfig', - self::CMD_INSTALL_ADMIN_USER => 'installAdminUser', - self::CMD_UPDATE => 'update', - self::CMD_DB_STATUS => 'dbStatus', - self::CMD_UNINSTALL => 'uninstall', - self::CMD_MAINTENANCE => 'maintenance', - self::CMD_MODULE_ENABLE => 'module', - self::CMD_MODULE_DISABLE => 'module', - ]; - - /** - * Options for "help" command - * - * @var string[] - */ - private static $helpOptions = [ - self::CMD_INSTALL, - self::CMD_INSTALL_SCHEMA, - self::CMD_INSTALL_DATA, - self::CMD_INSTALL_USER_CONFIG, - self::CMD_INSTALL_ADMIN_USER, - self::CMD_UPDATE, - self::CMD_DB_STATUS, - self::CMD_UNINSTALL, - self::CMD_MAINTENANCE, - self::CMD_MODULE_ENABLE, - self::CMD_MODULE_DISABLE, - UserConfig::KEY_LANGUAGE, - UserConfig::KEY_CURRENCY, - UserConfig::KEY_TIMEZONE, - self::HELP_LIST_OF_MODULES, - ]; - - /** - * Logger - * - * @var ConsoleLogger - */ - private $log; - - /** - * Options Lists - * - * @var Lists - */ - private $options; - - /** - * Installer service - * - * @var Installer - */ - private $installer; - - /** - * Object manager provider - * - * @var ObjectManagerProvider - */ - private $objectManagerProvider; - - /** - * Gets router configuration to be used in module definition - * - * @return array - */ - public static function getRouterConfig() - { - $result = []; - $config = self::getCliConfig(); - foreach (self::$actions as $type => $action) { - $result[$type] = ['options' => [ - 'route' => $config[$type]['route'], - 'defaults' => ['controller' => __CLASS__, 'action' => $action], - ]]; - } - return $result; - } - - /** - * Gets console usage to be used in module definition - * - * @return array - */ - public static function getConsoleUsage() - { - $result = ["Usage:\n"]; - foreach (self::getCliConfig() as $cmd) { - $result[$cmd['usage_short']] = $cmd['usage_desc']; - } - foreach (self::$helpOptions as $type) { - $result[] = ' ' . ConsoleController::CMD_HELP . ' ' . $type; - } - return $result; - } - - /** - * Gets command usage - * - * @return array - */ - public static function getCommandUsage() - { - $result = []; - foreach (self::getCliConfig() as $key => $cmd) { - $result[$key] = $cmd['usage']; - } - return $result; - } - - /** - * The CLI that this controller implements - * - * @return array - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - private static function getCliConfig() - { - $deployConfig = '--' . SetupConfigOptionsList::INPUT_KEY_DB_HOST . '=' - . ' --' . SetupConfigOptionsList::INPUT_KEY_DB_NAME . '=' - . ' --' . SetupConfigOptionsList::INPUT_KEY_DB_USER . '=' - . ' --' . BackendConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME . '=' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_DB_PASS . '=]' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_DB_PREFIX . '=]' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_DB_MODEL . '=]' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS . '=]' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_SESSION_SAVE . '=]' - . ' [--' . SetupConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY . '=]' - . ' [--' . Installer::ENABLE_MODULES . '=]' - . ' [--' . Installer::DISABLE_MODULES . '=]'; - $userConfig = '[--' . UserConfig::KEY_BASE_URL . '=]' - . ' [--' . UserConfig::KEY_LANGUAGE . '=]' - . ' [--' . UserConfig::KEY_TIMEZONE . '=]' - . ' [--' . UserConfig::KEY_CURRENCY . '=]' - . ' [--' . UserConfig::KEY_USE_SEF_URL . '=]' - . ' [--' . UserConfig::KEY_IS_SECURE . '=]' - . ' [--' . UserConfig::KEY_BASE_URL_SECURE . '=]' - . ' [--' . UserConfig::KEY_IS_SECURE_ADMIN . '=]' - . ' [--' . UserConfig::KEY_ADMIN_USE_SECURITY_KEY . '=]'; - $adminUser = '--' . AdminAccount::KEY_USERNAME . '=' - . ' --' . AdminAccount::KEY_PASSWORD . '=' - . ' --' . AdminAccount::KEY_EMAIL . '=' - . ' --' . AdminAccount::KEY_FIRST_NAME . '=' - . ' --' . AdminAccount::KEY_LAST_NAME . '='; - $salesConfig = '[--' . Installer::SALES_ORDER_INCREMENT_PREFIX . '=]'; - return [ - self::CMD_INSTALL => [ - 'route' => self::CMD_INSTALL - . " {$deployConfig} {$userConfig} {$adminUser} {$salesConfig}" - . ' [--' . Installer::CLEANUP_DB . ']' - . ' [--' . Installer::USE_SAMPLE_DATA . '=]', - 'usage' => "{$deployConfig} {$userConfig} {$adminUser} {$salesConfig}" - . ' [--' . Installer::CLEANUP_DB . ']' - . ' [--' . Installer::USE_SAMPLE_DATA . '=]', - 'usage_short' => self::CMD_INSTALL . ' <options>', - 'usage_desc' => 'Install Magento application', - ], - self::CMD_UPDATE => [ - 'route' => self::CMD_UPDATE, - 'usage' => '', - 'usage_short' => self::CMD_UPDATE, - 'usage_desc' => 'Update database schema and data', - ], - self::CMD_DB_STATUS => [ - 'route' => self::CMD_DB_STATUS, - 'usage' => '', - 'usage_short' => self::CMD_DB_STATUS, - 'usage_desc' => 'Check if update of DB schema or data is required', - ], - self::CMD_UNINSTALL => [ - 'route' => self::CMD_UNINSTALL, - 'usage' => '', - 'usage_short' => self::CMD_UNINSTALL, - 'usage_desc' => 'Uninstall Magento application', - ], - self::CMD_INSTALL_SCHEMA => [ - 'route' => self::CMD_INSTALL_SCHEMA, - 'usage' => '', - 'usage_short' => self::CMD_INSTALL_SCHEMA, - 'usage_desc' => 'Install DB schema', - ], - self::CMD_INSTALL_DATA => [ - 'route' => self::CMD_INSTALL_DATA, - 'usage' => '', - 'usage_short' => self::CMD_INSTALL_DATA, - 'usage_desc' => 'Install data fixtures', - ], - self::CMD_INSTALL_USER_CONFIG => [ - 'route' => self::CMD_INSTALL_USER_CONFIG . ' ' . $userConfig, - 'usage' => $userConfig, - 'usage_short' => self::CMD_INSTALL_USER_CONFIG . ' <options>', - 'usage_desc' => 'Install user configuration', - ], - self::CMD_INSTALL_ADMIN_USER => [ - 'route' => self::CMD_INSTALL_ADMIN_USER . ' ' . $adminUser, - 'usage' => $adminUser, - 'usage_short' => self::CMD_INSTALL_ADMIN_USER . ' <options>', - 'usage_desc' => 'Install admin user account', - ], - self::CMD_MAINTENANCE => [ - 'route' => self::CMD_MAINTENANCE . ' [--set=] [--addresses=]', - 'usage' => '[--set=1|0] [--addresses=127.0.0.1,...|none]', - 'usage_short' => self::CMD_MAINTENANCE, - 'usage_desc' => 'Set maintenance mode, optionally for specified addresses', - ], - self::CMD_MODULE_ENABLE => [ - 'route' => self::CMD_MODULE_ENABLE . ' --modules= [--force]', - 'usage' => '--modules=Module_Foo,Module_Bar [--force]', - 'usage_short' => self::CMD_MODULE_ENABLE, - 'usage_desc' => 'Enable specified modules' - ], - self::CMD_MODULE_DISABLE => [ - 'route' => self::CMD_MODULE_DISABLE . ' --modules= [--force]', - 'usage' => '--modules=Module_Foo,Module_Bar [--force]', - 'usage_short' => self::CMD_MODULE_DISABLE, - 'usage_desc' => 'Disable specified modules' - ], - self::CMD_HELP => [ - 'route' => self::CMD_HELP . ' [' . implode('|', self::$helpOptions) . ']:type', - 'usage' => '<' . implode('|', self::$helpOptions) . '>', - 'usage_short' => self::CMD_HELP . ' <topic>', - 'usage_desc' => 'Help about particular command or topic:', - ], - ]; - } - - /** - * Constructor - * - * @param ConsoleLogger $consoleLogger - * @param Lists $options - * @param InstallerFactory $installerFactory - * @param MaintenanceMode $maintenanceMode - * @param ObjectManagerProvider $objectManagerProvider - */ - public function __construct( - ConsoleLogger $consoleLogger, - Lists $options, - InstallerFactory $installerFactory, - MaintenanceMode $maintenanceMode, - ObjectManagerProvider $objectManagerProvider - ) { - $this->log = $consoleLogger; - $this->options = $options; - $this->installer = $installerFactory->create($consoleLogger); - $this->maintenanceMode = $maintenanceMode; - $this->objectManagerProvider = $objectManagerProvider; - // By default we use our customized error handler, but for CLI we want to display all errors - restore_error_handler(); - } - - /** - * Adding Check for Allowing only console application to come through - * - * {@inheritdoc} - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function setEventManager(EventManagerInterface $events) - { - parent::setEventManager($events); - $controller = $this; - $events->attach('dispatch', function ($action) use ($controller) { - /** @var $action \Zend\Mvc\Controller\AbstractActionController */ - // Make sure that we are running in a console and the user has not tricked our - // application into running this action from a public web server. - if (!$action->getRequest() instanceof ConsoleRequest) { - throw new \RuntimeException('You can only use this action from a console!'); - } - }, 100); // execute before executing action logic - return $this; - } - - /** - * {@inheritdoc} - */ - public function onDispatch(\Zend\Mvc\MvcEvent $e) - { - try { - return parent::onDispatch($e); - } catch (\Magento\Setup\Exception $exception) { - $this->log->log($exception->getMessage()); - return $this->getResponse(); - } - } - - /** - * Controller for Install Command - * - * @return void - */ - public function installAction() - { - /** @var \Zend\Console\Request $request */ - $request = $this->getRequest(); - $this->installer->install($request->getParams()); - } - - /** - * Installs and updates database schema - * - * @return void - */ - public function installSchemaAction() - { - $this->installer->installSchema(); - } - - /** - * Installs and updates data fixtures - * - * @return void - */ - public function installDataAction() - { - $this->installer->installDataFixtures(); - } - - /** - * Updates database schema and data - * - * @return void - */ - public function updateAction() - { - $this->installer->updateModulesSequence(); - $this->installer->installSchema(); - $this->installer->installDataFixtures(); - } - - /** - * Checks if DB schema or data upgrade is required - * - * @return void - */ - public function dbStatusAction() - { - /** @var DbVersionInfo $dbVersionInfo */ - $dbVersionInfo = $this->objectManagerProvider->get() - ->get('Magento\Framework\Module\DbVersionInfo'); - $outdated = $dbVersionInfo->getDbVersionErrors(); - if (!empty($outdated)) { - $this->log->log("The module code base doesn't match the DB schema and data."); - $versionParser = new VersionParser(); - $codebaseUpdateNeeded = false; - foreach ($outdated as $row) { - if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') { - // check if module code base update is needed - $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]); - $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]); - if ($requiredVersion->matches($currentVersion)) { - $codebaseUpdateNeeded = true; - }; - } - $this->log->log(sprintf( - "%20s %10s: %11s -> %-11s", - $row[DbVersionInfo::KEY_MODULE], - $row[DbVersionInfo::KEY_TYPE], - $row[DbVersionInfo::KEY_CURRENT], - $row[DbVersionInfo::KEY_REQUIRED] - )); - } - if ($codebaseUpdateNeeded) { - $this->log->log( - 'Some modules use code versions newer or older than the database. ' . - 'First update the module code, then run the "Update" command.' - ); - } else { - $this->log->log('Run the "Update" command to update your DB schema and data'); - } - } else { - $this->log->log('All modules are up to date'); - } - } - - /** - * Installs user configuration - * - * @return void - */ - public function installUserConfigAction() - { - /** @var \Zend\Console\Request $request */ - $request = $this->getRequest(); - $this->installer->installUserConfig($request->getParams()); - } - - /** - * Installs admin user - * - * @return void - */ - public function installAdminUserAction() - { - /** @var \Zend\Console\Request $request */ - $request = $this->getRequest(); - $this->installer->installAdminUser($request->getParams()); - } - - /** - * Controller for Uninstall Command - * - * @return void - */ - public function uninstallAction() - { - $this->installer->uninstall(); - } - - /** - * Action for "maintenance" command - * - * @return void - * @SuppressWarnings(PHPMD.NPathComplexity) - * - */ - public function maintenanceAction() - { - /** @var \Zend\Console\Request $request */ - $request = $this->getRequest(); - $set = $request->getParam('set'); - $addresses = $request->getParam('addresses'); - - if (null !== $set) { - if (1 == $set) { - $this->log->log('Enabling maintenance mode...'); - $this->maintenanceMode->set(true); - } else { - $this->log->log('Disabling maintenance mode...'); - $this->maintenanceMode->set(false); - } - } - if (null !== $addresses) { - $addresses = ('none' == $addresses) ? '' : $addresses; - $this->maintenanceMode->setAddresses($addresses); - } - - $this->log->log('Status: maintenance mode is ' . ($this->maintenanceMode->isOn() ? 'active' : 'not active')); - $addressInfo = $this->maintenanceMode->getAddressInfo(); - if (!empty($addressInfo)) { - $addresses = implode(', ', $addressInfo); - $this->log->log('List of exempt IP-addresses: ' . ($addresses ? $addresses : 'none')); - } - } - - /** - * Action for enabling or disabling modules - * - * @return void - * @throws \Magento\Setup\Exception - */ - public function moduleAction() - { - /** @var \Zend\Console\Request $request */ - $request = $this->getRequest(); - $isEnable = $request->getParam(0) == self::CMD_MODULE_ENABLE; - $modules = explode(',', $request->getParam('modules')); - /** @var \Magento\Framework\Module\Status $status */ - $status = $this->objectManagerProvider->get()->create('Magento\Framework\Module\Status'); - - $modulesToChange = $status->getModulesToChange($isEnable, $modules); - $message = ''; - if (!empty($modulesToChange)) { - if (!$request->getParam('force')) { - $constraints = $status->checkConstraints($isEnable, $modulesToChange); - if ($constraints) { - $message .= "Unable to change status of modules because of the following constraints:\n" - . implode("\n", $constraints); - throw new \Magento\Setup\Exception($message); - } - } else { - $message .= 'Alert: Your store may not operate properly because of ' - . "dependencies and conflicts of this module(s).\n"; - } - $status->setIsEnabled($isEnable, $modulesToChange); - $updateAfterEnableMessage = ''; - if ($isEnable) { - $message .= 'The following modules have been enabled:'; - $updateAfterEnableMessage = "\nTo make sure that the enabled modules are properly registered," - . " run 'update' command."; - } else { - $message .= 'The following modules have been disabled:'; - } - $message .= ' ' . implode(', ', $modulesToChange) . $updateAfterEnableMessage; - } else { - $message .= 'There have been no changes to any modules.'; - } - $this->log->log($message); - } - - /** - * Shows necessary information for installing Magento - * - * @return string - * @throws \InvalidArgumentException - */ - public function helpAction() - { - $type = $this->getRequest()->getParam('type'); - if ($type === false) { - $usageInfo = $this->formatConsoleFullUsageInfo( - array_merge(self::getConsoleUsage(), InitParamListener::getConsoleUsage()) - ); - return $usageInfo; - } - switch($type) { - case UserConfig::KEY_LANGUAGE: - return $this->arrayToString($this->options->getLocaleList()); - case UserConfig::KEY_CURRENCY: - return $this->arrayToString($this->options->getCurrencyList()); - case UserConfig::KEY_TIMEZONE: - return $this->arrayToString($this->options->getTimezoneList()); - case self::HELP_LIST_OF_MODULES: - return $this->getModuleListMsg(); - default: - $usages = self::getCommandUsage(); - if (isset($usages[$type])) { - if ($usages[$type]) { - $formatted = $this->formatCliUsage($usages[$type]); - return "\nAvailable parameters:\n{$formatted}\n"; - } - return "\nThis command has no parameters.\n"; - } - throw new \InvalidArgumentException("Unknown type: {$type}"); - } - } - - /** - * Formats full usage info for console when user inputs 'help' command with no type - * - * @param array $usageInfo - * @return string - */ - private function formatConsoleFullUsageInfo($usageInfo) - { - $result = "\n==-------------------==\n" - . " Magento Setup CLI \n" - . "==-------------------==\n"; - $mask = "%-50s %-30s\n"; - $script = 'index.php'; - foreach ($usageInfo as $key => $value) { - if ($key === 0) { - $result .= sprintf($mask, "\n$value", ''); - } elseif (is_numeric($key)) { - if (is_array($value)) { - $result .= sprintf($mask, " " . $value[0], $value[1]); - } else { - $result .= sprintf($mask, '', $value); - } - } else { - $result .= sprintf($mask, " $script " . $key, $value); - } - } - return $result; - } - - /** - * Formats output of "usage" into more readable format by grouping required/optional parameters and wordwrapping - * - * @param string $text - * @return string - */ - private function formatCliUsage($text) - { - $result = ['required' => [], 'optional' => []]; - foreach (explode(' ', $text) as $value) { - if (empty($value)) { - continue; - } - if (strpos($value, '[') === 0) { - $group = 'optional'; - } else { - $group = 'required'; - } - $result[$group][] = $value; - } - - return wordwrap(implode(' ', $result['required']) . "\n" . implode(' ', $result['optional']), 120); - } - - /** - * Convert an array to string - * - * @param array $input - * @return string - */ - private function arrayToString($input) - { - $result = ''; - foreach ($input as $key => $value) { - $result .= "$key => $value\n"; - } - return $result; - } - - /** - * Get formatted message containing list of enabled and disabled modules - * - * @return string - */ - private function getModuleListMsg() - { - $moduleList = $this->objectManagerProvider->get()->create('Magento\Framework\Module\ModuleList'); - $result = "\nList of enabled modules:\n"; - $enabledModuleList = $moduleList->getNames(); - foreach ($enabledModuleList as $moduleName) { - $result .= "$moduleName\n"; - } - if (count($enabledModuleList) === 0) { - $result .= "None\n"; - } - - $fullModuleList = $this->objectManagerProvider->get()->create('Magento\Framework\Module\FullModuleList'); - $result .= "\nList of disabled modules:\n"; - $disabledModuleList = array_diff($fullModuleList->getNames(), $enabledModuleList); - foreach ($disabledModuleList as $moduleName) { - $result .= "$moduleName\n"; - } - if (count($disabledModuleList) === 0) { - $result .= "None\n"; - } - - return $result; - } -} diff --git a/setup/src/Magento/Setup/Controller/Install.php b/setup/src/Magento/Setup/Controller/Install.php index 0618df92d08c81e9974c73079cf7ab6a66e8d078..87ca5ba26940acc55ddbe6b159aba0f0f01afe37 100644 --- a/setup/src/Magento/Setup/Controller/Install.php +++ b/setup/src/Magento/Setup/Controller/Install.php @@ -12,12 +12,13 @@ use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList; use Magento\Setup\Model\Installer; use Magento\Setup\Model\Installer\ProgressFactory; use Magento\Setup\Model\InstallerFactory; -use Magento\Setup\Model\UserConfigurationDataMapper as UserConfig; +use Magento\Setup\Model\StoreConfigurationDataMapper as UserConfig; use Magento\Setup\Model\WebLogger; use Zend\Json\Json; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\JsonModel; use Zend\View\Model\ViewModel; +use Magento\Setup\Console\Command\InstallCommand; /** * Install controller @@ -131,7 +132,7 @@ class Install extends AbstractActionController $result[SetupConfigOptionsList::INPUT_KEY_DB_HOST] = isset($source['db']['host']) ? $source['db']['host'] : ''; $result[SetupConfigOptionsList::INPUT_KEY_DB_NAME] = isset($source['db']['name']) ? $source['db']['name'] : ''; $result[SetupConfigOptionsList::INPUT_KEY_DB_USER] = isset($source['db']['user']) ? $source['db']['user'] :''; - $result[SetupConfigOptionsList::INPUT_KEY_DB_PASS] = + $result[SetupConfigOptionsList::INPUT_KEY_DB_PASSWORD] = isset($source['db']['password']) ? $source['db']['password'] : ''; $result[SetupConfigOptionsList::INPUT_KEY_DB_PREFIX] = isset($source['db']['tablePrefix']) ? $source['db']['tablePrefix'] : ''; @@ -175,7 +176,7 @@ class Install extends AbstractActionController ? $source['store']['timezone'] : ''; $result[UserConfig::KEY_CURRENCY] = isset($source['store']['currency']) ? $source['store']['currency'] : ''; - $result[Installer::USE_SAMPLE_DATA] = isset($source['store']['useSampleData']) + $result[InstallCommand::INPUT_KEY_USE_SAMPLE_DATA] = isset($source['store']['useSampleData']) ? $source['store']['useSampleData'] : ''; return $result; } @@ -189,11 +190,11 @@ class Install extends AbstractActionController { $source = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY); $result = []; - $result[AdminAccount::KEY_USERNAME] = isset($source['admin']['username']) ? $source['admin']['username'] : ''; + $result[AdminAccount::KEY_USER] = isset($source['admin']['username']) ? $source['admin']['username'] : ''; $result[AdminAccount::KEY_PASSWORD] = isset($source['admin']['password']) ? $source['admin']['password'] : ''; $result[AdminAccount::KEY_EMAIL] = isset($source['admin']['email']) ? $source['admin']['email'] : ''; - $result[AdminAccount::KEY_FIRST_NAME] = $result[AdminAccount::KEY_USERNAME]; - $result[AdminAccount::KEY_LAST_NAME] = $result[AdminAccount::KEY_USERNAME]; + $result[AdminAccount::KEY_FIRST_NAME] = $result[AdminAccount::KEY_USER]; + $result[AdminAccount::KEY_LAST_NAME] = $result[AdminAccount::KEY_USER]; return $result; } } diff --git a/setup/src/Magento/Setup/Model/AdminAccount.php b/setup/src/Magento/Setup/Model/AdminAccount.php index 2bd64aaecd675d2315be375e6a8761ab8d733b16..7e52b2b604e10f76f660e28d50f26cf59f3d2c6e 100644 --- a/setup/src/Magento/Setup/Model/AdminAccount.php +++ b/setup/src/Magento/Setup/Model/AdminAccount.php @@ -17,7 +17,7 @@ class AdminAccount /**#@+ * Data keys */ - const KEY_USERNAME = 'admin_username'; + const KEY_USER = 'admin_user'; const KEY_PASSWORD = 'admin_password'; const KEY_EMAIL = 'admin_email'; const KEY_FIRST_NAME = 'admin_firstname'; @@ -102,7 +102,7 @@ class AdminAccount $result = $this->setup->getConnection()->fetchRow( 'SELECT user_id, username, email FROM ' . $this->setup->getTable('admin_user') . ' ' . 'WHERE username = :username OR email = :email', - ['username' => $this->data[self::KEY_USERNAME], 'email' => $this->data[self::KEY_EMAIL]] + ['username' => $this->data[self::KEY_USER], 'email' => $this->data[self::KEY_EMAIL]] ); if (!empty($result)) { @@ -113,11 +113,11 @@ class AdminAccount $this->setup->getConnection()->update( $this->setup->getTable('admin_user'), $adminData, - $this->setup->getConnection()->quoteInto('username = ?', $this->data[self::KEY_USERNAME]) + $this->setup->getConnection()->quoteInto('username = ?', $this->data[self::KEY_USER]) ); } else { // User does not exist, create it - $adminData['username'] = $this->data[self::KEY_USERNAME]; + $adminData['username'] = $this->data[self::KEY_USER]; $adminData['email'] = $this->data[self::KEY_EMAIL]; $adminData['extra'] = serialize(null); $this->setup->getConnection()->insert( @@ -140,18 +140,18 @@ class AdminAccount private function validateUserMatches($username, $email) { if ((strcasecmp($email, $this->data[self::KEY_EMAIL]) == 0) && - (strcasecmp($username, $this->data[self::KEY_USERNAME]) != 0)) { + (strcasecmp($username, $this->data[self::KEY_USER]) != 0)) { // email matched but username did not throw new \Exception( - 'An existing user has the given email but different username. ' . self::KEY_USERNAME . + 'An existing user has the given email but different username. ' . self::KEY_USER . ' and ' . self::KEY_EMAIL . ' both need to match an existing user or both be new.' ); } - if ((strcasecmp($username, $this->data[self::KEY_USERNAME]) == 0) && + if ((strcasecmp($username, $this->data[self::KEY_USER]) == 0) && (strcasecmp($email, $this->data[self::KEY_EMAIL]) != 0)) { // username matched but email did not throw new \Exception( - 'An existing user has the given username but different email. ' . self::KEY_USERNAME . + 'An existing user has the given username but different email. ' . self::KEY_USER . ' and ' . self::KEY_EMAIL . ' both need to match an existing user or both be new.' ); } @@ -180,7 +180,7 @@ class AdminAccount 'role_type' => User::ROLE_TYPE, 'user_id' => $adminId, 'user_type' => UserContextInterface::USER_TYPE_ADMIN, - 'role_name' => $this->data[self::KEY_USERNAME], + 'role_name' => $this->data[self::KEY_USER], ]; $this->setup->getConnection()->insert($this->setup->getTable('authorization_role'), $adminRoleData); } diff --git a/setup/src/Magento/Setup/Model/ConsoleLogger.php b/setup/src/Magento/Setup/Model/ConsoleLogger.php index e0c0aa147272977e68f05fd731614284be45b5b5..3bcd21aabe083ce1066554ca661e2b4e270e2916 100644 --- a/setup/src/Magento/Setup/Model/ConsoleLogger.php +++ b/setup/src/Magento/Setup/Model/ConsoleLogger.php @@ -6,8 +6,8 @@ namespace Magento\Setup\Model; -use Zend\Console\ColorInterface; -use Zend\Console\Console; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Formatter\OutputFormatterStyle; /** * Console Logger @@ -26,16 +26,21 @@ class ConsoleLogger implements LoggerInterface /** * Console * - * @var \Zend\Console\Adapter\AdapterInterface + * @var OutputInterface */ protected $console; /** * Constructor + * + * @param OutputInterface $output */ - public function __construct() + public function __construct(OutputInterface $output) { - $this->console = Console::getInstance(); + $this->console = $output; + $outputFormatter = $this->console->getFormatter(); + $outputFormatter->setStyle('detail', new OutputFormatterStyle('blue')); + $outputFormatter->setStyle('metadata', new OutputFormatterStyle('cyan')); } /** @@ -44,7 +49,7 @@ class ConsoleLogger implements LoggerInterface public function logSuccess($message) { $this->terminateLine(); - $this->console->writeLine("[SUCCESS]" . ($message ? ": $message" : ''), ColorInterface::LIGHT_GREEN); + $this->console->writeln("<info>[SUCCESS]" . ($message ? ": $message" : '') . '</info>'); } /** @@ -53,7 +58,7 @@ class ConsoleLogger implements LoggerInterface public function logError(\Exception $e) { $this->terminateLine(); - $this->console->writeLine("[ERROR]: " . $e, ColorInterface::LIGHT_RED); + $this->console->writeln("<error>[ERROR]: " . $e . '</error>'); } /** @@ -62,7 +67,7 @@ class ConsoleLogger implements LoggerInterface public function log($message) { $this->terminateLine(); - $this->console->writeLine($message, ColorInterface::LIGHT_BLUE); + $this->console->writeln('<detail>' . $message . '</detail>'); } /** @@ -71,7 +76,7 @@ class ConsoleLogger implements LoggerInterface public function logInline($message) { $this->isInline = true; - $this->console->write($message, ColorInterface::LIGHT_BLUE); + $this->console->write('<detail>' . $message . '</detail>'); } /** @@ -80,7 +85,7 @@ class ConsoleLogger implements LoggerInterface public function logMeta($message) { $this->terminateLine(); - $this->console->writeLine($message, ColorInterface::GRAY); + $this->console->writeln('<metadata>' . $message . '</metadata>'); } /** @@ -92,7 +97,7 @@ class ConsoleLogger implements LoggerInterface { if ($this->isInline) { $this->isInline = false; - $this->console->writeLine(''); + $this->console->writeln(''); } } } diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 451c0c06800a1fe01d04d079bc34b8e503ddbe15..5db3a546a66113ea49ff556c9f346281ec8afc44 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -29,6 +29,8 @@ use Magento\Store\Model\Store; use Magento\Setup\Module\ConnectionFactory; use Magento\Setup\Module\Setup; use Magento\Framework\Config\File\ConfigFilePool; +use Magento\Framework\App\State\CleanupFiles; +use Magento\Setup\Console\Command\InstallCommand; /** * Class Installer contains the logic to install Magento application. @@ -39,11 +41,6 @@ use Magento\Framework\Config\File\ConfigFilePool; */ class Installer { - /** - * Parameter indicating command whether to cleanup database in the install routine - */ - const CLEANUP_DB = 'cleanup_database'; - /**#@+ * Parameters for enabling/disabling modules */ @@ -51,16 +48,6 @@ class Installer const DISABLE_MODULES = 'disable_modules'; /**#@- */ - /** - * Parameter indicating command whether to install Sample Data - */ - const USE_SAMPLE_DATA = 'use_sample_data'; - - /** - * Parameter to specify an order_increment_prefix - */ - const SALES_ORDER_INCREMENT_PREFIX = 'sales_order_increment_prefix'; - /**#@+ * Formatting for progress log */ @@ -193,6 +180,11 @@ class Installer */ private $setupConfigModel; + /** + * @var CleanupFiles + */ + private $cleanupFiles; + /** * Constructor * @@ -211,7 +203,8 @@ class Installer * @param ObjectManagerProvider $objectManagerProvider * @param Context $context * @param SetupConfigModel $setupConfigModel - * + * @param CleanupFiles $cleanupFiles + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -229,7 +222,8 @@ class Installer SampleData $sampleData, ObjectManagerProvider $objectManagerProvider, Context $context, - SetupConfigModel $setupConfigModel + SetupConfigModel $setupConfigModel, + CleanupFiles $cleanupFiles ) { $this->filePermissions = $filePermissions; $this->deploymentConfigWriter = $deploymentConfigWriter; @@ -247,6 +241,7 @@ class Installer $this->objectManagerProvider = $objectManagerProvider; $this->context = $context; $this->setupConfigModel = $setupConfigModel; + $this->cleanupFiles = $cleanupFiles; } /** @@ -261,22 +256,22 @@ class Installer $script[] = ['File permissions check...', 'checkInstallationFilePermissions', []]; $script[] = ['Enabling Maintenance Mode...', 'setMaintenanceMode', [1]]; $script[] = ['Installing deployment configuration...', 'installDeploymentConfig', [$request]]; - if (!empty($request[self::CLEANUP_DB])) { + if (!empty($request[InstallCommand::INPUT_KEY_CLEANUP_DB])) { $script[] = ['Cleaning up database...', 'cleanupDb', []]; } $script[] = ['Installing database schema:', 'installSchema', []]; $script[] = ['Installing user configuration...', 'installUserConfig', [$request]]; $script[] = ['Installing data...', 'installDataFixtures', []]; - if (!empty($request[self::SALES_ORDER_INCREMENT_PREFIX])) { + if (!empty($request[InstallCommand::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX])) { $script[] = [ 'Creating sales order increment prefix...', 'installOrderIncrementPrefix', - [$request[self::SALES_ORDER_INCREMENT_PREFIX]], + [$request[InstallCommand::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX]], ]; } $script[] = ['Installing admin user...', 'installAdminUser', [$request]]; $script[] = ['Enabling caches:', 'enableCaches', []]; - if (!empty($request[Installer::USE_SAMPLE_DATA]) && $this->sampleData->isDeployed()) { + if (!empty($request[InstallCommand::INPUT_KEY_USE_SAMPLE_DATA]) && $this->sampleData->isDeployed()) { $script[] = ['Installing sample data:', 'installSampleData', [$request]]; } $script[] = ['Disabling Maintenance Mode:', 'setMaintenanceMode', [0]]; @@ -420,12 +415,7 @@ class Installer { $this->checkInstallationFilePermissions(); $userData = is_array($data) ? $data : $data->getArrayCopy(); - - // TODO: remove this when moving install command to symfony - $userData = $this->setDefaultValues($userData); - $this->setupConfigModel->process($userData); - if ($this->deploymentConfig->isAvailable()) { $deploymentConfigData = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_CRYPT_KEY); if (isset($deploymentConfigData)) { @@ -435,32 +425,6 @@ class Installer // reset object manager now that there is a deployment config $this->objectManagerProvider->reset(); } - - /** - * Sets defaults if user input is missing - * - * @param array $userData - * @return array - */ - private function setDefaultValues(array $userData) - { - if (!isset($userData[ConfigOptionsList::INPUT_KEY_SESSION_SAVE])) { - $userData[ConfigOptionsList::INPUT_KEY_SESSION_SAVE] = ConfigOptionsList::SESSION_SAVE_FILES; - } - if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_PASS])) { - $userData[ConfigOptionsList::INPUT_KEY_DB_PASS] = ''; - } - if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_MODEL])) { - $userData[ConfigOptionsList::INPUT_KEY_DB_MODEL] = 'mysql4'; - } - if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS])) { - $userData[ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS] = 'SET NAMES utf8;'; - } - if (!isset($userData[ConfigOptionsList::INPUT_KEY_DB_PREFIX])) { - $userData[ConfigOptionsList::INPUT_KEY_DB_PREFIX] = ''; - } - return $userData; - } /** * Set up setup_module table to register modules' versions, skip this process if it already exists @@ -822,7 +786,7 @@ class Installer */ public function installUserConfig($data) { - $userConfig = new UserConfigurationDataMapper(); + $userConfig = new StoreConfigurationDataMapper(); $configData = $userConfig->getConfigData($data); if (count($configData) === 0) { return; @@ -909,9 +873,14 @@ class Installer public function updateModulesSequence() { $this->assertDeploymentConfigExists(); + + $this->clearCache(); + $this->log->log('File system cleanup:'); - $this->deleteDirContents(DirectoryList::GENERATION); - $this->deleteDirContents(DirectoryList::CACHE); + $messages = $this->cleanupFiles->clearCodeGeneratedClasses(); + foreach ($messages as $message) { + $this->log->log($message); + } $this->log->log('Updating modules:'); $this->createModulesConfig([]); } @@ -926,14 +895,31 @@ class Installer $this->log->log('Starting Magento uninstallation:'); $this->cleanupDb(); + $this->clearCache(); + $this->log->log('File system cleanup:'); - $this->deleteDirContents(DirectoryList::VAR_DIR); - $this->deleteDirContents(DirectoryList::STATIC_VIEW); + $messages = $this->cleanupFiles->clearAllFiles(); + foreach ($messages as $message) { + $this->log->log($message); + } + $this->deleteDeploymentConfig(); $this->log->logSuccess('Magento uninstallation complete.'); } + /** + * Clears cache + * + * @return void + */ + private function clearCache() + { + $cache = $this->objectManagerProvider->get()->create('Magento\Framework\App\Cache'); + $cache->clean(); + $this->log->log('Cache cleared successfully'); + } + /** * Enables caches after installing application * @@ -1065,33 +1051,6 @@ class Installer $this->log->log('No database connection defined - skipping database cleanup'); } - /** - * Removes contents of a directory - * - * @param string $type - * @return void - */ - private function deleteDirContents($type) - { - $dir = $this->filesystem->getDirectoryWrite($type); - $dirPath = $dir->getAbsolutePath(); - if (!$dir->isExist()) { - $this->log->log("The directory '{$dirPath}' doesn't exist - skipping cleanup"); - return; - } - foreach ($dir->read() as $path) { - if (preg_match('/^\./', $path)) { - continue; - } - $this->log->log("{$dirPath}{$path}"); - try { - $dir->delete($path); - } catch (FileSystemException $e) { - $this->log->log($e->getMessage()); - } - } - } - /** * Removes deployment configuration * @@ -1140,7 +1099,7 @@ class Installer $connectionConfig[ConfigOptionsList::KEY_NAME], $connectionConfig[ConfigOptionsList::KEY_HOST], $connectionConfig[ConfigOptionsList::KEY_USER], - $connectionConfig[ConfigOptionsList::KEY_PASS] + $connectionConfig[ConfigOptionsList::KEY_PASSWORD] ); if (isset($connectionConfig[ConfigOptionsList::KEY_PREFIX])) { $this->checkDatabaseTablePrefix($connectionConfig[ConfigOptionsList::KEY_PREFIX]); @@ -1157,7 +1116,7 @@ class Installer */ private function installSampleData($request) { - $userName = isset($request[AdminAccount::KEY_USERNAME]) ? $request[AdminAccount::KEY_USERNAME] : ''; + $userName = isset($request[AdminAccount::KEY_USER]) ? $request[AdminAccount::KEY_USER] : ''; $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName); } diff --git a/setup/src/Magento/Setup/Model/InstallerFactory.php b/setup/src/Magento/Setup/Model/InstallerFactory.php index 3f12a06c8ffd7b46cdcf62d183f0defdc2e62c55..ce6bb1c99434580b03b8e8385b3deb7dd148bc2e 100644 --- a/setup/src/Magento/Setup/Model/InstallerFactory.php +++ b/setup/src/Magento/Setup/Model/InstallerFactory.php @@ -9,6 +9,7 @@ namespace Magento\Setup\Model; use Zend\ServiceManager\ServiceLocatorInterface; use Magento\Setup\Module\ResourceFactory; use Magento\Framework\App\ErrorHandler; +use Magento\Framework\App\State\CleanupFiles; class InstallerFactory { @@ -66,7 +67,8 @@ class InstallerFactory $this->serviceLocator->get('Magento\Framework\Model\Resource\Db\TransactionManager'), $this->serviceLocator->get('Magento\Framework\Model\Resource\Db\ObjectRelationProcessor') ), - $this->serviceLocator->get('Magento\Setup\Model\ConfigModel') + $this->serviceLocator->get('Magento\Setup\Model\ConfigModel'), + $this->serviceLocator->get('Magento\Framework\App\State\CleanupFiles') ); } diff --git a/setup/src/Magento/Setup/Model/UserConfigurationDataMapper.php b/setup/src/Magento/Setup/Model/StoreConfigurationDataMapper.php similarity index 70% rename from setup/src/Magento/Setup/Model/UserConfigurationDataMapper.php rename to setup/src/Magento/Setup/Model/StoreConfigurationDataMapper.php index e9985cb4d52cc4d420bd9f04f94b44f1566e7262..0fa3c235244568c8a4e7dbf2595c658f87f9dd68 100644 --- a/setup/src/Magento/Setup/Model/UserConfigurationDataMapper.php +++ b/setup/src/Magento/Setup/Model/StoreConfigurationDataMapper.php @@ -17,7 +17,7 @@ use Magento\Store\Model\Store; * * @package Magento\Setup\Model */ -class UserConfigurationDataMapper +class StoreConfigurationDataMapper { /**#@+ * Model data keys @@ -43,6 +43,8 @@ class UserConfigurationDataMapper Store::XML_PATH_UNSECURE_BASE_URL => self::KEY_BASE_URL, Store::XML_PATH_SECURE_BASE_URL => self::KEY_BASE_URL_SECURE, Data::XML_PATH_DEFAULT_LOCALE => self::KEY_LANGUAGE, + Store::XML_PATH_SECURE_IN_FRONTEND => self::KEY_IS_SECURE, + Store::XML_PATH_SECURE_IN_ADMINHTML => self::KEY_IS_SECURE_ADMIN, Data::XML_PATH_DEFAULT_TIMEZONE => self::KEY_TIMEZONE, Currency::XML_PATH_CURRENCY_BASE => self::KEY_CURRENCY, Currency::XML_PATH_CURRENCY_DEFAULT => self::KEY_CURRENCY, @@ -59,20 +61,6 @@ class UserConfigurationDataMapper public function getConfigData($installParamData) { $configData = []; - if (!$this->isSecureUrlNeeded($installParamData) && isset($installParamData[self::KEY_BASE_URL_SECURE])) { - unset($installParamData[self::KEY_BASE_URL_SECURE]); - } - - // Base URL is secure, add secure entries - if (isset($installParamData[self::KEY_BASE_URL_SECURE])) { - $this->pathDataMap = array_merge( - $this->pathDataMap, - [ - Store::XML_PATH_SECURE_IN_FRONTEND => self::KEY_IS_SECURE, - Store::XML_PATH_SECURE_IN_ADMINHTML => self::KEY_IS_SECURE_ADMIN - ] - ); - } foreach ($this->pathDataMap as $path => $key) { $configData = $this->addParamToConfigData($configData, $installParamData, $key, $path); @@ -80,18 +68,6 @@ class UserConfigurationDataMapper return $configData; } - /** - * Determine if secure URL is needed (use_secure or use_secure_admin flag is set.) - * - * @param array $installParamData - * @return bool - */ - private function isSecureUrlNeeded($installParamData) - { - return ((isset($installParamData[self::KEY_IS_SECURE]) && $installParamData[self::KEY_IS_SECURE]) - || (isset($installParamData[self::KEY_IS_SECURE_ADMIN]) && $installParamData[self::KEY_IS_SECURE_ADMIN])); - } - /** * Adds an install parameter value to the configData structure * diff --git a/setup/src/Magento/Setup/Module.php b/setup/src/Magento/Setup/Module.php index 10141ca8f7e6416d1589a676da4268501e9b1ba8..55dd70b8c7b68ef24bf3c840b3bcd43a729998a5 100644 --- a/setup/src/Magento/Setup/Module.php +++ b/setup/src/Magento/Setup/Module.php @@ -6,7 +6,6 @@ namespace Magento\Setup; -use Magento\Setup\Mvc\Bootstrap\InitParamListener; use Magento\Setup\Mvc\View\Http\InjectTemplateListener; use Zend\EventManager\EventInterface; use Zend\ModuleManager\Feature\BootstrapListenerInterface; @@ -66,7 +65,6 @@ class Module implements include __DIR__ . '/../../../config/states.config.php', include __DIR__ . '/../../../config/languages.config.php' ); - $result = InitParamListener::attachToConsoleRoutes($result); return $result; } } diff --git a/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php b/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php index 19e6317e96e43c24b996cc194c1c8addc238fe41..1d229e825f9c8f43c165e93bf62574ea9b34c0af 100644 --- a/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php +++ b/setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php @@ -39,45 +39,6 @@ class InitParamListener implements ListenerAggregateInterface, FactoryInterface */ private $listeners = []; - /** - * Registers itself to every command in console routes - * - * @param array $config - * @return array - */ - public static function attachToConsoleRoutes($config) - { - if (isset($config['console']['router']['routes'])) { - foreach ($config['console']['router']['routes'] as &$route) { - $route['options']['route'] .= ' [--' . self::BOOTSTRAP_PARAM . '=]'; - } - } - return $config; - } - - /** - * Adds itself to CLI usage instructions - * - * @return array - */ - public static function getConsoleUsage() - { - $result = ['']; - $result[] = [ - '[--' . self::BOOTSTRAP_PARAM . sprintf('=%s]', escapeshellarg('<query>')), - 'Add to any command to customize Magento initialization parameters', - ]; - $mode = State::PARAM_MODE; - $dirs = AppBootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS; - $examples = [ - "{$mode}=developer", - "{$dirs}[base][path]=/var/www/example.com", - "{$dirs}[cache][path]=/var/tmp/cache", - ]; - $result[] = ['', sprintf('For example: %s', escapeshellarg(implode('&', $examples)))]; - return $result; - } - /** * {@inheritdoc} */ diff --git a/setup/src/Magento/Setup/Mvc/Console/RouteListener.php b/setup/src/Magento/Setup/Mvc/Console/RouteListener.php deleted file mode 100644 index 5b4dcbfde5a8c935edd544627be8aeae85ee70a7..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Mvc/Console/RouteListener.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Mvc\Console; - -use Zend\View\Model\ConsoleModel; -use Zend\Mvc\Router\RouteMatch; -use Zend\Mvc\MvcEvent; -use Zend\Console\ColorInterface; -use Zend\EventManager\EventManagerInterface; - -/** - * Custom route listener to validate user parameters - */ -class RouteListener extends \Zend\Mvc\RouteListener -{ - /** - * {@inheritdoc} - */ - public function onRoute($e) - { - $request = $e->getRequest(); - // propagates to default RouteListener if not CLI - if (!$request instanceof \Zend\Console\Request) { - return null; - } - - $router = $e->getRouter(); - $match = $router->match($request); - - // CLI routing miss, checks for missing/extra parameters - if (!$match instanceof RouteMatch) { - $content = $request->getContent(); - $config = $e->getApplication()->getServiceManager()->get('Config')['console']['router']['routes']; - - $verboseValidator = new VerboseValidator(); - $validationMessages = $verboseValidator->validate($content, $config); - - if ('' !== $validationMessages) { - $this->displayMessages($e, $validationMessages); - // set error to stop propagation - $e->setError('default_error'); - } - } - return null; - } - - /** - * Display messages on console - * - * @param MvcEvent $e - * @param string $validationMessages - * @return void - */ - private function displayMessages(MvcEvent $e, $validationMessages) - { - /** @var \Zend\Console\Adapter\AdapterInterface $console */ - $console = $e->getApplication()->getServiceManager()->get('console'); - $validationMessages = $console->colorize($validationMessages, ColorInterface::RED); - $model = new ConsoleModel(); - $model->setErrorLevel(1); - $model->setResult($validationMessages); - $e->setResult($model); - } - - /** - * {@inheritdoc} - */ - public function attach(EventManagerInterface $events) - { - // set a higher priority than default route listener so it gets triggered first - $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'onRoute'], 10); - } -} diff --git a/setup/src/Magento/Setup/Mvc/Console/RouteMatcher.php b/setup/src/Magento/Setup/Mvc/Console/RouteMatcher.php deleted file mode 100644 index 7e2fc9dfd558f98dc4331c5ac60a3e864657c2b7..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Mvc/Console/RouteMatcher.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Mvc\Console; - -/** - * Extending ZF RouteMatcher for a public getter - */ -class RouteMatcher extends \Zend\Console\RouteMatcher\DefaultRouteMatcher -{ - /** - * Public getter of parts, used for parameters validation - * - * @return array - */ - public function getParts() - { - return $this->parts; - } -} diff --git a/setup/src/Magento/Setup/Mvc/Console/VerboseValidator.php b/setup/src/Magento/Setup/Mvc/Console/VerboseValidator.php deleted file mode 100644 index 1da4628b2b3573380d6363c22e5ecc32183afae1..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Mvc/Console/VerboseValidator.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Mvc\Console; - -use Magento\Setup\Controller\ConsoleController; - -/** - * Validator for checking parameters in CLI - */ -class VerboseValidator -{ - /** - * Checks parameters and returns validation messages - * - * @param array $data - * @param array $config - * @return string - */ - public function validate(array $data, array $config) - { - $validationMessages = ''; - $userAction = null; - if (!empty($data)) { - $userAction = $data[0]; - array_shift($data); - } - if (isset($userAction) && isset($config[$userAction])) { - // parse the expected parameters of the action - $matcher = new RouteMatcher($config[$userAction]['options']['route']); - $parts = $matcher->getParts(); - array_shift($parts); - $expectedParams = []; - foreach ($parts as $part) { - $expectedParams[$part['name']] = $part; - } - // parse user parameters - $userParams = $this->parseUserParams($data); - $validationMessages = $this->validateParameters($expectedParams, $userParams); - - // add usage message - $usages = ConsoleController::getCommandUsage(); - $validationMessages .= 'Usage:' . PHP_EOL . "{$userAction} "; - $validationMessages .= $usages[$userAction] . PHP_EOL . PHP_EOL; - - } else { - if (!is_null($userAction)) { - $validationMessages .= PHP_EOL . "Unknown action name '{$userAction}'." . PHP_EOL . PHP_EOL; - } else { - $validationMessages .= PHP_EOL . "No action is given in the command." . PHP_EOL . PHP_EOL; - } - $validationMessages .= 'Available options: ' . PHP_EOL; - foreach (array_keys($config) as $action) { - $validationMessages .= $action . PHP_EOL; - } - $validationMessages .= PHP_EOL; - } - - return $validationMessages; - } - - /** - * Parse user input - * - * @param array $content - * @return array - */ - private function parseUserParams(array $content) - { - $parameters = []; - foreach ($content as $param) { - $parsed = explode('=', $param, 2); - $value = isset($parsed[1]) ? $parsed[1] : ''; - if (strpos($parsed[0], '--') !== false) { - $key = substr($parsed[0], 2, strlen($parsed[0]) - 2); - } else { - $key = $parsed[0]; - } - - $parameters[$key] = $value; - } - return $parameters; - } - /** - * Check for any missing parameters - * - * @param array $expectedParams - * @param array $actualParams - * @return array - */ - public function checkMissingParameter($expectedParams, $actualParams) - { - $missingParams = array_diff(array_keys($expectedParams), array_keys($actualParams)); - foreach ($missingParams as $key => $missingParam) { - /* disregard if optional parameter */ - if (!$expectedParams[$missingParam]['required']) { - unset($missingParams[$key]); - } - } - // some parameters have alternative names, verify user input with theses alternative names - foreach ($missingParams as $key => $missingParam) { - foreach (array_keys($actualParams) as $actualParam) { - if (isset($expectedParams[$missingParam]['alternatives'])) { - foreach ($expectedParams[$missingParam]['alternatives'] as $alternative) { - if ($actualParam === $alternative) { - unset($missingParams[$key]); - break 2; - } - } - } - } - } - return $missingParams; - } - - /** - * Check for any extra parameters - * - * @param array $expectedParams - * @param array $actualParams - * @return array - */ - public function checkExtraParameter($expectedParams, $actualParams) - { - $extraParams = array_diff(array_keys($actualParams), array_keys($expectedParams)); - // some parameters have alternative names, make sure $extraParams doesn't contain these alternatives names - foreach ($extraParams as $key => $extraParam) { - foreach ($expectedParams as $expectedParam) { - if (isset($expectedParam['alternatives'])) { - foreach ($expectedParam['alternatives'] as $alternative) { - if ($extraParam === $alternative) { - unset($extraParams[$key]); - break 2; - } - } - } - } - } - return $extraParams; - } - - /** - * Checks for parameters that are missing values - * - * @param array $expectedParams - * @param array $actualParams - * @return array - */ - public function checkMissingValue($expectedParams, $actualParams) - { - $missingValues = []; - foreach ($actualParams as $param => $value) { - if (isset($expectedParams[$param])) { - if ($value === '' && $expectedParams[$param]['hasValue']) { - $missingValues[] = $param; - } - } - } - return $missingValues; - } - - /** - * Checks for parameters that do not need values - * - * @param array $expectedParams - * @param array $actualParams - * @return array - */ - public function checkExtraValue($expectedParams, $actualParams) - { - $extraValues = []; - foreach ($actualParams as $param => $value) { - if (isset($expectedParams[$param])) { - if ($value !== '' && !$expectedParams[$param]['hasValue']) { - $extraValues[] = $param; - } - } - } - return $extraValues; - } - - /** - * Validates the parameters. - * - * @param array $expectedParams - * @param array $userParams - * @return string - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - private function validateParameters($expectedParams, $userParams) - { - $missingParams = $this->checkMissingParameter($expectedParams, $userParams); - $extraParams = $this->checkExtraParameter($expectedParams, $userParams); - $missingValues = $this->checkMissingValue($expectedParams, $userParams); - $extraValues = $this->checkExtraValue($expectedParams, $userParams); - $validationMessages = PHP_EOL; - if (!empty($missingParams)) { - $validationMessages .= 'Missing required parameters:' . PHP_EOL; - foreach ($missingParams as $missingParam) { - $validationMessages .= $missingParam . PHP_EOL; - } - $validationMessages .= PHP_EOL; - } - if (!empty($extraParams)) { - $validationMessages .= 'Unidentified parameters:' . PHP_EOL; - foreach ($extraParams as $extraParam) { - $validationMessages .= $extraParam . PHP_EOL; - } - $validationMessages .= PHP_EOL; - } - if (!empty($missingValues)) { - $validationMessages .= 'Parameters missing value:' . PHP_EOL; - foreach ($missingValues as $missingValue) { - $validationMessages .= $missingValue . PHP_EOL; - } - $validationMessages .= PHP_EOL; - } - if (!empty($extraValues)) { - $validationMessages .= 'Parameters that don\'t need value:' . PHP_EOL; - foreach ($extraValues as $extraValue) { - $validationMessages .= $extraValue . PHP_EOL; - } - $validationMessages .= PHP_EOL; - } - if (empty($missingParams) && empty($extraParams) && empty($missingValues) && empty($extraValue)) { - $validationMessages .= 'Please make sure parameters are in correct format and are not repeated.'; - $validationMessages .= PHP_EOL . PHP_EOL; - return $validationMessages; - } - return $validationMessages; - } -} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3e8ad803fd37af25053bb648cfe69412a42348d6 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php @@ -0,0 +1,92 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Model\AdminAccount; +use Magento\Setup\Console\Command\AdminUserCreateCommand; +use Magento\Setup\Mvc\Bootstrap\InitParamListener; +use Symfony\Component\Console\Tester\CommandTester; + +class AdminUserCreateCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\InstallerFactory + */ + private $installerFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|AdminUserCreateCommand + */ + private $command; + + public function setUp() + { + $this->installerFactoryMock = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $this->command = new AdminUserCreateCommand($this->installerFactoryMock); + } + + public function testExecute() + { + $options = [ + '--' . AdminAccount::KEY_USER => 'user', + '--' . AdminAccount::KEY_PASSWORD => '123123q', + '--' . AdminAccount::KEY_EMAIL => 'test@test.com', + '--' . AdminAccount::KEY_FIRST_NAME => 'John', + '--' . AdminAccount::KEY_LAST_NAME => 'Doe', + ]; + $data = [ + AdminAccount::KEY_USER => 'user', + AdminAccount::KEY_PASSWORD => '123123q', + AdminAccount::KEY_EMAIL => 'test@test.com', + AdminAccount::KEY_FIRST_NAME => 'John', + AdminAccount::KEY_LAST_NAME => 'Doe', + InitParamListener::BOOTSTRAP_PARAM => null, + ]; + $commandTester = new CommandTester($this->command); + $installerMock = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $installerMock->expects($this->once())->method('installAdminUser')->with($data); + $this->installerFactoryMock->expects($this->once())->method('create')->willReturn($installerMock); + $commandTester->execute($options); + $this->assertEquals('Created admin user user' . PHP_EOL, $commandTester->getDisplay()); + } + + public function testGetOptionsList() + { + /* @var $argsList \Symfony\Component\Console\Input\InputArgument[] */ + $argsList = $this->command->getOptionsList(); + $this->assertEquals(AdminAccount::KEY_EMAIL, $argsList[2]->getName()); + } + + /** + * @dataProvider validateDataProvider + * @param bool[] $options + * @param string[] $errors + */ + public function testValidate(array $options, array $errors) + { + $inputMock = $this->getMockForAbstractClass('Symfony\Component\Console\Input\InputInterface', [], '', false); + $index = 0; + foreach ($options as $option) { + $inputMock->expects($this->at($index++))->method('getOption')->willReturn($option); + } + $this->assertEquals($errors, $this->command->validate($inputMock)); + } + + /** + * @return array + */ + public function validateDataProvider() + { + return [ + [[false, true, true, true, true], ['Missing option ' . AdminAccount::KEY_USER]], + [ + [true, false, false, true, true], + ['Missing option ' . AdminAccount::KEY_PASSWORD, 'Missing option ' . AdminAccount::KEY_EMAIL], + ], + [[true, true, true, true, true], []], + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/ConfigSetCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/ConfigSetCommandTest.php index 857ea54b8f51818c45f61b28e1a1792887b41e6b..11e08c4faf7784e8af19f186640dc30ef82b7461 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/ConfigSetCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/ConfigSetCommandTest.php @@ -27,8 +27,6 @@ class ConfigSetCommandTest extends \PHPUnit_Framework_TestCase */ private $command; - - public function setUp() { $option = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/DbDataUpgradeCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbDataUpgradeCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..50494cd968b1ccf56db4596f6303f68eb8d59bf8 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbDataUpgradeCommandTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Framework\Module\ModuleList; +use Magento\Setup\Console\Command\DbDataUpgradeCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class DbDataUpgradeCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Setup\Model\InstallerFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $installerFactory; + + /** + * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject + */ + protected $deploymentConfig; + + protected function setup() + { + $this->installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false); + } + + public function testExecute() + { + $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true)); + $installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $this->installerFactory->expects($this->once())->method('create')->will($this->returnValue($installer)); + $installer->expects($this->once())->method('installDataFixtures'); + + $commandTester = new CommandTester( + new DbDataUpgradeCommand($this->installerFactory, $this->deploymentConfig) + ); + $commandTester->execute([]); + } + + public function testExecuteNoConfig() + { + $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); + $this->installerFactory->expects($this->never())->method('create'); + + $commandTester = new CommandTester( + new DbDataUpgradeCommand($this->installerFactory, $this->deploymentConfig) + ); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'No information is available: the application is not installed.%w', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/DbSchemaUpgradeCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbSchemaUpgradeCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6300175f95926f4c476d23ecc9252ea545d819ec --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbSchemaUpgradeCommandTest.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Framework\Module\ModuleList; +use Magento\Setup\Console\Command\DbSchemaUpgradeCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class DbSchemaUpgradeCommandTest extends DbDataUpgradeCommandTest +{ + public function testExecute() + { + $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true)); + $installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $this->installerFactory->expects($this->once())->method('create')->will($this->returnValue($installer)); + $installer->expects($this->once())->method('installSchema'); + + $commandTester = new CommandTester( + new DbSchemaUpgradeCommand($this->installerFactory, $this->deploymentConfig) + ); + $commandTester->execute([]); + } + + public function testExecuteNoConfig() + { + $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); + $this->installerFactory->expects($this->never())->method('create'); + + $commandTester = new CommandTester( + new DbSchemaUpgradeCommand($this->installerFactory, $this->deploymentConfig) + ); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'No information is available: the application is not installed.%w', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d16758b51e6c99d4437423e59564f0b095c8621c --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Framework\Module\DbVersionInfo; +use Magento\Setup\Console\Command\DbStatusCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class DbStatusCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\Module\DbVersionInfo|\PHPUnit_Framework_MockObject_MockObject + */ + private $dbVersionInfo; + + /** + * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject + */ + private $deploymentConfig; + + /** + * @var DbStatusCommand + */ + private $command; + + protected function setUp() + { + $this->dbVersionInfo = $this->getMock('Magento\Framework\Module\DbVersionInfo', [], [], '', false); + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $objectManagerProvider->expects($this->any()) + ->method('get') + ->will($this->returnValue($objectManager)); + $objectManager->expects($this->any()) + ->method('get') + ->will($this->returnValue($this->dbVersionInfo)); + $this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false); + $this->command = new DbStatusCommand($objectManagerProvider, $this->deploymentConfig); + } + + /** + * @param array $outdatedInfo + * @param string $expectedMessage + * + * @dataProvider executeDataProvider + */ + public function testExecute(array $outdatedInfo, $expectedMessage) + { + $this->deploymentConfig->expects($this->once()) + ->method('isAvailable') + ->will($this->returnValue(true)); + $this->dbVersionInfo->expects($this->once()) + ->method('getDbVersionErrors') + ->will($this->returnValue($outdatedInfo)); + $tester = new CommandTester($this->command); + $tester->execute([]); + $this->assertStringMatchesFormat($expectedMessage, $tester->getDisplay()); + } + + public function executeDataProvider() + { + return [ + 'DB is up to date' => [ + [], + 'All modules are up to date%a' + ], + 'DB is outdated' => [ + [ + [ + DbVersionInfo::KEY_MODULE => 'module_a', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '1.0.0', + DbVersionInfo::KEY_REQUIRED => '2.0.0' + ] + ], + '%amodule_a%aschema%a1%a->%a2' + . "%aRun 'setup:upgrade' to update your DB schema and data%a", + ], + 'code is outdated' => [ + [ + [ + DbVersionInfo::KEY_MODULE => 'module_a', + DbVersionInfo::KEY_TYPE => 'data', + DbVersionInfo::KEY_CURRENT => '2.0.0', + DbVersionInfo::KEY_REQUIRED => '1.0.0' + ] + ], + '%amodule_a%adata%a2.0.0%a->%a1.0.0' + . '%aSome modules use code versions newer or older than the database%a', + ], + 'both DB and code is outdated' => [ + [ + [ + DbVersionInfo::KEY_MODULE => 'module_a', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '1.0.0', + DbVersionInfo::KEY_REQUIRED => '2.0.0' + ], + [ + DbVersionInfo::KEY_MODULE => 'module_b', + DbVersionInfo::KEY_TYPE => 'data', + DbVersionInfo::KEY_CURRENT => '2.0.0', + DbVersionInfo::KEY_REQUIRED => '1.0.0' + ] + ], + '%amodule_a%aschema%a1.0.0%a->%a2.0.0' + . '%amodule_b%adata%a2.0.0%a->%a1.0.0' + . '%aSome modules use code versions newer or older than the database%a', + ], + ]; + } + + public function testExecuteNotInstalled() + { + $this->deploymentConfig->expects($this->once()) + ->method('isAvailable') + ->will($this->returnValue(false)); + $this->dbVersionInfo->expects($this->never()) + ->method('getDbVersionErrors'); + $tester = new CommandTester($this->command); + $tester->execute([]); + $this->assertStringMatchesFormat( + 'No information is available: the application is not installed.%w', + $tester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoCurrencyListCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoCurrencyListCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a7e087f94bd2b3f68ca6d01a767202d1873ebbd5 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoCurrencyListCommandTest.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\InfoCurrencyListCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class InfoCurrencyListCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $currencies = [ + 'CUR' => 'Currency description' + ]; + + /** @var \Magento\Setup\Model\Lists|\PHPUnit_Framework_MockObject_MockObject $list */ + $list = $this->getMock('Magento\Setup\Model\Lists', [], [], '', false); + $list->expects($this->once())->method('getCurrencyList')->will($this->returnValue($currencies)); + $commandTester = new CommandTester(new InfoCurrencyListCommand($list)); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'CUR => Currency description', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoLanguageListCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoLanguageListCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..938fb53f72590df1a99758d588ffd2129f23a09a --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoLanguageListCommandTest.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\InfoLanguageListCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class InfoLanguageListCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $languages = [ + 'LNG' => 'Language description' + ]; + /** @var \Magento\Setup\Model\Lists|\PHPUnit_Framework_MockObject_MockObject $list */ + $list = $this->getMock('Magento\Setup\Model\Lists', [], [], '', false); + $list->expects($this->once())->method('getLocaleList')->will($this->returnValue($languages)); + $commandTester = new CommandTester(new InfoLanguageListCommand($list)); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'LNG => Language description', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoTimezoneListCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoTimezoneListCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6b1be6a5e9bc122e58d4845d116de5a14bd13e51 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InfoTimezoneListCommandTest.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\InfoTimezoneListCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class InfoTimezoneListCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $timezones = [ + 'timezone' => 'timezone description' + ]; + + /** @var \Magento\Setup\Model\Lists|\PHPUnit_Framework_MockObject_MockObject $list */ + $list = $this->getMock('Magento\Setup\Model\Lists', [], [], '', false); + $list->expects($this->once())->method('getTimezoneList')->will($this->returnValue($timezones)); + $commandTester = new CommandTester(new InfoTimezoneListCommand($list)); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'timezone => timezone description', + $commandTester->getDisplay() + ); + + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a358368092f032e951ecfcbba5d8f92a240367fd --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php @@ -0,0 +1,178 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\InstallCommand; +use Symfony\Component\Console\Tester\CommandTester; +use Magento\Setup\Model\AdminAccount; +use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList; +use Magento\Framework\Config\ConfigOptionsList as SetupConfigOptionsList; +use Magento\Setup\Console\Command\InstallStoreConfigurationCommand; +use Magento\Setup\Model\StoreConfigurationDataMapper; + +class InstallCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $input = [ + '--' . SetupConfigOptionsList::INPUT_KEY_DB_HOST => 'localhost', + '--' . SetupConfigOptionsList::INPUT_KEY_DB_NAME => 'magento', + '--' . SetupConfigOptionsList::INPUT_KEY_DB_USER => 'root', + '--' . BackendConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'admin', + '--' . StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/magento2ce/', + '--' . StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US', + '--' . StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', + '--' . StoreConfigurationDataMapper::KEY_CURRENCY => 'USD', + '--' . AdminAccount::KEY_USER => 'user', + '--' . AdminAccount::KEY_PASSWORD => '123123q', + '--' . AdminAccount::KEY_EMAIL => 'test@test.com', + '--' . AdminAccount::KEY_FIRST_NAME => 'John', + '--' . AdminAccount::KEY_LAST_NAME => 'Doe', + ]; + + $configModel = $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false); + $configModel + ->expects($this->exactly(2)) + ->method('getAvailableOptions') + ->will($this->returnValue($this->getOptionsListDeployConfig())); + $configModel + ->expects($this->once()) + ->method('validate') + ->will($this->returnValue([])); + + $userConfig = $this->getMock( + 'Magento\Setup\Console\Command\InstallStoreConfigurationCommand', + [], + [], + '', + false + ); + $userConfig + ->expects($this->once()) + ->method('getOptionsList') + ->will($this->returnValue($this->getOptionsListUserConfig())); + + $adminUser = $this->getMock('Magento\Setup\Console\Command\AdminUserCreateCommand', [], [], '', false); + $adminUser + ->expects($this->once()) + ->method('getOptionsList') + ->will($this->returnValue($this->getOptionsListAdminUser())); + $adminUser + ->expects($this->once()) + ->method('validate') + ->will($this->returnValue([])); + + $installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $installerFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($installer)); + $installer->expects($this->once())->method('install'); + $commandTester = new CommandTester(new InstallCommand( + $installerFactory, + $configModel, + $userConfig, + $adminUser + )); + $commandTester->execute($input); + } + + /** + * Get list of options for deployment configuration + * + * @return array + */ + private function getOptionsListDeployConfig() + { + $option1 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option1 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(SetupConfigOptionsList::INPUT_KEY_DB_HOST)); + $option2 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option2 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(SetupConfigOptionsList::INPUT_KEY_DB_NAME)); + $option3 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option3 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(SetupConfigOptionsList::INPUT_KEY_DB_USER)); + $option4 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option4 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(BackendConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME)); + return [$option1, $option2, $option3, $option4]; + } + + /** + * Get list of options for user configuration + * + * @return array + */ + private function getOptionsListUserConfig() + { + $option1 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option1 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(StoreConfigurationDataMapper::KEY_BASE_URL)); + $option2 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option2 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(StoreConfigurationDataMapper::KEY_LANGUAGE)); + $option3 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option3 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(StoreConfigurationDataMapper::KEY_TIMEZONE)); + $option4 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option4 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(StoreConfigurationDataMapper::KEY_CURRENCY)); + return [$option1, $option2, $option3, $option4]; + } + + /** + * Get list of options for admin user + * + * @return array + */ + private function getOptionsListAdminUser() + { + $option1 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option1 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(AdminAccount::KEY_USER)); + $option2 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option2 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(AdminAccount::KEY_PASSWORD)); + $option3 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option3 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(AdminAccount::KEY_EMAIL)); + $option4 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option4 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(AdminAccount::KEY_FIRST_NAME)); + $option5 = $this->getMock('Magento\Framework\Setup\Option\TextConfigOption', [], [], '', false); + $option5 + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue(AdminAccount::KEY_LAST_NAME)); + return [$option1, $option2, $option3, $option4, $option5]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..65e5ded76910b01334ae1e93134cfca621a8e9ec --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallStoreConfigurationCommandTest.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\InstallStoreConfigurationCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class InstallStoreConfigurationCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject + */ + private $deploymentConfig; + + /** + * @var \Magento\Setup\Model\InstallerFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $installerFactory; + + /** + * @var Installer|\PHPUnit_Framework_MockObject_MockObject + */ + private $installer; + + /** + * @var InstallStoreConfigurationCommand + */ + private $command; + + protected function setUp() + { + $this->installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false); + $this->installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $this->command = new InstallStoreConfigurationCommand($this->installerFactory, $this->deploymentConfig); + } + + public function testExecute() + { + $this->deploymentConfig->expects($this->once()) + ->method('isAvailable') + ->will($this->returnValue(true)); + $this->installer->expects($this->once()) + ->method('installUserConfig'); + $this->installerFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->installer)); + $tester = new CommandTester($this->command); + $tester->execute([]); + } + + public function testExecuteNotInstalled() + { + $this->deploymentConfig->expects($this->once()) + ->method('isAvailable') + ->will($this->returnValue(false)); + $this->installerFactory->expects($this->never()) + ->method('create'); + $tester = new CommandTester($this->command); + $tester->execute([]); + $this->assertStringMatchesFormat( + "Store settings can't be saved because the Magento application is not installed.%w", + $tester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceAllowIpsCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceAllowIpsCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b129552455218f84445a91f2d602c79326610be8 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceAllowIpsCommandTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\MaintenanceAllowIpsCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class MaintenanceAllowIpsCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject + */ + private $maintenanceMode; + + /** + * @var MaintenanceAllowIpsCommand + */ + private $command; + + public function setUp() + { + $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); + $this->command = new MaintenanceAllowIpsCommand($this->maintenanceMode); + } + + /** + * @param array $input + * @param string $expectedMessage + * @dataProvider executeDataProvider + */ + public function testExecute(array $input, $expectedMessage) + { + if (isset($input['--none']) && !$input['--none'] && isset($input['ip'])) { + $this->maintenanceMode + ->expects($this->once()) + ->method('getAddressInfo') + ->willReturn($input['ip']); + } + $tester = new CommandTester($this->command); + $tester->execute($input); + $this->assertEquals($expectedMessage, $tester->getDisplay()); + + } + + /** + * return array + */ + public function executeDataProvider() + { + return [ + [ + ['ip' => ['127.0.0.1', '127.0.0.2'], '--none' => false], + 'Set exempt IP-addresses: 127.0.0.1, 127.0.0.2' . PHP_EOL + ], + [ + ['--none' => true], + 'Set exempt IP-addresses: none' . PHP_EOL + ], + [ + ['ip' => ['127.0.0.1', '127.0.0.2'], '--none' => true], + 'Set exempt IP-addresses: none' . PHP_EOL + ], + [ + [], + '' + ] + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceDisableCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceDisableCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e32acacb15aaa7d23197b77e166941d636d1f95a --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceDisableCommandTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\MaintenanceDisableCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class MaintenanceDisableCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject + */ + private $maintenanceMode; + + /** + * @var MaintenanceDisableCommand + */ + private $command; + + public function setUp() + { + $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); + $this->command = new MaintenanceDisableCommand($this->maintenanceMode); + } + + /** + * @param array $input + * @param string $expectedMessage + * @dataProvider executeDataProvider + */ + public function testExecute(array $input, $expectedMessage) + { + $return = isset($input['--ip']) ? ($input['--ip'] !== ['none'] ? $input['--ip'] : []) : []; + $this->maintenanceMode + ->expects($this->any()) + ->method('getAddressInfo') + ->willReturn($return); + $tester = new CommandTester($this->command); + $tester->execute($input); + $this->assertEquals($expectedMessage, $tester->getDisplay()); + } + + /** + * return array + */ + public function executeDataProvider() + { + return [ + [ + ['--ip' => ['127.0.0.1', '127.0.0.2']], + 'Disabled maintenance mode' . PHP_EOL . + 'Set exempt IP-addresses: 127.0.0.1, 127.0.0.2' . PHP_EOL + ], + [ + [], + 'Disabled maintenance mode' . PHP_EOL + ], + [ + ['--ip' => ['none']], + 'Disabled maintenance mode' . PHP_EOL . + 'Set exempt IP-addresses: none' . PHP_EOL + ], + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceEnableCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceEnableCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7615de13c617e951cfb965c8390ff1e46444b76a --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceEnableCommandTest.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\MaintenanceEnableCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class MaintenanceEnableCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject + */ + private $maintenanceMode; + + /** + * @var MaintenanceEnableCommand + */ + private $command; + + public function setUp() + { + $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); + $this->command = new MaintenanceEnableCommand($this->maintenanceMode); + } + + /** + * @param array $input + * @param string $expectedMessage + * @dataProvider executeDataProvider + */ + public function testExecute(array $input, $expectedMessage) + { + $return = isset($input['--ip']) ? ($input['--ip'] !== ['none'] ? $input['--ip'] : []) : []; + $this->maintenanceMode + ->expects($this->any()) + ->method('getAddressInfo') + ->willReturn($return); + $tester = new CommandTester($this->command); + $tester->execute($input); + $this->assertEquals($expectedMessage, $tester->getDisplay()); + + } + + /** + * return array + */ + public function executeDataProvider() + { + return [ + [ + ['--ip' => ['127.0.0.1', '127.0.0.2']], + 'Enabled maintenance mode' . PHP_EOL . + 'Set exempt IP-addresses: 127.0.0.1, 127.0.0.2' . PHP_EOL + ], + [ + ['--ip' => ['none']], + 'Enabled maintenance mode' . PHP_EOL . + 'Set exempt IP-addresses: none' . PHP_EOL + ], + [ + [], + 'Enabled maintenance mode' . PHP_EOL + ], + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceStatusCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceStatusCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8205bf8277b2c21e11861df672061398146939df --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/MaintenanceStatusCommandTest.php @@ -0,0 +1,71 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\MaintenanceStatusCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class MaintenanceStatusCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject + */ + private $maintenanceMode; + + /** + * @var MaintenanceStatusCommand + */ + private $command; + + public function setUp() + { + $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); + $this->command = new MaintenanceStatusCommand($this->maintenanceMode); + } + + /** + * @param array $maintenanceData + * @param string $expectedMessage + * @dataProvider executeDataProvider + */ + public function testExecute(array $maintenanceData, $expectedMessage) + { + $this->maintenanceMode->expects($this->once())->method('isOn')->willReturn($maintenanceData[0]); + $this->maintenanceMode->expects($this->once())->method('getAddressInfo')->willReturn($maintenanceData[1]); + $tester = new CommandTester($this->command); + $tester->execute([]); + $this->assertEquals($expectedMessage, $tester->getDisplay()); + + } + + /** + * return array + */ + public function executeDataProvider() + { + return [ + [ + [true, ['127.0.0.1', '127.0.0.2']], + 'Status: maintenance mode is active' . PHP_EOL . + 'List of exempt IP-addresses: 127.0.0.1, 127.0.0.2' . PHP_EOL + ], + [ + [true, []], + 'Status: maintenance mode is active' . PHP_EOL . 'List of exempt IP-addresses: none' . PHP_EOL + ], + [ + [false, []], + 'Status: maintenance mode is not active' . PHP_EOL . 'List of exempt IP-addresses: none' . PHP_EOL + ], + [ + [false, ['127.0.0.1', '127.0.0.2']], + 'Status: maintenance mode is not active' . PHP_EOL . + 'List of exempt IP-addresses: 127.0.0.1, 127.0.0.2' . PHP_EOL + ], + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b0fdb27794887177ecaee65f25d2d057ee3d97da --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleEnableDisableCommandTest.php @@ -0,0 +1,278 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\ModuleDisableCommand; +use Magento\Setup\Console\Command\ModuleEnableCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class ModuleEnableDisableCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Setup\Model\ObjectManagerProvider|\PHPUnit_Framework_MockObject_MockObject + */ + private $objectManagerProvider; + + /** + * @var \Magento\Framework\Module\Status|\PHPUnit_Framework_MockObject_MockObject + */ + private $status; + + /** + * @var \Magento\Framework\App\Cache|\PHPUnit_Framework_MockObject_MockObject + */ + private $cache; + + /** + * @var \Magento\Framework\App\State\CleanupFiles|\PHPUnit_Framework_MockObject_MockObject + */ + private $cleanupFiles; + + /** + * @var \Magento\Framework\Module\FullModuleList|\PHPUnit_Framework_MockObject_MockObject + */ + private $fullModuleList; + + protected function setUp() + { + $this->objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $this->objectManagerProvider->expects($this->any()) + ->method('get') + ->will($this->returnValue($objectManager)); + $this->status = $this->getMock('Magento\Framework\Module\Status', [], [], '', false); + $this->cache = $this->getMock('Magento\Framework\App\Cache', [], [], '', false); + $this->cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false); + $this->fullModuleList = $this->getMock('Magento\Framework\Module\FullModuleList', [], [], '', false); + $objectManager->expects($this->any()) + ->method('get') + ->will($this->returnValueMap([ + ['Magento\Framework\Module\Status', $this->status], + ['Magento\Framework\App\Cache', $this->cache], + ['Magento\Framework\App\State\CleanupFiles', $this->cleanupFiles], + ['Magento\Framework\Module\FullModuleList', $this->fullModuleList], + ])); + } + + /** + * @param bool $isEnable + * @param bool $clearStaticContent + * @param string $expectedMessage + * + * @dataProvider executeDataProvider + */ + public function testExecute($isEnable, $clearStaticContent, $expectedMessage) + { + $this->status->expects($this->once()) + ->method('getModulesToChange') + ->with($isEnable, ['Magento_Module1', 'Magento_Module2']) + ->will($this->returnValue(['Magento_Module1'])); + + $this->status->expects($this->any()) + ->method('checkConstraints') + ->will($this->returnValue([])); + + $this->status->expects($this->once()) + ->method('setIsEnabled') + ->with($isEnable, ['Magento_Module1']); + + $this->cache->expects($this->once()) + ->method('clean'); + $this->cleanupFiles->expects($this->once()) + ->method('clearCodeGeneratedClasses'); + $this->cleanupFiles->expects($clearStaticContent ? $this->once() : $this->never()) + ->method('clearMaterializedViewFiles'); + + $commandTester = $isEnable + ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) + : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); + $input = ['module' => ['Magento_Module1', 'Magento_Module2']]; + if ($clearStaticContent) { + $input['--clear-static-content'] = true; + } + $commandTester->execute($input); + $this->assertStringMatchesFormat($expectedMessage, $commandTester->getDisplay()); + } + + /** + * @return array + */ + public function executeDataProvider() + { + return [ + 'enable, do not clear static content' => [ + true, + false, + '%amodules have been enabled%aMagento_Module1%aGenerated static view files were not cleared%a' + ], + 'disable, do not clear static content' => [ + false, + false, + '%amodules have been disabled%aMagento_Module1%aGenerated static view files were not cleared%a' + ], + 'enable, clear static content' => [ + true, + true, + '%amodules have been enabled%aMagento_Module1%aGenerated static view files cleared%a' + ], + 'disable, clear static content' => [ + false, + true, + '%amodules have been disabled%aMagento_Module1%aGenerated static view files cleared%a' + ], + ]; + } + + /** + * @param bool $isEnable + * @param string $expectedMessage + * + * @dataProvider executeAllDataProvider + */ + public function testExecuteAll($isEnable, $expectedMessage) + { + $this->fullModuleList->expects($this->once()) + ->method('getNames') + ->will($this->returnValue(['Magento_Module1', 'Magento_Module2'])); + + $this->status->expects($this->once()) + ->method('getModulesToChange') + ->with($isEnable, ['Magento_Module1', 'Magento_Module2']) + ->will($this->returnValue(['Magento_Module1'])); + + $this->status->expects($this->any()) + ->method('checkConstraints') + ->will($this->returnValue([])); + + $this->status->expects($this->once()) + ->method('setIsEnabled') + ->with($isEnable, ['Magento_Module1']); + + $commandTester = $isEnable + ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) + : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); + $input = ['--all' => true]; + $commandTester->execute($input); + $this->assertStringMatchesFormat($expectedMessage, $commandTester->getDisplay()); + } + + /** + * @return array + */ + public function executeAllDataProvider() + { + return [ + 'enable' => [true, '%amodules have been enabled%aMagento_Module1%a'], + 'disable' => [false, '%amodules have been disabled%aMagento_Module1%a'], + ]; + } + + /** + * @param bool $isEnable + * + * @dataProvider executeWithConstraintsDataProvider + */ + public function testExecuteWithConstraints($isEnable) + { + $this->status->expects($this->once()) + ->method('getModulesToChange') + ->with($isEnable, ['Magento_Module1', 'Magento_Module2']) + ->will($this->returnValue(['Magento_Module1'])); + + $this->status->expects($this->any()) + ->method('checkConstraints') + ->will($this->returnValue(['constraint1', 'constraint2'])); + + $this->status->expects($this->never()) + ->method('setIsEnabled'); + + $commandTester = $isEnable + ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) + : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); + $commandTester->execute(['module' => ['Magento_Module1', 'Magento_Module2']]); + $this->assertStringMatchesFormat( + 'Unable to change status of modules%aconstraint1%aconstraint2%a', + $commandTester->getDisplay() + ); + } + + /** + * @return array + */ + public function executeWithConstraintsDataProvider() + { + return [ + 'enable' => [true], + 'disable' => [false], + ]; + } + + /** + * @param bool $isEnable + * @param string $expectedMessage + * + * @dataProvider executeExecuteForceDataProvider + */ + public function testExecuteForce($isEnable, $expectedMessage) + { + $this->status->expects($this->once()) + ->method('getModulesToChange') + ->with($isEnable, ['Magento_Module1', 'Magento_Module2']) + ->will($this->returnValue(['Magento_Module1'])); + + $this->status->expects($this->never()) + ->method('checkConstraints'); + + $this->status->expects($this->once()) + ->method('setIsEnabled') + ->with($isEnable, ['Magento_Module1']); + + $commandTester = $isEnable + ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) + : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); + $commandTester->execute(['module' => ['Magento_Module1', 'Magento_Module2'], '--force' => true]); + $this->assertStringMatchesFormat( + $expectedMessage . '%amodules might not function properly%a', + $commandTester->getDisplay() + ); + } + + /** + * @return array + */ + public function executeExecuteForceDataProvider() + { + return [ + 'enable' => [true, '%amodules have been enabled%aMagento_Module1%a'], + 'disable' => [false, '%amodules have been disabled%aMagento_Module1%a'], + ]; + } + + /** + * @param bool $isEnable + * + * @dataProvider executeWithConstraintsDataProvider + */ + public function testExecuteNoChanges($isEnable) + { + $this->status->expects($this->once()) + ->method('getModulesToChange') + ->with($isEnable, ['Magento_Module1', 'Magento_Module2']) + ->will($this->returnValue([])); + + $this->status->expects($this->never()) + ->method('setIsEnabled'); + + $commandTester = $isEnable + ? new CommandTester(new ModuleEnableCommand($this->objectManagerProvider)) + : new CommandTester(new ModuleDisableCommand($this->objectManagerProvider)); + $commandTester->execute(['module' => ['Magento_Module1', 'Magento_Module2']]); + $this->assertStringMatchesFormat( + 'No modules were changed%a', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleStatusCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleStatusCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2010188f4a8c552e88f95a8ffbe015617f5016db --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/ModuleStatusCommandTest.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\ModuleStatusCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class ModuleStatusCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); + $objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); + $objectManagerProvider->expects($this->any()) + ->method('get') + ->will($this->returnValue($objectManager)); + $moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false); + $fullModuleList = $this->getMock('Magento\Framework\Module\FullModuleList', [], [], '', false); + $objectManager->expects($this->any()) + ->method('create') + ->will($this->returnValueMap([ + ['Magento\Framework\Module\ModuleList', [], $moduleList], + ['Magento\Framework\Module\FullModuleList', [], $fullModuleList], + ])); + $moduleList->expects($this->any()) + ->method('getNames') + ->will($this->returnValue(['Magento_Module1', 'Magento_Module2'])); + $fullModuleList->expects($this->any()) + ->method('getNames') + ->will($this->returnValue(['Magento_Module1', 'Magento_Module2', 'Magento_Module3'])); + $commandTester = new CommandTester(new ModuleStatusCommand($objectManagerProvider)); + $commandTester->execute([]); + $this->assertStringMatchesFormat( + 'List of enabled modules%aMagento_Module1%aMagento_Module2%a' + . 'List of disabled modules%aMagento_Module3%a', + $commandTester->getDisplay() + ); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/UninstallCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/UninstallCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..14090e2388ea3d5cad1f1b5aa11ef8e45d78b7ce --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/UninstallCommandTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Model\InstallerFactory; +use Magento\Setup\Console\Command\UninstallCommand; +use Symfony\Component\Console\Tester\CommandTester; +use Magento\Setup\Model\Installer; + +class UninstallCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var InstallerFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $installerFactory; + + /** + * @var Installer|\PHPUnit_Framework_MockObject_MockObject + */ + private $installer; + + /** + * @var UninstallCommand|\PHPUnit_Framework_MockObject_MockObject + */ + private $command; + + public function setUp() + { + $this->installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $this->installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $this->command = new UninstallCommand($this->installerFactory); + } + + public function testExecuteInteractionYes() + { + $this->installer->expects($this->once())->method('uninstall'); + $this->installerFactory->expects($this->once())->method('create')->will($this->returnValue($this->installer)); + + $this->checkInteraction(true); + } + + public function testExecuteInteractionNo() + { + $this->installer->expects($this->exactly(0))->method('uninstall'); + $this->installerFactory->expects($this->exactly(0))->method('create'); + + $this->checkInteraction(false); + } + + public function checkInteraction($answer) + { + $question = $this->getMock('Symfony\Component\Console\Helper\QuestionHelper', [], [], '', false); + $question + ->expects($this->once()) + ->method('ask') + ->will($this->returnValue($answer)); + + /** @var \Symfony\Component\Console\Helper\HelperSet|\PHPUnit_Framework_MockObject_MockObject $helperSet */ + $helperSet = $this->getMock('Symfony\Component\Console\Helper\HelperSet', [], [], '', false); + $helperSet + ->expects($this->once()) + ->method('get') + ->with('question') + ->will($this->returnValue($question)); + $this->command->setHelperSet($helperSet); + + $tester = new CommandTester($this->command); + $tester->execute([]); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/UpgradeCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/UpgradeCommandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..41ed13c09d4e829435cbe392bd04b96e08397390 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/UpgradeCommandTest.php @@ -0,0 +1,24 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Console\Command\UpgradeCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class UpgradeCommandTest extends \PHPUnit_Framework_TestCase +{ + public function testExecute() + { + $installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); + $installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); + $installer->expects($this->at(0))->method('updateModulesSequence'); + $installer->expects($this->at(1))->method('installSchema'); + $installer->expects($this->at(2))->method('installDataFixtures'); + $installerFactory->expects($this->once())->method('create')->willReturn($installer); + $commandTester = new CommandTester(new UpgradeCommand($installerFactory)); + $commandTester->execute([]); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Console/CommandListTest.php b/setup/src/Magento/Setup/Test/Unit/Console/CommandListTest.php index 3e0d5bd666a426f36004c7a99cd6d8d2f181286b..39e78dc660683bd3b555ed6553dfc9e09f591c63 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/CommandListTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/CommandListTest.php @@ -28,9 +28,34 @@ class CommandListTest extends \PHPUnit_Framework_TestCase public function testGetCommands() { - $this->serviceManager->expects($this->at(0)) - ->method('create') - ->with('Magento\Setup\Console\Command\ConfigSetCommand'); + $commands = [ + 'Magento\Setup\Console\Command\AdminUserCreateCommand', + 'Magento\Setup\Console\Command\ConfigSetCommand', + 'Magento\Setup\Console\Command\DbDataUpgradeCommand', + 'Magento\Setup\Console\Command\DbSchemaUpgradeCommand', + 'Magento\Setup\Console\Command\DbStatusCommand', + 'Magento\Setup\Console\Command\InfoCurrencyListCommand', + 'Magento\Setup\Console\Command\InfoLanguageListCommand', + 'Magento\Setup\Console\Command\InfoTimezoneListCommand', + 'Magento\Setup\Console\Command\InstallCommand', + 'Magento\Setup\Console\Command\InstallStoreConfigurationCommand', + 'Magento\Setup\Console\Command\ModuleEnableCommand', + 'Magento\Setup\Console\Command\ModuleDisableCommand', + 'Magento\Setup\Console\Command\ModuleStatusCommand', + 'Magento\Setup\Console\Command\MaintenanceAllowIpsCommand', + 'Magento\Setup\Console\Command\MaintenanceDisableCommand', + 'Magento\Setup\Console\Command\MaintenanceEnableCommand', + 'Magento\Setup\Console\Command\MaintenanceStatusCommand', + 'Magento\Setup\Console\Command\UpgradeCommand', + 'Magento\Setup\Console\Command\UninstallCommand', + ]; + $index = 0; + foreach ($commands as $command) { + $this->serviceManager->expects($this->at($index++)) + ->method('create') + ->with($command); + } + $this->commandList->getCommands(); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php deleted file mode 100644 index 6a5abfd72e66e018024faefac3ebd3b965913e89..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php +++ /dev/null @@ -1,663 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -// @codingStandardsIgnoreFile - -namespace Magento\Setup\Test\Unit\Controller; - -use \Magento\Setup\Controller\ConsoleController; - -use Magento\Framework\Module\DbVersionInfo; -use Magento\Setup\Model\UserConfigurationDataMapper as UserConfig; - -class ConsoleControllerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\ConsoleLogger - */ - private $consoleLogger; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\Lists - */ - private $options; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\Installer - */ - private $installer; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\MaintenanceMode - */ - private $maintenanceMode; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Mvc\MvcEvent - */ - private $mvcEvent; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Console\Request - */ - private $request; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Stdlib\Parameters - */ - private $parameters; - - /** - * @var ConsoleController - */ - private $controller; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManagerInterface - */ - private $objectManager; - - public function setUp() - { - $this->consoleLogger = $this->getMock('Magento\Setup\Model\ConsoleLogger', [], [], '', false); - $installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false); - $this->installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false); - $installerFactory->expects($this->once())->method('create')->with($this->consoleLogger)->willReturn( - $this->installer - ); - $this->options = $this->getMock('Magento\Setup\Model\Lists', [], [], '', false); - $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false); - - $this->request = $this->getMock('Zend\Console\Request', [], [], '', false); - $response = $this->getMock('Zend\Console\Response', [], [], '', false); - $routeMatch = $this->getMock('Zend\Mvc\Router\RouteMatch', [], [], '', false); - - $this->parameters= $this->getMock('Zend\Stdlib\Parameters', [], [], '', false); - $this->request->expects($this->any())->method('getParams')->willReturn($this->parameters); - - $this->mvcEvent = $this->getMock('Zend\Mvc\MvcEvent', [], [], '', false); - $this->mvcEvent->expects($this->once())->method('setRequest')->with($this->request)->willReturn( - $this->mvcEvent - ); - $this->mvcEvent->expects($this->once())->method('getRequest')->willReturn($this->request); - $this->mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($this->mvcEvent); - $routeMatch->expects($this->any())->method('getParam')->willReturn('not-found'); - $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - - $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); - $objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false); - $objectManagerProvider->expects($this->any())->method('get')->willReturn($this->objectManager); - - $this->controller = new ConsoleController( - $this->consoleLogger, - $this->options, - $installerFactory, - $this->maintenanceMode, - $objectManagerProvider - ); - $this->controller->setEvent($this->mvcEvent); - $this->controller->dispatch($this->request, $response); - } - - public function testGetRouterConfig() - { - $controller = $this->controller; - $actualRoute = $controller::getRouterConfig(); - foreach ($actualRoute as $route) { - $options = $route['options']; - $this->assertArrayHasKey('route', $options); - $this->assertArrayHasKey('defaults', $options); - $defaults = $options['defaults']; - $this->assertArrayHasKey('controller', $defaults); - $this->assertArrayHasKey('action', $defaults); - } - } - - public function testSetEventManager() - { - $eventManager = $this->getMock('Zend\EventManager\EventManagerInterface'); - $eventManager->expects($this->atLeastOnce())->method('attach'); - $returnValue = $this->controller->setEventManager($eventManager); - $this->assertSame($returnValue, $this->controller); - } - - public function testOnDispatch() - { - $returnValue = $this->controller->onDispatch($this->mvcEvent); - $this->assertInstanceOf('Zend\View\Model\ConsoleModel', $returnValue); - } - - public function testOnDispatchWithException() - { - $errorMessage = 'Missing route matches; unsure how to retrieve action'; - $event = $this->getMock('Zend\Mvc\MvcEvent'); - $exception = $this->getMock('Magento\Setup\Exception', ['getCode'], [$errorMessage]); - $event->expects($this->once())->method('getRouteMatch')->willThrowException($exception); - $this->consoleLogger->expects($this->once())->method('log')->with($errorMessage); - $this->controller->onDispatch($event); - } - - public function testInstallAction() - { - $this->installer->expects($this->once())->method('install')->with($this->parameters); - $this->controller->installAction(); - } - - public function testInstallSchemaAction() - { - $this->installer->expects($this->once())->method('installSchema'); - $this->controller->installSchemaAction(); - } - - public function testInstallDataAction() - { - $this->installer->expects($this->once())->method('installDataFixtures'); - $this->controller->installDataAction(); - } - - public function testUpdateAction() - { - $this->installer->expects($this->at(0))->method('updateModulesSequence'); - $this->installer->expects($this->at(1))->method('installSchema'); - $this->installer->expects($this->at(2))->method('installDataFixtures'); - $this->controller->updateAction(); - } - - /** - * @param array $outdated - * @param array $expected - * - * @dataProvider dbStatusActionDataProvider - */ - public function testDbStatusAction(array $outdated, array $expected) - { - $dbVersionInfo = $this->getMock('\Magento\Framework\Module\DbVersionInfo', [], [], '', false); - $this->objectManager->expects($this->once()) - ->method('get') - ->with('Magento\Framework\Module\DbVersionInfo') - ->will($this->returnValue($dbVersionInfo)); - $dbVersionInfo->expects($this->once()) - ->method('getDbVersionErrors') - ->will($this->returnValue($outdated)); - foreach ($expected as $at => $message) { - $this->consoleLogger->expects($this->at($at)) - ->method('log') - ->with($this->matches($message)); - } - $this->controller->dbStatusAction(); - } - - /** - * @return array - */ - public function dbStatusActionDataProvider() - { - return [ - 'one outdated module' => [ - [[ - DbVersionInfo::KEY_MODULE => 'Module_One', - DbVersionInfo::KEY_TYPE => 'schema', - DbVersionInfo::KEY_CURRENT => '1.0.0', - DbVersionInfo::KEY_REQUIRED => '1.0.1', - ]], - [ - 1 => '%wModule_One%wschema:%w1.0.0%w->%w1.0.1%w', - 2 => 'Run the "Update" command to update your DB schema and data' - ], - ], - 'no outdated modules' => [ - [], - [0 => 'All modules are up to date'], - ], - 'one newer module' => [ - [[ - DbVersionInfo::KEY_MODULE => 'Module_One', - DbVersionInfo::KEY_TYPE => 'schema', - DbVersionInfo::KEY_CURRENT => '1.0.1', - DbVersionInfo::KEY_REQUIRED => '1.0.0', - ]], - [ - 1 => '%wModule_One%wschema:%w1.0.1%w->%w1.0.0%w', - 2 => 'Some modules use code versions newer or older than the database. ' . - 'First update the module code, then run the "Update" command.' - ], - ], - 'one none module' => [ - [[ - DbVersionInfo::KEY_MODULE => 'Module_One', - DbVersionInfo::KEY_TYPE => 'schema', - DbVersionInfo::KEY_CURRENT => 'none', - DbVersionInfo::KEY_REQUIRED => '1.0.0', - ]], - [ - 1 => '%wModule_One%wschema:%wnone%w->%w1.0.0%w', - 2 => 'Run the "Update" command to update your DB schema and data' - ], - ] - ]; - } - - public function testInstallUserConfigAction() - { - $this->installer->expects($this->once())->method('installUserConfig')->with($this->parameters); - $this->controller->installUserConfigAction(); - } - - public function testInstallAdminUserAction() - { - $this->installer->expects($this->once())->method('installAdminUser')->with($this->parameters); - $this->controller->installAdminUserAction(); - } - - public function testUninstallAction() - { - $this->installer->expects($this->once())->method('uninstall'); - $this->controller->uninstallAction(); - } - - /** - * @param int $maintenanceMode - * @param int $setCount - * @param int $logCount - * - * @dataProvider maintenanceActionDataProvider - */ - public function testMaintenanceAction($maintenanceMode, $setCount, $logCount) - { - $mapGetParam = [ - ['set', null, $maintenanceMode], - ['addresses', null, null], - ]; - $this->request->expects($this->exactly(2))->method('getParam')->will($this->returnValueMap($mapGetParam)); - $this->maintenanceMode->expects($this->exactly($setCount))->method('set'); - $this->maintenanceMode->expects($this->exactly(0))->method('setAddresses'); - $this->maintenanceMode->expects($this->once())->method('isOn')->willReturn($maintenanceMode); - $this->maintenanceMode->expects($this->once())->method('getAddressInfo')->willReturn([]); - $this->consoleLogger->expects($this->exactly($logCount))->method('log'); - $this->controller->maintenanceAction(); - } - - /** - * @return array - */ - public function maintenanceActionDataProvider() - { - return [ - [1, 1, 2], - [0, 1, 2], - [null, 0, 1], - ]; - } - - /** - * @param array $addresses - * @param int $logCount - * @param int $setAddressesCount - * - * @dataProvider maintenanceActionWithAddressDataProvider - */ - public function testMaintenanceActionWithAddress($addresses, $logCount, $setAddressesCount) - { - $mapGetParam = [ - ['set', null, true], - ['addresses', null, $addresses], - ]; - $this->request->expects($this->exactly(2))->method('getParam')->will($this->returnValueMap($mapGetParam)); - $this->maintenanceMode->expects($this->exactly(1))->method('set'); - $this->maintenanceMode->expects($this->exactly($setAddressesCount))->method('setAddresses'); - $this->maintenanceMode->expects($this->once())->method('isOn')->willReturn(true); - $this->maintenanceMode->expects($this->once())->method('getAddressInfo')->willReturn($addresses); - $this->consoleLogger->expects($this->exactly($logCount))->method('log'); - $this->controller->maintenanceAction(); - } - - /** - * @return array - */ - public function maintenanceActionWithAddressDataProvider() - { - return [ - [['address1', 'address2'], 3, 1], - [[], 2, 1], - [null, 2, 0], - ]; - } - - /** - * @param string $type - * @param string $method - * @param array $expectedValue - * - * @dataProvider helpActionForLanguageCurrencyTimezoneDataProvider - */ - public function testHelpActionForLanguageCurrencyTimezone($type, $method, $expectedValue) - { - $this->request->expects($this->once())->method('getParam')->willReturn($type); - $this->options->expects($this->once())->method($method)->willReturn($expectedValue); - $returnValue = $this->controller->helpAction(); - - //Need to convert from String to associative array. - $result = explode("\n", trim($returnValue)); - $actual = []; - foreach ($result as $value) { - $tempArray = explode(' => ', $value); - $actual[$tempArray[0]] = $tempArray[1]; - } - - $this->assertSame($expectedValue, $actual); - } - - /** - * @return array - */ - public function helpActionForLanguageCurrencyTimezoneDataProvider() - { - return [ - [UserConfig::KEY_LANGUAGE, 'getLocaleList', [ - 'someCode1' => 'some country', - 'someCode2' => 'some country2', - ] - ], - [UserConfig::KEY_CURRENCY, 'getCurrencyList', [ - 'currencyCode1' => 'some currency1', - 'currencyCode2' => 'some currency2', - ] - ], - [UserConfig::KEY_TIMEZONE, 'getTimezoneList', [ - 'timezone1' => 'some specific timezone1', - 'timezone2' => 'some specific timezone2', - ] - ], - ]; - } - - public function testHelpActionForModuleList() - { - $this->request->expects($this->once())->method('getParam')->willReturn(ConsoleController::HELP_LIST_OF_MODULES); - $moduleListMock = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false); - $moduleListMock - ->expects($this->once()) - ->method('getNames') - ->will($this->returnValue(['Magento_Theme', 'Magento_Store'])); - $fullModuleListMock = $this->getMock('Magento\Framework\Module\FullModuleList', [], [], '', false); - $fullModuleListMock - ->expects($this->once()) - ->method('getNames') - ->will($this->returnValue(['Magento_Theme', 'Magento_Store', 'Magento_Directory'])); - $returnValueMap = [ - [ - 'Magento\Framework\Module\ModuleList', - [], - $moduleListMock, - ], - [ - 'Magento\Framework\Module\FullModuleList', - [], - $fullModuleListMock, - ], - ]; - $this->objectManager->expects($this->exactly(2)) - ->method('create') - ->will($this->returnValueMap($returnValueMap)); - $this->controller->helpAction(); - } - - public function testHelpActionNoType() - { - $beginHelpString = "\n==-------------------==\n" - . " Magento Setup CLI \n" - . "==-------------------==\n"; - $this->request->expects($this->once())->method('getParam')->willReturn(false); - $returnValue = $this->controller->helpAction(); - $this->assertStringStartsWith($beginHelpString, $returnValue); - } - - /** - * @param string $command - * @param string $modules - * @param bool $isForce - * @param bool $expectedIsEnabled - * @param string[] $expectedModules - * @dataProvider moduleActionDataProvider - */ - public function testModuleAction($command, $modules, $isForce, $expectedIsEnabled, $expectedModules) - { - $status = $this->getModuleActionMocks($command, $modules, $isForce, false); - $status->expects($this->once())->method('getModulesToChange')->willReturn($expectedModules); - if (!$isForce) { - $status->expects($this->once())->method('checkConstraints')->willReturn([]); - } - $status->expects($this->once()) - ->method('setIsEnabled') - ->with($expectedIsEnabled, $expectedModules); - $this->consoleLogger->expects($this->once())->method('log'); - $this->controller->moduleAction(); - } - - /** - * @return array - */ - public function moduleActionDataProvider() - { - return [ - [ConsoleController::CMD_MODULE_ENABLE, 'Module_Foo,Module_Bar', false, true, ['Module_Foo', 'Module_Bar']], - [ConsoleController::CMD_MODULE_ENABLE, 'Module_Foo,Module_Bar', true, true, ['Module_Foo', 'Module_Bar']], - [ConsoleController::CMD_MODULE_DISABLE, 'Module_Foo', false, false, ['Module_Foo']], - [ConsoleController::CMD_MODULE_DISABLE, 'Module_Bar', true, false, ['Module_Bar']], - ]; - } - - /** - * @param string $command - * @param string $modules - * @param bool $isForce - * @param bool $expectedIsEnabled - * @param string[] $expectedModules - * @dataProvider moduleActionEnabledSuggestionMessageDataProvider - */ - public function testModuleActionEnabledSuggestionMessage( - $command, - $modules, - $isForce, - $expectedIsEnabled, - $expectedModules - ) { - $status = $this->getModuleActionMocks($command, $modules, $isForce, false); - $status->expects($this->once())->method('getModulesToChange')->willReturn($expectedModules); - if (!$isForce) { - $status->expects($this->once())->method('checkConstraints')->willReturn([]); - } - $status->expects($this->once()) - ->method('setIsEnabled') - ->with($expectedIsEnabled, $expectedModules); - $this->consoleLogger->expects($this->once()) - ->method('log') - ->with($this->stringContains( - "To make sure that the enabled modules are properly registered, run 'update' command." - )); - $this->controller->moduleAction(); - } - - /** - * @return array - */ - public function moduleActionEnabledSuggestionMessageDataProvider() - { - return [ - [ConsoleController::CMD_MODULE_ENABLE, 'Module_Foo,Module_Bar', false, true, ['Module_Foo', 'Module_Bar']], - [ConsoleController::CMD_MODULE_ENABLE, 'Module_Foo,Module_Bar', true, true, ['Module_Foo', 'Module_Bar']], - [ConsoleController::CMD_MODULE_ENABLE, 'Module_Foo,Module_Bar', false, true, ['Module_Foo']], - ]; - } - - /** - * @param string $command - * @param string $modules - * @param bool $isForce - * @param bool $expectedIsEnabled - * @param string[] $expectedModules - * @dataProvider moduleActionDataProvider - */ - public function testModuleActionNoChanges($command, $modules, $isForce, $expectedIsEnabled, $expectedModules) - { - $status = $this->getModuleActionMocks($command, $modules, $isForce, true); - $status->expects($this->once()) - ->method('getModulesToChange') - ->with($expectedIsEnabled, $expectedModules) - ->willReturn([]); - $status->expects($this->never())->method('checkConstraints'); - $status->expects($this->never())->method('setIsEnabled'); - $this->consoleLogger->expects($this->once())->method('log'); - $this->controller->moduleAction(); - } - - /** - * @param string $command - * @param string $modules - * @param bool $isForce - * @param bool $expectedIsEnabled - * @param string[] $modulesToChange - * @dataProvider moduleActionPartialNoChangesDataProvider - */ - public function testModuleActionPartialNoChanges( - $command, - $modules, - $isForce, - $expectedIsEnabled, - $modulesToChange - ) { - $status = $this->getModuleActionMocks($command, $modules, $isForce, false); - $status->expects($this->once())->method('getModulesToChange')->willReturn($modulesToChange); - if (!$isForce) { - $status->expects($this->once())->method('checkConstraints')->willReturn([]); - } - $status->expects($this->once()) - ->method('setIsEnabled') - ->with($expectedIsEnabled, $modulesToChange); - $this->consoleLogger->expects($this->once())->method('log'); - $this->controller->moduleAction(); - } - - /** - * @return array - */ - public function moduleActionPartialNoChangesDataProvider() - { - return [ - [ - ConsoleController::CMD_MODULE_ENABLE, - 'Module_Foo,Module_Bar', - false, - true, - ['Module_Bar'], - ], - [ - ConsoleController::CMD_MODULE_ENABLE, - 'Module_Foo,Module_Bar', - true, - true, - ['Module_Bar'], - ], - [ - ConsoleController::CMD_MODULE_DISABLE, - 'Module_Foo,Module_Bar', - false, - false, - ['Module_Bar'], - ], - [ - ConsoleController::CMD_MODULE_DISABLE, - 'Module_Foo,Module_Bar', - true, - false, - ['Module_Bar'], - ], - ]; - } - - /** - * Prepares a set of mocks for testing module action - * - * @param string $command - * @param string $modules - * @param bool $isForce - * @param bool $isUnchanged - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function getModuleActionMocks($command, $modules, $isForce, $isUnchanged) - { - $this->request->expects($this->at(0))->method('getParam')->with(0)->willReturn($command); - $this->request->expects($this->at(1))->method('getParam')->with('modules')->willReturn($modules); - if (!$isUnchanged) { - $this->request->expects($this->at(2))->method('getParam')->with('force')->willReturn($isForce); - } - $status = $this->getMock('Magento\Framework\Module\Status', [], [], '', false); - $this->objectManager->expects($this->once()) - ->method('create') - ->will($this->returnValue($status)); - return $status; - } - - /** - * @expectedException \Magento\Setup\Exception - * @expectedExceptionMessage Unable to change status of modules because of the following constraints: - */ - public function testModuleActionNotAllowed() - { - $status = $this->getModuleActionMocks( - ConsoleController::CMD_MODULE_ENABLE, - 'Module_Foo,Module_Bar', - false, - false - ); - $status->expects($this->once())->method('getModulesToChange')->willReturn(['Module_Foo', 'Module_Bar']); - $status->expects($this->once()) - ->method('checkConstraints') - ->willReturn(['Circular dependency of Foo and Bar']); - $status->expects($this->never())->method('setIsEnabled'); - $this->controller->moduleAction(); - } - - /** - * @param string $option - * @param string $noParameters - * - * @dataProvider helpActionDataProvider - */ - public function testHelpAction($option, $noParameters) - { - $this->request->expects($this->once())->method('getParam')->willReturn($option); - - $usage = $this->controller->getCommandUsage(); - $expectedValue = explode(' ', (strlen($usage[$option]) > 0 ? $usage[$option] : $noParameters)); - $returnValue = explode( - ' ', - trim(str_replace([PHP_EOL, 'Available parameters:'], '', $this->controller->helpAction())) - ); - $expectedValue = asort($expectedValue); - $returnValue = asort($returnValue); - $this->assertEquals($expectedValue, $returnValue); - } - - /** - * @return array - */ - public function helpActionDataProvider() - { - $noParameters = 'This command has no parameters.'; - return [ - ['install',''], - ['update', $noParameters], - ['uninstall', $noParameters], - ['install-schema', $noParameters], - ['install-data', $noParameters], - ['install-user-configuration', ''], - ['install-admin-user', ''], - ['maintenance', ''], - ['help', ''], - ]; - } -} diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php index 1607eebca1f174e42adbdf5936c7c9af878ac91d..96a30e19ac7a847092e8c1211c0e3f52f55d5c3e 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/ModulesTest.php @@ -35,7 +35,6 @@ class ModulesTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); - $this->status = $this->getMock('Magento\Framework\Module\Status', [], [], '', false); /** @var * $objectManagerProvider \PHPUnit_Framework_MockObject_MockObject|\Magento\Setup\Model\ObjectManagerProvider */ diff --git a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php index 938c72b9b2693f89975184f03958aa04fb0dc467..598641f1b844c84309a107b93c109ba0a88ab3d9 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php @@ -58,7 +58,7 @@ class AdminAccountTest extends \PHPUnit_Framework_TestCase AdminAccount::KEY_LAST_NAME => 'Doe', AdminAccount::KEY_EMAIL => 'john.doe@test.com', AdminAccount::KEY_PASSWORD => '123123q', - AdminAccount::KEY_USERNAME => 'admin', + AdminAccount::KEY_USER => 'admin', ]; $this->adminAccount = new AdminAccount($this->setUpMock, $this->randomMock, $data); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/ConsoleLoggerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/ConsoleLoggerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..af381ada33f4db5564b64cc1ad1cfe359c3a68ac --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Model/ConsoleLoggerTest.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Model; + +use Magento\Setup\Model\ConsoleLogger; + +class ConsoleLoggerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\Console\Output\OutputInterface + */ + private $console; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject |\Magento\Setup\Model\ConsoleLogger + */ + private $consoleLoggerModel; + + public function setUp() + { + $this->console = $this->getMock('Symfony\Component\Console\Output\OutputInterface', [], [], '', false); + $outputFormatter = $this->getMock( + 'Symfony\Component\Console\Formatter\OutputFormatterInterface', + [], + [], + '', + false + ); + $this->console + ->expects($this->once()) + ->method('getFormatter') + ->willReturn($outputFormatter); + $this->consoleLoggerModel = new ConsoleLogger($this->console); + } + + public function testLogSuccess() + { + $this->console + ->expects($this->once()) + ->method('writeln') + ->with('<info>[SUCCESS]: Success message.</info>'); + $this->consoleLoggerModel->logSuccess('Success message.'); + } + + public function testLogError() + { + $exception = $this->getMock('\Exception', [], [], '', false); + $this->console + ->expects($this->once()) + ->method('writeln') + ->with('<error>[ERROR]: </error>'); + $this->consoleLoggerModel->logError($exception); + } + + public function testLog() + { + $this->console + ->expects($this->once()) + ->method('writeln') + ->with('<detail>Detail message.</detail>'); + $this->consoleLoggerModel->log('Detail message.'); + } + + public function testLogInline() + { + $this->console + ->expects($this->once()) + ->method('write') + ->with('<detail>Detail message.</detail>'); + $this->consoleLoggerModel->logInline('Detail message.'); + } + + public function testLogMeta() + { + $this->console + ->expects($this->once()) + ->method('writeln') + ->with('<metadata>Meta message.</metadata>'); + $this->consoleLoggerModel->logMeta('Meta message.'); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php index b211b970509dd0b5bba1e6aeb23cf04d9152b6b8..291fee230a4bc3e33bd60c1d0cb16fee12bd2df5 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerFactoryTest.php @@ -73,6 +73,10 @@ class InstallerFactoryTest extends \PHPUnit_Framework_TestCase 'Magento\Setup\Model\ConfigModel', $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false), ], + [ + 'Magento\Framework\App\State\CleanupFiles', + $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false), + ], ]; $serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']); $serviceLocatorMock diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php index 2423d8c903342da47c4b165d772771a8dda64c7c..553c5c8ed4c1ec544a824a240237a1b0eb505dca 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php @@ -9,10 +9,10 @@ namespace Magento\Setup\Test\Unit\Model; use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList; use Magento\Framework\Config\ConfigOptionsList as SetupConfigOptionsList; use \Magento\Setup\Model\Installer; -use Magento\Framework\Config\ConfigOptionsList; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem\DriverPool; use Magento\Framework\Config\File\ConfigFilePool; +use Magento\Framework\App\State\CleanupFiles; /** * @SuppressWarnings(PHPMD.TooManyFields) @@ -105,6 +105,11 @@ class InstallerTest extends \PHPUnit_Framework_TestCase */ private $configModel; + /** + * @var CleanupFiles|\PHPUnit_Framework_MockObject_MockObject + */ + private $cleanupFiles; + /** * Sample DB configuration segment * @@ -117,7 +122,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase SetupConfigOptionsList::KEY_HOST => '127.0.0.1', SetupConfigOptionsList::KEY_NAME => 'magento', SetupConfigOptionsList::KEY_USER => 'magento', - SetupConfigOptionsList::KEY_PASS => '', + SetupConfigOptionsList::KEY_PASSWORD => '', ], ], ]; @@ -153,6 +158,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface'); $this->contextMock = $this->getMock('Magento\Framework\Model\Resource\Db\Context', [], [], '', false); $this->configModel = $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false); + $this->cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false); $this->object = $this->createObject(); } @@ -189,7 +195,8 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $this->sampleData, $objectManagerProvider, $this->contextMock, - $this->configModel + $this->configModel, + $this->cleanupFiles ); } @@ -300,18 +307,27 @@ class InstallerTest extends \PHPUnit_Framework_TestCase public function testUpdateModulesSequence() { - $varDir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); - $varDir->expects($this->exactly(2))->method('getAbsolutePath')->willReturn('/var'); - $this->filesystem - ->expects($this->exactly(2)) - ->method('getDirectoryWrite') - ->willReturn($varDir); - $allModules = [ 'Foo_One' => [], 'Bar_Two' => [], 'New_Module' => [], ]; + $this->cleanupFiles->expects($this->once())->method('clearCodeGeneratedClasses')->will( + $this->returnValue( + [ + "The directory '/generation' doesn't exist - skipping cleanup", + ] + ) + ); + + $cache = $this->getMock('Magento\Framework\App\Cache', [], [], '', false); + $cache->expects($this->once())->method('clean'); + $this->objectManager->expects($this->once()) + ->method('create') + ->will($this->returnValueMap([ + ['Magento\Framework\App\Cache', [], $cache], + ])); + $this->moduleLoader->expects($this->once())->method('load')->willReturn($allModules); $expectedModules = [ @@ -330,9 +346,10 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $this->configReader->expects($this->once())->method('load') ->willReturn(['modules' => ['Bar_Two' => 0, 'Foo_One' => 1, 'Old_Module' => 0] ]); $this->configWriter->expects($this->once())->method('saveConfig')->with($expectedModules); - $this->logger->expects($this->at(0))->method('log')->with('File system cleanup:'); - $this->logger->expects($this->at(1))->method('log') - ->with('The directory \'/var\' doesn\'t exist - skipping cleanup'); + $this->logger->expects($this->at(0))->method('log')->with('Cache cleared successfully'); + $this->logger->expects($this->at(1))->method('log')->with('File system cleanup:'); + $this->logger->expects($this->at(2))->method('log') + ->with('The directory \'/generation\' doesn\'t exist - skipping cleanup'); $this->logger->expects($this->at(3))->method('log')->with('Updating modules:'); $newObject->updateModulesSequence(); } @@ -340,18 +357,12 @@ class InstallerTest extends \PHPUnit_Framework_TestCase public function testUninstall() { $this->config->expects($this->once())->method('isAvailable')->willReturn(false); - $varDir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); - $varDir->expects($this->once())->method('getAbsolutePath')->willReturn('/var'); - $staticDir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); - $staticDir->expects($this->once())->method('getAbsolutePath')->willReturn('/static'); $configDir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); $configDir->expects($this->once())->method('getAbsolutePath')->willReturn('/config/config.php'); $this->filesystem ->expects($this->any()) ->method('getDirectoryWrite') ->will($this->returnValueMap([ - [DirectoryList::VAR_DIR, DriverPool::FILE, $varDir], - [DirectoryList::STATIC_VIEW, DriverPool::FILE, $staticDir], [DirectoryList::CONFIG, DriverPool::FILE, $configDir], ])); $this->logger->expects($this->at(0))->method('log')->with('Starting Magento uninstallation:'); @@ -359,20 +370,36 @@ class InstallerTest extends \PHPUnit_Framework_TestCase ->expects($this->at(1)) ->method('log') ->with('No database connection defined - skipping database cleanup'); - $this->logger->expects($this->at(2))->method('log')->with('File system cleanup:'); + $cache = $this->getMock('Magento\Framework\App\Cache', [], [], '', false); + $cache->expects($this->once())->method('clean'); + $this->objectManager->expects($this->once()) + ->method('create') + ->will($this->returnValueMap([ + ['Magento\Framework\App\Cache', [], $cache], + ])); + $this->logger->expects($this->at(2))->method('log')->with('Cache cleared successfully'); + $this->logger->expects($this->at(3))->method('log')->with('File system cleanup:'); $this->logger - ->expects($this->at(3)) + ->expects($this->at(4)) ->method('log') ->with("The directory '/var' doesn't exist - skipping cleanup"); $this->logger - ->expects($this->at(4)) + ->expects($this->at(5)) ->method('log') ->with("The directory '/static' doesn't exist - skipping cleanup"); $this->logger - ->expects($this->at(5)) + ->expects($this->at(6)) ->method('log') ->with("The file '/config/config.php' doesn't exist - skipping cleanup"); $this->logger->expects($this->once())->method('logSuccess')->with('Magento uninstallation complete.'); + $this->cleanupFiles->expects($this->once())->method('clearAllFiles')->will( + $this->returnValue( + [ + "The directory '/var' doesn't exist - skipping cleanup", + "The directory '/static' doesn't exist - skipping cleanup" + ] + ) + ); $this->object->uninstall(); } diff --git a/setup/src/Magento/Setup/Test/Unit/Model/StoreConfigurationDataMapperTest.php b/setup/src/Magento/Setup/Test/Unit/Model/StoreConfigurationDataMapperTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9385ce4105e405cf38a9d1c9f4df8705ed6a5c90 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Model/StoreConfigurationDataMapperTest.php @@ -0,0 +1,147 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Model; + +use \Magento\Setup\Model\StoreConfigurationDataMapper; + +use Magento\Backend\Model\Url; +use Magento\Directory\Helper\Data; +use Magento\Directory\Model\Currency; +use Magento\Setup\Module\Setup; +use Magento\Store\Model\Store; + +class StoreConfigurationDataMapperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param array $data + * @param array $expected + * @dataProvider getConfigDataDataProvider + */ + public function testGetConfigData(array $data, array $expected) + { + $userConfigurationDataMapper = new StoreConfigurationDataMapper(); + $this->assertEquals($expected, $userConfigurationDataMapper->getConfigData($data)); + } + + /** + * @return array + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function getConfigDataDataProvider() + { + return [ + 'valid' => + [ + [ + StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', + StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', + StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1/', + StoreConfigurationDataMapper::KEY_CURRENCY => 'USD', + StoreConfigurationDataMapper::KEY_IS_SECURE => '1', + StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', + StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US', + StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', + StoreConfigurationDataMapper::KEY_USE_SEF_URL => '1', + ], + [ + Store::XML_PATH_USE_REWRITES => '1', + Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', + Store::XML_PATH_SECURE_IN_FRONTEND => '1', + Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', + Store::XML_PATH_SECURE_IN_ADMINHTML => '1', + Data::XML_PATH_DEFAULT_LOCALE => 'en_US', + Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', + Currency::XML_PATH_CURRENCY_BASE => 'USD', + Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', + Currency::XML_PATH_CURRENCY_ALLOW => 'USD', + Url::XML_PATH_USE_SECURE_KEY => '1', + ], + ], + 'valid alphabet url' => [ + [ + StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', + StoreConfigurationDataMapper::KEY_BASE_URL => 'http://example.com/', + StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://example.com/', + StoreConfigurationDataMapper::KEY_CURRENCY => 'USD', + StoreConfigurationDataMapper::KEY_IS_SECURE => '1', + StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', + StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US', + StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', + StoreConfigurationDataMapper::KEY_USE_SEF_URL => '1', + ], + [ + Store::XML_PATH_USE_REWRITES => '1', + Store::XML_PATH_UNSECURE_BASE_URL => 'http://example.com/', + Store::XML_PATH_SECURE_IN_FRONTEND => '1', + Store::XML_PATH_SECURE_BASE_URL => 'https://example.com/', + Store::XML_PATH_SECURE_IN_ADMINHTML => '1', + Data::XML_PATH_DEFAULT_LOCALE => 'en_US', + Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', + Currency::XML_PATH_CURRENCY_BASE => 'USD', + Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', + Currency::XML_PATH_CURRENCY_ALLOW => 'USD', + Url::XML_PATH_USE_SECURE_KEY => '1', + ], + ], + 'no trailing slash' => + [ + [ + StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', + StoreConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1', + StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', + StoreConfigurationDataMapper::KEY_CURRENCY => 'USD', + StoreConfigurationDataMapper::KEY_IS_SECURE => '1', + StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', + StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US', + StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', + StoreConfigurationDataMapper::KEY_USE_SEF_URL => '1', + ], + [ + Store::XML_PATH_USE_REWRITES => '1', + Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', + Store::XML_PATH_SECURE_IN_FRONTEND => '1', + Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', + Store::XML_PATH_SECURE_IN_ADMINHTML => '1', + Data::XML_PATH_DEFAULT_LOCALE => 'en_US', + Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', + Currency::XML_PATH_CURRENCY_BASE => 'USD', + Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', + Currency::XML_PATH_CURRENCY_ALLOW => 'USD', + Url::XML_PATH_USE_SECURE_KEY => '1', + ], + ], + 'no trailing slash, alphabet url' => + [ + [ + StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', + StoreConfigurationDataMapper::KEY_BASE_URL => 'http://example.com', + StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://example.com', + StoreConfigurationDataMapper::KEY_CURRENCY => 'USD', + StoreConfigurationDataMapper::KEY_IS_SECURE => '1', + StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', + StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US', + StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', + StoreConfigurationDataMapper::KEY_USE_SEF_URL => '1', + ], + [ + Store::XML_PATH_USE_REWRITES => '1', + Store::XML_PATH_UNSECURE_BASE_URL => 'http://example.com/', + Store::XML_PATH_SECURE_IN_FRONTEND => '1', + Store::XML_PATH_SECURE_BASE_URL => 'https://example.com/', + Store::XML_PATH_SECURE_IN_ADMINHTML => '1', + Data::XML_PATH_DEFAULT_LOCALE => 'en_US', + Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', + Currency::XML_PATH_CURRENCY_BASE => 'USD', + Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', + Currency::XML_PATH_CURRENCY_ALLOW => 'USD', + Url::XML_PATH_USE_SECURE_KEY => '1', + ], + ], + ]; + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Model/UserConfigurationDataMapperTest.php b/setup/src/Magento/Setup/Test/Unit/Model/UserConfigurationDataMapperTest.php deleted file mode 100644 index 442ee985c7c604385aa80b9993776b52110e402b..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Model/UserConfigurationDataMapperTest.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Test\Unit\Model; - -use \Magento\Setup\Model\UserConfigurationDataMapper; - -use Magento\Backend\Model\Url; -use Magento\Directory\Helper\Data; -use Magento\Directory\Model\Currency; -use Magento\Setup\Module\Setup; -use Magento\Store\Model\Store; - -class UserConfigurationDataMapperTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param array $data - * @param array $expected - * @dataProvider getConfigDataDataProvider - */ - public function testGetConfigData(array $data, array $expected) - { - $userConfigurationDataMapper = new UserConfigurationDataMapper(); - $this->assertEquals($expected, $userConfigurationDataMapper->getConfigData($data)); - } - - /** - * @return array - * - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function getConfigDataDataProvider() - { - return [ - 'valid' => - [ - [ - UserConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1/', - UserConfigurationDataMapper::KEY_CURRENCY => 'USD', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - UserConfigurationDataMapper::KEY_LANGUAGE => 'en_US', - UserConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', - UserConfigurationDataMapper::KEY_USE_SEF_URL => '1', - ], - [ - Store::XML_PATH_USE_REWRITES => '1', - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - Data::XML_PATH_DEFAULT_LOCALE => 'en_US', - Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', - Currency::XML_PATH_CURRENCY_BASE => 'USD', - Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', - Currency::XML_PATH_CURRENCY_ALLOW => 'USD', - Url::XML_PATH_USE_SECURE_KEY => '1', - ], - ], - 'valid alphabet url' => [ - [ - UserConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', - UserConfigurationDataMapper::KEY_BASE_URL => 'http://example.com/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://example.com/', - UserConfigurationDataMapper::KEY_CURRENCY => 'USD', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - UserConfigurationDataMapper::KEY_LANGUAGE => 'en_US', - UserConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', - UserConfigurationDataMapper::KEY_USE_SEF_URL => '1', - ], - [ - Store::XML_PATH_USE_REWRITES => '1', - Store::XML_PATH_UNSECURE_BASE_URL => 'http://example.com/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://example.com/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - Data::XML_PATH_DEFAULT_LOCALE => 'en_US', - Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', - Currency::XML_PATH_CURRENCY_BASE => 'USD', - Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', - Currency::XML_PATH_CURRENCY_ALLOW => 'USD', - Url::XML_PATH_USE_SECURE_KEY => '1', - ], - ], - 'no trailing slash' => - [ - [ - UserConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_CURRENCY => 'USD', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - UserConfigurationDataMapper::KEY_LANGUAGE => 'en_US', - UserConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', - UserConfigurationDataMapper::KEY_USE_SEF_URL => '1', - ], - [ - Store::XML_PATH_USE_REWRITES => '1', - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - Data::XML_PATH_DEFAULT_LOCALE => 'en_US', - Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', - Currency::XML_PATH_CURRENCY_BASE => 'USD', - Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', - Currency::XML_PATH_CURRENCY_ALLOW => 'USD', - Url::XML_PATH_USE_SECURE_KEY => '1', - ], - ], - 'no trailing slash, alphabet url' => - [ - [ - UserConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => '1', - UserConfigurationDataMapper::KEY_BASE_URL => 'http://example.com', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://example.com', - UserConfigurationDataMapper::KEY_CURRENCY => 'USD', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - UserConfigurationDataMapper::KEY_LANGUAGE => 'en_US', - UserConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago', - UserConfigurationDataMapper::KEY_USE_SEF_URL => '1', - ], - [ - Store::XML_PATH_USE_REWRITES => '1', - Store::XML_PATH_UNSECURE_BASE_URL => 'http://example.com/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://example.com/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - Data::XML_PATH_DEFAULT_LOCALE => 'en_US', - Data::XML_PATH_DEFAULT_TIMEZONE => 'America/Chicago', - Currency::XML_PATH_CURRENCY_BASE => 'USD', - Currency::XML_PATH_CURRENCY_DEFAULT => 'USD', - Currency::XML_PATH_CURRENCY_ALLOW => 'USD', - Url::XML_PATH_USE_SECURE_KEY => '1', - ], - ], - 'is_secure, is_secure_admin set but no secure base url' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - ], - ], - 'secure base url set but is_secure and is_secure_admin set to 0' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_IS_SECURE => '0', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '0', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - ], - ], - 'secure base url set but is_secure and is_secure_admin not set' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - ], - ], - 'secure base url set, is_secure set to 0, is_secure_admin set to 1' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_IS_SECURE => '0', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_IN_FRONTEND => '0', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - ], - ], - 'secure base url set, is_secure set to 1, is_secure_admin set to 0' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '0', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '0', - ], - ], - 'secure base url set, is_secure not set, is_secure_admin set to 1' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_IS_SECURE_ADMIN => '1', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - Store::XML_PATH_SECURE_IN_ADMINHTML => '1', - ], - ], - 'secure base url set, is_secure set to 1, is_secure_admin not set' => - [ - [ - UserConfigurationDataMapper::KEY_BASE_URL => 'http://127.0.0.1/', - UserConfigurationDataMapper::KEY_BASE_URL_SECURE => 'https://127.0.0.1', - UserConfigurationDataMapper::KEY_IS_SECURE => '1', - ], - [ - Store::XML_PATH_UNSECURE_BASE_URL => 'http://127.0.0.1/', - Store::XML_PATH_SECURE_IN_FRONTEND => '1', - Store::XML_PATH_SECURE_BASE_URL => 'https://127.0.0.1/', - ], - ], - ]; - } -} diff --git a/setup/src/Magento/Setup/Test/Unit/Mvc/Bootstrap/InitParamListenerTest.php b/setup/src/Magento/Setup/Test/Unit/Mvc/Bootstrap/InitParamListenerTest.php index c59c2c3f1337f5a84778534329b2d97b973d595a..778c734d7e599e59722858d38fa04c110adc3fc5 100644 --- a/setup/src/Magento/Setup/Test/Unit/Mvc/Bootstrap/InitParamListenerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Mvc/Bootstrap/InitParamListenerTest.php @@ -29,73 +29,6 @@ class InitParamListenerTest extends \PHPUnit_Framework_TestCase $this->listener = new InitParamListener(); } - public function testAttachToConsoleRoutesEmpty() - { - $inputConfig = []; - $expectedConfig = []; - $this->assertEquals( - $expectedConfig, - InitParamListener::attachToConsoleRoutes($inputConfig) - ); - } - - public function testAttachToConsoleRoutesOneRoute() - { - $inputConfig = [ - 'console' => ['router' => ['routes' => [['options' => ['route' => 'one_route']]]]] - ]; - $expectedConfig = [ - 'console' => ['router' => ['routes' => [['options' => ['route' => 'one_route [--magento_init_params=]']]]]] - ]; - - $this->assertEquals( - $expectedConfig, - InitParamListener::attachToConsoleRoutes($inputConfig) - ); - } - - public function testAttachToConsoleRoutesManyRoute() - { - $inputConfig = [ - 'console' => ['router' => ['routes' => [ - ['options' => ['route' => 'one_route']], - ['options' => ['route' => 'two_route']], - ['options' => ['route' => 'three_route']], - ['options' => ['route' => 'four_route']], - ['options' => ['route' => 'five_route']], - ]]] - ]; - $expectedConfig = [ - 'console' => ['router' => ['routes' => [ - ['options' => ['route' => 'one_route [--magento_init_params=]']], - ['options' => ['route' => 'two_route [--magento_init_params=]']], - ['options' => ['route' => 'three_route [--magento_init_params=]']], - ['options' => ['route' => 'four_route [--magento_init_params=]']], - ['options' => ['route' => 'five_route [--magento_init_params=]']], - ]]] - ]; - - $this->assertEquals( - $expectedConfig, - InitParamListener::attachToConsoleRoutes($inputConfig) - ); - } - - public function testGetConsoleUsage() - { - $usage = InitParamListener::getConsoleUsage(); - - // usage statement should be an array and have a blank line followed by a line containing the parameter - $this->assertArrayHasKey(0, $usage); - $this->assertGreaterThanOrEqual(2, count($usage)); - - // First element should be a blank line - $this->assertEquals('', $usage[0]); - - // Parameter definition is added to the usage statement - $this->assertContains(InitParamListener::BOOTSTRAP_PARAM, implode($usage[1])); - } - public function testAttach() { $events = $this->prepareEventManager(); diff --git a/setup/src/Magento/Setup/Test/Unit/Mvc/Console/RouteListenerTest.php b/setup/src/Magento/Setup/Test/Unit/Mvc/Console/RouteListenerTest.php deleted file mode 100644 index 6ec5166de20f78467e738550ea2ab9feff6771c5..0000000000000000000000000000000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Mvc/Console/RouteListenerTest.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Setup\Test\Unit\Mvc\Console; - -use \Magento\Setup\Mvc\Console\RouteListener; - -use Zend\Mvc\MvcEvent; - -/** - * Tests Magento\Setup\Mvc\Console\RouteListener - */ -class RouteListenerTest extends \PHPUnit_Framework_TestCase -{ - - /** @var RouteListener */ - private $routeListener; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $request; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $router; - - protected function setUp() - { - $this->routeListener = new RouteListener(); - $this->request = $this->getMockBuilder('Zend\Console\Request')->disableOriginalConstructor()->getMock(); - $this->router = $this->getMockBuilder('Zend\Mvc\Router\RouteInterface') - ->disableOriginalConstructor()->getMock(); - } - - public function testOnRouteHttpRequest() - { - /** @var \Zend\Mvc\MvcEvent|\PHPUnit_Framework_MockObject_MockObject $mvcEvent */ - $mvcEvent = $this->getMockBuilder('Zend\Mvc\MvcEvent')->disableOriginalConstructor()->getMock(); - $httpRequest = $this->getMockBuilder('Zend\Http\Request')->getMock(); - $mvcEvent->expects($this->any())->method('getRequest')->willReturn($httpRequest); - - // Sending an HttpRequest to console RouteListener should return null - $this->assertNull($this->routeListener->onRoute($mvcEvent)); - } - - public function testOnRouteMatch() - { - $mvcEvent = $this->prepareEvent(); - - $match = $this->getMockBuilder('Zend\Mvc\Router\RouteMatch')->disableOriginalConstructor()->getMock(); - $this->router->expects($this->any())->method('match')->willReturn($match); - $mvcEvent->expects($this->any())->method('getRouter')->willReturn($this->router); - - // There is a RouteMatch, so RouteListener will return null to trigger default listeners - $this->assertNull($this->routeListener->onRoute($mvcEvent)); - } - - public function testOnRouteError() - { - $mvcEvent = $this->prepareEvent(); - - $this->router->expects($this->any())->method('match')->willReturn(null); - $mvcEvent->expects($this->any())->method('getRouter')->willReturn($this->router); - - $this->request->expects($this->any())->method('getContent')->willReturn([]); - $this->prepareOnRoute($mvcEvent, ['console' => ['router' => ['routes' => ['testAction' => 'test']]]]); - - // Verify the error is set - $mvcEvent->expects($this->once())->method('setError'); - - // Should always return null - $this->assertNull($this->routeListener->onRoute($mvcEvent)); - } - - public function testOnRouteNoError() - { - $mvcEvent = $this->prepareEvent(); - - $routeMatch = $this->getMockBuilder('Zend\Mvc\Router\RouteMatch')->disableOriginalConstructor()->getMock(); - $this->router->expects($this->any())->method('match')->willReturn($routeMatch); - $mvcEvent->expects($this->any())->method('getRouter')->willReturn($this->router); - - // Verify the error is not set - $mvcEvent->expects($this->never())->method('setError'); - - // Should always return null - $this->assertNull($this->routeListener->onRoute($mvcEvent)); - } - - - public function testOnRouteValidationMessage() - { - $mvcEvent = $this->prepareEvent(); - - $this->router->expects($this->any())->method('match')->willReturn(null); - $mvcEvent->expects($this->any())->method('getRouter')->willReturn($this->router); - - $this->request->expects($this->any())->method('getContent')->willReturn(['install']); - - $this->prepareOnRoute( - $mvcEvent, - ['console' => ['router' => ['routes' => ['install' => ['options' => ['route' => 'testRoute']]]]]] - ); - - // Verify the error is set - $mvcEvent->expects($this->once())->method('setError'); - $mvcEvent->expects($this->once()) - ->method('setResult') - ->with($this->isInstanceOf('Zend\View\Model\ConsoleModel')); - - // Should always return null - $this->assertNull($this->routeListener->onRoute($mvcEvent)); - } - - - public function testAttach() - { - /** @var \Zend\EventManager\EventManagerInterface|\PHPUnit_Framework_MockObject_MockObject $eventManager */ - $eventManager = $this->getMockBuilder('Zend\EventManager\EventManagerInterface')->getMock(); - $eventManager->expects($this->once()) - ->method('attach') - ->with( - $this->equalTo(MvcEvent::EVENT_ROUTE), - $this->contains($this->routeListener), - 10 - ); - $this->routeListener->attach($eventManager); - } - - /** - * Create a mock MVC event with a console mock console request. - * - * @return \PHPUnit_Framework_MockObject_MockObject|MvcEvent - */ - private function prepareEvent() - { - $mvcEvent = $this->getMockBuilder('Zend\Mvc\MvcEvent')->disableOriginalConstructor()->getMock(); - $this->request = $this->getMockBuilder('Zend\Console\Request')->disableOriginalConstructor()->getMock(); - $mvcEvent->expects($this->any())->method('getRequest')->willReturn($this->request); - return $mvcEvent; - } - - /** - * Add a mock application, service manager and console adapter. - * - * @param \PHPUnit_Framework_MockObject_MockObject $mvcEvent - * @param $configArray - */ - private function prepareOnRoute($mvcEvent, $configArray) - { - $application = $this->getMockBuilder('Zend\Mvc\ApplicationInterface')->getMock(); - $serviceManager = $this->getMockBuilder('Zend\ServiceManager\ServiceLocatorInterface')->getMock(); - $console = $this->getMockBuilder('Zend\Console\Adapter\AdapterInterface')->getMock(); - - $serviceManager - ->expects($this->any()) - ->method('get')->will($this->returnValueMap([['Config', $configArray], ['console', $console]])); - - $application->expects($this->any())->method('getServiceManager')->willReturn($serviceManager); - $mvcEvent->expects($this->any())->method('getApplication')->willReturn($application); - } -}