本文整理汇总了PHP中Magento\Catalog\Model\Product::isInStock方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::isInStock方法的具体用法?PHP Product::isInStock怎么用?PHP Product::isInStock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product
的用法示例。
在下文中一共展示了Product::isInStock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsSalable
/**
* @covers \Magento\Catalog\Model\Product::isSalable
* @covers \Magento\Catalog\Model\Product::isSaleable
* @covers \Magento\Catalog\Model\Product::isAvailable
* @covers \Magento\Catalog\Model\Product::isInStock
*/
public function testIsSalable()
{
$this->_model->load(1);
// fixture
$this->assertTrue((bool) $this->_model->isSalable());
$this->assertTrue((bool) $this->_model->isSaleable());
$this->assertTrue((bool) $this->_model->isAvailable());
$this->assertTrue($this->_model->isInStock());
$this->_model->setStatus(0);
$this->assertFalse((bool) $this->_model->isSalable());
$this->assertFalse((bool) $this->_model->isSaleable());
$this->assertFalse((bool) $this->_model->isAvailable());
$this->assertFalse($this->_model->isInStock());
}
示例2: testIsSalable
/**
* @covers \Magento\Catalog\Model\Product::isSalable
* @covers \Magento\Catalog\Model\Product::isSaleable
* @covers \Magento\Catalog\Model\Product::isAvailable
* @covers \Magento\Catalog\Model\Product::isInStock
*/
public function testIsSalable()
{
$this->_model = $this->productRepository->get('simple');
// fixture
$this->assertTrue((bool) $this->_model->isSalable());
$this->assertTrue((bool) $this->_model->isSaleable());
$this->assertTrue((bool) $this->_model->isAvailable());
$this->assertTrue($this->_model->isInStock());
$this->_model->setStatus(0);
$this->assertFalse((bool) $this->_model->isSalable());
$this->assertFalse((bool) $this->_model->isSaleable());
$this->assertFalse((bool) $this->_model->isAvailable());
$this->assertFalse($this->_model->isInStock());
}
示例3: testIsInStock
public function testIsInStock()
{
$this->model->setStatus(Status::STATUS_ENABLED);
$this->assertTrue($this->model->isInStock());
}
示例4: testIsInStock
public function testIsInStock()
{
$this->model->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$this->assertTrue($this->model->isInStock());
}
示例5: isInStock
/**
* {@inheritdoc}
*/
public function isInStock()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'isInStock');
if (!$pluginInfo) {
return parent::isInStock();
} else {
return $this->___callPlugins('isInStock', func_get_args(), $pluginInfo);
}
}