Example #1
0
 public function testGetIdentities()
 {
     $productTag = 'catalog_product_1';
     $categoryTag = 'catalog_category_product_1';
     $this->productMock->expects($this->once())->method('getIdentities')->will($this->returnValue([$productTag]));
     $itemsCollection = new \ReflectionProperty('Magento\\Catalog\\Block\\Product\\ListProduct', '_productCollection');
     $itemsCollection->setAccessible(true);
     $itemsCollection->setValue($this->block, [$this->productMock]);
     $currentCategory = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $currentCategory->expects($this->once())->method('getId')->will($this->returnValue('1'));
     $this->layerMock->expects($this->once())->method('getCurrentCategory')->will($this->returnValue($currentCategory));
     $this->assertEquals([$productTag, $categoryTag], $this->block->getIdentities());
 }
Example #2
0
 public function testGetIdentities()
 {
     $this->assertEquals([\Magento\Catalog\Model\Product::CACHE_TAG], $this->block->getIdentities());
 }
 /**
  * {@inheritdoc}
  */
 public function getIdentities()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getIdentities');
     if (!$pluginInfo) {
         return parent::getIdentities();
     } else {
         return $this->___callPlugins('getIdentities', func_get_args(), $pluginInfo);
     }
 }