/**
  * @param array $exceptionData
  *
  * @dataProvider exceptionDataProvider
  */
 public function testExecuteWithException($exceptionData)
 {
     $username = '******';
     $password = '******';
     $this->session->expects($this->once())->method('isLoggedIn')->willReturn(false);
     $this->formkeyValidator->expects($this->once())->method('validate')->with($this->request)->willReturn(true);
     $this->request->expects($this->once())->method('isPost')->willReturn(true);
     $this->request->expects($this->once())->method('getPost')->with('login')->willReturn(['username' => $username, 'password' => $password]);
     $exception = new $exceptionData['exception'](__($exceptionData['message']));
     $this->accountManagement->expects($this->once())->method('authenticate')->with($username, $password)->willThrowException($exception);
     $this->mockExceptions($exceptionData['exception'], $username);
     $this->accountRedirect->expects($this->once())->method('getRedirect')->willReturn($this->redirect);
     $this->assertSame($this->redirect, $this->controller->execute());
 }
Ejemplo n.º 2
-1
 /**
  * Product edit form
  *
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     $this->messageManager->addSuccess('Message from new controller.');
     return parent::execute();
 }