Example #1
0
 /**
  * @magentoDataFixture simpleProductFixture
  */
 public function testSaveWithNullQty()
 {
     $this->_model->setProductId(1)->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE)->setStockId(\Magento\CatalogInventory\Model\Stock::DEFAULT_STOCK_ID)->setQty(null);
     $this->_model->save();
     $this->_model->setQty(2);
     $this->_model->save();
     $this->assertEquals('2.0000', $this->_model->load(1)->getQty());
     $this->_model->setQty(0);
     $this->_model->save();
     $this->assertEquals('0.0000', $this->_model->load(1)->getQty());
     $this->_model->setQty(null);
     $this->_model->save();
     $this->assertEquals(null, $this->_model->load(1)->getQty());
 }