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()); }
public function testShowPager() { $this->assertEquals(false, $this->productsList->showPager()); $this->productsList->setData('show_pager', true); $this->assertEquals(true, $this->productsList->showPager()); }
/** * {@inheritdoc} */ public function setData($key, $value = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setData'); if (!$pluginInfo) { return parent::setData($key, $value); } else { return $this->___callPlugins('setData', func_get_args(), $pluginInfo); } }