本文整理汇总了PHP中Magento\Catalog\Model\Product::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::setStatus方法的具体用法?PHP Product::setStatus怎么用?PHP Product::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product
的用法示例。
在下文中一共展示了Product::setStatus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStatusAfterLoad
public function testStatusAfterLoad()
{
$this->resource->expects($this->once())->method('load')->with($this->model, 1, null);
$this->eventManagerMock->expects($this->exactly(4))->method('dispatch');
$this->model->load(1);
$this->assertEquals(Status::STATUS_ENABLED, $this->model->getData(\Magento\Catalog\Model\Product::STATUS));
$this->assertFalse($this->model->hasDataChanges());
$this->model->setStatus(Status::STATUS_DISABLED);
$this->assertTrue($this->model->hasDataChanges());
}
示例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->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());
}
示例3: 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());
}
示例4: testGetAttributeText
public function testGetAttributeText()
{
$this->assertNull($this->_model->getAttributeText('status'));
$this->_model->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$this->assertEquals('Enabled', $this->_model->getAttributeText('status'));
}
示例5: testIsInStock
public function testIsInStock()
{
$this->model->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$this->assertTrue($this->model->isInStock());
}
示例6: setStatus
/**
* {@inheritdoc}
*/
public function setStatus($status)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'setStatus');
if (!$pluginInfo) {
return parent::setStatus($status);
} else {
return $this->___callPlugins('setStatus', func_get_args(), $pluginInfo);
}
}