Пример #1
0
 function it_encodes_password(EncoderFactoryInterface $encoderFactory, PasswordEncoderInterface $passwordEncoder, CredentialsHolderInterface $user)
 {
     $user->getPlainPassword()->willReturn('topSecretPlainPassword');
     $user->getSalt()->willReturn('typicalSalt');
     $encoderFactory->getEncoder(get_class($user->getWrappedObject()))->willReturn($passwordEncoder);
     $passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
     $this->encode($user)->shouldReturn('topSecretEncodedPassword');
 }
 function it_encodes_password(CredentialsHolderInterface $user)
 {
     $user->getPlainPassword()->willReturn('myPassword');
     $user->getSalt()->willReturn('typicalSalt');
     $this->encode($user)->shouldReturn('G1DuArwJiu+4Ctk9p2965gC3SXjGcom6gNhmV0OGUm79Kb9Anm5GWg==');
 }
Пример #3
0
 /**
  * {@inheritdoc}
  *
  * @throws \LogicException when the algorithm is not supported
  */
 public function encode(CredentialsHolderInterface $user)
 {
     return $this->encodePassword($user->getPlainPassword(), $user->getSalt());
 }