/**
  * @dataProvider stockStatusDataProvider
  */
 public function testAfterGetProductCollectionShow($status, $callCount)
 {
     list($collectionMock, $subjectMock) = $this->buildMocks();
     $this->configMock->expects($this->once())->method('isShowOutOfStock')->will($this->returnValue($status));
     $this->stockHelperMock->expects($this->exactly($callCount))->method('addInStockFilterToCollection')->with($collectionMock);
     $this->assertEquals($collectionMock, $this->model->afterGetProductCollection($subjectMock, $collectionMock));
 }
Example #2
0
 /**
  * @param Link $subject
  * @param Collection $collection
  * @return Collection
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterGetProductCollection(Link $subject, Collection $collection)
 {
     if ($this->configuration->isShowOutOfStock() != 1) {
         $this->stockHelper->addInStockFilterToCollection($collection);
     }
     return $collection;
 }
 public function testGetManageStock()
 {
     $store = 1;
     $this->scopeConfigMock->expects($this->once())->method('isSetFlag')->with(Configuration::XML_PATH_MANAGE_STOCK, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)->willReturn(1);
     $this->assertEquals(1, $this->model->getManageStock($store));
 }
 public function testGetConfigItemOptions()
 {
     $fields = ['min_qty', 'backorders', 'min_sale_qty', 'max_sale_qty', 'notify_stock_qty', 'manage_stock', 'enable_qty_increments', 'qty_increments', 'is_decimal_divided'];
     $this->assertEquals($fields, $this->model->getConfigItemOptions());
 }