Esempio n. 1
0
 /**
  * Run test getMinimalQty method
  *
  * @param int $minSale
  * @param int|null $result
  * @return void
  *
  * @dataProvider dataProviderGetMinimalQty
  */
 public function testGetMinimalQty($minSale, $result)
 {
     $id = 10;
     $websiteId = 99;
     $productMock = $this->getMock('Magento\\Catalog\\Model\\Product', ['getId', 'getStore'], [], '', false);
     $storeMock = $this->getMock('Magento\\Store\\Model\\Store', ['getWebsiteId'], [], '', false);
     $stockItemMock = $this->getMockForAbstractClass('Magento\\CatalogInventory\\Api\\Data\\StockItemInterface', [], '', false, true, true, ['getMinSaleQty']);
     $this->stockRegistryMock->expects($this->once())->method('getStockItem')->with($id, $websiteId)->will($this->returnValue($stockItemMock));
     $productMock->expects($this->once())->method('getId')->will($this->returnValue($id));
     $productMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
     $storeMock->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId));
     $stockItemMock->expects($this->once())->method('getMinSaleQty')->will($this->returnValue($minSale));
     /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject $productMock */
     $this->assertEquals($result, $this->block->getMinimalQty($productMock));
 }
 /**
  * {@inheritdoc}
  */
 public function getMinimalQty($product)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getMinimalQty');
     if (!$pluginInfo) {
         return parent::getMinimalQty($product);
     } else {
         return $this->___callPlugins('getMinimalQty', func_get_args(), $pluginInfo);
     }
 }