public function it_can_create_new_auth_records($authenticationMapper, User $user5, AuthenticationRecordInterface $newAuth)
 {
     $newAuth->getSessionKey()->willReturn(KeyFactory::generateEncryptionKey()->getRawKeyMaterial());
     $newAuth->getUsername()->willReturn('email');
     $newAuth->getUserId()->willReturn(5);
     $user5->getId()->willReturn(5);
     $authenticationMapper->save(Argument::type(AuthenticationRecordInterface::class))->shouldBeCalled();
     $authenticationMapper->create(Argument::type('integer'), Argument::type('string'), Argument::type('string'), Argument::type('string'))->willReturn($newAuth);
     $this->create($user5, 'userC', 'beestring')->shouldBeAnInstanceOf(AuthenticationRecordInterface::class);
 }
 /**
  * Resalt a user's authentication table salt
  *
  * @param AuthenticationRecordInterface $auth
  *
  * @return AuthenticationRecordInterface
  */
 private function resetAuthenticationKey(AuthenticationRecordInterface $auth) : AuthenticationRecordInterface
 {
     $key = KeyFactory::generateEncryptionKey();
     $auth->setSessionKey($key->getRawKeyMaterial());
     $this->authenticationProvider->update($auth);
     return $auth;
 }