public function testGetStockStatus() { $this->stockStatusCriteriaFactory->expects($this->once())->method('create')->willReturn($this->stockStatusCriteria); $this->stockStatusCriteria->expects($this->once())->method('setScopeFilter')->willReturn(null); $this->stockStatusCriteria->expects($this->once())->method('setProductsFilter')->willReturn(null); $stockStatusCollection = $this->getMock('\\Magento\\CatalogInventory\\Model\\ResourceModel\\Stock\\Status\\Collection', ['getFirstItem', '__wakeup', 'getItems'], [], '', false); $stockStatusCollection->expects($this->once())->method('getItems')->willReturn([$this->stockStatus]); $this->stockStatusRepository->expects($this->once())->method('getList')->willReturn($stockStatusCollection); $this->stockStatus->expects($this->once())->method('getProductId')->willReturn($this->productId); $this->assertEquals($this->stockStatus, $this->stockRegistryProvider->getStockStatus($this->productId, $this->scopeId)); }