43 $this->product = $this->createMock(\
Magento\Catalog\Model\Product::class);
44 $this->productFactory = $this->createPartialMock(\
Magento\Catalog\Model\ProductFactory::class, [
'create']);
45 $this->productFactory->expects($this->any())->method(
'create')->will($this->returnValue($this->product));
46 $this->storeManager = $this->createMock(\
Magento\
Store\Model\StoreManager::class);
48 $this->objectManagerHelper =
new ObjectManagerHelper($this);
49 $this->special = $this->objectManagerHelper->getObject(
52 'productFactory' => $this->productFactory,
53 'storeManager' => $this->storeManager
58 public function testGetProductsCollection()
62 $this->storeManager->expects($this->once())->method(
'getStore')->with(
$storeId)->will(
66 $store->expects($this->once())->method(
'getWebsiteId')->will($this->returnValue(
$websiteId));
71 $this->product->expects($this->once())->method(
'getResourceCollection')->will(
75 $productCollection->expects($this->once())->method(
'addPriceDataFieldFilter')->will($this->returnSelf());
79 $productCollection->expects($this->once())->method(
'addAttributeToSelect')->will($this->returnSelf());
80 $productCollection->expects($this->once())->method(
'addAttributeToSort')->will($this->returnSelf());