当前位置: 首页>>代码示例>>PHP>>正文


PHP Observer::refundOrderInventory方法代码示例

本文整理汇总了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);
 }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例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);
 }
开发者ID:,项目名称:,代码行数:15,代码来源:


注:本文中的Observer::refundOrderInventory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。