/** * @param int $productId * @param int $qtyInc * @param bool $isSaleable * @param int|bool $result * @dataProvider getProductQtyIncrementsDataProvider */ public function testGetProductQtyIncrements($productId, $qtyInc, $isSaleable, $result) { $this->stockItemService->expects($this->once())->method('getQtyIncrements')->with($this->equalTo($productId))->will($this->returnValue($qtyInc)); $product = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false); $product->expects($this->once())->method('getId')->will($this->returnValue($productId)); $product->expects($this->once())->method('isSaleable')->will($this->returnValue($isSaleable)); $this->registryMock->expects($this->any())->method('registry')->with('current_product')->will($this->returnValue($product)); $this->assertSame($result, $this->block->getProductQtyIncrements()); // test lazy load $this->assertSame($result, $this->block->getProductQtyIncrements()); }