コード例 #1
0
 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());
 }
コード例 #2
0
ファイル: ProductsListTest.php プロジェクト: nja78/magento2
 public function testShowPager()
 {
     $this->assertEquals(false, $this->productsList->showPager());
     $this->productsList->setData('show_pager', true);
     $this->assertEquals(true, $this->productsList->showPager());
 }
コード例 #3
0
 /**
  * {@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);
     }
 }