public function testGetIdentities()
 {
     $collection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection')->setMethods(['addAttributeToSelect', 'getIterator'])->disableOriginalConstructor()->getMock();
     $product = $this->getMock('Magento\\Framework\\DataObject\\IdentityInterface', ['getIdentities']);
     $notProduct = $this->getMock('NotProduct', ['getIdentities']);
     $product->expects($this->once())->method('getIdentities')->willReturn(['product_identity']);
     $collection->expects($this->once())->method('getIterator')->willReturn(new \ArrayIterator([$product, $notProduct]));
     $this->productsList->setData('product_collection', $collection);
     $this->assertEquals(['product_identity'], $this->productsList->getIdentities());
 }
Exemple #2
0
 public function testGetIdentities()
 {
     $this->assertEquals([\Magento\Catalog\Model\Product::CACHE_TAG], $this->productsList->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);
     }
 }