本文整理汇总了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']));
}
示例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));
}
示例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();
}