Пример #1
0
 /**
  *  Test add stock status to collection with 'display out of stock' option enabled
  */
 public function testAddStockStatusEnabledShow()
 {
     $this->_scopeConfigMock->expects($this->once())->method('isSetFlag')->with('cataloginventory/options/show_out_of_stock')->will($this->returnValue(false));
     $collectionMock = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection', [], [], '', false);
     $this->_stockHelperMock->expects($this->once())->method('addIsInStockFilterToCollection')->with($collectionMock);
     $subjectMock = $this->getMock('\\Magento\\Catalog\\Model\\Layer', [], [], '', false);
     $this->_model->beforePrepareProductCollection($subjectMock, $collectionMock);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param \Magento\CatalogInventory\Helper\Stock             $stockHelper  Stock helper.
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig  Configuration.
  * @param \Magento\Search\Model\QueryFactory                 $queryFactory Search query factory.
  */
 public function __construct(\Magento\CatalogInventory\Helper\Stock $stockHelper, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Search\Model\QueryFactory $queryFactory)
 {
     parent::__construct($stockHelper, $scopeConfig);
     $this->queryFactory = $queryFactory;
 }