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


PHP OrderFactory::expects方法代码示例

本文整理汇总了PHP中Magento\Sales\Model\OrderFactory::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderFactory::expects方法的具体用法?PHP OrderFactory::expects怎么用?PHP OrderFactory::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Sales\Model\OrderFactory的用法示例。


在下文中一共展示了OrderFactory::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetSuccessOrderUrl

 public function testGetSuccessOrderUrl()
 {
     $orderMock = $this->getMock('Magento\\Sales\\Model\\Order', ['loadByIncrementId', 'getId', '__wakeup'], [], '', false);
     $orderMock->expects($this->once())->method('loadByIncrementId')->with('invoice number')->willReturnSelf();
     $orderMock->expects($this->once())->method('getId')->willReturn('order id');
     $this->orderFactoryMock->expects($this->once())->method('create')->willReturn($orderMock);
     $this->urlBuilderMock->expects($this->once())->method('getUrl')->with('sales/order/view', ['order_id' => 'order id'])->willReturn('some value');
     $this->assertEquals('some value', $this->dataHelper->getSuccessOrderUrl(['x_invoice_num' => 'invoice number', 'some param']));
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:DataTest.php

示例2: initOrderMock

 private function initOrderMock($orderId, $state)
 {
     $this->orderFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->orderMock));
     $this->orderMock->expects($this->once())->method('loadByIncrementId')->with($orderId)->will($this->returnSelf());
     $this->orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($orderId));
     $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue($state));
 }
开发者ID:Zash22,项目名称:magento,代码行数:7,代码来源:ReturnUrlTest.php

示例3: testExecuteNotAllowedOrderState

 /**
  * @param $state
  * @param $restoreQuote
  * @param $expectedGotoSection
  * @dataProvider testNotAllowedOrderStateDataProvider
  */
 public function testExecuteNotAllowedOrderState($state, $restoreQuote, $expectedGotoSection)
 {
     $lastRealOrderId = '000000001';
     $this->viewMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->layoutMock));
     $this->layoutMock->expects($this->once())->method('getBlock')->will($this->returnValue($this->blockMock));
     $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrderId')->will($this->returnValue($lastRealOrderId));
     $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrder')->will($this->returnValue($this->orderMock));
     $this->checkoutSessionMock->expects($this->any())->method('restoreQuote')->will($this->returnValue($restoreQuote));
     $this->orderFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->orderMock));
     $this->orderMock->expects($this->once())->method('loadByIncrementId')->with($lastRealOrderId)->will($this->returnSelf());
     $this->orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($lastRealOrderId));
     $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue($state));
     $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', $expectedGotoSection)->will($this->returnSelf());
     $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf());
     $this->returnUrl->execute();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:ReturnUrlTest.php


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