protected function setUp()
 {
     $this->product = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->productFactory = $this->getMock('Magento\\Catalog\\Model\\ProductFactory', ['create'], [], '', false);
     $this->productFactory->expects($this->any())->method('create')->will($this->returnValue($this->product));
     $this->stock = $this->getMock('Magento\\CatalogInventory\\Model\\ResourceModel\\Stock', [], [], '', false);
     $this->stockFactory = $this->getMock('Magento\\CatalogInventory\\Model\\ResourceModel\\StockFactory', ['create'], [], '', false);
     $this->stockFactory->expects($this->any())->method('create')->will($this->returnValue($this->stock));
     $this->status = $this->getMock('Magento\\Catalog\\Model\\Product\\Attribute\\Source\\Status');
     $this->eventManager = $this->getMock('Magento\\Framework\\Event\\Manager', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->notifyStock = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Rss\\Product\\NotifyStock', ['productFactory' => $this->productFactory, 'stockFactory' => $this->stockFactory, 'productStatus' => $this->status, 'eventManager' => $this->eventManager]);
 }
 /**
  * @return \Magento\Catalog\Model\ResourceModel\Product\Collection
  */
 public function getProductsCollection()
 {
     /* @var $product \Magento\Catalog\Model\Product */
     $product = $this->productFactory->create();
     /* @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
     $collection = $product->getCollection();
     /** @var $resourceStock \Magento\CatalogInventory\Model\ResourceModel\Stock */
     $resourceStock = $this->stockFactory->create();
     $resourceStock->addLowStockFilter($collection, ['qty', 'notify_stock_qty', 'low_stock_date', 'use_config' => 'use_config_notify_stock_qty']);
     $collection->addAttributeToSelect('name', true)->addAttributeToFilter('status', ['in' => $this->productStatus->getVisibleStatusIds()])->setOrder('low_stock_date');
     $this->eventManager->dispatch('rss_catalog_notify_stock_collection_select', ['collection' => $collection]);
     return $collection;
 }