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


PHP ForwardFactory::expects方法代码示例

本文整理汇总了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());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:PrintActionTest.php

示例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());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:IndexTest.php

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

示例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());
    }
开发者ID:nblair,项目名称:magescotch,代码行数:35,代码来源:CaptureTest.php

示例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());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:CancelTest.php

示例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());
    }
开发者ID:nblair,项目名称:magescotch,代码行数:29,代码来源:EmailTest.php

示例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());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:CancelTest.php

示例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());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:ViewTest.php

示例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]);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:22,代码来源:ProcessDataTest.php

示例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());
 }
开发者ID:opexsw,项目名称:magento2,代码行数:17,代码来源:VoidTest.php

示例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()
        );
    }
开发者ID:nblair,项目名称:magescotch,代码行数:25,代码来源:VoidTest.php


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