public function generatePassword(PasswordEncoderInterface $encoder, HasPassword $object)
 {
     $salt = '';
     if (true === $object instanceof HasSalt || true === $object instanceof UserInterface) {
         $salt = $object->getSalt();
     }
     return $encoder->encodePassword($object->getPlainPassword(), $salt);
 }
 function let(EncoderFactoryInterface $factory, PasswordEncoderInterface $encoder, HasPassword $user, LifecycleEventArgs $event)
 {
     $user->implement('Symfony\\Component\\Security\\Core\\User\\UserInterface');
     $user->getPlainPassword()->willReturn('password');
     $user->getSalt()->willReturn('salt');
     $user->setPassword(Argument::any())->willReturn(null);
     $user->eraseCredentials()->willReturn(null);
     $event->getObject()->willReturn($user);
     $factory->getEncoder($user)->willReturn($encoder);
     $encoder->encodePassword('password', 'salt')->willReturn('encoded');
     $this->beConstructedWith($factory);
 }