Exemple #1
0
 public function testExecute()
 {
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->checkoutSession->expects($this->once())->method('getLastOrderId')->will($this->returnValue(100));
     $customer = $this->getMock('\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $this->orderCustomerService->expects($this->once())->method('create')->with(100)->will($this->returnValue($customer));
     $this->action->executeInternal();
 }
Exemple #2
0
 public function testExecute()
 {
     $jsonFactoryMock = $this->getMock(\Magento\Framework\Controller\Result\JsonFactory::class, [], [], '', false);
     $this->objectManagerMock->expects($this->once())->method('get')->with(\Magento\Framework\Controller\Result\JsonFactory::class)->willReturn($jsonFactoryMock);
     $jsonMock = $this->getMock(\Magento\Framework\Controller\Result\Json::class, [], [], '', false);
     $jsonFactoryMock->expects($this->once())->method('create')->willReturn($jsonMock);
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->checkoutSession->expects($this->once())->method('getLastOrderId')->will($this->returnValue(100));
     $customer = $this->getMock('\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $this->orderCustomerService->expects($this->once())->method('create')->with(100)->will($this->returnValue($customer));
     $jsonMock->expects($this->once())->method('setData')->with(['errors' => false, 'message' => __('A letter with further instructions will be sent to your email.')])->willReturnSelf();
     $this->action->execute();
 }
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }