/**
  * Process form
  *
  * @param AccountUser $accountUser
  * @return bool True on successful processing, false otherwise
  */
 public function process(AccountUser $accountUser)
 {
     if (in_array($this->request->getMethod(), ['POST', 'PUT'], true)) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             if (!$accountUser->getId()) {
                 if ($this->form->get('passwordGenerate')->getData()) {
                     $generatedPassword = $this->userManager->generatePassword(10);
                     $accountUser->setPlainPassword($generatedPassword);
                 }
                 if ($this->form->get('sendEmail')->getData()) {
                     $this->userManager->sendWelcomeEmail($accountUser);
                 }
             }
             $token = $this->securityFacade->getToken();
             if ($token instanceof OrganizationContextTokenInterface) {
                 $organization = $token->getOrganizationContext();
                 $accountUser->setOrganization($organization)->addOrganization($organization);
             }
             $this->userManager->updateUser($accountUser);
             return true;
         }
     }
     return false;
 }
 public function testRegisterConfirmationNotRequired()
 {
     $password = '******';
     $user = new AccountUser();
     $user->setConfirmed(false);
     $user->setPlainPassword($password);
     $this->configManager->expects($this->exactly(2))->method('get')->willReturnMap([['oro_b2b_account.confirmation_required', false, false, false], ['oro_b2b_account.send_password_in_welcome_email', false, false, true]]);
     $this->emailProcessor->expects($this->once())->method('sendWelcomeNotification')->with($user, $password);
     $this->userManager->register($user);
     $this->assertTrue($user->isConfirmed());
 }