本文整理汇总了PHP中Observer::refundOrderInventory方法的典型用法代码示例。如果您正苦于以下问题:PHP Observer::refundOrderInventory方法的具体用法?PHP Observer::refundOrderInventory怎么用?PHP Observer::refundOrderInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Observer
的用法示例。
在下文中一共展示了Observer::refundOrderInventory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRefundOrderInventory
public function testRefundOrderInventory()
{
$websiteId = 0;
$ids = ['1', '14'];
$items = [];
$isAutoReturnEnabled = true;
$itemsToUpdate = [];
foreach ($ids as $id) {
$item = $this->getCreditMemoItem($id);
$items[] = $item;
$itemsToUpdate[$item->getProductId()] = $item->getQty();
}
$creditMemo = $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo', [], [], '', false);
$creditMemo->expects($this->once())->method('getAllItems')->will($this->returnValue($items));
$store = $this->getMock('Magento\\Store\\Model\\Store', ['getWebsiteId', '__wakeup'], [], '', false);
$store->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId));
$creditMemo->expects($this->once())->method('getStore')->will($this->returnValue($store));
$this->stockConfiguration->expects($this->any())->method('isAutoReturnEnabled')->will($this->returnValue($isAutoReturnEnabled));
$this->stockManagement->expects($this->once())->method('revertProductsSale')->with($itemsToUpdate, $websiteId);
$this->stockIndexerProcessor->expects($this->once())->method('reindexList')->with($ids);
$this->priceIndexer->expects($this->once())->method('reindexList')->with($ids);
$this->event->expects($this->once())->method('getCreditmemo')->will($this->returnValue($creditMemo));
$this->eventObserver->expects($this->atLeastOnce())->method('getEvent')->will($this->returnValue($this->event));
$this->observer->refundOrderInventory($this->eventObserver);
}
示例2: refundOrderInventory
public function refundOrderInventory()
{
$ids = ['1', '14'];
$items = [];
foreach ($ids as $id) {
$items[] = $this->getCreditMemoItem($id);
}
$creditMemo = $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo', [], [], '', false);
$creditMemo->expects($this->once())->method('getAllItems')->will($this->returnValue($items));
$this->event->expects($this->once())->method('getCreditmemo')->will($this->returnValue($creditMemo));
$this->catalogInventoryData->expects($this->once())->method('isAutoReturnEnabled')->will($this->returnValue(true));
$this->stock->expects($this->once())->method('revertProductsSale')->with($items);
$this->stockIndexProcessor->expects($this->once())->method('reidexList')->with($ids);
$this->model->refundOrderInventory($this->eventObserver);
}