diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php
index 035a909cb3b38c09284c3a1a1fc61ed0c6085b75..c25dc3c944c44e280e759e62381b5ae21d5ca5af 100644
--- a/app/code/Magento/Backend/Block/Template/Context.php
+++ b/app/code/Magento/Backend/Block/Template/Context.php
@@ -67,6 +67,8 @@ class Context extends \Magento\Framework\View\Element\Template\Context
      * @param \Magento\Framework\App\State $appState
      * @param \Magento\Store\Model\StoreManagerInterface $storeManager
      * @param \Magento\Framework\View\Page\Config $pageConfig
+     * @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
+     * @param \Magento\Framework\View\Element\Template\File\Validator $validator
      * @param \Magento\Framework\AuthorizationInterface $authorization
      * @param \Magento\Backend\Model\Session $backendSession
      * @param \Magento\Framework\Math\Random $mathRandom
@@ -99,6 +101,8 @@ class Context extends \Magento\Framework\View\Element\Template\Context
         \Magento\Framework\App\State $appState,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Framework\View\Page\Config $pageConfig,
+        \Magento\Framework\View\Element\Template\File\Resolver $resolver,
+        \Magento\Framework\View\Element\Template\File\Validator $validator,
         \Magento\Framework\AuthorizationInterface $authorization,
         \Magento\Backend\Model\Session $backendSession,
         \Magento\Framework\Math\Random $mathRandom,
@@ -133,7 +137,9 @@ class Context extends \Magento\Framework\View\Element\Template\Context
             $enginePool,
             $appState,
             $storeManager,
-            $pageConfig
+            $pageConfig,
+            $resolver,
+            $validator
         );
     }
 
diff --git a/app/code/Magento/Backend/Block/Widget/Context.php b/app/code/Magento/Backend/Block/Widget/Context.php
index dacc0fe3379c57233c5bdaf4a2c456d4c5544853..83c3f1827877b4e1c8b179f68068e5362d7eefea 100644
--- a/app/code/Magento/Backend/Block/Widget/Context.php
+++ b/app/code/Magento/Backend/Block/Widget/Context.php
@@ -49,6 +49,9 @@ class Context extends \Magento\Backend\Block\Template\Context
      * @param \Magento\Framework\View\TemplateEnginePool $enginePool
      * @param \Magento\Framework\App\State $appState
      * @param \Magento\Store\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Framework\View\Page\Config $pageConfig
+     * @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
+     * @param \Magento\Framework\View\Element\Template\File\Validator $validator
      * @param \Magento\Framework\AuthorizationInterface $authorization
      * @param \Magento\Backend\Model\Session $backendSession
      * @param \Magento\Framework\Math\Random $mathRandom
@@ -56,7 +59,6 @@ class Context extends \Magento\Backend\Block\Template\Context
      * @param \Magento\Framework\Code\NameBuilder $nameBuilder
      * @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList
      * @param Button\ToolbarInterface $toolbar
-     * @param \Magento\Framework\View\Page\Config $pageConfig
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
@@ -84,6 +86,8 @@ class Context extends \Magento\Backend\Block\Template\Context
         \Magento\Framework\App\State $appState,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Framework\View\Page\Config $pageConfig,
+        \Magento\Framework\View\Element\Template\File\Resolver $resolver,
+        \Magento\Framework\View\Element\Template\File\Validator $validator,
         \Magento\Framework\AuthorizationInterface $authorization,
         \Magento\Backend\Model\Session $backendSession,
         \Magento\Framework\Math\Random $mathRandom,
@@ -116,6 +120,8 @@ class Context extends \Magento\Backend\Block\Template\Context
             $appState,
             $storeManager,
             $pageConfig,
+            $resolver,
+            $validator,
             $authorization,
             $backendSession,
             $mathRandom,
diff --git a/app/code/Magento/Catalog/Block/Product/Context.php b/app/code/Magento/Catalog/Block/Product/Context.php
index a0d38f5d3c28a751df57aa7e44dbbfcde69847c3..b707ad5848b054ccf20039530499a588365facf7 100644
--- a/app/code/Magento/Catalog/Block/Product/Context.php
+++ b/app/code/Magento/Catalog/Block/Product/Context.php
@@ -94,6 +94,9 @@ class Context extends \Magento\Framework\View\Element\Template\Context
      * @param \Magento\Framework\View\TemplateEnginePool $enginePool
      * @param \Magento\Framework\App\State $appState
      * @param \Magento\Store\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Framework\View\Page\Config $pageConfig
+     * @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
+     * @param \Magento\Framework\View\Element\Template\File\Validator $validator
      * @param \Magento\Catalog\Model\Config $catalogConfig
      * @param \Magento\Framework\Registry $registry
      * @param \Magento\Tax\Helper\Data $taxHelper
@@ -105,7 +108,6 @@ class Context extends \Magento\Framework\View\Element\Template\Context
      * @param \Magento\Catalog\Helper\Image $imageHelper
      * @param ReviewRendererInterface $reviewRenderer
      * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
-     * @param \Magento\Framework\View\Page\Config $pageConfig
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
@@ -133,6 +135,8 @@ class Context extends \Magento\Framework\View\Element\Template\Context
         \Magento\Framework\App\State $appState,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Framework\View\Page\Config $pageConfig,
+        \Magento\Framework\View\Element\Template\File\Resolver $resolver,
+        \Magento\Framework\View\Element\Template\File\Validator $validator,
         \Magento\Catalog\Model\Config $catalogConfig,
         \Magento\Framework\Registry $registry,
         \Magento\Tax\Helper\Data $taxHelper,
@@ -179,7 +183,9 @@ class Context extends \Magento\Framework\View\Element\Template\Context
             $enginePool,
             $appState,
             $storeManager,
-            $pageConfig
+            $pageConfig,
+            $resolver,
+            $validator
         );
     }
 
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php
index 7eac125efeaa9844f69f5def335f7eece0d5e7f6..ea19e1bee5c9874b40d0e484ff3d82157666961f 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php
@@ -15,6 +15,7 @@ class Actions extends Generic implements TabInterface
      * Prepare content for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabLabel()
     {
@@ -25,6 +26,7 @@ class Actions extends Generic implements TabInterface
      * Prepare title for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabTitle()
     {
@@ -35,6 +37,7 @@ class Actions extends Generic implements TabInterface
      * Returns status flag about this tab can be showen or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function canShowTab()
     {
@@ -45,6 +48,7 @@ class Actions extends Generic implements TabInterface
      * Returns status flag about this tab hidden or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function isHidden()
     {
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
index e52687c42cf0a92d72555376807378479b4cb05d..478a5556997cdd03d62195d3039ca35e3ae40f22 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
@@ -46,6 +46,7 @@ class Conditions extends Generic implements TabInterface
      * Prepare content for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabLabel()
     {
@@ -56,6 +57,7 @@ class Conditions extends Generic implements TabInterface
      * Prepare title for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabTitle()
     {
@@ -66,6 +68,7 @@ class Conditions extends Generic implements TabInterface
      * Returns status flag about this tab can be showen or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function canShowTab()
     {
@@ -76,6 +79,7 @@ class Conditions extends Generic implements TabInterface
      * Returns status flag about this tab hidden or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function isHidden()
     {
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
index 9b50207884c18ed1b9a124e751c4a485cf2c347b..c3da800a88d65759a74ea4414d4102a45a52a7d8 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php
@@ -68,6 +68,7 @@ class Main extends Generic implements TabInterface
      * Prepare content for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabLabel()
     {
@@ -78,6 +79,7 @@ class Main extends Generic implements TabInterface
      * Prepare title for tab
      *
      * @return \Magento\Framework\Phrase
+     * @codeCoverageIgnore
      */
     public function getTabTitle()
     {
@@ -88,6 +90,7 @@ class Main extends Generic implements TabInterface
      * Returns status flag about this tab can be showed or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function canShowTab()
     {
@@ -98,6 +101,7 @@ class Main extends Generic implements TabInterface
      * Returns status flag about this tab hidden or not
      *
      * @return bool
+     * @codeCoverageIgnore
      */
     public function isHidden()
     {
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
index f5c53227cf41c7587d110a9b50dab39aae37bd10..775d4ba8dfe6465c05a6a2a47d112a768197f709 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php
@@ -86,6 +86,7 @@ class Catalog extends Action
      *
      * @param string $dirtyRulesNoticeMessage
      * @return void
+     * @codeCoverageIgnore
      */
     public function setDirtyRulesNoticeMessage($dirtyRulesNoticeMessage)
     {
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
index dd32624a89912a5a3a8434f2975ed266bda2cb42..cef2b010b1d4070fe0cfc00db054890cb61a6033 100644
--- a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
@@ -60,6 +60,7 @@ abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInt
      * Get affected cache tags
      *
      * @return array
+     * @codeCoverageIgnore
      */
     public function getIdentities()
     {
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
index b20a93b2b6f15ee8904c2d8823b58fbd4ca1ef52..fe950295f0781e77ee525a65719883f19411dee2 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
@@ -135,6 +135,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource
      * Initialize main table and table id field
      *
      * @return void
+     * @codeCoverageIgnore
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Collection.php
index d23367451d26ce59315883d507e2cdb2c4fe8a1a..bda374dbafac623adce4a2c9bc7d122575ce9a98 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Collection.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Collection.php
@@ -24,6 +24,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo
      * Set resource model
      *
      * @return void
+     * @codeCoverageIgnore
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php
index 66f19d5c5234851cec5463701609323bfa382684..3f96fc0775c4bd0a4ec4b2b348520dce447b0bd1 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php
@@ -17,6 +17,7 @@ class Price extends \Magento\Framework\Model\Resource\Db\AbstractDb
      * Initialize connection and define main table
      *
      * @return void
+     * @codeCoverageIgnore
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php
index 8775a9b18f44a17d31493ef9ceb51d4d1237c00a..951b0e593c5407be37d0e356391c25256997750f 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php
@@ -9,6 +9,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
 {
     /**
      * @return void
+     * @codeCoverageIgnore
      */
     protected function _construct()
     {
diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php
index 84bfce2b0c8337189bcc4120e6a1b665b21dbb2c..1bdab229ba82a6d2b5aad2bbc72bf17fc46fa6ed 100644
--- a/app/code/Magento/CatalogRule/Model/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Rule.php
@@ -270,6 +270,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel
      *
      * @param string $now
      * @return void
+     * @codeCoverageIgnore
      */
     public function setNow($now)
     {
@@ -425,6 +426,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel
      *
      * @param  int|array $productIds
      * @return void
+     * @codeCoverageIgnore
      */
     public function setProductsFilter($productIds)
     {
@@ -435,6 +437,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel
      * Returns products filter
      *
      * @return array|int|null
+     * @codeCoverageIgnore
      */
     public function getProductsFilter()
     {
diff --git a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php
index 9fd408462cfc6a5918fa511605c160c3ad05c7fd..d671e0b864fb54e5ffc82f9a5d317debb6d73015 100755
--- a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php
@@ -90,11 +90,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
      */
     protected $appState;
 
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $viewFileSystem;
-
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
@@ -130,6 +125,16 @@ class FormTest extends \PHPUnit_Framework_TestCase
      */
     protected $block;
 
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Resolver|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_resolver;
+
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Validator|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_validator;
+
     /**
      * Sets up the fixture, for example, open a network connection.
      * This method is called before a test is executed.
@@ -138,6 +143,22 @@ class FormTest extends \PHPUnit_Framework_TestCase
      */
     public function setUp()
     {
+        $this->_resolver = $this->getMock(
+            'Magento\Framework\View\Element\Template\File\Resolver',
+            [],
+            [],
+            '',
+            false
+        );
+
+        $this->_validator = $this->getMock(
+            'Magento\Framework\View\Element\Template\File\Validator',
+            [],
+            [],
+            '',
+            false
+        );
+
         $this->model = $this->getMock('Magento\Cms\Model\Block', ['getBlockId', 'setStoreId'], [], '', false);
 
         $this->registry = $this->getMock('Magento\Framework\Registry', [], [], '', false);
@@ -158,7 +179,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
         $this->scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface', [], [], '', false);
         $this->urlBuilder = $this->getMock('Magento\Framework\UrlInterface', [], [], '', false);
         $this->appState = $this->getMock('Magento\Framework\App\State', [], [], '', false);
-        $this->viewFileSystem = $this->getMock('Magento\Framework\View\FileSystem', [], [], '', false);
         $this->logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false);
         $this->rootDirectory = $this->getMock(
             'Magento\Framework\Filesystem\Directory\ReadInterface',
@@ -193,10 +213,11 @@ class FormTest extends \PHPUnit_Framework_TestCase
         $this->context->expects($this->once())->method('getStoreManager')->willReturn($this->storeManager);
         $this->context->expects($this->once())->method('getUrlBuilder')->willReturn($this->urlBuilder);
         $this->context->expects($this->once())->method('getAppState')->willReturn($this->appState);
-        $this->context->expects($this->once())->method('getViewFileSystem')->willReturn($this->viewFileSystem);
         $this->context->expects($this->once())->method('getFilesystem')->willReturn($this->fileSystem);
         $this->context->expects($this->once())->method('getLogger')->willReturn($this->logger);
         $this->context->expects($this->once())->method('getLayout')->willReturn($this->layout);
+        $this->context->expects($this->once())->method('getResolver')->willReturn($this->_resolver);
+        $this->context->expects($this->once())->method('getValidator')->willReturn($this->_validator);
 
         /** @var \Magento\Cms\Block\Adminhtml\Block\Edit\Form $block */
         $this->block = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
index 5f381f0ddad0979e3efa4e6585a8ef09eedb7dd1..9f99ffd9339462f5692d169df9e2aeea0601f837 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php
@@ -204,7 +204,7 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended
      */
     public function getGridParentHtml()
     {
-        $templateName = $this->_viewFileSystem->getTemplateFileName($this->_parentTemplate, ['_relative' => true]);
+        $templateName = $this->resolver->getTemplateFileName($this->_parentTemplate, ['_relative' => true]);
         return $this->fetchView($templateName);
     }
 
diff --git a/app/code/Magento/PageCache/Model/Observer/ProcessLayoutRenderElement.php b/app/code/Magento/PageCache/Model/Observer/ProcessLayoutRenderElement.php
index c95ad9995ef88ff4943fb0dbd5e0c3673776857b..ea4d21869bda7c09e933ded3f741ff297808f0d2 100644
--- a/app/code/Magento/PageCache/Model/Observer/ProcessLayoutRenderElement.php
+++ b/app/code/Magento/PageCache/Model/Observer/ProcessLayoutRenderElement.php
@@ -16,6 +16,22 @@ class ProcessLayoutRenderElement
     protected $_config;
 
     /**
+     * Is varnish enabled flag
+     *
+     * @var bool
+     */
+    protected $isVarnishEnabled;
+
+    /**
+     * Is full page cache enabled flag
+     *
+     * @var bool
+     */
+    protected $isFullPageCacheEnabled;
+
+    /**
+     * Class constructor
+     *
      * @param \Magento\PageCache\Model\Config $config
      */
     public function __construct(\Magento\PageCache\Model\Config $config)
@@ -44,6 +60,32 @@ class ProcessLayoutRenderElement
         return sprintf('<esi:include src="%s" />', $url);
     }
 
+    /**
+     * Is full page cache enabled
+     *
+     * @return bool
+     */
+    protected function isFullPageCacheEnabled()
+    {
+        if ($this->isFullPageCacheEnabled === null) {
+            $this->isFullPageCacheEnabled = $this->_config->isEnabled();
+        }
+        return $this->isFullPageCacheEnabled;
+    }
+
+    /**
+     * Is varnish cache engine enabled
+     *
+     * @return bool
+     */
+    protected function isVarnishEnabled()
+    {
+        if ($this->isVarnishEnabled === null) {
+            $this->isVarnishEnabled = ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH);
+        }
+        return $this->isVarnishEnabled;
+    }
+
     /**
      * Add comment cache containers to private blocks
      * Blocks are wrapped only if page is cacheable
@@ -56,15 +98,15 @@ class ProcessLayoutRenderElement
         $event = $observer->getEvent();
         /** @var \Magento\Framework\View\Layout $layout */
         $layout = $event->getLayout();
-        if ($layout->isCacheable() && $this->_config->isEnabled()) {
+        if ($this->isFullPageCacheEnabled() && $layout->isCacheable()) {
             $name = $event->getElementName();
+            /** @var \Magento\Framework\View\Element\AbstractBlock $block */
             $block = $layout->getBlock($name);
             $transport = $event->getTransport();
             if ($block instanceof \Magento\Framework\View\Element\AbstractBlock) {
                 $blockTtl = $block->getTtl();
-                $varnishIsEnabledFlag = ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH);
                 $output = $transport->getData('output');
-                if ($varnishIsEnabledFlag && isset($blockTtl)) {
+                if (isset($blockTtl) && $this->isVarnishEnabled()) {
                     $output = $this->_wrapEsi($block, $layout);
                 } elseif ($block->isScopePrivate()) {
                     $output = sprintf(
diff --git a/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php b/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php
index 370edc3a369e53f2f49de43de5e26a367fb3bd7c..1601b85f477494d942138fae8a8cbbcf8cc35c54 100644
--- a/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php
+++ b/app/code/Magento/PageCache/Test/Unit/Model/Observer/ProcessLayoutRenderElementTest.php
@@ -99,19 +99,29 @@ class ProcessLayoutRenderElementTest extends \PHPUnit_Framework_TestCase
         $this->_configMock->expects($this->any())->method('isEnabled')->will($this->returnValue($cacheState));
 
         if ($cacheState) {
-            $eventMock->expects($this->once())->method('getElementName')->will($this->returnValue('blockName'));
-            $eventMock->expects($this->once())->method('getTransport')->will($this->returnValue($this->_transport));
-            $this->_layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true));
-
-            $this->_layoutMock->expects($this->any())->method('getUpdate')->will($this->returnSelf());
-            $this->_layoutMock->expects($this->any())->method('getHandles')->will($this->returnValue([]));
-            $this->_layoutMock->expects(
-                $this->once()
-            )->method(
-                    'getBlock'
-                )->will(
-                    $this->returnValue($this->_blockMock)
-                );
+            $eventMock->expects($this->once())
+                ->method('getElementName')
+                ->will($this->returnValue('blockName'));
+
+            $eventMock->expects($this->once())
+                ->method('getTransport')
+                ->will($this->returnValue($this->_transport));
+
+            $this->_layoutMock->expects($this->once())
+                ->method('isCacheable')
+                ->will($this->returnValue(true));
+
+            $this->_layoutMock->expects($this->any())
+                ->method('getUpdate')
+                ->will($this->returnSelf());
+
+            $this->_layoutMock->expects($this->any())
+                ->method('getHandles')
+                ->will($this->returnValue([]));
+            
+            $this->_layoutMock->expects($this->once())
+                ->method('getBlock')
+                ->will($this->returnValue($this->_blockMock));
 
             if ($varnishIsEnabled) {
                 $this->_blockMock->expects($this->once())
@@ -123,20 +133,12 @@ class ProcessLayoutRenderElementTest extends \PHPUnit_Framework_TestCase
                     ->will($this->returnValue('page_cache/block/wrapesi/with/handles/and/other/stuff'));
             }
             if ($scopeIsPrivate) {
-                $this->_blockMock->expects(
-                    $this->once()
-                )->method(
-                        'getNameInLayout'
-                    )->will(
-                        $this->returnValue('testBlockName')
-                    );
-                $this->_blockMock->expects(
-                    $this->once()
-                )->method(
-                        'isScopePrivate'
-                    )->will(
-                        $this->returnValue($scopeIsPrivate)
-                    );
+                $this->_blockMock->expects($this->once())
+                    ->method('getNameInLayout')
+                    ->will($this->returnValue('testBlockName'));
+                $this->_blockMock->expects($this->once())
+                    ->method('isScopePrivate')
+                    ->will($this->returnValue($scopeIsPrivate));
             }
             $this->_configMock->expects($this->any())->method('getType')->will($this->returnValue($varnishIsEnabled));
         }
diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php
index 30b6fccb13435e396ce06d6383768b301f0f399c..8b325bb2a0ad1b0a5695bf54864496effbed60ba 100644
--- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php
+++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php
@@ -37,31 +37,20 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date
     {
         $format = $this->getColumn()->getFormat();
         if (!$format) {
-            if (self::$_format === null) {
-                try {
-                    $formats = (new DataBundle())->get(
-                        $this->_localeResolver->getLocale()
-                    )['calendar']['gregorian']['availableFormats'];
-
-                    switch ($this->getColumn()->getPeriodType()) {
-                        case 'month':
-                            self::$_format = $formats['yM'];
-                            break;
-
-                        case 'year':
-                            self::$_format = $formats['y'];
-                            break;
-
-                        default:
-                            self::$_format = $this->_localeDate->getDateFormat(
-                                \IntlDateFormatter::MEDIUM
-                            );
-                            break;
-                    }
-                } catch (\Exception $e) {
-                }
+            $dataBundle = new DataBundle();
+            $resourceBundle = $dataBundle->get($this->_localeResolver->getLocale());
+            $formats = $resourceBundle['calendar']['gregorian']['availableFormats'];
+            switch ($this->getColumn()->getPeriodType()) {
+                case 'month':
+                    $format = $formats['yM'];
+                    break;
+                case 'year':
+                    $format = $formats['y'];
+                    break;
+                default:
+                    $format = $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM);
+                    break;
             }
-            $format = self::$_format;
         }
         return $format;
     }
@@ -74,51 +63,22 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date
      */
     public function render(\Magento\Framework\Object $row)
     {
-        //@todo: check this logic manually
         if ($data = $row->getData($this->getColumn()->getIndex())) {
             switch ($this->getColumn()->getPeriodType()) {
                 case 'month':
-                    $dateFormat = 'yyyy-MM';
+                    $data = $data . '-01';
                     break;
                 case 'year':
-                    $dateFormat = 'yyyy';
-                    break;
-                default:
-                    $dateFormat = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
+                    $data = $data . '-01-01';
                     break;
             }
-
             $format = $this->_getFormat();
-            try {
-                $data = $this->getColumn()->getGmtoffset()
-                    ? \IntlDateFormatter::formatObject(
-                        $this->_localeDate->date(new \DateTime($data)),
-                        $format
-                    )
-                    : \IntlDateFormatter::formatObject(
-                        $this->_localeDate->date(
-                            new \DateTime($data),
-                            null,
-                            false
-                        ),
-                        $format
-                    );
-            } catch (\Exception $e) {
-                $data = $this->getColumn()->getTimezone()
-                    ? \IntlDateFormatter::formatObject(
-                        $this->_localeDate->date(new \DateTime($data)),
-                        $format
-                    )
-                    : \IntlDateFormatter::formatObject(
-                        $this->_localeDate->date(
-                            new \DateTime($data),
-                            null,
-                            false
-                        ),
-                        $format
-                    );
+            if ($this->getColumn()->getGmtoffset() || $this->getColumn()->getTimezone()) {
+                $date = $this->_localeDate->date(new \DateTime($data));
+            } else {
+                $date = $this->_localeDate->date(new \DateTime($data), null, false);
             }
-            return $data;
+            return \IntlDateFormatter::formatObject($date, $format);
         }
         return $this->getColumn()->getDefault();
     }
diff --git a/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6252d53d0382924f42e5af294791de18e333c88a
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Sales/Grid/Column/Renderer/DateTest.php
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Block\Adminhtml\Sales\Grid\Column\Renderer;
+
+use Magento\Reports\Block\Adminhtml\Sales\Grid\Column\Renderer\Date;
+
+class DateTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Reports\Block\Adminhtml\Sales\Grid\Column\Renderer\Date
+     */
+    protected $date;
+
+    /**
+     * @var \Magento\Backend\Block\Context|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $contextMock;
+
+    /**
+     * @var \Magento\Framework\Locale\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resolverMock;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $localeDate;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        $this->localeDate = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\TimezoneInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->localeDate
+            ->expects($this->once())
+            ->method('date')
+            ->will($this->returnArgument(0));
+
+        $this->contextMock = $this->getMockBuilder('Magento\Backend\Block\Context')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->contextMock
+            ->expects($this->once())
+            ->method('getLocaleDate')
+            ->will($this->returnValue($this->localeDate));
+
+        $this->resolverMock = $this->getMockBuilder('Magento\Framework\Locale\ResolverInterface')
+            ->getMock();
+
+        $this->date = new Date(
+            $this->contextMock,
+            $this->resolverMock
+        );
+    }
+
+    /**
+     * @param string $data
+     * @param string $index
+     * @param string $locale
+     * @param string $period
+     * @param string $result
+     * @dataProvider datesDataProvider
+     * @return void
+     */
+    public function testRender($data, $index, $locale, $period, $result)
+    {
+        $this->resolverMock->expects($this->any())->method('getLocale')->will($this->returnValue($locale));
+        $this->localeDate->expects($this->any())->method('getDateFormat')->willReturnCallback(
+            function ($value) use ($locale) {
+                return (new \IntlDateFormatter(
+                    $locale,
+                    $value,
+                    \IntlDateFormatter::NONE
+                ))->getPattern();
+            }
+        );
+
+        $objectMock = $this->getMockBuilder('Magento\Framework\Object')
+            ->setMethods(['getData'])
+            ->getMock();
+        $objectMock->expects($this->once())->method('getData')->will($this->returnValue($data));
+
+        $columnMock = $this->getMockBuilder('Magento\Backend\Block\Widget\Grid\Column')
+            ->disableOriginalConstructor()
+            ->setMethods(['getIndex', 'getPeriodType'])
+            ->getMock();
+        $columnMock->expects($this->once())->method('getIndex')->will($this->returnValue($index));
+        $columnMock->expects($this->atLeastOnce())->method('getPeriodType')->will($this->returnValue($period));
+
+        $this->date->setColumn($columnMock);
+
+        $this->assertEquals($result, $this->date->render($objectMock));
+    }
+
+    /**
+     * @return array
+     */
+    public function datesDataProvider()
+    {
+        return [
+            [
+                'data' => '2000',
+                'index' => 'period',
+                'locale' => 'en_US',
+                'period' => 'year',
+                'result' => '2000'
+            ],
+            [
+                'data' => '2030',
+                'index' => 'period',
+                'locale' => 'en_US',
+                'period' => 'year',
+                'result' => '2030'
+            ],
+            [
+                'data' => '2000-01',
+                'index' => 'period',
+                'locale' => 'en_US',
+                'period' => 'month',
+                'result' => '1/2000'
+            ],
+            [
+                'data' => '2030-12',
+                'index' => 'period',
+                'locale' => 'en_US',
+                'period' => 'month',
+                'result' => '12/2030'
+            ],
+            [
+                'data' => '2014-06-25',
+                'index' => 'period',
+                'locale' => 'en_US',
+                'period' => 'day',
+                'result' => 'Jun 25, 2014'
+            ]
+        ];
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/AbstractControllerTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/AbstractControllerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..a15c7a139132cb978a52ca934612c946427bb8aa
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/AbstractControllerTest.php
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report;
+
+/**
+ * @SuppressWarnings(PHPMD.NumberOfChildren)
+ */
+abstract class AbstractControllerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $contextMock;
+
+    /**
+     * @var \Magento\Framework\App\Response\Http\FileFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $fileFactoryMock;
+
+    /**
+     * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $requestMock;
+
+    /**
+     * @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $viewMock;
+
+    /**
+     * @var \Magento\Framework\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $layoutMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\BlockInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $breadcrumbsBlockMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\BlockInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $menuBlockMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\BlockInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $switcherBlockMock;
+
+    /**
+     * @var \Magento\Backend\Model\Menu|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $menuModelMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\AbstractBlock|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $abstractBlockMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        $this->requestMock = $this->getMockForAbstractClassBuilder(
+            'Magento\Framework\App\RequestInterface',
+            ['isDispatched', 'initForward', 'setDispatched', 'isForwarded']
+        );
+        $this->breadcrumbsBlockMock = $this->getMockForAbstractClassBuilder(
+            'Magento\Framework\View\Element\BlockInterface',
+            ['addLink']
+        );
+        $this->menuBlockMock = $this->getMockForAbstractClassBuilder(
+            'Magento\Framework\View\Element\BlockInterface',
+            ['setActive', 'getMenuModel']
+        );
+        $this->viewMock = $this->getMockForAbstractClassBuilder(
+            'Magento\Framework\App\ViewInterface'
+        );
+
+        $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->switcherBlockMock = $this->getMockBuilder('Magento\Framework\View\Element\BlockInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->contextMock = $this->getMockBuilder('Magento\Backend\App\Action\Context')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->fileFactoryMock = $this->getMockBuilder('Magento\Framework\App\Response\Http\FileFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->menuModelMock = $this->getMockBuilder('Magento\Backend\Model\Menu')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->abstractBlockMock = $this->getMockBuilder('Magento\Framework\View\Element\AbstractBlock')
+            ->setMethods(['getCsvFile', 'getExcelFile', 'setSaveParametersInSession', 'getCsv', 'getExcel'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->menuModelMock->expects($this->any())->method('getParentItems')->willReturn([]);
+        $this->menuBlockMock->expects($this->any())->method('getMenuModel')->willReturn($this->menuModelMock);
+        $this->viewMock->expects($this->any())->method('getLayout')->willReturn($this->layoutMock);
+        $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
+        $this->contextMock->expects($this->any())->method('getView')->willReturn($this->viewMock);
+
+        $this->layoutMock->expects($this->any())->method('getBlock')->will(
+            $this->returnValueMap(
+                [
+                    ['breadcrumbs', $this->breadcrumbsBlockMock],
+                    ['menu', $this->menuBlockMock],
+                    ['store_switcher', $this->switcherBlockMock]
+                ]
+            )
+        );
+        $this->layoutMock->expects($this->any())->method('getChildBlock')->willReturn($this->abstractBlockMock);
+    }
+
+    /**
+     * Custom mock for abstract class
+     * @param string $className
+     * @param array $mockedMethods
+     * @return \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected function getMockForAbstractClassBuilder($className, $mockedMethods = [])
+    {
+        return $this->getMockForAbstractClass($className, [], '', false, false, true, $mockedMethods);
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..c6267c7192f74a912a2ba6be23c7b5e3108fe473
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/AccountsTest.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\Accounts;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class AccountsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\Accounts
+     */
+    protected $accounts;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->accounts = new Accounts(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('New Accounts Report'));
+
+        $this->viewMock
+            ->expects($this->any())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_customers_accounts');
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(0))
+            ->method('addLink')
+            ->with(new Phrase('Reports'), new Phrase('Reports'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(1))
+            ->method('addLink')
+            ->with(new Phrase('Customers'), new Phrase('Customers'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(2))
+            ->method('addLink')
+            ->with(new Phrase('New Accounts'), new Phrase('New Accounts'));
+        $this->accounts->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..c5e9ccccf6d933966c1802fe34a2c0fdf2c6c885
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsCsvTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportAccountsCsv;
+
+class ExportAccountsCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportAccountsCsv
+     */
+    protected $exportAccountsCsv;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportAccountsCsv = new ExportAccountsCsv(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('new_accounts.csv', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportAccountsCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..98134d20ccd9edc52fa27958a60c437657c1756c
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportAccountsExcelTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportAccountsExcel;
+
+class ExportAccountsExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportAccountsExcel
+     */
+    protected $exportAccountsExcel;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportAccountsExcel = new ExportAccountsExcel(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('new_accounts.xml', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportAccountsExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..573720a1859cd759ca99ba03f9ec0b93252904f4
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersCsvTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportOrdersCsv;
+
+class ExportOrdersCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportOrdersCsv
+     */
+    protected $exportOrdersCsv;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportOrdersCsv = new ExportOrdersCsv(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('customers_orders.csv', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportOrdersCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..b8273becb2d66d0a3636e6514a37f77c599e87d9
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersExcelTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportOrdersExcel;
+
+class ExportOrdersExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportOrdersExcel
+     */
+    protected $exportOrdersExcel;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportOrdersExcel = new ExportOrdersExcel(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('customers_orders.xml', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportOrdersExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..b4a7a0c68e2d2872f7e04a4a655eb614c5d72893
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsCsvTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportTotalsCsv;
+
+class ExportTotalsCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportTotalsCsv
+     */
+    protected $exportTotalsCsv;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportTotalsCsv = new ExportTotalsCsv(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('customer_totals.csv', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportTotalsCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..33177c27a183fbd6aa03e6e8f208190dc43a433d
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportTotalsExcelTest.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\ExportTotalsExcel;
+
+class ExportTotalsExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\ExportTotalsExcel
+     */
+    protected $exportTotalsExcel;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->exportTotalsExcel = new ExportTotalsExcel(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->willReturn(['export']);
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export');
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('customer_totals.xml', ['export'], \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+        $this->exportTotalsExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..9e58897f7458dc46882a9e5b1aa5288e71f60748
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/OrdersTest.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\Orders;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class OrdersTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\Orders
+     */
+    protected $orders;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->orders = new Orders(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Order Count Report'));
+
+        $this->viewMock
+            ->expects($this->any())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_customers_orders');
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(0))
+            ->method('addLink')
+            ->with(new Phrase('Reports'), new Phrase('Reports'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(1))
+            ->method('addLink')
+            ->with(new Phrase('Customers'), new Phrase('Customers'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(2))
+            ->method('addLink')
+            ->with(new Phrase('Customers by Number of Orders'), new Phrase('Customers by Number of Orders'));
+        $this->orders->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..bf63f966292f16cd203897e72f8abb7b672593f6
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Customer/TotalsTest.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Customer;
+
+use Magento\Reports\Controller\Adminhtml\Report\Customer\Totals;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class TotalsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Customer\Totals
+     */
+    protected $totals;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->totals = new Totals(
+            $this->contextMock,
+            $this->fileFactoryMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Order Total Report'));
+
+        $this->viewMock
+            ->expects($this->any())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_customers_totals');
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(0))
+            ->method('addLink')
+            ->with(new Phrase('Reports'), new Phrase('Reports'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(1))
+            ->method('addLink')
+            ->with(new Phrase('Customers'), new Phrase('Customers'));
+        $this->breadcrumbsBlockMock
+            ->expects($this->at(2))
+            ->method('addLink')
+            ->with(new Phrase('Customers by Orders Total'), new Phrase('Customers by Orders Total'));
+        $this->totals->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..e7e1ada266c5a9545c4b965a12c8604c0d446257
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/DownloadsTest.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\Downloads;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class DownloadsTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\Downloads
+     */
+    protected $downloads;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->downloads = new Downloads(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Downloads Report'));
+
+        $this->viewMock
+            ->expects($this->once())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Downloadable::report_products_downloads');
+
+        $this->breadcrumbsBlockMock
+            ->expects($this->exactly(3))
+            ->method('addLink')
+            ->withConsecutive(
+                [new Phrase('Reports'), new Phrase('Reports')],
+                [new Phrase('Products'), new Phrase('Products')],
+                [new Phrase('Downloads'), new Phrase('Downloads')]
+            );
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('createBlock')
+            ->with('Magento\Reports\Block\Adminhtml\Product\Downloads')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->downloads->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6d693599b8f92dd48c21f8be673ff7a5efc16001
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsCsvTest.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportDownloadsCsv;
+
+class ExportDownloadsCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportDownloadsCsv
+     */
+    protected $exportDownloadsCsv;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportDownloadsCsv = new ExportDownloadsCsv(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('setSaveParametersInSession')
+            ->willReturnSelf();
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsv')
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('createBlock')
+            ->with('Magento\Reports\Block\Adminhtml\Product\Downloads\Grid')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('products_downloads.csv', $content);
+
+        $this->exportDownloadsCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..9b10f29b369590a8e2d154bb59abb2007fe34aa7
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportDownloadsExcelTest.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportDownloadsExcel;
+
+class ExportDownloadsExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportDownloadsExcel
+     */
+    protected $exportDownloadsExcel;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportDownloadsExcel = new ExportDownloadsExcel(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+        $fileName = 'products_downloads.xml';
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('setSaveParametersInSession')
+            ->willReturnSelf();
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcel')
+            ->with($fileName)
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('createBlock')
+            ->with('Magento\Reports\Block\Adminhtml\Product\Downloads\Grid')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with($fileName, $content);
+
+        $this->exportDownloadsExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..010a123afc7e3e61d5ac8c541f0292bd94dd7cdf
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockCsvTest.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockCsv;
+
+class ExportLowstockCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockCsv
+     */
+    protected $exportLowstockCsv;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportLowstockCsv = new ExportLowstockCsv(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.block.report.product.lowstock.grid', 'grid.export')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('products_lowstock.csv', $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportLowstockCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..257b08e7bcbf44e47b5a855985482908b593af1d
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportLowstockExcelTest.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockExcel;
+
+class ExportLowstockExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportLowstockExcel
+     */
+    protected $exportLowstockExcel;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportLowstockExcel = new ExportLowstockExcel(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.block.report.product.lowstock.grid', 'grid.export')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('products_lowstock.xml', $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportLowstockExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..54d5303ad317e706fa733fe13c7208a8d09d6a7d
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldCsvTest.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportSoldCsv;
+
+class ExportSoldCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportSoldCsv
+     */
+    protected $exportSoldCsv;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportSoldCsv = new ExportSoldCsv(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with('products_ordered.csv', $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportSoldCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..cec703d778b347b536444ac4dafa1fa1937feb4f
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportSoldExcelTest.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportSoldExcel;
+
+class ExportSoldExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportSoldExcel
+     */
+    protected $exportSoldExcel;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->exportSoldExcel = new ExportSoldExcel(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+        $fileName = 'products_ordered.xml';
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->with($fileName)
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('getChildBlock')
+            ->with('adminhtml.report.grid', 'grid.export')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with($fileName, $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportSoldExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedCsvTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedCsvTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..d1e4cafbf627af407b1470049d4b81a76c510009
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedCsvTest.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportViewedCsv;
+
+class ExportViewedCsvTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportViewedCsv
+     */
+    protected $exportViewedCsv;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $objectManagerMock;
+
+    /**
+     * @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $helperMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->helperMock = $this->getMockBuilder('Magento\Backend\Helper\Data')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->objectManagerMock
+            ->expects($this->any())
+            ->method('get')
+            ->willReturn($this->helperMock);
+
+        $this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
+
+        $this->exportViewedCsv = new ExportViewedCsv(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+        $fileName = 'products_mostviewed.csv';
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getCsvFile')
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('createBlock')
+            ->with('Magento\Reports\Block\Adminhtml\Product\Viewed\Grid')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with($fileName, $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportViewedCsv->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedExcelTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedExcelTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..93c68d3ff695049a73d6f7df11a93d2c6ce2092f
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ExportViewedExcelTest.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\ExportViewedExcel;
+
+class ExportViewedExcelTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\ExportViewedExcel
+     */
+    protected $exportViewedExcel;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $objectManagerMock;
+
+    /**
+     * @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $helperMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->helperMock = $this->getMockBuilder('Magento\Backend\Helper\Data')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->objectManagerMock
+            ->expects($this->any())
+            ->method('get')
+            ->willReturn($this->helperMock);
+
+        $this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
+
+        $this->exportViewedExcel = new ExportViewedExcel(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $content = ['export'];
+        $fileName = 'products_mostviewed.xml';
+
+        $this->abstractBlockMock
+            ->expects($this->once())
+            ->method('getExcelFile')
+            ->with($fileName)
+            ->willReturn($content);
+
+        $this->layoutMock
+            ->expects($this->once())
+            ->method('createBlock')
+            ->with('Magento\Reports\Block\Adminhtml\Product\Viewed\Grid')
+            ->willReturn($this->abstractBlockMock);
+
+        $this->fileFactoryMock
+            ->expects($this->once())
+            ->method('create')
+            ->with($fileName, $content, \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR);
+
+        $this->exportViewedExcel->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6120128d828fb902d8a10c9cc5956dd14d67e33d
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/LowstockTest.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\Lowstock;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class LowstockTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\Lowstock
+     */
+    protected $lowstock;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->lowstock = new Lowstock(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Low Stock Report'));
+
+        $this->viewMock
+            ->expects($this->once())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_products_lowstock');
+
+        $this->breadcrumbsBlockMock
+            ->expects($this->exactly(3))
+            ->method('addLink')
+            ->withConsecutive(
+                [new Phrase('Reports'), new Phrase('Reports')],
+                [new Phrase('Products'), new Phrase('Products')],
+                [new Phrase('Low Stock'), new Phrase('Low Stock')]
+            );
+
+        $this->lowstock->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b1b27e748e88f47ade203433a846b7360566c4b
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/SoldTest.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\Sold;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class SoldTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\Sold
+     */
+    protected $sold;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->sold = new Sold(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Ordered Products Report'));
+
+        $this->viewMock
+            ->expects($this->once())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_products_sold');
+
+        $this->breadcrumbsBlockMock
+            ->expects($this->exactly(3))
+            ->method('addLink')
+            ->withConsecutive(
+                [new Phrase('Reports'), new Phrase('Reports')],
+                [new Phrase('Products'), new Phrase('Products')],
+                [new Phrase('Products Ordered'), new Phrase('Products Ordered')]
+            );
+
+        $this->sold->execute();
+    }
+}
diff --git a/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0d87c428b3933a214d1d16fb68058e37007a5728
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Unit/Controller/Adminhtml/Report/Product/ViewedTest.php
@@ -0,0 +1,223 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Reports\Test\Unit\Controller\Adminhtml\Report\Product;
+
+use Magento\Reports\Controller\Adminhtml\Report\Product\Viewed;
+use Magento\Framework\Object;
+use Magento\Framework\Phrase;
+
+class ViewedTest extends \Magento\Reports\Test\Unit\Controller\Adminhtml\Report\AbstractControllerTest
+{
+    /**
+     * @var \Magento\Reports\Controller\Adminhtml\Report\Product\Viewed
+     */
+    protected $viewed;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $dateMock;
+
+    /**
+     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $objectManagerMock;
+
+    /**
+     * @var \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $helperMock;
+
+    /**
+     * @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $messageManagerMock;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Filter\Date')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $flagMock = $this->getMockBuilder('Magento\Reports\Model\Flag')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $flagMock
+            ->expects($this->any())
+            ->method('setReportFlagCode')
+            ->willReturnSelf();
+        $flagMock
+            ->expects($this->any())
+            ->method('loadSelf')
+            ->willReturnSelf();
+
+        $this->helperMock = $this->getMockBuilder('Magento\Backend\Helper\Data')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->objectManagerMock
+            ->expects($this->any())
+            ->method('create')
+            ->with('Magento\Reports\Model\Flag')
+            ->willReturn($flagMock);
+
+        $this->messageManagerMock = $this->getMockBuilder('Magento\Framework\Message\ManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $flagMock = $this->getMockBuilder('Magento\Framework\App\ActionFlag')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $responseMock = $this->getMockBuilder('Magento\Framework\App\ResponseInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(['setRedirect', 'sendResponse'])
+            ->getMock();
+
+        $this->contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
+        $this->contextMock->expects($this->any())->method('getHelper')->willReturn($this->helperMock);
+        $this->contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock);
+        $this->contextMock->expects($this->any())->method('getActionFlag')->willReturn($flagMock);
+        $this->contextMock->expects($this->any())->method('getResponse')->willReturn($responseMock);
+
+        $this->viewed = new Viewed(
+            $this->contextMock,
+            $this->fileFactoryMock,
+            $this->dateMock
+        );
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecute()
+    {
+        $this->objectManagerMock
+            ->expects($this->any())
+            ->method('get')
+            ->willReturn($this->helperMock);
+
+        $titleMock = $this->getMockBuilder('Magento\Framework\View\Page\Title')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $titleMock
+            ->expects($this->once())
+            ->method('prepend')
+            ->with(new Phrase('Product Views Report'));
+
+        $this->viewMock
+            ->expects($this->once())
+            ->method('getPage')
+            ->willReturn(
+                new Object(
+                    ['config' => new Object(
+                        ['title' => $titleMock]
+                    )]
+                )
+            );
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->with('Magento_Reports::report_products_viewed');
+
+        $this->breadcrumbsBlockMock
+            ->expects($this->exactly(3))
+            ->method('addLink')
+            ->withConsecutive(
+                [new Phrase('Reports'), new Phrase('Reports')],
+                [new Phrase('Products'), new Phrase('Products')],
+                [new Phrase('Products Most Viewed Report'), new Phrase('Products Most Viewed Report')]
+            );
+
+        $this->viewMock
+            ->expects($this->once())
+            ->method('renderLayout');
+
+        $this->viewed->execute();
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecuteWithException()
+    {
+        $errorText = new Phrase(
+            'An error occurred while showing the product views report. ' .
+            'Please review the log and try again.'
+        );
+
+        $logMock = $this->getMockBuilder('Psr\Log\LoggerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $sessionMock = $this->getMockBuilder('Magento\Backend\Model\Session')
+            ->setMethods(['setIsUrlNotice'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->objectManagerMock
+            ->expects($this->any())
+            ->method('get')
+            ->will(
+                $this->returnValueMap(
+                    [
+                        ['Psr\Log\LoggerInterface', $logMock],
+                        ['Magento\Backend\Model\Auth\Session', $sessionMock]
+                    ]
+                )
+            );
+
+        $this->messageManagerMock
+            ->expects($this->once())
+            ->method('addError')
+            ->with($errorText);
+
+        $logMock
+            ->expects($this->once())
+            ->method('critical');
+        $sessionMock
+            ->expects($this->once())
+            ->method('setIsUrlNotice');
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->willThrowException(new \Exception());
+
+        $this->viewed->execute();
+    }
+
+    /**
+     * @return void
+     */
+    public function testExecuteWithLocalizedException()
+    {
+        $errorText = new Phrase('Error');
+
+        $this->messageManagerMock
+            ->expects($this->once())
+            ->method('addError')
+            ->with($errorText);
+
+        $this->menuBlockMock
+            ->expects($this->once())
+            ->method('setActive')
+            ->willThrowException(new \Magento\Framework\Exception\LocalizedException($errorText));
+
+        $this->viewed->execute();
+    }
+}
diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml
index c47f73ec9012bd91e4218009b662d754d6905645..1bc032018f7c8a1ff22c9c0863f1c5aaac1d62b0 100644
--- a/app/code/Magento/Store/etc/di.xml
+++ b/app/code/Magento/Store/etc/di.xml
@@ -23,6 +23,11 @@
         <argument name="cache" xsi:type="object">Magento\Framework\App\Cache\Type\Config</argument>
         </arguments>
     </type>
+    <type name="Magento\Framework\View\Element\Template\File\Validator">
+        <arguments>
+            <argument name="scope" xsi:type="string">store</argument>
+        </arguments>
+    </type>
     <type name="Magento\Store\Model\Config\Reader\Website">
         <arguments>
             <argument name="scopePool" xsi:type="object">Magento\Framework\App\Config\ScopePool\Proxy</argument>
diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php
index 8e1c8e4cb27946799946680b342aff3ae78949df..a9928ab157baac5bdcbc1a0826a825254813ee5f 100644
--- a/lib/internal/Magento/Framework/View/Element/Template.php
+++ b/lib/internal/Magento/Framework/View/Element/Template.php
@@ -55,13 +55,6 @@ class Template extends AbstractBlock
      */
     protected $_filesystem;
 
-    /**
-     * View file system
-     *
-     * @var \Magento\Framework\View\FileSystem
-     */
-    protected $_viewFileSystem;
-
     /**
      * Path to template file in theme.
      *
@@ -116,6 +109,16 @@ class Template extends AbstractBlock
      */
     protected $pageConfig;
 
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Resolver
+     */
+    protected $resolver;
+
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Validator
+     */
+    protected $validator;
+
     /**
      * Constructor
      *
@@ -124,8 +127,9 @@ class Template extends AbstractBlock
      */
     public function __construct(Template\Context $context, array $data = [])
     {
+        $this->validator = $context->getValidator();
+        $this->resolver = $context->getResolver();
         $this->_filesystem = $context->getFilesystem();
-        $this->_viewFileSystem = $context->getViewFileSystem();
         $this->templateEnginePool = $context->getEnginePool();
         $this->_storeManager = $context->getStoreManager();
         $this->_appState = $context->getAppState();
@@ -199,8 +203,7 @@ class Template extends AbstractBlock
         if ($area) {
             $params['area'] = $area;
         }
-        $templateName = $this->_viewFileSystem->getTemplateFileName($template ?: $this->getTemplate(), $params);
-        return $templateName;
+        return $this->resolver->getTemplateFileName($template ?: $this->getTemplate(), $params);
     }
 
     /**
@@ -246,7 +249,7 @@ class Template extends AbstractBlock
             ['group' => 'TEMPLATE', 'file_name' => $relativeFilePath]
         );
 
-        if ($this->isTemplateFileValid($fileName)) {
+        if ($this->validator->isValid($fileName)) {
             $extension = pathinfo($fileName, PATHINFO_EXTENSION);
             $templateEngine = $this->templateEnginePool->get($extension);
             $html = $templateEngine->render($this->templateContext, $fileName, $this->_viewVars);
@@ -312,22 +315,6 @@ class Template extends AbstractBlock
         ];
     }
 
-    /**
-     * Get is allowed symliks flag
-     *
-     * @return bool
-     */
-    protected function isAllowSymlinks()
-    {
-        if (null === $this->_allowSymlinks) {
-            $this->_allowSymlinks = $this->_scopeConfig->isSetFlag(
-                self::XML_PATH_TEMPLATE_ALLOW_SYMLINK,
-                \Magento\Store\Model\ScopeInterface::SCOPE_STORE
-            );
-        }
-        return $this->_allowSymlinks;
-    }
-
     /**
      * Instantiates filesystem directory
      *
@@ -354,49 +341,4 @@ class Template extends AbstractBlock
         }
         return $this->mediaDirectory;
     }
-
-    /**
-     * Checks whether the provided file can be rendered.
-     *
-     * Available directories which are allowed to be rendered
-     * (the template file should be located under these directories):
-     *  - app
-     *  - design
-     *
-     * @param string $fileName
-     * @return bool
-     */
-    protected function isTemplateFileValid($fileName)
-    {
-        $fileName = str_replace('\\', '/', $fileName);
-
-        $themesDir = $this->_filesystem->getDirectoryRead(DirectoryList::THEMES)->getAbsolutePath();
-        $appDir = $this->_filesystem->getDirectoryRead(DirectoryList::APP)->getAbsolutePath();
-        $compiledDir = $this->_filesystem->getDirectoryRead(DirectoryList::TEMPLATE_MINIFICATION_DIR)
-            ->getAbsolutePath();
-        return ($this->isPathInDirectory(
-            $fileName,
-            $compiledDir
-        ) || $this->isPathInDirectory(
-            $fileName,
-            $appDir
-        ) || $this->isPathInDirectory(
-            $fileName,
-            $themesDir
-        ) || $this->isAllowSymlinks()) && $this->getRootDirectory()->isFile(
-            $this->getRootDirectory()->getRelativePath($fileName)
-        );
-    }
-
-    /**
-     * Checks whether path related to the directory
-     *
-     * @param string $path
-     * @param string $directory
-     * @return bool
-     */
-    protected function isPathInDirectory($path, $directory)
-    {
-        return 0 === strpos($path, $directory);
-    }
 }
diff --git a/lib/internal/Magento/Framework/View/Element/Template/Context.php b/lib/internal/Magento/Framework/View/Element/Template/Context.php
index 6fddcb67280165d4662656a264035f30e95a5a8c..78251c9ec7991dd713211c9663879bde569a5281 100644
--- a/lib/internal/Magento/Framework/View/Element/Template/Context.php
+++ b/lib/internal/Magento/Framework/View/Element/Template/Context.php
@@ -62,6 +62,17 @@ class Context extends \Magento\Framework\View\Element\Context
     protected $pageConfig;
 
     /**
+     * @var \Magento\Framework\View\Element\Template\File\Resolver
+     */
+    protected $resolver;
+
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Validator
+     */
+    protected $validator;
+
+    /**
+     *
      * @param \Magento\Framework\App\RequestInterface $request
      * @param \Magento\Framework\View\LayoutInterface $layout
      * @param \Magento\Framework\Event\ManagerInterface $eventManager
@@ -85,6 +96,8 @@ class Context extends \Magento\Framework\View\Element\Context
      * @param \Magento\Framework\App\State $appState
      * @param \Magento\Store\Model\StoreManagerInterface $storeManager
      * @param \Magento\Framework\View\Page\Config $pageConfig
+     * @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
+     * @param \Magento\Framework\View\Element\Template\File\Validator $validator
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
@@ -111,7 +124,9 @@ class Context extends \Magento\Framework\View\Element\Context
         \Magento\Framework\View\TemplateEnginePool $enginePool,
         \Magento\Framework\App\State $appState,
         \Magento\Store\Model\StoreManagerInterface $storeManager,
-        \Magento\Framework\View\Page\Config $pageConfig
+        \Magento\Framework\View\Page\Config $pageConfig,
+        \Magento\Framework\View\Element\Template\File\Resolver $resolver,
+        \Magento\Framework\View\Element\Template\File\Validator $validator
     ) {
         parent::__construct(
             $request,
@@ -132,7 +147,8 @@ class Context extends \Magento\Framework\View\Element\Context
             $localeDate,
             $inlineTranslation
         );
-
+        $this->resolver = $resolver;
+        $this->validator = $validator;
         $this->_storeManager = $storeManager;
         $this->_appState = $appState;
         $this->_logger = $logger;
@@ -142,6 +158,26 @@ class Context extends \Magento\Framework\View\Element\Context
         $this->pageConfig = $pageConfig;
     }
 
+    /**
+     * Get template file resolver
+     *
+     * @return File\Resolver
+     */
+    public function getResolver()
+    {
+        return $this->resolver;
+    }
+
+    /**
+     * Get validator
+     *
+     * @return File\Validator
+     */
+    public function getValidator()
+    {
+        return $this->validator;
+    }
+
     /**
      * Get filesystem instance
      *
diff --git a/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php
new file mode 100644
index 0000000000000000000000000000000000000000..4bb7e4884a8b17e87deed5597e14eac2b3be9f25
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Element/Template/File/Resolver.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Element\Template\File;
+
+/**
+ * Class Resolver
+ * @package Magento\Framework\View\Element\Template\File
+ */
+class Resolver
+{
+    /**
+     * Template files map
+     *
+     * @var []
+     */
+    protected $_templateFilesMap = [];
+
+    /**
+     * View filesystem
+     *
+     * @var \Magento\Framework\View\FileSystem
+     */
+    protected $_viewFileSystem;
+
+    /**
+     * Class constructor
+     *
+     * @param \Magento\Framework\View\FileSystem $viewFileSystem
+     */
+    public function __construct(\Magento\Framework\View\FileSystem $viewFileSystem)
+    {
+        $this->_viewFileSystem = $viewFileSystem;
+    }
+
+    /**
+     * Get template filename
+     *
+     * @param string $template
+     * @param [] $params
+     * @return string|bool
+     */
+    public function getTemplateFileName($template, $params = [])
+    {
+        $key = $template . '_' . serialize($params);
+        if (!isset($this->_templateFilesMap[$key])) {
+            $this->_templateFilesMap[$key] = $this->_viewFileSystem->getTemplateFileName($template, $params);
+        }
+        return $this->_templateFilesMap[$key];
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Element/Template/File/Validator.php b/lib/internal/Magento/Framework/View/Element/Template/File/Validator.php
new file mode 100644
index 0000000000000000000000000000000000000000..101bae7ad7037e583c6d4cbac150402068d1326e
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Element/Template/File/Validator.php
@@ -0,0 +1,139 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Element\Template\File;
+
+use \Magento\Framework\App\Filesystem\DirectoryList;
+
+/**
+ * Class Validator
+ * @package Magento\Framework\View\Element\Template\File
+ */
+class Validator
+{
+    /**
+     * Config path to 'Allow Symlinks' template settings
+     */
+    const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
+
+    /**
+     * Template files map
+     *
+     * @var []
+     */
+    protected $_templatesValidationResults = [];
+
+    /**
+     * View filesystem
+     *
+     * @var \Magento\Framework\FileSystem
+     */
+    protected $_filesystem;
+
+    /**
+     * Allow symlinks flag
+     *
+     * @var bool
+     */
+    protected $_isAllowSymlinks = false;
+
+    /**
+     * Root directory
+     *
+     * @var bool
+     */
+    protected $directory = null;
+
+    /**
+     * Themes directory
+     *
+     * @var string
+     */
+    protected $_themesDir;
+
+    /**
+     * Application directory
+     *
+     * @var string
+     */
+    protected $_appDir;
+
+    /**
+     * Compiled templates directory
+     *
+     * @var string
+     */
+    protected $_compiledDir;
+
+    /**
+     * Class constructor
+     *
+     * @param \Magento\Framework\Filesystem $filesystem
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface
+     * @param string|null $scope
+     */
+    public function __construct(
+        \Magento\Framework\Filesystem $filesystem,
+        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface,
+        $scope = null
+    ) {
+        $this->_filesystem = $filesystem;
+        $this->_isAllowSymlinks = $scopeConfigInterface->getValue(self::XML_PATH_TEMPLATE_ALLOW_SYMLINK, $scope);
+        $this->_themesDir = $this->_filesystem->getDirectoryRead(DirectoryList::THEMES)->getAbsolutePath();
+        $this->_appDir = $this->_filesystem->getDirectoryRead(DirectoryList::APP)->getAbsolutePath();
+        $this->_compiledDir = $this->_filesystem->getDirectoryRead(DirectoryList::TEMPLATE_MINIFICATION_DIR)
+            ->getAbsolutePath();
+    }
+
+    /**
+     * Checks whether the provided file can be rendered.
+     *
+     * Available directories which are allowed to be rendered
+     * (the template file should be located under these directories):
+     *  - app
+     *  - design
+     *
+     * @param string $filename
+     * @return bool
+     */
+    public function isValid($filename)
+    {
+        $filename = str_replace('\\', '/', $filename);
+        if (!isset($this->_templatesValidationResults[$filename])) {
+            $this->_templatesValidationResults[$filename] =
+                ($this->isPathInDirectory($filename, $this->_compiledDir)
+                || $this->isPathInDirectory($filename, $this->_appDir)
+                || $this->isPathInDirectory($filename, $this->_themesDir)
+                || $this->_isAllowSymlinks)
+                && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename));
+        }
+        return $this->_templatesValidationResults[$filename];
+    }
+
+    /**
+     * Checks whether path related to the directory
+     *
+     * @param string $path
+     * @param string $directory
+     * @return bool
+     */
+    protected function isPathInDirectory($path, $directory)
+    {
+        return 0 === strpos($path, $directory);
+    }
+
+    /**
+     * Instantiates filesystem directory
+     *
+     * @return \Magento\Framework\Filesystem\Directory\ReadInterface
+     */
+    protected function getRootDirectory()
+    {
+        if (null === $this->directory) {
+            $this->directory = $this->_filesystem->getDirectoryRead(DirectoryList::ROOT);
+        }
+        return $this->directory;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/LinkTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/LinkTest.php
index 3ff2d6934ce46ce7108dbc886fff3d28def47715..a5792024f66313ad80f7d5d89a605c4990366697 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/LinkTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/LinkTest.php
@@ -53,8 +53,27 @@ class LinkTest extends \PHPUnit_Framework_TestCase
             ->method('getUrl')
             ->will($this->returnArgument('http://site.com/link.html'));
 
+        $validtorMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\File\Validator')
+            ->setMethods(['isValid'])->disableOriginalConstructor()->getMock();
+
+        $scopeConfigMock = $this->getMockBuilder('Magento\Framework\App\Config')
+            ->setMethods(['isSetFlag'])->disableOriginalConstructor()->getMock();
+
+        $resolverMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\File\Resolver')
+            ->setMethods([])->disableOriginalConstructor()->getMock();
+
         $contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
-            ->setMethods(['getEscaper', 'getUrlBuilder'])->disableOriginalConstructor()->getMock();
+            ->setMethods(['getEscaper', 'getUrlBuilder', 'getValidator', 'getResolver', 'getScopeConfig'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $contextMock->expects($this->any())
+            ->method('getValidator')
+            ->will($this->returnValue($validtorMock));
+
+        $contextMock->expects($this->any())
+            ->method('getResolver')
+            ->will($this->returnValue($resolverMock));
 
         $contextMock->expects($this->any())
             ->method('getEscaper')
@@ -64,6 +83,10 @@ class LinkTest extends \PHPUnit_Framework_TestCase
             ->method('getUrlBuilder')
             ->will($this->returnValue($urlBuilderMock));
 
+        $contextMock->expects($this->any())
+            ->method('getScopeConfig')
+            ->will($this->returnValue($scopeConfigMock));
+
         /** @var \Magento\Framework\View\Element\Html\Link $linkWithAttributes */
         $linkWithAttributes = $objectManagerHelper->getObject(
             'Magento\Framework\View\Element\Html\Link',
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Js/CookieTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Js/CookieTest.php
index 60e4d21af3ab3a5a1bc4a9274da581ca80bc3d95..6e39e1cb47191b43e72bfb49bcc4493e0c67fe2b 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Js/CookieTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Js/CookieTest.php
@@ -38,6 +38,21 @@ class CookieTest extends \PHPUnit_Framework_TestCase
         $this->ipValidatorMock = $this->getMockBuilder('Magento\Framework\Validator\Ip')
             ->disableOriginalConstructor()
             ->getMock();
+
+        $validtorMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\File\Validator')
+            ->setMethods(['isValid'])->disableOriginalConstructor()->getMock();
+
+        $scopeConfigMock = $this->getMockBuilder('Magento\Framework\App\Config')
+            ->setMethods(['isSetFlag'])->disableOriginalConstructor()->getMock();
+
+        $this->contextMock->expects($this->any())
+            ->method('getScopeConfig')
+            ->will($this->returnValue($scopeConfigMock));
+
+        $this->contextMock->expects($this->any())
+            ->method('getValidator')
+            ->will($this->returnValue($validtorMock));
+
         $this->model = new \Magento\Framework\View\Element\Js\Cookie(
             $this->contextMock,
             $this->sessionConfigMock,
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ResolverTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ResolverTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..31dd64c547cd6b2a1984fdae9dd1c40f615fb782
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ResolverTest.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Element\Template\File;
+
+/**
+ * Class ResolverTest
+ * @package Magento\Framework\View\Test\Unit\Element\Template\File
+ */
+class ResolverTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Resolver object
+     *
+     * @var \Magento\Framework\View\Element\Template\File\Resolver
+     */
+    protected $_resolver;
+
+    /**
+     * Mock for view file system
+     *
+     * @var \Magento\Framework\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_viewFileSystemMock;
+
+    /**
+     * Test Setup
+     *
+     * @return void
+     */
+    public function setUp()
+    {
+        $this->_viewFileSystemMock = $this->getMock('\Magento\Framework\View\FileSystem', [], [], '', false);
+        $this->_resolver = new \Magento\Framework\View\Element\Template\File\Resolver(
+            $this->_viewFileSystemMock
+        );
+    }
+
+    /**
+     * Resolver get template file name test
+     *
+     * @return void
+     */
+    public function testGetTemplateFileName()
+    {
+        $template = 'template.phtml';
+        $this->_viewFileSystemMock->expects($this->once())
+            ->method('getTemplateFileName')
+            ->with($template)
+            ->will($this->returnValue('path_to' . $template));
+        $this->assertEquals('path_to' . $template, $this->_resolver->getTemplateFileName($template));
+        $this->assertEquals('path_to' . $template, $this->_resolver->getTemplateFileName($template));
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ValidatorTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ValidatorTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..befcf7e5a8c9f2d7397c049b7b704da5d72e0b6a
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Template/File/ValidatorTest.php
@@ -0,0 +1,141 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Element\Template\File;
+
+use \Magento\Framework\App\Filesystem\DirectoryList;
+use \Magento\Framework\Filesystem\DriverPool;
+
+/**
+ * Class ValidatorTest
+ * @package Magento\Framework\View\Test\Unit\Element\Template\File
+ */
+class ValidatorTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Resolver object
+     *
+     * @var \Magento\Framework\View\Element\Template\File\Validator
+     */
+    protected $_validator;
+
+    /**
+     * Mock for view file system
+     *
+     * @var \Magento\Framework\FileSystem|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_fileSystemMock;
+
+    /**
+     * Mock for scope config
+     *
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_scopeConfigMock;
+
+    /**
+     * Mock for root directory reader
+     *
+     * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $rootDirectoryMock;
+
+    /**
+     * Mock for app directory reader
+     *
+     * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $appDirectoryMock;
+
+    /**
+     * Mock for themes directory reader
+     *
+     * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $themesDirectoryMock;
+
+    /**
+     * Mock for compiled directory reader
+     *
+     * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $compiledDirectoryMock;
+
+    /**
+     * Test Setup
+     *
+     * @return void
+     */
+    public function setUp()
+    {
+        $this->_fileSystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false);
+        $this->_scopeConfigMock = $this->getMock('\Magento\Framework\App\Config\ScopeConfigInterface');
+        $this->rootDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');
+        $this->appDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');
+        $this->themesDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');
+        $this->compiledDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface');
+
+        $this->_fileSystemMock->expects($this->any())
+            ->method('getDirectoryRead')
+            ->will($this->returnValueMap(
+                [
+                    [DirectoryList::ROOT, DriverPool::FILE, $this->rootDirectoryMock],
+                    [DirectoryList::THEMES, DriverPool::FILE, $this->themesDirectoryMock],
+                    [DirectoryList::APP, DriverPool::FILE, $this->appDirectoryMock],
+                    [DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE, $this->compiledDirectoryMock],
+                ]
+            ));
+
+        $this->compiledDirectoryMock->expects($this->any())
+            ->method('getAbsolutePath')
+            ->will($this->returnValue('/magento/var/compiled'));
+
+        $this->appDirectoryMock->expects($this->any())
+            ->method('getAbsolutePath')
+            ->will($this->returnValue('/magento/app'));
+
+        $this->themesDirectoryMock->expects($this->any())
+            ->method('getAbsolutePath')
+            ->will($this->returnValue('/magento/themes'));
+
+        $this->_validator = new \Magento\Framework\View\Element\Template\File\Validator(
+            $this->_fileSystemMock,
+            $this->_scopeConfigMock
+        );
+    }
+
+    /**
+     * Test is file valid
+     *
+     * @param string $file
+     * @param bool $expectedResult
+     *
+     * @dataProvider testIsValidDataProvider
+     *
+     * @return void
+     */
+    public function testIsValid($file, $expectedResult)
+    {
+
+        $this->rootDirectoryMock->expects($this->any())->method('isFile')->will($this->returnValue(true));
+        $this->assertEquals($expectedResult, $this->_validator->isValid($file));
+    }
+
+    /**
+     * Data provider for testIsValid
+     *
+     * @return []
+     */
+    public function testIsValidDataProvider()
+    {
+        return [
+            'empty' => ['', false],
+            '/magento/var/compiled/template.phtml' => ['/magento/var/compiled/template.phtml', true],
+            '/magento/themes/default/template.phtml' => ['/magento/themes/default/template.phtml', true],
+            '/magento/app/code/Some/Module/template.phtml' => ['/magento/app/code/Some/Module/template.phtml', true],
+            '/magento/x' => ['/magento/x', false],
+        ];
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php
index 0a462c8fd4f453e24df96106c9789d68bb9e09e7..33bba78c6238eee8d64ba66a4a6bde7378986acb 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php
@@ -25,9 +25,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     protected $_templateEngine;
 
     /**
-     * @var \Magento\Framework\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\View\Element\Template\File\Resolver|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_viewFileSystem;
+    protected $_resolver;
+
+    /**
+     * @var \Magento\Framework\View\Element\Template\File\Validator|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $_validator;
 
     /**
      * @var \Magento\Framework\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject
@@ -36,7 +41,21 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
-        $this->_viewFileSystem = $this->getMock('\Magento\Framework\View\FileSystem', [], [], '', false);
+        $this->_resolver = $this->getMock(
+            'Magento\Framework\View\Element\Template\File\Resolver',
+            [],
+            [],
+            '',
+            false
+        );
+
+        $this->_validator = $this->getMock(
+            'Magento\Framework\View\Element\Template\File\Validator',
+            [],
+            [],
+            '',
+            false
+        );
 
         $this->rootDirMock = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false);
         $this->rootDirMock->expects($this->any())
@@ -55,7 +74,10 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
                 [\Magento\Framework\App\Filesystem\DirectoryList::THEMES, DriverPool::FILE, $themesDirMock],
                 [\Magento\Framework\App\Filesystem\DirectoryList::APP, DriverPool::FILE, $appDirMock],
                 [\Magento\Framework\App\Filesystem\DirectoryList::ROOT, DriverPool::FILE, $this->rootDirMock],
-                [\Magento\Framework\App\Filesystem\DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE, $this->rootDirMock],
+                [
+                    \Magento\Framework\App\Filesystem\DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE,
+                    $this->rootDirMock
+                ],
             ]));
 
         $this->_templateEngine = $this->getMock(
@@ -76,7 +98,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
             [
                 'filesystem' => $this->_filesystem,
                 'enginePool' => $this->_templateEngine,
-                'viewFileSystem' => $this->_viewFileSystem,
+                'resolver' => $this->_resolver,
+                'validator' => $this->_validator,
                 'appState' => $appState,
                 'data' => ['template' => 'template.phtml', 'module_name' => 'Fixture_Module']
             ]
@@ -86,7 +109,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     public function testGetTemplateFile()
     {
         $params = ['module' => 'Fixture_Module', 'area' => 'frontend'];
-        $this->_viewFileSystem->expects($this->once())->method('getTemplateFileName')->with('template.phtml', $params);
+        $this->_resolver->expects($this->once())->method('getTemplateFileName')->with('template.phtml', $params);
         $this->_block->getTemplateFile();
     }
 
@@ -94,8 +117,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     {
         $this->expectOutputString('');
         $template = 'themedir/template.phtml';
-        $this->rootDirMock->expects($this->once())
-            ->method('isFile')
+        $this->_validator->expects($this->once())
+            ->method('isValid')
             ->with($template)
             ->will($this->returnValue(true));
 
@@ -109,11 +132,12 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
     public function testSetTemplateContext()
     {
         $template = 'themedir/template.phtml';
-        $this->rootDirMock->expects($this->once())
-            ->method('isFile')
+        $context = new \Magento\Framework\Object();
+        $this->_validator->expects($this->once())
+            ->method('isValid')
             ->with($template)
             ->will($this->returnValue(true));
-        $context = new \Magento\Framework\Object();
+
         $this->_templateEngine->expects($this->once())->method('render')->with($context);
         $this->_block->setTemplateContext($context);
         $this->_block->fetchView($template);