本文整理汇总了PHP中Magento\Backend\Model\View\Result\ForwardFactory::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ForwardFactory::expects方法的具体用法?PHP ForwardFactory::expects怎么用?PHP ForwardFactory::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\View\Result\ForwardFactory
的用法示例。
在下文中一共展示了ForwardFactory::expects方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecuteNoCreditmemoId
/**
* @covers \Magento\Sales\Controller\Adminhtml\Order\Creditmemo\PrintAction::execute
*/
public function testExecuteNoCreditmemoId()
{
$this->prepareTestExecute();
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->printAction->execute());
}
示例2: testExecuteAjax
/**
* @covers \Magento\Customer\Controller\Adminhtml\Index\Index::execute
*/
public function testExecuteAjax()
{
$this->prepareExecute(true);
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('grid')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->indexController->execute());
}
示例3: testExecuteWithoutTaxClass
public function testExecuteWithoutTaxClass()
{
$this->request->expects($this->once())->method('getParam')->with('tax_class')->willReturn(null);
$this->forwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForward);
$this->resultForward->expects($this->once())->method('forward')->with('new')->willReturnSelf();
$this->assertSame($this->resultForward, $this->controller->execute());
}
示例4: testExecuteNoInvoice
/**
* @return void
*/
public function testExecuteNoInvoice()
{
$invoiceId = 2;
$this->requestMock->expects($this->once())
->method('getParam')
->with('invoice_id')
->will($this->returnValue($invoiceId));
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn(null);
$this->objectManagerMock->expects($this->once())
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$resultForward = $this->getMockBuilder('Magento\Backend\Model\View\Result\Forward')
->disableOriginalConstructor()
->getMock();
$resultForward->expects($this->once())->method('forward')->with(('noroute'))->will($this->returnSelf());
$this->resultForwardFactoryMock->expects($this->once())
->method('create')
->will($this->returnValue($resultForward));
$this->assertSame($resultForward, $this->controller->executeInternal());
}
示例5: testExecuteNoCreditmemo
/**
* @return void
*/
public function testExecuteNoCreditmemo()
{
$this->requestMock->expects($this->once())->method('getParam')->with('creditmemo_id')->willReturn(null);
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
$this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Forward', $this->controller->execute());
}
示例6: testEmailNoInvoice
public function testEmailNoInvoice()
{
$invoiceId = 10000031;
$this->request->expects($this->once())
->method('getParam')
->with('invoice_id')
->willReturn($invoiceId);
$invoiceRepository = $this->getMockBuilder('Magento\Sales\Api\InvoiceRepositoryInterface')
->disableOriginalConstructor()
->getMock();
$invoiceRepository->expects($this->any())
->method('get')
->willReturn(null);
$this->objectManager->expects($this->at(0))
->method('create')
->with('Magento\Sales\Api\InvoiceRepositoryInterface')
->willReturn($invoiceRepository);
$this->resultForwardFactory->expects($this->any())
->method('create')
->willReturn($this->resultForward);
$this->resultForward->expects($this->once())
->method('forward')
->with('noroute')
->willReturnSelf();
$this->assertInstanceOf('Magento\Backend\Model\View\Result\Forward', $this->invoiceEmail->executeInternal());
}
示例7: testExecuteNoInvoice
/**
* @return void
*/
public function testExecuteNoInvoice()
{
$invoiceId = 2;
$this->requestMock->expects($this->once())->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId));
$this->invoiceRepository->expects($this->once())->method('get')->willReturn(null);
$resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->setMethods([])->getMock();
$resultForward->expects($this->once())->method('forward')->with('noroute')->will($this->returnSelf());
$this->resultForwardFactoryMock->expects($this->once())->method('create')->will($this->returnValue($resultForward));
$this->assertSame($resultForward, $this->controller->execute());
}
示例8: testExecuteNoShipment
/**
* Run test execute method (no shipment)
*/
public function testExecuteNoShipment()
{
$orderId = 1;
$shipmentId = 1;
$shipment = [];
$tracking = [];
$this->loadShipment($orderId, $shipmentId, $shipment, $tracking, null, false);
$this->resultForwardFactoryMock->expects($this->once())->method('create')->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
$this->assertEquals($this->resultForwardMock, $this->controller->execute());
}
示例9: setUp
protected function setUp()
{
$objectManagerHelper = new ObjectManagerHelper($this);
$context = $this->getMock('Magento\\Backend\\App\\Action\\Context', [], [], '', false);
$this->request = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getParam', 'getPost', 'getPostValue', 'get', 'has', 'setModuleName', 'setActionName', 'initForward', 'setDispatched', 'getModuleName', 'getActionName', 'getCookie']);
$response = $this->getMockForAbstractClass('Magento\\Framework\\App\\ResponseInterface', [], '', false, true, true, []);
$context->expects($this->any())->method('getResponse')->willReturn($response);
$context->expects($this->any())->method('getRequest')->willReturn($this->request);
$this->messageManager = $this->getMock('Magento\\Framework\\Message\\ManagerInterface', [], [], '', false);
$context->expects($this->any())->method('getMessageManager')->willReturn($this->messageManager);
$this->eventManager = $this->getMock('Magento\\Framework\\Event\\ManagerInterface', [], [], '', false);
$context->expects($this->any())->method('getEventManager')->willReturn($this->eventManager);
$this->objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
$context->expects($this->any())->method('getObjectManager')->willReturn($this->objectManager);
$this->session = $this->getMock('Magento\\Backend\\Model\\Session\\Quote', [], [], '', false);
$context->expects($this->any())->method('getSession')->willReturn($this->session);
$this->escaper = $this->getMock('Magento\\Framework\\Escaper', ['escapeHtml'], [], '', false);
$this->resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->getMock();
$this->resultForwardFactory = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\ForwardFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultForwardFactory->expects($this->once())->method('create')->willReturn($this->resultForward);
$this->processData = $objectManagerHelper->getObject('Magento\\Sales\\Controller\\Adminhtml\\Order\\Create\\ProcessData', ['context' => $context, 'escaper' => $this->escaper, 'resultForwardFactory' => $this->resultForwardFactory]);
}
示例10: testExecuteNoInvoice
/**
* @return void
*/
public function testExecuteNoInvoice()
{
$invoiceId = 2;
$this->requestMock->expects($this->once())->method('getParam')->with('invoice_id')->will($this->returnValue($invoiceId));
$invoiceMock = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Invoice')->disableOriginalConstructor()->setMethods([])->getMock();
$invoiceMock->expects($this->once())->method('load')->willReturn(null);
$this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Sales\\Model\\Order\\Invoice')->willReturn($invoiceMock);
$this->messageManagerMock->expects($this->never())->method('addError');
$this->messageManagerMock->expects($this->never())->method('addSuccess');
$resultForward = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Forward')->disableOriginalConstructor()->setMethods([])->getMock();
$resultForward->expects($this->once())->method('forward')->with('noroute')->will($this->returnSelf());
$this->resultForwardFactoryMock->expects($this->once())->method('create')->will($this->returnValue($resultForward));
$this->assertSame($resultForward, $this->controller->execute());
}
示例11: testExecuteNoCreditmemo
/**
* @return void
*/
public function testExecuteNoCreditmemo()
{
$this->requestMock->expects($this->any())
->method('getParam')
->withAnyParameters()
->willReturnArgument(0);
$this->loaderMock->expects($this->once())
->method('load')
->willReturn(false);
$this->resultForwardFactoryMock->expects($this->once())
->method('create')
->willReturn($this->resultForwardMock);
$this->resultForwardMock->expects($this->once())
->method('forward')
->with('noroute')
->willReturnSelf();
$this->assertInstanceOf(
'Magento\Backend\Model\View\Result\Forward',
$this->controller->executeInternal()
);
}