diff --git a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php
index 92704735fe73e9978cb0f321f9058a28ff4933e1..ee34eeea325a2a439cf5b6fae82180df8ee83a8a 100644
--- a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php
+++ b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php
@@ -11,13 +11,15 @@ use Magento\CatalogInventory\Api\StockRegistryInterface;
 use Magento\Customer\Api\GroupManagementInterface;
 use Magento\Framework\Api\AttributeValueFactory;
 use Magento\Framework\Api\ExtensionAttributesFactory;
+use Magento\Framework\Object\IdentityInterface;
+use Magento\Catalog\Model\Product;
 
 /**
  * Catalog Inventory Stock Model for adminhtml area
  * @method \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface getExtensionAttributes()
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class Item extends \Magento\CatalogInventory\Model\Stock\Item
+class Item extends \Magento\CatalogInventory\Model\Stock\Item implements IdentityInterface
 {
     /**
      * @var GroupManagementInterface
@@ -122,4 +124,17 @@ class Item extends \Magento\CatalogInventory\Model\Stock\Item
     {
         return true;
     }
+
+    /**
+     * @inheritdoc
+     */
+    public function getIdentities()
+    {
+        $tags = [];
+        if ($this->getProductId()) {
+            $tags[] = Product::CACHE_TAG . '_' . $this->getProductId();
+        }
+
+        return $tags;
+    }
 }
diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php
index b182d738370fcf152295f199814a120ebbff8604..ee653da73580405bdb9f219ef4793e6b5adc0783 100644
--- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php
+++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php
@@ -123,6 +123,7 @@ class Item extends \Magento\Framework\Model\Resource\Db\AbstractDb
         parent::_afterSave($object);
         /** @var StockItemInterface $object */
         if ($this->processIndexEvents) {
+            $this->stockIndexerProcessor->markIndexerAsInvalid();
             $this->stockIndexerProcessor->reindexRow($object->getProductId());
         }
         return $this;
diff --git a/app/code/Magento/CatalogInventory/Model/StockRegistry.php b/app/code/Magento/CatalogInventory/Model/StockRegistry.php
index f32aeb2104b686091e06120271c462ec33542f08..059910b98b6f6b5dee0cf76426d92074e4f1a548 100644
--- a/app/code/Magento/CatalogInventory/Model/StockRegistry.php
+++ b/app/code/Magento/CatalogInventory/Model/StockRegistry.php
@@ -172,7 +172,7 @@ class StockRegistry implements StockRegistryInterface
         $criteria = $this->criteriaFactory->create();
         $criteria->setLimit($currentPage, $pageSize);
         $criteria->setWebsiteFilter($websiteId);
-        $criteria->setQtyFilter('>=', $qty);
+        $criteria->setQtyFilter('<=', $qty);
         $criteria->addField('qty');
         return $this->stockItemRepository->getList($criteria);
     }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..4edffd7709f010ce79108f022e22a3e1c19ce03c
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\CatalogInventory\Test\Unit\Block\Plugin;
+
+class ProductViewTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogInventory\Block\Plugin\ProductView
+     */
+    protected $block;
+
+    /**
+     * @var \Magento\CatalogInventory\Api\Data\StockItemInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockItem;
+
+    /**
+     * @var \Magento\CatalogInventory\Api\StockRegistryInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockRegistry;
+
+    protected function setUp()
+    {
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+        $this->stockItem = $this->getMockBuilder('\Magento\CatalogInventory\Model\Stock\Item')
+            ->disableOriginalConstructor()
+            ->setMethods(['getQtyMinAllowed', 'getQtyMaxAllowed', 'getQtyIncrements'])
+            ->getMock();
+
+        $this->stockRegistry = $this->getMockBuilder('Magento\CatalogInventory\Api\StockRegistryInterface')
+            ->getMock();
+
+        $this->block = $objectManager->getObject(
+            'Magento\CatalogInventory\Block\Plugin\ProductView',
+            [
+                'stockRegistry' => $this->stockRegistry
+            ]
+        );
+    }
+
+    public function testAfterGetQuantityValidators()
+    {
+        $result = [
+            'validate-item-quantity' =>
+                [
+                    'minAllowed' => 2,
+                    'maxAllowed' => 5,
+                    'qtyIncrements' => 3
+                ]
+        ];
+        $validators = [];
+        $productViewBlock = $this->getMockBuilder('Magento\Catalog\Block\Product\View')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $productMock = $this->getMockBuilder('Magento\Catalog\Model\Product')
+            ->disableOriginalConstructor()
+            ->setMethods(['_wakeup', 'getId', 'getStore'])
+            ->getMock();
+        $storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+            ->disableOriginalConstructor()
+            ->setMethods(['getWebsiteId', '_wakeup'])
+            ->getMock();
+
+        $productViewBlock->expects($this->any())->method('getProduct')->willReturn($productMock);
+        $productMock->expects($this->once())->method('getId')->willReturn('productId');
+        $productMock->expects($this->once())->method('getStore')->willReturn($storeMock);
+        $storeMock->expects($this->once())->method('getWebsiteId')->willReturn('websiteId');
+        $this->stockRegistry->expects($this->once())
+            ->method('getStockItem')
+            ->with('productId', 'websiteId')
+            ->willReturn($this->stockItem);
+        $this->stockItem->expects($this->once())->method('getQtyMinAllowed')->willReturn(2);
+        $this->stockItem->expects($this->any())->method('getQtyMaxAllowed')->willReturn(5);
+        $this->stockItem->expects($this->any())->method('getQtyIncrements')->willReturn(3);
+
+        $this->assertEquals($result, $this->block->afterGetQuantityValidators($productViewBlock, $validators));
+    }
+}
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Block/Stockqty/DefaultStockqtyTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Block/Stockqty/DefaultStockqtyTest.php
index a513382ecc9c08706363240c69c0e210e5e4d5cc..fd247ef871523bf14f3ee2480af22f3c648d6627 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Block/Stockqty/DefaultStockqtyTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Block/Stockqty/DefaultStockqtyTest.php
@@ -30,6 +30,11 @@ class DefaultStockqtyTest extends \PHPUnit_Framework_TestCase
      */
     protected $stockRegistryMock;
 
+    /**
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $scopeConfigMock;
+
     protected function setUp()
     {
         $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -44,12 +49,16 @@ class DefaultStockqtyTest extends \PHPUnit_Framework_TestCase
         $this->stockRegistryMock = $this->getMockBuilder('Magento\CatalogInventory\Api\StockRegistryInterface')
             ->disableOriginalConstructor()
             ->getMock();
+        $this->scopeConfigMock = $this->getMockBuilder('\Magento\Framework\App\Config\ScopeConfigInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->block = $objectManager->getObject(
             'Magento\CatalogInventory\Block\Stockqty\DefaultStockqty',
             [
                 'registry' => $this->registryMock,
                 'stockState' => $this->stockState,
-                'stockRegistry' => $this->stockRegistryMock
+                'stockRegistry' => $this->stockRegistryMock,
+                'scopeConfig' => $this->scopeConfigMock
             ]
         );
     }
@@ -198,4 +207,10 @@ class DefaultStockqtyTest extends \PHPUnit_Framework_TestCase
         $dataArray[$key] = $value;
         $property->setValue($this->block, $dataArray);
     }
+
+    public function testGetThresholdQty()
+    {
+        $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(5);
+        $this->assertEquals(5, $this->block->getThresholdQty());
+    }
 }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Adminhtml/Stock/ItemTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Adminhtml/Stock/ItemTest.php
index bcf805e7260685689b0fda77d1026a91c8aa006b..096c3e60ebde0867c7288c24cec2efeb66651921 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Adminhtml/Stock/ItemTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Adminhtml/Stock/ItemTest.php
@@ -58,4 +58,10 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         $this->_model->setCustomerGroupId(2);
         $this->assertEquals(2, $this->_model->getCustomerGroupId());
     }
+
+    public function testGetIdentities()
+    {
+        $this->_model->setProductId(1);
+        $this->assertEquals(['catalog_product_1'], $this->_model->getIdentities());
+    }
 }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php
index 6de9c01656aecb292c061550e65c69bc000ee0c1..14b5bebfb49f0ac812c2a283a58ac61f5632cbbe 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php
@@ -259,4 +259,14 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
         ];
         $this->assertEquals($fields, $this->model->getConfigItemOptions());
     }
+
+    public function testGetManageStock()
+    {
+        $store = 1;
+        $this->scopeConfigMock->expects($this->once())
+            ->method('isSetFlag')
+            ->with(Configuration::XML_PATH_MANAGE_STOCK, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)
+            ->willReturn(1);
+        $this->assertEquals(1, $this->model->getManageStock($store));
+    }
 }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php
index f6cfa8b4e7e6643d3b4df80ae83fe79bd57dd0fc..93f078e9ca11d272ef5abc37b8d2c73820cf9096 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php
@@ -403,4 +403,58 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         $this->item->setLowStockDate($date);
         $this->assertEquals($date, $this->item->getLowStockDate());
     }
+
+    /**
+     * @param array $config
+     * @param mixed $expected
+     * @dataProvider getQtyIncrementsDataProvider(
+     */
+    public function testGetQtyIncrements($config, $expected)
+    {
+        $this->setDataArrayValue('qty_increments', $config['qty_increments']);
+        $this->setDataArrayValue('enable_qty_increments', $config['enable_qty_increments']);
+        $this->setDataArrayValue('use_config_qty_increments', $config['use_config_qty_increments']);
+        if ($config['use_config_qty_increments']) {
+            $this->stockConfiguration->expects($this->once())
+                ->method('getQtyIncrements')
+                ->with($this->storeId)
+                ->willReturn($config['qty_increments']);
+        } else {
+            $this->setDataArrayValue('qty_increments', $config['qty_increments']);
+        }
+        $this->assertEquals($expected, $this->item->getQtyIncrements());
+    }
+
+    /**
+     * @return array
+     */
+    public function getQtyIncrementsDataProvider()
+    {
+        return [
+            [
+                [
+                    'qty_increments' => 1,
+                    'enable_qty_increments' => true,
+                    'use_config_qty_increments' => true
+                ],
+                1
+            ],
+            [
+                [
+                    'qty_increments' => -2,
+                    'enable_qty_increments' => true,
+                    'use_config_qty_increments' => true
+                ],
+                false
+            ],
+            [
+                [
+                    'qty_increments' => 3,
+                    'enable_qty_increments' => true,
+                    'use_config_qty_increments' => false
+                ],
+                3
+            ],
+        ];
+    }
 }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php
index d01e095949ef6020c099d017e7dd15cca5a30e7f..ed72a425ea8fb2b4d67ec6a75fbf405dfb79505a 100644
--- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php
@@ -6,9 +6,12 @@
 namespace Magento\CatalogInventory\Test\Unit\Model\Stock;
 
 use \Magento\CatalogInventory\Model\Stock\StockItemRepository;
+use \Magento\CatalogInventory\Api\Data as InventoryApiData;
 
 /**
  * Class StockItemRepositoryTest
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
 class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
 {
@@ -18,7 +21,11 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
     protected $model;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\CatalogInventory\Model\Stock\Item |\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockItemMock;
+    /**
+     * @var \Magento\CatalogInventory\Api\StockConfigurationInterface|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $stockConfigurationMock;
 
@@ -28,42 +35,42 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
     protected $productMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $stockStateProviderMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\CatalogInventory\Model\Resource\Stock\Item|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $stockItemResourceMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var InventoryApiData\StockItemInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $stockItemMock;
+    protected $stockItemFactoryMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var InventoryApiData\StockItemCollectionInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $stockItemCollectionMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Catalog\Model\ProductFactory|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $productFactoryMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\DB\QueryBuilderFactory|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $queryBuilderMock;
+    protected $queryBuilderFactoryMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\DB\MapperFactory|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $mapperMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $localeDateMock;
 
@@ -74,6 +81,27 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
+        $this->stockItemMock = $this->getMockBuilder('\Magento\CatalogInventory\Model\Stock\Item')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getItemId',
+                    'getProductId',
+                    'setIsInStock',
+                    'setStockStatusChangedAutomaticallyFlag',
+                    'getStockStatusChangedAutomaticallyFlag',
+                    'getManageStock',
+                    'setLowStockDate',
+                    'setStockStatusChangedAuto',
+                    'hasStockStatusChangedAutomaticallyFlag',
+                    'setQty',
+                    'getWebsiteId',
+                    'setWebsiteId',
+                    'getStockId',
+                    'setStockId'
+                ]
+            )
+            ->getMock();
         $this->stockConfigurationMock = $this->getMockBuilder(
             'Magento\CatalogInventory\Api\StockConfigurationInterface'
         )
@@ -87,12 +115,16 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
         $this->stockItemResourceMock = $this->getMockBuilder('Magento\CatalogInventory\Model\Resource\Stock\Item')
             ->disableOriginalConstructor()
             ->getMock();
-        $this->stockItemMock = $this->getMockBuilder('Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory')
+        $this->stockItemFactoryMock = $this->getMockBuilder(
+            'Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory'
+        )
+            ->setMethods(['create'])
             ->disableOriginalConstructor()
             ->getMock();
         $this->stockItemCollectionMock = $this->getMockBuilder(
             'Magento\CatalogInventory\Api\Data\StockItemCollectionInterfaceFactory'
         )
+            ->setMethods(['create'])
             ->disableOriginalConstructor()
             ->getMock();
         $this->productFactoryMock = $this->getMockBuilder('Magento\Catalog\Model\ProductFactory')
@@ -101,12 +133,14 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
             ->getMock();
         $this->productMock = $this->getMockBuilder('Magento\Catalog\Model\Product')
             ->disableOriginalConstructor()
+            ->setMethods(['load', 'getId', 'getTypeId', '__wakeup'])
             ->getMock();
         $this->productFactoryMock->expects($this->any())
             ->method('create')
             ->willReturn($this->productMock);
 
-        $this->queryBuilderMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilderFactory')
+        $this->queryBuilderFactoryMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilderFactory')
+            ->setMethods(['create'])
             ->disableOriginalConstructor()
             ->getMock();
         $this->mapperMock = $this->getMockBuilder('Magento\Framework\DB\MapperFactory')
@@ -127,29 +161,167 @@ class StockItemRepositoryTest extends \PHPUnit_Framework_TestCase
             $this->stockConfigurationMock,
             $this->stockStateProviderMock,
             $this->stockItemResourceMock,
-            $this->stockItemMock,
+            $this->stockItemFactoryMock,
             $this->stockItemCollectionMock,
             $this->productFactoryMock,
-            $this->queryBuilderMock,
+            $this->queryBuilderFactoryMock,
             $this->mapperMock,
             $this->localeDateMock,
             $this->indexProcessorMock
         );
     }
 
+    public function testDelete()
+    {
+        $this->stockItemResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockItemMock)
+            ->willReturnSelf();
+
+        $this->assertTrue($this->model->delete($this->stockItemMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     */
+    public function testDeleteException()
+    {
+        $this->stockItemResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockItemMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->delete($this->stockItemMock);
+    }
+
+    public function testDeleteById()
+    {
+        $id = 1;
+
+        $this->stockItemFactoryMock->expects($this->once())->method('create')->willReturn($this->stockItemMock);
+        $this->stockItemResourceMock->expects($this->once())->method('load')->with($this->stockItemMock, $id);
+        $this->stockItemMock->expects($this->once())->method('getItemId')->willReturn($id);
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     * @expectedExceptionMessage Stock Item with id "1" does not exist.
+     */
+    public function testDeleteByIdException()
+    {
+        $id = 1;
+
+        $this->stockItemFactoryMock->expects($this->once())->method('create')->willReturn($this->stockItemMock);
+        $this->stockItemResourceMock->expects($this->once())->method('load')->with($this->stockItemMock, $id);
+        $this->stockItemMock->expects($this->once())->method('getItemId')->willReturn(null);
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+
     public function testSave()
     {
-        $params = [];
+        $productId = 1;
+
+        $this->stockItemMock->expects($this->any())->method('getProductId')->willReturn($productId);
+        $this->productMock->expects($this->once())->method('load')->with($productId)->willReturnSelf();
+        $this->productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $this->productMock->expects($this->once())->method('getTypeId')->willReturn('typeId');
+        $this->stockConfigurationMock->expects($this->once())->method('isQty')->with('typeId')->willReturn(true);
+        $this->stockStateProviderMock->expects($this->once())
+            ->method('verifyStock')
+            ->with($this->stockItemMock)
+            ->willReturn(false);
+        $this->stockItemMock->expects($this->once())->method('getManageStock')->willReturn(true);
+        $this->stockItemMock->expects($this->once())->method('setIsInStock')->with(false)->willReturnSelf();
+        $this->stockItemMock->expects($this->once())
+            ->method('setStockStatusChangedAutomaticallyFlag')
+            ->with(true)
+            ->willReturnSelf();
+        $this->stockItemMock->expects($this->any())->method('setLowStockDate')->willReturnSelf();
+        $this->stockStateProviderMock->expects($this->once())
+            ->method('verifyNotification')
+            ->with($this->stockItemMock)
+            ->willReturn(true);
+        $this->stockItemMock->expects($this->atLeastOnce())->method('setStockStatusChangedAuto')->willReturnSelf();
+        $this->stockItemMock->expects($this->once())
+            ->method('hasStockStatusChangedAutomaticallyFlag')
+            ->willReturn(true);
+        $this->stockItemMock->expects($this->once())
+            ->method('getStockStatusChangedAutomaticallyFlag')
+            ->willReturn(true);
+        $this->stockItemMock->expects($this->once())->method('getWebsiteId')->willReturn(1);
+        $this->stockItemMock->expects($this->once())->method('setWebsiteId')->with(1)->willReturnSelf();
+        $this->stockItemMock->expects($this->once())->method('getStockId')->willReturn(1);
+        $this->stockItemMock->expects($this->once())->method('setStockId')->with(1)->willReturnSelf();
+        $this->stockItemResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockItemMock)
+            ->willReturnSelf();
+        $this->indexProcessorMock->expects($this->once())->method('reindexRow')->with($productId);
+
+        $this->assertEquals($this->stockItemMock, $this->model->save($this->stockItemMock));
+    }
+
+    public function testSaveWithoutProductId()
+    {
+        $productId = 1;
+
+        $this->stockItemMock->expects($this->any())->method('getProductId')->willReturn($productId);
+        $this->productMock->expects($this->once())->method('load')->with($productId)->willReturnSelf();
+        $this->productMock->expects($this->once())->method('getId')->willReturn(null);
+
+        $this->assertEquals($this->stockItemMock, $this->model->save($this->stockItemMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+     */
+    public function testSaveException()
+    {
+        $productId = 1;
+
+        $this->stockItemMock->expects($this->any())->method('getProductId')->willReturn($productId);
+        $this->productMock->expects($this->once())->method('load')->with($productId)->willReturnSelf();
+        $this->productMock->expects($this->once())->method('getId')->willReturn($productId);
+        $this->productMock->expects($this->once())->method('getTypeId')->willReturn('typeId');
+        $this->stockConfigurationMock->expects($this->once())->method('isQty')->with('typeId')->willReturn(false);
+        $this->stockItemMock->expects($this->once())->method('setQty')->with(0)->willReturnSelf();
+        $this->stockItemMock->expects($this->once())->method('getWebsiteId')->willReturn(1);
+        $this->stockItemMock->expects($this->once())->method('setWebsiteId')->with(1)->willReturnSelf();
+        $this->stockItemMock->expects($this->once())->method('getStockId')->willReturn(1);
+        $this->stockItemMock->expects($this->once())->method('setStockId')->with(1)->willReturnSelf();
+        $this->stockItemResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockItemMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->save($this->stockItemMock);
+    }
 
-        $stockItemMock = $this->getMockBuilder('Magento\CatalogInventory\Api\Data\StockItemInterface')
+    public function testGetList()
+    {
+        $criteriaMock = $this->getMockBuilder('Magento\CatalogInventory\Api\StockItemCriteriaInterface')
+            ->getMock();
+        $queryBuilderMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilder')
             ->disableOriginalConstructor()
+            ->setMethods(['setCriteria', 'setResource', 'create'])
             ->getMock();
-        $this->indexProcessorMock->expects($this->any())
-            ->method('reindexRow')
-            ->withAnyParameters();
-        $this->assertInstanceOf(
-            'Magento\CatalogInventory\Api\Data\StockItemInterface',
-            $this->model->save($stockItemMock, $params)
-        );
+        $queryMock = $this->getMockBuilder('Magento\Framework\DB\QueryInterface')
+            ->getMock();
+        $queryCollectionMock = $this->getMockBuilder('Magento\CatalogInventory\Api\Data\StockItemCollectionInterface')
+            ->getMock();
+
+        $this->queryBuilderFactoryMock->expects($this->once())->method('create')->willReturn($queryBuilderMock);
+        $queryBuilderMock->expects($this->once())->method('setCriteria')->with($criteriaMock)->willReturnSelf();
+        $queryBuilderMock->expects($this->once())
+            ->method('setResource')
+            ->with($this->stockItemResourceMock)
+            ->willReturnSelf();
+        $queryBuilderMock->expects($this->once())->method('create')->willReturn($queryMock);
+        $this->stockItemCollectionMock->expects($this->once())->method('create')->willReturn($queryCollectionMock);
+
+        $this->assertEquals($queryCollectionMock, $this->model->getList($criteriaMock));
     }
 }
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockRepositoryTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockRepositoryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..dc13237c4677445f25dd6d6107100a8345e61b9c
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockRepositoryTest.php
@@ -0,0 +1,186 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\CatalogInventory\Test\Unit\Model\Stock;
+
+use \Magento\CatalogInventory\Model\Stock\StockRepository;
+
+/**
+ * Class StockRepositoryTest
+ */
+class StockRepositoryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var StockRepository
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\CatalogInventory\Model\Stock |\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockMock;
+
+    /**
+     * @var \Magento\CatalogInventory\Model\Resource\Stock|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockResourceMock;
+
+    /**
+     * @var Magento\CatalogInventory\Model\StockFactory |\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockFactoryMock;
+
+    /**
+     * @var Magento\CatalogInventory\Api\Data\StockCollectionInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockCollectionMock;
+
+    /**
+     * @var \Magento\Framework\DB\QueryBuilderFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $queryBuilderFactoryMock;
+
+    /**
+     * @var \Magento\Framework\DB\MapperFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mapperMock;
+
+    protected function setUp()
+    {
+
+        $this->stockMock = $this->getMockBuilder('\Magento\CatalogInventory\Model\Stock')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->stockResourceMock = $this->getMockBuilder('\Magento\CatalogInventory\Model\Resource\Stock')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->stockFactoryMock = $this->getMockBuilder(
+            'Magento\CatalogInventory\Model\StockFactory'
+        )
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->stockCollectionMock = $this->getMockBuilder(
+            'Magento\CatalogInventory\Api\Data\StockCollectionInterfaceFactory'
+        )
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->queryBuilderFactoryMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilderFactory')
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->mapperMock = $this->getMockBuilder('Magento\Framework\DB\MapperFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->model = new StockRepository(
+            $this->stockResourceMock,
+            $this->stockFactoryMock,
+            $this->stockCollectionMock,
+            $this->queryBuilderFactoryMock,
+            $this->mapperMock
+        );
+    }
+
+    public function testSave()
+    {
+        $this->stockResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockMock)
+            ->willReturnSelf();
+
+        $this->assertEquals($this->stockMock, $this->model->save($this->stockMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+     */
+    public function testSaveException()
+    {
+        $this->stockResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->save($this->stockMock);
+    }
+
+    public function testGetList()
+    {
+        $criteriaMock = $this->getMockBuilder('Magento\CatalogInventory\Api\StockCriteriaInterface')
+            ->getMock();
+        $queryBuilderMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilder')
+            ->disableOriginalConstructor()
+            ->setMethods(['setCriteria', 'setResource', 'create'])
+            ->getMock();
+        $queryMock = $this->getMockBuilder('Magento\Framework\DB\QueryInterface')
+            ->getMock();
+        $queryCollectionMock = $this->getMockBuilder('Magento\CatalogInventory\Api\Data\StockCollectionInterface')
+            ->getMock();
+
+        $this->queryBuilderFactoryMock->expects($this->once())->method('create')->willReturn($queryBuilderMock);
+        $queryBuilderMock->expects($this->once())->method('setCriteria')->with($criteriaMock)->willReturnSelf();
+        $queryBuilderMock->expects($this->once())
+            ->method('setResource')
+            ->with($this->stockResourceMock)
+            ->willReturnSelf();
+        $queryBuilderMock->expects($this->once())->method('create')->willReturn($queryMock);
+        $this->stockCollectionMock->expects($this->once())->method('create')->willReturn($queryCollectionMock);
+
+        $this->assertEquals($queryCollectionMock, $this->model->getList($criteriaMock));
+    }
+
+    public function testDelete()
+    {
+        $this->stockResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockMock)
+            ->willReturnSelf();
+
+        $this->assertTrue($this->model->delete($this->stockMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     */
+    public function testDeleteException()
+    {
+        $this->stockResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->delete($this->stockMock);
+    }
+
+    public function testDeleteById()
+    {
+        $id = 1;
+
+        $this->stockFactoryMock->expects($this->once())->method('create')->willReturn($this->stockMock);
+        $this->stockResourceMock->expects($this->once())->method('load')->with($this->stockMock, $id);
+        $this->stockMock->expects($this->once())->method('getId')->willReturn($id);
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     * @expectedExceptionMessage Stock with id "1" does not exist.
+     */
+    public function testDeleteByIdException()
+    {
+        $id = 1;
+
+        $this->stockFactoryMock->expects($this->once())->method('create')->willReturn($this->stockMock);
+        $this->stockResourceMock->expects($this->once())->method('load')->with($this->stockMock, $id);
+        $this->stockMock->expects($this->once())->method('getId')->willReturn(null);
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+}
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockStatusRepositoryTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockStatusRepositoryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..19eadb2165460d9f9ba2428d652580f6f78a0b6b
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockStatusRepositoryTest.php
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\CatalogInventory\Test\Unit\Model\Stock;
+
+use \Magento\CatalogInventory\Model\Stock\StockStatusRepository;
+use \Magento\CatalogInventory\Api\Data as InventoryApiData;
+
+/**
+ * Class StockStatusRepositoryTest
+ */
+class StockStatusRepositoryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var StockStatusRepository
+     */
+    protected $model;
+
+    /**
+     * @var \Magento\CatalogInventory\Model\Stock\Status|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockStatusMock;
+
+    /**
+     * @var \Magento\CatalogInventory\Model\Resource\Stock\Status|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockStatusResourceMock;
+
+    /**
+     * @var Magento\CatalogInventory\Model\Stock\StatusFactory |\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockStatusFactoryMock;
+
+    /**
+     * @var InventoryApiData\StockStatusCollectionInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $stockStatusCollectionMock;
+
+    /**
+     * @var \Magento\Framework\DB\QueryBuilderFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $queryBuilderFactoryMock;
+
+    /**
+     * @var \Magento\Framework\DB\MapperFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mapperMock;
+
+    protected function setUp()
+    {
+        $this->stockStatusMock = $this->getMockBuilder('\Magento\CatalogInventory\Model\Stock\Status')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->stockStatusResourceMock = $this->getMockBuilder('\Magento\CatalogInventory\Model\Resource\Stock\Status')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->stockStatusFactoryMock = $this->getMockBuilder(
+            'Magento\CatalogInventory\Model\Stock\StatusFactory'
+        )
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->stockStatusCollectionMock = $this->getMockBuilder(
+            'Magento\CatalogInventory\Api\Data\StockStatusCollectionInterfaceFactory'
+        )
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->queryBuilderFactoryMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilderFactory')
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->mapperMock = $this->getMockBuilder('Magento\Framework\DB\MapperFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->model = new StockStatusRepository(
+            $this->stockStatusResourceMock,
+            $this->stockStatusFactoryMock,
+            $this->stockStatusCollectionMock,
+            $this->queryBuilderFactoryMock,
+            $this->mapperMock
+        );
+    }
+
+    public function testSave()
+    {
+        $this->stockStatusResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockStatusMock)
+            ->willReturnSelf();
+
+        $this->assertEquals($this->stockStatusMock, $this->model->save($this->stockStatusMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+     */
+    public function testSaveException()
+    {
+        $this->stockStatusResourceMock->expects($this->once())
+            ->method('save')
+            ->with($this->stockStatusMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->save($this->stockStatusMock);
+    }
+
+    public function testGetList()
+    {
+        $criteriaMock = $this->getMockBuilder('Magento\CatalogInventory\Api\StockStatusCriteriaInterface')
+            ->getMock();
+        $queryBuilderMock = $this->getMockBuilder('Magento\Framework\DB\QueryBuilder')
+            ->disableOriginalConstructor()
+            ->setMethods(['setCriteria', 'setResource', 'create'])
+            ->getMock();
+        $queryMock = $this->getMockBuilder('Magento\Framework\DB\QueryInterface')
+            ->getMock();
+        $queryCollectionMock = $this->getMockBuilder('Magento\CatalogInventory\Api\Data\StockStatusCollectionInterface')
+            ->getMock();
+
+        $this->queryBuilderFactoryMock->expects($this->once())->method('create')->willReturn($queryBuilderMock);
+        $queryBuilderMock->expects($this->once())->method('setCriteria')->with($criteriaMock)->willReturnSelf();
+        $queryBuilderMock->expects($this->once())
+            ->method('setResource')
+            ->with($this->stockStatusResourceMock)
+            ->willReturnSelf();
+        $queryBuilderMock->expects($this->once())->method('create')->willReturn($queryMock);
+        $this->stockStatusCollectionMock->expects($this->once())->method('create')->willReturn($queryCollectionMock);
+
+        $this->assertEquals($queryCollectionMock, $this->model->getList($criteriaMock));
+    }
+
+    public function testDelete()
+    {
+        $this->stockStatusResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockStatusMock)
+            ->willReturnSelf();
+
+        $this->assertTrue($this->model->delete($this->stockStatusMock));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     */
+    public function testDeleteException()
+    {
+        $this->stockStatusResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockStatusMock)
+            ->willThrowException(new \Exception());
+
+        $this->model->delete($this->stockStatusMock);
+    }
+
+    public function testDeleteById()
+    {
+        $id = 1;
+
+        $this->stockStatusFactoryMock->expects($this->once())->method('create')->willReturn($this->stockStatusMock);
+        $this->stockStatusResourceMock->expects($this->once())->method('load')->with($this->stockStatusMock, $id);
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\CouldNotDeleteException
+     */
+    public function testDeleteByIdException()
+    {
+        $id = 1;
+
+        $this->stockStatusFactoryMock->expects($this->once())->method('create')->willReturn($this->stockStatusMock);
+        $this->stockStatusResourceMock->expects($this->once())->method('load')->with($this->stockStatusMock, $id);
+        $this->stockStatusResourceMock->expects($this->once())
+            ->method('delete')
+            ->with($this->stockStatusMock)
+            ->willThrowException(new \Exception());
+
+        $this->assertTrue($this->model->deleteById($id));
+    }
+}
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/StockRegistryTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/StockRegistryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0c7cdea123e283baf3a5f2f9021e5dcb057fbbf4
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/StockRegistryTest.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\CatalogInventory\Test\Unit\Model;
+
+/**
+ * Class StockRegistryTest
+ */
+class StockRegistryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogInventory\Model\StockRegistry
+     */
+    protected $model;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $criteria;
+
+    public function setUp()
+    {
+        $this->criteria = $this->getMockBuilder('Magento\CatalogInventory\Api\StockItemCriteriaInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $criteriaFactory = $this->getMockBuilder('Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory')
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $criteriaFactory->expects($this->once())->method('create')->willReturn($this->criteria);
+
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+        $this->model = $objectManager->getObject(
+            'Magento\CatalogInventory\Model\StockRegistry',
+            [
+                'criteriaFactory' => $criteriaFactory
+            ]
+        );
+    }
+
+    public function testGetLowStockItems()
+    {
+        $this->criteria->expects($this->once())->method('setLimit')->with(1, 0);
+        $this->criteria->expects($this->once())->method('setWebsiteFilter')->with(1);
+        $this->criteria->expects($this->once())->method('setQtyFilter')->with('<=');
+        $this->criteria->expects($this->once())->method('addField')->with('qty');
+        $this->model->getLowStockItems(1, 100);
+    }
+}
diff --git a/app/code/Magento/CatalogInventory/etc/webapi.xml b/app/code/Magento/CatalogInventory/etc/webapi.xml
index 80317eccf51a7dd8ba3e7d24fe0497cef61e9df2..fe200c8628cb130aa2f3847283c7b52e0bac3b23 100644
--- a/app/code/Magento/CatalogInventory/etc/webapi.xml
+++ b/app/code/Magento/CatalogInventory/etc/webapi.xml
@@ -13,7 +13,7 @@
             <resource ref="Magento_CatalogInventory::cataloginventory"/>
         </resources>
     </route>
-    <route url="/V1/stockItems/:productSku" method="PUT">
+    <route url="/V1/products/:productSku/stockItems/:itemId" method="PUT">
         <service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="updateStockItemBySku"/>
         <resources>
             <resource ref="Magento_CatalogInventory::cataloginventory"/>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml
index 2865b30b7710771e8fa63e2542f8f08e08c5c68e..a997ad893456cef5e3ff769f50a3881cdcb8fa12 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml
@@ -149,14 +149,14 @@
                     <div class="fields-group-2">
                         <div class="field field-pricing-value">
                             <div class="control">
-                                <input type="text" class="pricing-value validate-number"
+                                <input type="text" class="pricing-value validate-number" <?php if(!$block->getCanEditPrice()): ?> 'disabled="disabled"' <?php endif; ?>
                                        name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][pricing_value]" />
                             </div>
                         </div>
                         <div class="field field-pricing-measure">
                             <div class="actions dropdown actions-select">
                                 <input type="hidden" value="0" name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][is_percent]"/>
-                                <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'>
+                                <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}' <?php if(!$block->getCanEditPrice()): ?> 'disabled="disabled"' <?php endif; ?>>
                                     <span><?php echo $block->getBaseCurrency()->getSymbol() ?></span>
                                 </button>
                                 <ul class="dropdown" data-role="dropdown-menu" data-mage-init='{"menu":{}}'>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-template.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-template.phtml
index 9a50b287313e96ffbf5d4335e1fb8c9563ee5f8e..dd8a327146c9e87e81db2815df1a84ec4d9afcf2 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-template.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-template.phtml
@@ -118,7 +118,7 @@ $id = $block->escapeHtml($attribute['attribute_id']);
                                                 <div class="fields-group-2">
                                                     <div class="field field-pricing-value">
                                                         <div class="control">
-                                                            <input type="text" class="pricing-value validate-number"
+                                                            <input type="text" <?php if (!$block->getCanEditPrice()): ?> disabled="disabled";<?php endif; ?> class="pricing-value validate-number"
                                                                    name="<?php echo $namePrefix ?>[<?php echo $valueIndex ?>][pricing_value]"
                                                                    value="<?php echo $block->escapeHtml($pricingValue);
                                 ?>">
@@ -128,7 +128,7 @@ $id = $block->escapeHtml($attribute['attribute_id']);
                                                         <div class="actions dropdown actions-select">
                                                             <input name="<?php echo $namePrefix ?>[<?php echo $valueIndex ?>][is_percent]" type="hidden" value="<?php echo $isPercent ? 1 : 0;
                                 ?>"/>
-                                                            <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'>
+                                                            <button type="button" class="action toggle" <?php if (!$block->getCanEditPrice()): ?> disabled="disabled" <?php endif; ?> data-toggle="dropdown" data-mage-init='{"dropdown":{}}'>
                                                                 <span><?php echo $isPercent ? __('%') : $block->getBaseCurrency()->getSymbol() ?></span>
                                                             </button>
                                                             <ul class="dropdown" data-role="dropdown-menu" data-mage-init='{"menu":{}}'>
diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php
index 4eba984b8fcfa243c684cce9019a51444cad3283..4b92506e5118417cdba79e7b8556afd8974fe8da 100644
--- a/app/code/Magento/Email/Model/AbstractTemplate.php
+++ b/app/code/Magento/Email/Model/AbstractTemplate.php
@@ -71,22 +71,26 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
      * @param \Magento\Framework\Registry $registry
      * @param \Magento\Store\Model\App\Emulation $appEmulation
      * @param \Magento\Store\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Framework\Model\Resource\AbstractResource $resource
+     * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
      * @param array $data
      */
     public function __construct(
         \Magento\Framework\Model\Context $context,
-        \Magento\Framework\View\DesignInterface $design,
         \Magento\Framework\Registry $registry,
+        \Magento\Framework\View\DesignInterface $design,
         \Magento\Store\Model\App\Emulation $appEmulation,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
-        array $data = []
+        array $data = [],
+        \Magento\Framework\Model\Resource\AbstractResource $resource = null,
+        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null
     ) {
         $this->_design = $design;
         $this->_area = isset($data['area']) ? $data['area'] : null;
         $this->_store = isset($data['store']) ? $data['store'] : null;
         $this->_appEmulation = $appEmulation;
         $this->_storeManager = $storeManager;
-        parent::__construct($context, $registry, null, null, $data);
+        parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     }
 
     /**
diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php
index c8bc6b34398e0c492f9123cfaeedc8182da23299..e95278407067921ce22144ee327204e518b60625 100644
--- a/app/code/Magento/Email/Model/BackendTemplate.php
+++ b/app/code/Magento/Email/Model/BackendTemplate.php
@@ -38,8 +38,8 @@ class BackendTemplate extends Template
      */
     public function __construct(
         \Magento\Framework\Model\Context $context,
-        \Magento\Framework\View\DesignInterface $design,
         \Magento\Framework\Registry $registry,
+        \Magento\Framework\View\DesignInterface $design,
         \Magento\Store\Model\App\Emulation $appEmulation,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Framework\Filesystem $filesystem,
@@ -53,8 +53,8 @@ class BackendTemplate extends Template
     ) {
         parent::__construct(
             $context,
-            $design,
             $registry,
+            $design,
             $appEmulation,
             $storeManager,
             $filesystem,
diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php
index 577393b498924af0885edb1affd4f97c6feec9bb..30f8ae33f00615c9968ae62e2d4e41e71f7acc12 100644
--- a/app/code/Magento/Email/Model/Template.php
+++ b/app/code/Magento/Email/Model/Template.php
@@ -156,10 +156,10 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento
 
     /**
      * @param \Magento\Framework\Model\Context $context
-     * @param \Magento\Framework\View\DesignInterface $design
      * @param \Magento\Framework\Registry $registry
+     * @param \Magento\Framework\View\DesignInterface $design
      * @param \Magento\Store\Model\App\Emulation $appEmulation
-     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
+     * @param StoreManagerInterface $storeManager
      * @param \Magento\Framework\Filesystem $filesystem
      * @param \Magento\Framework\View\Asset\Repository $assetRepo
      * @param \Magento\Framework\View\FileSystem $viewFileSystem
@@ -167,13 +167,15 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento
      * @param Template\FilterFactory $emailFilterFactory
      * @param Template\Config $emailConfig
      * @param array $data
+     * @param \Magento\Framework\Model\Resource\AbstractResource $resource
+     * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Framework\Model\Context $context,
-        \Magento\Framework\View\DesignInterface $design,
         \Magento\Framework\Registry $registry,
+        \Magento\Framework\View\DesignInterface $design,
         \Magento\Store\Model\App\Emulation $appEmulation,
         StoreManagerInterface $storeManager,
         \Magento\Framework\Filesystem $filesystem,
@@ -182,7 +184,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
         \Magento\Email\Model\Template\FilterFactory $emailFilterFactory,
         \Magento\Email\Model\Template\Config $emailConfig,
-        array $data = []
+        array $data = [],
+        \Magento\Framework\Model\Resource\AbstractResource $resource = null,
+        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null
     ) {
         $this->_scopeConfig = $scopeConfig;
         $this->_filesystem = $filesystem;
@@ -190,7 +194,16 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento
         $this->_viewFileSystem = $viewFileSystem;
         $this->_emailFilterFactory = $emailFilterFactory;
         $this->_emailConfig = $emailConfig;
-        parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data);
+        parent::__construct(
+            $context,
+            $registry,
+            $design,
+            $appEmulation,
+            $storeManager,
+            $data,
+            $resource,
+            $resourceCollection
+        );
     }
 
     /**
diff --git a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php
index 47d4e8e0929ac4722552617b51d069385d24d2be..3c89c3a8532971729ea0a7fcbb408ef0854fb2a3 100644
--- a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php
+++ b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php
@@ -122,8 +122,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
             ->setConstructorArgs(
                 [
                     $this->context,
-                    $this->design,
                     $this->registry,
+                    $this->design,
                     $this->appEmulation,
                     $this->storeManager,
                     $this->filesystem,
@@ -758,8 +758,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
         )->setConstructorArgs(
             [
                 $this->getMock('Magento\Framework\Model\Context', [], [], '', false),
-                $this->getMock('Magento\Theme\Model\View\Design', [], [], '', false),
                 $this->getMock('Magento\Framework\Registry', [], [], '', false),
+                $this->getMock('Magento\Theme\Model\View\Design', [], [], '', false),
                 $this->getMock('Magento\Store\Model\App\Emulation', [], [], '', false),
                 $this->getMock('Magento\Store\Model\StoreManager', [], [], '', false),
                 $this->getMock('Magento\Framework\Filesystem', [], [], '', false),
diff --git a/app/code/Magento/Indexer/etc/crontab.xml b/app/code/Magento/Indexer/etc/crontab.xml
index 33e6a27040f939cca18a0ccf2418ffa0fa3ee5b7..2dd222c0e0166f7a4c5f1800e8655c83dccb0cec 100644
--- a/app/code/Magento/Indexer/etc/crontab.xml
+++ b/app/code/Magento/Indexer/etc/crontab.xml
@@ -6,7 +6,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Cron/etc/crontab.xsd">
-    <group id="index">
+    <group id="default">
         <job name="indexer_reindex_all_invalid" instance="Magento\Indexer\Model\Processor" method="reindexAllInvalid">
             <schedule>* * * * *</schedule>
         </job>
diff --git a/app/code/Magento/Newsletter/Model/Queue.php b/app/code/Magento/Newsletter/Model/Queue.php
index 4c34f3419f10ad6f41717fd31d5b656d2d849ffb..3a42e4ac6e36ba5b352caffd24f13cf5e23c48d7 100644
--- a/app/code/Magento/Newsletter/Model/Queue.php
+++ b/app/code/Magento/Newsletter/Model/Queue.php
@@ -119,13 +119,15 @@ class Queue extends \Magento\Email\Model\AbstractTemplate
      * @param \Magento\Newsletter\Model\ProblemFactory $problemFactory
      * @param \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory
      * @param \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder
+     * @param \Magento\Framework\Model\Resource\AbstractResource $resource
+     * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
      * @param array $data
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Framework\Model\Context $context,
-        \Magento\Framework\View\DesignInterface $design,
         \Magento\Framework\Registry $registry,
+        \Magento\Framework\View\DesignInterface $design,
         \Magento\Store\Model\App\Emulation $appEmulation,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Newsletter\Model\Template\Filter $templateFilter,
@@ -134,9 +136,20 @@ class Queue extends \Magento\Email\Model\AbstractTemplate
         \Magento\Newsletter\Model\ProblemFactory $problemFactory,
         \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory,
         \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder,
+        \Magento\Framework\Model\Resource\AbstractResource $resource = null,
+        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
         array $data = []
     ) {
-        parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data);
+        parent::__construct(
+            $context,
+            $registry,
+            $design,
+            $appEmulation,
+            $storeManager,
+            $data,
+            $resource,
+            $resourceCollection
+        );
         $this->_templateFilter = $templateFilter;
         $this->_date = $date;
         $this->_templateFactory = $templateFactory;
diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php
index 9f2dc723b155c0da2015d5cae3d906f5069ec660..9f439f7192713eb30dfff6dbc279b615cc53a6ff 100644
--- a/app/code/Magento/Newsletter/Model/Template.php
+++ b/app/code/Magento/Newsletter/Model/Template.php
@@ -106,8 +106,8 @@ class Template extends \Magento\Email\Model\AbstractTemplate
      */
     public function __construct(
         \Magento\Framework\Model\Context $context,
-        \Magento\Framework\View\DesignInterface $design,
         \Magento\Framework\Registry $registry,
+        \Magento\Framework\View\DesignInterface $design,
         \Magento\Store\Model\App\Emulation $appEmulation,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Framework\App\RequestInterface $request,
@@ -117,7 +117,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
         \Magento\Framework\Filter\FilterManager $filterManager,
         array $data = []
     ) {
-        parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data);
+        parent::__construct($context, $registry, $design, $appEmulation, $storeManager, $data);
         $this->_storeManager = $storeManager;
         $this->_request = $request;
         $this->_filter = $filter;
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0c97d3ef5ef8a0b28513411058c1604b81aa6bed
--- /dev/null
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/Plugin/CustomerPluginTest.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Newsletter\Test\Unit\Model\Plugin;
+
+class CustomerPluginTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Newsletter\Model\Plugin\CustomerPlugin
+     */
+    protected $plugin;
+
+    /**
+     * @var \Magento\Newsletter\Model\SubscriberFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $subscriberFactory;
+
+    /**
+     * @var \Magento\Newsletter\Model\Subscriber|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $subscriber;
+
+    /**
+     * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+     */
+    protected $objectManager;
+
+    public function setUp()
+    {
+        $this->subscriberFactory = $this->getMockBuilder('\Magento\Newsletter\Model\SubscriberFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+        $this->subscriber = $this->getMockBuilder('\Magento\Newsletter\Model\Subscriber')
+            ->setMethods(['loadByEmail', 'getId', 'delete', 'updateSubscription'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->subscriberFactory->expects($this->any())->method('create')->willReturn($this->subscriber);
+
+        $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+        $this->plugin = $this->objectManager->getObject(
+            'Magento\Newsletter\Model\Plugin\CustomerPlugin',
+            [
+                'subscriberFactory' => $this->subscriberFactory
+            ]
+        );
+    }
+
+    public function testAfterSave()
+    {
+        $customerId = 1;
+        $subject = $this->getMock('\Magento\Customer\Api\CustomerRepositoryInterface');
+        $customer = $this->getMock('Magento\Customer\Api\Data\CustomerInterface');
+        $customer->expects($this->once())->method('getId')->willReturn($customerId);
+        $this->subscriber->expects($this->once())->method('updateSubscription')->with($customerId)->willReturnSelf();
+
+        $this->assertEquals($customer, $this->plugin->afterSave($subject, $customer));
+    }
+
+    public function testAroundDelete()
+    {
+        $deleteCustomer = function () {
+            return true;
+        };
+        $subject = $this->getMock('\Magento\Customer\Api\CustomerRepositoryInterface');
+        $customer = $this->getMock('Magento\Customer\Api\Data\CustomerInterface');
+        $customer->expects($this->once())->method('getEmail')->willReturn('test@test.com');
+        $this->subscriber->expects($this->once())->method('loadByEmail')->with('test@test.com')->willReturnSelf();
+        $this->subscriber->expects($this->once())->method('getId')->willReturn(1);
+        $this->subscriber->expects($this->once())->method('delete')->willReturnSelf();
+
+        $this->assertEquals(true, $this->plugin->aroundDelete($subject, $deleteCustomer, $customer));
+    }
+
+    public function testAroundDeleteById()
+    {
+        $customerId = 1;
+        $deleteCustomerById = function () {
+            return true;
+        };
+        $subject = $this->getMock('\Magento\Customer\Api\CustomerRepositoryInterface');
+        $customer = $this->getMock('Magento\Customer\Api\Data\CustomerInterface');
+        $subject->expects($this->once())->method('getById')->willReturn($customer);
+        $customer->expects($this->once())->method('getEmail')->willReturn('test@test.com');
+        $this->subscriber->expects($this->once())->method('loadByEmail')->with('test@test.com')->willReturnSelf();
+        $this->subscriber->expects($this->once())->method('getId')->willReturn(1);
+        $this->subscriber->expects($this->once())->method('delete')->willReturnSelf();
+
+        $this->assertEquals(true, $this->plugin->aroundDeleteById($subject, $deleteCustomerById, $customerId));
+    }
+}
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/QueueTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/QueueTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..bb8ec3b719f54c143447aececfde24daccbcc5ce
--- /dev/null
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/QueueTest.php
@@ -0,0 +1,205 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Newsletter\Test\Unit\Model;
+
+class QueueTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Newsletter\Model\Queue
+     */
+    protected $queue;
+
+    /**
+     * @var \Magento\Newsletter\Model\Template\Filter|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $templateFilter;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\DateTime|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $date;
+
+    /**
+     * @var \Magento\Newsletter\Model\TemplateFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $templateFactory;
+
+    /**
+     * @var \Magento\Newsletter\Model\ProblemFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $problemFactory;
+
+    /**
+     * @var \Magento\Newsletter\Model\Resource\Subscriber\Collection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subscribersCollection;
+
+    /**
+     * @var \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subscribersCollectionFactory;
+
+    /**
+     * @var \Magento\Newsletter\Model\Queue\TransportBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $transportBuilder;
+
+    /**
+     * @var \Magento\Newsletter\Model\Resource\Queue|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resource;
+
+    /**
+     * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+     */
+    protected $objectManager;
+
+    public function setUp()
+    {
+        $this->templateFilter = $this->getMockBuilder('\Magento\Newsletter\Model\Template\Filter')
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+        $this->date = $this->getMockBuilder('\Magento\Framework\Stdlib\DateTime\DateTime')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->templateFactory = $this->getMockBuilder('\Magento\Newsletter\Model\TemplateFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(['create', 'load'])
+            ->getMock();
+        $this->problemFactory = $this->getMockBuilder('\Magento\Newsletter\Model\ProblemFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->transportBuilder = $this->getMockBuilder('\Magento\Newsletter\Model\Queue\TransportBuilder')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                ['setTemplateData', 'setTemplateOptions', 'setTemplateVars', 'setFrom', 'addTo', 'getTransport']
+            )
+            ->getMock();
+        $this->subscribersCollection = $this->getMockBuilder('\Magento\Newsletter\Model\Resource\Subscriber\Collection')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->resource = $this->getMockBuilder('\Magento\Newsletter\Model\Resource\Queue')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->subscribersCollectionFactory = $this->getMockBuilder(
+            '\Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory'
+        )
+            ->disableOriginalConstructor()
+            ->setMethods(['create'])
+            ->getMock();
+        $this->subscribersCollectionFactory->expects($this->any())->method('create')->willReturn(
+            $this->subscribersCollection
+        );
+
+        $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+        $this->queue = $this->objectManager->getObject(
+            '\Magento\Newsletter\Model\Queue',
+            [
+                'templateFilter' => $this->templateFilter,
+                'date' => $this->date,
+                'templateFactory' => $this->templateFactory,
+                'problemFactory' => $this->problemFactory,
+                'subscriberCollectionFactory' => $this->subscribersCollectionFactory,
+                'transportBuilder' => $this->transportBuilder,
+                'resource' => $this->resource
+            ]
+        );
+    }
+
+    public function testSendPerSubscriber1()
+    {
+        $this->queue->setQueueStatus(2);
+        $this->queue->setQueueStartAt(1);
+
+        $this->assertEquals($this->queue, $this->queue->sendPerSubscriber());
+    }
+
+    public function testSendPerSubscriberZeroSize()
+    {
+        $this->queue->setQueueStatus(1);
+        $this->queue->setQueueStartAt(1);
+        $this->subscribersCollection->expects($this->once())->method('getQueueJoinedFlag')->willReturn(false);
+        $this->subscribersCollection->expects($this->once())->method('useQueue')->with($this->queue)->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('getSize')->willReturn(0);
+        $this->date->expects($this->once())->method('gmtDate')->willReturn('any_date');
+
+        $this->assertEquals($this->queue, $this->queue->sendPerSubscriber());
+    }
+
+    public function testSendPerSubscriber2()
+    {
+        $this->queue->setQueueStatus(1);
+        $this->queue->setQueueStartAt(1);
+        $collection = $this->getMockBuilder('\Magento\Framework\Data\Collection')
+            ->disableOriginalConstructor()
+            ->setMethods(['getItems'])
+            ->getMock();
+        $item = $this->getMockBuilder('\Magento\Newsletter\Model\Subscriber')
+            ->disableOriginalConstructor()
+            ->setMethods(['getStoreId', 'getSubscriberEmail', 'getSubscriberFullName', 'received'])
+            ->getMock();
+        $transport = $this->getMock('\Magento\Framework\Mail\TransportInterface');
+        $this->subscribersCollection->expects($this->once())->method('getQueueJoinedFlag')->willReturn(false);
+        $this->subscribersCollection->expects($this->once())->method('useQueue')->with($this->queue)->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('getSize')->willReturn(5);
+        $this->subscribersCollection->expects($this->once())->method('useOnlyUnsent')->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('showCustomerInfo')->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('setPageSize')->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('setCurPage')->willReturnSelf();
+        $this->subscribersCollection->expects($this->once())->method('load')->willReturn($collection);
+        $this->transportBuilder->expects($this->once())->method('setTemplateData')->willReturnSelf();
+        $collection->expects($this->atLeastOnce())->method('getItems')->willReturn([$item]);
+        $item->expects($this->once())->method('getStoreId')->willReturn('store_id');
+        $item->expects($this->once())->method('getSubscriberEmail')->willReturn('email');
+        $item->expects($this->once())->method('getSubscriberFullName')->willReturn('full_name');
+        $this->transportBuilder->expects($this->once())->method('setTemplateOptions')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('setTemplateVars')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('setFrom')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('addTo')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('getTransport')->willReturn($transport);
+        $item->expects($this->once())->method('received')->with($this->queue)->willReturnSelf();
+
+        $this->assertEquals($this->queue, $this->queue->sendPerSubscriber());
+    }
+
+    public function testGetDataForSave()
+    {
+        $result = [
+            'template_id' => 'id',
+            'queue_status' => 'status',
+            'queue_start_at' => 'start_at',
+            'queue_finish_at' => 'finish_at'
+        ];
+        $this->queue->setTemplateId('id');
+        $this->queue->setQueueStatus('status');
+        $this->queue->setQueueStartAt('start_at');
+        $this->queue->setQueueFinishAt('finish_at');
+
+        $this->assertEquals($result, $this->queue->getDataForSave());
+    }
+
+    public function testGetTemplate()
+    {
+        $template = $this->getMockBuilder('\Magento\Newsletter\Model\Template')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->queue->setTemplateId(2);
+        $this->templateFactory->expects($this->once())->method('create')->willReturn($template);
+        $template->expects($this->once())->method('load')->with(2)->willReturnSelf();
+
+        $this->assertEquals($template, $this->queue->getTemplate());
+    }
+
+    public function testGetStores()
+    {
+        $stores = ['store'];
+        $this->resource->expects($this->once())->method('getStores')->willReturn($stores);
+
+        $this->assertEquals($stores, $this->queue->getStores());
+    }
+}
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php
index bd8380299a52ee06f8d95a9ddea229ae2649160e..90d5c2ca0a4886deac1ab31f7acf72a004ace884 100644
--- a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php
@@ -100,7 +100,9 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase
             [
                 'loadByEmail',
                 'getIdFieldName',
-                'save'
+                'save',
+                'loadByCustomerData',
+                'received'
             ],
             [],
             '',
@@ -134,7 +136,6 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase
                 'name' => 'subscriber_name'
             ]
         );
-        $this->resource->expects($this->any())->method('getIdFieldName')->willReturn('id_field');
         $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true);
         $this->customerSession->expects($this->any())->method('isLoggedIn')->willReturn(true);
         $customerDataModel = $this->getMock('\Magento\Customer\Api\Data\CustomerInterface');
@@ -144,21 +145,193 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase
         $this->customerRepository->expects($this->any())->method('getById')->willReturn($customerDataModel);
         $customerDataModel->expects($this->any())->method('getStoreId')->willReturn(1);
         $customerDataModel->expects($this->any())->method('getId')->willReturn(1);
-        $this->transportBuilder->expects($this->any())->method('setTemplateIdentifier')->willReturnSelf();
-        $this->transportBuilder->expects($this->any())->method('setTemplateOptions')->willReturnSelf();
-        $this->transportBuilder->expects($this->any())->method('setTemplateVars')->willReturnSelf();
-        $this->transportBuilder->expects($this->any())->method('setFrom')->willReturnSelf();
-        $this->transportBuilder->expects($this->any())->method('addTo')->willReturnSelf();
-        $storeModel = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
-        $this->scopeConfig->expects($this->any())->method('getValue')->willReturn('owner_email@magento.com');
-        $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel);
-        $storeModel->expects($this->any())->method('getId')->willReturn(1);
-        $transport = $this->getMock('\Magento\Framework\Mail\TransportInterface');
-        $this->transportBuilder->expects($this->any())->method('getTransport')->willReturn($transport);
-        $transport->expects($this->any())->method('sendMessage')->willReturnSelf();
-        $inlineTranslation = $this->getMock('Magento\Framework\Translate\Inline\StateInterface');
-        $inlineTranslation->expects($this->any())->method('resume')->willReturnSelf();
+        $this->sendEmailCheck();
         $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
+
         $this->assertEquals(1, $this->subscriber->subscribe($email));
     }
+
+    public function testSubscribeNotLoggedIn()
+    {
+        $email = 'subscriber_email@magento.com';
+        $this->resource->expects($this->any())->method('loadByEmail')->willReturn(
+            [
+                'subscriber_status' => 3,
+                'subscriber_email' => $email,
+                'name' => 'subscriber_name'
+            ]
+        );
+        $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true);
+        $this->customerSession->expects($this->any())->method('isLoggedIn')->willReturn(false);
+        $customerDataModel = $this->getMock('\Magento\Customer\Api\Data\CustomerInterface');
+        $this->customerSession->expects($this->any())->method('getCustomerDataObject')->willReturn($customerDataModel);
+        $this->customerSession->expects($this->any())->method('getCustomerId')->willReturn(1);
+        $customerDataModel->expects($this->any())->method('getEmail')->willReturn($email);
+        $this->customerRepository->expects($this->any())->method('getById')->willReturn($customerDataModel);
+        $customerDataModel->expects($this->any())->method('getStoreId')->willReturn(1);
+        $customerDataModel->expects($this->any())->method('getId')->willReturn(1);
+        $this->sendEmailCheck();
+        $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
+
+        $this->assertEquals(2, $this->subscriber->subscribe($email));
+    }
+
+    public function testUpdateSubscription()
+    {
+        $customerId = 1;
+        $customerDataMock = $this->getMockBuilder('\Magento\Customer\Api\Data\CustomerInterface')
+            ->getMock();
+        $this->customerRepository->expects($this->atLeastOnce())
+            ->method('getById')
+            ->with($customerId)->willReturn($customerDataMock);
+        $this->resource->expects($this->atLeastOnce())
+            ->method('loadByCustomerData')
+            ->with($customerDataMock)
+            ->willReturn(
+                [
+                    'subscriber_id' => 1,
+                    'subscriber_status' => 1
+                ]
+            );
+        $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
+        $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
+        $this->customerAccountManagement->expects($this->once())
+            ->method('getConfirmationStatus')
+            ->with($customerId)
+            ->willReturn('account_confirmation_required');
+        $customerDataMock->expects($this->once())->method('getStoreId')->willReturn('store_id');
+        $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email');
+
+        $this->assertEquals($this->subscriber, $this->subscriber->updateSubscription($customerId));
+    }
+
+    public function testUnsubscribeCustomerById()
+    {
+        $customerId = 1;
+        $customerDataMock = $this->getMockBuilder('\Magento\Customer\Api\Data\CustomerInterface')
+            ->getMock();
+        $this->customerRepository->expects($this->atLeastOnce())
+            ->method('getById')
+            ->with($customerId)->willReturn($customerDataMock);
+        $this->resource->expects($this->atLeastOnce())
+            ->method('loadByCustomerData')
+            ->with($customerDataMock)
+            ->willReturn(
+                [
+                    'subscriber_id' => 1,
+                    'subscriber_status' => 1
+                ]
+            );
+        $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
+        $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
+        $customerDataMock->expects($this->once())->method('getStoreId')->willReturn('store_id');
+        $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email');
+        $this->sendEmailCheck();
+
+        $this->subscriber->unsubscribeCustomerById($customerId);
+    }
+
+    public function testSubscribeCustomerById()
+    {
+        $customerId = 1;
+        $customerDataMock = $this->getMockBuilder('\Magento\Customer\Api\Data\CustomerInterface')
+            ->getMock();
+        $this->customerRepository->expects($this->atLeastOnce())
+            ->method('getById')
+            ->with($customerId)->willReturn($customerDataMock);
+        $this->resource->expects($this->atLeastOnce())
+            ->method('loadByCustomerData')
+            ->with($customerDataMock)
+            ->willReturn(
+                [
+                    'subscriber_id' => 1,
+                    'subscriber_status' => 3
+                ]
+            );
+        $customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
+        $this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
+        $customerDataMock->expects($this->once())->method('getStoreId')->willReturn('store_id');
+        $customerDataMock->expects($this->once())->method('getEmail')->willReturn('email');
+        $this->sendEmailCheck();
+
+        $this->subscriber->subscribeCustomerById($customerId);
+    }
+
+    public function testUnsubscribe()
+    {
+        $this->resource->expects($this->once())->method('save')->willReturnSelf();
+        $this->sendEmailCheck();
+
+        $this->assertEquals($this->subscriber, $this->subscriber->unsubscribe());
+    }
+
+    /**
+     * @expectedException \Magento\Framework\Exception\LocalizedException
+     * @expectedExceptionMessage This is an invalid subscription confirmation code.
+     */
+    public function testUnsubscribeException()
+    {
+        $this->subscriber->setCode(111);
+        $this->subscriber->setCheckCode(222);
+
+        $this->subscriber->unsubscribe();
+    }
+
+    public function testGetSubscriberFullName()
+    {
+        $this->subscriber->setCustomerFirstname('John');
+        $this->subscriber->setCustomerLastname('Doe');
+
+        $this->assertEquals('John Doe', $this->subscriber->getSubscriberFullName());
+    }
+
+    public function testConfirm()
+    {
+        $code = 111;
+        $this->subscriber->setCode($code);
+        $this->resource->expects($this->once())->method('save')->willReturnSelf();
+
+        $this->assertTrue($this->subscriber->confirm($code));
+    }
+
+    public function testConfirmWrongCode()
+    {
+        $code = 111;
+        $this->subscriber->setCode(222);
+
+        $this->assertFalse($this->subscriber->confirm($code));
+    }
+
+    public function testReceived()
+    {
+        $queue = $this->getMockBuilder('\Magento\Newsletter\Model\Queue')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->resource->expects($this->once())->method('received')->with($this->subscriber, $queue)->willReturnSelf();
+
+        $this->assertEquals($this->subscriber, $this->subscriber->received($queue));
+    }
+
+    protected function sendEmailCheck()
+    {
+        $storeModel = $this->getMockBuilder('\Magento\Store\Model\Store')
+            ->disableOriginalConstructor()
+            ->setMethods(['getId'])
+            ->getMock();
+        $transport = $this->getMock('\Magento\Framework\Mail\TransportInterface');
+        $this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true);
+        $this->transportBuilder->expects($this->once())->method('setTemplateIdentifier')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('setTemplateOptions')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('setTemplateVars')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('setFrom')->willReturnSelf();
+        $this->transportBuilder->expects($this->once())->method('addTo')->willReturnSelf();
+        $this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel);
+        $storeModel->expects($this->any())->method('getId')->willReturn(1);
+        $this->transportBuilder->expects($this->once())->method('getTransport')->willReturn($transport);
+        $transport->expects($this->once())->method('sendMessage')->willReturnSelf();
+        $this->inlineTranslation->expects($this->once())->method('suspend')->willReturnSelf();
+        $this->inlineTranslation->expects($this->once())->method('resume')->willReturnSelf();
+
+        return $this;
+    }
 }
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php
index 1b599897715f903b48a95b6432f14c96a74f3f4f..0bbd428237b19edb86a68947a8964696d138baa9 100644
--- a/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/TemplateTest.php
@@ -65,8 +65,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
             ['_init'],
             [
                 $context,
-                $design,
                 $registry,
+                $design,
                 $appEmulation,
                 $storeManager,
                 $request,
diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php
index 63405dde14c7588458537f1d9ee4f47a5e38dc8b..82e5fd6abc996310802fd5871bbbff62cbcbfdab 100644
--- a/app/code/Magento/Review/Model/Review.php
+++ b/app/code/Magento/Review/Model/Review.php
@@ -6,6 +6,7 @@
 namespace Magento\Review\Model;
 
 use Magento\Catalog\Model\Product;
+use Magento\Framework\Object\IdentityInterface;
 use Magento\Review\Model\Resource\Review\Product\Collection as ProductCollection;
 use Magento\Review\Model\Resource\Review\Status\Collection as StatusCollection;
 
@@ -21,7 +22,7 @@ use Magento\Review\Model\Resource\Review\Status\Collection as StatusCollection;
  * @method \Magento\Review\Model\Review setStatusId(int $value)
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class Review extends \Magento\Framework\Model\AbstractModel
+class Review extends \Magento\Framework\Model\AbstractModel implements IdentityInterface
 {
     /**
      * Event prefix for observer
@@ -359,4 +360,18 @@ class Review extends \Magento\Framework\Model\AbstractModel
     {
         return $this->getResource()->getEntityIdByCode($entityCode);
     }
+
+    /**
+     * Return unique ID(s) for each object in system
+     *
+     * @return array
+     */
+    public function getIdentities()
+    {
+        $tags = [];
+        if ($this->isApproved() && $this->getEntityPkValue()) {
+            $tags[] = Product::CACHE_TAG . '_' . $this->getEntityPkValue();
+        }
+        return $tags;
+    }
 }
diff --git a/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php b/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php
index e96842c2cc28601dd771445269d924f42cd51d01..4be052abd03baebb2d5125ab1662c30f99acd5bc 100644
--- a/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php
+++ b/app/code/Magento/Review/Test/Unit/Model/ReviewTest.php
@@ -6,6 +6,7 @@
 
 namespace Magento\Review\Test\Unit\Model;
 
+use \Magento\Catalog\Model\Product;
 use \Magento\Review\Model\Review;
 
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
@@ -270,4 +271,15 @@ class ReviewTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($result));
         $this->assertSame($result, $this->review->getEntityIdByCode($entityCode));
     }
+
+    public function testGetIdentities()
+    {
+        $this->review->setStatusId(Review::STATUS_PENDING);
+        $this->assertEmpty($this->review->getIdentities());
+
+        $productId = 1;
+        $this->review->setEntityPkValue($productId);
+        $this->review->setStatusId(Review::STATUS_APPROVED);
+        $this->assertEquals([Product::CACHE_TAG . '_' . $productId], $this->review->getIdentities());
+    }
 }
diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml b/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml
index 3af29a203ff8ff030ae04b5fa2dc651de88f9a5b..0f950489f8aae9dc1c8c8405a6c1c7a5adbf076a 100644
--- a/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml
+++ b/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml
@@ -7,7 +7,7 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd">
     <container name="root">
-        <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="product/view/list.phtml"/>
+        <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="product/view/list.phtml" />
         <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar">
             <arguments>
                 <argument name="show_per_page" xsi:type="boolean">false</argument>
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php b/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php
index 37c29c2be223a85d35eb22fa196c757480c062ed..b4f0e627cebf03296c4ce22b62758b0a0e40cd9e 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php
@@ -38,20 +38,6 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
 
         $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
 
-        $objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface');
-        $objectManagerMock->expects($this->once())
-            ->method('get')
-            ->with('Magento\Email\Model\Resource\Template')
-            ->will($this->returnValue($objectManagerHelper->getObject('Magento\Email\Model\Resource\Template')));
-
-        try {
-            $this->objectManagerBackup = \Magento\Framework\App\ObjectManager::getInstance();
-        } catch (\RuntimeException $e) {
-            $this->objectManagerBackup = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER)
-                ->create($_SERVER);
-        }
-        \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
-
         $this->template = $objectManagerHelper->getObject(
             'Magento\Sales\Model\Email\Template',
             [
@@ -60,12 +46,6 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
         );
     }
 
-    protected function tearDown()
-    {
-        parent::tearDown();
-        \Magento\Framework\App\ObjectManager::setInstance($this->objectManagerBackup);
-    }
-
     public function testIncludeTemplate()
     {
         $this->mockViewFilesystem->expects($this->once())
diff --git a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php
index f8ef77f8e297b3bdf6a41c501c70adb40d31db99..0f49b8bef0ae3f56dfff91db4c9ae8cc25f371c4 100644
--- a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php
@@ -29,7 +29,12 @@ class StockItemTest extends WebapiAbstract
     /**
      * Resource path
      */
-    const RESOURCE_PATH = '/V1/stockItems';
+    const RESOURCE_GET_PATH = '/V1/stockItems';
+
+    /**
+     * Resource path
+     */
+    const RESOURCE_PUT_PATH = '/V1/products/:productSku/stockItems/:itemId';
 
     /** @var \Magento\Catalog\Model\Resource\Product\Collection */
     protected $productCollection;
@@ -73,7 +78,7 @@ class StockItemTest extends WebapiAbstract
         $productSku = 'simple1';
         $serviceInfo = [
             'rest' => [
-                'resourcePath' => self::RESOURCE_PATH . "/$productSku",
+                'resourcePath' => self::RESOURCE_GET_PATH . "/$productSku",
                 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
             ],
             'soap' => [
@@ -100,9 +105,13 @@ class StockItemTest extends WebapiAbstract
     {
         $stockItemOld = $this->getStockItemBySku($fixtureData);
         $productSku = 'simple1';
+        $itemId = $stockItemOld['item_id'];
+
+        $resourcePath = str_replace([':productSku', ':itemId'], [$productSku, $itemId], self::RESOURCE_PUT_PATH);
+
         $serviceInfo = [
             'rest' => [
-                'resourcePath' => self::RESOURCE_PATH . "/$productSku",
+                'resourcePath' => $resourcePath,
                 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
             ],
             'soap' => [
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php
index 6acd799855c98ff4bdfce79c329196a94919fea0..ca4260d5c037668987898fb26a647e0ee85aa113 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\CatalogInventory\Model\Stock;
 
+use Magento\Indexer\Model\Indexer\State;
+
 class ItemTest extends \PHPUnit_Framework_TestCase
 {
     /**
@@ -21,6 +23,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase
 
     /**
      * @magentoDataFixture Magento/Catalog/_files/products.php
+     * @magentoAppIsolation enabled
      */
     public function testSaveWithNullQty()
     {
@@ -31,11 +34,11 @@ class ItemTest extends \PHPUnit_Framework_TestCase
         $product->load(1);
 
         /** @var \Magento\CatalogInventory\Model\Stock\StockItemRepository $stockItemRepository */
-        $stockItemRepository = $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $stockItemRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\CatalogInventory\Model\Stock\StockItemRepository');
 
         /** @var \Magento\CatalogInventory\Api\StockItemCriteriaInterface $stockItemCriteria */
-        $stockItemCriteria = $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $stockItemCriteria = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\CatalogInventory\Api\StockItemCriteriaInterface');
 
         $savedStockItem = current($stockItemRepository->getList($stockItemCriteria)->getItems());
@@ -60,15 +63,49 @@ class ItemTest extends \PHPUnit_Framework_TestCase
 
     /**
      * @magentoDataFixture Magento/Catalog/_files/products.php
+     * @magentoAppIsolation enabled
+     */
+    public function testIndexerInvalidation()
+    {
+        /** @var \Magento\CatalogInventory\Model\Stock\StockItemRepository $stockItemRepository */
+        $stockItemRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\CatalogInventory\Model\Stock\StockItemRepository');
+
+        /** @var \Magento\CatalogInventory\Api\StockItemCriteriaInterface $stockItemCriteria */
+        $stockItemCriteria = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\CatalogInventory\Api\StockItemCriteriaInterface');
+        /** @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor $indexerProcessor */
+        $indexerProcessor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+            ->create('Magento\CatalogInventory\Model\Indexer\Stock\Processor');
+        $indexer = $indexerProcessor->getIndexer();
+        $indexer->setScheduled(true);
+        $indexer->getState()->setStatus(State::STATUS_VALID)->save();
+
+        /** @var \Magento\CatalogInventory\Api\Data\StockItemInterface $savedStockItem */
+        $savedStockItem = current($stockItemRepository->getList($stockItemCriteria)->getItems());
+        $savedStockItem->setQty(1);
+        $savedStockItem->setIsInStock(false);
+        $savedStockItem->save();
+
+
+        $this->assertEquals('invalid', $indexerProcessor->getIndexer()->getStatus());
+
+        $indexer->setScheduled(false);
+        $indexer->getState()->setStatus(State::STATUS_VALID)->save();
+    }
+
+    /**
+     * @magentoDataFixture Magento/Catalog/_files/products.php
+     * @magentoAppIsolation enabled
      */
     public function testStockStatusChangedAuto()
     {
         /** @var \Magento\CatalogInventory\Model\Stock\StockItemRepository $stockItemRepository */
-        $stockItemRepository = $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $stockItemRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\CatalogInventory\Model\Stock\StockItemRepository');
 
         /** @var \Magento\CatalogInventory\Api\StockItemCriteriaInterface $stockItemCriteria */
-        $stockItemCriteria = $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+        $stockItemCriteria = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
             ->create('Magento\CatalogInventory\Api\StockItemCriteriaInterface');
 
         $savedStockItem = current($stockItemRepository->getList($stockItemCriteria)->getItems());
diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
index 70d92a6e3a017440a5333f356da2216e9d9b9d64..16e47b8b867ebd5dd2cd757c33f465634b73b998 100755
--- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php
@@ -32,8 +32,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
         )->setConstructorArgs(
             [
                 $objectManager->get('Magento\Framework\Model\Context'),
-                $objectManager->get('Magento\Framework\View\DesignInterface'),
                 $objectManager->get('Magento\Framework\Registry'),
+                $objectManager->get('Magento\Framework\View\DesignInterface'),
                 $objectManager->get('Magento\Store\Model\App\Emulation'),
                 $objectManager->get('Magento\Store\Model\StoreManager'),
                 $objectManager->create('Magento\Framework\Filesystem'),