コード例 #1
0
 /**
  * @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
0
ファイル: IndexTest.php プロジェクト: Doability/magento2dev
 /**
  * @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
0
ファイル: SaveTest.php プロジェクト: Doability/magento2dev
 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
0
ファイル: CaptureTest.php プロジェクト: nblair/magescotch
    /**
     * @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
0
 /**
  * @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
0
ファイル: EmailTest.php プロジェクト: nblair/magescotch
    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
0
ファイル: CancelTest.php プロジェクト: Doability/magento2dev
 /**
  * @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
0
ファイル: ViewTest.php プロジェクト: pradeep-wagento/magento2
 /**
  * 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
0
 public function testEmailNoInvoice()
 {
     $invoiceId = 10000031;
     $invoiceClassName = 'Magento\\Sales\\Model\\Order\\Invoice';
     $invoice = $this->getMock($invoiceClassName, [], [], '', false);
     $this->request->expects($this->once())->method('getParam')->with('invoice_id')->willReturn($invoiceId);
     $this->objectManager->expects($this->at(0))->method('create')->with($invoiceClassName)->willReturn($invoice);
     $invoice->expects($this->once())->method('load')->with($invoiceId)->willReturn(null);
     $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->execute());
 }
コード例 #10
0
ファイル: ProcessDataTest.php プロジェクト: tingyeeh/magento2
 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]);
 }
コード例 #11
0
ファイル: VoidTest.php プロジェクト: opexsw/magento2
 /**
  * @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());
 }
コード例 #12
0
ファイル: VoidTest.php プロジェクト: nblair/magescotch
    /**
     * @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()
        );
    }