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/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php
index 31b8842ee72e5502ff200716c3761e519c378a45..f8118f245e8ff3cebc4cdf1e2adfc5ee3075a4ba 100644
--- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php
+++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php
@@ -45,7 +45,7 @@ class InstallSchema implements InstallSchemaInterface
             'date_added',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Create date'
         )->addColumn(
             'title',
@@ -112,7 +112,7 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Create date'
         )->setComment(
             'Admin System Messages'
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/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php
index d2199ef50ff836939de4a8b930482e744222390c..be78cce218735960373e7c04510390fe56f06186 100644
--- a/app/code/Magento/Authorization/Setup/InstallSchema.php
+++ b/app/code/Magento/Authorization/Setup/InstallSchema.php
@@ -138,7 +138,6 @@ class InstallSchema implements InstallSchemaInterface
                 'role_id',
                 $installer->getTable('authorization_role'),
                 'role_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )->setComment(
                 'Admin Rule Table'
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/Api/Data/LinkInterface.php b/app/code/Magento/Bundle/Api/Data/LinkInterface.php
index e16fad7f555bee04fb7f42743598acff877c6c6b..4e2268eae8f9a533b2bed55f7a4e97990f05d62e 100644
--- a/app/code/Magento/Bundle/Api/Data/LinkInterface.php
+++ b/app/code/Magento/Bundle/Api/Data/LinkInterface.php
@@ -9,6 +9,24 @@ namespace Magento\Bundle\Api\Data;
 
 interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface
 {
+    const PRICE_TYPE_FIXED = 0;
+    const PRICE_TYPE_PERCENT = 1;
+
+    /**
+     * Get the identifier
+     *
+     * @return string|null
+     */
+    public function getId();
+
+    /**
+     * Set id
+     *
+     * @param string $id
+     * @return $this
+     */
+    public function setId($id);
+
     /**
      * Get linked product sku
      *
@@ -69,21 +87,6 @@ interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface
      */
     public function setPosition($position);
 
-    /**
-     * Get is defined
-     *
-     * @return bool|null
-     */
-    public function getIsDefined();
-
-    /**
-     * Set is defined
-     *
-     * @param bool $isDefined
-     * @return $this
-     */
-    public function setIsDefined($isDefined);
-
     /**
      * Get is default
      *
diff --git a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php
index 2109cde0f95d452be9456038b8cfc2fa8ca30726..0529831f4094f7b936550e37914b91208f3d282e 100644
--- a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php
+++ b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php
@@ -11,12 +11,13 @@ interface ProductLinkManagementInterface
     /**
      * Get all children for Bundle product
      *
-     * @param string $productId
+     * @param string $productSku
+     * @param int $optionId
      * @return \Magento\Bundle\Api\Data\LinkInterface[]
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      * @throws \Magento\Framework\Exception\InputException
      */
-    public function getChildren($productId);
+    public function getChildren($productSku, $optionId = null);
 
     /**
      * Add child product to specified Bundle option by product sku
@@ -31,10 +32,23 @@ interface ProductLinkManagementInterface
      */
     public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct);
 
+    /**
+     * @param string $sku
+     * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
+     * @throws \Magento\Framework\Exception\NoSuchEntityException
+     * @throws \Magento\Framework\Exception\CouldNotSaveException
+     * @throws \Magento\Framework\Exception\InputException
+     * @return bool
+     */
+    public function saveChild(
+        $sku,
+        \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
+    );
+
     /**
      * @param \Magento\Catalog\Api\Data\ProductInterface $product
      * @param int $optionId
-     * @param Data\LinkInterface $linkedProduct
+     * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      * @throws \Magento\Framework\Exception\CouldNotSaveException
      * @throws \Magento\Framework\Exception\InputException
diff --git a/app/code/Magento/Bundle/Model/Link.php b/app/code/Magento/Bundle/Model/Link.php
index eb99eff55e334fd9c878af2054243956b76a115c..fef35d3261b030978b73d67377a75ebf4c10a491 100644
--- a/app/code/Magento/Bundle/Model/Link.php
+++ b/app/code/Magento/Bundle/Model/Link.php
@@ -16,17 +16,34 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
     /**#@+
      * Constants
      */
+    const KEY_ID = 'id';
     const KEY_SKU = 'sku';
     const KEY_OPTION_ID = 'option_id';
     const KEY_QTY = 'qty';
     const KEY_POSITION = 'position';
-    const KEY_IS_DEFINED = 'is_defined';
     const KEY_IS_DEFAULT = 'is_default';
     const KEY_PRICE = 'price';
     const KEY_PRICE_TYPE = 'price_type';
-    const KEY_CAN_CHANGE_QUANTITY = 'can_change_quantity';
+    const KEY_CAN_CHANGE_QUANTITY = 'selection_can_change_quantity';
     /**#@-*/
 
+    /**
+     * {@inheritdoc}
+     */
+    public function getId()
+    {
+        return $this->getData(self::KEY_ID);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function setId($id)
+    {
+        return $this->setData(self::KEY_ID, $id);
+    }
+
+
     /**
      * {@inheritdoc}
      */
@@ -59,14 +76,6 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
         return $this->getData(self::KEY_POSITION);
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getIsDefined()
-    {
-        return $this->getData(self::KEY_IS_DEFINED);
-    }
-
     /**
      * {@inheritdoc}
      */
@@ -143,17 +152,6 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
         return $this->setData(self::KEY_POSITION, $position);
     }
 
-    /**
-     * Set is defined
-     *
-     * @param bool $isDefined
-     * @return $this
-     */
-    public function setIsDefined($isDefined)
-    {
-        return $this->setData(self::KEY_IS_DEFINED, $isDefined);
-    }
-
     /**
      * Set is default
      *
diff --git a/app/code/Magento/Bundle/Model/LinkManagement.php b/app/code/Magento/Bundle/Model/LinkManagement.php
index fe2c0d85d7b168d21183813afc8b72ffbb9f280e..5d240c0517e595fc5812c5c1ad4e5d1d23530b6d 100644
--- a/app/code/Magento/Bundle/Model/LinkManagement.php
+++ b/app/code/Magento/Bundle/Model/LinkManagement.php
@@ -75,15 +75,18 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
     /**
      * {@inheritdoc}
      */
-    public function getChildren($productId)
+    public function getChildren($productSku, $optionId = null)
     {
-        $product = $this->productRepository->get($productId);
+        $product = $this->productRepository->get($productSku);
         if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
             throw new InputException(__('Only implemented for bundle product'));
         }
 
         $childrenList = [];
         foreach ($this->getOptions($product) as $option) {
+            if ($optionId !== null && $option->getOptionId() != $optionId) {
+                continue;
+            }
             /** @var \Magento\Catalog\Model\Product $selection */
             foreach ($option->getSelections() as $selection) {
                 $childrenList[] = $this->buildLink($selection, $product);
@@ -107,6 +110,93 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
+    public function saveChild(
+        $sku,
+        \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
+    ) {
+        $product = $this->productRepository->get($sku);
+        if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
+            throw new InputException(
+                __('Product with specified sku: "%1" is not a bundle product', [$product->getSku()])
+            );
+        }
+
+        /** @var \Magento\Catalog\Model\Product $linkProductModel */
+        $linkProductModel = $this->productRepository->get($linkedProduct->getSku());
+        if ($linkProductModel->isComposite()) {
+            throw new InputException(__('Bundle product could not contain another composite product'));
+        }
+
+        if (!$linkedProduct->getId()) {
+            throw new InputException(__('Id field of product link is required'));
+        }
+
+        /** @var \Magento\Bundle\Model\Selection $selectionModel */
+        $selectionModel = $this->bundleSelection->create();
+        $selectionModel->load($linkedProduct->getId());
+        if (!$selectionModel->getId()) {
+            throw new InputException(__('Can not find product link with id "%1"', [$linkedProduct->getId()]));
+        }
+
+        $selectionModel = $this->mapProductLinkToSelectionModel(
+            $selectionModel,
+            $linkedProduct,
+            $linkProductModel->getId(),
+            $product->getId()
+        );
+
+        try {
+            $selectionModel->save();
+        } catch (\Exception $e) {
+            throw new CouldNotSaveException(__('Could not save child: "%1"', $e->getMessage()), $e);
+        }
+
+        return true;
+    }
+
+    /**
+     * @param \Magento\Bundle\Model\Selection $selectionModel
+     * @param \Magento\Bundle\Api\Data\LinkInterface $productLink
+     * @param string $linkedProductId
+     * @param string $parentProductId
+     * @return \Magento\Bundle\Model\Selection
+     */
+    protected function mapProductLinkToSelectionModel(
+        \Magento\Bundle\Model\Selection $selectionModel,
+        \Magento\Bundle\Api\Data\LinkInterface $productLink,
+        $linkedProductId,
+        $parentProductId
+    ) {
+        $selectionModel->setProductId($linkedProductId);
+        $selectionModel->setParentProductId($parentProductId);
+        if (($productLink->getOptionId() !== null)) {
+            $selectionModel->setOptionId($productLink->getOptionId());
+        }
+        if ($productLink->getPosition() !== null) {
+            $selectionModel->setPosition($productLink->getPosition());
+        }
+        if ($productLink->getQty() !== null) {
+            $selectionModel->setSelectionQty($productLink->getQty());
+        }
+        if ($productLink->getPriceType() !== null) {
+            $selectionModel->setSelectionPriceType($productLink->getPriceType());
+        }
+        if ($productLink->getPrice() !== null) {
+            $selectionModel->setSelectionPriceValue($productLink->getPrice());
+        }
+        if ($productLink->getCanChangeQuantity() !== null) {
+            $selectionModel->setSelectionCanChangeQty($productLink->getCanChangeQuantity());
+        }
+        if ($productLink->getIsDefault() !== null) {
+            $selectionModel->setIsDefault($productLink->getIsDefault());
+        }
+
+        return $selectionModel;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
     public function addChild(
         \Magento\Catalog\Api\Data\ProductInterface $product,
         $optionId,
@@ -119,17 +209,10 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
         }
 
         $options = $this->optionCollection->create();
-        $options->setProductIdFilter($product->getId())->joinValues($this->storeManager->getStore()->getId());
-        $isNewOption = true;
-        /** @var \Magento\Bundle\Model\Option $option */
-        foreach ($options as $option) {
-            if ($option->getOptionId() == $optionId) {
-                $isNewOption = false;
-                break;
-            }
-        }
+        $options->setIdFilter($optionId);
+        $existingOption = $options->getFirstItem();
 
-        if ($isNewOption) {
+        if (!$existingOption->getId()) {
             throw new InputException(
                 __(
                     'Product with specified sku: "%1" does not contain option: "%2"',
@@ -161,16 +244,13 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
         }
 
         $selectionModel = $this->bundleSelection->create();
-        $selectionModel->setOptionId($optionId)
-            ->setPosition($linkedProduct->getPosition())
-            ->setSelectionQty($linkedProduct->getQty())
-            ->setSelectionPriceType($linkedProduct->getPriceType())
-            ->setSelectionPriceValue($linkedProduct->getPrice())
-            ->setSelectionCanChangeQty($linkedProduct->getCanChangeQuantity())
-            ->setProductId($linkProductModel->getId())
-            ->setParentProductId($product->getId())
-            ->setIsDefault($linkedProduct->getIsDefault())
-            ->setWebsiteId($this->storeManager->getStore()->getWebsiteId());
+        $selectionModel = $this->mapProductLinkToSelectionModel(
+            $selectionModel,
+            $linkedProduct,
+            $linkProductModel->getId(),
+            $product->getId()
+        );
+        $selectionModel->setOptionId($optionId);
 
         try {
             $selectionModel->save();
@@ -242,8 +322,9 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
             '\Magento\Bundle\Api\Data\LinkInterface'
         );
         $link->setIsDefault($selection->getIsDefault())
+            ->setId($selection->getSelectionId())
             ->setQty($selection->getSelectionQty())
-            ->setIsDefined($selection->getSelectionCanChangeQty())
+            ->setCanChangeQuantity($selection->getSelectionCanChangeQty())
             ->setPrice($selectionPrice)
             ->setPriceType($selectionPriceType);
         return $link;
@@ -251,7 +332,7 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
 
     /**
      * @param \Magento\Catalog\Api\Data\ProductInterface $product
-     * @return \Magento\Bundle\Api\Data\OptionTypeInterface[]
+     * @return \Magento\Bundle\Api\Data\OptionInterface[]
      */
     private function getOptions(\Magento\Catalog\Api\Data\ProductInterface $product)
     {
diff --git a/app/code/Magento/Bundle/Model/OptionRepository.php b/app/code/Magento/Bundle/Model/OptionRepository.php
index 024b6f1cd2482780901ce6a8ca475a54e8e8785e..78caa83e801b3fd014eadfcfbbaf074c554d23f5 100644
--- a/app/code/Magento/Bundle/Model/OptionRepository.php
+++ b/app/code/Magento/Bundle/Model/OptionRepository.php
@@ -161,7 +161,6 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
 
     /**
      * {@inheritdoc}
-     * @SuppressWarnings(PHPMD.NPathComplexity)
      */
     public function save(
         \Magento\Catalog\Api\Data\ProductInterface $product,
@@ -170,35 +169,25 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
         $option->setStoreId($this->storeManager->getStore()->getId());
         $option->setParentId($product->getId());
 
-        if (!$option->getOptionId()) {
+        $optionId = $option->getOptionId();
+        $linksToAdd = [];
+        if (!$optionId) {
             $option->setDefaultTitle($option->getTitle());
-            $linksToAdd = is_array($option->getProductLinks()) ? $option->getProductLinks() : [];
+            if (is_array($option->getProductLinks())) {
+                $linksToAdd = $option->getProductLinks();
+            }
         } else {
             $optionCollection = $this->type->getOptionsCollection($product);
-            $optionCollection->setIdFilter($option->getOptionId());
 
             /** @var \Magento\Bundle\Model\Option $existingOption */
-            $existingOption = $optionCollection->getFirstItem();
+            $existingOption = $optionCollection->getItemById($option->getOptionId());
 
-            if (!$existingOption->getOptionId()) {
+            if (!isset($existingOption) || !$existingOption->getOptionId()) {
                 throw new NoSuchEntityException(__('Requested option doesn\'t exist'));
             }
 
             $option->setData(array_merge($existingOption->getData(), $option->getData()));
-
-            /** @var \Magento\Bundle\Api\Data\LinkInterface[] $existingLinks */
-            $existingLinks = is_array($existingOption->getProductLinks()) ? $existingOption->getProductLinks() : [];
-
-            /** @var \Magento\Bundle\Api\Data\LinkInterface[] $newProductLinks */
-            $newProductLinks = is_array($option->getProductLinks()) ? $option->getProductLinks() : [];
-
-            /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToDelete */
-            $linksToDelete = array_udiff($existingLinks, $newProductLinks, [$this, 'compareLinks']);
-            foreach ($linksToDelete as $link) {
-                $this->linkManagement->removeChild($product->getSku(), $option->getOptionId(), $link->getSku());
-            }
-            /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToAdd */
-            $linksToAdd = array_udiff($newProductLinks, $existingLinks, [$this, 'compareLinks']);
+            $this->updateOptionSelection($product, $option);
         }
 
         try {
@@ -215,6 +204,50 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
         return $option->getOptionId();
     }
 
+    /**
+     * Update option selections
+     *
+     * @param \Magento\Catalog\Api\Data\ProductInterface $product
+     * @param \Magento\Bundle\Api\Data\OptionInterface $option
+     * @return $this
+     */
+    protected function updateOptionSelection(
+        \Magento\Catalog\Api\Data\ProductInterface $product,
+        \Magento\Bundle\Api\Data\OptionInterface $option
+    ) {
+        $optionId = $option->getOptionId();
+        $existingLinks = $this->linkManagement->getChildren($product->getSku(), $optionId);
+        $linksToAdd = [];
+        $linksToUpdate = [];
+        $linksToDelete = [];
+        if (is_array($option->getProductLinks())) {
+            $productLinks = $option->getProductLinks();
+            foreach ($productLinks as $productLink) {
+                if (!$productLink->getId()) {
+                    $linksToAdd[] = $productLink;
+                } else {
+                    $linksToUpdate[] = $productLink;
+                }
+            }
+            /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToDelete */
+            $linksToDelete = array_udiff($existingLinks, $linksToUpdate, [$this, 'compareLinks']);
+        }
+        foreach ($linksToUpdate as $linkedProduct) {
+            $this->linkManagement->saveChild($product->getSku(), $linkedProduct);
+        }
+        foreach ($linksToDelete as $linkedProduct) {
+            $this->linkManagement->removeChild(
+                $product->getSku(),
+                $option->getOptionId(),
+                $linkedProduct->getSku()
+            );
+        }
+        foreach ($linksToAdd as $linkedProduct) {
+            $this->linkManagement->addChild($product, $option->getOptionId(), $linkedProduct);
+        }
+        return $this;
+    }
+
     /**
      * @param string $sku
      * @return \Magento\Catalog\Api\Data\ProductInterface
@@ -241,7 +274,7 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
         \Magento\Bundle\Api\Data\LinkInterface $firstLink,
         \Magento\Bundle\Api\Data\LinkInterface $secondLink
     ) {
-        if ($firstLink->getSku() == $secondLink->getSku()) {
+        if ($firstLink->getId() == $secondLink->getId()) {
             return 0;
         } else {
             return 1;
diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php
index 76b5dd84b3620c4ee3fa4da5eae8fc6490b602ce..16bce777104a27d1a45a9ad0c26bc7282f76a000 100644
--- a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php
+++ b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php
@@ -52,7 +52,10 @@ class BundleLoadOptions
             return $product;
         }
 
-        $productExtension = $this->productExtensionFactory->create();
+        $productExtension = $product->getExtensionAttributes();
+        if ($productExtension === null) {
+            $productExtension = $this->productExtensionFactory->create();
+        }
         $productExtension->setBundleProductOptions($this->productOptionList->getItems($product));
 
         $product->setExtensionAttributes($productExtension);
diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php
index b0e9ee6de4700da4651aee4c31aaed0b03db657b..ccfd78d1054804c09bafbe0e38c2b1675f3efd51 100644
--- a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php
+++ b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php
@@ -17,8 +17,9 @@ class BundleSaveOptions
     /**
      * @param \Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository
      */
-    public function __construct(\Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository)
-    {
+    public function __construct(
+        \Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository
+    ) {
         $this->optionRepository = $optionRepository;
     }
 
@@ -45,13 +46,37 @@ class BundleSaveOptions
         }
 
         /* @var \Magento\Bundle\Api\Data\OptionInterface[] $options */
-        $bundleProductOptions = $product->getExtensionAttributes()->getBundleProductOptions();
+        $extendedAttributes = $product->getExtensionAttributes();
+        if ($extendedAttributes === null) {
+            return $result;
+        }
+        $bundleProductOptions = $extendedAttributes->getBundleProductOptions();
+        if ($bundleProductOptions == null) {
+            return $result;
+        }
 
-        if (is_array($bundleProductOptions)) {
-            foreach ($bundleProductOptions as $option) {
-                $this->optionRepository->save($result, $option);
+        /** @var \Magento\Bundle\Api\Data\OptionInterface[] $bundleProductOptions */
+        $existingOptions = $this->optionRepository->getList($product->getSku());
+        $existingOptionsMap = [];
+        foreach ($existingOptions as $existingOption) {
+            $existingOptionsMap[$existingOption->getOptionId()] = $existingOption;
+        }
+        $updatedOptionIds = [];
+        foreach ($bundleProductOptions as $bundleOption) {
+            $optionId = $bundleOption->getOptionId();
+            if ($optionId) {
+                $updatedOptionIds[] = $optionId;
             }
         }
-        return $result;
+        $optionIdsToDelete = array_diff(array_keys($existingOptionsMap), $updatedOptionIds);
+        //Handle new and existing options
+        foreach ($bundleProductOptions as $option) {
+            $this->optionRepository->save($result, $option);
+        }
+        //Delete options that are not in the list
+        foreach ($optionIdsToDelete as $optionId) {
+            $this->optionRepository->delete($existingOptionsMap[$optionId]);
+        }
+        return $subject->get($result->getSku(), false, $result->getStoreId(), true);
     }
 }
diff --git a/app/code/Magento/Bundle/Model/Product/LinksList.php b/app/code/Magento/Bundle/Model/Product/LinksList.php
index d0b6a78635b6a905d8ba9c9e9aa0c163ee56d53e..2d0076f67847b6df0b65e0b9af418bcf4f9934f1 100644
--- a/app/code/Magento/Bundle/Model/Product/LinksList.php
+++ b/app/code/Magento/Bundle/Model/Product/LinksList.php
@@ -61,8 +61,9 @@ class LinksList
                 '\Magento\Bundle\Api\Data\LinkInterface'
             );
             $productLink->setIsDefault($selection->getIsDefault())
+                ->setId($selection->getSelectionId())
                 ->setQty($selection->getSelectionQty())
-                ->setIsDefined($selection->getSelectionCanChangeQty())
+                ->setCanChangeQuantity($selection->getSelectionCanChangeQty())
                 ->setPrice($selectionPrice)
                 ->setPriceType($selectionPriceType);
             $productLinks[] = $productLink;
diff --git a/app/code/Magento/Bundle/Model/Selection.php b/app/code/Magento/Bundle/Model/Selection.php
index 919c54051566f0bc631c233bb0cfd7618955a907..1f68f9795dd2b66e4b9e8866aa1fb8c7de697f8c 100644
--- a/app/code/Magento/Bundle/Model/Selection.php
+++ b/app/code/Magento/Bundle/Model/Selection.php
@@ -8,6 +8,8 @@ namespace Magento\Bundle\Model;
 /**
  * Bundle Selection Model
  *
+ * @method int getSelectionId()
+ * @method \Magento\Bundle\Model\Selection setSelectionId(int $value)
  * @method int getOptionId()
  * @method \Magento\Bundle\Model\Selection setOptionId(int $value)
  * @method int getParentProductId()
diff --git a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
index 706de8be46be2f927b9783076ae2c2350564e273..a541ac48c12486820616203fb337e3b0ae610cc0 100644
--- a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
+++ b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Bundle\Model\Source\Option\Selection\Price;
 
+use Magento\Bundle\Api\Data\LinkInterface;
+
 /**
  * Extended Attributes Source Model
  *
@@ -17,6 +19,9 @@ class Type implements \Magento\Framework\Option\ArrayInterface
      */
     public function toOptionArray()
     {
-        return [['value' => '0', 'label' => __('Fixed')], ['value' => '1', 'label' => __('Percent')]];
+        return [
+            ['value' => LinkInterface::PRICE_TYPE_FIXED, 'label' => __('Fixed')],
+            ['value' => LinkInterface::PRICE_TYPE_PERCENT, 'label' => __('Percent')]
+        ];
     }
 }
diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php
index 96f43cb95704dbcf8d9e672be049493bfccab912..94325c54ff13c965a23e20a7b1962818b5816d2f 100644
--- a/app/code/Magento/Bundle/Setup/InstallSchema.php
+++ b/app/code/Magento/Bundle/Setup/InstallSchema.php
@@ -79,7 +79,6 @@ class InstallSchema implements InstallSchemaInterface
                 'parent_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Bundle Option');
@@ -138,7 +137,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_id',
                 $installer->getTable('catalog_product_bundle_option'),
                 'option_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Bundle Option Value');
@@ -238,7 +236,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_id',
                 $installer->getTable('catalog_product_bundle_option'),
                 'option_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -251,7 +248,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Bundle Selection');
@@ -305,7 +301,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -318,7 +313,6 @@ class InstallSchema implements InstallSchemaInterface
                 'selection_id',
                 $installer->getTable('catalog_product_bundle_selection'),
                 'selection_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Bundle Selection Price');
@@ -383,7 +377,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -396,7 +389,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -409,7 +401,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Bundle Price Index');
diff --git a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php
index a1d9391b3e112a3785dfa4f7f5cdbff682db01f4..e4f49d48adcf35004827caf8d85fb4028f3b19ca 100644
--- a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php
+++ b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php
@@ -111,7 +111,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
         $this->option = $this->getMockBuilder('Magento\Bundle\Model\Option')
-            ->setMethods(['getSelections', '__wakeup'])
+            ->setMethods(['getSelections', 'getOptionId', '__wakeup'])
             ->disableOriginalConstructor()
             ->getMock();
         $this->optionCollection = $this->getMockBuilder('Magento\Bundle\Model\Resource\Option\Collection')
@@ -193,14 +193,48 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
             ->willReturnSelf();
         $this->link->expects($this->once())->method('setIsDefault')->willReturnSelf();
         $this->link->expects($this->once())->method('setQty')->willReturnSelf();
-        $this->link->expects($this->once())->method('setIsDefined')->willReturnSelf();
+        $this->link->expects($this->once())->method('setCanChangeQuantity')->willReturnSelf();
         $this->link->expects($this->once())->method('setPrice')->willReturnSelf();
         $this->link->expects($this->once())->method('setPriceType')->willReturnSelf();
+        $this->link->expects($this->once())->method('setId')->willReturnSelf();
         $this->linkFactory->expects($this->once())->method('create')->willReturn($this->link);
 
         $this->assertEquals([$this->link], $this->model->getChildren($productSku));
     }
 
+    public function testGetChildrenWithOptionId()
+    {
+        $productSku = 'productSku';
+
+        $this->getOptions();
+
+        $this->productRepository->expects($this->any())->method('get')->with($this->equalTo($productSku))
+            ->will($this->returnValue($this->product));
+
+        $this->product->expects($this->once())->method('getTypeId')->will($this->returnValue('bundle'));
+
+        $this->productType->expects($this->once())->method('setStoreFilter')->with(
+            $this->equalTo($this->storeId),
+            $this->product
+        );
+        $this->productType->expects($this->once())->method('getSelectionsCollection')
+            ->with($this->equalTo($this->optionIds), $this->equalTo($this->product))
+            ->will($this->returnValue($this->selectionCollection));
+        $this->productType->expects($this->once())->method('getOptionsIds')->with($this->equalTo($this->product))
+            ->will($this->returnValue($this->optionIds));
+
+        $this->optionCollection->expects($this->once())->method('appendSelections')
+            ->with($this->equalTo($this->selectionCollection))
+            ->will($this->returnValue([$this->option]));
+
+        $this->option->expects($this->any())->method('getOptionId')->will($this->returnValue(10));
+        $this->option->expects($this->never())->method('getSelections');
+
+        $this->dataObjectHelperMock->expects($this->never())->method('populateWithArray');
+
+        $this->assertEquals([], $this->model->getChildren($productSku, 1));
+    }
+
     /**
      * @expectedException \Magento\Framework\Exception\InputException
      */
@@ -243,31 +277,29 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
             \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
         ));
-        $productMock->expects($this->once())->method('getId')->will($this->returnValue('product_id'));
 
         $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
         $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store));
         $store->expects($this->any())->method('getId')->will($this->returnValue(0));
 
-        $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
-            ->setMethods(['getOptionId', '__wakeup'])
+        $emptyOption = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
+            ->setMethods(['getId', '__wakeup'])
             ->getMock();
-        $option->expects($this->once())->method('getOptionId')->will($this->returnValue(2));
+        $emptyOption->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue(null));
 
         $optionsCollectionMock = $this->getMock(
             '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false
         );
         $optionsCollectionMock->expects($this->once())
-            ->method('setProductIdFilter')
-            ->with($this->equalTo('product_id'))
+            ->method('setIdFilter')
+            ->with($this->equalTo(1))
             ->will($this->returnSelf());
         $optionsCollectionMock->expects($this->once())
-            ->method('joinValues')
-            ->with($this->equalTo(0))
-            ->will($this->returnSelf());
-        $optionsCollectionMock->expects($this->any())->method('getIterator')->will(
-            $this->returnValue(new \ArrayIterator([$option]))
-        );
+            ->method('getFirstItem')
+           ->will($this->returnValue($emptyOption));
+
         $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will(
             $this->returnValue($optionsCollectionMock)
         );
@@ -304,22 +336,18 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $store->expects($this->any())->method('getId')->will($this->returnValue(0));
 
         $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
-            ->setMethods(['getOptionId', '__wakeup'])
+            ->setMethods(['getId', '__wakeup'])
             ->getMock();
-        $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1));
+        $option->expects($this->once())->method('getId')->will($this->returnValue(1));
 
         $optionsCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false);
         $optionsCollectionMock->expects($this->once())
-            ->method('setProductIdFilter')
-            ->with($this->equalTo('product_id'))
+            ->method('setIdFilter')
+            ->with($this->equalTo('1'))
             ->will($this->returnSelf());
         $optionsCollectionMock->expects($this->once())
-            ->method('joinValues')
-            ->with($this->equalTo(0))
-            ->will($this->returnSelf());
-        $optionsCollectionMock->expects($this->any())->method('getIterator')->will(
-            $this->returnValue(new \ArrayIterator([$option]))
-        );
+            ->method('getFirstItem')
+            ->will($this->returnValue($option));
         $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will(
             $this->returnValue($optionsCollectionMock)
         );
@@ -359,22 +387,18 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $store->expects($this->any())->method('getId')->will($this->returnValue(0));
 
         $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
-            ->setMethods(['getOptionId', '__wakeup'])
+            ->setMethods(['getId', '__wakeup'])
             ->getMock();
-        $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1));
+        $option->expects($this->once())->method('getId')->will($this->returnValue(1));
 
         $optionsCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false);
         $optionsCollectionMock->expects($this->once())
-            ->method('setProductIdFilter')
-            ->with($this->equalTo('product_id'))
+            ->method('setIdFilter')
+            ->with($this->equalTo(1))
             ->will($this->returnSelf());
         $optionsCollectionMock->expects($this->once())
-            ->method('joinValues')
-            ->with($this->equalTo(0))
-            ->will($this->returnSelf());
-        $optionsCollectionMock->expects($this->any())->method('getIterator')->will(
-            $this->returnValue(new \ArrayIterator([$option]))
-        );
+            ->method('getFirstItem')
+            ->will($this->returnValue($option));
         $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will(
             $this->returnValue($optionsCollectionMock)
         );
@@ -420,24 +444,20 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $store->expects($this->any())->method('getId')->will($this->returnValue(0));
 
         $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
-            ->setMethods(['getOptionId', '__wakeup'])
+            ->setMethods(['getId', '__wakeup'])
             ->getMock();
-        $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1));
+        $option->expects($this->once())->method('getId')->will($this->returnValue(1));
 
         $optionsCollectionMock = $this->getMock(
             '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false
         );
         $optionsCollectionMock->expects($this->once())
-            ->method('setProductIdFilter')
-            ->with($this->equalTo('product_id'))
+            ->method('setIdFilter')
+            ->with($this->equalTo(1))
             ->will($this->returnSelf());
         $optionsCollectionMock->expects($this->once())
-            ->method('joinValues')
-            ->with($this->equalTo(0))
-            ->will($this->returnSelf());
-        $optionsCollectionMock->expects($this->any())->method('getIterator')->will(
-            $this->returnValue(new \ArrayIterator([$option]))
-        );
+            ->method('getFirstItem')
+            ->will($this->returnValue($option));
         $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will(
             $this->returnValue($optionsCollectionMock)
         );
@@ -452,7 +472,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($selections));
         $this->bundleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($bundle));
 
-        $selection = $this->getMock('\Magento\Framework\Object', ['save'], [], '', false);
+        $selection = $this->getMock('\Magento\Bundle\Model\Selection', ['save'], [], '', false);
         $selection->expects($this->once())->method('save')
             ->will(
                 $this->returnCallback(
@@ -491,24 +511,20 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $store->expects($this->any())->method('getId')->will($this->returnValue(0));
 
         $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor()
-            ->setMethods(['getOptionId', '__wakeup'])
+            ->setMethods(['getId', '__wakeup'])
             ->getMock();
-        $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1));
+        $option->expects($this->once())->method('getId')->will($this->returnValue(1));
 
         $optionsCollectionMock = $this->getMock(
             '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false
         );
         $optionsCollectionMock->expects($this->once())
-            ->method('setProductIdFilter')
-            ->with($this->equalTo('product_id'))
+            ->method('setIdFilter')
+            ->with($this->equalTo(1))
             ->will($this->returnSelf());
         $optionsCollectionMock->expects($this->once())
-            ->method('joinValues')
-            ->with($this->equalTo(0))
-            ->will($this->returnSelf());
-        $optionsCollectionMock->expects($this->any())->method('getIterator')->will(
-            $this->returnValue(new \ArrayIterator([$option]))
-        );
+            ->method('getFirstItem')
+            ->will($this->returnValue($option));
         $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will(
             $this->returnValue($optionsCollectionMock)
         );
@@ -523,7 +539,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($selections));
         $this->bundleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($bundle));
 
-        $selection = $this->getMock('\Magento\Framework\Object', ['save', 'getId'], [], '', false);
+        $selection = $this->getMock('\Magento\Bundle\Model\Selection', ['save', 'getId'], [], '', false);
         $selection->expects($this->once())->method('save');
         $selection->expects($this->once())->method('getId')->will($this->returnValue(42));
         $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection));
@@ -531,6 +547,298 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(42, $result);
     }
 
+    public function testSaveChild()
+    {
+        $id = 12;
+        $optionId = 1;
+        $position = 3;
+        $qty = 2;
+        $priceType = 1;
+        $price = 10.5;
+        $canChangeQuantity = true;
+        $isDefault = true;
+        $linkProductId = 45;
+        $parentProductId = 32;
+        $bundleProductSku = 'bundleProductSku';
+
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue('linked_product_sku'));
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $productLink->expects($this->any())->method('getOptionId')->will($this->returnValue($optionId));
+        $productLink->expects($this->any())->method('getPosition')->will($this->returnValue($position));
+        $productLink->expects($this->any())->method('getQty')->will($this->returnValue($qty));
+        $productLink->expects($this->any())->method('getPriceType')->will($this->returnValue($priceType));
+        $productLink->expects($this->any())->method('getPrice')->will($this->returnValue($price));
+        $productLink->expects($this->any())->method('getCanChangeQuantity')->will($this->returnValue($canChangeQuantity));
+        $productLink->expects($this->any())->method('getIsDefault')->will($this->returnValue($isDefault));
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
+        ));
+        $productMock->expects($this->any())->method('getId')->will($this->returnValue($parentProductId));
+
+        $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $linkedProductMock->expects($this->any())->method('getId')->will($this->returnValue($linkProductId));
+        $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false));
+        $this->productRepository
+            ->expects($this->at(0))
+            ->method('get')
+            ->with($bundleProductSku)
+            ->will($this->returnValue($productMock));
+        $this->productRepository
+            ->expects($this->at(1))
+            ->method('get')
+            ->with('linked_product_sku')
+            ->will($this->returnValue($linkedProductMock));
+
+        $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
+        $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store));
+        $store->expects($this->any())->method('getId')->will($this->returnValue(0));
+
+        $selection = $this->getMock(
+            '\Magento\Bundle\Model\Selection',
+            [
+                'save',
+                'getId',
+                'load',
+                'setProductId',
+                'setParentProductId',
+                'setOptionId',
+                'setPosition',
+                'setSelectionQty',
+                'setSelectionPriceType',
+                'setSelectionPriceValue',
+                'setSelectionCanChangeQty',
+                'setIsDefault'
+            ],
+            [],
+            '',
+            false
+        );
+        $selection->expects($this->once())->method('save');
+        $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf());
+        $selection->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $selection->expects($this->once())->method('setProductId')->with($linkProductId);
+        $selection->expects($this->once())->method('setParentProductId')->with($parentProductId);
+        $selection->expects($this->once())->method('setOptionId')->with($optionId);
+        $selection->expects($this->once())->method('setPosition')->with($position);
+        $selection->expects($this->once())->method('setSelectionQty')->with($qty);
+        $selection->expects($this->once())->method('setSelectionPriceType')->with($priceType);
+        $selection->expects($this->once())->method('setSelectionPriceValue')->with($price);
+        $selection->expects($this->once())->method('setSelectionCanChangeQty')->with($canChangeQuantity);
+        $selection->expects($this->once())->method('setIsDefault')->with($isDefault);
+
+        $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection));
+        $this->assertTrue($this->model->saveChild($bundleProductSku, $productLink));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+     */
+    public function testSaveChildFailedToSave()
+    {
+        $id = 12;
+        $linkProductId = 45;
+        $parentProductId = 32;
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue('linked_product_sku'));
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $bundleProductSku = 'bundleProductSku';
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
+        ));
+        $productMock->expects($this->any())->method('getId')->will($this->returnValue($parentProductId));
+
+        $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $linkedProductMock->expects($this->any())->method('getId')->will($this->returnValue($linkProductId));
+        $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false));
+        $this->productRepository
+            ->expects($this->at(0))
+            ->method('get')
+            ->with($bundleProductSku)
+            ->will($this->returnValue($productMock));
+        $this->productRepository
+            ->expects($this->at(1))
+            ->method('get')
+            ->with('linked_product_sku')
+            ->will($this->returnValue($linkedProductMock));
+
+        $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
+        $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store));
+        $store->expects($this->any())->method('getId')->will($this->returnValue(0));
+
+        $selection = $this->getMock(
+            '\Magento\Bundle\Model\Selection',
+            [
+                'save',
+                'getId',
+                'load',
+                'setProductId',
+                'setParentProductId',
+                'setSelectionId',
+                'setOptionId',
+                'setPosition',
+                'setSelectionQty',
+                'setSelectionPriceType',
+                'setSelectionPriceValue',
+                'setSelectionCanChangeQty',
+                'setIsDefault'
+            ],
+            [],
+            '',
+            false
+        );
+        $mockException = $this->getMock('\Exception');
+        $selection->expects($this->once())->method('save')->will($this->throwException($mockException));
+        $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf());
+        $selection->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $selection->expects($this->once())->method('setProductId')->with($linkProductId);
+
+        $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection));
+        $this->model->saveChild($bundleProductSku, $productLink);
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\InputException
+     */
+    public function testSaveChildWithoutId()
+    {
+        $bundleProductSku = "bundleSku";
+        $linkedProductSku = 'simple';
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue(null));
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku));
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
+        ));
+
+        $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false));
+        $this->productRepository
+            ->expects($this->at(0))
+            ->method('get')
+            ->with($bundleProductSku)
+            ->will($this->returnValue($productMock));
+        $this->productRepository
+            ->expects($this->at(1))
+            ->method('get')
+            ->with($linkedProductSku)
+            ->will($this->returnValue($linkedProductMock));
+
+        $this->model->saveChild($bundleProductSku, $productLink);
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\InputException
+     * @expectedExceptionMessage Can not find product link with id "12345"
+     */
+    public function testSaveChildWithInvalidId()
+    {
+        $id = 12345;
+        $linkedProductSku = 'simple';
+        $bundleProductSku = "bundleProductSku";
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku));
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
+        ));
+
+        $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false));
+        $this->productRepository
+            ->expects($this->at(0))
+            ->method('get')
+            ->with($bundleProductSku)
+            ->will($this->returnValue($productMock));
+        $this->productRepository
+            ->expects($this->at(1))
+            ->method('get')
+            ->with($linkedProductSku)
+            ->will($this->returnValue($linkedProductMock));
+
+        $selection = $this->getMock(
+            '\Magento\Bundle\Model\Selection',
+            [
+                'getId',
+                'load',
+            ],
+            [],
+            '',
+            false
+        );
+        $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf());
+        $selection->expects($this->any())->method('getId')->will($this->returnValue(null));
+
+        $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection));
+
+        $this->model->saveChild($bundleProductSku, $productLink);
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\InputException
+     */
+    public function testSaveChildWithCompositeProductLink()
+    {
+        $bundleProductSku = "bundleProductSku";
+        $id = 12;
+        $linkedProductSku = 'simple';
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku));
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
+        ));
+
+        $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(true));
+        $this->productRepository
+            ->expects($this->at(0))
+            ->method('get')
+            ->with($bundleProductSku)
+            ->will($this->returnValue($productMock));
+        $this->productRepository
+            ->expects($this->at(1))
+            ->method('get')
+            ->with($linkedProductSku)
+            ->will($this->returnValue($linkedProductMock));
+
+        $this->model->saveChild($bundleProductSku, $productLink);
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\InputException
+     */
+    public function testSaveChildWithSimpleProduct()
+    {
+        $id = 12;
+        $linkedProductSku = 'simple';
+        $bundleProductSku = "bundleProductSku";
+
+        $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink->expects($this->any())->method('getId')->will($this->returnValue($id));
+        $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku));
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue(
+            \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE
+        ));
+
+        $this->productRepository->expects($this->once())->method('get')->with($bundleProductSku)
+            ->willReturn($productMock);
+
+        $this->model->saveChild($bundleProductSku, $productLink);
+    }
+
     public function testRemoveChild()
     {
         $this->productRepository->expects($this->any())->method('get')->will($this->returnValue($this->product));
diff --git a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php
index 7b91140a3bfe6fd0aa0196384d298e656afbb5bd..6c4fc418f0390d2e5262d425da13355a16724a34 100644
--- a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php
+++ b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php
@@ -335,8 +335,9 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase
             ->willReturn($optCollectionMock);
 
         $existingOptionMock = $this->getMock('\Magento\Bundle\Model\Option', ['getOptionId'], [], '', false);
-        $optCollectionMock->expects($this->once())->method('setIdFilter')->with($optionId)->willReturnSelf();
-        $optCollectionMock->expects($this->once())->method('getFirstItem')->willReturn($existingOptionMock);
+        $optCollectionMock->expects($this->once())->method('getItemById')
+            ->with($optionId)
+            ->willReturn($existingOptionMock);
         $existingOptionMock->expects($this->once())->method('getOptionId')->willReturn(null);
 
         $this->assertEquals($optionId, $this->model->save($productMock, $optionMock));
@@ -345,13 +346,16 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase
     /**
      * @SuppressWarnings(PHPMD.UnusedLocalVariable)
      */
-    public function testUpdate()
+    public function testSaveExistingOption()
     {
         $productId = 1;
+        $productSku = 'bundle_sku';
         $storeId = 2;
         $optionId = 5;
         $existingOptionId = 5;
-        $existingOptionTitle = 'option_title';
+        $existingLinkToUpdateId = '23';
+        $existingLinkToDeleteId = '24';
+        $productSkuToDelete = 'simple2';
 
         $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
         $storeMock->expects($this->once())->method('getId')->willReturn($storeId);
@@ -359,6 +363,7 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase
 
         $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $productMock->expects($this->any())->method('getSku')->willReturn($productSku);
         $optionMock = $this->getMock(
             '\Magento\Bundle\Model\Option',
             [
@@ -378,6 +383,17 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase
         $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();
         $optionMock->expects($this->any())->method('getOptionId')->willReturn($optionId);
 
+        $existingLinkToUpdate = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $existingLinkToUpdate->expects($this->any())->method('getId')->willReturn($existingLinkToUpdateId);
+        $existingLinkToDelete = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $existingLinkToDelete->expects($this->any())->method('getId')->willReturn($existingLinkToDeleteId);
+        $existingLinkToDelete->expects($this->once())->method('getSku')->willReturn($productSkuToDelete);
+        $existingLinks = [$existingLinkToUpdate, $existingLinkToDelete];
+        $this->linkManagementMock->expects($this->once())
+            ->method('getChildren')
+            ->with($productSku, $optionId)
+            ->willReturn($existingLinks);
+
         $optCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false);
         $this->typeMock->expects($this->once())
             ->method('getOptionsCollection')
@@ -390,22 +406,183 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $optCollectionMock->expects($this->once())->method('setIdFilter')->with($optionId)->willReturnSelf();
-        $optCollectionMock->expects($this->once())->method('getFirstItem')->willReturn($existingOptionMock);
+        $optCollectionMock->expects($this->once())->method('getItemById')
+            ->with($optionId)
+            ->willReturn($existingOptionMock);
         $existingOptionMock->expects($this->any())->method('getOptionId')->willReturn($existingOptionId);
-        $existingOptionMock->expects($this->once())->method('getProductLinks')->willReturn(null);
 
-        $linkedProductMock = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
-        $optionMock->expects($this->exactly(2))->method('getProductLinks')->willReturn([$linkedProductMock]);
+        $productLinkUpdate = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLinkUpdate->expects($this->any())->method('getId')->willReturn($existingLinkToUpdateId);
+        $productLinkNew = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLinkNew->expects($this->any())->method('getId')->willReturn(null);
+        $optionMock->expects($this->exactly(2))
+            ->method('getProductLinks')
+            ->willReturn([$productLinkUpdate, $productLinkNew]);
 
         $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)->willReturnSelf();
         $this->linkManagementMock->expects($this->once())
             ->method('addChild')
-            ->with($productMock, $optionId, $linkedProductMock)
-            ->willReturn(1);
+            ->with($productMock, $optionId, $productLinkNew);
+        $this->linkManagementMock->expects($this->once())
+            ->method('saveChild')
+            ->with($productSku, $productLinkUpdate);
+        $this->linkManagementMock->expects($this->once())
+            ->method('removeChild')
+            ->with($productSku, $optionId, $productSkuToDelete);
+        $this->assertEquals($optionId, $this->model->save($productMock, $optionMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\NoSuchEntityException
+     * @expectedExceptionMessage Requested option doesn't exist
+     */
+    public function testSaveExistingOptionNoSuchOption()
+    {
+        $productId = 1;
+        $productSku = 'bundle_sku';
+        $storeId = 2;
+        $optionId = 5;
+
+        $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
+        $storeMock->expects($this->once())->method('getId')->willReturn($storeId);
+        $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock);
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $productMock->expects($this->any())->method('getSku')->willReturn($productSku);
+        $optionMock = $this->getMock(
+            '\Magento\Bundle\Model\Option',
+            [
+                'setStoreId',
+                'setParentId',
+                'getOptionId',
+            ],
+            [],
+            '',
+            false
+        );
+        $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf();
+        $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();
+        $optionMock->expects($this->any())->method('getOptionId')->willReturn($optionId);
+
+        $optCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false);
+        $this->typeMock->expects($this->once())
+            ->method('getOptionsCollection')
+            ->with($productMock)
+            ->willReturn($optCollectionMock);
+        $existingOptionMock = $this->getMock(
+            '\Magento\Bundle\Model\Option',
+            ['getOptionId', 'getTitle', 'getProductLinks'],
+            [],
+            '',
+            false
+        );
+        $optCollectionMock->expects($this->once())->method('getItemById')
+            ->with($optionId)
+            ->willReturn($existingOptionMock);
+        $existingOptionMock->expects($this->any())->method('getOptionId')->willReturn(null);
+
+        $this->model->save($productMock, $optionMock);
+    }
+
+    public function testSaveNewOption()
+    {
+        $productId = 1;
+        $productSku = 'bundle_sku';
+        $storeId = 2;
+        $optionId = 5;
+
+        $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
+        $storeMock->expects($this->once())->method('getId')->willReturn($storeId);
+        $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock);
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $productMock->expects($this->any())->method('getSku')->willReturn($productSku);
+        $optionMock = $this->getMock(
+            '\Magento\Bundle\Model\Option',
+            [
+                'setStoreId',
+                'setParentId',
+                'getProductLinks',
+                'getOptionId',
+                'setOptionId',
+                'setDefaultTitle',
+                'getTitle'
+            ],
+            [],
+            '',
+            false
+        );
+        $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf();
+        $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();
+        $optionMock->method('getOptionId')
+            ->will($this->onConsecutiveCalls(null, $optionId, $optionId, $optionId, $optionId));
+
+        $productLink1 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink2 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $optionMock->expects($this->exactly(2))
+            ->method('getProductLinks')
+            ->willReturn([$productLink1, $productLink2]);
+
+        $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)->willReturnSelf();
+        $this->linkManagementMock->expects($this->at(0))
+            ->method('addChild')
+            ->with($productMock, $optionId, $productLink1);
+        $this->linkManagementMock->expects($this->at(1))
+            ->method('addChild')
+            ->with($productMock, $optionId, $productLink2);
         $this->assertEquals($optionId, $this->model->save($productMock, $optionMock));
     }
 
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+     * @expectedExceptionMessage Could not save option
+     */
+    public function testSaveCanNotSave()
+    {
+        $productId = 1;
+        $productSku = 'bundle_sku';
+        $storeId = 2;
+        $optionId = 5;
+
+        $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
+        $storeMock->expects($this->once())->method('getId')->willReturn($storeId);
+        $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock);
+
+        $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
+        $productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $productMock->expects($this->any())->method('getSku')->willReturn($productSku);
+        $optionMock = $this->getMock(
+            '\Magento\Bundle\Model\Option',
+            [
+                'setStoreId',
+                'setParentId',
+                'getProductLinks',
+                'getOptionId',
+                'setOptionId',
+                'setDefaultTitle',
+                'getTitle'
+            ],
+            [],
+            '',
+            false
+        );
+        $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf();
+        $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();
+        $optionMock->method('getOptionId')->will($this->onConsecutiveCalls(null, $optionId, $optionId, $optionId));
+
+        $productLink1 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $productLink2 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface');
+        $optionMock->expects($this->exactly(2))
+            ->method('getProductLinks')
+            ->willReturn([$productLink1, $productLink2]);
+
+        $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)
+            ->willThrowException($this->getMock('\Exception'));
+        $this->model->save($productMock, $optionMock);
+    }
+
     public function testGetList()
     {
         $productSku = 'simple';
diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php
index e4050d99040ca61dacc97b54731fd79e67719af1..77d92ff634334b7d1fbc04e3022a33d6eea06334 100644
--- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php
+++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php
@@ -60,7 +60,6 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundLoad()
     {
-        $this->markTestSkipped('MAGETWO-34577');
         $productMock = $this->getMock(
             '\Magento\Catalog\Model\Product',
             ['getTypeId', 'setExtensionAttributes'],
@@ -82,6 +81,7 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase
             ->willReturn([$optionMock]);
         $productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtension')
             ->disableOriginalConstructor()
+            ->setMethods(['setBundleProductOptions', 'getBundleProductOptions'])
             ->getMock();
         $this->productExtensionFactory->expects($this->once())
             ->method('create')
diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php
index 1615760e6dbee5b4ad44d0d30cd81b53b19e691e..62095af664f2b1c04fbd1332ba5c959149e04a4f 100644
--- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php
+++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php
@@ -43,6 +43,11 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
      */
     protected $productBundleOptionsMock;
 
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $productInterfaceFactoryMock;
+
     /**
      * @var \Closure
      */
@@ -54,7 +59,7 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
         $this->productOptionRepositoryMock = $this->getMock('Magento\Bundle\Api\ProductOptionRepositoryInterface');
         $this->productMock = $this->getMock(
             'Magento\Catalog\Model\Product',
-            ['getExtensionAttributes', 'getTypeId'],
+            ['getExtensionAttributes', 'getTypeId', 'getSku', 'getStoreId'],
             [],
             '',
             false
@@ -62,10 +67,12 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
         $this->closureMock = function () {
             return $this->productMock;
         };
-        $this->plugin = new BundleSaveOptions($this->productOptionRepositoryMock);
+        $this->plugin = new BundleSaveOptions(
+            $this->productOptionRepositoryMock
+        );
         $this->productExtensionMock = $this->getMock(
             'Magento\Catalog\Api\Data\ProductExtension',
-            ['getBundleProductOptions'],
+            ['getBundleProductOptions', 'setBundleProductOptions'],
             [],
             '',
             false
@@ -98,7 +105,7 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
             ->willReturn($this->productExtensionMock);
         $this->productExtensionMock->expects($this->once())
             ->method('getBundleProductOptions')
-            ->willReturn([]);
+            ->willReturn(null);
 
         $this->productOptionRepositoryMock->expects($this->never())->method('save');
 
@@ -110,20 +117,105 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundSaveWhenProductIsBundleWithOptions()
     {
+        $productSku = "bundle_sku";
+        $option = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface');
+        $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle');
+        $this->productMock->expects($this->once())
+            ->method('getExtensionAttributes')
+            ->willReturn($this->productExtensionMock);
+        $this->productExtensionMock->expects($this->once())
+            ->method('getBundleProductOptions')
+            ->willReturn([$option]);
+
+        $this->productOptionRepositoryMock->expects($this->once())->method('save')->with($this->productMock, $option);
+
+        $this->productMock->expects($this->exactly(2))->method('getSku')
+            ->will($this->returnValue($productSku));
+
+        $this->productOptionRepositoryMock->expects($this->once())
+            ->method('getList')
+            ->with($productSku)
+            ->will($this->returnValue([]));
+
+        $newProductMock = $this->getMockBuilder('Magento\Catalog\Api\Data\ProductInterface')
+            ->disableOriginalConstructor()->getMock();
+        $this->productRepositoryMock->expects($this->once())
+            ->method('get')
+            ->with($productSku, false, null, true)
+            ->willReturn($newProductMock);
+
+        $this->assertEquals(
+            $newProductMock,
+            $this->plugin->aroundSave($this->productRepositoryMock, $this->closureMock, $this->productMock)
+        );
+    }
+
+    /**
+     * Test the case where the product has existing options
+     */
+    public function testAroundSaveWhenProductIsBundleWithOptionsAndExistingOptions()
+    {
+        $existOption1Id = 10;
+        $existOption2Id = 11;
+        $productSku = 'bundle_sku';
+        $existingOption1 = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface');
+        $existingOption1->expects($this->once())
+            ->method('getOptionId')
+            ->will($this->returnValue($existOption1Id));
+        $existingOption2 = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface');
+        $existingOption2->expects($this->once())
+            ->method('getOptionId')
+            ->will($this->returnValue($existOption2Id));
+
+        $bundleOptionExisting = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface');
+        $bundleOptionExisting->expects($this->once())
+            ->method('getOptionId')
+            ->will($this->returnValue($existOption1Id));
+
+        $bundleOptionNew = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface');
+        $bundleOptionNew->expects($this->once())
+            ->method('getOptionId')
+            ->will($this->returnValue(null));
+
         $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle');
         $this->productMock->expects($this->once())
             ->method('getExtensionAttributes')
             ->willReturn($this->productExtensionMock);
         $this->productExtensionMock->expects($this->once())
             ->method('getBundleProductOptions')
-            ->willReturn([$this->productBundleOptionsMock]);
+            ->willReturn([$bundleOptionExisting, $bundleOptionNew]);
+        $this->productMock->expects($this->exactly(2))->method('getSku')
+            ->will($this->returnValue($productSku));
 
         $this->productOptionRepositoryMock->expects($this->once())
+            ->method('getList')
+            ->with($productSku)
+            ->will($this->returnValue([$existingOption1, $existingOption2]));
+
+        $this->productOptionRepositoryMock
+            ->expects($this->at(1))
+            ->method('save')
+            ->with($this->productMock, $bundleOptionExisting);
+
+        $this->productOptionRepositoryMock
+            ->expects($this->at(1))
             ->method('save')
-            ->with($this->productMock, $this->productBundleOptionsMock);
+            ->with($this->productMock, $bundleOptionNew);
+
+        $this->productOptionRepositoryMock
+            ->expects($this->once())
+            ->method('delete')
+            ->with($existingOption2);
+
+        $newProductMock = $this->getMockBuilder('Magento\Catalog\Api\Data\ProductInterface')
+            ->disableOriginalConstructor()->getMock();
+        $this->productRepositoryMock->expects($this->once())
+            ->method('get')
+            ->with($productSku, false, null, true)
+            ->willReturn($newProductMock);
 
         $this->assertEquals(
-            $this->productMock,
+            $newProductMock,
             $this->plugin->aroundSave($this->productRepositoryMock, $this->closureMock, $this->productMock)
         );
     }
diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php
index 86c409a3de09e7bde03a28658c897ab6371f5bc0..0909834ce5914307bd82d13fa7bbfcecd3a07dc6 100644
--- a/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php
+++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php
@@ -64,6 +64,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase
                 'getIsDefault',
                 'getSelectionQty',
                 'getSelectionCanChangeQty',
+                'getSelectionId',
                 '__wakeup'
             ],
             [],
@@ -89,6 +90,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase
     public function testLinksList()
     {
         $optionId = 665;
+        $selectionId = 1345;
         $this->productTypeMock->expects($this->once())
             ->method('getSelectionsCollection')
             ->with([$optionId], $this->productMock)
@@ -99,6 +101,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase
             ->willReturn('selection_price_type');
         $this->selectionMock->expects($this->once())->method('getSelectionPriceValue')->willReturn(12);
         $this->selectionMock->expects($this->once())->method('getData')->willReturn(['some data']);
+        $this->selectionMock->expects($this->once())->method('getSelectionId')->willReturn($selectionId);
         $this->selectionMock->expects($this->once())->method('getIsDefault')->willReturn(true);
         $this->selectionMock->expects($this->once())->method('getSelectionQty')->willReturn(66);
         $this->selectionMock->expects($this->once())->method('getSelectionCanChangeQty')->willReturn(22);
@@ -108,8 +111,9 @@ class LinksListTest extends \PHPUnit_Framework_TestCase
             ->with($linkMock, ['some data'], '\Magento\Bundle\Api\Data\LinkInterface')->willReturnSelf();
         $linkMock->expects($this->once())->method('setIsDefault')->with(true)->willReturnSelf();
         $linkMock->expects($this->once())->method('setQty')->with(66)->willReturnSelf();
-        $linkMock->expects($this->once())->method('setIsDefined')->with(22)->willReturnSelf();
+        $linkMock->expects($this->once())->method('setCanChangeQuantity')->with(22)->willReturnSelf();
         $linkMock->expects($this->once())->method('setPrice')->with(12)->willReturnSelf();
+        $linkMock->expects($this->once())->method('setId')->with($selectionId)->willReturnSelf();
         $linkMock->expects($this->once())
             ->method('setPriceType')->with('selection_price_type')->willReturnSelf();
         $this->linkFactoryMock->expects($this->once())->method('create')->willReturn($linkMock);
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/Bundle/etc/data_object.xml b/app/code/Magento/Bundle/etc/data_object.xml
index 88e317dafc78c8ce9d0c9a3fe6f703b777361e4a..2b3da013978f971bb20baca3a5e0ca95f2b501fc 100644
--- a/app/code/Magento/Bundle/etc/data_object.xml
+++ b/app/code/Magento/Bundle/etc/data_object.xml
@@ -8,7 +8,5 @@
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
     <custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
         <attribute code="bundle_product_options" type="Magento\Bundle\Api\Data\OptionInterface[]" />
-        <attribute code="price_type" type="integer" />
-        <attribute code="price_view" type="string" />
     </custom_attributes>
 </config>
diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml
index ec0dffcf1049e2d29da72bb80d02e8fba97ee316..550987ba13e669b5e2a5634384b3793d8932f97e 100644
--- a/app/code/Magento/Bundle/etc/webapi.xml
+++ b/app/code/Magento/Bundle/etc/webapi.xml
@@ -13,7 +13,13 @@
             <resource ref="Magento_Catalog::products"/>
         </resources>
     </route>
-    <route url="/V1/bundle-products/:productId/children" method="GET">
+    <route url="/V1/bundle-products/:sku/links/:id" method="PUT">
+        <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="saveChild"/>
+        <resources>
+            <resource ref="Magento_Catalog::products"/>
+        </resources>
+    </route>
+    <route url="/V1/bundle-products/:productSku/children" method="GET">
         <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="getChildren"/>
         <resources>
             <resource ref="Magento_Catalog::products"/>
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/Api/ProductRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php
index 8205f68fca6095f9d516c01f5ad04be1a8515725..7fb25a7c046f5124a52ba8e50171112ca670c6c3 100644
--- a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php
+++ b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php
@@ -27,10 +27,11 @@ interface ProductRepositoryInterface
      * @param string $sku
      * @param bool $editMode
      * @param null|int $storeId
+     * @param bool $forceReload
      * @return \Magento\Catalog\Api\Data\ProductInterface
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      */
-    public function get($sku, $editMode = false, $storeId = null);
+    public function get($sku, $editMode = false, $storeId = null, $forceReload = false);
 
     /**
      * Get info about product by product id
@@ -38,10 +39,11 @@ interface ProductRepositoryInterface
      * @param int $productId
      * @param bool $editMode
      * @param null|int $storeId
+     * @param bool $forceReload
      * @return \Magento\Catalog\Api\Data\ProductInterface
      * @throws \Magento\Framework\Exception\NoSuchEntityException
      */
-    public function getById($productId, $editMode = false, $storeId = null);
+    public function getById($productId, $editMode = false, $storeId = null, $forceReload = false);
 
     /**
      * Delete product
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php
index 9dbbddcee68f828b225304bea6dad7050d74c275..318fad719e5c0c857db31f5cef1dc06570328116 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php
@@ -64,6 +64,8 @@ class Helper
     public function initialize(\Magento\Catalog\Model\Product $product)
     {
         $productData = $this->request->getPost('product');
+        unset($productData['custom_attributes']);
+        unset($productData['extension_attributes']);
 
         if ($productData) {
             $stockData = isset($productData['stock_data']) ? $productData['stock_data'] : [];
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/Plugin/ProductRepository/TransactionWrapper.php b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php
new file mode 100644
index 0000000000000000000000000000000000000000..1d940a5d7aee5e62da18e7a623ee2295b36afcea
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Plugin for \Magento\Catalog\Api\ProductRepositoryInterface
+ *
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Catalog\Model\Plugin\ProductRepository;
+
+class TransactionWrapper
+{
+    /**
+     * @var \Magento\Catalog\Model\Resource\Product
+     */
+    protected $resourceModel;
+
+    /**
+     * @param \Magento\Catalog\Model\Resource\Product $resourceModel
+     */
+    public function __construct(
+        \Magento\Catalog\Model\Resource\Product $resourceModel
+    ) {
+        $this->resourceModel = $resourceModel;
+    }
+
+    /**
+     * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject
+     * @param callable $proceed
+     * @param \Magento\Catalog\Api\Data\ProductInterface $product
+     * @param bool $saveOptions
+     * @return \Magento\Catalog\Api\Data\ProductInterface
+     * @throws \Exception
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function aroundSave(
+        \Magento\Catalog\Api\ProductRepositoryInterface $subject,
+        \Closure $proceed,
+        \Magento\Catalog\Api\Data\ProductInterface $product,
+        $saveOptions = false
+    ) {
+        $this->resourceModel->beginTransaction();
+        try {
+            /** @var \Magento\Catalog\Api\Data\ProductInterface $result */
+            $result = $proceed($product, $saveOptions);
+            $this->resourceModel->commit();
+            return $result;
+        } catch (\Exception $e) {
+            $this->resourceModel->rollBack();
+            throw $e;
+        }
+    }
+
+    /**
+     * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject
+     * @param callable $proceed
+     * @param \Magento\Catalog\Api\Data\ProductInterface $product
+     * @return bool
+     * @throws \Exception
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function aroundDelete(
+        \Magento\Catalog\Api\ProductRepositoryInterface $subject,
+        \Closure $proceed,
+        \Magento\Catalog\Api\Data\ProductInterface $product
+    ) {
+        $this->resourceModel->beginTransaction();
+        try {
+            /** @var bool $result */
+            $result = $proceed($product);
+            $this->resourceModel->commit();
+            return $result;
+        } catch (\Exception $e) {
+            $this->resourceModel->rollBack();
+            throw $e;
+        }
+    }
+
+    /**
+     * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject
+     * @param callable $proceed
+     * @param string $productSku
+     * @return bool
+     * @throws \Exception
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function aroundDeleteById(
+        \Magento\Catalog\Api\ProductRepositoryInterface $subject,
+        \Closure $proceed,
+        $productSku
+    ) {
+        $this->resourceModel->beginTransaction();
+        try {
+            /** @var bool $result */
+            $result = $proceed($productSku);
+            $this->resourceModel->commit();
+            return $result;
+        } catch (\Exception $e) {
+            $this->resourceModel->rollBack();
+            throw $e;
+        }
+    }
+}
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/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php
index 43fa06093960b8abab062c90bb649cde53164d96..40ecc5d2cb3419101374a9d563b52ada19cd9967 100644
--- a/app/code/Magento/Catalog/Model/ProductRepository.php
+++ b/app/code/Magento/Catalog/Model/ProductRepository.php
@@ -181,10 +181,10 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
     /**
      * {@inheritdoc}
      */
-    public function get($sku, $editMode = false, $storeId = null)
+    public function get($sku, $editMode = false, $storeId = null, $forceReload = false)
     {
         $cacheKey = $this->getCacheKey(func_get_args());
-        if (!isset($this->instances[$sku][$cacheKey])) {
+        if (!isset($this->instances[$sku][$cacheKey]) || $forceReload) {
             $product = $this->productFactory->create();
 
             $productId = $this->resourceModel->getIdBySku($sku);
@@ -204,10 +204,10 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
     /**
      * {@inheritdoc}
      */
-    public function getById($productId, $editMode = false, $storeId = null)
+    public function getById($productId, $editMode = false, $storeId = null, $forceReload = false)
     {
         $cacheKey = $this->getCacheKey(func_get_args());
-        if (!isset($this->instancesById[$productId][$cacheKey])) {
+        if (!isset($this->instancesById[$productId][$cacheKey]) || $forceReload) {
             $product = $this->productFactory->create();
 
             if ($editMode) {
@@ -235,6 +235,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
     protected function getCacheKey($data)
     {
         unset($data[0]);
+        unset($data['forceReload']);
         $serializeData = [];
         foreach ($data as $key => $value) {
             if (is_object($value)) {
diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php
index 1ca2468ed2a4ef213c22bfb9b7a31c0aaa6e322c..d2dc790edb124beb7e7aaa34c86114e7a17ff7e2 100644
--- a/app/code/Magento/Catalog/Setup/InstallSchema.php
+++ b/app/code/Magento/Catalog/Setup/InstallSchema.php
@@ -115,7 +115,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_set_id',
                 $installer->getTable('eav_attribute_set'),
                 'attribute_set_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -123,7 +122,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_type_id',
                 $installer->getTable('eav_entity_type'),
                 'entity_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Table');
@@ -203,7 +201,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -216,7 +213,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -224,7 +220,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Datetime Attribute Backend Table');
@@ -304,7 +299,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -317,7 +311,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -325,7 +318,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Decimal Attribute Backend Table');
@@ -400,7 +392,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -408,7 +399,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -416,7 +406,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Integer Attribute Backend Table');
@@ -496,7 +485,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -509,7 +497,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -517,7 +504,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Text Attribute Backend Table');
@@ -597,7 +583,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -610,7 +595,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -618,7 +602,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Varchar Attribute Backend Table');
@@ -709,7 +692,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -722,7 +704,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -730,7 +711,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Gallery Attribute Backend Table');
@@ -896,7 +876,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -909,7 +888,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -917,7 +895,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Category Datetime Attribute Backend Table');
@@ -1001,7 +978,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1014,7 +990,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1022,7 +997,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Category Decimal Attribute Backend Table');
@@ -1101,7 +1075,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1114,7 +1087,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1122,7 +1094,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Category Integer Attribute Backend Table');
@@ -1201,7 +1172,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1214,7 +1184,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1222,7 +1191,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Category Text Attribute Backend Table');
@@ -1306,7 +1274,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1319,7 +1286,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1327,7 +1293,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Category Varchar Attribute Backend Table');
@@ -1373,7 +1338,6 @@ class InstallSchema implements InstallSchemaInterface
                 'category_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1381,7 +1345,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product To Category Linkage Table');
@@ -1514,7 +1477,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_id',
                 $installer->getTable('customer_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1522,7 +1484,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1530,8 +1491,7 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment(
                 'Catalog Compare Table'
@@ -1569,7 +1529,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1577,7 +1536,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -1675,7 +1633,6 @@ class InstallSchema implements InstallSchemaInterface
                 'linked_product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1683,7 +1640,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1696,7 +1652,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_type_id',
                 $installer->getTable('catalog_product_link_type'),
                 'link_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -1754,7 +1709,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_type_id',
                 $installer->getTable('catalog_product_link_type'),
                 'link_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -1821,7 +1775,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_id',
                 $installer->getTable('catalog_product_link'),
                 'link_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1834,7 +1787,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_link_attribute_id',
                 $installer->getTable('catalog_product_link_attribute'),
                 'product_link_attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -1901,7 +1853,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_id',
                 $installer->getTable('catalog_product_link'),
                 'link_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1914,7 +1865,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_link_attribute_id',
                 $installer->getTable('catalog_product_link_attribute'),
                 'product_link_attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -1981,7 +1931,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_id',
                 $installer->getTable('catalog_product_link'),
                 'link_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -1994,7 +1943,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_link_attribute_id',
                 $installer->getTable('catalog_product_link_attribute'),
                 'product_link_attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2086,7 +2034,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2099,7 +2046,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2107,7 +2053,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2169,7 +2114,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2182,7 +2126,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2258,7 +2201,6 @@ class InstallSchema implements InstallSchemaInterface
                 'value_id',
                 $installer->getTable('catalog_product_entity_media_gallery'),
                 'value_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2266,7 +2208,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2279,7 +2220,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2374,7 +2314,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2448,7 +2387,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_id',
                 $installer->getTable('catalog_product_option'),
                 'option_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2456,7 +2394,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2523,7 +2460,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_id',
                 $installer->getTable('catalog_product_option'),
                 'option_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2531,7 +2467,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2663,7 +2598,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_type_id',
                 $installer->getTable('catalog_product_option_type_value'),
                 'option_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2671,7 +2605,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2738,7 +2671,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_type_id',
                 $installer->getTable('catalog_product_option_type_value'),
                 'option_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2746,7 +2678,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2908,7 +2839,6 @@ class InstallSchema implements InstallSchemaInterface
                 'attribute_id',
                 $installer->getTable('eav_attribute'),
                 'attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -2947,7 +2877,6 @@ class InstallSchema implements InstallSchemaInterface
                 'child_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -2955,7 +2884,6 @@ class InstallSchema implements InstallSchemaInterface
                 'parent_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -3169,7 +3097,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -3182,7 +3109,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -3190,7 +3116,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -3252,7 +3177,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -3265,7 +3189,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -3273,7 +3196,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -3319,7 +3241,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -4605,7 +4526,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -4618,7 +4538,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -4631,7 +4550,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
@@ -4694,7 +4612,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -4707,7 +4624,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -4715,7 +4631,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment(
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..681af582d1344c749c0623451ce0d4195e2f3d17
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php
@@ -0,0 +1,141 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Catalog\Test\Unit\Model\Plugin\ProductRepository;
+
+class TransactionWrapperTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper
+     */
+    protected $model;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Resource\Product
+     */
+    protected $resourceMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Api\ProductRepositoryInterface
+     */
+    protected $subjectMock;
+
+    /**
+     * @var \Closure
+     */
+    protected $closureMock;
+
+    /**
+     * @var \Closure
+     */
+    protected $rollbackClosureMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $productMock;
+
+    /**
+     * @var bool
+     */
+    protected $saveOption = true;
+
+    const ERROR_MSG = "error occurred";
+
+    protected function setUp()
+    {
+        $this->resourceMock = $this->getMock('Magento\Catalog\Model\Resource\Product', [], [], '', false);
+        $this->subjectMock = $this->getMock('Magento\Catalog\Api\ProductRepositoryInterface', [], [], '', false);
+        $this->productMock = $this->getMock('Magento\Catalog\Api\Data\ProductInterface', [], [], '', false);
+        $productMock = $this->productMock;
+        $this->closureMock = function () use ($productMock) {
+            return $productMock;
+        };
+        $this->rollbackClosureMock = function () use ($productMock) {
+            throw new \Exception(self::ERROR_MSG);
+        };
+
+        $this->model = new \Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper($this->resourceMock);
+    }
+
+    public function testAroundSaveCommit()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('commit');
+
+        $this->assertEquals(
+            $this->productMock,
+            $this->model->aroundSave($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption)
+        );
+    }
+
+    /**
+     * @expectedException \Exception
+     * @expectedExceptionMessage error occurred
+     */
+    public function testAroundSaveRollBack()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('rollBack');
+
+        $this->model->aroundSave($this->subjectMock, $this->rollbackClosureMock, $this->productMock, $this->saveOption);
+    }
+
+    public function testAroundDeleteCommit()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('commit');
+
+        $this->assertEquals(
+            $this->productMock,
+            $this->model->aroundDelete($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption)
+        );
+    }
+
+    /**
+     * @expectedException \Exception
+     * @expectedExceptionMessage error occurred
+     */
+    public function testAroundDeleteRollBack()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('rollBack');
+
+        $this->model->aroundDelete(
+            $this->subjectMock,
+            $this->rollbackClosureMock,
+            $this->productMock,
+            $this->saveOption
+        );
+    }
+
+    public function testAroundDeleteByIdCommit()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('commit');
+
+        $this->assertEquals(
+            $this->productMock,
+            $this->model->aroundDelete($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption)
+        );
+    }
+
+    /**
+     * @expectedException \Exception
+     * @expectedExceptionMessage error occurred
+     */
+    public function testAroundDeleteByIdRollBack()
+    {
+        $this->resourceMock->expects($this->once())->method('beginTransaction');
+        $this->resourceMock->expects($this->once())->method('rollBack');
+
+        $this->model->aroundDelete(
+            $this->subjectMock,
+            $this->rollbackClosureMock,
+            $this->productMock,
+            $this->saveOption
+        );
+    }
+}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php
index affded52e9586413fb24378919bf538fdf4b74fb..26f70422f0e6075392f7e52c473371af78ded36c 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php
@@ -75,8 +75,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap(
             [
-                ['product', false, null, $productMock],
-                ['linkedProduct', false, null, $linkedProductMock],
+                ['product', false, null, false, $productMock],
+                ['linkedProduct', false, null, false, $linkedProductMock],
             ]
         ));
         $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct');
@@ -102,8 +102,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap(
             [
-                ['product', false, null, $productMock],
-                ['linkedProduct', false, null, $linkedProductMock],
+                ['product', false, null, false, $productMock],
+                ['linkedProduct', false, null, false, $linkedProductMock],
             ]
         ));
         $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct');
@@ -129,8 +129,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap(
             [
-                ['product', false, null, $productMock],
-                ['linkedProduct', false, null, $linkedProductMock],
+                ['product', false, null, false, $productMock],
+                ['linkedProduct', false, null, false, $linkedProductMock],
             ]
         ));
         $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct');
@@ -157,8 +157,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap(
             [
-                ['product', false, null, $productMock],
-                ['linkedProduct', false, null, $linkedProductMock],
+                ['product', false, null, false, $productMock],
+                ['linkedProduct', false, null, false, $linkedProductMock],
             ]
         ));
         $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct');
@@ -186,8 +186,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
         $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap(
             [
-                ['product', false, null, $productMock],
-                ['linkedProduct', false, null, $linkedProductMock],
+                ['product', false, null, false, $productMock],
+                ['linkedProduct', false, null, false, $linkedProductMock],
             ]
         ));
         $entityMock->expects($this->exactly(2))->method('getLinkedProductSku')->willReturn('linkedProduct');
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
index d50868fc2306bb0376ba81b02973d51f3c7b42ef..a8ba184519d797718c4613f9e5f4c4c8690764bf 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
@@ -298,6 +298,55 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase
         $this->productMock->expects($this->once())->method('load')->with($identifier);
         $this->productMock->expects($this->once())->method('getId')->willReturn($identifier);
         $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId));
+        //Second invocation should just return from cache
+        $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId));
+    }
+
+    /**
+     * Test the forceReload parameter
+     *
+     * @throws \Magento\Framework\Exception\NoSuchEntityException
+     */
+    public function testGetByIdForcedReload()
+    {
+        $identifier = "23";
+        $editMode = false;
+        $storeId = 0;
+
+        $this->productFactoryMock->expects($this->exactly(2))->method('create')
+            ->will($this->returnValue($this->productMock));
+        $this->productMock->expects($this->exactly(2))->method('load');
+        $this->productMock->expects($this->exactly(2))->method('getId')->willReturn($identifier);
+        $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId));
+        //second invocation should just return from cache
+        $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId));
+        //force reload
+        $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId, true));
+    }
+
+    /**
+     * Test forceReload parameter
+     *
+     * @throws \Magento\Framework\Exception\NoSuchEntityException
+     */
+    public function testGetForcedReload()
+    {
+        $sku = "sku";
+        $id = "23";
+        $editMode = false;
+        $storeId = 0;
+
+        $this->productFactoryMock->expects($this->exactly(2))->method('create')
+            ->will($this->returnValue($this->productMock));
+        $this->productMock->expects($this->exactly(2))->method('load');
+        $this->productMock->expects($this->exactly(2))->method('getId')->willReturn($sku);
+        $this->resourceModelMock->expects($this->exactly(2))->method('getIdBySku')
+            ->with($sku)->willReturn($id);
+        $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId));
+        //second invocation should just return from cache
+        $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId));
+        //force reload
+        $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId, true));
     }
 
     public function testGetByIdWithSetStoreId()
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/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index 971bebcac3226849a1af0c88b08925230ea83246..acd741fdbbe66d5c107a3d24ce3d99a5ec716b52 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -461,4 +461,7 @@
     <preference for="Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface" type="\Magento\Catalog\Model\Product\Option\Value" />
     <virtualType name="Magento\Catalog\Model\Resource\Attribute\Collection" type="Magento\Eav\Model\Resource\Entity\Attribute\Collection">
     </virtualType>
+    <type name="Magento\Catalog\Api\ProductRepositoryInterface">
+        <plugin name="transactionWrapper" type="\Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper" sortOrder="-1"/>
+    </type>
 </config>
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/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php
index d7730876dd43e08eec57a8789f719d4262a2b3fa..aa6705a61ca829bc17506700a82eaaef67602093 100644
--- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php
+++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php
@@ -283,7 +283,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -291,7 +290,6 @@ class InstallSchema implements InstallSchemaInterface
                 'stock_id',
                 $installer->getTable('cataloginventory_stock'),
                 'stock_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Cataloginventory Stock Item');
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/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php
index 7c9fd560f92a857956d04366b247c52e8b33690e..610434b70a4448f545de5db717fc93e15dfced94 100644
--- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php
+++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php
@@ -418,7 +418,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -426,7 +425,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rule_id',
                 $installer->getTable('catalogrule'),
                 'rule_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -434,7 +432,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('CatalogRule Group Website');
@@ -469,7 +466,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rule_id',
                 $installer->getTable('catalogrule'),
                 'rule_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -477,7 +473,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Rules To Websites Relations');
@@ -512,7 +507,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rule_id',
                 $installer->getTable('catalogrule'),
                 'rule_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -525,7 +519,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_group_id',
                 $installer->getTable('customer_group'),
                 'customer_group_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Rules To Customer Groups Relations');
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/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php
index baed812982fcbaf707c62d6b2c37c2851617f93e..88acf7808b614cd0654f92eecd70e37f27cc9200 100644
--- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php
+++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php
@@ -57,7 +57,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -65,7 +64,6 @@ class InstallSchema implements InstallSchemaInterface
                 'category_id',
                 $installer->getTable('catalog_category_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -73,7 +71,6 @@ class InstallSchema implements InstallSchemaInterface
                 'url_rewrite_id',
                 $installer->getTable('url_rewrite'),
                 'url_rewrite_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('url_rewrite_relation');
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/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php
index 27f72fb347f391cd41e74da27eb83713e46abd1a..8cf93dd33eaa66b2e65598029299152b508dc991 100644
--- a/app/code/Magento/Checkout/Block/Cart/Shipping.php
+++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php
@@ -34,7 +34,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
     protected $_directoryBlock;
 
     /**
-     * @var \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface
+     * @var \Magento\Shipping\Model\CarrierFactoryInterface
      */
     protected $_carrierFactory;
 
@@ -48,7 +48,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
      * @param \Magento\Customer\Model\Session $customerSession
      * @param \Magento\Checkout\Model\Session $checkoutSession
      * @param \Magento\Directory\Block\Data $directoryBlock
-     * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory
+     * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory
      * @param PriceCurrencyInterface $priceCurrency
      * @param array $data
      */
@@ -57,7 +57,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
         \Magento\Customer\Model\Session $customerSession,
         \Magento\Checkout\Model\Session $checkoutSession,
         \Magento\Directory\Block\Data $directoryBlock,
-        \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory,
+        \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory,
         PriceCurrencyInterface $priceCurrency,
         array $data = []
     ) {
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index 50db79346bdbb9c2e5c0f05a300135a83e6d7161..3ff8bfdb0e1e152992f8a393859817f6fc9ad865 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -3,31 +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-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/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php
index 2b782a0ed9bf781c7f262f24df3f87c3d9ada9bc..d4df1585bb67b80436fde0e266ddaef1225b6bd1 100644
--- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php
+++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php
@@ -97,14 +97,12 @@ class InstallSchema implements InstallSchemaInterface
             'agreement_id',
             $installer->getTable('checkout_agreement'),
             'agreement_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Checkout Agreement Store'
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/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php
index d57b656b110393c18585834c08f84c813fad474e..00c2eba7289fe191a41b801fc3c8ad0749a4c20a 100644
--- a/app/code/Magento/Cms/Setup/InstallSchema.php
+++ b/app/code/Magento/Cms/Setup/InstallSchema.php
@@ -102,14 +102,12 @@ class InstallSchema implements InstallSchemaInterface
             'block_id',
             $installer->getTable('cms_block'),
             'block_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'CMS Block To Store Linkage Table'
@@ -262,14 +260,12 @@ class InstallSchema implements InstallSchemaInterface
             'page_id',
             $installer->getTable('cms_page'),
             'page_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'CMS Page To Store Linkage Table'
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/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php
index 51ce770c9aa042b6da48a047baa8752c3e67f706..d4514e8618dbdb4f9f62f98d9ea828d10d7ad6be 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php
@@ -77,8 +77,7 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-                \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Super Attribute Table');
 
@@ -147,7 +146,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_super_attribute_id',
                 $installer->getTable('catalog_product_super_attribute'),
                 'product_super_attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -155,7 +153,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Super Attribute Label Table');
@@ -231,7 +228,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -244,7 +240,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_super_attribute_id',
                 $installer->getTable('catalog_product_super_attribute'),
                 'product_super_attribute_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Super Attribute Pricing Table');
@@ -300,7 +295,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -308,7 +302,6 @@ class InstallSchema implements InstallSchemaInterface
                 'parent_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Catalog Product Super Link Table');
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/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php
index cc7b419fa4e66bbbfbb9468768fde123f37f1d03..e3368c677742fe41a016adc40ed7293e3e072dcf 100644
--- a/app/code/Magento/Cron/Setup/InstallSchema.php
+++ b/app/code/Magento/Cron/Setup/InstallSchema.php
@@ -57,7 +57,7 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Created At'
         )->addColumn(
             'scheduled_at',
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/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php
index d4a9815838c9e3d0d68a5795b6875cc034d8eac6..e74309026a57bd6f342c9d09c4276cb64e1857e9 100644
--- a/app/code/Magento/Customer/Setup/InstallSchema.php
+++ b/app/code/Magento/Customer/Setup/InstallSchema.php
@@ -81,13 +81,13 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Created At'
         )->addColumn(
             'updated_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
             'Updated At'
         )->addColumn(
             'is_active',
@@ -123,20 +123,18 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->addForeignKey(
             $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Customer Entity'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity'
          */
@@ -176,13 +174,13 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Created At'
         )->addColumn(
             'updated_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
             'Updated At'
         )->addColumn(
             'is_active',
@@ -204,7 +202,7 @@ class InstallSchema implements InstallSchemaInterface
             'Customer Address Entity'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity_datetime'
          */
@@ -262,7 +260,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -274,7 +271,6 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('customer_address_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -286,13 +282,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Address Entity Datetime'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity_decimal'
          */
@@ -350,7 +345,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -362,7 +356,6 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('customer_address_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -374,13 +367,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Address Entity Decimal'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity_int'
          */
@@ -438,27 +430,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_address_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_address_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Address Entity Int'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity_text'
          */
@@ -513,14 +502,12 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_address_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -532,13 +519,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Address Entity Text'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_address_entity_varchar'
          */
@@ -596,7 +582,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -608,7 +593,6 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('customer_address_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -620,13 +604,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Address Entity Varchar'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_entity_datetime'
          */
@@ -684,27 +667,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Entity Datetime'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_entity_decimal'
          */
@@ -762,27 +742,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Entity Decimal'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_entity_int'
          */
@@ -840,27 +817,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Entity Int'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_entity_text'
          */
@@ -915,27 +889,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Entity Text'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_entity_varchar'
          */
@@ -993,27 +964,24 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'),
             'entity_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Entity Varchar'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_group'
          */
@@ -1041,7 +1009,7 @@ class InstallSchema implements InstallSchemaInterface
             'Customer Group'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_eav_attribute'
          */
@@ -1100,13 +1068,12 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Eav Attribute'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_form_attribute'
          */
@@ -1132,13 +1099,12 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Form Attribute'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_eav_attribute_website'
          */
@@ -1188,20 +1154,18 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Customer Eav Attribute Website'
         );
         $installer->getConnection()->createTable($table);
-        
+
         /**
          * Create table 'customer_visitor'
          */
@@ -1229,8 +1193,8 @@ class InstallSchema implements InstallSchemaInterface
             'Visitor Table'
         );
         $installer->getConnection()->createTable($table);
-        
+
         $installer->endSetup();
-        
+
     }
 }
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/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php
index e6a87de0bc1f10d3d7d8c2b03b881b0a62b90a10..d5edc3e7e86d98eec58a52b36111134615284f64 100644
--- a/app/code/Magento/DesignEditor/Setup/InstallSchema.php
+++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php
@@ -51,7 +51,6 @@ class InstallSchema implements InstallSchemaInterface
             'theme_id',
             $setup->getTable('theme'),
             'theme_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Design Editor Theme Change'
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/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php
index 6d5c1720a2ce7b03dd418fb59139810ca3592116..dc2388e4e0c5606d3fbc3ff45c0a36d97d128da4 100644
--- a/app/code/Magento/Dhl/Model/Carrier.php
+++ b/app/code/Magento/Dhl/Model/Carrier.php
@@ -295,10 +295,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
     /**
      * Collect and get rates
      *
-     * @param RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return bool|Result|null
      */
-    public function collectRates(RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag($this->_activeFlag)) {
             return false;
@@ -1255,10 +1255,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
     /**
      * Processing additional validation to check is carrier applicable.
      *
-     * @param RateRequest $request
-     * @return $this|Error|boolean
+     * @param \Magento\Framework\Object $request
+     * @return $this|\Magento\Framework\Object|boolean
      */
-    public function proccessAdditionalValidation(RateRequest $request)
+    public function proccessAdditionalValidation(\Magento\Framework\Object $request)
     {
         //Skip by item validation if there is no items in request
         if (!count($this->getAllItems($request))) {
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/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php
index e28328894d0223e232d15ec445244cb4bdac5b2b..101ccd3ededc4c46b5f92e2950d0aa1e5abbb537 100644
--- a/app/code/Magento/Directory/Setup/InstallSchema.php
+++ b/app/code/Magento/Directory/Setup/InstallSchema.php
@@ -168,7 +168,6 @@ class InstallSchema implements InstallSchemaInterface
             'region_id',
             $installer->getTable('directory_country_region'),
             'region_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Directory Country Region Name'
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/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php
index 101da102b1418efda65a311856d4cb5ebb9ee6c5..f377662176a55473a8bd1461f7db95c44a440043 100644
--- a/app/code/Magento/Downloadable/Setup/InstallSchema.php
+++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php
@@ -116,7 +116,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Downloadable Link Table');
@@ -164,7 +163,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_id',
                 $installer->getTable('downloadable_link'),
                 'link_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addIndex(
@@ -176,7 +174,6 @@ class InstallSchema implements InstallSchemaInterface
                 'website_id',
                 $installer->getTable('store_website'),
                 'website_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Downloadable Link Price Table');
@@ -219,14 +216,14 @@ class InstallSchema implements InstallSchemaInterface
                 'created_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Date of creation'
             )
             ->addColumn(
                 'updated_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
                 'Date of modification'
             )
             ->addColumn(
@@ -274,16 +271,14 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_id',
                 $installer->getTable('customer_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->addForeignKey(
                 $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'),
                 'order_id',
                 $installer->getTable('sales_order'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Downloadable Link Purchased Table');
         $installer->getConnection()->createTable($table);
@@ -395,14 +390,14 @@ class InstallSchema implements InstallSchemaInterface
                 'created_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Creation Time'
             )
             ->addColumn(
                 'updated_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
                 'Update Time'
             )
             ->addIndex(
@@ -427,7 +422,6 @@ class InstallSchema implements InstallSchemaInterface
                 'purchased_id',
                 $installer->getTable('downloadable_link_purchased'),
                 'purchased_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -440,8 +434,7 @@ class InstallSchema implements InstallSchemaInterface
                 'order_item_id',
                 $installer->getTable('sales_order_item'),
                 'item_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Downloadable Link Purchased Item Table');
         $installer->getConnection()->createTable($table);
@@ -493,7 +486,6 @@ class InstallSchema implements InstallSchemaInterface
                 'link_id',
                 $installer->getTable('downloadable_link'),
                 'link_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addIndex(
@@ -505,7 +497,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Link Title Table');
@@ -567,7 +558,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Downloadable Sample Table');
@@ -620,7 +610,6 @@ class InstallSchema implements InstallSchemaInterface
                 'sample_id',
                 $installer->getTable('downloadable_sample'),
                 'sample_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addIndex(
@@ -632,7 +621,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Downloadable Sample Title Table');
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/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php
index 9fb0d559cce5b8af7a54bfca2f6f7ecbb854e1a0..24c041c7e2c05bd1365bfb0166cae0f253d3c0c5 100644
--- a/app/code/Magento/Eav/Setup/InstallSchema.php
+++ b/app/code/Magento/Eav/Setup/InstallSchema.php
@@ -179,13 +179,13 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Created At'
         )->addColumn(
             'updated_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
             'Updated At'
         )->addColumn(
             'is_active',
@@ -204,14 +204,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity'
@@ -281,21 +279,18 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('eav_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Value Prefix'
@@ -365,21 +360,18 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('eav_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Value Prefix'
@@ -449,21 +441,18 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('eav_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Value Prefix'
@@ -533,21 +522,18 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('eav_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Value Prefix'
@@ -617,21 +603,18 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('eav_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id'),
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Value Prefix'
@@ -758,7 +741,6 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute'
@@ -811,14 +793,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Store'
@@ -870,7 +850,6 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute Set'
@@ -940,7 +919,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_set_id',
             $installer->getTable('eav_attribute_set'),
             'attribute_set_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute Group'
@@ -1015,7 +993,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -1027,7 +1004,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_group_id',
             $installer->getTable('eav_attribute_group'),
             'attribute_group_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Entity Attributes'
@@ -1065,7 +1041,6 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute Option'
@@ -1112,14 +1087,12 @@ class InstallSchema implements InstallSchemaInterface
             'option_id',
             $installer->getTable('eav_attribute_option'),
             'option_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute Option Value'
@@ -1166,14 +1139,12 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Attribute Label'
@@ -1237,7 +1208,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Form Type'
@@ -1269,14 +1239,12 @@ class InstallSchema implements InstallSchemaInterface
             'entity_type_id',
             $installer->getTable('eav_entity_type'),
             'entity_type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'),
             'type_id',
             $installer->getTable('eav_form_type'),
             'type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Form Type Entity'
@@ -1325,7 +1293,6 @@ class InstallSchema implements InstallSchemaInterface
             'type_id',
             $installer->getTable('eav_form_type'),
             'type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Form Fieldset'
@@ -1363,14 +1330,12 @@ class InstallSchema implements InstallSchemaInterface
             'fieldset_id',
             $installer->getTable('eav_form_fieldset'),
             'fieldset_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Form Fieldset Label'
@@ -1431,21 +1396,18 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'),
             'fieldset_id',
             $installer->getTable('eav_form_fieldset'),
             'fieldset_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->addForeignKey(
             $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'),
             'type_id',
             $installer->getTable('eav_form_type'),
             'type_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Eav Form Element'
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/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php
index 51ac852ac050d79893f68a4dc7a1d4fc47da9ad8..66f266dd1a8450611cba7a72e55e406a135e6caa 100644
--- a/app/code/Magento/Fedex/Model/Carrier.php
+++ b/app/code/Magento/Fedex/Model/Carrier.php
@@ -236,10 +236,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C
     /**
      * Collect and get rates
      *
-     * @param RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return Result|bool|null
      */
-    public function collectRates(RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag($this->_activeFlag)) {
             return false;
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/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php
index a43eb599a8d722bbfafe95504703ee86c22c7ca8..e15c6b957e2231a9f9506f923c1f94d3b2c0dad9 100644
--- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php
+++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php
@@ -78,7 +78,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Google Experiment code');
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/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php
index f3522a162f2fcb8776620150433a18c16cc09395..9588da6905210f53b0c47aaecc05c1f483d30107 100644
--- a/app/code/Magento/Integration/Setup/InstallSchema.php
+++ b/app/code/Magento/Integration/Setup/InstallSchema.php
@@ -211,21 +211,18 @@ class InstallSchema implements InstallSchemaInterface
             'admin_id',
             $adminTable,
             'user_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'),
             'consumer_id',
             $installer->getTable('oauth_consumer'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'),
             'customer_id',
             $customerTable,
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'OAuth Tokens'
@@ -268,7 +265,6 @@ class InstallSchema implements InstallSchemaInterface
             'consumer_id',
             $installer->getTable('oauth_consumer'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'OAuth Nonce'
@@ -320,13 +316,13 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Creation Time'
         )->addColumn(
             'updated_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE],
             'Update Time'
         )->addColumn(
             'setup_type',
@@ -361,7 +357,6 @@ class InstallSchema implements InstallSchemaInterface
             'consumer_id',
             $installer->getTable('oauth_consumer'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         );
 
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/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php
index 1cf4f0832bf5032958659da8bc0b55f24b244371..372d41188ca9e537430493c40e5342e5e89fadbf 100644
--- a/app/code/Magento/Log/Setup/InstallSchema.php
+++ b/app/code/Magento/Log/Setup/InstallSchema.php
@@ -95,7 +95,7 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Creation Time'
         )->addColumn(
             'deleted_at',
@@ -147,7 +147,7 @@ class InstallSchema implements InstallSchemaInterface
             'add_date',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Date'
         )->setComment(
             'Log Summary Table'
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/Model/Resource/File/Storage/Database.php b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php
index 6c77da1c9f7f4a7bd05d6f74ca3d476d20b03041..1d1c0c7224c383dd59a48ee93e017b7eaf9b80d8 100644
--- a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php
+++ b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php
@@ -109,7 +109,6 @@ class Database extends \Magento\MediaStorage\Model\Resource\File\Storage\Abstrac
             'directory_id',
             $dirStorageTable,
             'directory_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'File Storage'
diff --git a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php
index 8291cd225711713be1671f237f6cd42998ddb55f..0ea6567f6404adc0630b0a132af105a0c1985bd5 100644
--- a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php
+++ b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php
@@ -81,7 +81,6 @@ class Database extends \Magento\MediaStorage\Model\Resource\File\Storage\Abstrac
             'parent_id',
             $table,
             'directory_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Directory Storage'
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/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php
index 87ad2e8adcca1e752c396dccefc41423777758bd..f567558d0550f4ad4987a2b13d3418093c147c7c 100644
--- a/app/code/Magento/Newsletter/Setup/InstallSchema.php
+++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php
@@ -92,8 +92,7 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Newsletter Subscriber');
         $installer->getConnection()->createTable($table);
@@ -293,7 +292,6 @@ class InstallSchema implements InstallSchemaInterface
                 'template_id',
                 $installer->getTable('newsletter_template'),
                 'template_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Newsletter Queue');
@@ -345,7 +343,6 @@ class InstallSchema implements InstallSchemaInterface
                 'queue_id',
                 $installer->getTable('newsletter_queue'),
                 'queue_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -358,7 +355,6 @@ class InstallSchema implements InstallSchemaInterface
                 'subscriber_id',
                 $installer->getTable('newsletter_subscriber'),
                 'subscriber_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Newsletter Queue Link');
@@ -392,7 +388,6 @@ class InstallSchema implements InstallSchemaInterface
                 'queue_id',
                 $installer->getTable('newsletter_queue'),
                 'queue_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -400,7 +395,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Newsletter Queue Store Link');
@@ -459,7 +453,6 @@ class InstallSchema implements InstallSchemaInterface
                 'queue_id',
                 $installer->getTable('newsletter_queue'),
                 'queue_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -467,7 +460,6 @@ class InstallSchema implements InstallSchemaInterface
                 'subscriber_id',
                 $installer->getTable('newsletter_subscriber'),
                 'subscriber_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Newsletter Problems');
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/Flatrate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php
index ff96421b77034d67dc4cf1cb6ab6c4d83077d3ad..d85a0d771d2fb3a8602b779c84ca27c9204efccf 100644
--- a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php
+++ b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php
@@ -55,12 +55,12 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement
     }
 
     /**
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return Result|bool
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag('active')) {
             return false;
diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php
index 0586b180b8832ae34b16ca6267c77dab93df82e4..fdbc3c264671dfe4714d0f003a48d54efcba85dc 100644
--- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php
+++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php
@@ -58,10 +58,10 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple
     /**
      * FreeShipping Rates Collector
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return \Magento\Shipping\Model\Rate\Result|bool
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag('active')) {
             return false;
diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php
index e1411217d1d5d1b96dae3cfd82ee4ba78047b4b1..40df2042c043dbb3782b0d3e6b8f3d6a1d304734 100644
--- a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php
+++ b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php
@@ -50,11 +50,11 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
     }
 
     /**
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return \Magento\Shipping\Model\Rate\Result
      * @SuppressWarnings(PHPMD.UnusedLocalVariable)
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag('active')) {
             return false;
diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php
index 4456feee0578c38c56347f4ec2f474d5d5d765fa..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
 {
@@ -72,13 +74,13 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen
     }
 
     /**
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return \Magento\Shipping\Model\Rate\Result
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      * @SuppressWarnings(PHPMD.NPathComplexity)
      * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag('active')) {
             return false;
@@ -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/Model/Cart.php b/app/code/Magento/Payment/Model/Cart.php
index 85962afa760aac013aa161f98e21225336030a10..436bdc899a48d198278823bd4ec1c381384d6447 100644
--- a/app/code/Magento/Payment/Model/Cart.php
+++ b/app/code/Magento/Payment/Model/Cart.php
@@ -75,7 +75,7 @@ class Cart
     /**
      * @param \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory
      * @param \Magento\Framework\Event\ManagerInterface $eventManager
-     * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel
+     * @param \Magento\Quote\Api\Data\CartInterface $salesModel
      */
     public function __construct(
         \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory,
@@ -91,6 +91,7 @@ class Cart
      * Return payment cart sales model
      *
      * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface
+     * @api
      */
     public function getSalesModel()
     {
@@ -102,6 +103,7 @@ class Cart
      *
      * @param float $taxAmount
      * @return void
+     * @api
      */
     public function addTax($taxAmount)
     {
@@ -113,6 +115,7 @@ class Cart
      *
      * @param float $taxAmount
      * @return void
+     * @api
      */
     public function setTax($taxAmount)
     {
@@ -123,6 +126,7 @@ class Cart
      * Get tax amount
      *
      * @return float
+     * @api
      */
     public function getTax()
     {
@@ -134,6 +138,7 @@ class Cart
      *
      * @param float $discountAmount
      * @return void
+     * @api
      */
     public function addDiscount($discountAmount)
     {
@@ -145,6 +150,7 @@ class Cart
      *
      * @param float $discountAmount
      * @return void
+     * @api
      */
     public function setDiscount($discountAmount)
     {
@@ -155,6 +161,7 @@ class Cart
      * Get discount amount
      *
      * @return float
+     * @api
      */
     public function getDiscount()
     {
@@ -166,6 +173,7 @@ class Cart
      *
      * @param float $shippingAmount
      * @return void
+     * @api
      */
     public function addShipping($shippingAmount)
     {
@@ -177,6 +185,7 @@ class Cart
      *
      * @param float $shippingAmount
      * @return void
+     * @api
      */
     public function setShipping($shippingAmount)
     {
@@ -187,6 +196,7 @@ class Cart
      * Get shipping amount
      *
      * @return float
+     * @api
      */
     public function getShipping()
     {
@@ -198,6 +208,7 @@ class Cart
      *
      * @param float $subtotalAmount
      * @return void
+     * @api
      */
     public function addSubtotal($subtotalAmount)
     {
@@ -208,6 +219,7 @@ class Cart
      * Get subtotal amount
      *
      * @return float
+     * @api
      */
     public function getSubtotal()
     {
@@ -222,6 +234,7 @@ class Cart
      * @param float $amount
      * @param string|null $identifier
      * @return void
+     * @api
      */
     public function addCustomItem($name, $qty, $amount, $identifier = null)
     {
@@ -232,6 +245,7 @@ class Cart
      * Get all cart items
      *
      * @return array
+     * @api
      */
     public function getAllItems()
     {
@@ -243,6 +257,7 @@ class Cart
      * Get shipping, tax, subtotal and discount amounts all together
      *
      * @return array
+     * @api
      */
     public function getAmounts()
     {
@@ -255,6 +270,7 @@ class Cart
      * Specify that shipping should be transferred as cart item
      *
      * @return void
+     * @api
      */
     public function setTransferShippingAsItem()
     {
@@ -265,6 +281,7 @@ class Cart
      * Specify that discount should be transferred as cart item
      *
      * @return void
+     * @api
      */
     public function setTransferDiscountAsItem()
     {
diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php
index 186a6fc45f5c8dc0ffe77e8f31aa54476da796ba..f077e1a72f1870943e626cbcc0dc41c1062c9ac6 100644
--- a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php
+++ b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php
@@ -26,7 +26,7 @@ class Factory
     /**
      * Wrap sales model with Magento\Payment\Model\Cart\SalesModel\SalesModelInterface
      *
-     * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel
+     * @param \Magento\Quote\Api\Data\CartInterface $salesModel
      * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface
      * @throws \InvalidArgumentException
      */
diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php
index 117eb8b1d48e2ba5fd61cf5c504e67f6730c7003..a210f55bb3a2b3f7cb6a7d75d92377bac6070b17 100644
--- a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php
+++ b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php
@@ -14,26 +14,31 @@ interface SalesModelInterface
      * Get all items from shopping sales model
      *
      * @return array
+     * @api
      */
     public function getAllItems();
 
     /**
      * @return float|null
+     * @api
      */
     public function getBaseSubtotal();
 
     /**
      * @return float|null
+     * @api
      */
     public function getBaseTaxAmount();
 
     /**
      * @return float|null
+     * @api
      */
     public function getBaseShippingAmount();
 
     /**
      * @return float|null
+     * @api
      */
     public function getBaseDiscountAmount();
 
@@ -43,13 +48,15 @@ interface SalesModelInterface
      * @param string $key
      * @param mixed $args
      * @return mixed
+     * @api
      */
     public function getDataUsingMethod($key, $args = null);
 
     /**
      * Return object that contains tax related fields
      *
-     * @return \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote\Address
+     * @return \Magento\Sales\Api\Data\OrderInterface|\Magento\Quote\Api\Data\AddressInterface
+     * @api
      */
     public function getTaxContainer();
 }
diff --git a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php
index d2bb13d0eda1823369883e738efa3888c7507b65..9d2ad43801e5ebda0834b4c4adff7019e4631b65 100644
--- a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php
+++ b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php
@@ -14,6 +14,7 @@ interface PaymentMethodChecksInterface
      * Retrieve payment method code
      *
      * @return string
+     * @api
      */
     public function getCode();
 
@@ -22,6 +23,7 @@ interface PaymentMethodChecksInterface
      * Can be used in admin
      *
      * @return bool
+     * @api
      */
     public function canUseInternal();
 
@@ -29,6 +31,7 @@ interface PaymentMethodChecksInterface
      * Can be used in regular checkout
      *
      * @return bool
+     * @api
      */
     public function canUseCheckout();
 
@@ -37,6 +40,7 @@ interface PaymentMethodChecksInterface
      *
      * @param string $country
      * @return bool
+     * @api
      */
     public function canUseForCountry($country);
 
@@ -45,6 +49,7 @@ interface PaymentMethodChecksInterface
      *
      * @param string $currencyCode
      * @return bool
+     * @api
      */
     public function canUseForCurrency($currencyCode);
 
@@ -55,6 +60,7 @@ interface PaymentMethodChecksInterface
      * @param int|string|null|\Magento\Store\Model\Store $storeId
      *
      * @return mixed
+     * @api
      */
     public function getConfigData($field, $storeId = null);
 }
diff --git a/app/code/Magento/Payment/Model/Config.php b/app/code/Magento/Payment/Model/Config.php
index 62a196bfce79f0b267fea1af1edc2cbf5dd35097..9d782ce97998d70e2a78f63ecd92a51fa7a1a2ed 100644
--- a/app/code/Magento/Payment/Model/Config.php
+++ b/app/code/Magento/Payment/Model/Config.php
@@ -86,6 +86,7 @@ class Config
      * Retrieve active system payments
      *
      * @return array
+     * @api
      */
     public function getActiveMethods()
     {
@@ -107,6 +108,7 @@ class Config
      * Get list of credit card types
      *
      * @return array
+     * @api
      */
     public function getCcTypes()
     {
@@ -117,6 +119,7 @@ class Config
      * Retrieve array of payment methods information
      *
      * @return array
+     * @api
      */
     public function getMethodsInfo()
     {
@@ -127,6 +130,7 @@ class Config
      * Get payment groups
      *
      * @return array
+     * @api
      */
     public function getGroups()
     {
@@ -137,6 +141,7 @@ class Config
      * Retrieve list of months translation
      *
      * @return array
+     * @api
      */
     public function getMonths()
     {
@@ -155,6 +160,7 @@ class Config
      * Retrieve array of available years
      *
      * @return array
+     * @api
      */
     public function getYears()
     {
diff --git a/app/code/Magento/Payment/Model/InfoInterface.php b/app/code/Magento/Payment/Model/InfoInterface.php
index 270ee9c16fe89c98208ec2f8ac1cde356adae12b..b39670441cf23d5fd320c6faf98f421ee39b5321 100644
--- a/app/code/Magento/Payment/Model/InfoInterface.php
+++ b/app/code/Magento/Payment/Model/InfoInterface.php
@@ -16,6 +16,7 @@ interface InfoInterface
      *
      * @param string $data
      * @return string
+     * @api
      */
     public function encrypt($data);
 
@@ -24,6 +25,7 @@ interface InfoInterface
      *
      * @param string $data
      * @return string
+     * @api
      */
     public function decrypt($data);
 
@@ -33,6 +35,7 @@ interface InfoInterface
      * @param string $key
      * @param string|null $value
      * @return mixed
+     * @api
      */
     public function setAdditionalInformation($key, $value = null);
 
@@ -41,6 +44,7 @@ interface InfoInterface
      *
      * @param mixed|null $key
      * @return bool
+     * @api
      */
     public function hasAdditionalInformation($key = null);
 
@@ -49,6 +53,7 @@ interface InfoInterface
      *
      * @param string|null $key
      * @return $this
+     * @api
      */
     public function unsAdditionalInformation($key = null);
 
@@ -57,6 +62,7 @@ interface InfoInterface
      *
      * @param string|null $key
      * @return mixed
+     * @api
      */
     public function getAdditionalInformation($key = null);
 
@@ -65,6 +71,7 @@ interface InfoInterface
      *
      * @return \Magento\Payment\Model\MethodInterface
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function getMethodInstance();
 }
diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php
index 74e26082b6c0b7525c47b07c57f5c6cf08bc263d..e316982a1be7081f470bc8cb2493d19ea0debfea 100644
--- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php
+++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php
@@ -260,6 +260,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check order availability
      *
      * @return bool
+     * @api
      */
     public function canOrder()
     {
@@ -270,6 +271,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check authorize availability
      *
      * @return bool
+     * @api
      */
     public function canAuthorize()
     {
@@ -280,6 +282,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check capture availability
      *
      * @return bool
+     * @api
      */
     public function canCapture()
     {
@@ -290,6 +293,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check partial capture availability
      *
      * @return bool
+     * @api
      */
     public function canCapturePartial()
     {
@@ -300,6 +304,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check whether capture can be performed once and no further capture possible
      *
      * @return bool
+     * @api
      */
     public function canCaptureOnce()
     {
@@ -310,6 +315,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check refund availability
      *
      * @return bool
+     * @api
      */
     public function canRefund()
     {
@@ -320,6 +326,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check partial refund availability for invoice
      *
      * @return bool
+     * @api
      */
     public function canRefundPartialPerInvoice()
     {
@@ -332,6 +339,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param   \Magento\Framework\Object $payment
      * @return  bool
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function canVoid(\Magento\Framework\Object $payment)
     {
@@ -363,6 +371,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Can be edit order (renew order)
      *
      * @return bool
+     * @api
      */
     public function canEdit()
     {
@@ -373,6 +382,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Check fetch transaction info availability
      *
      * @return bool
+     * @api
      */
     public function canFetchTransactionInfo()
     {
@@ -386,6 +396,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param string $transactionId
      * @return array
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId)
     {
@@ -396,6 +407,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Retrieve payment system relation flag
      *
      * @return bool
+     * @api
      */
     public function isGateway()
     {
@@ -406,6 +418,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Retrieve payment method online/offline flag
      *
      * @return bool
+     * @api
      */
     public function isOffline()
     {
@@ -416,6 +429,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Flag if we need to run payment initialize while order place
      *
      * @return bool
+     * @api
      */
     public function isInitializeNeeded()
     {
@@ -482,6 +496,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Retrieve block type for display method information
      *
      * @return string
+     * @api
      */
     public function getInfoBlockType()
     {
@@ -491,8 +506,9 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
     /**
      * Retrieve payment information model object
      *
-     * @return \Magento\Payment\Model\Info
+     * @return \Magento\Payment\Model\InfoInterface
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function getInfoInstance()
     {
@@ -508,6 +524,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function validate()
     {
@@ -537,6 +554,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function order(\Magento\Framework\Object $payment, $amount)
     {
@@ -555,6 +573,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function authorize(\Magento\Framework\Object $payment, $amount)
     {
@@ -573,6 +592,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function capture(\Magento\Framework\Object $payment, $amount)
     {
@@ -591,6 +611,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param Invoice $invoice
      * @param Payment $payment
      * @return $this
+     * @api
      */
     public function processInvoice($invoice, $payment)
     {
@@ -606,6 +627,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param Invoice $invoice
      * @param Payment $payment
      * @return $this
+     * @api
      */
     public function processBeforeRefund($invoice, $payment)
     {
@@ -621,6 +643,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function refund(\Magento\Framework\Object $payment, $amount)
     {
@@ -635,6 +658,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo
      * @param Payment $payment
      * @return $this
+     * @api
      */
     public function processCreditmemo($creditmemo, $payment)
     {
@@ -649,6 +673,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @return $this
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function cancel(\Magento\Framework\Object $payment)
     {
@@ -661,6 +686,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param \Magento\Framework\Object $payment
      * @return $this
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function void(\Magento\Framework\Object $payment)
     {
@@ -676,6 +702,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param \Magento\Payment\Model\InfoInterface $payment
      * @return bool
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function canReviewPayment(\Magento\Payment\Model\InfoInterface $payment)
     {
@@ -688,6 +715,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param \Magento\Payment\Model\InfoInterface $payment
      * @return false
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment)
     {
@@ -703,6 +731,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * @param \Magento\Payment\Model\InfoInterface $payment
      * @return false
      * @throws \Magento\Framework\Exception\LocalizedException
+     * @api
      */
     public function denyPayment(\Magento\Payment\Model\InfoInterface $payment)
     {
@@ -744,6 +773,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @param array|\Magento\Framework\Object $data
      * @return $this
+     * @api
      */
     public function assignData($data)
     {
@@ -759,6 +789,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Prepare info instance for save
      *
      * @return $this
+     * @api
      */
     public function prepareSave()
     {
@@ -768,9 +799,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
     /**
      * Check whether payment method can be used
      *
-     * TODO: payment method instance is not supposed to know about quote
-     *
-     * @param \Magento\Quote\Model\Quote|null $quote
+     * @param \Magento\Quote\Api\Data\CartInterface|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
@@ -797,6 +826,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @return $this
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function initialize($paymentAction, $stateObject)
     {
@@ -808,6 +838,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      * Used to universalize payment actions when processing payment place
      *
      * @return string
+     * @api
      */
     public function getConfigPaymentAction()
     {
@@ -832,6 +863,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @return bool
      * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+     * @api
      */
     public function getDebugFlag()
     {
@@ -843,6 +875,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl
      *
      * @param mixed $debugData
      * @return void
+     * @api
      */
     public function debugData($debugData)
     {
diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php
index 167f88c7e9fca09662aaad2148ed7c3599c210f9..978e75c5840aaeae528aad5111f93b3c77fc75c5 100644
--- a/app/code/Magento/Payment/Model/Method/Cc.php
+++ b/app/code/Magento/Payment/Model/Method/Cc.php
@@ -250,6 +250,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * @return bool
+     * @api
      */
     public function hasVerification()
     {
@@ -262,6 +263,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
 
     /**
      * @return array
+     * @api
      */
     public function getVerificationRegEx()
     {
@@ -298,6 +300,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * @param string $type
      * @return bool
+     * @api
      */
     public function otherCcType($type)
     {
@@ -309,6 +312,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
      *
      * @param   string $ccNumber
      * @return  bool
+     * @api
      */
     public function validateCcNum($ccNumber)
     {
@@ -348,6 +352,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
      *
      * @param string $ccNumber
      * @return bool
+     * @api
      */
     public function validateCcNumOther($ccNumber)
     {
@@ -357,7 +362,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod
     /**
      * Check whether there are CC types set in configuration
      *
-     * @param \Magento\Quote\Model\Quote|null $quote
+     * @param \Magento\Quote\Api\Data\CartInterface|null $quote
      * @return bool
      */
     public function isAvailable($quote = null)
diff --git a/app/code/Magento/Payment/Model/MethodInterface.php b/app/code/Magento/Payment/Model/MethodInterface.php
index 0e6c1da86887622a33d98efeb2df06b65e14741b..f800703d73e3cf04cbbd8294c70262e5fb60ae0a 100644
--- a/app/code/Magento/Payment/Model/MethodInterface.php
+++ b/app/code/Magento/Payment/Model/MethodInterface.php
@@ -15,6 +15,7 @@ interface MethodInterface
      * Retrieve payment method code
      *
      * @return string
+     * @api
      */
     public function getCode();
 
@@ -22,6 +23,7 @@ interface MethodInterface
      * Retrieve block type for method form generation
      *
      * @return string
+     * @api
      */
     public function getFormBlockType();
 
@@ -29,6 +31,7 @@ interface MethodInterface
      * Retrieve payment method title
      *
      * @return string
+     * @api
      */
     public function getTitle();
 }
diff --git a/app/code/Magento/Payment/Model/MethodList.php b/app/code/Magento/Payment/Model/MethodList.php
index 8ba8a76d77acc33da2bb8e9c2f1423776ed76313..5d486411b9f7a8d63139579ff76d55d13e26ccb8 100644
--- a/app/code/Magento/Payment/Model/MethodList.php
+++ b/app/code/Magento/Payment/Model/MethodList.php
@@ -33,10 +33,11 @@ class MethodList
     }
 
     /**
-     * @param \Magento\Quote\Model\Quote $quote
+     * @param \Magento\Quote\Api\Data\CartInterface $quote
      * @return \Magento\Payment\Model\MethodInterface[]
+     * @api
      */
-    public function getAvailableMethods(\Magento\Quote\Model\Quote $quote = null)
+    public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
     {
         $store = $quote ? $quote->getStoreId() : null;
         $methods = [];
@@ -54,10 +55,10 @@ class MethodList
      * Check payment method model
      *
      * @param \Magento\Payment\Model\MethodInterface $method
-     * @param \Magento\Quote\Model\Quote $quote
+     * @param \Magento\Quote\Api\Data\CartInterface $quote
      * @return bool
      */
-    protected function _canUseMethod($method, \Magento\Quote\Model\Quote $quote)
+    protected function _canUseMethod($method, \Magento\Quote\Api\Data\CartInterface $quote)
     {
         return $this->methodSpecificationFactory->create(
             [
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/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php
index 6b8e6b732f368e00e1b40579d23956c81578dc06..9926f11ef1196ec4729cdb8c68a56c64ab5be4e5 100644
--- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php
+++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php
@@ -63,7 +63,7 @@ class InstallSchema implements InstallSchemaInterface
             'add_date',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Product alert add date'
         )->addColumn(
             'last_send_date',
@@ -97,21 +97,18 @@ class InstallSchema implements InstallSchemaInterface
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'),
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Product Alert Price'
@@ -151,7 +148,7 @@ class InstallSchema implements InstallSchemaInterface
             'add_date',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Product alert add date'
         )->addColumn(
             'send_date',
@@ -185,21 +182,18 @@ class InstallSchema implements InstallSchemaInterface
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'),
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'),
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Product Alert Stock'
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/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php
index 1d663cfd5d942c84d88a63f9161cdc9773f2c4aa..88010642002f69ba6d36ff56c882fd2f96076ccd 100644
--- a/app/code/Magento/Quote/Model/Quote.php
+++ b/app/code/Magento/Quote/Model/Quote.php
@@ -2253,12 +2253,6 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C
     {
         if (!$this->getReservedOrderId()) {
             $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this));
-        } else {
-            //checking if reserved order id was already used for some order
-            //if yes reserving new one if not using old one
-            if ($this->_getResource()->isOrderIncrementIdUsed($this->getReservedOrderId())) {
-                $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this));
-            }
         }
         return $this;
     }
diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php
index c57a8d0d5e8163661cdb1e240d60924801c3e5bb..4cddfa347659b75a2930348d1fb19cf54bf3226c 100644
--- a/app/code/Magento/Quote/Model/Quote/Address.php
+++ b/app/code/Magento/Quote/Model/Quote/Address.php
@@ -248,7 +248,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements
      * @param \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory
      * @param Address\TotalFactory $addressTotalFactory
      * @param \Magento\Framework\Object\Copy $objectCopyService
-     * @param Address\CarrierFactoryInterface $carrierFactory
+     * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory
      * @param Address\Validator $validator
      * @param \Magento\Customer\Model\Address\Mapper $addressMapper
      * @param \Magento\Framework\Model\Resource\AbstractResource $resource
@@ -280,7 +280,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements
         \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory,
         \Magento\Quote\Model\Quote\Address\TotalFactory $addressTotalFactory,
         \Magento\Framework\Object\Copy $objectCopyService,
-        \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory,
+        \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory,
         Address\Validator $validator,
         \Magento\Customer\Model\Address\Mapper $addressMapper,
         \Magento\Framework\Model\Resource\AbstractResource $resource = null,
diff --git a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php
index 6f58b342a667a7b0a56dee8e649007f5710ddfba..3b4649c44736fce125edcde2e664247dd5a22411 100644
--- a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php
+++ b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php
@@ -75,7 +75,8 @@ class ToOrder
             '\Magento\Sales\Api\Data\OrderInterface'
         );
         $order->setStoreId($object->getQuote()->getStoreId())
-            ->setQuoteId($object->getQuote()->getId());
+            ->setQuoteId($object->getQuote()->getId())
+            ->setIncrementId($object->getQuote()->getReservedOrderId());
 
         $this->objectCopyService->copyFieldsetToTarget('sales_convert_quote', 'to_order', $object->getQuote(), $order);
         $this->eventManager->dispatch(
diff --git a/app/code/Magento/Quote/Model/Resource/Quote.php b/app/code/Magento/Quote/Model/Resource/Quote.php
index 4483f59150e89ab68d768e1971b2507ce8461194..990902300124466ee9cdc4a3437425e9f5841156 100644
--- a/app/code/Magento/Quote/Model/Resource/Quote.php
+++ b/app/code/Magento/Quote/Model/Resource/Quote.php
@@ -16,22 +16,22 @@ use Magento\Framework\Model\Resource\Db\AbstractDb;
 class Quote extends AbstractDb
 {
     /**
-     * @var \Magento\Eav\Model\Config
+     * @var \Magento\SalesSequence\Model\Manager
      */
-    protected $_config;
+    protected $sequenceManager;
 
     /**
      * @param \Magento\Framework\Model\Resource\Db\Context $context
-     * @param \Magento\Eav\Model\Config $config
-     * @param string|null $resourcePrefix
+     * @param \Magento\SalesSequence\Model\Manager $sequenceManager
+     * @param null $resourcePrefix
      */
     public function __construct(
         \Magento\Framework\Model\Resource\Db\Context $context,
-        \Magento\Eav\Model\Config $config,
+        \Magento\SalesSequence\Model\Manager $sequenceManager,
         $resourcePrefix = null
     ) {
         parent::__construct($context, $resourcePrefix);
-        $this->_config = $config;
+        $this->sequenceManager = $sequenceManager;
     }
 
     /**
@@ -156,28 +156,8 @@ class Quote extends AbstractDb
      */
     public function getReservedOrderId($quote)
     {
-        $storeId = (int)$quote->getStoreId();
-        return $this->_config->getEntityType(\Magento\Sales\Model\Order::ENTITY)->fetchNewIncrementId($storeId);
-    }
-
-    /**
-     * Check is order increment id use in sales/order table
-     *
-     * @param int $orderIncrementId
-     * @return bool
-     */
-    public function isOrderIncrementIdUsed($orderIncrementId)
-    {
-        $adapter = $this->_getReadAdapter();
-        $bind = [':increment_id' => $orderIncrementId];
-        $select = $adapter->select();
-        $select->from($this->getTable('sales_order'), 'entity_id')->where('increment_id = :increment_id');
-        $entity_id = $adapter->fetchOne($select, $bind);
-        if ($entity_id > 0) {
-            return true;
-        }
-
-        return false;
+        return $this->sequenceManager->getSequence(\Magento\Sales\Model\Order::ENTITY, (int)$quote->getStoreId())
+            ->getNextValue();
     }
 
     /**
diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php
index 6801bb83f5e43e43ad241ac5fed14dae285e9302..f21945483c6873facccac4eb9efeebe611ba723c 100644
--- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php
+++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php
@@ -24,7 +24,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
      * @param \Psr\Log\LoggerInterface $logger
      * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
      * @param \Magento\Framework\Event\ManagerInterface $eventManager
-     * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory
+     * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory
      * @param \Zend_Db_Adapter_Abstract $connection
      * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource
      */
@@ -33,7 +33,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
         \Psr\Log\LoggerInterface $logger,
         \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
         \Magento\Framework\Event\ManagerInterface $eventManager,
-        \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory,
+        \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory,
         $connection = null,
         \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null
     ) {
diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php
index 3ae1f3354306299aee448da17020eb4ff69654b7..905cfba56782664a89b0d33b722e9e43828e7319 100644
--- a/app/code/Magento/Quote/Setup/InstallSchema.php
+++ b/app/code/Magento/Quote/Setup/InstallSchema.php
@@ -334,7 +334,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote'
@@ -684,7 +683,6 @@ class InstallSchema implements InstallSchemaInterface
             'quote_id',
             $installer->getTable('quote'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote Address'
@@ -965,29 +963,25 @@ class InstallSchema implements InstallSchemaInterface
             'parent_item_id',
             $installer->getTable('quote_item'),
             'item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'),
             'quote_id',
             $installer->getTable('quote'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Quote Item'
         );
@@ -1245,7 +1239,6 @@ class InstallSchema implements InstallSchemaInterface
             'quote_address_id',
             $installer->getTable('quote_address'),
             'address_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -1257,14 +1250,12 @@ class InstallSchema implements InstallSchemaInterface
             'parent_item_id',
             $installer->getTable('quote_address_item'),
             'address_item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'),
             'quote_item_id',
             $installer->getTable('quote_item'),
             'item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote Address Item'
@@ -1314,7 +1305,6 @@ class InstallSchema implements InstallSchemaInterface
             'item_id',
             $installer->getTable('quote_item'),
             'item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote Item Option'
@@ -1448,7 +1438,6 @@ class InstallSchema implements InstallSchemaInterface
             'quote_id',
             $installer->getTable('quote'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote Payment'
@@ -1540,7 +1529,6 @@ class InstallSchema implements InstallSchemaInterface
             'address_id',
             $installer->getTable('quote_address'),
             'address_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Quote Shipping Rate'
diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php
index 8dea99e3bed4cc480d50780aff182647a8d95a37..0859ec68fe7bde8d106915f6a98a7c013813872b 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php
@@ -84,7 +84,7 @@ class ToOrderTest extends \PHPUnit_Framework_TestCase
 
         $object = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false);
         $quote = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false);
-        $object->expects($this->exactly(4))->method('getQuote')->willReturn($quote);
+        $object->expects($this->exactly(5))->method('getQuote')->willReturn($quote);
         $quote->expects($this->once())->method('getId')->willReturn($quoteId);
         $quote->expects($this->once())->method('getStoreId')->willReturn($storeId);
         $this->objectCopyMock->expects($this->once())->method('getDataFromFieldset')->with(
diff --git a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php
deleted file mode 100644
index 33885a47c6bb30365fdff0b0ca2ed287dc4a2bf8..0000000000000000000000000000000000000000
--- a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Quote\Test\Unit\Model\Resource;
-
-class QuoteTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Quote\Model\Resource\Quote
-     */
-    protected $model;
-
-    /**
-     * @var \Magento\Framework\App\Resource
-     */
-    protected $resourceMock;
-
-    /**
-     * @var \Magento\Eav\Model\Config
-     */
-    protected $configMock;
-
-    /**
-     * @var \Magento\Framework\DB\Adapter\Pdo\Mysql
-     */
-    protected $adapterMock;
-
-    /**
-     * @var \Magento\Framework\DB\Select
-     */
-    protected $selectMock;
-
-    protected function setUp()
-    {
-        $this->selectMock = $this->getMock('\Magento\Framework\DB\Select', [], [], '', false);
-        $this->selectMock->expects($this->any())->method('from')->will($this->returnSelf());
-        $this->selectMock->expects($this->any())->method('where');
-
-        $this->adapterMock = $this->getMock('\Magento\Framework\DB\Adapter\Pdo\Mysql', [], [], '', false);
-        $this->adapterMock->expects($this->any())->method('select')->will($this->returnValue($this->selectMock));
-
-        $this->resourceMock = $this->getMock('\Magento\Framework\App\Resource', [], [], '', false);
-        $this->resourceMock->expects(
-            $this->any()
-        )->method(
-            'getConnection'
-        )->will(
-            $this->returnValue($this->adapterMock)
-        );
-
-        $this->configMock = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false);
-
-        $contextMock = $this->getMock('\Magento\Framework\Model\Resource\Db\Context', [], [], '', false);
-        $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock);
-
-        $this->model = new \Magento\Quote\Model\Resource\Quote(
-            $contextMock,
-            $this->configMock
-        );
-    }
-
-    /**
-     * @param $value
-     * @dataProvider isOrderIncrementIdUsedDataProvider
-     */
-    public function testIsOrderIncrementIdUsed($value)
-    {
-        $expectedBind = [':increment_id' => $value];
-        $this->adapterMock->expects($this->once())->method('fetchOne')->with($this->selectMock, $expectedBind);
-        $this->model->isOrderIncrementIdUsed($value);
-    }
-
-    /**
-     * @return array
-     */
-    public function isOrderIncrementIdUsedDataProvider()
-    {
-        return [[100000001], ['10000000001'], ['M10000000001']];
-    }
-}
diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json
index 2d867ccca552b0bf3dee8361003601c036092d3a..c28feaa41dcb842b926fa2925e7fdf88420d4bfc 100644
--- a/app/code/Magento/Quote/composer.json
+++ b/app/code/Magento/Quote/composer.json
@@ -3,23 +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-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/Block/Adminhtml/Shopcart/Product/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php
index 6de66a60e04a8c28d281e4f55f1fb0cca6a388dc..347405789dc2e49d5131525a55b1ec3aebbe4b29 100644
--- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php
+++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php
@@ -57,14 +57,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
     protected function _prepareCollection()
     {
         $collection = $this->_quotesFactory->create();
-        if ($this->queryResolver->isSingleQuery()) {
-            $collection->prepareForProductsInCarts();
-            $collection->setSelectCountSqlType(
-                \Magento\Reports\Model\Resource\Quote\Collection::SELECT_COUNT_SQL_TYPE_CART
-            );
-        } else {
-            $collection->prepareActiveCartItems();
-        }
+        $collection->prepareActiveCartItems();
         $this->setCollection($collection);
         return parent::_prepareCollection();
     }
@@ -80,6 +73,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
                 'header' => __('ID'),
                 'align' => 'right',
                 'index' => 'entity_id',
+                'sortable' => false,
                 'header_css_class' => 'col-id',
                 'column_css_class' => 'col-id'
             ]
@@ -90,6 +84,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
             [
                 'header' => __('Product'),
                 'index' => 'name',
+                'sortable' => false,
                 'header_css_class' => 'col-product',
                 'column_css_class' => 'col-product'
             ]
@@ -104,6 +99,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
                 'type' => 'currency',
                 'currency_code' => $currencyCode,
                 'index' => 'price',
+                'sortable' => false,
                 'renderer' => 'Magento\Reports\Block\Adminhtml\Grid\Column\Renderer\Currency',
                 'rate' => $this->getRate($currencyCode),
                 'header_css_class' => 'col-price',
@@ -117,6 +113,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
                 'header' => __('Carts'),
                 'align' => 'right',
                 'index' => 'carts',
+                'sortable' => false,
                 'header_css_class' => 'col-carts',
                 'column_css_class' => 'col-carts'
             ]
@@ -128,6 +125,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
                 'header' => __('Orders'),
                 'align' => 'right',
                 'index' => 'orders',
+                'sortable' => false,
                 'header_css_class' => 'col-qty',
                 'column_css_class' => 'col-qty'
             ]
diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
index a4b9fee5599cade00a19481c4a35a4bab335746b..c602eb91ae9b4284b289204770089483d4879ffe 100644
--- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
@@ -66,6 +66,11 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
      */
     protected $_quoteItemFactory;
 
+    /**
+     * @var \Magento\Sales\Model\Resource\Order\Collection
+     */
+    protected $orderResource;
+
     /**
      * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
      * @param \Psr\Log\LoggerInterface $logger
@@ -79,6 +84,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
      * @param \Magento\Framework\Object\Copy\Config $fieldsetConfig
      * @param \Magento\Quote\Model\QuoteRepository $quoteRepository
      * @param \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory
+     * @param \Magento\Sales\Model\Resource\Order\Collection $orderResource
      * @param mixed $connection
      * @param string $modelName
      *
@@ -97,6 +103,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
         \Magento\Framework\Object\Copy\Config $fieldsetConfig,
         \Magento\Quote\Model\QuoteRepository $quoteRepository,
         \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory,
+        \Magento\Sales\Model\Resource\Order\Collection $orderResource,
         $connection = null,
         $modelName = self::CUSTOMER_MODEL_NAME
     ) {
@@ -114,6 +121,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
             $connection,
             $modelName
         );
+        $this->orderResource = $orderResource;
         $this->quoteRepository = $quoteRepository;
         $this->_quoteItemFactory = $quoteItemFactory;
     }
@@ -152,90 +160,6 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
         return $this;
     }
 
-    /**
-     * Order for each customer
-     *
-     * @param string $fromDate
-     * @param string $toDate
-     * @return $this
-     */
-    public function joinOrders($fromDate = '', $toDate = '')
-    {
-        if ($fromDate != '' && $toDate != '') {
-            $dateFilter = " AND orders.created_at BETWEEN '{$fromDate}' AND '{$toDate}'";
-        } else {
-            $dateFilter = '';
-        }
-
-        $this->getSelect()->joinLeft(
-            ['orders' => $this->getTable('sales_order')],
-            "orders.customer_id = e.entity_id" . $dateFilter,
-            []
-        );
-
-        return $this;
-    }
-
-    /**
-     * Add orders count
-     *
-     * @return $this
-     */
-    public function addOrdersCount()
-    {
-        $this->getSelect()->columns(
-            ["orders_count" => "COUNT(orders.entity_id)"]
-        )->where(
-            'orders.state <> ?',
-            \Magento\Sales\Model\Order::STATE_CANCELED
-        )->group(
-            "e.entity_id"
-        );
-
-        return $this;
-    }
-
-    /**
-     * Order summary info for each customer such as orders_count, orders_avg_amount, orders_total_amount
-     *
-     * @param int $storeId
-     * @return $this
-     */
-    public function addSumAvgTotals($storeId = 0)
-    {
-        $adapter = $this->getConnection();
-        $baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0);
-        $baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0);
-
-        /**
-         * calculate average and total amount
-         */
-        $expr = $storeId ==
-            0 ?
-            "(orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}) * orders.base_to_global_rate" :
-            "orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}";
-
-        $this->getSelect()->columns(
-            ["orders_avg_amount" => "AVG({$expr})"]
-        )->columns(
-            ["orders_sum_amount" => "SUM({$expr})"]
-        );
-
-        return $this;
-    }
-
-    /**
-     * Order by total amount
-     *
-     * @param string $dir
-     * @return $this
-     */
-    public function orderByTotalAmount($dir = self::SORT_ORDER_DESC)
-    {
-        $this->getSelect()->order("orders_sum_amount {$dir}");
-        return $this;
-    }
-
     /**
      * Add order statistics
      *
@@ -259,7 +183,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
         $customerIds = $this->getColumnValues($this->getResource()->getIdFieldName());
 
         if ($this->_addOrderStatistics && !empty($customerIds)) {
-            $adapter = $this->getConnection();
+            $adapter = $this->orderResource->getConnection();
             $baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0);
             $baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0);
 
@@ -267,9 +191,9 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
                 "(orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded})*orders.base_to_global_rate" :
                 "orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded}";
 
-            $select = $this->getConnection()->select();
+            $select = $this->orderResource->getConnection()->select();
             $select->from(
-                ['orders' => $this->getTable('sales_order')],
+                ['orders' => $this->orderResource->getTable('sales_order')],
                 [
                     'orders_avg_amount' => "AVG({$totalExpr})",
                     'orders_sum_amount' => "SUM({$totalExpr})",
@@ -286,7 +210,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
                 'orders.customer_id'
             );
 
-            foreach ($this->getConnection()->fetchAll($select) as $ordersInfo) {
+            foreach ($this->orderResource->getConnection()->fetchAll($select) as $ordersInfo) {
                 $this->getItemById($ordersInfo['customer_id'])->addData($ordersInfo);
             }
         }
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
index 3e77d75e16eb6f2f451477f1c89ceb4f907b4e8e..3eb9ac629a26e8fdcd075618a98ea3c26357ce1a 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
@@ -56,6 +56,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      */
     protected $_productType;
 
+    /**
+     * @var \Magento\Quote\Model\Resource\Quote\Collection
+     */
+    protected $quoteResource;
+
     /**
      * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
      * @param \Psr\Log\LoggerInterface $logger
@@ -79,6 +84,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      * @param \Magento\Catalog\Model\Resource\Product $product
      * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory
      * @param \Magento\Catalog\Model\Product\Type $productType
+     * @param \Magento\Quote\Model\Resource\Quote\Collection $quoteResource
      * @param mixed $connection
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -106,6 +112,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         \Magento\Catalog\Model\Resource\Product $product,
         \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
         \Magento\Catalog\Model\Product\Type $productType,
+        \Magento\Quote\Model\Resource\Quote\Collection $quoteResource,
         $connection = null
     ) {
         $this->setProductEntityId($product->getEntityIdField());
@@ -135,6 +142,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         );
         $this->_eventTypeFactory = $eventTypeFactory;
         $this->_productType = $productType;
+        $this->quoteResource = $quoteResource;
     }
 
     /**
@@ -239,7 +247,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
     public function getSelectCountSql()
     {
         if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) {
-            $countSelect = clone $this->getSelect();
+            $countSelect = clone $this->quoteResource->getSelect();
             $countSelect->reset()->from(
                 ['quote_item_table' => $this->getTable('quote_item')],
                 ['COUNT(DISTINCT quote_item_table.product_id)']
@@ -263,102 +271,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         return $countSelect;
     }
 
-    /**
-     * Add orders count
-     *
-     * @param string $from
-     * @param string $to
-     * @return $this
-     */
-    public function addOrdersCount($from = '', $to = '')
-    {
-        $orderItemTableName = $this->getTable('sales_order_item');
-        $productFieldName = sprintf('e.%s', $this->getProductEntityId());
-
-        $this->getSelect()->joinLeft(
-            ['order_items' => $orderItemTableName],
-            "order_items.product_id = {$productFieldName}",
-            []
-        )->columns(
-            ['orders' => 'COUNT(order_items2.item_id)']
-        )->group(
-            $productFieldName
-        );
-
-        $dateFilter = ['order_items2.item_id = order_items.item_id'];
-        if ($from != '' && $to != '') {
-            $dateFilter[] = $this->_prepareBetweenSql('order_items2.created_at', $from, $to);
-        }
-
-        $this->getSelect()->joinLeft(
-            ['order_items2' => $orderItemTableName],
-            implode(' AND ', $dateFilter),
-            []
-        );
-
-        return $this;
-    }
-
-    /**
-     * Add ordered qty's
-     *
-     * @param string $from
-     * @param string $to
-     * @return $this
-     */
-    public function addOrderedQty($from = '', $to = '')
-    {
-        $adapter = $this->getConnection();
-        $compositeTypeIds = $this->_productType->getCompositeTypes();
-        $orderTableAliasName = $adapter->quoteIdentifier('order');
-
-        $orderJoinCondition = [
-            $orderTableAliasName . '.entity_id = order_items.order_id',
-            $adapter->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),
-        ];
-
-        $productJoinCondition = [
-            $adapter->quoteInto('(e.type_id NOT IN (?))', $compositeTypeIds),
-            'e.entity_id = order_items.product_id',
-           $adapter->quoteInto('e.attribute_set_id = ?', $this->getProductAttributeSetId()),
-        ];
-
-        if ($from != '' && $to != '') {
-            $fieldName = $orderTableAliasName . '.created_at';
-            $orderJoinCondition[] = $this->_prepareBetweenSql($fieldName, $from, $to);
-        }
-
-        $this->getSelect()->reset()->from(
-            ['order_items' => $this->getTable('sales_order_item')],
-            ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name']
-        )->joinInner(
-            ['order' => $this->getTable('sales_order')],
-            implode(' AND ', $orderJoinCondition),
-            []
-        )->joinLeft(
-            ['e' => $this->getProductEntityTableName()],
-            implode(' AND ', $productJoinCondition),
-            [
-                'entity_id' => 'order_items.product_id',
-                'attribute_set_id' => 'e.attribute_set_id',
-                'type_id' => 'e.type_id',
-                'sku' => 'e.sku',
-                'has_options' => 'e.has_options',
-                'required_options' => 'e.required_options',
-                'created_at' => 'e.created_at',
-                'updated_at' => 'e.updated_at'
-            ]
-        )->where(
-            'parent_item_id IS NULL'
-        )->group(
-            'order_items.product_id'
-        )->having(
-            'SUM(order_items.qty_ordered) > ?',
-            0
-        );
-        return $this;
-    }
-
     /**
      * Set order
      *
@@ -368,7 +280,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      */
     public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
     {
-        if (in_array($attribute, ['carts', 'orders', 'ordered_qty'])) {
+        if (in_array($attribute, ['carts'])) {
             $this->getSelect()->order($attribute . ' ' . $dir);
         } else {
             parent::setOrder($attribute, $dir);
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
index 521135eeb0422efb7b7f4b9822d00b567793c81b..0c71c26aa69ebf90ac9456c0d898508470399c55 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php
@@ -68,6 +68,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
      * @param \Magento\Catalog\Model\Resource\Product $product
      * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory
      * @param \Magento\Catalog\Model\Product\Type $productType
+     * @param \Magento\Quote\Model\Resource\Quote\Collection $quoteResource
      * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
      * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration
      * @param \Magento\CatalogInventory\Model\Resource\Stock\Item $itemResource
@@ -98,6 +99,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
         \Magento\Catalog\Model\Resource\Product $product,
         \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
         \Magento\Catalog\Model\Product\Type $productType,
+        \Magento\Quote\Model\Resource\Quote\Collection $quoteResource,
         \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
         \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
         \Magento\CatalogInventory\Model\Resource\Stock\Item $itemResource,
@@ -126,6 +128,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
             $product,
             $eventTypeFactory,
             $productType,
+            $quoteResource,
             $connection
         );
         $this->stockRegistry = $stockRegistry;
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php
index 0b91b4a360e7134702a1785a73c75be07ae973ba..2959e2cd45165da18c3911b55f876298326e3452 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php
@@ -11,7 +11,7 @@
  */
 namespace Magento\Reports\Model\Resource\Product\Sold;
 
-class Collection extends \Magento\Reports\Model\Resource\Product\Collection
+class Collection extends \Magento\Reports\Model\Resource\Order\Collection
 {
     /**
      * Set Date range to collection
@@ -34,6 +34,46 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
         return $this;
     }
 
+    /**
+     * Add ordered qty's
+     *
+     * @param string $from
+     * @param string $to
+     * @return $this
+     */
+    public function addOrderedQty($from = '', $to = '')
+    {
+        $adapter = $this->getConnection();
+        $orderTableAliasName = $adapter->quoteIdentifier('order');
+
+        $orderJoinCondition = [
+            $orderTableAliasName . '.entity_id = order_items.order_id',
+            $adapter->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),
+        ];
+
+        if ($from != '' && $to != '') {
+            $fieldName = $orderTableAliasName . '.created_at';
+            $orderJoinCondition[] = $this->prepareBetweenSql($fieldName, $from, $to);
+        }
+
+        $this->getSelect()->reset()->from(
+            ['order_items' => $this->getTable('sales_order_item')],
+            ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name']
+        )->joinInner(
+            ['order' => $this->getTable('sales_order')],
+            implode(' AND ', $orderJoinCondition),
+            []
+        )->where(
+            'parent_item_id IS NULL'
+        )->group(
+            'order_items.product_id'
+        )->having(
+            'SUM(order_items.qty_ordered) > ?',
+            0
+        );
+        return $this;
+    }
+
     /**
      * Set store filter to collection
      *
@@ -49,29 +89,38 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection
     }
 
     /**
-     * Add website product limitation
+     * Set order
      *
+     * @param string $attribute
+     * @param string $dir
      * @return $this
      */
-    protected function _productLimitationJoinWebsite()
+    public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
     {
-        $filters = $this->_productLimitationFilters;
-        $conditions = ['product_website.product_id=e.entity_id'];
-        if (isset($filters['website_ids'])) {
-            $conditions[] = $this->getConnection()->quoteInto(
-                'product_website.website_id IN(?)',
-                $filters['website_ids']
-            );
-
-            $subQuery = $this->getConnection()->select()->from(
-                ['product_website' => $this->getTable('catalog_product_website')],
-                ['product_website.product_id']
-            )->where(
-                join(' AND ', $conditions)
-            );
-            $this->getSelect()->where('e.entity_id IN( ' . $subQuery . ' )');
+        if (in_array($attribute, ['orders', 'ordered_qty'])) {
+            $this->getSelect()->order($attribute . ' ' . $dir);
+        } else {
+            parent::setOrder($attribute, $dir);
         }
 
         return $this;
     }
+
+    /**
+     * Prepare between sql
+     *
+     * @param string $fieldName Field name with table suffix ('created_at' or 'main_table.created_at')
+     * @param string $from
+     * @param string $to
+     * @return string Formatted sql string
+     */
+    protected function prepareBetweenSql($fieldName, $from, $to)
+    {
+        return sprintf(
+            '(%s BETWEEN %s AND %s)',
+            $fieldName,
+            $this->getConnection()->quote($from),
+            $this->getConnection()->quote($to)
+        );
+    }
 }
diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
index 38ba00038520a828469d8d5c1cda8976c9a3b0b3..ea190558cac88646b628f4affaa5583f23f92d14 100644
--- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
@@ -13,6 +13,10 @@
  */
 namespace Magento\Reports\Model\Resource\Quote;
 
+/**
+ * Class Collection
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
 class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
 {
     const SELECT_COUNT_SQL_TYPE_CART = 1;
@@ -39,12 +43,17 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
     /**
      * @var \Magento\Catalog\Model\Resource\Product\Collection
      */
-    protected $_productResource;
+    protected $productResource;
 
     /**
      * @var \Magento\Customer\Model\Resource\Customer
      */
-    protected $_customerResource;
+    protected $customerResource;
+
+    /**
+     * @var \Magento\Sales\Model\Resource\Order\Collection
+     */
+    protected $orderResource;
 
     /**
      * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
@@ -53,6 +62,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
      * @param \Magento\Framework\Event\ManagerInterface $eventManager
      * @param \Magento\Catalog\Model\Resource\Product\Collection $productResource
      * @param \Magento\Customer\Model\Resource\Customer $customerResource
+     * @param \Magento\Sales\Model\Resource\Order\Collection $orderResource
      * @param null $connection
      * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource
      */
@@ -63,12 +73,14 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
         \Magento\Framework\Event\ManagerInterface $eventManager,
         \Magento\Catalog\Model\Resource\Product\Collection $productResource,
         \Magento\Customer\Model\Resource\Customer $customerResource,
+        \Magento\Sales\Model\Resource\Order\Collection $orderResource,
         $connection = null,
         \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null
     ) {
         parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
-        $this->_productResource = $productResource;
-        $this->_customerResource = $customerResource;
+        $this->productResource = $productResource;
+        $this->customerResource = $customerResource;
+        $this->orderResource = $orderResource;
     }
 
     /**
@@ -120,75 +132,47 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
     /**
      * Prepare select query for products in carts report
      *
-     * @return $this
+     * @return \Magento\Framework\DB\Select
      */
-    public function prepareForProductsInCarts()
+    public function prepareActiveCartItems()
     {
-        $productAttrName = $this->_productResource->getAttribute('name');
-        $productAttrNameId = (int)$productAttrName->getAttributeId();
-        $productAttrNameTable = $productAttrName->getBackend()->getTable();
-        $productAttrPrice = $this->_productResource->getAttribute('price');
-        $productAttrPriceId = (int)$productAttrPrice->getAttributeId();
-        $productAttrPriceTable = $productAttrPrice->getBackend()->getTable();
-
-        $this->getSelect()->useStraightJoin(
-            true
-        )->reset(
-            \Zend_Db_Select::COLUMNS
-        )->joinInner(
-            ['quote_items' => $this->getTable('quote_item')],
-            'quote_items.quote_id = main_table.entity_id',
-            null
-        )->joinInner(
-            ['e' => $this->getTable('catalog_product_entity')],
-            'e.entity_id = quote_items.product_id',
-            null
-        )->joinInner(
-            ['product_name' => $productAttrNameTable],
-            'product_name.entity_id = e.entity_id'
-                . ' AND product_name.attribute_id = ' . $productAttrNameId
-                . ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
-            ['name' => 'product_name.value']
-        )->joinInner(
-            ['product_price' => $productAttrPriceTable],
-            "product_price.entity_id = e.entity_id AND product_price.attribute_id = {$productAttrPriceId}",
-            ['price' => new \Zend_Db_Expr('product_price.value * main_table.base_to_global_rate')]
-        )->joinLeft(
-            ['order_items' => new \Zend_Db_Expr(sprintf('(%s)', $this->getOrdersSubSelect()))],
-            'order_items.product_id = e.entity_id',
-            []
-        )->columns(
-            'e.*'
-        )->columns(
-            ['carts' => new \Zend_Db_Expr('COUNT(quote_items.item_id)')]
-        )->columns(
-            'order_items.orders'
-        )->where(
-            'main_table.is_active = ?',
-            1
-        )->group(
-            'quote_items.product_id'
-        );
+        $quoteItemsSelect = $this->getSelect();
+        $quoteItemsSelect->reset()
+            ->from(['main_table' => $this->getTable('quote')], '')
+            ->columns('quote_items.product_id')
+            ->columns(['carts' => new \Zend_Db_Expr('COUNT(quote_items.item_id)')])
+            ->columns('main_table.base_to_global_rate')
+            ->joinInner(
+                ['quote_items' => $this->getTable('quote_item')],
+                'quote_items.quote_id = main_table.entity_id',
+                null
+            )->where(
+                'main_table.is_active = ?',
+                1
+            )->group(
+                'quote_items.product_id'
+            );
 
-        return $this;
+        return $quoteItemsSelect;
     }
 
     /**
-     * Orders quantity subselect
+     * Orders quantity data
      *
-     * @return \Magento\Framework\DB\Select
+     * @param array $productIds
+     * @return array
      */
-    protected function getOrdersSubSelect()
+    protected function getOrdersData(array $productIds)
     {
-        $ordersSubSelect = clone $this->getSelect();
+        $ordersSubSelect = clone $this->orderResource->getSelect();
         $ordersSubSelect->reset()->from(
             ['oi' => $this->getTable('sales_order_item')],
-            ['orders' => new \Zend_Db_Expr('COUNT(1)'), 'product_id']
-        )->group(
+            ['product_id', 'orders' => new \Zend_Db_Expr('COUNT(1)')]
+        )->where('oi.product_id IN (?)', $productIds)->group(
             'oi.product_id'
         );
 
-        return $ordersSubSelect;
+        return $this->orderResource->getConnection()->fetchAssoc($ordersSubSelect);
     }
 
     /**
@@ -211,7 +195,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
      */
     public function addCustomerData($filter = null)
     {
-        $customersSelect = $this->_customerResource->getReadConnection()->select();
+        $customersSelect = $this->customerResource->getReadConnection()->select();
         $customersSelect->from(['customer' => 'customer_entity'], 'entity_id');
         if (isset($filter['customer_name'])) {
             $customersSelect = $this->getCustomerNames($customersSelect);
@@ -223,7 +207,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
         if (isset($filter['email'])) {
             $customersSelect->where('customer.email LIKE ?', '%' . $filter['email'] . '%');
         }
-        $filteredCustomers = $this->_customerResource->getReadConnection()->fetchCol($customersSelect);
+        $filteredCustomers = $this->customerResource->getReadConnection()->fetchCol($customersSelect);
         $this->getSelect()->where('main_table.customer_id IN (?)', $filteredCustomers);
         return $this;
     }
@@ -270,24 +254,14 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
     /**
      * Get select count sql
      *
-     * @return string
+     * @return \Magento\Framework\DB\Select
      */
     public function getSelectCountSql()
     {
-        $countSelect = clone $this->getSelect();
-        $countSelect->reset(\Zend_Db_Select::ORDER);
-        $countSelect->reset(\Zend_Db_Select::LIMIT_COUNT);
-        $countSelect->reset(\Zend_Db_Select::LIMIT_OFFSET);
-        $countSelect->reset(\Zend_Db_Select::COLUMNS);
-        $countSelect->reset(\Zend_Db_Select::GROUP);
-        $countSelect->resetJoinLeft();
-
-        if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) {
-            $countSelect->columns("COUNT(DISTINCT e.entity_id)");
-        } else {
-            $countSelect->columns("COUNT(DISTINCT main_table.entity_id)");
-        }
-
+        $countSelect = clone $this->prepareActiveCartItems();
+        $countSelect->reset(\Zend_Db_Select::COLUMNS)
+            ->reset(\Zend_Db_Select::GROUP)
+            ->columns('COUNT(DISTINCT quote_items.product_id)');
         return $countSelect;
     }
 
@@ -297,10 +271,10 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
      */
     protected function getCustomerNames($select)
     {
-        $attrFirstname = $this->_customerResource->getAttribute('firstname');
+        $attrFirstname = $this->customerResource->getAttribute('firstname');
         $attrFirstnameId = (int)$attrFirstname->getAttributeId();
         $attrFirstnameTableName = $attrFirstname->getBackend()->getTable();
-        $attrLastname = $this->_customerResource->getAttribute('lastname');
+        $attrLastname = $this->customerResource->getAttribute('lastname');
         $attrLastnameId = (int)$attrLastname->getAttributeId();
         $attrLastnameTableName = $attrLastname->getBackend()->getTable();
         $select->joinInner(
@@ -326,7 +300,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
      */
     public function resolveCustomerNames()
     {
-        $select = $this->_customerResource->getReadConnection()->select();
+        $select = $this->customerResource->getReadConnection()->select();
         $customerName = $select->getAdapter()->getConcatSql(['cust_fname.value', 'cust_lname.value'], ' ');
 
         $select->from(
@@ -343,4 +317,69 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection
             next($customersData);
         }
     }
+
+    /**
+     * Separate query for product and order data
+     *
+     * @param array $productIds
+     * @return array
+     * @throws \Magento\Framework\Exception\LocalizedException
+     */
+    protected function getProductData(array $productIds)
+    {
+        $productConnection = $this->productResource->getConnection('read');
+        $productAttrName = $this->productResource->getAttribute('name');
+        $productAttrNameId = (int)$productAttrName->getAttributeId();
+        $productAttrPrice = $this->productResource->getAttribute('price');
+        $productAttrPriceId = (int)$productAttrPrice->getAttributeId();
+
+        $select = clone $this->productResource->getSelect();
+        $select->reset();
+        $select->from(
+            ['main_table' => $this->getTable('catalog_product_entity')]
+        )->useStraightJoin(
+            true
+        )->joinInner(
+            ['product_name' => $productAttrName->getBackend()->getTable()],
+            'product_name.entity_id = main_table.entity_id'
+            . ' AND product_name.attribute_id = ' . $productAttrNameId
+            . ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
+            ['name' => 'product_name.value']
+        )->joinInner(
+            ['product_price' => $productAttrPrice->getBackend()->getTable()],
+            "product_price.entity_id = main_table.entity_id AND product_price.attribute_id = {$productAttrPriceId}",
+            ['price' => new \Zend_Db_Expr('product_price.value')]
+        )->where('main_table.entity_id IN (?)', $productIds);
+
+        $productData = $productConnection->fetchAssoc($select);
+        return $productData;
+    }
+
+    /**
+     * Add data fetched from another database
+     *
+     * @return $this
+     */
+    protected function _afterLoad()
+    {
+        parent::_afterLoad();
+        $items = $this->getItems();
+        $productIds = [];
+        foreach ($items as $item) {
+            $productIds[] = $item->getProductId();
+        }
+        $productData = $this->getProductData($productIds);
+        $orderData = $this->getOrdersData($productIds);
+        foreach ($items as $item) {
+            $item->setId($item->getProductId());
+            $item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
+            $item->setName($productData[$item->getProductId()]['name']);
+            $item->setOrders(0);
+            if (isset($orderData[$item->getProductId()])) {
+                $item->setOrders($orderData[$item->getProductId()]['orders']);
+            }
+        }
+
+        return $this;
+    }
 }
diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php
index bea0fc3cb2e6710e0d27b9f47aabe6bbb34d2c52..7e619a704833f703ce6f0c9f97e4a37333e1912e 100644
--- a/app/code/Magento/Reports/Setup/InstallSchema.php
+++ b/app/code/Magento/Reports/Setup/InstallSchema.php
@@ -73,7 +73,7 @@ class InstallSchema implements InstallSchemaInterface
                 'added_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Added At'
             )
             ->addIndex(
@@ -111,7 +111,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_id',
                 $installer->getTable('customer_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -124,7 +123,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -132,8 +130,7 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Reports Compared Product Index Table');
         $installer->getConnection()->createTable($table);
@@ -184,7 +181,7 @@ class InstallSchema implements InstallSchemaInterface
                 'added_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Added At'
             )
             ->addIndex(
@@ -222,7 +219,6 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_id',
                 $installer->getTable('customer_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -235,7 +231,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -243,8 +238,7 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Reports Viewed Product Index Table');
         $installer->getConnection()->createTable($table);
@@ -294,7 +288,7 @@ class InstallSchema implements InstallSchemaInterface
                 'logged_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Logged At'
             )
             ->addColumn(
@@ -357,7 +351,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -365,7 +358,6 @@ class InstallSchema implements InstallSchemaInterface
                 'event_type_id',
                 $installer->getTable('report_event_types'),
                 'event_type_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Reports Event Table');
@@ -419,7 +411,7 @@ class InstallSchema implements InstallSchemaInterface
                     'added_at',
                     \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                     null,
-                    ['nullable' => false],
+                    ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                     'Added At'
                 )
                 ->addIndex(
@@ -452,7 +444,6 @@ class InstallSchema implements InstallSchemaInterface
                     'customer_id',
                     $installer->getTable('customer_entity'),
                     'entity_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
                 )
                 ->addForeignKey(
@@ -465,7 +456,6 @@ class InstallSchema implements InstallSchemaInterface
                     'product_id',
                     $installer->getTable('catalog_product_entity'),
                     'entity_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
                 )
                 ->addForeignKey(
@@ -473,8 +463,7 @@ class InstallSchema implements InstallSchemaInterface
                     'store_id',
                     $installer->getTable('store'),
                     'store_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
                 )
                 ->setComment('Reports Compared Product Index Table');
             $installer->getConnection()->createTable($table);
@@ -528,7 +517,7 @@ class InstallSchema implements InstallSchemaInterface
                     'added_at',
                     \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                     null,
-                    ['nullable' => false],
+                    ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                     'Added At'
                 )
                 ->addIndex(
@@ -556,7 +545,6 @@ class InstallSchema implements InstallSchemaInterface
                     'customer_id',
                     $installer->getTable('customer_entity'),
                     'entity_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
                 )
                 ->addForeignKey(
@@ -569,7 +557,6 @@ class InstallSchema implements InstallSchemaInterface
                     'product_id',
                     $installer->getTable('catalog_product_entity'),
                     'entity_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
                 )
                 ->addForeignKey(
@@ -577,8 +564,7 @@ class InstallSchema implements InstallSchemaInterface
                     'store_id',
                     $installer->getTable('store'),
                     'store_id',
-                    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
                 )
                 ->setComment('Reports Viewed Product Index Table');
             $installer->getConnection()->createTable($table);
@@ -667,7 +653,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -680,7 +665,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Most Viewed Products Aggregated Daily');
@@ -769,7 +753,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -782,7 +765,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Most Viewed Products Aggregated Monthly');
@@ -871,7 +853,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -884,7 +865,6 @@ class InstallSchema implements InstallSchemaInterface
                 'product_id',
                 $installer->getTable('catalog_product_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Most Viewed Products Aggregated Yearly');
diff --git a/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..d3b7eadd6da68560e28bcad5b9a1b5249209c615
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php
@@ -0,0 +1,154 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Reports\Test\Unit\Model\Resource\Report\Quote;
+
+use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use \Magento\Reports\Model\Resource\Quote\Collection as Collection;
+
+class CollectionTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+     */
+    protected $objectManager;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $selectMock;
+
+    protected function setUp()
+    {
+        $this->objectManager = new ObjectManager($this);
+        $this->selectMock = $this->getMock('\Magento\Framework\DB\Select', [], [], '', false);
+    }
+
+    public function testGetSelectCountSql()
+    {
+        /** @var $collection \PHPUnit_Framework_MockObject_MockObject */
+        $constructArgs = $this->objectManager
+            ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection');
+        $collection = $this->getMock(
+            'Magento\Reports\Model\Resource\Quote\Collection',
+            ['prepareActiveCartItems', 'getSelect'],
+            $constructArgs,
+            '',
+            false
+        );
+
+        $collection->expects($this->once())->method('prepareActiveCartItems')->willReturn($this->selectMock);
+        $this->selectMock->expects($this->atLeastOnce())->method('reset')->willReturnSelf();
+        $this->selectMock->expects($this->once())
+            ->method('columns')
+            ->with('COUNT(DISTINCT quote_items.product_id)')
+            ->willReturnSelf();
+        $this->assertEquals($this->selectMock, $collection->getSelectCountSql());
+    }
+
+    public function testPrepareActiveCartItems()
+    {
+        /** @var $collection \PHPUnit_Framework_MockObject_MockObject */
+        $constructArgs = $this->objectManager
+            ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection');
+        $collection = $this->getMock(
+            'Magento\Reports\Model\Resource\Quote\Collection',
+            ['getSelect', 'getTable'],
+            $constructArgs,
+            '',
+            false
+        );
+
+        $collection->expects($this->once())->method('getSelect')->willReturn($this->selectMock);
+        $this->selectMock->expects($this->once())->method('reset')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('from')->willReturnSelf();
+        $this->selectMock->expects($this->atLeastOnce())->method('columns')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('joinInner')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('where')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('group')->willReturnSelf();
+        $collection->expects($this->exactly(2))->method('getTable')->willReturn('table');
+        $collection->prepareActiveCartItems();
+    }
+
+    public function testLoadWithFilter()
+    {
+        /** @var $collection \PHPUnit_Framework_MockObject_MockObject */
+        $constructArgs = $this->objectManager
+            ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection');
+        $constructArgs['eventManager'] = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false);
+        $readConnectionMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false);
+        $resourceMock = $this->getMock('\Magento\Quote\Model\Resource\Quote', [], [], '', false);
+        $constructArgs['resource'] = $resourceMock;
+        $productResourceMock = $this->getMock('\Magento\Catalog\Model\Resource\Product\Collection', [], [], '', false);
+        $constructArgs['productResource'] = $productResourceMock;
+        $orderResourceMock = $this->getMock('\Magento\Sales\Model\Resource\Order\Collection', [], [], '', false);
+        $constructArgs['orderResource'] = $orderResourceMock;
+
+        $collection = $this->getMock(
+            'Magento\Reports\Model\Resource\Quote\Collection',
+            [
+                '_beforeLoad',
+                '_renderFilters',
+                '_renderOrders',
+                '_renderLimit',
+                'printLogQuery',
+                'getData',
+                '_setIsLoaded',
+                'setConnection',
+                '_initSelect',
+                'getTable',
+                'getItems',
+                'getOrdersData',
+            ],
+            $constructArgs
+        );
+        //load()
+        $collection->expects($this->once())->method('_beforeLoad')->willReturnSelf();
+        $collection->expects($this->once())->method('_renderFilters')->willReturnSelf();
+        $collection->expects($this->once())->method('_renderOrders')->willReturnSelf();
+        $collection->expects($this->once())->method('_renderLimit')->willReturnSelf();
+        $collection->expects($this->once())->method('printLogQuery')->willReturnSelf();
+        $collection->expects($this->once())->method('getData')->willReturn(null);
+        $collection->expects($this->once())->method('_setIsLoaded')->willReturnSelf();
+
+        //productLoad()
+        $productAttributeMock = $this->getMock(
+            '\Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
+            [],
+            [],
+            '',
+            false
+        );
+        $priceAttributeMock = $this->getMock(
+            '\Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
+            [],
+            [],
+            '',
+            false
+        );
+        $productResourceMock->expects($this->once())
+            ->method('getConnection')
+            ->with('read')
+            ->willReturn($readConnectionMock);
+        $productResourceMock->expects($this->any())
+            ->method('getAttribute')
+            ->willReturnMap([['name', $productAttributeMock], ['price', $priceAttributeMock]]);
+        $productResourceMock->expects($this->once())->method('getSelect')->willReturn($this->selectMock);
+        $this->selectMock->expects($this->once())->method('reset')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('from')->willReturnSelf();
+        $this->selectMock->expects($this->once())->method('useStraightJoin')->willReturnSelf();
+        $this->selectMock->expects($this->exactly(2))->method('joinInner')->willReturnSelf();
+        $collection->expects($this->once())->method('getOrdersData')->willReturn([]);
+
+        $productAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf();
+        $priceAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf();
+        $readConnectionMock->expects($this->once())->method('fetchAssoc')->willReturn([1, 2, 3]);
+
+        //_afterLoad()
+        $collection->expects($this->once())->method('getItems')->willReturn([]);
+
+        $collection->loadWithFilter();
+    }
+}
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/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php
index 6d5a14fe2880f21d46abd7d3be56f5be04d60fb0..147688bdf15e3b7dbab52eefab5c1104c547a77a 100644
--- a/app/code/Magento/Review/Setup/InstallSchema.php
+++ b/app/code/Magento/Review/Setup/InstallSchema.php
@@ -84,7 +84,7 @@ class InstallSchema implements InstallSchemaInterface
                 'created_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                 'Review create date'
             )
             ->addColumn(
@@ -125,7 +125,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('review_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -133,7 +132,6 @@ class InstallSchema implements InstallSchemaInterface
                 'status_id',
                 $installer->getTable('review_status'),
                 'status_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION,
                 \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
             )
             ->setComment('Review base information');
@@ -210,15 +208,13 @@ class InstallSchema implements InstallSchemaInterface
                 'customer_id',
                 $installer->getTable('customer_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->addForeignKey(
                 $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'),
                 'review_id',
                 $installer->getTable('review'),
                 'review_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -226,8 +222,7 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
             )
             ->setComment('Review detail information');
         $installer->getConnection()->createTable($table);
@@ -288,7 +283,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Review aggregates');
@@ -322,7 +316,6 @@ class InstallSchema implements InstallSchemaInterface
                 'review_id',
                 $installer->getTable('review'),
                 'review_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -330,7 +323,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Review Store');
@@ -425,7 +417,6 @@ class InstallSchema implements InstallSchemaInterface
                 'entity_id',
                 $installer->getTable('rating_entity'),
                 'entity_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Ratings');
@@ -480,7 +471,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rating_id',
                 $installer->getTable('rating'),
                 'rating_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Rating options');
@@ -570,7 +560,6 @@ class InstallSchema implements InstallSchemaInterface
                 'option_id',
                 $installer->getTable('rating_option'),
                 'option_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -578,7 +567,6 @@ class InstallSchema implements InstallSchemaInterface
                 'review_id',
                 $installer->getTable('review'),
                 'review_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Rating option values');
@@ -658,7 +646,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rating_id',
                 $installer->getTable('rating'),
                 'rating_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -666,7 +653,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Rating vote aggregated');
@@ -700,7 +686,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -708,8 +693,7 @@ class InstallSchema implements InstallSchemaInterface
                 'rating_id',
                 $installer->getTable('rating'),
                 'rating_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-                \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Rating Store');
         $installer->getConnection()->createTable($table);
@@ -749,7 +733,6 @@ class InstallSchema implements InstallSchemaInterface
                 'rating_id',
                 $installer->getTable('rating'),
                 'rating_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->addForeignKey(
@@ -757,7 +740,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Rating Title');
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/Controller/Adminhtml/Order/Creditmemo/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php
index 63b1f9055bdd1e78a525a655e5cef4e96595048d..832aed45797e962b32264d1681ca979fee5cfe8c 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php
@@ -6,7 +6,7 @@
 namespace Magento\Sales\Controller\Adminhtml\Order\Creditmemo;
 
 use Magento\Backend\App\Action;
-use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender;
+use Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender;
 
 class AddComment extends \Magento\Backend\App\Action
 {
@@ -16,9 +16,9 @@ class AddComment extends \Magento\Backend\App\Action
     protected $creditmemoLoader;
 
     /**
-     * @var CreditmemoSender
+     * @var CreditmemoCommentSender
      */
-    protected $creditmemoSender;
+    protected $creditmemoCommentSender;
 
     /**
      * @var \Magento\Framework\View\Result\PageFactory
@@ -38,7 +38,7 @@ class AddComment extends \Magento\Backend\App\Action
     /**
      * @param Action\Context $context
      * @param \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader
-     * @param CreditmemoSender $creditmemoSender
+     * @param CreditmemoCommentSender $creditmemoCommentSender
      * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
      * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
      * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
@@ -46,13 +46,13 @@ class AddComment extends \Magento\Backend\App\Action
     public function __construct(
         Action\Context $context,
         \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader,
-        CreditmemoSender $creditmemoSender,
+        CreditmemoCommentSender $creditmemoCommentSender,
         \Magento\Framework\View\Result\PageFactory $resultPageFactory,
         \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
         \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
     ) {
         $this->creditmemoLoader = $creditmemoLoader;
-        $this->creditmemoSender = $creditmemoSender;
+        $this->creditmemoCommentSender = $creditmemoCommentSender;
         $this->resultPageFactory = $resultPageFactory;
         $this->resultJsonFactory = $resultJsonFactory;
         $this->resultRawFactory = $resultRawFactory;
@@ -94,7 +94,7 @@ class AddComment extends \Magento\Backend\App\Action
             );
             $comment->save();
 
-            $this->creditmemoSender->send($creditmemo, !empty($data['is_customer_notified']), $data['comment']);
+            $this->creditmemoCommentSender->send($creditmemo, !empty($data['is_customer_notified']), $data['comment']);
             $resultPage = $this->resultPageFactory->create();
             $response = $resultPage->getLayout()->getBlock('creditmemo_comments')->toHtml();
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php
index 6ba3acd497b1f06992c9b871cc1cc63f2a1da6de..dbbd9dd55e33e64ae70286cadd0111f9a54d363b 100644
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php
@@ -81,16 +81,15 @@ class Save extends \Magento\Backend\App\Action
                     );
                 }
 
-                $comment = '';
                 if (!empty($data['comment_text'])) {
                     $creditmemo->addComment(
                         $data['comment_text'],
                         isset($data['comment_customer_notify']),
                         isset($data['is_visible_on_front'])
                     );
-                    if (isset($data['comment_customer_notify'])) {
-                        $comment = $data['comment_text'];
-                    }
+
+                    $creditmemo->setCustomerNote($data['comment_text']);
+                    $creditmemo->setCustomerNoteNotify(isset($data['comment_customer_notify']));
                 }
 
                 if (isset($data['do_refund'])) {
@@ -107,9 +106,6 @@ class Save extends \Magento\Backend\App\Action
                 }
 
                 $creditmemo->register();
-                if (!empty($data['send_email'])) {
-                    $creditmemo->setEmailSent(true);
-                }
 
                 $creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
                 $transactionSave = $this->_objectManager->create(
@@ -123,7 +119,10 @@ class Save extends \Magento\Backend\App\Action
                     $transactionSave->addObject($creditmemo->getInvoice());
                 }
                 $transactionSave->save();
-                $this->creditmemoSender->send($creditmemo, !empty($data['send_email']), $comment);
+
+                if (!empty($data['send_email'])) {
+                    $this->creditmemoSender->send($creditmemo);
+                }
 
                 $this->messageManager->addSuccess(__('You created the credit memo.'));
                 $this->_getSession()->getCommentText(true);
diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php
index 1fffaf8a03ee16324a611fdf6f1b9f862c1367af..3758ad060f0dcb4c6714cac12fa1ad9d41b7540e 100755
--- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php
+++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php
@@ -9,7 +9,7 @@ namespace Magento\Sales\Controller\Adminhtml\Order\Invoice;
 use Magento\Backend\App\Action;
 use Magento\Framework\Exception\LocalizedException;
 use Magento\Framework\Registry;
-use Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender;
+use Magento\Sales\Model\Order\Email\Sender\InvoiceSender;
 use Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
 use Magento\Sales\Model\Order\Invoice;
 
@@ -19,9 +19,9 @@ use Magento\Sales\Model\Order\Invoice;
 class Save extends \Magento\Backend\App\Action
 {
     /**
-     * @var InvoiceCommentSender
+     * @var InvoiceSender
      */
-    protected $invoiceCommentSender;
+    protected $invoiceSender;
 
     /**
      * @var ShipmentSender
@@ -36,17 +36,17 @@ class Save extends \Magento\Backend\App\Action
     /**
      * @param Action\Context $context
      * @param Registry $registry
-     * @param InvoiceCommentSender $invoiceCommentSender
+     * @param InvoiceSender $invoiceSender
      * @param ShipmentSender $shipmentSender
      */
     public function __construct(
         Action\Context $context,
         Registry $registry,
-        InvoiceCommentSender $invoiceCommentSender,
+        InvoiceSender $invoiceSender,
         ShipmentSender $shipmentSender
     ) {
         $this->registry = $registry;
-        $this->invoiceCommentSender = $invoiceCommentSender;
+        $this->invoiceSender = $invoiceSender;
         $this->shipmentSender = $shipmentSender;
         parent::__construct($context);
     }
@@ -153,14 +153,13 @@ class Save extends \Magento\Backend\App\Action
                     isset($data['comment_customer_notify']),
                     isset($data['is_visible_on_front'])
                 );
+
+                $invoice->setCustomerNote($data['comment_text']);
+                $invoice->setCustomerNoteNotify(isset($data['comment_customer_notify']));
             }
 
             $invoice->register();
 
-            if (!empty($data['send_email'])) {
-                $invoice->setEmailSent(true);
-            }
-
             $invoice->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
             $invoice->getOrder()->setIsInProcess(true);
 
@@ -175,7 +174,6 @@ class Save extends \Magento\Backend\App\Action
             if (!empty($data['do_shipment']) || (int)$invoice->getOrder()->getForcedShipmentWithInvoice()) {
                 $shipment = $this->_prepareShipment($invoice);
                 if ($shipment) {
-                    $shipment->setEmailSent($invoice->getEmailSent());
                     $transactionSave->addObject($shipment);
                 }
             }
@@ -195,19 +193,19 @@ class Save extends \Magento\Backend\App\Action
             }
 
             // send invoice/shipment emails
-            $comment = '';
-            if (isset($data['comment_customer_notify'])) {
-                $comment = $data['comment_text'];
-            }
             try {
-                $this->invoiceCommentSender->send($invoice, !empty($data['send_email']), $comment);
+                if (!empty($data['send_email'])) {
+                    $this->invoiceSender->send($invoice);
+                }
             } catch (\Exception $e) {
                 $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
                 $this->messageManager->addError(__('We can\'t send the invoice email.'));
             }
             if ($shipment) {
                 try {
-                    $this->shipmentSender->send($shipment, !empty($data['send_email']));
+                    if (!empty($data['send_email'])) {
+                        $this->shipmentSender->send($shipment);
+                    }
                 } catch (\Exception $e) {
                     $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
                     $this->messageManager->addError(__('We can\'t send the shipment.'));
diff --git a/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php b/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php
new file mode 100644
index 0000000000000000000000000000000000000000..b872e5b9de289a11573bdae418dd86fe57d7abf3
--- /dev/null
+++ b/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Sales\Model\Config\Backend\Email;
+
+/**
+ * Backend model for global configuration value
+ * 'sales_email/general/async_sending'.
+ */
+class AsyncSending extends \Magento\Framework\App\Config\Value
+{
+    /**
+     * Dispatches corresponding event after saving of configuration
+     * value if it was changed.
+     *
+     * Dispatches next events:
+     *
+     * - config_data_sales_email_general_async_sending_enabled
+     * - config_data_sales_email_general_async_sending_disabled
+     *
+     * @return $this
+     */
+    public function afterSave()
+    {
+        if ($this->isValueChanged()) {
+            $state = $this->getValue() ? 'enabled' : 'disabled';
+
+            $this->_eventManager->dispatch(
+                $this->_eventPrefix . '_sales_email_general_async_sending_' . $state,
+                $this->_getEventData()
+            );
+        }
+
+        return $this;
+    }
+}
diff --git a/app/code/Magento/Sales/Model/Observer/SendEmails.php b/app/code/Magento/Sales/Model/Observer/SendEmails.php
new file mode 100644
index 0000000000000000000000000000000000000000..b8c8d00cddb52d4f23c7b51aab51d46776d2d27e
--- /dev/null
+++ b/app/code/Magento/Sales/Model/Observer/SendEmails.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Sales\Model\Observer;
+
+/**
+ * Sales emails sending observer.
+ *
+ * Performs handling of cron jobs related to sending emails to customers
+ * after creation/modification of Order, Invoice, Shipment or Creditmemo.
+ */
+class SendEmails
+{
+    /**
+     * Email sender model.
+     *
+     * @var \Magento\Sales\Model\Order\Email\Sender
+     */
+    protected $emailSender;
+
+    /**
+     * Entity resource model.
+     *
+     * @var \Magento\Sales\Model\Resource\EntityAbstract
+     */
+    protected $entityResource;
+
+    /**
+     * Entity collection model.
+     *
+     * @var \Magento\Sales\Model\Resource\Collection\AbstractCollection
+     */
+    protected $entityCollection;
+
+    /**
+     * Global configuration storage.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface
+     */
+    protected $globalConfig;
+
+    /**
+     * @param \Magento\Sales\Model\Order\Email\Sender $emailSender
+     * @param \Magento\Sales\Model\Resource\EntityAbstract $entityResource
+     * @param \Magento\Sales\Model\Resource\Collection\AbstractCollection $entityCollection
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
+     */
+    public function __construct(
+        \Magento\Sales\Model\Order\Email\Sender $emailSender,
+        \Magento\Sales\Model\Resource\EntityAbstract $entityResource,
+        \Magento\Sales\Model\Resource\Collection\AbstractCollection $entityCollection,
+        \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
+    ) {
+        $this->emailSender = $emailSender;
+        $this->entityResource = $entityResource;
+        $this->entityCollection = $entityCollection;
+        $this->globalConfig = $globalConfig;
+    }
+
+    /**
+     * Handles asynchronous email sending during corresponding
+     * cron job.
+     *
+     * Also method is used in the next events:
+     *
+     * - config_data_sales_email_general_async_sending_disabled
+     *
+     * Works only if asynchronous email sending is enabled
+     * in global settings.
+     *
+     * @return void
+     */
+    public function execute()
+    {
+        if ($this->globalConfig->getValue('sales_email/general/async_sending')) {
+            $this->entityCollection->addFieldToFilter('send_email', ['eq' => 1]);
+            $this->entityCollection->addFieldToFilter('email_sent', ['null' => true]);
+
+            /** @var \Magento\Sales\Model\AbstractModel $item */
+            foreach ($this->entityCollection->getItems() as $item) {
+                if ($this->emailSender->send($item, true)) {
+                    $this->entityResource->save(
+                        $item->setEmailSent(true)
+                    );
+                }
+            }
+        }
+    }
+}
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 667678cc71d24a24127cd0abb7ace46d519d8ba2..94847e91dbe200c9ea34764d4981d08ac986db98 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -45,6 +45,7 @@ use Magento\Sales\Model\Resource\Order\Status\History\Collection as HistoryColle
  * @method bool hasForcedCanCreditmemo()
  * @method bool getIsInProcess()
  * @method \Magento\Customer\Model\Customer getCustomer()
+ * @method \Magento\Sales\Model\Order setSendEmail(bool $value)
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  * @SuppressWarnings(PHPMD.TooManyFields)
  * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
@@ -520,7 +521,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
      */
     protected function _canVoidOrder()
     {
-        return !($this->canUnhold() || $this->isPaymentReview());
+        return !($this->isCanceled() || $this->canUnhold() || $this->isPaymentReview());
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php
index ec5829dc30e18066c186db6fead57c9a48f4279c..9e77f5afd8635e1b6421a1915684a4c0a858cbd0 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php
@@ -21,6 +21,11 @@ use Magento\Sales\Model\EntityInterface;
  * @method \Magento\Sales\Model\Resource\Order\Creditmemo _getResource()
  * @method \Magento\Sales\Model\Resource\Order\Creditmemo getResource()
  * @method \Magento\Sales\Model\Order\Creditmemo setCreatedAt(string $value)
+ * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value)
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value)
+ * @method string getCustomerNote()
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value)
+ * @method bool getCustomerNoteNotify()
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
index 163a03903f878e254e5817243cff2ac0bd1288b0..35d522427429f1d01def7ad15a2f784ee2e7f31f 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
@@ -219,7 +219,7 @@ class Item extends AbstractModel implements CreditmemoItemInterface
         $rowTotalInclTax = $orderItem->getRowTotalInclTax();
         $baseRowTotalInclTax = $orderItem->getBaseRowTotalInclTax();
 
-        if (!$this->isLast() && $orderItemQtyInvoiced > 0 && $this->getQty() > 0) {
+        if (!$this->isLast() && $orderItemQtyInvoiced > 0 && $this->getQty() >= 0) {
             $availableQty = $orderItemQtyInvoiced - $orderItem->getQtyRefunded();
             $rowTotal = $creditmemo->roundPrice($rowTotal / $availableQty * $this->getQty());
             $baseRowTotal = $creditmemo->roundPrice($baseRowTotal / $availableQty * $this->getQty(), 'base');
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php
index 50441777e01cab6309354625c12b893d68099517..e476e5ec8b544272154e907ce04cf46be2dd08ba 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php
@@ -10,7 +10,7 @@ use Magento\Sales\Model\Order;
 use Magento\Sales\Model\Order\Creditmemo;
 use Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity;
 use Magento\Sales\Model\Order\Email\Container\Template;
-use Magento\Sales\Model\Order\Email\NotifySender;
+use Magento\Sales\Model\Order\Email\Sender;
 use Magento\Sales\Model\Resource\Order\Creditmemo as CreditmemoResource;
 use Magento\Sales\Model\Order\Address\Renderer;
 
@@ -19,7 +19,7 @@ use Magento\Sales\Model\Order\Address\Renderer;
  *
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class CreditmemoSender extends NotifySender
+class CreditmemoSender extends Sender
 {
     /**
      * @var PaymentHelper
@@ -32,14 +32,16 @@ class CreditmemoSender extends NotifySender
     protected $creditmemoResource;
 
     /**
-     * @var Renderer
+     * Global configuration storage.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface
      */
-    protected $addressRenderer;
+    protected $globalConfig;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var Renderer
      */
-    protected $loggerMock;
+    protected $addressRenderer;
 
     /**
      * @param Template $templateContainer
@@ -48,6 +50,7 @@ class CreditmemoSender extends NotifySender
      * @param \Psr\Log\LoggerInterface $logger
      * @param PaymentHelper $paymentHelper
      * @param CreditmemoResource $creditmemoResource
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
      * @param Renderer $addressRenderer
      */
     public function __construct(
@@ -57,50 +60,71 @@ class CreditmemoSender extends NotifySender
         \Psr\Log\LoggerInterface $logger,
         PaymentHelper $paymentHelper,
         CreditmemoResource $creditmemoResource,
+        \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig,
         Renderer $addressRenderer
     ) {
         parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger);
         $this->paymentHelper = $paymentHelper;
         $this->creditmemoResource = $creditmemoResource;
+        $this->globalConfig = $globalConfig;
         $this->addressRenderer = $addressRenderer;
     }
 
     /**
-     * Send email to customer
+     * Sends order creditmemo email to the customer.
+     *
+     * Email will be sent immediately in two cases:
+     *
+     * - if asynchronous email sending is disabled in global settings
+     * - if $forceSyncMode parameter is set to TRUE
+     *
+     * Otherwise, email will be sent later during running of
+     * corresponding cron job.
      *
      * @param Creditmemo $creditmemo
-     * @param bool $notify
-     * @param string $comment
+     * @param bool $forceSyncMode
      * @return bool
      */
-    public function send(Creditmemo $creditmemo, $notify = true, $comment = '')
+    public function send(Creditmemo $creditmemo, $forceSyncMode = false)
     {
-        $order = $creditmemo->getOrder();
-        if ($order->getShippingAddress()) {
-            $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
-        } else {
-            $formattedShippingAddress = '';
-        }
-        $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
-        $this->templateContainer->setTemplateVars(
-            [
-                'order' => $creditmemo->getOrder(),
-                'creditmemo' => $creditmemo,
-                'comment' => $comment,
-                'billing' => $order->getBillingAddress(),
-                'payment_html' => $this->getPaymentHtml($order),
-                'store' => $order->getStore(),
-                'formattedShippingAddress' => $formattedShippingAddress,
-                'formattedBillingAddress' => $formattedBillingAddress,
-            ]
-        );
+        $creditmemo->setSendEmail(true);
+
+        if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
+            $order = $creditmemo->getOrder();
+
+            if ($order->getShippingAddress()) {
+                $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
+            } else {
+                $formattedShippingAddress = '';
+            }
+
+            $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
+
+            $this->templateContainer->setTemplateVars(
+                [
+                    'order' => $order,
+                    'creditmemo' => $creditmemo,
+                    'comment' => $creditmemo->getCustomerNoteNotify() ? $creditmemo->getCustomerNote() : '',
+                    'billing' => $order->getBillingAddress(),
+                    'payment_html' => $this->getPaymentHtml($order),
+                    'store' => $order->getStore(),
+                    'formattedShippingAddress' => $formattedShippingAddress,
+                    'formattedBillingAddress' => $formattedBillingAddress,
+                ]
+            );
 
-        $result = $this->checkAndSend($order, $notify);
-        if ($result) {
-            $creditmemo->setEmailSent(true);
-            $this->creditmemoResource->saveAttribute($creditmemo, 'email_sent');
+            if ($this->checkAndSend($order)) {
+                $creditmemo->setEmailSent(true);
+
+                $this->creditmemoResource->saveAttribute($creditmemo, ['send_email', 'email_sent']);
+
+                return true;
+            }
         }
-        return $result;
+
+        $this->creditmemoResource->saveAttribute($creditmemo, 'send_email');
+
+        return false;
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php
index b26d038222bd8d66bfec6e23906e753ef786f59d..0796ff0443b198be2f4f2533e825fb8eca25c2f9 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php
@@ -9,15 +9,17 @@ use Magento\Payment\Helper\Data as PaymentHelper;
 use Magento\Sales\Model\Order;
 use Magento\Sales\Model\Order\Email\Container\InvoiceIdentity;
 use Magento\Sales\Model\Order\Email\Container\Template;
-use Magento\Sales\Model\Order\Email\NotifySender;
+use Magento\Sales\Model\Order\Email\Sender;
 use Magento\Sales\Model\Order\Invoice;
 use Magento\Sales\Model\Resource\Order\Invoice as InvoiceResource;
 use Magento\Sales\Model\Order\Address\Renderer;
 
 /**
  * Class InvoiceSender
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class InvoiceSender extends NotifySender
+class InvoiceSender extends Sender
 {
     /**
      * @var PaymentHelper
@@ -29,6 +31,13 @@ class InvoiceSender extends NotifySender
      */
     protected $invoiceResource;
 
+    /**
+     * Global configuration storage.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface
+     */
+    protected $globalConfig;
+
     /**
      * @var Renderer
      */
@@ -41,6 +50,7 @@ class InvoiceSender extends NotifySender
      * @param \Psr\Log\LoggerInterface $logger
      * @param PaymentHelper $paymentHelper
      * @param InvoiceResource $invoiceResource
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
      * @param Renderer $addressRenderer
      */
     public function __construct(
@@ -50,49 +60,70 @@ class InvoiceSender extends NotifySender
         \Psr\Log\LoggerInterface $logger,
         PaymentHelper $paymentHelper,
         InvoiceResource $invoiceResource,
+        \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig,
         Renderer $addressRenderer
     ) {
         parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger);
         $this->paymentHelper = $paymentHelper;
         $this->invoiceResource = $invoiceResource;
+        $this->globalConfig = $globalConfig;
         $this->addressRenderer = $addressRenderer;
     }
 
     /**
-     * Send email to customer
+     * Sends order invoice email to the customer.
+     *
+     * Email will be sent immediately in two cases:
+     *
+     * - if asynchronous email sending is disabled in global settings
+     * - if $forceSyncMode parameter is set to TRUE
+     *
+     * Otherwise, email will be sent later during running of
+     * corresponding cron job.
      *
      * @param Invoice $invoice
-     * @param bool $notify
-     * @param string $comment
+     * @param bool $forceSyncMode
      * @return bool
      */
-    public function send(Invoice $invoice, $notify = true, $comment = '')
+    public function send(Invoice $invoice, $forceSyncMode = false)
     {
-        $order = $invoice->getOrder();
-        if ($order->getShippingAddress()) {
-            $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
-        } else {
-            $formattedShippingAddress = '';
-        }
-        $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
-        $this->templateContainer->setTemplateVars(
-            [
-                'order' => $order,
-                'invoice' => $invoice,
-                'comment' => $comment,
-                'billing' => $order->getBillingAddress(),
-                'payment_html' => $this->getPaymentHtml($order),
-                'store' => $order->getStore(),
-                'formattedShippingAddress' => $formattedShippingAddress,
-                'formattedBillingAddress' => $formattedBillingAddress,
-            ]
-        );
-        $result = $this->checkAndSend($order, $notify);
-        if ($result) {
-            $invoice->setEmailSent(true);
-            $this->invoiceResource->saveAttribute($invoice, 'email_sent');
+        $invoice->setSendEmail(true);
+
+        if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
+            $order = $invoice->getOrder();
+
+            if ($order->getShippingAddress()) {
+                $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
+            } else {
+                $formattedShippingAddress = '';
+            }
+            $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
+            
+            $this->templateContainer->setTemplateVars(
+                [
+                    'order' => $order,
+                    'invoice' => $invoice,
+                    'comment' => $invoice->getCustomerNoteNotify() ? $invoice->getCustomerNote() : '',
+                    'billing' => $order->getBillingAddress(),
+                    'payment_html' => $this->getPaymentHtml($order),
+                    'store' => $order->getStore(),
+                    'formattedShippingAddress' => $formattedShippingAddress,
+                    'formattedBillingAddress' => $formattedBillingAddress
+                ]
+            );
+
+            if ($this->checkAndSend($order)) {
+                $invoice->setEmailSent(true);
+
+                $this->invoiceResource->saveAttribute($invoice, ['send_email', 'email_sent']);
+
+                return true;
+            }
         }
-        return $result;
+
+        $this->invoiceResource->saveAttribute($invoice, 'send_email');
+
+        return false;
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
index 9388270c7db300ea4f4de64b95eca3fa9ada02df..dc2d544d335bd35b9aa5c81327f272bb2c927872 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
@@ -28,6 +28,13 @@ class OrderSender extends Sender
      */
     protected $orderResource;
 
+    /**
+     * Global configuration storage.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface
+     */
+    protected $globalConfig;
+
     /**
      * @var Renderer
      */
@@ -40,6 +47,7 @@ class OrderSender extends Sender
      * @param \Psr\Log\LoggerInterface $logger
      * @param PaymentHelper $paymentHelper
      * @param OrderResource $orderResource
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
      * @param Renderer $addressRenderer
      */
     public function __construct(
@@ -49,28 +57,48 @@ class OrderSender extends Sender
         \Psr\Log\LoggerInterface $logger,
         PaymentHelper $paymentHelper,
         OrderResource $orderResource,
+        \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig,
         Renderer $addressRenderer
     ) {
         parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger);
         $this->paymentHelper = $paymentHelper;
         $this->orderResource = $orderResource;
+        $this->globalConfig = $globalConfig;
         $this->addressRenderer = $addressRenderer;
     }
 
     /**
-     * Send email to customer
+     * Sends order email to the customer.
+     *
+     * Email will be sent immediately in two cases:
+     *
+     * - if asynchronous email sending is disabled in global settings
+     * - if $forceSyncMode parameter is set to TRUE
+     *
+     * Otherwise, email will be sent later during running of
+     * corresponding cron job.
      *
      * @param Order $order
+     * @param bool $forceSyncMode
      * @return bool
      */
-    public function send(Order $order)
+    public function send(Order $order, $forceSyncMode = false)
     {
-        $result = $this->checkAndSend($order);
-        if ($result) {
-            $order->setEmailSent(true);
-            $this->orderResource->saveAttribute($order, 'email_sent');
+        $order->setSendEmail(true);
+
+        if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
+            if ($this->checkAndSend($order)) {
+                $order->setEmailSent(true);
+
+                $this->orderResource->saveAttribute($order, ['send_email', 'email_sent']);
+
+                return true;
+            }
         }
-        return $result;
+
+        $this->orderResource->saveAttribute($order, 'send_email');
+
+        return false;
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php
index 811f89496835862b32ef5300de1b844e67182e39..cedd82ae34d6426ed8fff4d60ff9a48565b8ca20 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php
@@ -9,15 +9,17 @@ use Magento\Payment\Helper\Data as PaymentHelper;
 use Magento\Sales\Model\Order;
 use Magento\Sales\Model\Order\Email\Container\ShipmentIdentity;
 use Magento\Sales\Model\Order\Email\Container\Template;
-use Magento\Sales\Model\Order\Email\NotifySender;
+use Magento\Sales\Model\Order\Email\Sender;
 use Magento\Sales\Model\Order\Shipment;
 use Magento\Sales\Model\Resource\Order\Shipment as ShipmentResource;
 use Magento\Sales\Model\Order\Address\Renderer;
 
 /**
  * Class ShipmentSender
+ * 
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class ShipmentSender extends NotifySender
+class ShipmentSender extends Sender
 {
     /**
      * @var PaymentHelper
@@ -29,6 +31,13 @@ class ShipmentSender extends NotifySender
      */
     protected $shipmentResource;
 
+    /**
+     * Global configuration storage.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface
+     */
+    protected $globalConfig;
+
     /**
      * @var Renderer
      */
@@ -41,6 +50,7 @@ class ShipmentSender extends NotifySender
      * @param \Psr\Log\LoggerInterface $logger
      * @param PaymentHelper $paymentHelper
      * @param ShipmentResource $shipmentResource
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
      * @param Renderer $addressRenderer
      */
     public function __construct(
@@ -50,49 +60,70 @@ class ShipmentSender extends NotifySender
         \Psr\Log\LoggerInterface $logger,
         PaymentHelper $paymentHelper,
         ShipmentResource $shipmentResource,
+        \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig,
         Renderer $addressRenderer
     ) {
         parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger);
         $this->paymentHelper = $paymentHelper;
         $this->shipmentResource = $shipmentResource;
+        $this->globalConfig = $globalConfig;
         $this->addressRenderer = $addressRenderer;
     }
 
     /**
-     * Send email to customer
+     * Sends order shipment email to the customer.
+     *
+     * Email will be sent immediately in two cases:
+     *
+     * - if asynchronous email sending is disabled in global settings
+     * - if $forceSyncMode parameter is set to TRUE
+     *
+     * Otherwise, email will be sent later during running of
+     * corresponding cron job.
      *
      * @param Shipment $shipment
-     * @param bool $notify
-     * @param string $comment
+     * @param bool $forceSyncMode
      * @return bool
      */
-    public function send(Shipment $shipment, $notify = true, $comment = '')
+    public function send(Shipment $shipment, $forceSyncMode = false)
     {
-        $order = $shipment->getOrder();
-        if ($order->getShippingAddress()) {
-            $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
-        } else {
-            $formattedShippingAddress = '';
-        }
-        $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
-        $this->templateContainer->setTemplateVars(
-            [
-                'order' => $order,
-                'shipment' => $shipment,
-                'comment' => $comment,
-                'billing' => $order->getBillingAddress(),
-                'payment_html' => $this->getPaymentHtml($order),
-                'store' => $order->getStore(),
-                'formattedShippingAddress' => $formattedShippingAddress,
-                'formattedBillingAddress' => $formattedBillingAddress,
-            ]
-        );
-        $result = $this->checkAndSend($order, $notify);
-        if ($result) {
-            $shipment->setEmailSent(true);
-            $this->shipmentResource->saveAttribute($shipment, 'email_sent');
+        $shipment->setSendEmail(true);
+
+        if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
+            $order = $shipment->getOrder();
+
+            if ($order->getShippingAddress()) {
+                $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
+            } else {
+                $formattedShippingAddress = '';
+            }
+            $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
+
+            $this->templateContainer->setTemplateVars(
+                [
+                    'order' => $order,
+                    'shipment' => $shipment,
+                    'comment' => $shipment->getCustomerNoteNotify() ? $shipment->getCustomerNote() : '',
+                    'billing' => $order->getBillingAddress(),
+                    'payment_html' => $this->getPaymentHtml($order),
+                    'store' => $order->getStore(),
+                    'formattedShippingAddress' => $formattedShippingAddress,
+                    'formattedBillingAddress' => $formattedBillingAddress
+                ]
+            );
+
+            if ($this->checkAndSend($order)) {
+                $shipment->setEmailSent(true);
+
+                $this->shipmentResource->saveAttribute($shipment, ['send_email', 'email_sent']);
+
+                return true;
+            }
         }
-        return $result;
+
+        $this->shipmentResource->saveAttribute($shipment, 'send_email');
+
+        return false;
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php
index d88dfa1d8850a2fd04018895cb9c4417ed041c41..8317b7041d61f3e747af2b644050854b3b55174d 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice.php
@@ -12,6 +12,11 @@ use Magento\Sales\Model\EntityInterface;
 
 /**
  * @method \Magento\Sales\Model\Order\Invoice setCreatedAt(string $value)
+ * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value)
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value)
+ * @method string getCustomerNote()
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value)
+ * @method bool getCustomerNoteNotify()
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php
index ec3a0561cf262bb577f4f3a9e6f381b1ca121566..3472e9663ad337ceb64c7399b06a60e389883708 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment.php
@@ -16,6 +16,11 @@ use Magento\Sales\Model\EntityInterface;
  * @method \Magento\Sales\Model\Resource\Order\Shipment _getResource()
  * @method \Magento\Sales\Model\Resource\Order\Shipment getResource()
  * @method \Magento\Sales\Model\Order\Shipment setCreatedAt(string $value)
+ * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value)
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value)
+ * @method string getCustomerNote()
+ * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value)
+ * @method bool getCustomerNoteNotify()
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  */
diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php
index e4c43d87676778164d099ad8699467373810250a..93192e49bb663de74eaf6f9c87948ed058a649a4 100644
--- a/app/code/Magento/Sales/Setup/InstallSchema.php
+++ b/app/code/Magento/Sales/Setup/InstallSchema.php
@@ -876,15 +876,13 @@ class InstallSchema implements InstallSchemaInterface
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->addForeignKey(
             $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Order'
         );
@@ -1037,22 +1035,19 @@ class InstallSchema implements InstallSchemaInterface
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->addForeignKey(
             $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'),
             'entity_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Order Grid'
         );
@@ -1197,7 +1192,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Order Address'
@@ -1314,13 +1308,13 @@ class InstallSchema implements InstallSchemaInterface
             'created_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
             'Created At'
         )->addColumn(
             'updated_at',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
-            ['nullable' => false],
+            ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
             'Updated At'
         )->addColumn(
             'product_id',
@@ -1699,15 +1693,13 @@ class InstallSchema implements InstallSchemaInterface
             'order_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Order Item'
         );
@@ -2050,7 +2042,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Order Payment'
@@ -2180,15 +2171,13 @@ class InstallSchema implements InstallSchemaInterface
             'order_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Shipment'
         );
@@ -2296,15 +2285,13 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('sales_shipment'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Shipment Grid'
         );
@@ -2395,7 +2382,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_shipment'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Shipment Item'
@@ -2487,7 +2473,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_shipment'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Shipment Track'
@@ -2546,7 +2531,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_shipment'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Shipment Comment'
@@ -2850,15 +2834,13 @@ class InstallSchema implements InstallSchemaInterface
             'order_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Invoice'
         );
@@ -2996,15 +2978,13 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('sales_invoice'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Invoice Grid'
         );
@@ -3173,7 +3153,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_invoice'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Invoice Item'
@@ -3232,7 +3211,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_invoice'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Invoice Comment'
@@ -3560,15 +3538,13 @@ class InstallSchema implements InstallSchemaInterface
             'order_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Creditmemo'
         );
@@ -3748,15 +3724,13 @@ class InstallSchema implements InstallSchemaInterface
             'entity_id',
             $installer->getTable('sales_creditmemo'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Flat Creditmemo Grid'
         );
@@ -3925,7 +3899,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_creditmemo'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Creditmemo Item'
@@ -3984,7 +3957,6 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_creditmemo'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Flat Creditmemo Comment'
@@ -4066,8 +4038,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Invoiced Aggregated'
         );
@@ -4148,8 +4119,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Invoiced Aggregated Order'
         );
@@ -4296,8 +4266,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Order Aggregated Created'
         );
@@ -4394,7 +4363,6 @@ class InstallSchema implements InstallSchemaInterface
             'order_id',
             $installer->getTable('sales_order'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -4406,14 +4374,12 @@ class InstallSchema implements InstallSchemaInterface
             'parent_id',
             $installer->getTable('sales_payment_transaction'),
             'transaction_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'),
             'payment_id',
             $installer->getTable('sales_order_payment'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Payment Transaction'
@@ -4489,8 +4455,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Refunded Aggregated'
         );
@@ -4565,8 +4530,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Refunded Aggregated Order'
         );
@@ -4641,8 +4605,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Shipping Aggregated'
         );
@@ -4717,8 +4680,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Sales Shipping Aggregated Order'
         );
@@ -4796,7 +4758,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -4808,7 +4769,6 @@ class InstallSchema implements InstallSchemaInterface
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Bestsellers Aggregated Daily'
@@ -4887,7 +4847,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -4899,7 +4858,6 @@ class InstallSchema implements InstallSchemaInterface
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Bestsellers Aggregated Monthly'
@@ -4978,7 +4936,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -4990,7 +4947,6 @@ class InstallSchema implements InstallSchemaInterface
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Bestsellers Aggregated Yearly'
@@ -5138,7 +5094,6 @@ class InstallSchema implements InstallSchemaInterface
             'status',
             $installer->getTable('sales_order_status'),
             'status',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Order Status Table'
@@ -5176,14 +5131,12 @@ class InstallSchema implements InstallSchemaInterface
             'status',
             $installer->getTable('sales_order_status'),
             'status',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Order Status Label Table'
diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php
index b1178f1268f0dc446d252882798158ce8920ad11..99823503bd2e1abe1ba888584a5d47885e66de6e 100644
--- a/app/code/Magento/Sales/Setup/UpgradeSchema.php
+++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php
@@ -20,6 +20,7 @@ class UpgradeSchema implements UpgradeSchemaInterface
      * {@inheritdoc}
      * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+     * @SuppressWarnings(PHPMD.NPathComplexity)
      */
     public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
     {
@@ -111,6 +112,7 @@ class UpgradeSchema implements UpgradeSchemaInterface
                     );
             }
         }
+
         if (version_compare($context->getVersion(), '2.0.3') < 0) {
             $dropIncrementIndexTables = [
                 'sales_creditmemo',
@@ -155,5 +157,79 @@ class UpgradeSchema implements UpgradeSchemaInterface
                 );
             }
         }
+
+        if (version_compare($context->getVersion(), '2.0.4') < 0) {
+
+            /**
+             * Adding 'send_email' columns.
+             */
+
+            $tables = ['sales_order', 'sales_invoice', 'sales_shipment', 'sales_creditmemo'];
+
+            foreach ($tables as $table) {
+                $table = $setup->getTable($table);
+
+                $setup->getConnection()
+                    ->addColumn(
+                        $table,
+                        'send_email',
+                        [
+                            'type' => Table::TYPE_SMALLINT,
+                            'after' => 'email_sent',
+                            'comment' => 'Send Email',
+                            'unsigned' => true
+                        ]
+                    );
+
+                $setup->getConnection()
+                    ->addIndex($table, $setup->getIdxName($table, ['email_sent']), 'email_sent');
+
+                $setup->getConnection()
+                    ->addIndex($table, $setup->getIdxName($table, ['send_email']), 'send_email');
+            }
+
+            /**
+             * Adding 'customer_note' columns.
+             */
+
+            $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo'];
+
+            foreach ($tables as $table) {
+                $table = $setup->getTable($table);
+
+                $setup->getConnection()
+                    ->addColumn(
+                        $table,
+                        'customer_note',
+                        [
+                            'type' => Table::TYPE_TEXT,
+                            'after' => 'updated_at',
+                            'comment' => 'Customer Note'
+                        ]
+                    );
+            }
+
+            /**
+             * Adding 'customer_note_notify' columns.
+             */
+
+            $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo'];
+
+            foreach ($tables as $table) {
+                $table = $setup->getTable($table);
+
+                $setup->getConnection()
+                    ->addColumn(
+                        $table,
+                        'customer_note_notify',
+                        [
+                            'type' => Table::TYPE_SMALLINT,
+                            'after' => 'customer_note',
+                            'comment' => 'Customer Note Notify',
+                            'unsigned' => true
+                        ]
+                    );
+            }
+        }
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php b/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..69f3f6e0df310d27dc7c7c6774ad5a62ca1e82cb
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Sales\Test\Unit\Model\Config\Backend\Email;
+
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+
+/**
+ * Unit test of backend model for global configuration value
+ * 'sales_email/general/async_sending'.
+ */
+class AsyncSendingTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Sales\Model\Config\Backend\Email\AsyncSending
+     */
+    protected $object;
+
+    /**
+     * @var \Magento\Framework\App\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $config;
+
+    /**
+     * @var \Magento\Framework\Model\Context|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $context;
+
+    /**
+     * @var \Magento\Framework\Event\Manager\Proxy|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventManager;
+
+    protected function setUp()
+    {
+        $objectManager = new ObjectManager($this);
+
+        $this->config = $this->getMock('Magento\Framework\App\Config', [], [], '', false);
+
+        $this->eventManager = $this->getMock('Magento\Framework\Event\Manager\Proxy', [], [], '', false);
+
+        $this->context = $this->getMock('Magento\Framework\Model\Context', ['getEventDispatcher'], [], '', false);
+        $this->context->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventManager);
+
+        $this->object = $objectManager->getObject(
+            '\Magento\Sales\Model\Config\Backend\Email\AsyncSending',
+            [
+                'config' => $this->config,
+                'context' => $this->context
+            ]
+        );
+    }
+
+    /**
+     * @param int $value
+     * @param int $oldValue
+     * @param string $eventName
+     * @dataProvider afterSaveDataProvider
+     * @return void
+     */
+    public function testAfterSave($value, $oldValue, $eventName)
+    {
+        $path = 'sales_email/general/async_sending';
+        $scope = \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT;
+
+        $this->object->setData(['value' => $value, 'path' => $path, 'scope' => $scope]);
+
+        $this->config->expects($this->once())->method('getValue')->with($path, $scope)->willReturn($oldValue);
+
+        if ($value == $oldValue) {
+            $this->eventManager->expects($this->never())->method('dispatch');
+        } else {
+            $this->eventManager->expects($this->once())->method('dispatch')->with($eventName);
+        }
+
+        $this->object->afterSave();
+    }
+
+    /**
+     * @return array
+     */
+    public function afterSaveDataProvider()
+    {
+        return [
+            [0, 0, null],
+            [1, 1, null],
+            [0, 1, 'config_data_sales_email_general_async_sending_disabled'],
+            [1, 0, 'config_data_sales_email_general_async_sending_enabled']
+        ];
+    }
+}
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php b/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b3e4a9905a17f761eb6b763df933dabf5630d6b
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php
@@ -0,0 +1,184 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Sales\Test\Unit\Model\Observer;
+
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+
+/**
+ * Unit test of sales emails sending observer.
+ */
+class SendEmailsTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Subject of testing.
+     *
+     * @var \Magento\Sales\Model\Observer\SendEmails
+     */
+    protected $object;
+
+    /**
+     * Email sender model mock.
+     *
+     * @var \Magento\Sales\Model\Order\Email\Sender|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $emailSender;
+
+    /**
+     * Entity resource model mock.
+     *
+     * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $entityResource;
+
+    /**
+     * Entity collection model mock.
+     *
+     * @var \Magento\Sales\Model\Resource\Collection\AbstractCollection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $entityCollection;
+
+    /**
+     * Global configuration storage mock.
+     *
+     * @var \Magento\Framework\App\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $globalConfig;
+
+    protected function setUp()
+    {
+        $objectManager = new ObjectManager($this);
+
+        $this->emailSender = $this->getMock(
+            'Magento\Sales\Model\Order\Email\Sender',
+            ['send'],
+            [],
+            '',
+            false
+        );
+
+        $this->entityResource = $this->getMockForAbstractClass(
+            'Magento\Sales\Model\Resource\EntityAbstract',
+            [],
+            '',
+            false,
+            false,
+            true,
+            ['save']
+        );
+
+        $this->entityCollection = $this->getMockForAbstractClass(
+            'Magento\Sales\Model\Resource\Collection\AbstractCollection',
+            [],
+            '',
+            false,
+            false,
+            true,
+            ['addFieldToFilter', 'getItems']
+        );
+
+        $this->globalConfig = $this->getMock(
+            'Magento\Framework\App\Config',
+            [],
+            [],
+            '',
+            false
+        );
+
+        $this->object = $objectManager->getObject(
+            'Magento\Sales\Model\Observer\SendEmails',
+            [
+                'emailSender' => $this->emailSender,
+                'entityResource' => $this->entityResource,
+                'entityCollection' => $this->entityCollection,
+                'globalConfig' => $this->globalConfig
+            ]
+        );
+    }
+
+    /**
+     * @param int $configValue
+     * @param array|null $collectionItems
+     * @param bool|null $emailSendingResult
+     * @dataProvider executeDataProvider
+     * @return void
+     */
+    public function testExecute($configValue, $collectionItems, $emailSendingResult)
+    {
+        $path = 'sales_email/general/async_sending';
+
+        $this->globalConfig
+            ->expects($this->once())
+            ->method('getValue')
+            ->with($path)
+            ->willReturn($configValue);
+
+        if ($configValue) {
+            $this->entityCollection
+                ->expects($this->at(0))
+                ->method('addFieldToFilter')
+                ->with('send_email', ['eq' => 1]);
+
+            $this->entityCollection
+                ->expects($this->at(1))
+                ->method('addFieldToFilter')
+                ->with('email_sent', ['null' => true]);
+
+            $this->entityCollection
+                ->expects($this->any())
+                ->method('getItems')
+                ->willReturn($collectionItems);
+
+            if ($collectionItems) {
+                /** @var \Magento\Sales\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject $collectionItem */
+                $collectionItem = $collectionItems[0];
+
+                $this->emailSender
+                    ->expects($this->once())
+                    ->method('send')
+                    ->with($collectionItem, true)
+                    ->willReturn($emailSendingResult);
+
+                if ($emailSendingResult) {
+                    $collectionItem
+                        ->expects($this->once())
+                        ->method('setEmailSent')
+                        ->with(true)
+                        ->willReturn($collectionItem);
+
+                    $this->entityResource
+                        ->expects($this->once())
+                        ->method('save')
+                        ->with($collectionItem);
+                }
+            }
+        }
+
+        $this->object->execute();
+    }
+
+    /**
+     * @return array
+     */
+    public function executeDataProvider()
+    {
+        $entityModel = $this->getMockForAbstractClass(
+            'Magento\Sales\Model\AbstractModel',
+            [],
+            '',
+            false,
+            false,
+            true,
+            ['setEmailSent']
+        );
+
+        return [
+            [1, [$entityModel], true],
+            [1, [$entityModel], false],
+            [1, [], null],
+            [0, null, null]
+        ];
+    }
+}
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php
index afcf792c718dddc69eab5e23a17923b32a8e8a9c..0673aa120a217ae4daa1d549b441a2969c510d81 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php
@@ -264,43 +264,53 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         $this->assertInstanceOf('Magento\Sales\Model\Order\Creditmemo\Item', $result);
     }
 
-    public function testCalcRowTotal()
+    /**
+     * @dataProvider calcRowTotalDataProvider
+     */
+    public function testCalcRowTotal($qty)
     {
         $creditmemoMock = $this->getMockBuilder('\Magento\Sales\Model\Order\Creditmemo')
             ->disableOriginalConstructor()
             ->getMock();
         $creditmemoMock->expects($this->exactly(4))
             ->method('roundPrice')
-            ->willReturnMap(
-                [
-                    [0.375, 'regular', false, 0.4],
-                    [0.375, 'base', false, 0.4],
-                    [1, 'including', false, 1.0],
-                    [1, 'including_base', false, 1.0]
-                ]
-            );
+            ->will($this->returnCallback(
+                function ($arg) {
+                    return round($arg, 2);
+                }
+            ));
+
+        $qtyInvoiced = 10;
+        $qtyRefunded = 2;
+        $qtyAvailable = $qtyInvoiced - $qtyRefunded;
+
+        $rowInvoiced = 5;
+        $amountRefunded = 2;
+
+        $expectedRowTotal = ($rowInvoiced - $amountRefunded) / $qtyAvailable * $qty;
+        $expectedRowTotal = round($expectedRowTotal, 2);
 
         $orderItemMock = $this->getMockBuilder('Magento\Sales\Model\Order\Item')
             ->disableOriginalConstructor()
             ->getMock();
         $orderItemMock->expects($this->once())
             ->method('getQtyInvoiced')
-            ->willReturn(10);
+            ->willReturn($qtyInvoiced);
         $orderItemMock->expects($this->once())
             ->method('getQtyRefunded')
-            ->willReturn(2);
+            ->willReturn($qtyRefunded);
         $orderItemMock->expects($this->once())
             ->method('getRowInvoiced')
-            ->willReturn(5);
+            ->willReturn($rowInvoiced);
         $orderItemMock->expects($this->once())
             ->method('getAmountRefunded')
-            ->willReturn(2);
+            ->willReturn($amountRefunded);
         $orderItemMock->expects($this->once())
             ->method('getBaseRowInvoiced')
-            ->willReturn(5);
+            ->willReturn($rowInvoiced);
         $orderItemMock->expects($this->once())
             ->method('getBaseAmountRefunded')
-            ->willReturn(2);
+            ->willReturn($amountRefunded);
         $orderItemMock->expects($this->once())
             ->method('getRowTotalInclTax')
             ->willReturn(1);
@@ -313,11 +323,28 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         $orderItemMock->expects($this->once())
             ->method('getQtyOrdered')
             ->willReturn(1);
+        $orderItemMock->expects($this->any())
+            ->method('getQtyToRefund')
+            ->willReturn($qtyAvailable);
 
-        $this->item->setData('qty', 1);
+        $this->item->setData('qty', $qty);
         $this->item->setCreditmemo($creditmemoMock);
         $this->item->setOrderItem($orderItemMock);
         $result = $this->item->calcRowTotal();
+
         $this->assertInstanceOf('Magento\Sales\Model\Order\Creditmemo\Item', $result);
+        $this->assertEquals($expectedRowTotal, $this->item->getData('row_total'));
+        $this->assertEquals($expectedRowTotal, $this->item->getData('base_row_total'));
+    }
+
+    /**
+     * @return array
+     */
+    public function calcRowTotalDataProvider()
+    {
+        return [
+            'qty 1' => [1],
+            'qty 0' => [0],
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php
index f57cac671fa583cd989e9251664ad6a1113a3c7d..cd70e51424497d16585475b55edaab6d526e7cef 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php
@@ -10,6 +10,11 @@ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender;
  */
 abstract class AbstractSenderTest extends \PHPUnit_Framework_TestCase
 {
+    /**
+     * @var \Magento\Sales\Model\Order\Email\Sender|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $senderMock;
+
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
@@ -36,12 +41,24 @@ abstract class AbstractSenderTest extends \PHPUnit_Framework_TestCase
     protected $orderMock;
 
     /**
-     * @var \Magento\Sales\Model\Order\Address\Renderer | \PHPUnit_Framework_MockObject_MockObject
+     * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $addressRendererMock;
+    protected $paymentHelper;
 
     /**
-     * @var \Magento\Sales\Model\Order\Address | \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Order\Address\Renderer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $addressRenderer;
+
+    /**
+     * Global configuration storage mock.
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $globalConfig;
+
+    /**
+     * @var \Magento\Sales\Model\Order\Address|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $addressMock;
 
@@ -52,6 +69,14 @@ abstract class AbstractSenderTest extends \PHPUnit_Framework_TestCase
 
     public function stepMockSetup()
     {
+        $this->senderMock = $this->getMock(
+            'Magento\Sales\Model\Order\Email\Sender',
+            ['send', 'sendCopyTo'],
+            [],
+            '',
+            false
+        );
+
         $this->senderBuilderFactoryMock = $this->getMock(
             '\Magento\Sales\Model\Order\Email\SenderBuilderFactory',
             ['create'],
@@ -77,20 +102,46 @@ abstract class AbstractSenderTest extends \PHPUnit_Framework_TestCase
 
         $this->orderMock = $this->getMock(
             '\Magento\Sales\Model\Order',
-            [],
+            [
+                'getStore', 'getBillingAddress', 'getPayment',
+                '__wakeup', 'getCustomerIsGuest', 'getCustomerName',
+                'getCustomerEmail', 'getShippingAddress', 'setSendEmail',
+                'setEmailSent'
+            ],
             [],
             '',
             false
         );
-
         $this->orderMock->expects($this->any())
             ->method('getStore')
             ->will($this->returnValue($this->storeMock));
+        $paymentInfoMock = $this->getMock(
+            '\Magento\Payment\Model\Info',
+            [],
+            [],
+            '',
+            false
+        );
+        $this->orderMock->expects($this->any())
+            ->method('getPayment')
+            ->will($this->returnValue($paymentInfoMock));
 
-
-        $this->addressRendererMock = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false);
+        $this->addressRenderer = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false);
         $this->addressMock = $this->getMock('Magento\Sales\Model\Order\Address', [], [], '', false);
-        $this->addressRendererMock->expects($this->any())->method('format')->willReturn(1);
+
+        $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false);
+        $this->paymentHelper->expects($this->any())
+            ->method('getInfoBlockHtml')
+            ->will($this->returnValue('payment'));
+
+        $this->globalConfig = $this->getMock(
+            'Magento\Framework\App\Config',
+            ['getValue'],
+            [],
+            '',
+            false
+        );
+
         $this->loggerMock = $this->getMock(
             '\Psr\Log\LoggerInterface',
             [],
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php
index c15aed06c125e85fe4732a483105522167522fde..977ded72038ee29f205fa6981c1f534dfdae6120 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php
@@ -26,6 +26,7 @@ class CreditmemoCommentSenderTest extends AbstractSenderTest
     {
         $this->stepMockSetup();
         $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity');
+        $this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
         $this->creditmemoMock = $this->getMock(
             '\Magento\Sales\Model\Order\Creditmemo',
             ['getStore', '__wakeup', 'getOrder'],
@@ -44,7 +45,7 @@ class CreditmemoCommentSenderTest extends AbstractSenderTest
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
-            $this->addressRendererMock
+            $this->addressRenderer
         );
     }
 
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php
index eff59e2afe8a99999fb54d326754148fd7192968..cfe7bfc22e54f51db6edc23e02859488612fd11b 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php
@@ -5,7 +5,7 @@
  */
 namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender;
 
-use \Magento\Sales\Model\Order\Email\Sender\CreditmemoSender;
+use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender;
 
 class CreditmemoSenderTest extends AbstractSenderTest
 {
@@ -15,52 +15,34 @@ class CreditmemoSenderTest extends AbstractSenderTest
     protected $sender;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Order\Creditmemo|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $creditmemoMock;
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $paymentHelper;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $creditmemoResource;
+    protected $creditmemoResourceMock;
 
-    /**
-     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
-     */
     protected function setUp()
     {
         $this->stepMockSetup();
-        $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false);
-        $this->paymentHelper->expects($this->any())
-            ->method('getInfoBlockHtml')
-            ->will($this->returnValue('payment'));
 
-        $this->creditmemoResource = $this->getMock(
+        $this->creditmemoResourceMock = $this->getMock(
             '\Magento\Sales\Model\Resource\Order\Creditmemo',
-            [],
+            ['saveAttribute'],
             [],
             '',
             false
         );
-        $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity');
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
 
         $this->creditmemoMock = $this->getMock(
             '\Magento\Sales\Model\Order\Creditmemo',
-            ['getStore', '__wakeup', 'getOrder'],
+            [
+                'getStore', '__wakeup', 'getOrder',
+                'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify',
+                'getCustomerNote'
+            ],
             [],
             '',
             false
@@ -71,95 +53,156 @@ class CreditmemoSenderTest extends AbstractSenderTest
         $this->creditmemoMock->expects($this->any())
             ->method('getOrder')
             ->will($this->returnValue($this->orderMock));
+
+        $this->identityContainerMock = $this->getMock(
+            '\Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity',
+            ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'],
+            [],
+            '',
+            false
+        );
+        $this->identityContainerMock->expects($this->any())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
+
         $this->sender = new CreditmemoSender(
             $this->templateContainerMock,
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
             $this->paymentHelper,
-            $this->creditmemoResource,
-            $this->addressRendererMock
+            $this->creditmemoResourceMock,
+            $this->globalConfig,
+            $this->addressRenderer
         );
     }
 
-    public function testSendFalse()
-    {
-        $this->stepAddressFormat($this->addressMock);
-        $result = $this->sender->send($this->creditmemoMock);
-        $this->assertFalse($result);
-    }
-
-    public function testSendTrueWithCustomerCopy()
+    /**
+     * @param int $configValue
+     * @param bool|null $forceSyncMode
+     * @param bool|null $customerNoteNotify
+     * @param bool|null $emailSendingResult
+     * @dataProvider sendDataProvider
+     * @return void
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult)
     {
-        $billingAddress = $this->addressMock;
-        $this->stepAddressFormat($this->addressMock);
         $comment = 'comment_test';
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
+        $address = 'address_test';
+        $configPath = 'sales_email/general/async_sending';
+
+        $this->creditmemoMock->expects($this->once())
+            ->method('setSendEmail')
+            ->with(true);
+
+        $this->globalConfig->expects($this->once())
+            ->method('getValue')
+            ->with($configPath)
+            ->willReturn($configValue);
+
+        if (!$configValue || $forceSyncMode) {
+            $addressMock = $this->getMock(
+                'Magento\Sales\Model\Order\Address',
+                [],
+                [],
+                '',
+                false
+            );
+
+            $this->addressRenderer->expects($this->any())
+                ->method('format')
+                ->with($addressMock, 'html')
+                ->willReturn($address);
+
+            $this->orderMock->expects($this->any())
+                ->method('getBillingAddress')
+                ->willReturn($addressMock);
+
+            $this->orderMock->expects($this->any())
+                ->method('getShippingAddress')
+                ->willReturn($addressMock);
+
+            $this->creditmemoMock->expects($this->once())
+                ->method('getCustomerNoteNotify')
+                ->willReturn($customerNoteNotify);
+
+            $this->creditmemoMock->expects($this->any())
+                ->method('getCustomerNote')
+                ->willReturn($comment);
+
+            $this->templateContainerMock->expects($this->once())
+                ->method('setTemplateVars')
+                ->with(
                     [
                         'order' => $this->orderMock,
                         'creditmemo' => $this->creditmemoMock,
-                        'comment' => $comment,
-                        'billing' => $billingAddress,
+                        'comment' => $customerNoteNotify ? $comment : '',
+                        'billing' => $addressMock,
                         'payment_html' => 'payment',
                         'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
+                        'formattedShippingAddress' => $address,
+                        'formattedBillingAddress' => $address
                     ]
-                )
+                );
+
+            $this->identityContainerMock->expects($this->once())
+                ->method('isEnabled')
+                ->willReturn($emailSendingResult);
+
+            if ($emailSendingResult) {
+                $this->senderBuilderFactoryMock->expects($this->once())
+                    ->method('create')
+                    ->willReturn($this->senderMock);
+
+                $this->senderMock->expects($this->once())->method('send');
+
+                $this->senderMock->expects($this->once())->method('sendCopyTo');
+
+                $this->creditmemoMock->expects($this->once())
+                    ->method('setEmailSent')
+                    ->with(true);
+
+                $this->creditmemoResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->creditmemoMock, ['send_email', 'email_sent']);
+
+                $this->assertTrue(
+                    $this->sender->send($this->creditmemoMock)
+                );
+            } else {
+                $this->creditmemoResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->creditmemoMock, 'send_email');
+
+                $this->assertFalse(
+                    $this->sender->send($this->creditmemoMock)
+                );
+            }
+        } else {
+            $this->creditmemoResourceMock->expects($this->once())
+                ->method('saveAttribute')
+                ->with($this->creditmemoMock, 'send_email');
+
+            $this->assertFalse(
+                $this->sender->send($this->creditmemoMock)
             );
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
-        $this->stepSendWithoutSendCopy();
-        $result = $this->sender->send($this->creditmemoMock, true, $comment);
-        $this->assertTrue($result);
+        }
     }
 
-    public function testSendTrueWithoutCustomerCopy()
+    /**
+     * @return array
+     */
+    public function sendDataProvider()
     {
-        $billingAddress = $this->addressMock;
-        $this->stepAddressFormat($billingAddress);
-        $comment = 'comment_test';
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
-                    [
-                        'order' => $this->orderMock,
-                        'creditmemo' => $this->creditmemoMock,
-                        'billing' => $billingAddress,
-                        'payment_html' => 'payment',
-                        'comment' => $comment,
-                        'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
-                    ]
-                )
-            );
-        $this->stepSendWithCallSendCopyTo();
-        $result = $this->sender->send($this->creditmemoMock, false, $comment);
-        $this->assertTrue($result);
+        return [
+            [0, 0, 1, true],
+            [0, 0, 0, true],
+            [0, 0, 1, false],
+            [0, 0, 0, false],
+            [0, 1, 1, true],
+            [0, 1, 0, true],
+            [1, null, null, null]
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php
index 28888804481dc704bff9ca1455c25688db95fb84..30b838341b5ce16a3d733839f911ee1014c2ccfe 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php
@@ -40,6 +40,8 @@ class InvoiceCommentSenderTest extends AbstractSenderTest
 
         $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity');
 
+        $this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
+
         $this->invoiceMock = $this->getMock(
             '\Magento\Sales\Model\Order\Invoice',
             ['getStore', '__wakeup', 'getOrder'],
@@ -59,7 +61,7 @@ class InvoiceCommentSenderTest extends AbstractSenderTest
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
-            $this->addressRendererMock
+            $this->addressRenderer
         );
     }
 
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php
index 3cb4e27fc43121dec895f70e6e436bbebac6c58f..35cb0e84b6566f2e74c0f17f20d918e8a88945a9 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php
@@ -5,7 +5,7 @@
  */
 namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender;
 
-use \Magento\Sales\Model\Order\Email\Sender\InvoiceSender;
+use Magento\Sales\Model\Order\Email\Sender\InvoiceSender;
 
 class InvoiceSenderTest extends AbstractSenderTest
 {
@@ -15,54 +15,34 @@ class InvoiceSenderTest extends AbstractSenderTest
     protected $sender;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Order\Invoice|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $invoiceMock;
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $paymentHelper;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $invoiceResource;
+    protected $invoiceResourceMock;
 
-    /**
-     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
-     */
     protected function setUp()
     {
         $this->stepMockSetup();
-        $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false);
-        $this->paymentHelper->expects($this->any())
-            ->method('getInfoBlockHtml')
-            ->will($this->returnValue('payment'));
 
-        $this->invoiceResource = $this->getMock(
+        $this->invoiceResourceMock = $this->getMock(
             '\Magento\Sales\Model\Resource\Order\Invoice',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\InvoiceIdentity');
-
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
+            ['saveAttribute'],
             [],
             '',
             false
         );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
 
         $this->invoiceMock = $this->getMock(
             '\Magento\Sales\Model\Order\Invoice',
-            ['getStore', '__wakeup', 'getOrder'],
+            [
+                'getStore', '__wakeup', 'getOrder',
+                'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify',
+                'getCustomerNote'
+            ],
             [],
             '',
             false
@@ -74,100 +54,155 @@ class InvoiceSenderTest extends AbstractSenderTest
             ->method('getOrder')
             ->will($this->returnValue($this->orderMock));
 
+        $this->identityContainerMock = $this->getMock(
+            '\Magento\Sales\Model\Order\Email\Container\InvoiceIdentity',
+            ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'],
+            [],
+            '',
+            false
+        );
+        $this->identityContainerMock->expects($this->any())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
+
         $this->sender = new InvoiceSender(
             $this->templateContainerMock,
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
             $this->paymentHelper,
-            $this->invoiceResource,
-            $this->addressRendererMock
+            $this->invoiceResourceMock,
+            $this->globalConfig,
+            $this->addressRenderer
         );
     }
 
-    public function testSendFalse()
-    {
-        $billingAddress = $this->addressMock;
-        $this->stepAddressFormat($billingAddress);
-        $result = $this->sender->send($this->invoiceMock);
-        $this->assertFalse($result);
-    }
-
-    public function testSendTrueWithCustomerCopy()
+    /**
+     * @param int $configValue
+     * @param bool|null $forceSyncMode
+     * @param bool|null $customerNoteNotify
+     * @param bool|null $emailSendingResult
+     * @dataProvider sendDataProvider
+     * @return void
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult)
     {
-        $billingAddress = $this->addressMock;
-        $this->stepAddressFormat($billingAddress);
         $comment = 'comment_test';
+        $address = 'address_test';
+        $configPath = 'sales_email/general/async_sending';
+
+        $this->invoiceMock->expects($this->once())
+            ->method('setSendEmail')
+            ->with(true);
+
+        $this->globalConfig->expects($this->once())
+            ->method('getValue')
+            ->with($configPath)
+            ->willReturn($configValue);
+
+        if (!$configValue || $forceSyncMode) {
+            $addressMock = $this->getMock(
+                'Magento\Sales\Model\Order\Address',
+                [],
+                [],
+                '',
+                false
+            );
+
+            $this->addressRenderer->expects($this->any())
+                ->method('format')
+                ->with($addressMock, 'html')
+                ->willReturn($address);
+
+            $this->orderMock->expects($this->any())
+                ->method('getBillingAddress')
+                ->willReturn($addressMock);
+
+            $this->orderMock->expects($this->any())
+                ->method('getShippingAddress')
+                ->willReturn($addressMock);
 
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
+            $this->invoiceMock->expects($this->once())
+                ->method('getCustomerNoteNotify')
+                ->willReturn($customerNoteNotify);
+
+            $this->invoiceMock->expects($this->any())
+                ->method('getCustomerNote')
+                ->willReturn($comment);
+
+            $this->templateContainerMock->expects($this->once())
+                ->method('setTemplateVars')
+                ->with(
                     [
                         'order' => $this->orderMock,
                         'invoice' => $this->invoiceMock,
-                        'comment' => $comment,
-                        'billing' => $billingAddress,
+                        'comment' => $customerNoteNotify ? $comment : '',
+                        'billing' => $addressMock,
                         'payment_html' => 'payment',
                         'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
+                        'formattedShippingAddress' => $address,
+                        'formattedBillingAddress' => $address
                     ]
-                )
+                );
+
+            $this->identityContainerMock->expects($this->once())
+                ->method('isEnabled')
+                ->willReturn($emailSendingResult);
+
+            if ($emailSendingResult) {
+                $this->senderBuilderFactoryMock->expects($this->once())
+                    ->method('create')
+                    ->willReturn($this->senderMock);
+
+                $this->senderMock->expects($this->once())->method('send');
+
+                $this->senderMock->expects($this->once())->method('sendCopyTo');
+
+                $this->invoiceMock->expects($this->once())
+                    ->method('setEmailSent')
+                    ->with(true);
+
+                $this->invoiceResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->invoiceMock, ['send_email', 'email_sent']);
+
+                $this->assertTrue(
+                    $this->sender->send($this->invoiceMock)
+                );
+            } else {
+                $this->invoiceResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->invoiceMock, 'send_email');
+
+                $this->assertFalse(
+                    $this->sender->send($this->invoiceMock)
+                );
+            }
+        } else {
+            $this->invoiceResourceMock->expects($this->once())
+                ->method('saveAttribute')
+                ->with($this->invoiceMock, 'send_email');
+
+            $this->assertFalse(
+                $this->sender->send($this->invoiceMock)
             );
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
-        $this->stepSendWithoutSendCopy();
-        $result = $this->sender->send($this->invoiceMock, true, $comment);
-        $this->assertTrue($result);
+        }
     }
 
-    public function testSendTrueWithoutCustomerCopy()
+    /**
+     * @return array
+     */
+    public function sendDataProvider()
     {
-        $billingAddress = $this->addressMock;
-        $this->stepAddressFormat($billingAddress);
-        $comment = 'comment_test';
-
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
-                    [
-                        'order' => $this->orderMock,
-                        'invoice' => $this->invoiceMock,
-                        'billing' => $billingAddress,
-                        'payment_html' => 'payment',
-                        'comment' => $comment,
-                        'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
-                    ]
-                )
-            );
-        $this->stepSendWithCallSendCopyTo();
-        $result = $this->sender->send($this->invoiceMock, false, $comment);
-        $this->assertTrue($result);
+        return [
+            [0, 0, 1, true],
+            [0, 0, 0, true],
+            [0, 0, 1, false],
+            [0, 0, 0, false],
+            [0, 1, 1, true],
+            [0, 1, 0, true],
+            [1, null, null, null]
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php
index 1ddc4e3724cd4050d2834987243c202baf9e126f..9bb5745162152cf85610abaa6cd8af1564586c7d 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php
@@ -18,12 +18,13 @@ class OrderCommentSenderTest extends AbstractSenderTest
     {
         $this->stepMockSetup();
         $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity');
+        $this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
         $this->sender = new OrderCommentSender(
             $this->templateContainerMock,
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
-            $this->addressRendererMock
+            $this->addressRenderer
         );
     }
 
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
index b6453f501acb007a92b30ed940b4f003b454f8c7..5350c1924f023c6055e59eec341cb024acb687ca 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
@@ -5,7 +5,7 @@
  */
 namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender;
 
-use \Magento\Sales\Model\Order\Email\Sender\OrderSender;
+use Magento\Sales\Model\Order\Email\Sender\OrderSender;
 
 class OrderSenderTest extends AbstractSenderTest
 {
@@ -15,42 +15,32 @@ class OrderSenderTest extends AbstractSenderTest
     protected $sender;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $paymentHelper;
+    protected $orderResourceMock;
 
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $orderResource;
-
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $loggerMock;
-    
     protected function setUp()
     {
         $this->stepMockSetup();
-        $this->paymentHelper = $this->getMock(
-            '\Magento\Payment\Helper\Data',
-            ['getInfoBlockHtml'],
+
+        $this->orderResourceMock = $this->getMock(
+            '\Magento\Sales\Model\Resource\Order',
+            ['saveAttribute'],
             [],
             '',
             false
         );
-        $this->paymentHelper->expects($this->any())
-            ->method('getInfoBlockHtml')
-            ->will($this->returnValue('payment'));
 
-        $this->orderResource = $this->getMock(
-            '\Magento\Sales\Model\Resource\Order',
-            [],
+        $this->identityContainerMock = $this->getMock(
+            '\Magento\Sales\Model\Order\Email\Container\OrderIdentity',
+            ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'],
             [],
             '',
             false
         );
-        $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\OrderIdentity');
+        $this->identityContainerMock->expects($this->any())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
 
         $this->sender = new OrderSender(
             $this->templateContainerMock,
@@ -58,110 +48,125 @@ class OrderSenderTest extends AbstractSenderTest
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
             $this->paymentHelper,
-            $this->orderResource,
-            $this->addressRendererMock
+            $this->orderResourceMock,
+            $this->globalConfig,
+            $this->addressRenderer
         );
     }
 
-    public function testSendFalse()
-    {
-        $this->stepAddressFormat($this->addressMock);
-        $result = $this->sender->send($this->orderMock);
-        $this->assertFalse($result);
-    }
-
-    public function testSendTrueForCustomer()
+    /**
+     * @param int $configValue
+     * @param bool|null $forceSyncMode
+     * @param bool|null $emailSendingResult
+     * @dataProvider sendDataProvider
+     * @return void
+     */
+    public function testSend($configValue, $forceSyncMode, $emailSendingResult)
     {
-        $billingAddress = $this->addressMock;
+        $address = 'address_test';
+        $configPath = 'sales_email/general/async_sending';
 
         $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-        $this->stepAddressFormat($billingAddress);
+            ->method('setSendEmail')
+            ->with(true);
 
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
-                    [
-                        'order' => $this->orderMock,
-                        'billing' => $billingAddress,
-                        'payment_html' => 'payment',
-                        'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
-                    ]
-                )
+        $this->globalConfig->expects($this->once())
+            ->method('getValue')
+            ->with($configPath)
+            ->willReturn($configValue);
+
+        if (!$configValue || $forceSyncMode) {
+            $this->identityContainerMock->expects($this->once())
+                ->method('isEnabled')
+                ->willReturn($emailSendingResult);
+
+            if ($emailSendingResult) {
+                $addressMock = $this->getMock(
+                    'Magento\Sales\Model\Order\Address',
+                    [],
+                    [],
+                    '',
+                    false
+                );
+
+                $this->addressRenderer->expects($this->any())
+                    ->method('format')
+                    ->with($addressMock, 'html')
+                    ->willReturn($address);
+
+                $this->orderMock->expects($this->any())
+                    ->method('getBillingAddress')
+                    ->willReturn($addressMock);
+
+                $this->orderMock->expects($this->any())
+                    ->method('getShippingAddress')
+                    ->willReturn($addressMock);
+
+                $this->templateContainerMock->expects($this->once())
+                    ->method('setTemplateVars')
+                    ->with(
+                        [
+                            'order' => $this->orderMock,
+                            'billing' => $addressMock,
+                            'payment_html' => 'payment',
+                            'store' => $this->storeMock,
+                            'formattedShippingAddress' => $address,
+                            'formattedBillingAddress' => $address
+                        ]
+                    );
+
+                $this->senderBuilderFactoryMock->expects($this->once())
+                    ->method('create')
+                    ->willReturn($this->senderMock);
+
+                $this->senderMock->expects($this->once())->method('send');
+
+                $this->senderMock->expects($this->once())->method('sendCopyTo');
+
+                $this->orderMock->expects($this->once())
+                    ->method('setEmailSent')
+                    ->with(true);
+
+                $this->orderResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->orderMock, ['send_email', 'email_sent']);
+
+                $this->assertTrue(
+                    $this->sender->send($this->orderMock)
+                );
+            } else {
+                $this->orderResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->orderMock, 'send_email');
+
+                $this->assertFalse(
+                    $this->sender->send($this->orderMock)
+                );
+            }
+        } else {
+            $this->orderResourceMock->expects($this->once())
+                ->method('saveAttribute')
+                ->with($this->orderMock, 'send_email');
+
+            $this->assertFalse(
+                $this->sender->send($this->orderMock)
             );
-        $this->stepSend($this->once(), $this->once());
-        $result = $this->sender->send($this->orderMock);
-        $this->assertTrue($result);
+        }
     }
 
-    public function testSendTrueForGuest()
+    /**
+     * @return array
+     */
+    public function sendDataProvider()
     {
-        $billingAddress = $this->getMock(
-            '\Magento\Sales\Model\Order\Address',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->stepAddressFormat($billingAddress);
-        $billingAddress->expects($this->any())
-            ->method('getName')
-            ->will($this->returnValue('name'));
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(true));
-        $this->orderMock->expects($this->any())
-            ->method('getBillingAddress')
-            ->will($this->returnValue($billingAddress));
-
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
-                    [
-                        'order' => $this->orderMock,
-                        'billing' => $billingAddress,
-                        'payment_html' => 'payment',
-                        'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
-                    ]
-                )
-            );
-        $this->stepSend($this->once(), $this->once());
-        $result = $this->sender->send($this->orderMock);
-        $this->assertTrue($result);
+        return [
+            [0, 0, true],
+            [0, 0, true],
+            [0, 0, false],
+            [0, 0, false],
+            [0, 1, true],
+            [0, 1, true],
+            [1, null, null, null]
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php
index 6d4c4f26fc03078f2d05510cf28b07ce15af2d7a..0a69bb2fcf85d7eae3c0f0841ee17be8afdd1221 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php
@@ -23,6 +23,7 @@ class ShipmentCommentSenderTest extends AbstractSenderTest
     {
         $this->stepMockSetup();
         $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity');
+        $this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
         $this->shipmentMock = $this->getMock(
             '\Magento\Sales\Model\Order\Shipment',
             ['getStore', '__wakeup', 'getOrder'],
@@ -42,7 +43,7 @@ class ShipmentCommentSenderTest extends AbstractSenderTest
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
-            $this->addressRendererMock
+            $this->addressRenderer
         );
     }
 
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php
index 1f57f234e409c43c25f1089980aa88fbf389daa6..a13619f0423eaaa9a0f0ee3636c0c999454a0a9c 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php
@@ -5,7 +5,7 @@
  */
 namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender;
 
-use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
+use Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
 
 class ShipmentSenderTest extends AbstractSenderTest
 {
@@ -15,54 +15,34 @@ class ShipmentSenderTest extends AbstractSenderTest
     protected $sender;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Order\Shipment|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $shipmentMock;
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $paymentHelper;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $shipmentResource;
+    protected $shipmentResourceMock;
 
-    /**
-     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
-     */
     protected function setUp()
     {
         $this->stepMockSetup();
-        $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false);
-        $this->paymentHelper->expects($this->any())
-            ->method('getInfoBlockHtml')
-            ->will($this->returnValue('payment'));
 
-        $this->shipmentResource = $this->getMock(
+        $this->shipmentResourceMock = $this->getMock(
             '\Magento\Sales\Model\Resource\Order\Shipment',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\ShipmentIdentity');
-
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
+            ['saveAttribute'],
             [],
             '',
             false
         );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
 
         $this->shipmentMock = $this->getMock(
             '\Magento\Sales\Model\Order\Shipment',
-            ['getStore', '__wakeup', 'getOrder'],
+            [
+                'getStore', '__wakeup', 'getOrder',
+                'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify',
+                'getCustomerNote'
+            ],
             [],
             '',
             false
@@ -74,99 +54,155 @@ class ShipmentSenderTest extends AbstractSenderTest
             ->method('getOrder')
             ->will($this->returnValue($this->orderMock));
 
+        $this->identityContainerMock = $this->getMock(
+            '\Magento\Sales\Model\Order\Email\Container\ShipmentIdentity',
+            ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'],
+            [],
+            '',
+            false
+        );
+        $this->identityContainerMock->expects($this->any())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
+
         $this->sender = new ShipmentSender(
             $this->templateContainerMock,
             $this->identityContainerMock,
             $this->senderBuilderFactoryMock,
             $this->loggerMock,
             $this->paymentHelper,
-            $this->shipmentResource,
-            $this->addressRendererMock
+            $this->shipmentResourceMock,
+            $this->globalConfig,
+            $this->addressRenderer
         );
     }
 
-    public function testSendFalse()
-    {
-        $this->stepAddressFormat($this->addressMock);
-        $result = $this->sender->send($this->shipmentMock);
-        $this->assertFalse($result);
-    }
-
-    public function testSendTrueWithCustomerCopy()
+    /**
+     * @param int $configValue
+     * @param bool|null $forceSyncMode
+     * @param bool|null $customerNoteNotify
+     * @param bool|null $emailSendingResult
+     * @dataProvider sendDataProvider
+     * @return void
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult)
     {
-        $billingAddress = $this->addressMock;
         $comment = 'comment_test';
+        $address = 'address_test';
+        $configPath = 'sales_email/general/async_sending';
+
+        $this->shipmentMock->expects($this->once())
+            ->method('setSendEmail')
+            ->with(true);
+
+        $this->globalConfig->expects($this->once())
+            ->method('getValue')
+            ->with($configPath)
+            ->willReturn($configValue);
+
+        if (!$configValue || $forceSyncMode) {
+            $addressMock = $this->getMock(
+                'Magento\Sales\Model\Order\Address',
+                [],
+                [],
+                '',
+                false
+            );
+
+            $this->addressRenderer->expects($this->any())
+                ->method('format')
+                ->with($addressMock, 'html')
+                ->willReturn($address);
+
+            $this->orderMock->expects($this->any())
+                ->method('getBillingAddress')
+                ->willReturn($addressMock);
+
+            $this->orderMock->expects($this->any())
+                ->method('getShippingAddress')
+                ->willReturn($addressMock);
 
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-        $this->stepAddressFormat($billingAddress);
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
+            $this->shipmentMock->expects($this->once())
+                ->method('getCustomerNoteNotify')
+                ->willReturn($customerNoteNotify);
+
+            $this->shipmentMock->expects($this->any())
+                ->method('getCustomerNote')
+                ->willReturn($comment);
+
+            $this->templateContainerMock->expects($this->once())
+                ->method('setTemplateVars')
+                ->with(
                     [
                         'order' => $this->orderMock,
                         'shipment' => $this->shipmentMock,
-                        'comment' => $comment,
-                        'billing' => $billingAddress,
+                        'comment' => $customerNoteNotify ? $comment : '',
+                        'billing' => $addressMock,
                         'payment_html' => 'payment',
                         'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
+                        'formattedShippingAddress' => $address,
+                        'formattedBillingAddress' => $address
                     ]
-                )
+                );
+
+            $this->identityContainerMock->expects($this->once())
+                ->method('isEnabled')
+                ->willReturn($emailSendingResult);
+
+            if ($emailSendingResult) {
+                $this->senderBuilderFactoryMock->expects($this->once())
+                    ->method('create')
+                    ->willReturn($this->senderMock);
+
+                $this->senderMock->expects($this->once())->method('send');
+
+                $this->senderMock->expects($this->once())->method('sendCopyTo');
+
+                $this->shipmentMock->expects($this->once())
+                    ->method('setEmailSent')
+                    ->with(true);
+
+                $this->shipmentResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->shipmentMock, ['send_email', 'email_sent']);
+
+                $this->assertTrue(
+                    $this->sender->send($this->shipmentMock)
+                );
+            } else {
+                $this->shipmentResourceMock->expects($this->once())
+                    ->method('saveAttribute')
+                    ->with($this->shipmentMock, 'send_email');
+
+                $this->assertFalse(
+                    $this->sender->send($this->shipmentMock)
+                );
+            }
+        } else {
+            $this->shipmentResourceMock->expects($this->once())
+                ->method('saveAttribute')
+                ->with($this->shipmentMock, 'send_email');
+
+            $this->assertFalse(
+                $this->sender->send($this->shipmentMock)
             );
-        $paymentInfoMock = $this->getMock(
-            '\Magento\Payment\Model\Info',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->orderMock->expects($this->once())
-            ->method('getPayment')
-            ->will($this->returnValue($paymentInfoMock));
-        $this->stepSendWithoutSendCopy();
-        $result = $this->sender->send($this->shipmentMock, true, $comment);
-        $this->assertTrue($result);
+        }
     }
 
-    public function testSendTrueWithoutCustomerCopy()
+    /**
+     * @return array
+     */
+    public function sendDataProvider()
     {
-        $billingAddress = $this->addressMock;
-        $comment = 'comment_test';
-
-        $this->orderMock->expects($this->once())
-            ->method('getCustomerIsGuest')
-            ->will($this->returnValue(false));
-        $this->stepAddressFormat($billingAddress);
-
-        $this->identityContainerMock->expects($this->once())
-            ->method('isEnabled')
-            ->will($this->returnValue(true));
-        $this->templateContainerMock->expects($this->once())
-            ->method('setTemplateVars')
-            ->with(
-                $this->equalTo(
-                    [
-                        'order' => $this->orderMock,
-                        'shipment' => $this->shipmentMock,
-                        'billing' => $billingAddress,
-                        'payment_html' => 'payment',
-                        'comment' => $comment,
-                        'store' => $this->storeMock,
-                        'formattedShippingAddress' => 1,
-                        'formattedBillingAddress' => 1
-                    ]
-                )
-            );
-        $this->stepSendWithCallSendCopyTo();
-        $result = $this->sender->send($this->shipmentMock, false, $comment);
-        $this->assertTrue($result);
+        return [
+            [0, 0, 1, true],
+            [0, 0, 0, true],
+            [0, 0, 1, false],
+            [0, 0, 0, false],
+            [0, 1, 1, true],
+            [0, 1, 0, true],
+            [1, null, null, null]
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php
index d3a0a17afb3e01472852a13c96b1c486fe9f0572..b222a99d487454639b77b3a2552c45115a8f1919 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php
@@ -348,6 +348,11 @@ class OrderTest extends \PHPUnit_Framework_TestCase
         $order->setData('state', $orderState);
         $payment = $this->_prepareOrderPayment($order);
         $canVoidOrder = true;
+
+        if ($orderState == \Magento\Sales\Model\Order::STATE_CANCELED) {
+            $canVoidOrder = false;
+        }
+
         if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) {
             $canVoidOrder = false;
         }
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/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml
index e7482704e39adc243e781283034f20f391152eb0..4ea65218f81382b54f65b88152199aa1e2866db6 100644
--- a/app/code/Magento/Sales/etc/adminhtml/system.xml
+++ b/app/code/Magento/Sales/etc/adminhtml/system.xml
@@ -119,6 +119,14 @@
             <label>Sales Emails</label>
             <tab>sales</tab>
             <resource>Magento_Sales::sales_email</resource>
+            <group id="general" type="text" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0">
+                <label>General Settings</label>
+                <field id="async_sending" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
+                    <label>Asynchronous sending</label>
+                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
+                    <backend_model>Magento\Sales\Model\Config\Backend\Email\AsyncSending</backend_model>
+                </field>
+            </group>
             <group id="order" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                 <label>Order</label>
                 <field id="enabled" translate="label" type="select" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -340,7 +348,7 @@
             <label>PDF Print-outs</label>
             <tab>sales</tab>
             <resource>Magento_Sales::sales_pdf</resource>
-            <group id="invoice" translate="label" type="text" sortOrder="1" showInDefault="10" showInWebsite="1" showInStore="1">
+            <group id="invoice" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                 <label>Invoice</label>
                 <field id="put_order_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                     <label>Display Order ID in Header</label>
diff --git a/app/code/Magento/Sales/etc/config.xml b/app/code/Magento/Sales/etc/config.xml
index f88cf2955f60ed8f3db411ad7f4f49b37b87dc51..e786d5e45149b1b0cbb655d91a7cbc94ff33b5e0 100644
--- a/app/code/Magento/Sales/etc/config.xml
+++ b/app/code/Magento/Sales/etc/config.xml
@@ -23,6 +23,9 @@
             </minimum_order>
         </sales>
         <sales_email>
+            <general>
+                <async_sending>0</async_sending>
+            </general>
             <order>
                 <enabled>1</enabled>
                 <template>sales_email_order_template</template>
diff --git a/app/code/Magento/Sales/etc/crontab.xml b/app/code/Magento/Sales/etc/crontab.xml
index 1bd5b3e3e2478754784856b302a17ec3c2162470..15264798d8f1f8f34b800160472065b76f4ae72b 100644
--- a/app/code/Magento/Sales/etc/crontab.xml
+++ b/app/code/Magento/Sales/etc/crontab.xml
@@ -37,5 +37,17 @@
         <job name="sales_grid_order_creditmemo_async_insert" instance="Magento\Sales\Model\Observer\Order\Creditmemo\IndexGrid" method="asyncInsert">
             <schedule>*/1 * * * *</schedule>
         </job>
+        <job name="sales_send_order_emails" instance="Magento\Sales\Model\Observer\Order\SendEmails" method="execute">
+            <schedule>*/1 * * * *</schedule>
+        </job>
+        <job name="sales_send_order_invoice_emails" instance="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" method="execute">
+            <schedule>*/1 * * * *</schedule>
+        </job>
+        <job name="sales_send_order_shipment_emails" instance="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" method="execute">
+            <schedule>*/1 * * * *</schedule>
+        </job>
+        <job name="sales_send_order_creditmemo_emails" instance="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" method="execute">
+            <schedule>*/1 * * * *</schedule>
+        </job>
     </group>
 </config>
diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml
index ba45f06f9d73eed3c92d5d35faaaf5210363d158..9e20997c62f002c51ce2448f1e59e46acedf86da 100644
--- a/app/code/Magento/Sales/etc/di.xml
+++ b/app/code/Magento/Sales/etc/di.xml
@@ -157,6 +157,34 @@
             <argument name="entityGrid" xsi:type="object">Magento\Sales\Model\Resource\Order\Creditmemo\Grid</argument>
         </arguments>
     </virtualType>
+    <virtualType name="Magento\Sales\Model\Observer\Order\SendEmails" type="Magento\Sales\Model\Observer\SendEmails">
+        <arguments>
+            <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\OrderSender</argument>
+            <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order</argument>
+            <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Collection</argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" type="Magento\Sales\Model\Observer\SendEmails">
+        <arguments>
+            <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\InvoiceSender</argument>
+            <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Invoice</argument>
+            <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Invoice\Collection</argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" type="Magento\Sales\Model\Observer\SendEmails">
+        <arguments>
+            <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\ShipmentSender</argument>
+            <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Shipment</argument>
+            <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Shipment\Collection</argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" type="Magento\Sales\Model\Observer\SendEmails">
+        <arguments>
+            <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\CreditmemoSender</argument>
+            <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Creditmemo</argument>
+            <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Creditmemo\Collection</argument>
+        </arguments>
+    </virtualType>
     <type name="Magento\SalesSequence\Model\EntityPool">
         <arguments>
             <argument name="entities" xsi:type="array">
diff --git a/app/code/Magento/Sales/etc/events.xml b/app/code/Magento/Sales/etc/events.xml
index 1260e97f8d9d48c95b7e9e77102267339abefcc6..9e38abcd68e8c2812d99b3dc4f33c20135e9e2d5 100644
--- a/app/code/Magento/Sales/etc/events.xml
+++ b/app/code/Magento/Sales/etc/events.xml
@@ -39,6 +39,12 @@
         <observer name="sales_grid_order_shipment_async_insert" instance="Magento\Sales\Model\Observer\Order\Shipment\IndexGrid" method="asyncInsert" />
         <observer name="sales_grid_order_creditmemo_async_insert" instance="Magento\Sales\Model\Observer\Order\Creditmemo\IndexGrid" method="asyncInsert" />
     </event>
+    <event name="config_data_sales_email_general_async_sending_disabled">
+        <observer name="sales_send_order_emails" instance="Magento\Sales\Model\Observer\Order\SendEmails" method="execute" />
+        <observer name="sales_send_order_invoice_emails" instance="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" method="execute" />
+        <observer name="sales_send_order_shipment_emails" instance="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" method="execute" />
+        <observer name="sales_send_order_creditmemo_emails" instance="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" method="execute" />
+    </event>
     <event name="store_add">
         <observer name="magento_sequence" instance="Magento\SalesSequence\Model\Observer" method="execute" />
     </event>
diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml
index eb894f667baef8cdb7b1214aec572f7660e00f50..931f2ab5884d8cb48936375b141eaba64c35d37e 100644
--- a/app/code/Magento/Sales/etc/module.xml
+++ b/app/code/Magento/Sales/etc/module.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Sales" setup_version="2.0.3">
+    <module name="Magento_Sales" setup_version="2.0.4">
         <sequence>
             <module name="Magento_Rule"/>
             <module name="Magento_Catalog"/>
diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php
index 700bdac3b587dd4fe706e90df90563a327d17cd8..0e319cccfc9fbd32dd184de60ba3bc3f37c1a8fa 100644
--- a/app/code/Magento/SalesRule/Setup/InstallSchema.php
+++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php
@@ -264,7 +264,6 @@ class InstallSchema implements InstallSchemaInterface
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Salesrule Coupon'
@@ -302,14 +301,12 @@ class InstallSchema implements InstallSchemaInterface
             'coupon_id',
             $installer->getTable('salesrule_coupon'),
             'coupon_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'),
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Salesrule Coupon Usage'
@@ -356,14 +353,12 @@ class InstallSchema implements InstallSchemaInterface
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'),
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Salesrule Customer'
@@ -415,14 +410,12 @@ class InstallSchema implements InstallSchemaInterface
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'),
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Salesrule Label'
@@ -472,8 +465,7 @@ class InstallSchema implements InstallSchemaInterface
             'attribute_id',
             $installer->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-            \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
                 'salesrule_product_attribute',
@@ -484,22 +476,19 @@ class InstallSchema implements InstallSchemaInterface
             'customer_group_id',
             $installer->getTable('customer_group'),
             'customer_group_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-            \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'),
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-            \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-            \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
+            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Salesrule Product Attribute'
         );
@@ -607,7 +596,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Coupon Aggregated'
@@ -705,7 +693,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Coupon Aggregated Order'
@@ -743,14 +730,12 @@ class InstallSchema implements InstallSchemaInterface
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'),
             'website_id',
             $websitesTable,
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Rules To Websites Relations'
@@ -784,7 +769,6 @@ class InstallSchema implements InstallSchemaInterface
             'rule_id',
             $installer->getTable('salesrule'),
             'rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -796,7 +780,6 @@ class InstallSchema implements InstallSchemaInterface
             'customer_group_id',
             $customerGroupsTable,
             'customer_group_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Rules To Customer Groups Relations'
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 8d71564f7d997e9f8277565b9d07693caa49dfc4..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/magento-composer-installer": "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/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php
index 8a4acf9042b8ea7d17b9572e7536f8f3f20622d1..d58c0da9a8946015c721e96229746d6beae6703a 100644
--- a/app/code/Magento/Search/Setup/InstallSchema.php
+++ b/app/code/Magento/Search/Setup/InstallSchema.php
@@ -104,7 +104,7 @@ class InstallSchema implements InstallSchemaInterface
                 'updated_at',
                 \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                 null,
-                ['nullable' => false],
+                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
                 'Updated at'
             )
             ->addIndex(
@@ -124,7 +124,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )
             ->setComment('Search query table');
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/Controller/Adminhtml/Order/Shipment/AddComment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php
index 70310d404c6fa4273b42a117d9d705fd0fd2d9e2..c1fdc5ecd880d668a722046d05c0a3075e2b4540 100644
--- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php
+++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php
@@ -6,7 +6,7 @@
  */
 namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment;
 
-use Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
+use Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender;
 use Magento\Backend\App\Action;
 use Magento\Framework\View\Result\LayoutFactory;
 
@@ -18,9 +18,9 @@ class AddComment extends \Magento\Backend\App\Action
     protected $shipmentLoader;
 
     /**
-     * @var ShipmentSender
+     * @var ShipmentCommentSender
      */
-    protected $shipmentSender;
+    protected $shipmentCommentSender;
 
     /**
      * @var LayoutFactory
@@ -30,17 +30,17 @@ class AddComment extends \Magento\Backend\App\Action
     /**
      * @param Action\Context $context
      * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader
-     * @param ShipmentSender $shipmentSender
+     * @param ShipmentCommentSender $shipmentCommentSender
      * @param LayoutFactory $resultLayoutFactory
      */
     public function __construct(
         Action\Context $context,
         \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader,
-        ShipmentSender $shipmentSender,
+        ShipmentCommentSender $shipmentCommentSender,
         LayoutFactory $resultLayoutFactory
     ) {
         $this->shipmentLoader = $shipmentLoader;
-        $this->shipmentSender = $shipmentSender;
+        $this->shipmentCommentSender = $shipmentCommentSender;
         $this->resultLayoutFactory = $resultLayoutFactory;
         parent::__construct($context);
     }
@@ -79,7 +79,7 @@ class AddComment extends \Magento\Backend\App\Action
                 isset($data['is_visible_on_front'])
             );
 
-            $this->shipmentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']);
+            $this->shipmentCommentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']);
             $shipment->save();
             $resultLayout = $this->resultLayoutFactory->create();
             $resultLayout->addDefaultHandle();
diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php
index 7bb56f5087c0f345788b454326742b918893d245..c187d9bb21b55870757cb76449665f92a9718216 100644
--- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php
+++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php
@@ -100,23 +100,19 @@ class Save extends \Magento\Backend\App\Action
                 return;
             }
 
-            $shipment->register();
-            $comment = '';
             if (!empty($data['comment_text'])) {
                 $shipment->addComment(
                     $data['comment_text'],
                     isset($data['comment_customer_notify']),
                     isset($data['is_visible_on_front'])
                 );
-                if (isset($data['comment_customer_notify'])) {
-                    $comment = $data['comment_text'];
-                }
-            }
 
-            if (!empty($data['send_email'])) {
-                $shipment->setEmailSent(true);
+                $shipment->setCustomerNote($data['comment_text']);
+                $shipment->setCustomerNoteNotify(isset($data['comment_customer_notify']));
             }
 
+            $shipment->register();
+
             $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
             $responseAjax = new \Magento\Framework\Object();
             $isNeedCreateLabel = isset($data['create_shipping_label']) && $data['create_shipping_label'];
@@ -128,7 +124,9 @@ class Save extends \Magento\Backend\App\Action
 
             $this->_saveShipment($shipment);
 
-            $this->shipmentSender->send($shipment, !empty($data['send_email']), $comment);
+            if (!empty($data['send_email'])) {
+                $this->shipmentSender->send($shipment);
+            }
 
             $shipmentCreatedMessage = __('The shipment has been created.');
             $labelCreatedMessage = __('You created the shipping label.');
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/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
index fd793ff3d03a7945feee7850449a192985b97485..04e8bc658ade10cc6a5f6d42ce34d7835710a5f4 100644
--- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
+++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
@@ -8,10 +8,12 @@
 
 namespace Magento\Shipping\Model\Carrier;
 
-use Magento\Quote\Model\Quote\Address\AbstractCarrierInterface;
 use Magento\Quote\Model\Quote\Address\RateResult\Error;
 use Magento\Shipping\Model\Shipment\Request;
 
+/**
+ * Class AbstractCarrier
+ */
 abstract class AbstractCarrier extends \Magento\Framework\Object implements AbstractCarrierInterface
 {
     /**
@@ -137,6 +139,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst
      * @param string $field
      * @return bool
      * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+     * @api
      */
     public function getConfigFlag($field)
     {
@@ -154,11 +157,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst
     /**
      * Collect and get rates
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return \Magento\Shipping\Model\Rate\Result|bool|null
      * @abstract
      */
-    abstract public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request);
+    abstract public function collectRates(\Magento\Framework\Object $request);
 
     /**
      * Do request to shipment
@@ -276,11 +279,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst
     }
 
     /**
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return $this|bool|false|\Magento\Framework\Model\AbstractModel
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      */
-    public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function checkAvailableShipCountries(\Magento\Framework\Object $request)
     {
         $speCountriesAllow = $this->getConfigData('sallowspecific');
         /*
@@ -323,11 +326,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst
     /**
      * Processing additional validation to check is carrier applicable.
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
-     * @return $this|bool|Error
+     * @param \Magento\Framework\Object $request
+     * @return $this|bool|\Magento\Framework\Object
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function proccessAdditionalValidation(\Magento\Framework\Object $request)
     {
         return $this;
     }
@@ -593,6 +596,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst
      *
      * @return bool
      * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+     * @api
      */
     public function getDebugFlag()
     {
diff --git a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php
similarity index 83%
rename from app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php
rename to app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php
index acc4f1b93d48291383afedf533b76438717bdaca..a8a9f2f747c31adfd37f69aae90489b571b69298 100644
--- a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php
+++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php
@@ -3,8 +3,11 @@
  * Copyright © 2015 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-namespace Magento\Quote\Model\Quote\Address;
+namespace Magento\Shipping\Model\Carrier;
 
+/**
+ * Interface AbstractCarrierInterface
+ */
 interface AbstractCarrierInterface
 {
     /**
@@ -12,16 +15,18 @@ interface AbstractCarrierInterface
      *
      * @param   string $field
      * @return  mixed
+     * @api
      */
     public function getConfigData($field);
 
     /**
      * Collect and get rates
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return \Magento\Framework\Object|bool|null
+     * @api
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request);
+    public function collectRates(\Magento\Framework\Object $request);
 
     /**
      * Do request to shipment
@@ -29,6 +34,7 @@ interface AbstractCarrierInterface
      *
      * @param \Magento\Framework\Object $request
      * @return \Magento\Framework\Object
+     * @api
      */
     public function requestToShipment($request);
 
@@ -38,6 +44,7 @@ interface AbstractCarrierInterface
      *
      * @param \Magento\Framework\Object $request
      * @return \Magento\Framework\Object
+     * @api
      */
     public function returnOfShipment($request);
 
@@ -46,6 +53,7 @@ interface AbstractCarrierInterface
      *
      * @param \Magento\Framework\Object|null $params
      * @return array
+     * @api
      */
     public function getContainerTypes(\Magento\Framework\Object $params = null);
 
@@ -53,6 +61,7 @@ interface AbstractCarrierInterface
      * Get Container Types, that could be customized
      *
      * @return array
+     * @api
      */
     public function getCustomizableContainerTypes();
 
@@ -61,27 +70,31 @@ interface AbstractCarrierInterface
      *
      * @param \Magento\Framework\Object|null $params
      * @return array
+     * @api
      */
     public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null);
 
     /**
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return $this|bool|false|\Magento\Framework\Model\AbstractModel
+     * @api
      */
-    public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request);
+    public function checkAvailableShipCountries(\Magento\Framework\Object $request);
 
     /**
      * Processing additional validation to check is carrier applicable.
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
-     * @return $this|\Magento\Quote\Model\Quote\Address\RateResult\Error|boolean
+     * @param \Magento\Framework\Object $request
+     * @return $this|\Magento\Framework\Object|boolean
+     * @api
      */
-    public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request);
+    public function proccessAdditionalValidation(\Magento\Framework\Object $request);
 
     /**
      * Determine whether current carrier enabled for activity
      *
      * @return bool
+     * @api
      */
     public function isActive();
 
@@ -89,6 +102,7 @@ interface AbstractCarrierInterface
      * Whether this carrier has fixed rates calculation
      *
      * @return bool
+     * @api
      */
     public function isFixed();
 
@@ -96,6 +110,7 @@ interface AbstractCarrierInterface
      * Check if carrier has shipping tracking option available
      *
      * @return bool
+     * @api
      */
     public function isTrackingAvailable();
 
@@ -103,6 +118,7 @@ interface AbstractCarrierInterface
      * Check if carrier has shipping label option available
      *
      * @return bool
+     * @api
      */
     public function isShippingLabelsAvailable();
 
@@ -110,6 +126,7 @@ interface AbstractCarrierInterface
      *  Retrieve sort order of current carrier
      *
      * @return string|null
+     * @api
      */
     public function getSortOrder();
 
@@ -118,6 +135,7 @@ interface AbstractCarrierInterface
      *
      * @param float $cost
      * @return float final price for shipping method
+     * @api
      */
     public function getFinalPriceWithHandlingFee($cost);
 
@@ -126,6 +144,7 @@ interface AbstractCarrierInterface
      *
      * @param int $weight in someone measure
      * @return float Weight in pounds
+     * @api
      */
     public function convertWeightToLbs($weight);
 
@@ -134,6 +153,7 @@ interface AbstractCarrierInterface
      *
      * @param int|float $weight
      * @return int|float weight
+     * @api
      */
     public function getTotalNumOfBoxes($weight);
 
@@ -141,6 +161,7 @@ interface AbstractCarrierInterface
      * Is state province required
      *
      * @return bool
+     * @api
      */
     public function isStateProvinceRequired();
 
@@ -148,6 +169,7 @@ interface AbstractCarrierInterface
      * Check if city option required
      *
      * @return bool
+     * @api
      */
     public function isCityRequired();
 
@@ -156,6 +178,7 @@ interface AbstractCarrierInterface
      *
      * @param string|null $countryId
      * @return bool
+     * @api
      */
     public function isZipCodeRequired($countryId = null);
 
@@ -164,6 +187,7 @@ interface AbstractCarrierInterface
      *
      * @param mixed $debugData
      * @return void
+     * @api
      */
     public function debugData($debugData);
 
@@ -171,6 +195,7 @@ interface AbstractCarrierInterface
      * Getter for carrier code
      *
      * @return string
+     * @api
      */
     public function getCarrierCode();
 
@@ -179,6 +204,7 @@ interface AbstractCarrierInterface
      *
      * @param \Magento\Framework\Object $params
      * @return array
+     * @api
      */
     public function getContentTypes(\Magento\Framework\Object $params);
 }
diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php
index e4f38e73beec05dc3b6955429b04c0ffa6af97e8..99e544593f16bc73c2b191233afa2ffe99184657 100644
--- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php
+++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php
@@ -157,6 +157,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      *
      * @param string $code
      * @return $this
+     * @api
      */
     public function setActiveFlag($code = 'active')
     {
@@ -179,6 +180,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      *
      * @param string $tracking
      * @return string|false
+     * @api
      */
     public function getTrackingInfo($tracking)
     {
@@ -249,6 +251,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      * @param RateRequest $request
      * @return array
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+     * @api
      */
     public function getAllItems(RateRequest $request)
     {
@@ -279,12 +282,12 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
     /**
      * Processing additional validation to check if carrier applicable.
      *
-     * @param RateRequest $request
-     * @return $this|bool|Error
+     * @param \Magento\Framework\Object $request
+     * @return $this|bool|\Magento\Framework\Object
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
-    public function proccessAdditionalValidation(RateRequest $request)
+    public function proccessAdditionalValidation(\Magento\Framework\Object $request)
     {
         //Skip by item validation if there is no items in request
         if (!count($this->getAllItems($request))) {
@@ -523,6 +526,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      *
      * @todo implement rollback logic
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function rollBack($data)
     {
@@ -572,6 +576,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      * @param null|string $countyDest
      * @return bool
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     * @api
      */
     public function isGirthAllowed($countyDest = null)
     {
@@ -581,6 +586,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
     /**
      * @param \Magento\Framework\Object|null $request
      * @return $this
+     * @api
      */
     public function setRawRequest($request)
     {
@@ -594,6 +600,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      * @param string $cost
      * @param string $method
      * @return float|string
+     * @api
      */
     public function getMethodPrice($cost, $method = '')
     {
@@ -615,6 +622,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier
      * @param string $customSimplexml
      *
      * @return \SimpleXMLElement|bool
+     * @api
      */
     public function parseXml($xmlContent, $customSimplexml = 'SimpleXMLElement')
     {
diff --git a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php
index 980fe636356a5edcac7dc153e174085d21ac2c28..f422d20a9e3a3ed33ce3c5f560c1d4d57589d84a 100644
--- a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php
+++ b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php
@@ -11,6 +11,7 @@ interface CarrierInterface
      * Check if carrier has shipping tracking option available
      *
      * @return boolean
+     * @api
      */
     public function isTrackingAvailable();
 
@@ -18,6 +19,7 @@ interface CarrierInterface
      * Get allowed shipping methods
      *
      * @return array
+     * @api
      */
     public function getAllowedMethods();
 }
diff --git a/app/code/Magento/Shipping/Model/CarrierFactory.php b/app/code/Magento/Shipping/Model/CarrierFactory.php
index ac7dcc25146347f60e41e5e6696a02b171dc1c1a..699a7a3be09aa754363f208b337b5d3e416fa832 100644
--- a/app/code/Magento/Shipping/Model/CarrierFactory.php
+++ b/app/code/Magento/Shipping/Model/CarrierFactory.php
@@ -5,8 +5,9 @@
  */
 namespace Magento\Shipping\Model;
 
-use Magento\Quote\Model\Quote\Address\CarrierFactoryInterface;
-
+/**
+ * Class CarrierFactory
+ */
 class CarrierFactory implements CarrierFactoryInterface
 {
     /**
diff --git a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php
similarity index 83%
rename from app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php
rename to app/code/Magento/Shipping/Model/CarrierFactoryInterface.php
index 9cd570db6feeccecbecad70df05a0ba2a58ab44e..2c0ac4c801d2f21ae0746930329689e5fb0f2e11 100644
--- a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php
+++ b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php
@@ -3,8 +3,13 @@
  * Copyright © 2015 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-namespace Magento\Quote\Model\Quote\Address;
+namespace Magento\Shipping\Model;
 
+use Magento\Shipping\Model\Carrier\AbstractCarrierInterface;
+
+/**
+ * Interface CarrierFactoryInterface
+ */
 interface CarrierFactoryInterface
 {
     /**
@@ -12,6 +17,7 @@ interface CarrierFactoryInterface
      *
      * @param string $carrierCode
      * @return bool|AbstractCarrierInterface
+     * @api
      */
     public function get($carrierCode);
 
@@ -21,6 +27,7 @@ interface CarrierFactoryInterface
      * @param string $carrierCode
      * @param int|null $storeId
      * @return bool|AbstractCarrierInterface
+     * @api
      */
     public function create($carrierCode, $storeId = null);
 
@@ -29,6 +36,7 @@ interface CarrierFactoryInterface
      *
      * @param string $carrierCode
      * @return bool|AbstractCarrierInterface
+     * @api
      */
     public function getIfActive($carrierCode);
 
@@ -38,6 +46,7 @@ interface CarrierFactoryInterface
      * @param string $carrierCode
      * @param null|int $storeId
      * @return bool|AbstractCarrierInterface
+     * @api
      */
     public function createIfActive($carrierCode, $storeId = null);
 }
diff --git a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php
index 4bc12ca36516585e31b7e146693ef2641dcbe5b7..6a60d69bdfe58eb6a6b84bb625f86082c9108820 100644
--- a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php
+++ b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php
@@ -16,9 +16,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
     protected $shipmentLoaderMock;
 
     /**
-     * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentSender|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $shipmentSenderMock;
+    protected $shipmentCommentSenderMock;
 
     /**
      * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
@@ -69,8 +69,8 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $this->shipmentSenderMock = $this->getMock(
-            'Magento\Sales\Model\Order\Email\Sender\ShipmentSender',
+        $this->shipmentCommentSenderMock = $this->getMock(
+            'Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender',
             ['send', '__wakeup'],
             [],
             '',
@@ -139,7 +139,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
         $this->controller = new \Magento\Shipping\Controller\Adminhtml\Order\Shipment\AddComment(
             $contextMock,
             $this->shipmentLoaderMock,
-            $this->shipmentSenderMock,
+            $this->shipmentCommentSenderMock,
             $this->resultLayoutFactoryMock
         );
     }
@@ -210,7 +210,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
             ->method('load')
             ->will($this->returnValue($this->shipmentMock));
         $this->shipmentMock->expects($this->once())->method('addComment');
-        $this->shipmentSenderMock->expects($this->once())->method('send');
+        $this->shipmentCommentSenderMock->expects($this->once())->method('send');
         $this->shipmentMock->expects($this->once())->method('save');
         $layoutMock = $this->getMock('Magento\Framework\View\Layout', ['getBlock'], [], '', false);
         $blockMock = $this->getMock('Magento\Shipping\Block\Adminhtml\View\Comments', ['toHtml'], [], '', false);
@@ -318,7 +318,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
             ->method('load')
             ->will($this->returnValue($this->shipmentMock));
         $this->shipmentMock->expects($this->once())->method('addComment');
-        $this->shipmentSenderMock->expects($this->once())->method('send');
+        $this->shipmentCommentSenderMock->expects($this->once())->method('send');
         $this->shipmentMock->expects($this->once())->method('save')->will($this->throwException(new \Exception()));
         $this->exceptionResponse();
 
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/Shipping/etc/di.xml b/app/code/Magento/Shipping/etc/di.xml
index 92fad82f65d25fb31c36ebc8f3de56a5b3abb8d7..9b785dac596f1f2a0bf2addc690fa8ca8cec1799 100644
--- a/app/code/Magento/Shipping/etc/di.xml
+++ b/app/code/Magento/Shipping/etc/di.xml
@@ -7,6 +7,6 @@
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
     <preference for="Magento\Quote\Model\Quote\Address\RateCollectorInterface" type="Magento\Shipping\Model\Shipping" />
-    <preference for="Magento\Quote\Model\Quote\Address\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" />
+    <preference for="Magento\Shipping\Model\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" />
     <preference for="Magento\Shipping\Model\Carrier\Source\GenericInterface" type="\Magento\Shipping\Model\Carrier\Source\GenericDefault" />
 </config>
diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php
index 202d222ec8ff8e06d4ece30cc339308959836f52..bca997246b74da37d27c3a02b1d842b71f37a7a9 100644
--- a/app/code/Magento/Sitemap/Setup/InstallSchema.php
+++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php
@@ -73,7 +73,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'XML Sitemap'
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/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php
index f76cc884777a8f1165ae5a6dbbcf61cac9124d4d..948659c8c34228615d5fff9fef35276b9f806984 100644
--- a/app/code/Magento/Store/Setup/InstallSchema.php
+++ b/app/code/Magento/Store/Setup/InstallSchema.php
@@ -133,7 +133,6 @@ class InstallSchema implements InstallSchemaInterface
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            Table::ACTION_CASCADE,
             Table::ACTION_CASCADE
         )->setComment(
             'Store Groups'
@@ -209,14 +208,12 @@ class InstallSchema implements InstallSchemaInterface
             'group_id',
             $installer->getTable('store_group'),
             'group_id',
-            Table::ACTION_CASCADE,
             Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('store', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $installer->getTable('store_website'),
             'website_id',
-            Table::ACTION_CASCADE,
             Table::ACTION_CASCADE
         )->setComment(
             'Stores'
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/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php
index 85218d2195b724907b3cc59c0ac0b10612f3904c..6d708d5862f56f6560bbc0a8515d9ccfd9f99a77 100644
--- a/app/code/Magento/Tax/Setup/InstallSchema.php
+++ b/app/code/Magento/Tax/Setup/InstallSchema.php
@@ -228,14 +228,12 @@ class InstallSchema implements InstallSchemaInterface
             'product_tax_class_id',
             $setup->getTable('tax_class'),
             'class_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'),
             'customer_tax_class_id',
             $setup->getTable('tax_class'),
             'class_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName(
@@ -247,7 +245,6 @@ class InstallSchema implements InstallSchemaInterface
             'tax_calculation_rate_id',
             $setup->getTable('tax_calculation_rate'),
             'tax_calculation_rate_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName(
@@ -259,7 +256,6 @@ class InstallSchema implements InstallSchemaInterface
             'tax_calculation_rule_id',
             $setup->getTable('tax_calculation_rule'),
             'tax_calculation_rule_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Tax Calculation'
@@ -306,7 +302,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $setup->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName(
@@ -318,7 +313,6 @@ class InstallSchema implements InstallSchemaInterface
             'tax_calculation_rate_id',
             $setup->getTable('tax_calculation_rate'),
             'tax_calculation_rate_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Tax Calculation Rate Title'
@@ -394,7 +388,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $setup->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Tax Order Aggregation'
@@ -492,21 +485,18 @@ class InstallSchema implements InstallSchemaInterface
             'associated_item_id',
             $setup->getTable('sales_order_item'),
             'item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'),
             'tax_id',
             $setup->getTable('sales_order_tax'),
             'tax_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'),
             'item_id',
             $setup->getTable('sales_order_item'),
             'item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Sales Order Tax Item'
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/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php
index f2135e0c1e4df8f03743be922c9e3aafe05026d5..b7f6d0edb3775a0f668233ab6bf758beea3ff807 100644
--- a/app/code/Magento/Theme/Setup/InstallSchema.php
+++ b/app/code/Magento/Theme/Setup/InstallSchema.php
@@ -150,7 +150,6 @@ class InstallSchema implements InstallSchemaInterface
             'theme_id',
             $installer->getTable('theme'),
             'theme_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Core theme files'
@@ -200,7 +199,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Design Changes'
diff --git a/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php b/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php
index cb439cd4ea692ffe840a80d5434b9e683c132169..d8ee45c4f15f067f6744c7c93071470040539b1f 100644
--- a/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php
+++ b/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php
@@ -85,7 +85,7 @@ class FaviconTest extends \PHPUnit_Framework_TestCase
     public function testGetFaviconFile()
     {
         $scopeConfigValue = 'path';
-        $urlToMediaDir = 'http://magneto.url/pub/media/';
+        $urlToMediaDir = 'http://magento.url/pub/media/';
         $expectedFile = ImageFavicon::UPLOAD_DIR . '/' . $scopeConfigValue;
         $expectedUrl = $urlToMediaDir . $expectedFile;
 
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/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php
index a7d4df05902bc0c50d9c3854fd40e503abe1a090..24afcc20396939c02e7360d551364a7ff521c879 100644
--- a/app/code/Magento/Translation/Setup/InstallSchema.php
+++ b/app/code/Magento/Translation/Setup/InstallSchema.php
@@ -96,7 +96,6 @@ class InstallSchema implements InstallSchemaInterface
                 'store_id',
                 $installer->getTable('store'),
                 'store_id',
-                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
                 \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
             )->setComment('Translations');
         $installer->getConnection()->createTable($table);
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/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php
index e88b68ea433cafc08dba11c7c4dbec7547c6aaf8..3085a8b35c988766d5d48820d5727fc498c1bf65 100644
--- a/app/code/Magento/Ups/Model/Carrier.php
+++ b/app/code/Magento/Ups/Model/Carrier.php
@@ -184,10 +184,10 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface
     /**
      * Collect and get rates
      *
-     * @param RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return Result|bool|null
      */
-    public function collectRates(RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag($this->_activeFlag)) {
             return false;
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/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php
index 49976c39fef46b183e6fd46190f5a28edfd11336..2d7845696c840f6695756459fa162e9c1832b5b5 100644
--- a/app/code/Magento/Usps/Model/Carrier.php
+++ b/app/code/Magento/Usps/Model/Carrier.php
@@ -177,10 +177,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C
     /**
      * Collect and get rates
      *
-     * @param \Magento\Quote\Model\Quote\Address\RateRequest $request
+     * @param \Magento\Framework\Object $request
      * @return Result|bool|null
      */
-    public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
+    public function collectRates(\Magento\Framework\Object $request)
     {
         if (!$this->getConfigFlag($this->_activeFlag)) {
             return false;
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/Setup/InstallSchema.php b/app/code/Magento/Variable/Setup/InstallSchema.php
index b2af66d257b7c3df5099a247c97239de561ed245..043ccaad3360d650fcaa4507c0699c9595d646cb 100644
--- a/app/code/Magento/Variable/Setup/InstallSchema.php
+++ b/app/code/Magento/Variable/Setup/InstallSchema.php
@@ -17,6 +17,7 @@ class InstallSchema implements InstallSchemaInterface
 {
     /**
      * {@inheritdoc}
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
      */
     public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
     {
@@ -135,7 +136,6 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         );
         $connection->addForeignKey(
@@ -144,12 +144,9 @@ class InstallSchema implements InstallSchemaInterface
             'variable_id',
             $installer->getTable('variable'),
             'variable_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         );
 
         $installer->endSetup();
-
     }
-
 }
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/Model/Total/Creditmemo/Weee.php b/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php
index d45eab656ca2a5eaf6c41e5f17125b87dc6b2f8b..7ddf6d66a7d0ada34c68da378ebcde2ed6112387 100644
--- a/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php
+++ b/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php
@@ -49,36 +49,30 @@ class Weee extends \Magento\Sales\Model\Order\Creditmemo\Total\AbstractTotal
 
         $totalWeeeAmount = 0;
         $baseTotalWeeeAmount = 0;
-
         $totalWeeeAmountInclTax = 0;
         $baseTotalWeeeAmountInclTax = 0;
-
-        $totalTaxAmount = $totalWeeeAmountInclTax - $totalWeeeAmount;
-        $baseTotalTaxAmount = $baseTotalWeeeAmountInclTax - $baseTotalWeeeAmount;
+        $totalTaxAmount = 0;
+        $baseTotalTaxAmount = 0;
 
         foreach ($creditmemo->getAllItems() as $item) {
             $orderItem = $item->getOrderItem();
-            if ($orderItem->isDummy() || $item->getQty() <= 0) {
+            $orderItemQty = $orderItem->getQtyOrdered();
+
+            if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() < 0) {
                 continue;
             }
 
-            $ratio = $item->getQty() / $orderItem->getQtyOrdered();
+            $ratio = $item->getQty() / $orderItemQty;
 
             $orderItemWeeeAmountExclTax = $orderItem->getWeeeTaxAppliedRowAmount();
             $orderItemBaseWeeeAmountExclTax = $orderItem->getBaseWeeeTaxAppliedRowAmnt();
             $weeeAmountExclTax = $creditmemo->roundPrice($orderItemWeeeAmountExclTax * $ratio);
-            $baseWeeeAmountExclTax = $creditmemo->roundPrice(
-                $orderItemBaseWeeeAmountExclTax * $ratio,
-                'base'
-            );
+            $baseWeeeAmountExclTax = $creditmemo->roundPrice($orderItemBaseWeeeAmountExclTax * $ratio, 'base');
 
             $orderItemWeeeAmountInclTax = $this->_weeeData->getRowWeeeTaxInclTax($orderItem);
             $orderItemBaseWeeeAmountInclTax = $this->_weeeData->getBaseRowWeeeTaxInclTax($orderItem);
             $weeeAmountInclTax = $creditmemo->roundPrice($orderItemWeeeAmountInclTax * $ratio);
-            $baseWeeeAmountInclTax = $creditmemo->roundPrice(
-                $orderItemBaseWeeeAmountInclTax * $ratio,
-                'base'
-            );
+            $baseWeeeAmountInclTax = $creditmemo->roundPrice($orderItemBaseWeeeAmountInclTax * $ratio, 'base');
 
             $itemTaxAmount = $weeeAmountInclTax - $weeeAmountExclTax;
             $itemBaseTaxAmount = $baseWeeeAmountInclTax - $baseWeeeAmountExclTax;
diff --git a/app/code/Magento/Weee/Model/Total/Invoice/Weee.php b/app/code/Magento/Weee/Model/Total/Invoice/Weee.php
index 457a08ccd86691eac2615dcbffcc5571bc8eaf6e..a5bed91ec0c366f9d72e7e6762be8f17249a3a3b 100644
--- a/app/code/Magento/Weee/Model/Total/Invoice/Weee.php
+++ b/app/code/Magento/Weee/Model/Total/Invoice/Weee.php
@@ -57,11 +57,12 @@ class Weee extends \Magento\Sales\Model\Order\Invoice\Total\AbstractTotal
             $orderItem = $item->getOrderItem();
             $orderItemQty = $orderItem->getQtyOrdered();
 
-            if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() <= 0) {
+            if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() < 0) {
                 continue;
             }
 
             $ratio = $item->getQty() / $orderItemQty;
+
             $orderItemWeeeAmount = $orderItem->getWeeeTaxAppliedRowAmount();
             $orderItemBaseWeeeAmount = $orderItem->getBaseWeeeTaxAppliedRowAmnt();
             $weeeAmount = $invoice->roundPrice($orderItemWeeeAmount * $ratio);
diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php
index c304dd40f5a099ea51e588c7fd3c35fca3adb148..6c098098c409cd434c84066bb8fdbb861a210012 100644
--- a/app/code/Magento/Weee/Setup/InstallSchema.php
+++ b/app/code/Magento/Weee/Setup/InstallSchema.php
@@ -86,28 +86,24 @@ class InstallSchema implements InstallSchemaInterface
             'country',
             $setup->getTable('directory_country'),
             'country_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('weee_tax', 'entity_id', 'catalog_product_entity', 'entity_id'),
             'entity_id',
             $setup->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'),
             'website_id',
             $setup->getTable('store_website'),
             'website_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $setup->getFkName('weee_tax', 'attribute_id', 'eav_attribute', 'attribute_id'),
             'attribute_id',
             $setup->getTable('eav_attribute'),
             'attribute_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Weee Tax'
diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php
index 47aa7692a51d940fb25b894b0951aac0af7590c3..0fdd0ad9bdab19c2c51da37e8b7751c807dc9620 100644
--- a/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php
+++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php
@@ -169,6 +169,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
     public function collectDataProvider()
     {
         $result = [];
+
         // scenario 1: 3 item_1, $100 with $weee, 8.25 tax rate, 3 items invoiced, full creditmemo
         $result['complete_creditmemo'] = [
             'creditmemo_data' => [
@@ -236,7 +237,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                         'tax_ratio' => serialize(['weee' => 1.0]),
                         'weee_tax_applied_row_amount' => 30,
                         'base_weee_tax_applied_row_amount' => 30,
-
                     ],
                 ],
                 'creditmemo_data' => [
@@ -248,7 +248,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 300,
                     'subtotal_incl_tax' => 357.22,
                     'base_subtotal_incl_tax' => 357.22,
-
                 ],
             ],
         ];
@@ -320,7 +319,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                         'tax_ratio' => serialize(['weee' => 1.65 / 2.47]),
                         'weee_tax_applied_row_amount' => 20,
                         'base_weee_tax_applied_row_amount' => 20,
-
                     ],
                 ],
                 'creditmemo_data' => [
@@ -332,7 +330,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 200,
                     'subtotal_incl_tax' => 238.15,
                     'base_subtotal_incl_tax' => 238.15,
-
                 ],
             ],
         ];
@@ -404,7 +401,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                         'tax_ratio' => serialize(['weee' => 0.83 / 2.47]),
                         'weee_tax_applied_row_amount' => 10,
                         'base_weee_tax_applied_row_amount' => 10,
-
                     ],
                 ],
                 'creditmemo_data' => [
@@ -416,7 +412,79 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 100,
                     'subtotal_incl_tax' => 119.07,
                     'base_subtotal_incl_tax' => 119.07,
+                ],
+            ],
+        ];
 
+        // scenario 4: 3 item_1, $100 with $weee, 8.25 tax rate.  Returning qty 0.
+        $result['zero_return'] = [
+            'creditmemo_data' => [
+                'items' => [
+                    'item_1' => [
+                        'order_item' => [
+                            'qty_ordered' => 3,
+                            'weee_tax_applied_row_amount' => 30,
+                            'base_weee_tax_applied_row_amnt' => 30,
+                            'row_weee_tax_incl_tax' => 32.47,
+                            'base_row_weee_tax_incl_tax' => 32.47,
+                            'weee_amount_invoiced' => 30,
+                            'base_weee_amount_invoiced' => 30,
+                            'weee_amount_refunded' => 0,
+                            'base_weee_amount_refunded' => 0,
+                            'weee_tax_amount_invoiced' => 2.47,
+                            'base_weee_tax_amount_invoiced' => 2.47,
+                            'weee_tax_amount_refunded' => 0,
+                            'base_weee_tax_amount_refunded' => 0,
+                            'applied_weee' => [
+                                [
+                                    'title' => 'recycling_fee',
+                                    'base_row_amount' => 30,
+                                    'row_amount' => 30,
+                                    'base_row_amount_incl_tax' => 32.47,
+                                    'row_amount_incl_tax' => 32.47,
+                                ],
+                            ],
+                            'qty_invoiced' => 3,
+                        ],
+                        'is_last' => true,
+                        'data_fields' => [
+                            'qty' => 0,
+                            'applied_weee' => [
+                                [
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+                'include_in_subtotal' => false,
+                'data_fields' => [
+                    'grand_total' => 300,
+                    'base_grand_total' => 300,
+                    'subtotal' => 300,
+                    'base_subtotal' => 300,
+                    'subtotal_incl_tax' => 324.75,
+                    'base_subtotal_incl_tax' => 324.75,
+                    'tax_amount' => 0,
+                    'base_tax_amount' => 0,
+                ],
+            ],
+            'expected_results' => [
+                'creditmemo_items' => [
+                    'item_1' => [
+                        'applied_weee' => [
+                            [
+                                'title' => 'recycling_fee',
+                                'base_row_amount' => 0,
+                                'row_amount' => 0,
+                                'base_row_amount_incl_tax' => 0,
+                                'row_amount_incl_tax' => 0,
+                            ],
+                        ],
+                    ],
+                ],
+                'creditmemo_data' => [
+                    'subtotal' => 300,
+                    'base_subtotal' => 300,
                 ],
             ],
         ];
diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php
index 4d91954b70fa26e81bf385295b50e5c25cf60934..d034947c48d71129a8ca1bbce59d39b69275d341 100644
--- a/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php
+++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php
@@ -172,6 +172,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
     public function collectDataProvider()
     {
         $result = [];
+
         // 3 item_1, $100 with $weee, 8.25 tax rate, full invoice
         $result['complete_invoice'] = [
             'order_data' => [
@@ -269,7 +270,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 300,
                     'subtotal_incl_tax' => 344.85,
                     'base_subtotal_incl_tax' => 344.85,
-
                 ],
             ],
         ];
@@ -360,7 +360,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                         'tax_ratio' => serialize(['weee' => 1.65 / 2.47]),
                         'weee_tax_applied_row_amount' => 20,
                         'base_weee_tax_applied_row_amount' => 20,
-
                     ],
                 ],
                 'invoice_data' => [
@@ -372,7 +371,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 200,
                     'subtotal_incl_tax' => 238.15,
                     'base_subtotal_incl_tax' => 238.15,
-
                 ],
             ],
         ];
@@ -464,7 +462,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                         'tax_ratio' => serialize(['weee' => 0.82 / 2.47]),
                         'weee_tax_applied_row_amount' => 10,
                         'base_weee_tax_applied_row_amount' => 10,
-
                     ],
                 ],
                 'invoice_data' => [
@@ -476,7 +473,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 100,
                     'subtotal_incl_tax' => 119.07,
                     'base_subtotal_incl_tax' => 119.07,
-
                 ],
             ],
         ];
@@ -580,7 +576,98 @@ class WeeeTest extends \PHPUnit_Framework_TestCase
                     'base_subtotal' => 100,
                     'subtotal_incl_tax' => 114.95,
                     'base_subtotal_incl_tax' => 114.95,
+                ],
+            ],
+        ];
 
+        // 3 item_1, $100 with $weee, 8.25 tax rate. Invoicing qty 0.
+        $result['zero_invoice'] = [
+            'order_data' => [
+                'previous_invoices' => [
+                ],
+                'data_fields' => [
+                    'shipping_tax_amount' => 1.24,
+                    'base_shipping_tax_amount' => 1.24,
+                    'shipping_hidden_tax_amount' => 0,
+                    'base_shipping_hidden_tax_amount' => 0,
+                    'tax_amount' => 16.09,
+                    'tax_invoiced' => 0,
+                    'base_tax_amount' => 16.09,
+                    'base_tax_amount_invoiced' => 0,
+                    'subtotal' => '300',
+                    'base_subtotal' => '300',
+                ],
+            ],
+            'invoice_data' => [
+                'items' => [
+                    'item_1' => [
+                        'order_item' => [
+                            'qty_ordered' => 3,
+                            'weee_tax_applied_row_amount' => 30,
+                            'base_weee_tax_applied_row_amnt' => 30,
+                            'row_weee_tax_incl_tax' => 32.47,
+                            'base_row_weee_tax_incl_tax' => 32.47,
+                            'weee_amount_invoiced' => 0,
+                            'base_weee_amount_invoiced' => 0,
+                            'weee_tax_amount_invoiced' => 0,
+                            'base_weee_tax_amount_invoiced' => 0,
+                            'applied_weee' => [
+                                [
+                                    'title' => 'recycling_fee',
+                                    'base_row_amount' => 30,
+                                    'row_amount' => 30,
+                                    'base_row_amount_incl_tax' => 32.47,
+                                    'row_amount_incl_tax' => 32.47,
+                                ],
+                            ],
+                            'applied_weee_updated' => [
+                                'base_row_amount_invoiced' => 30,
+                                'row_amount_invoiced' => 30,
+                                'base_tax_amount_invoiced' => 2.47,
+                                'tax_amount_invoiced' => 2.47,
+                            ],
+                            'qty_invoiced' => 0,
+                        ],
+                        'is_last' => true,
+                        'data_fields' => [
+                            'qty' => 0,
+                            'applied_weee' => [
+                                [
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+                'is_last' => true,
+                'include_in_subtotal' => false,
+                'data_fields' => [
+                    'grand_total' => 181.09,
+                    'base_grand_total' => 181.09,
+                    'subtotal' => 300,
+                    'base_subtotal' => 300,
+                    'subtotal_incl_tax' => 314.85,
+                    'base_subtotal_incl_tax' => 314.85,
+                    'tax_amount' => 16.09,
+                    'base_tax_amount' => 16.09,
+                ],
+            ],
+            'expected_results' => [
+                'invoice_items' => [
+                    'item_1' => [
+                        'applied_weee' => [
+                            [
+                                'title' => 'recycling_fee',
+                                'base_row_amount' => 0,
+                                'row_amount' => 0,
+                                'base_row_amount_incl_tax' => 0,
+                                'row_amount_incl_tax' => 0,
+                            ],
+                        ],
+                    ],
+                ],
+                'invoice_data' => [
+                    'subtotal' => 300,
+                    'base_subtotal' => 300,
                 ],
             ],
         ];
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/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php
index 4d71df5ef6ca67596d40ec2228ec75ca5f1d3966..60a95b70f7b5c931436a7fe6bd81e554bd6e3b62 100644
--- a/app/code/Magento/Widget/Setup/InstallSchema.php
+++ b/app/code/Magento/Widget/Setup/InstallSchema.php
@@ -167,7 +167,6 @@ class InstallSchema implements InstallSchemaInterface
             'theme_id',
             $installer->getTable('theme'),
             'theme_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Instances of Widget for Package Theme'
@@ -235,7 +234,6 @@ class InstallSchema implements InstallSchemaInterface
             'instance_id',
             $installer->getTable('widget_instance'),
             'instance_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Instance of Widget on Page'
@@ -275,7 +273,6 @@ class InstallSchema implements InstallSchemaInterface
             'page_id',
             $installer->getTable('widget_instance_page'),
             'page_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName(
@@ -287,7 +284,6 @@ class InstallSchema implements InstallSchemaInterface
             'layout_update_id',
             $installer->getTable('layout_update'),
             'layout_update_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Layout updates'
@@ -380,7 +376,6 @@ class InstallSchema implements InstallSchemaInterface
             'layout_update_id',
             $installer->getTable('layout_update'),
             'layout_update_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addIndex(
             $installer->getIdxName(
@@ -394,14 +389,12 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addForeignKey(
             $installer->getFkName('layout_link', 'theme_id', 'theme', 'theme_id'),
             'theme_id',
             $installer->getTable('theme'),
             'theme_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Layout Link'
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/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php
index cde21e7ff48653f2f09dbe0a05429befc21ce0f8..f2894e5fbec2ea9c8218117e9112f810a8562b0b 100644
--- a/app/code/Magento/Wishlist/Setup/InstallSchema.php
+++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php
@@ -76,7 +76,6 @@ class InstallSchema implements InstallSchemaInterface
             'customer_id',
             $installer->getTable('customer_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Wishlist main Table'
@@ -138,7 +137,6 @@ class InstallSchema implements InstallSchemaInterface
             'wishlist_id',
             $installer->getTable('wishlist'),
             'wishlist_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addIndex(
             $installer->getIdxName('wishlist_item', 'product_id'),
@@ -148,7 +146,6 @@ class InstallSchema implements InstallSchemaInterface
             'product_id',
             $installer->getTable('catalog_product_entity'),
             'entity_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->addIndex(
             $installer->getIdxName('wishlist_item', 'store_id'),
@@ -158,8 +155,7 @@ class InstallSchema implements InstallSchemaInterface
             'store_id',
             $installer->getTable('store'),
             'store_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+            \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
         )->setComment(
             'Wishlist items'
         );
@@ -205,7 +201,6 @@ class InstallSchema implements InstallSchemaInterface
             'wishlist_item_id',
             $installer->getTable('wishlist_item'),
             'wishlist_item_id',
-            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
             \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
         )->setComment(
             'Wishlist Item Option Table'
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 c8721c87609c6a84b5b35d2abd2e15b2f0fddbdb..93c1f2b024685ab26c8bf8fc467f2aa3a71c868f 100644
--- a/composer.json
+++ b/composer.json
@@ -1,8 +1,8 @@
 {
-    "name": "magento/project-community-edition",
-    "description": "Magento project (Community Edition)",
+    "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"
@@ -30,7 +30,7 @@
         "zendframework/zend-log": "2.3.1",
         "zendframework/zend-http": "2.3.1",
         "magento/zendframework1": "1.12.10",
-        "composer/composer": "1.0.0-alpha8",
+        "composer/composer": "1.0.0-alpha9",
         "monolog/monolog": "1.11.0",
         "oyejorge/less.php": "1.7.0.3",
         "tubalmartin/cssmin": "2.4.8-p4",
@@ -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",
@@ -208,5 +209,7 @@
             "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/",
             "Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/"
         }
-    }
+    },
+    "minimum-stability": "alpha",
+    "prefer-stable": true
 }
diff --git a/composer.lock b/composer.lock
index 02e531e791e517c23da1202be3be61491553ec1d..036da6915e82470dc348beffecb1a07f394215b4 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,32 +4,32 @@
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "974fa7d59a25f8a31c70ea53068944cd",
+    "hash": "986eef2b3ae742a365a8a886f0babdd6",
     "packages": [
         {
             "name": "composer/composer",
-            "version": "1.0.0-alpha8",
+            "version": "1.0.0-alpha9",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/composer.git",
-                "reference": "1eb1df44a97fb2daca1bb8b007f3bee012f0aa46"
+                "reference": "eb1ce550ca51134ee619ad3e37f5a0b7e980dd24"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/composer/zipball/1eb1df44a97fb2daca1bb8b007f3bee012f0aa46",
-                "reference": "1eb1df44a97fb2daca1bb8b007f3bee012f0aa46",
+                "url": "https://api.github.com/repos/composer/composer/zipball/eb1ce550ca51134ee619ad3e37f5a0b7e980dd24",
+                "reference": "eb1ce550ca51134ee619ad3e37f5a0b7e980dd24",
                 "shasum": ""
             },
             "require": {
-                "justinrainbow/json-schema": "1.1.*",
+                "justinrainbow/json-schema": "~1.1",
                 "php": ">=5.3.2",
-                "seld/jsonlint": "1.*",
+                "seld/jsonlint": "~1.0",
                 "symfony/console": "~2.3",
                 "symfony/finder": "~2.2",
                 "symfony/process": "~2.1"
             },
             "require-dev": {
-                "phpunit/phpunit": "~3.7.10"
+                "phpunit/phpunit": "~4.0"
             },
             "suggest": {
                 "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",
@@ -54,46 +54,57 @@
                 "MIT"
             ],
             "authors": [
-                {
-                    "name": "Jordi Boggiano",
-                    "email": "j.boggiano@seld.be",
-                    "homepage": "http://seld.be",
-                    "role": "Developer"
-                },
                 {
                     "name": "Nils Adermann",
                     "email": "naderman@naderman.de",
-                    "homepage": "http://www.naderman.de",
-                    "role": "Developer"
+                    "homepage": "http://www.naderman.de"
+                },
+                {
+                    "name": "Jordi Boggiano",
+                    "email": "j.boggiano@seld.be",
+                    "homepage": "http://seld.be"
                 }
             ],
-            "description": "Dependency Manager",
+            "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.",
             "homepage": "http://getcomposer.org/",
             "keywords": [
                 "autoload",
                 "dependency",
                 "package"
             ],
-            "time": "2014-01-06 18:39:59"
+            "time": "2014-12-07 17:15:20"
         },
         {
             "name": "justinrainbow/json-schema",
-            "version": "1.1.0",
+            "version": "1.4.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/justinrainbow/json-schema.git",
-                "reference": "05ff6d8d79fe3ad190b0663d80d3f9deee79416c"
+                "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/05ff6d8d79fe3ad190b0663d80d3f9deee79416c",
-                "reference": "05ff6d8d79fe3ad190b0663d80d3f9deee79416c",
+                "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2465fe486c864e30badaa4d005ebdf89dbc503f3",
+                "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.0"
             },
+            "require-dev": {
+                "json-schema/json-schema-test-suite": "1.1.0",
+                "phpdocumentor/phpdocumentor": "~2",
+                "phpunit/phpunit": "~3.7"
+            },
+            "bin": [
+                "bin/validate-json"
+            ],
             "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4.x-dev"
+                }
+            },
             "autoload": {
                 "psr-0": {
                     "JsonSchema": "src/"
@@ -101,14 +112,9 @@
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
-                "NewBSD"
+                "BSD-3-Clause"
             ],
             "authors": [
-                {
-                    "name": "Igor Wiedler",
-                    "email": "igor@wiedler.ch",
-                    "homepage": "http://wiedler.ch/igor/"
-                },
                 {
                     "name": "Bruno Prieto Reis",
                     "email": "bruno.p.reis@gmail.com"
@@ -117,10 +123,13 @@
                     "name": "Justin Rainbow",
                     "email": "justin.rainbow@gmail.com"
                 },
+                {
+                    "name": "Igor Wiedler",
+                    "email": "igor@wiedler.ch"
+                },
                 {
                     "name": "Robert Schönthal",
-                    "email": "robert.schoenthal@gmail.com",
-                    "homepage": "http://digitalkaoz.net"
+                    "email": "seroscho@googlemail.com"
                 }
             ],
             "description": "A library to validate a json schema.",
@@ -129,7 +138,7 @@
                 "json",
                 "schema"
             ],
-            "time": "2012-01-03 00:33:17"
+            "time": "2015-03-27 16:41:39"
         },
         {
             "name": "magento/magento-composer-installer",
@@ -2007,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": {
@@ -2056,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",
@@ -2272,16 +2281,16 @@
         },
         {
             "name": "phpunit/php-code-coverage",
-            "version": "2.0.15",
+            "version": "2.0.16",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
-                "reference": "34cc484af1ca149188d0d9e91412191e398e0b67"
+                "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67",
-                "reference": "34cc484af1ca149188d0d9e91412191e398e0b67",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
+                "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
                 "shasum": ""
             },
             "require": {
@@ -2330,7 +2339,7 @@
                 "testing",
                 "xunit"
             ],
-            "time": "2015-01-24 10:06:35"
+            "time": "2015-04-11 04:35:00"
         },
         {
             "name": "phpunit/php-file-iterator",
@@ -3414,12 +3423,12 @@
         }
     ],
     "aliases": [],
-    "minimum-stability": "stable",
+    "minimum-stability": "alpha",
     "stability-flags": {
         "composer/composer": 15,
         "phpmd/phpmd": 0
     },
-    "prefer-stable": false,
+    "prefer-stable": true,
     "prefer-lowest": false,
     "platform": {
         "php": "~5.5.0|~5.6.0"
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/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php
index 463f490480ce06c6e3016e5606971eb6ee1fe392..caf1b320ef82ce37e47ca055dbcb95bebd599bf9 100644
--- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php
@@ -33,12 +33,13 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb
         $this->assertArrayHasKey(0, $result);
         $this->assertArrayHasKey('option_id', $result[0]);
         $this->assertArrayHasKey('is_default', $result[0]);
-        $this->assertArrayHasKey('is_defined', $result[0]);
+        $this->assertArrayHasKey('can_change_quantity', $result[0]);
         $this->assertArrayHasKey('price', $result[0]);
         $this->assertArrayHasKey('price_type', $result[0]);
+        $this->assertNotNull($result[0]['id']);
 
-        unset($result[0]['option_id'], $result[0]['is_default'], $result[0]['is_defined']);
-        unset($result[0]['price'], $result[0]['price_type']);
+        unset($result[0]['option_id'], $result[0]['is_default'], $result[0]['can_change_quantity']);
+        unset($result[0]['price'], $result[0]['price_type'], $result[0]['id']);
 
         ksort($result[0]);
         ksort($expected[0]);
@@ -83,6 +84,55 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb
         $this->assertGreaterThan(0, $childId);
     }
 
+    /**
+     * @magentoApiDataFixture Magento/Bundle/_files/product.php
+     * @magentoApiDataFixture Magento/Catalog/_files/product_virtual.php
+     */
+    public function testSaveChild()
+    {
+        $productSku = 'bundle-product';
+        $children = $this->getChildren($productSku);
+
+        $linkedProduct = $children[0];
+
+        //Modify a few fields
+        $linkedProduct['is_default'] = true;
+        $linkedProduct['qty'] = 2;
+
+        $this->assertTrue($this->saveChild($productSku, $linkedProduct));
+        $children = $this->getChildren($productSku);
+        $this->assertEquals($linkedProduct, $children[0]);
+    }
+
+    /**
+     * @param string $productSku
+     * @param array $linkedProduct
+     * @return string
+     */
+    private function saveChild($productSku, $linkedProduct)
+    {
+        $resourcePath = self::RESOURCE_PATH . '/:sku/links/:id';
+        $serviceInfo = [
+            'rest' => [
+                'resourcePath' => str_replace(
+                    [':sku', ':id'],
+                    [$productSku, $linkedProduct['id']],
+                    $resourcePath
+                ),
+                'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
+            ],
+            'soap' => [
+                'service' => self::SERVICE_NAME,
+                'serviceVersion' => self::SERVICE_VERSION,
+                'operation' => self::SERVICE_NAME . 'SaveChild',
+            ],
+        ];
+        return $this->_webApiCall(
+            $serviceInfo,
+            ['sku' => $productSku, 'linkedProduct' => $linkedProduct]
+        );
+    }
+
     /**
      * @param string $productSku
      * @param int $optionId
@@ -158,6 +208,6 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb
                 'operation' => self::SERVICE_NAME . 'getChildren',
             ],
         ];
-        return $this->_webApiCall($serviceInfo, ['productId' => $productSku]);
+        return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]);
     }
 }
diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
index 325e35ee8291041dd553575d39ed4523f71e5284..d402aea3d67a790681fe4f8970e5bda17e8bcf67 100644
--- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
@@ -29,7 +29,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi
                     'sku' => 'simple',
                     'qty' => 1,
                     'position' => 0,
-                    'is_defined' => true,
+                    'can_change_quantity' => 1,
                     'is_default' => false,
                     'price' => null,
                     'price_type' => null,
@@ -42,9 +42,13 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi
         $this->assertArrayHasKey('option_id', $result);
         $expected['product_links'][0]['option_id'] = $result['option_id'];
         unset($result['option_id']);
+        $this->assertNotNull($result['product_links'][0]['id']);
+        unset($result['product_links'][0]['id']);
 
         ksort($expected);
         ksort($result);
+        ksort($expected['product_links'][0]);
+        ksort($result['product_links'][0]);
         $this->assertEquals($expected, $result);
     }
 
@@ -66,7 +70,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi
                         'sku' => 'simple',
                         'qty' => 1,
                         'position' => 0,
-                        'is_defined' => true,
+                        'can_change_quantity' => 1,
                         'is_default' => false,
                         'price' => null,
                         'price_type' => null,
@@ -80,9 +84,13 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi
         $this->assertArrayHasKey('option_id', $result[0]);
         $expected[0]['product_links'][0]['option_id'] = $result[0]['option_id'];
         unset($result[0]['option_id']);
+        $this->assertNotNull($result[0]['product_links'][0]['id']);
+        unset($result[0]['product_links'][0]['id']);
 
         ksort($expected[0]);
         ksort($result[0]);
+        ksort($expected[0]['product_links'][0]);
+        ksort($result[0]['product_links'][0]);
         $this->assertEquals($expected, $result);
     }
 
diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php
index 1a817b18d3b593df2cbbef8280a42e40f0d5b84c..80fbe1999d3349f6b889931c23515cba7316e0c2 100644
--- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php
@@ -10,6 +10,7 @@ use Magento\Catalog\Api\Data\ProductInterface;
 use Magento\Framework\Api\ExtensibleDataInterface;
 use Magento\TestFramework\Helper\Bootstrap;
 use Magento\TestFramework\TestCase\WebapiAbstract;
+use Magento\Bundle\Api\Data\LinkInterface;
 
 /**
  * Class ProductServiceTest for testing Bundle Product API
@@ -19,6 +20,7 @@ class ProductServiceTest extends WebapiAbstract
     const SERVICE_NAME = 'catalogProductRepositoryV1';
     const SERVICE_VERSION = 'V1';
     const RESOURCE_PATH = '/V1/products';
+    const BUNDLE_PRODUCT_ID = 'sku-test-product-bundle';
 
     /**
      * @var \Magento\Catalog\Model\Resource\Product\Collection
@@ -39,20 +41,7 @@ class ProductServiceTest extends WebapiAbstract
      */
     public function tearDown()
     {
-        /** @var \Magento\Framework\Registry $registry */
-        $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry');
-
-        $registry->unregister('isSecureArea');
-        $registry->register('isSecureArea', true);
-
-        $this->productCollection->addFieldToFilter(
-            'sku',
-            ['in' => ['sku-test-product-bundle']]
-        )->delete();
-        unset($this->productCollection);
-
-        $registry->unregister('isSecureArea');
-        $registry->register('isSecureArea', false);
+        $this->deleteProductBySku(self::BUNDLE_PRODUCT_ID);
         parent::tearDown();
     }
 
@@ -61,7 +50,6 @@ class ProductServiceTest extends WebapiAbstract
      */
     public function testCreateBundle()
     {
-        $this->markTestSkipped('Processing of custom attributes has been changed in MAGETWO-34448.');
         $bundleProductOptions = [
             [
                 "title" => "test option",
@@ -73,38 +61,365 @@ class ProductServiceTest extends WebapiAbstract
                         "qty" => 1,
                         'is_default' => false,
                         'price' => 1.0,
-                        'price_type' => 1
+                        'price_type' => LinkInterface::PRICE_TYPE_FIXED,
                     ],
                 ],
             ],
         ];
 
-        $uniqueId = 'sku-test-product-bundle';
         $product = [
-            "sku" => $uniqueId,
-            "name" => $uniqueId,
+            "sku" => self::BUNDLE_PRODUCT_ID,
+            "name" => self::BUNDLE_PRODUCT_ID,
             "type_id" => "bundle",
             "price" => 50,
             'attribute_set_id' => 4,
+            "custom_attributes" => [
+                [
+                    "attribute_code" => "price_type",
+                    "value" => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED,
+                ],
+                [
+                    "attribute_code" => "price_view",
+                    "value" => 1,
+                ],
+            ],
             "extension_attributes" => [
-                "price_type" => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC,
                 "bundle_product_options" => $bundleProductOptions,
-                "price_view" => "test"
             ],
         ];
 
         $response = $this->createProduct($product);
 
-        $this->assertEquals($uniqueId, $response[ProductInterface::SKU]);
+        $this->assertEquals(self::BUNDLE_PRODUCT_ID, $response[ProductInterface::SKU]);
+        $this->assertEquals(50, $response['price']);
+        $this->assertTrue(
+            isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"])
+        );
+        $resultBundleProductOptions
+            = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"];
+        $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"]));
+        $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]);
+
+        $response = $this->getProduct(self::BUNDLE_PRODUCT_ID);
+        $this->assertTrue(
+            isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"])
+        );
+        $resultBundleProductOptions
+            = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"];
+        $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"]));
+        $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]);
+    }
+
+    /**
+     * @magentoApiDataFixture Magento/Catalog/_files/products_new.php
+     * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php
+     */
+    public function testUpdateBundleModifyExistingSelection()
+    {
+        $bundleProduct = $this->createFixedPriceBundleProduct();
+        $bundleProductOptions = $this->getBundleProductOptions($bundleProduct);
+
+        $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id'];
+
+        //Change the type of existing option
+        $bundleProductOptions[0]['type'] = 'select';
+        //Change the sku of existing link and qty
+        $bundleProductOptions[0]['product_links'][0]['sku'] = 'simple2';
+        $bundleProductOptions[0]['product_links'][0]['qty'] = 2;
+        $bundleProductOptions[0]['product_links'][0]['price'] = 10;
+        $bundleProductOptions[0]['product_links'][0]['price_type'] = 1;
+        $this->setBundleProductOptions($bundleProduct, $bundleProductOptions);
+
+        $updatedProduct = $this->saveProduct($bundleProduct);
+
+        $bundleOptions = $this->getBundleProductOptions($updatedProduct);
+        $this->assertEquals('select', $bundleOptions[0]['type']);
+        $this->assertEquals('simple2', $bundleOptions[0]['product_links'][0]['sku']);
+        $this->assertEquals(2, $bundleOptions[0]['product_links'][0]['qty']);
+        $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']);
+        $this->assertEquals(10, $bundleOptions[0]['product_links'][0]['price']);
+        $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']);
+    }
+
+    /**
+     * @magentoApiDataFixture Magento/Catalog/_files/products_new.php
+     * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php
+     */
+    public function testUpdateBundleModifyExistingOptionOnly()
+    {
+        $bundleProduct = $this->createFixedPriceBundleProduct();
+        $bundleProductOptions = $this->getBundleProductOptions($bundleProduct);
+
+        $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id'];
+
+        //Change the type of existing option
+        $bundleProductOptions[0]['type'] = 'select';
+        //unset product_links attribute
+        unset($bundleProductOptions[0]['product_links']);
+        $this->setBundleProductOptions($bundleProduct, $bundleProductOptions);
+
+        $updatedProduct = $this->saveProduct($bundleProduct);
+
+        $bundleOptions = $this->getBundleProductOptions($updatedProduct);
+        $this->assertEquals('select', $bundleOptions[0]['type']);
+        $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']);
+        $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['qty']);
+        $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']);
+        $this->assertEquals(20, $bundleOptions[0]['product_links'][0]['price']);
+        $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']);
+    }
+
+    /**
+     * @magentoApiDataFixture Magento/Catalog/_files/products_new.php
+     * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php
+     */
+    public function testUpdateProductWithoutBundleOptions()
+    {
+        $bundleProduct = $this->createFixedPriceBundleProduct();
+        $bundleProductOptions = $this->getBundleProductOptions($bundleProduct);
+
+        $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id'];
+
+        //unset bundle_product_options
+        unset($bundleProductOptions[0]['product_links']);
+        $this->setBundleProductOptions($bundleProduct, null);
+
+        $updatedProduct = $this->saveProduct($bundleProduct);
+
+        $bundleOptions = $this->getBundleProductOptions($updatedProduct);
+        $this->assertEquals('checkbox', $bundleOptions[0]['type']);
+        $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']);
+        $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['qty']);
+        $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']);
+        $this->assertEquals(20, $bundleOptions[0]['product_links'][0]['price']);
+        $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']);
+    }
+
+    /**
+     * @magentoApiDataFixture Magento/Catalog/_files/products_new.php
+     * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php
+     */
+    public function testUpdateBundleAddSelection()
+    {
+        $bundleProduct = $this->createDynamicBundleProduct();
+        $bundleProductOptions = $this->getBundleProductOptions($bundleProduct);
+
+        //Add a selection to existing option
+        $bundleProductOptions[0]['product_links'][] = [
+            'sku' => 'simple2',
+            'qty' => 2,
+            "price" => 20,
+            "price_type" => 1,
+            "is_default" => false,
+        ];
+        $this->setBundleProductOptions($bundleProduct, $bundleProductOptions);
+        $updatedProduct = $this->saveProduct($bundleProduct);
+
+        $bundleOptions = $this->getBundleProductOptions($updatedProduct);
+        $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']);
+        $this->assertEquals('simple2', $bundleOptions[0]['product_links'][1]['sku']);
+        $this->assertEquals(2, $bundleOptions[0]['product_links'][1]['qty']);
+        $this->assertGreaterThan(
+            $bundleOptions[0]['product_links'][0]['id'],
+            $bundleOptions[0]['product_links'][1]['id']
+        );
+    }
+
+    /**
+     * @magentoApiDataFixture Magento/Catalog/_files/products_new.php
+     * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php
+     */
+    public function testUpdateBundleAddAndDeleteOption()
+    {
+        $bundleProduct = $this->createDynamicBundleProduct();
+
+        $bundleProductOptions = $this->getBundleProductOptions($bundleProduct);
+
+        $oldOptionId = $bundleProductOptions[0]['option_id'];
+        //replace current option with a new option
+        $bundleProductOptions[0] = [
+            'title' => 'new option',
+            'required' => true,
+            'type' => 'select',
+            'product_links' => [
+                [
+                    'sku' => 'simple2',
+                    'qty' => 2,
+                    "price" => 20,
+                    "price_type" => 1,
+                    "is_default" => false,
+                ],
+            ],
+        ];
+        $this->setBundleProductOptions($bundleProduct, $bundleProductOptions);
+        $this->saveProduct($bundleProduct);
+
+        $updatedProduct = $this->getProduct(self::BUNDLE_PRODUCT_ID);
+        $bundleOptions = $this->getBundleProductOptions($updatedProduct);
+        $this->assertEquals('new option', $bundleOptions[0]['title']);
+        $this->assertTrue($bundleOptions[0]['required']);
+        $this->assertEquals('select', $bundleOptions[0]['type']);
+        $this->assertGreaterThan($oldOptionId, $bundleOptions[0]['option_id']);
+        $this->assertFalse(isset($bundleOptions[1]));
+        $this->assertEquals('simple2', $bundleOptions[0]['product_links'][0]['sku']);
+        $this->assertEquals(2, $bundleOptions[0]['product_links'][0]['qty']);
+    }
+
+    /**
+     * Get the bundle_product_options custom attribute from product, null if the attribute is not set
+     *
+     * @param array $product
+     * @return array|null
+     */
+    protected function getBundleProductOptions($product)
+    {
+        if (isset($product[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"])) {
+            return $product[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"];
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Set the bundle_product_options custom attribute, replace existing attribute if exists
+     *
+     * @param array $product
+     * @param array $bundleProductOptions
+     */
+    protected function setBundleProductOptions(&$product, $bundleProductOptions)
+    {
+        $product["extension_attributes"]["bundle_product_options"] = $bundleProductOptions;
+        return;
+    }
+
+    /**
+     * Create dynamic bundle product with one option
+     *
+     * @return array
+     */
+    protected function createDynamicBundleProduct()
+    {
+        $bundleProductOptions = [
+            [
+                "title" => "test option",
+                "type" => "checkbox",
+                "required" => 1,
+                "product_links" => [
+                    [
+                        "sku" => 'simple',
+                        "qty" => 1,
+                        "is_default" => true,
+                        "price" => 10,
+                        "price_type" => 1,
+                    ],
+                ],
+            ],
+        ];
+
+        $uniqueId = self::BUNDLE_PRODUCT_ID;
+        $product = [
+            "sku" => $uniqueId,
+            "name" => $uniqueId,
+            "type_id" => "bundle",
+            'attribute_set_id' => 4,
+            "custom_attributes" => [
+                "price_type" => [
+                    'attribute_code' => 'price_type',
+                    'value' => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC
+                ],
+                "price_view" => [
+                    "attribute_code" => "price_view",
+                    "value" => "1",
+                ],
+            ],
+            "extension_attributes" => [
+                "bundle_product_options" => $bundleProductOptions,
+            ],
+        ];
+
+        $response = $this->createProduct($product);
+        $this->assertTrue(
+            isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"])
+        );
         $resultBundleProductOptions
             = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"];
-        $this->assertEquals($bundleProductOptions, $resultBundleProductOptions);
+        $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"]));
         $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]);
+        $this->assertTrue(isset($response['custom_attributes']));
+        $customAttributes = $this->convertCustomAttributes($response['custom_attributes']);
+        $this->assertTrue(isset($customAttributes['price_type']));
+        $this->assertEquals(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, $customAttributes['price_type']);
+        $this->assertTrue(isset($customAttributes['price_view']));
+        $this->assertEquals(1, $customAttributes['price_view']);
+        return $response;
+    }
+
+    /**
+     * Create fixed price bundle product with one option
+     *
+     * @return array
+     */
+    protected function createFixedPriceBundleProduct()
+    {
+        $bundleProductOptions = [
+            [
+                "title" => "test option",
+                "type" => "checkbox",
+                "required" => 1,
+                "product_links" => [
+                    [
+                        "sku" => 'simple',
+                        "qty" => 1,
+                        "price" => 20,
+                        "price_type" => 1,
+                        "is_default" => true,
+                    ],
+                ],
+            ],
+        ];
+
+        $uniqueId = self::BUNDLE_PRODUCT_ID;
+        $product = [
+            "sku" => $uniqueId,
+            "name" => $uniqueId,
+            "type_id" => "bundle",
+            "price" => 50,
+            'attribute_set_id' => 4,
+            "custom_attributes" => [
+                "price_type" => [
+                    'attribute_code' => 'price_type',
+                    'value' => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED
+                ],
+                "price_view" => [
+                    "attribute_code" => "price_view",
+                    "value" => "1",
+                ],
+            ],
+            "extension_attributes" => [
+                "bundle_product_options" => $bundleProductOptions,
+            ],
+        ];
 
-        $response = $this->getProduct($uniqueId);
+        $response = $this->createProduct($product);
         $resultBundleProductOptions
             = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"];
         $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]);
+        $this->assertTrue(isset($response['custom_attributes']));
+        $customAttributes = $this->convertCustomAttributes($response['custom_attributes']);
+        $this->assertTrue(isset($customAttributes['price_type']));
+        $this->assertEquals(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED, $customAttributes['price_type']);
+        $this->assertTrue(isset($customAttributes['price_view']));
+        $this->assertEquals(1, $customAttributes['price_view']);
+        return $response;
+    }
+
+    protected function convertCustomAttributes($customAttributes)
+    {
+        $convertedCustomAttribute = [];
+        foreach ($customAttributes as $customAttribute) {
+            $convertedCustomAttribute[$customAttribute['attribute_code']] = $customAttribute['value'];
+        }
+        return $convertedCustomAttribute;
     }
 
     /**
@@ -154,7 +469,56 @@ class ProductServiceTest extends WebapiAbstract
         ];
         $requestData = ['product' => $product];
         $response = $this->_webApiCall($serviceInfo, $requestData);
-        $product[ProductInterface::SKU] = $response[ProductInterface::SKU];
-        return $product;
+        return $response;
+    }
+
+    /**
+     * Delete a product by sku
+     *
+     * @param $productSku
+     * @return bool
+     */
+    protected function deleteProductBySku($productSku)
+    {
+        $resourcePath = self::RESOURCE_PATH . '/' . $productSku;
+        $serviceInfo = [
+            'rest' => [
+                'resourcePath' => $resourcePath,
+                'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE
+            ],
+            'soap' => [
+                'service' => self::SERVICE_NAME,
+                'serviceVersion' => self::SERVICE_VERSION,
+                'operation' => self::SERVICE_NAME . 'deleteById',
+            ],
+        ];
+        $requestData = ["sku" => $productSku];
+        $response = $this->_webApiCall($serviceInfo, $requestData);
+        return $response;
+    }
+
+    /**
+     * Save product
+     *
+     * @param array $product
+     * @return array the created product data
+     */
+    protected function saveProduct($product)
+    {
+        $resourcePath = self::RESOURCE_PATH . '/' . $product['sku'];
+        $serviceInfo = [
+            'rest' => [
+                'resourcePath' => $resourcePath,
+                'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT
+            ],
+            'soap' => [
+                'service' => self::SERVICE_NAME,
+                'serviceVersion' => self::SERVICE_VERSION,
+                'operation' => self::SERVICE_NAME . 'Save',
+            ],
+        ];
+        $requestData = ['product' => $product];
+        $response = $this->_webApiCall($serviceInfo, $requestData);
+        return $response;
     }
 }
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/Constraint/AssertAgreementTextPresent.php b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php
index 7c59cf1d4c263b8493ce2dcbb0889824a55e72ed..1bc49b0acc7773869bb8b2af6f669c01661f94df 100644
--- a/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php
+++ b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php
@@ -8,6 +8,7 @@ namespace Magento\Install\Test\Constraint;
 
 use Magento\Install\Test\Page\Install;
 use Magento\Mtf\Constraint\AbstractConstraint;
+use Magento\TestFramework\Inspection\Exception;
 
 /**
  * Check that agreement text present on Terms & Agreement page during install.
@@ -15,9 +16,14 @@ use Magento\Mtf\Constraint\AbstractConstraint;
 class AssertAgreementTextPresent extends AbstractConstraint
 {
     /**
-     * Part of license agreement text.
+     * Part of Default license agreement text.
      */
-    const LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0';
+    const DEFAULT_LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0';
+
+    /**
+     * Part of Default license agreement text.
+     */
+    const LICENSE_AGREEMENT_TEXT = 'END USER LICENSE AGREEMENT';
 
     /**
      * Assert that part of license agreement text is present on Terms & Agreement page.
@@ -27,11 +33,19 @@ class AssertAgreementTextPresent extends AbstractConstraint
      */
     public function processAssert(Install $installPage)
     {
-        \PHPUnit_Framework_Assert::assertContains(
-            self::LICENSE_AGREEMENT_TEXT,
-            $installPage->getLicenseBlock()->getLicense(),
-            'License agreement text is absent.'
-        );
+        try {
+            \PHPUnit_Framework_Assert::assertContains(
+                self::LICENSE_AGREEMENT_TEXT,
+                $installPage->getLicenseBlock()->getLicense(),
+                'License agreement text is absent.'
+            );
+        } catch (\Exception $e) {
+            \PHPUnit_Framework_Assert::assertContains(
+                self::DEFAULT_LICENSE_AGREEMENT_TEXT,
+                $installPage->getLicenseBlock()->getLicense(),
+                'License agreement text is absent.'
+            );
+        }
     }
 
     /**
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/Bundle/Model/Plugin/BundleSaveOptionsTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Plugin/BundleSaveOptionsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..b46a6544e18aa8f3c0a466afb394c30183e3223e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Plugin/BundleSaveOptionsTest.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Bundle\Model\Plugin;
+
+class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $_model;
+
+    /**
+     * @var \Magento\Catalog\Api\ProductRepositoryInterface
+     */
+    protected $productRepository;
+
+    protected function setUp()
+    {
+        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        $this->productRepository = $objectManager->get('Magento\Catalog\Api\ProductRepositoryInterface');
+    }
+
+    /**
+     * @magentoDataFixture Magento/Bundle/_files/product.php
+     * @magentoDbIsolation enabled
+     */
+    public function testSaveSuccess()
+    {
+        $title = "new title";
+        $bundleProductSku = 'bundle-product';
+        $product = $this->productRepository->get($bundleProductSku);
+        $bundleExtensionAttributes = $product->getExtensionAttributes()->getBundleProductOptions();
+        $bundleOption = $bundleExtensionAttributes[0];
+        $this->assertEquals(true, $bundleOption->getRequired());
+        $bundleOption->setTitle($title);
+
+        $oldDescription = $product->getDescription();
+        $description = $oldDescription . "hello";
+        $product->setDescription($description);
+        $product->getExtensionAttributes()->setBundleProductOptions([$bundleOption]);
+        $product = $this->productRepository->save($product);
+
+        $this->assertEquals($description, $product->getDescription());
+        $this->assertEquals($title, $product->getExtensionAttributes()->getBundleProductOptions()[0]->getTitle());
+    }
+
+    /**
+     * @magentoDataFixture Magento/Bundle/_files/product.php
+     * @magentoDbIsolation enabled
+     */
+    public function testSaveFailure()
+    {
+        $this->markTestSkipped("When MAGETWO-36510 is fixed, need to change Dbisolation to disabled");
+        $bundleProductSku = 'bundle-product';
+        $product = $this->productRepository->get($bundleProductSku);
+        $bundleExtensionAttributes = $product->getExtensionAttributes()->getBundleProductOptions();
+        $bundleOption = $bundleExtensionAttributes[0];
+        $this->assertEquals(true, $bundleOption->getRequired());
+        $bundleOption->setRequired(false);
+        //set an incorrect option id to trigger exception
+        $bundleOption->setOptionId(-1);
+
+        $description = "hello";
+
+        $product->setDescription($description);
+        $product->getExtensionAttributes()->setBundleProductOptions([$bundleOption]);
+        $caughtException = false;
+        try {
+            $this->productRepository->save($product);
+        } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+            $caughtException = true;
+        }
+
+        $this->assertTrue($caughtException);
+        /** @var \Magento\Catalog\Model\Product $product */
+        $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\Catalog\Model\Product')->load($product->getId());
+        $this->assertEquals(null, $product->getDescription());
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php
index 1bb799689c7ec3748bb251a5ae75f80dbd996271..663c2d0225742e375ea459b0b70ae903d90e00b7 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php
@@ -31,6 +31,12 @@ $product->setTypeId(
     \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
 )->setStockData(
     ['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]
+)->setPriceView(
+    1
+)->setPriceType(
+    1
+)->setPrice(
+    10.0
 )->setBundleOptionsData(
     [
         [
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/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php
deleted file mode 100644
index 7b3f1e37c8db98dd810ec1553d1033b9159022dd..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Sales\Model\Resource;
-
-class QuoteTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Quote\Model\Resource\Quote
-     */
-    protected $_resourceModel;
-
-    protected function setUp()
-    {
-        $this->_resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
-            'Magento\Quote\Model\Resource\Quote'
-        );
-    }
-
-    /**
-     * @magentoDataFixture Magento/Sales/_files/order.php
-     */
-    public function testIsOrderIncrementIdUsedNumericIncrementId()
-    {
-        $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('100000001'));
-    }
-
-    /**
-     * @magentoDataFixture Magento/Sales/_files/order_alphanumeric_id.php
-     */
-    public function testIsOrderIncrementIdUsedAlphanumericIncrementId()
-    {
-        $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('M00000001'));
-    }
-}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php
index 1862adfcee81f7a0d9a509e88b0d51b9febd2b05..c476e27898e83aa6c0632abe182c97d668349729 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php
@@ -48,7 +48,7 @@ $quote->setCustomerIsGuest(
         'Magento\Store\Model\StoreManagerInterface'
     )->getStore()->getId()
 )->setReservedOrderId(
-    'test01'
+    '100000001'
 )->setBillingAddress(
     $billingAddress
 )->setShippingAddress(
diff --git a/dev/tests/performance/benchmark.jmx b/dev/tests/performance/benchmark.jmx
index cd9ed6d2ce32c5897479e3b872accca6454d0e05..34b8617830f417808bcc2e5086b8ecf6efe94c72 100644
--- a/dev/tests/performance/benchmark.jmx
+++ b/dev/tests/performance/benchmark.jmx
@@ -864,7 +864,7 @@
             <collectionProp name="Arguments.arguments">
               <elementProp name="billing[address_id]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.value">37</stringProp>
+                <stringProp name="Argument.value"></stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">billing[address_id]</stringProp>
@@ -962,7 +962,7 @@
               </elementProp>
               <elementProp name="billing[save_in_address_book]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.value">0</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">billing[save_in_address_book]</stringProp>
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 1d5e17894031ef8128770154c92cf7816bb05a55..834e90911948bcba3d3ecc1a6dd945fbd9ef8988 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php
@@ -322,7 +322,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
 
     /**
      * Collect redundant dependencies
-     *
+     * @SuppressWarnings(PHPMD.NPathComplexity)
      * @test
      * @depends testUndeclared
      */
@@ -331,6 +331,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
         foreach (array_keys(self::$_mapDependencies) as $module) {
             $declared = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_DECLARED);
             $found = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_FOUND);
+            $found['Magento\Framework'] = 'Magento\Framework';
             $this->_setDependencies($module, self::TYPE_HARD, self::MAP_TYPE_REDUNDANT, array_diff($declared, $found));
         }
     }
@@ -427,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
             )
         );
@@ -489,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/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
index 7baeb9bac60b7ecbb782de7407a87d7033367831..6a1f2846a85df46a6293a7fc8c210feddce5d60d 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
@@ -2155,4 +2155,13 @@ return [
     ['_isCacheEnabled', 'Magento\Eav\Model\Config'],
     ['_createCustomerAttribute', '\Magento\Customer\Model\Customer'],
     ['prepareCatalogProductPriceIndexTable', 'Magento\CatalogRule\Model\Observer'],
+    ['joinOrders', 'Magento\Reports\Model\Resource\Customer\Collection'],
+    ['addOrdersCount', 'Magento\Reports\Model\Resource\Customer\Collection'],
+    ['addSumAvgTotals', 'Magento\Reports\Model\Resource\Customer\Collection'],
+    ['orderByTotalAmount', 'Magento\Reports\Model\Resource\Customer\Collection'],
+    ['addOrdersCount', 'Magento\Reports\Model\Resource\Product\Collection'],
+    ['addOrderedQty', 'Magento\Reports\Model\Resource\Product\Collection'],
+    ['prepareForProductsInCarts', 'Magento\Reports\Model\Resource\Quote\Collection'],
+    ['getOrdersSubSelect', 'Magento\Reports\Model\Resource\Quote\Collection'],
+    ['isOrderIncrementIdUsed', 'Magento\Quote\Model\Resource\Quote'],
 ];
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/dev/tools/performance-toolkit/fixtures/configurable_products.php b/dev/tools/performance-toolkit/fixtures/configurable_products.php
index af3a5b5c6cd2bbc1da4eb0aa299971b436b43f69..a3aa8f8ba8d244eba56a8ca2e184be05f7cdbbce 100644
--- a/dev/tools/performance-toolkit/fixtures/configurable_products.php
+++ b/dev/tools/performance-toolkit/fixtures/configurable_products.php
@@ -885,7 +885,7 @@ class ConfigurableProductsFixture extends \Magento\ToolkitFramework\Fixture
         /** @var \Magento\ImportExport\Model\Import $import */
         $import = $this->application->getObjectManager()->create(
             'Magento\ImportExport\Model\Import',
-            ['data' => ['entity' => 'catalog_product', 'behavior' => 'append']]
+            ['data' => ['entity' => 'catalog_product', 'behavior' => 'replace']]
         );
 
         $source = new \Magento\ToolkitFramework\ImportExport\Fixture\Complex\Generator($pattern, $configurablesCount);
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 84ab04e316702c3f3575d9b6bff71bf5db92aff6..938cfe6a31ec26f0193059607e1a20ea68bba299 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
@@ -375,7 +375,6 @@ interface AdapterInterface
         $refTableName,
         $refColumnName,
         $onDelete = self::FK_ACTION_CASCADE,
-        $onUpdate = self::FK_ACTION_CASCADE,
         $purge = false,
         $schemaName = null,
         $refSchemaName = null
@@ -986,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 c46f71cf9ebe447a028d6ce512819631ebd463e9..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;
 
@@ -1071,7 +1072,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
      * REF_TABLE_NAME   => string; reference table name
      * REF_COLUMN_NAME  => string; reference column name
      * ON_DELETE        => string; action type on delete row
-     * ON_UPDATE        => string; action type on update row
      *
      * @param string $tableName
      * @param string $schemaName
@@ -1101,8 +1101,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
                     'REF_SHEMA_NAME'    => isset($match[4]) ? $match[4] : $schemaName,
                     'REF_TABLE_NAME'    => $match[5],
                     'REF_COLUMN_NAME'   => $match[6],
-                    'ON_DELETE'         => isset($match[7]) ? $match[8] : '',
-                    'ON_UPDATE'         => isset($match[9]) ? $match[10] : '',
+                    'ON_DELETE'         => isset($match[7]) ? $match[8] : ''
                 ];
             }
 
@@ -1173,10 +1172,8 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
                     unset($columnDefinition['identity'], $columnDefinition['primary'], $columnDefinition['comment']);
 
                     $onDelete = $options['ON_DELETE'];
-                    $onUpdate = $options['ON_UPDATE'];
 
-                    if ($onDelete == AdapterInterface::FK_ACTION_SET_NULL
-                        || $onUpdate == AdapterInterface::FK_ACTION_SET_NULL) {
+                    if ($onDelete == AdapterInterface::FK_ACTION_SET_NULL) {
                         $columnDefinition['nullable'] = true;
                     }
                     $this->modifyColumn($options['TABLE_NAME'], $options['COLUMN_NAME'], $columnDefinition);
@@ -1186,8 +1183,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
                         $options['COLUMN_NAME'],
                         $options['REF_TABLE_NAME'],
                         $options['REF_COLUMN_NAME'],
-                        ($onDelete) ? $onDelete : AdapterInterface::FK_ACTION_NO_ACTION,
-                        ($onUpdate) ? $onUpdate : AdapterInterface::FK_ACTION_NO_ACTION
+                        ($onDelete) ? $onDelete : AdapterInterface::FK_ACTION_NO_ACTION
                     );
                 }
             }
@@ -1633,15 +1629,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
                 $keyData['REF_COLUMN_NAME']
             );
             $onDelete = $this->_getDdlAction($keyData['ON_DELETE']);
-            $onUpdate = $this->_getDdlAction($keyData['ON_UPDATE']);
 
             $table->addForeignKey(
                 $fkName,
                 $keyData['COLUMN_NAME'],
                 $keyData['REF_TABLE_NAME'],
                 $keyData['REF_COLUMN_NAME'],
-                $onDelete,
-                $onUpdate
+                $onDelete
             );
         }
 
@@ -2139,16 +2133,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
         if (!empty($relations)) {
             foreach ($relations as $fkData) {
                 $onDelete = $this->_getDdlAction($fkData['ON_DELETE']);
-                $onUpdate = $this->_getDdlAction($fkData['ON_UPDATE']);
-
                 $definition[] = sprintf(
-                    '  CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s ON UPDATE %s',
+                    '  CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s',
                     $this->quoteIdentifier($fkData['FK_NAME']),
                     $this->quoteIdentifier($fkData['COLUMN_NAME']),
                     $this->quoteIdentifier($fkData['REF_TABLE_NAME']),
                     $this->quoteIdentifier($fkData['REF_COLUMN_NAME']),
-                    $onDelete,
-                    $onUpdate
+                    $onDelete
                 );
             }
         }
@@ -2579,7 +2570,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
      * @param string $refTableName
      * @param string $refColumnName
      * @param string $onDelete
-     * @param string $onUpdate
      * @param bool $purge            trying remove invalid data
      * @param string $schemaName
      * @param string $refSchemaName
@@ -2593,7 +2583,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
         $refTableName,
         $refColumnName,
         $onDelete = AdapterInterface::FK_ACTION_CASCADE,
-        $onUpdate = AdapterInterface::FK_ACTION_CASCADE,
         $purge = false,
         $schemaName = null,
         $refSchemaName = null
@@ -2616,9 +2605,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
         if ($onDelete !== null) {
             $query .= ' ON DELETE ' . strtoupper($onDelete);
         }
-        if ($onUpdate  !== null) {
-            $query .= ' ON UPDATE ' . strtoupper($onUpdate);
-        }
 
         $result = $this->rawQuery($query);
         $this->resetDdlCache($tableName);
@@ -3337,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')
             );
         }
@@ -3395,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)
      */
@@ -3453,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/Ddl/Table.php b/lib/internal/Magento/Framework/DB/Ddl/Table.php
index e42dfa1f6c2d7914b07c10931b5eed2a00805312..a623ba4c0fb3398a107d72140fe711adfa19b946 100644
--- a/lib/internal/Magento/Framework/DB/Ddl/Table.php
+++ b/lib/internal/Magento/Framework/DB/Ddl/Table.php
@@ -59,7 +59,7 @@ class Table
     const MAX_VARBINARY_SIZE = 2147483648;
 
     /**
-     * Default values for timestampses - fill with current timestamp on inserting record, on changing and both cases
+     * Default values for timestamps - fill with current timestamp on inserting record, on changing and both cases
      */
     const TIMESTAMP_INIT_UPDATE = 'TIMESTAMP_INIT_UPDATE';
 
@@ -405,12 +405,11 @@ class Table
      * @param string $refTable      the reference table name
      * @param string $refColumn     the reference table column name
      * @param string $onDelete      the action on delete row
-     * @param string $onUpdate      the action on update
      * @return $this
      * @throws \Zend_Db_Exception
      * @SuppressWarnings(PHPMD.CyclomaticComplexity)
      */
-    public function addForeignKey($fkName, $column, $refTable, $refColumn, $onDelete = null, $onUpdate = null)
+    public function addForeignKey($fkName, $column, $refTable, $refColumn, $onDelete = null)
     {
         $upperName = strtoupper($fkName);
 
@@ -429,23 +428,12 @@ class Table
                 $onDelete = self::ACTION_NO_ACTION;
         }
 
-        switch ($onUpdate) {
-            case self::ACTION_CASCADE:
-            case self::ACTION_RESTRICT:
-            case self::ACTION_SET_DEFAULT:
-            case self::ACTION_SET_NULL:
-                break;
-            default:
-                $onUpdate = self::ACTION_NO_ACTION;
-        }
-
         $this->_foreignKeys[$upperName] = [
             'FK_NAME' => $fkName,
             'COLUMN_NAME' => $column,
             'REF_TABLE_NAME' => $refTable,
             'REF_COLUMN_NAME' => $refColumn,
-            'ON_DELETE' => $onDelete,
-            'ON_UPDATE' => $onUpdate,
+            'ON_DELETE' => $onDelete
         ];
 
         return $this;
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/Less/Test/Unit/File/Collector/LibraryTest.php b/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php
index 9dc45f4008b201640712a5a12c5177f2bb61a8b1..1bb6e276c9761f3e69dfc02f3870c9466d845328 100644
--- a/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php
+++ b/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php
@@ -120,7 +120,7 @@ class LibraryTest extends \PHPUnit_Framework_TestCase
         $this->libraryDirectoryMock->expects($this->any())->method('search')->will($this->returnValue($libraryFiles));
         $this->libraryDirectoryMock->expects($this->any())->method('getAbsolutePath')->will($this->returnCallback(
             function ($file) {
-                return '/opt/Magneto/lib/' . $file;
+                return '/opt/Magento/lib/' . $file;
             }
         ));
         $themePath = '/var/Magento/ATheme';
diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
index b90ff7acb3929174c921ac4a7e0ea5c3e464fab7..7b70fa5d35e61e3174d0b008a275f2afd8880d3c 100644
--- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
@@ -205,6 +205,21 @@ abstract class AbstractExtensibleModel extends AbstractModel implements
         return parent::unsetData($key);
     }
 
+    /**
+     * Convert custom values if necessary
+     *
+     * @param array $customAttributes
+     * @return void
+     */
+    protected function convertCustomAttributeValues(array &$customAttributes)
+    {
+        foreach ($customAttributes as $attributeCode => $attributeValue) {
+            if ($attributeValue instanceof \Magento\Framework\Api\AttributeValue) {
+                $customAttributes[$attributeCode] = $attributeValue->getValue();
+            }
+        }
+    }
+
     /**
      * Object data getter
      *
@@ -231,6 +246,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements
             $customAttributes = isset($this->_data[self::CUSTOM_ATTRIBUTES])
                 ? $this->_data[self::CUSTOM_ATTRIBUTES]
                 : [];
+            $this->convertCustomAttributeValues($customAttributes);
             $data = array_merge($this->_data, $customAttributes);
             unset($data[self::CUSTOM_ATTRIBUTES]);
         } else {
@@ -238,6 +254,9 @@ abstract class AbstractExtensibleModel extends AbstractModel implements
             if ($data === null) {
                 /** Try to find necessary data in custom attributes */
                 $data = parent::getData(self::CUSTOM_ATTRIBUTES . "/{$key}", $index);
+                if ($data instanceof \Magento\Framework\Api\AttributeValue) {
+                    $data = $data->getValue();
+                }
             }
         }
         return $data;
diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php
index 43223069055fdaab1fe7decf6754233bf990ab5a..fcd03252a4160d16805909a3bc45492f896f2e85 100644
--- a/lib/internal/Magento/Framework/Model/AbstractModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractModel.php
@@ -127,6 +127,13 @@ abstract class AbstractModel extends \Magento\Framework\Object
      */
     protected $_actionValidator;
 
+    /**
+     * Array to store object's original data
+     *
+     * @var array
+     */
+    protected $storedData = [];
+
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
@@ -301,6 +308,7 @@ abstract class AbstractModel extends \Magento\Framework\Object
         $this->_afterLoad();
         $this->setOrigData();
         $this->_hasDataChanges = false;
+        $this->updateStoredData();
         return $this;
     }
 
@@ -354,6 +362,7 @@ abstract class AbstractModel extends \Magento\Framework\Object
     {
         $this->getResource()->afterLoad($this);
         $this->_afterLoad();
+        $this->updateStoredData();
         return $this;
     }
 
@@ -566,6 +575,7 @@ abstract class AbstractModel extends \Magento\Framework\Object
         $this->_eventManager->dispatch('model_save_after', ['object' => $this]);
         $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
         $this->_eventManager->dispatch($this->_eventPrefix . '_save_after', $this->_getEventData());
+        $this->updateStoredData();
         return $this;
     }
 
@@ -611,6 +621,7 @@ abstract class AbstractModel extends \Magento\Framework\Object
         $this->_eventManager->dispatch('model_delete_after', ['object' => $this]);
         $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
         $this->_eventManager->dispatch($this->_eventPrefix . '_delete_after', $this->_getEventData());
+        $this->storedData = [];
         return $this;
     }
 
@@ -689,4 +700,29 @@ abstract class AbstractModel extends \Magento\Framework\Object
     {
         return $this;
     }
+
+    /**
+     * Synchronize object's stored data with the actual data
+     *
+     * @return $this
+     */
+    private function updateStoredData()
+    {
+        if (isset($this->_data)) {
+            $this->storedData = $this->_data;
+        } else {
+            $this->storedData = [];
+        }
+        return $this;
+    }
+
+    /**
+     * Model StoredData getter
+     *
+     * @return array
+     */
+    public function getStoredData()
+    {
+        return $this->storedData;
+    }
 }
diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php
index 393c90be8e000891cad8ca84d83e6e8cbcf3ccc7..351365b08d9eb57d45b6b65a50c53edbb93d482c 100644
--- a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php
+++ b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php
@@ -417,9 +417,10 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso
                      * Not auto increment primary key support
                      */
                     if ($this->_isPkAutoIncrement) {
-                        $data = $this->_prepareDataForSave($object);
-                        unset($data[$this->getIdFieldName()]);
-                        $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition);
+                        $data = $this->prepareDataForUpdate($object);
+                        if (!empty($data)) {
+                            $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition);
+                        }
                     } else {
                         $select = $this->_getWriteAdapter()->select()->from(
                             $this->getMainTable(),
@@ -428,8 +429,7 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso
                             $condition
                         );
                         if ($this->_getWriteAdapter()->fetchOne($select) !== false) {
-                            $data = $this->_prepareDataForSave($object);
-                            unset($data[$this->getIdFieldName()]);
+                            $data = $this->prepareDataForUpdate($object);
                             if (!empty($data)) {
                                 $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition);
                             }
@@ -770,4 +770,27 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso
         }
         return $checksum;
     }
+
+    /**
+     * Get the array of data fields that was changed or added
+     *
+     * @param \Magento\Framework\Model\AbstractModel $object
+     * @return array
+     */
+    protected function prepareDataForUpdate($object)
+    {
+        $data = $object->getData();
+        foreach ($object->getStoredData() as $key => $value) {
+            if (array_key_exists($key, $data) && $data[$key] === $value) {
+                unset($data[$key]);
+            }
+        }
+        $dataObject = clone $object;
+        $dataObject->setData($data);
+        $data = $this->_prepareDataForTable($dataObject, $this->getMainTable());
+        unset($data[$this->getIdFieldName()]);
+        unset($dataObject);
+
+        return $data;
+    }
 }
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php
index 49b76a75b8ac30215540f4ebee497986fa232d84..71df4ee8ed9475b92e10972758dc62b3b5926bb3 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php
@@ -108,4 +108,22 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase
         $this->resourceMock->expects($this->once())->method('delete')->with($this->model);
         $this->model->delete();
     }
+
+    public function testUpdateStoredData()
+    {
+        $this->model->setData(
+            [
+                'id'   => 1000,
+                'name' => 'Test Name'
+            ]
+        );
+        $this->assertEmpty($this->model->getStoredData());
+        $this->model->afterLoad();
+        $this->assertEquals($this->model->getData(), $this->model->getStoredData());
+        $this->model->setData('value', 'Test Value');
+        $this->model->afterSave();
+        $this->assertEquals($this->model->getData(), $this->model->getStoredData());
+        $this->model->afterDelete();
+        $this->assertEmpty($this->model->getStoredData());
+    }
 }
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php
index 66e49e079e7f0f340db69bf355c973c1b894e9a9..6745f6d62c7412089519d0bd6569d0ef29624cbd 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php
@@ -61,7 +61,12 @@ class AbstractDbTest extends \PHPUnit_Framework_TestCase
 
         $this->_model = $this->getMockForAbstractClass(
             'Magento\Framework\Model\Resource\Db\AbstractDb',
-            [$contextMock]
+            [$contextMock],
+            '',
+            true,
+            true,
+            true,
+            ['_prepareDataForTable']
         );
     }
 
@@ -422,4 +427,85 @@ class AbstractDbTest extends \PHPUnit_Framework_TestCase
             [null, false]
         ];
     }
+
+    public function testPrepareDataForUpdate()
+    {
+        $adapterInterfaceMock = $this->getMock('\Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false);
+        $context = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject(
+                'Magento\Framework\Model\Context'
+        );
+        $registryMock = $this->getMock('\Magento\Framework\Registry', [], [], '', false);
+        $resourceMock = $this->getMock(
+            'Magento\Framework\Model\Resource\Db\AbstractDb',
+            [
+                '_construct',
+                '_getReadAdapter',
+                '_getWriteAdapter',
+                '__wakeup',
+                'getIdFieldName'
+            ],
+            [],
+            '',
+            false
+        );
+        $adapterMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false);
+        $resourceMock->expects($this->any())
+            ->method('_getWriteAdapter')
+            ->will($this->returnValue($adapterMock));
+        $resourceCollectionMock = $this->getMock('Magento\Framework\Data\Collection\Db', [], [], '', false);
+        $abstractModelMock = $this->getMockForAbstractClass(
+            'Magento\Framework\Model\AbstractModel',
+            [$context, $registryMock, $resourceMock, $resourceCollectionMock]
+        );
+        $data = 'tableName';
+        $this->_resourcesMock->expects($this->any())
+            ->method('getConnection')
+            ->will($this->returnValue($adapterInterfaceMock)
+        );
+        $this->_resourcesMock->expects($this->any())->method('getTableName')->with($data)->will(
+            $this->returnValue('tableName')
+        );
+        $this->_resourcesMock->expects($this->any())
+            ->method('_getWriteAdapter')
+            ->will($this->returnValue($adapterInterfaceMock));
+        $mainTableReflection = new \ReflectionProperty(
+            'Magento\Framework\Model\Resource\Db\AbstractDb',
+            '_mainTable'
+        );
+        $mainTableReflection->setAccessible(true);
+        $mainTableReflection->setValue($this->_model, 'tableName');
+        $idFieldNameReflection = new \ReflectionProperty(
+            'Magento\Framework\Model\Resource\Db\AbstractDb',
+            '_idFieldName'
+        );
+        $idFieldNameReflection->setAccessible(true);
+        $idFieldNameReflection->setValue($this->_model, 'idFieldName');
+        $adapterInterfaceMock->expects($this->any())->method('save')->with('tableName', 'idFieldName');
+        $adapterInterfaceMock->expects($this->any())->method('quoteInto')->will($this->returnValue('idFieldName'));
+
+        $abstractModelMock->setIdFieldName('id');
+        $abstractModelMock->setData(
+            [
+                'id'    => 12345,
+                'name'  => 'Test Name',
+                'value' => 'Test Value'
+            ]
+        );
+        $abstractModelMock->afterLoad();
+        $this->assertEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData());
+        $newData = ['value' => 'Test Value New'];
+        $this->_model->expects($this->once())->method('_prepareDataForTable')->will($this->returnValue($newData));
+        $abstractModelMock->addData($newData);
+        $this->assertNotEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData());
+        $abstractModelMock->isObjectNew(false);
+        $adapterInterfaceMock->expects($this->once())
+            ->method('update')
+            ->with(
+                'tableName',
+                $newData,
+                'idFieldName'
+            );
+
+        $this->_model->save($abstractModelMock);
+    }
 }
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/BlockFactory.php b/lib/internal/Magento/Framework/View/Element/BlockFactory.php
index 8832e6e40bb890555a14ca090d48a841ef1e537c..08f66289fb1082e5712e97c53fc8f2cd8558d8bd 100644
--- a/lib/internal/Magento/Framework/View/Element/BlockFactory.php
+++ b/lib/internal/Magento/Framework/View/Element/BlockFactory.php
@@ -42,7 +42,7 @@ class BlockFactory
         $blockName = ltrim($blockName, '\\');
         $block = $this->objectManager->create($blockName, $arguments);
         if (!$block instanceof BlockInterface) {
-            throw new \LogicException($blockName . ' does not implemented BlockInterface');
+            throw new \LogicException($blockName . ' does not implement BlockInterface');
         }
         if ($block instanceof Template) {
             $block->setTemplateContext($block);
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/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php
index 14caad463c95a3878d7351a339c20173665b6dc1..e232546d6ac1eea71af4a52b97f22aace0e83717 100644
--- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php
+++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php
@@ -137,8 +137,7 @@ class ServiceInputProcessor
         if (is_subclass_of($className, self::EXTENSION_ATTRIBUTES_TYPE)) {
             $className = substr($className, 0, -strlen('Interface'));
         }
-        $factory = $this->objectManager->get($className . 'Factory');
-        $object = $factory->create();
+        $object = $this->objectManager->create($className);
 
         foreach ($data as $propertyName => $value) {
             // Converts snake_case to uppercase CamelCase to help form getter/setter method names
diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php
index 41cdf8184ba372143f8ed2fdde2ff790f8633fa0..ac75d2c131fb1cd2319c1ebd36ab58014917ec87 100644
--- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php
+++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php
@@ -42,6 +42,14 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
         $this->objectManagerMock = $this->getMockBuilder('\Magento\Framework\ObjectManagerInterface')
             ->disableOriginalConstructor()
             ->getMock();
+        $this->objectManagerMock->expects($this->any())
+            ->method('create')
+            ->willReturnCallback(
+                function ($className) use ($objectManager) {
+                    return $objectManager->getObject($className);
+                }
+            );
+
         /** @var \Magento\Framework\Reflection\TypeProcessor $typeProcessor */
         $typeProcessor = $objectManager->getObject('Magento\Framework\Reflection\TypeProcessor');
         $cache = $this->getMockBuilder('Magento\Framework\App\Cache\Type\Webapi')
@@ -119,12 +127,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testNestedDataProperties()
     {
-        $this->setupFactory(
-            [
-                'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested',
-                '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple',
-            ]
-        );
         $data = ['nested' => ['details' => ['entityId' => 15, 'name' => 'Test']]];
         $result = $this->serviceInputProcessor->process(
             'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService',
@@ -167,7 +169,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testAssociativeArrayProperties()
     {
-        $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple']);
         $data = ['associativeArray' => ['key' => 'value', 'key_two' => 'value_two']];
         $result = $this->serviceInputProcessor->process(
             'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService',
@@ -186,7 +187,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testAssociativeArrayPropertiesWithItem()
     {
-        $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']);
         $data = ['associativeArray' => ['item' => 'value']];
         $result = $this->serviceInputProcessor->process(
             'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService',
@@ -204,7 +204,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testAssociativeArrayPropertiesWithItemArray()
     {
-        $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']);
         $data = ['associativeArray' => ['item' => ['value1','value2']]];
         $result = $this->serviceInputProcessor->process(
             'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService',
@@ -223,11 +222,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testArrayOfDataObjectProperties()
     {
-        $this->setupFactory(
-            [
-                '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple'
-            ]
-        );
         $data = [
             'dataObjects' => [
                 ['entityId' => 14, 'name' => 'First'],
@@ -259,7 +253,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testNestedSimpleArrayProperties()
     {
-        $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray']);
         $data = ['arrayData' => ['ids' => [1, 2, 3, 4]]];
         $result = $this->serviceInputProcessor->process(
             'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService',
@@ -281,7 +274,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testNestedAssociativeArrayProperties()
     {
-        $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']);
         $data = [
             'associativeArrayData' => ['associativeArray' => ['key' => 'value', 'key2' => 'value2']],
         ];
@@ -305,12 +297,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
 
     public function testNestedArrayOfDataObjectProperties()
     {
-        $this->setupFactory(
-            [
-                'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray',
-                '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple',
-            ]
-        );
         $data = [
             'dataObjects' => [
                 'items' => [['entityId' => 1, 'name' => 'First'], ['entityId' => 2, 'name' => 'Second']],
@@ -352,14 +338,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
      */
     public function testCustomAttributesProperties($customAttributeType, $inputData, $expectedObject)
     {
-        $this->setupFactory(
-            [
-                'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes',
-                '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple',
-                'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple',
-                'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray',
-            ]
-        );
         $this->customAttributeTypeLocator->expects($this->any())->method('getType')->willReturn($customAttributeType);
 
         $result = $this->serviceInputProcessor->process(
@@ -521,27 +499,4 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase
             ]]
         );
     }
-    protected function setupFactory(array $classNames)
-    {
-        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
-
-        $returnValueMap = [];
-        foreach ($classNames as $className) {
-            $factoryMock = $this->getMockBuilder($className . 'Factory')
-                ->setMethods(['create'])
-                ->disableOriginalConstructor()
-                ->getMock();
-            $factoryMock->expects($this->any())
-                ->method('create')
-                ->willReturnCallback(
-                    function () use ($objectManager, $className) {
-                        return $objectManager->getObject($className);
-                    }
-                );
-            $returnValueMap[] = [$className . 'Factory', $factoryMock];
-        }
-        $this->objectManagerMock->expects($this->any())
-            ->method('get')
-            ->will($this->returnValueMap($returnValueMap));
-    }
 }
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/License.php b/setup/src/Magento/Setup/Model/License.php
index beb3d857aedea1ca21ca059697d79434a114a263..1c7458bd3404c1c816d134f61a97c4f41a43b5ee 100644
--- a/setup/src/Magento/Setup/Model/License.php
+++ b/setup/src/Magento/Setup/Model/License.php
@@ -16,12 +16,19 @@ use Magento\Framework\Filesystem;
  */
 class License
 {
+    /**
+     * Default License File location
+     *
+     * @var string
+     */
+    const DEFAULT_LICENSE_FILENAME = 'LICENSE.txt';
+
     /**
      * License File location
      *
      * @var string
      */
-    const LICENSE_FILENAME = 'LICENSE.txt';
+    const LICENSE_FILENAME = 'LICENSE_EE.txt';
 
     /**
      * Directory that contains license file
@@ -43,13 +50,16 @@ class License
     /**
      * Returns contents of License file.
      *
-     * @return string
+     * @return string|boolean
      */
     public function getContents()
     {
-        if (!$this->dir->isFile(self::LICENSE_FILENAME)) {
+        if ($this->dir->isFile(self::LICENSE_FILENAME)) {
+            return $this->dir->readFile(self::LICENSE_FILENAME);
+        } elseif ($this->dir->isFile(self::DEFAULT_LICENSE_FILENAME)) {
+            return $this->dir->readFile(self::DEFAULT_LICENSE_FILENAME);
+        } else {
             return false;
         }
-        return $this->dir->readFile(self::LICENSE_FILENAME);
     }
 }
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/LicenseTest.php b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php
index 1d8f9f3accce01dd668f9f8b4ed4e998a2fafe47..3bb5a5324c33e7b58bb3d11a28cacdd10f0a8735 100644
--- a/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php
@@ -33,14 +33,12 @@ class LicenseTest extends \PHPUnit_Framework_TestCase
     public function testGetContents()
     {
         $this->directoryReadMock
-            ->expects($this->once())
+            ->expects($this->atLeastOnce())
             ->method('readFile')
-            ->with(License::LICENSE_FILENAME)
             ->will($this->returnValue('License text'));
         $this->directoryReadMock
-            ->expects($this->once())
+            ->expects($this->atLeastOnce())
             ->method('isFile')
-            ->with(License::LICENSE_FILENAME)
             ->will($this->returnValue(true));
 
         $license = new License($this->filesystemMock);
@@ -50,9 +48,8 @@ class LicenseTest extends \PHPUnit_Framework_TestCase
     public function testGetContentsNoFile()
     {
         $this->directoryReadMock
-            ->expects($this->once())
+            ->expects($this->atLeastOnce())
             ->method('isFile')
-            ->with(License::LICENSE_FILENAME)
             ->will($this->returnValue(false));
 
         $license = new License($this->filesystemMock);
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);
-    }
-}