Esempio n. 1
0
 /**
  * {@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);
     }
 }
 public function testExecuteWithEmptyPassword()
 {
     $token = 'token';
     $customerId = '11';
     $password = '';
     $passwordConfirmation = '';
     $this->requestMock->expects($this->exactly(2))->method('getQuery')->willReturnMap([['token', $token], ['id', $customerId]]);
     $this->requestMock->expects($this->exactly(2))->method('getPost')->willReturnMap([['password', $password], ['password_confirmation', $passwordConfirmation]]);
     $this->messageManagerMock->expects($this->once())->method('addError')->with(__('Please enter a new password.'))->willReturnSelf();
     /** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
     $redirectMock = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Redirect')->disableOriginalConstructor()->getMock();
     $this->redirectFactoryMock->expects($this->once())->method('create')->with([])->willReturn($redirectMock);
     $redirectMock->expects($this->once())->method('setPath')->with('*/*/createPassword', ['id' => $customerId, 'token' => $token])->willReturnSelf();
     $this->assertEquals($redirectMock, $this->model->execute());
 }