Пример #1
0
 /**
  * @magentoDataFixture simpleProductFixture
  */
 public function testStockStatusChangedAuto()
 {
     $this->_model->setProductId(1)->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE)->setStockId(\Magento\CatalogInventory\Model\Stock::DEFAULT_STOCK_ID)->setQty(1);
     $this->_model->save();
     $this->assertEquals(0, $this->_model->getStockStatusChangedAuto());
     $this->_model->setStockStatusChangedAutomaticallyFlag(1);
     $this->_model->save();
     $this->assertEquals(1, $this->_model->getStockStatusChangedAuto());
 }
Пример #2
0
 public function testSave()
 {
     $this->item->setData('key', 'value');
     $this->eventManager->expects($this->at(0))->method('dispatch')->with('model_save_before', ['object' => $this->item]);
     $this->eventManager->expects($this->at(1))->method('dispatch')->with('cataloginventory_stock_item_save_before', ['data_object' => $this->item, 'item' => $this->item]);
     $this->resource->expects($this->once())->method('addCommitCallback')->will($this->returnValue($this->resource));
     $this->assertEquals($this->item, $this->item->save());
 }
Пример #3
0
 public function testSave()
 {
     $this->stockItemRepository->expects($this->any())->method('save')->willReturn($this->item);
     $this->assertEquals($this->item, $this->item->save());
 }