From ab39b56aa50241c4dfa5c321b01c9f1e66d5dace Mon Sep 17 00:00:00 2001 From: vitaliyboyko Date: Sat, 19 May 2018 12:51:11 +0300 Subject: [PATCH] Fixed static test checks issues --- .../InventoryCache/Model/FlushCacheByProductIds.php | 13 ++++++++++--- .../Model/ResourceModel/GetProductIdsByStockIds.php | 8 ++++---- app/code/Magento/InventoryCache/etc/di.xml | 5 +++++ .../ResourceModel/GetProductIdsBySourceItemIds.php | 8 ++++---- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/InventoryCache/Model/FlushCacheByProductIds.php b/app/code/Magento/InventoryCache/Model/FlushCacheByProductIds.php index 580b0853e95cf..7ce14dfdac7e2 100644 --- a/app/code/Magento/InventoryCache/Model/FlushCacheByProductIds.php +++ b/app/code/Magento/InventoryCache/Model/FlushCacheByProductIds.php @@ -7,7 +7,6 @@ namespace Magento\InventoryCache\Model; -use Magento\Catalog\Model\Product; use Magento\Framework\EntityManager\EventManager; use Magento\Framework\Indexer\CacheContext; @@ -26,16 +25,24 @@ class FlushCacheByProductIds */ private $eventManager; + /** + * @var string + */ + private $productCacheTag; + /** * @param CacheContext $cacheContext * @param EventManager $eventManager + * @param string $productCacheTag */ public function __construct( CacheContext $cacheContext, - EventManager $eventManager + EventManager $eventManager, + string $productCacheTag ) { $this->cacheContext = $cacheContext; $this->eventManager = $eventManager; + $this->productCacheTag = $productCacheTag; } /** @@ -47,7 +54,7 @@ public function __construct( public function execute(array $productIds) { if ($productIds) { - $this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds); + $this->cacheContext->registerEntities($this->productCacheTag, $productIds); $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]); } } diff --git a/app/code/Magento/InventoryCache/Model/ResourceModel/GetProductIdsByStockIds.php b/app/code/Magento/InventoryCache/Model/ResourceModel/GetProductIdsByStockIds.php index 90fc28e454ca9..b95baaa77607a 100644 --- a/app/code/Magento/InventoryCache/Model/ResourceModel/GetProductIdsByStockIds.php +++ b/app/code/Magento/InventoryCache/Model/ResourceModel/GetProductIdsByStockIds.php @@ -59,8 +59,8 @@ class GetProductIdsByStockIds * @param StockIndexTableNameResolverInterface $stockIndexTableNameResolver * @param DefaultStockProviderInterface $defaultStockProvider * @param IndexStructure $indexStructure - * @param $productSkuColumn - * @param $productInterfaceClassName + * @param string $productSkuColumn + * @param string $productInterfaceClassName */ public function __construct( ResourceConnection $resource, @@ -68,8 +68,8 @@ public function __construct( StockIndexTableNameResolverInterface $stockIndexTableNameResolver, DefaultStockProviderInterface $defaultStockProvider, IndexStructure $indexStructure, - $productSkuColumn, - $productInterfaceClassName + string $productSkuColumn, + string $productInterfaceClassName ) { $this->resource = $resource; $this->metadataPool = $metadataPool; diff --git a/app/code/Magento/InventoryCache/etc/di.xml b/app/code/Magento/InventoryCache/etc/di.xml index 87e50b7697e02..e13424af444f7 100644 --- a/app/code/Magento/InventoryCache/etc/di.xml +++ b/app/code/Magento/InventoryCache/etc/di.xml @@ -18,4 +18,9 @@ Magento\Catalog\Api\Data\ProductInterface + + + Magento\Catalog\Model\Product::CACHE_TAG + + diff --git a/app/code/Magento/InventoryIndexer/Model/ResourceModel/GetProductIdsBySourceItemIds.php b/app/code/Magento/InventoryIndexer/Model/ResourceModel/GetProductIdsBySourceItemIds.php index 70742195bd4b3..fc8cc717bce78 100644 --- a/app/code/Magento/InventoryIndexer/Model/ResourceModel/GetProductIdsBySourceItemIds.php +++ b/app/code/Magento/InventoryIndexer/Model/ResourceModel/GetProductIdsBySourceItemIds.php @@ -47,14 +47,14 @@ class GetProductIdsBySourceItemIds * @param MetadataPool $metadataPool * @param string $tableNameSourceItem * @param string $sourceItemIdFieldName - * @param $productInterfaceClassName + * @param string $productInterfaceClassName */ public function __construct( ResourceConnection $resource, MetadataPool $metadataPool, - $tableNameSourceItem, - $sourceItemIdFieldName, - $productInterfaceClassName + string $tableNameSourceItem, + string $sourceItemIdFieldName, + string $productInterfaceClassName ) { $this->resource = $resource; $this->metadataPool = $metadataPool;