Example #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);
     }
 }
Example #2
0
 public function testSaveAction()
 {
     $userId = 1;
     $requestParams = ['password' => 'password', 'password_confirmation' => true, 'interface_locale' => 'US', 'username' => 'Foo', 'firstname' => 'Bar', 'lastname' => 'Dummy', 'email' => '*****@*****.**', \Magento\Backend\Block\System\Account\Edit\Form::IDENTITY_VERIFICATION_PASSWORD_FIELD => 'current_password'];
     $testedMessage = __('You saved the account.');
     $this->authSessionMock->expects($this->any())->method('getUser')->willReturn($this->userMock);
     $this->userMock->expects($this->any())->method('load')->will($this->returnSelf());
     $this->validatorMock->expects($this->once())->method('isValid')->with($this->equalTo($requestParams['interface_locale']))->willReturn(true);
     $this->managerMock->expects($this->any())->method('switchBackendInterfaceLocale');
     $this->objectManagerMock->expects($this->at(0))->method('get')->with($this->equalTo('Magento\\Backend\\Model\\Auth\\Session'))->willReturn($this->authSessionMock);
     $this->objectManagerMock->expects($this->at(1))->method('create')->with($this->equalTo('Magento\\User\\Model\\User'))->willReturn($this->userMock);
     $this->objectManagerMock->expects($this->at(2))->method('get')->with($this->equalTo('Magento\\Framework\\Validator\\Locale'))->willReturn($this->validatorMock);
     $this->objectManagerMock->expects($this->at(3))->method('get')->with($this->equalTo('Magento\\Backend\\Model\\Locale\\Manager'))->willReturn($this->managerMock);
     $this->userMock->expects($this->once())->method('save');
     $this->userMock->expects($this->once())->method('verifyIdentity')->willReturn(true);
     $this->userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
     $this->messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage));
     $this->userMock->setUserId($userId);
     $this->requestMock->setParams($requestParams);
     $this->controller->executeInternal();
 }