public function testExecuteException() { $email = '*****@*****.**'; $exception = new \Exception(__('Exception')); $this->request->expects($this->once())->method('getPost')->with('email')->willReturn($email); $this->accountManagement->expects($this->once())->method('initiatePasswordReset')->with($email, AccountManagement::EMAIL_RESET)->willThrowException($exception); $this->messageManager->expects($this->once())->method('addExceptionMessage')->with($exception, __('We\'re unable to send the password reset email.'))->willReturnSelf(); $this->resultRedirect->expects($this->once())->method('setPath')->with('*/*/forgotpassword')->willReturnSelf(); $this->controller->execute(); }