/**
  * Add an user to the database.
  *
  * @param string $username The username.
  *
  * @param string $password The password.
  *
  * @return UserInformation
  */
 private function createUser($username, $password)
 {
     $user = new UserInformation(['username' => $username, 'acl' => UserInformationInterface::ROLE_ALL]);
     $user->set('password', $this->get('security.password_encoder')->encodePassword($user, $password));
     $user = $this->get('tenside.user_provider')->addUser($user)->refreshUser($user);
     return $user;
 }
 /**
  * Add the passed credentials in the database.
  *
  * @param string|UserInformation $user The username to remove.
  *
  * @return UserProviderFromConfig
  */
 public function removeUser($user)
 {
     $username = $user instanceof UserInformation ? $user->getUsername() : (string) $user;
     $this->configSource->set('auth-password/' . $username, null);
     return $this;
 }
 /**
  * Test the eraseCredentials() method.
  *
  * @return void
  */
 public function testEraseCredentials()
 {
     $user = new UserInformation(['password' => 'secure-hash']);
     $user->eraseCredentials();
     $this->assertNull($user->getPassword());
     $this->assertNull($user->getSalt());
 }