/**
  * @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());
 }
Example #2
0
 /**
  * @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());
 }
Example #3
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Framework\Gdata\Gshopping\Entry $entry
  * @return \Magento\Framework\Gdata\Gshopping\Entry
  */
 public function convertAttribute($product, $entry)
 {
     $value = $this->_googleAvailabilityMap[(int) $product->isSalable()];
     $this->_setAttribute($entry, 'availability', self::ATTRIBUTE_TYPE_TEXT, $value);
     return $entry;
 }
 /**
  * {@inheritdoc}
  */
 public function isSalable()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'isSalable');
     if (!$pluginInfo) {
         return parent::isSalable();
     } else {
         return $this->___callPlugins('isSalable', func_get_args(), $pluginInfo);
     }
 }