本文整理匯總了PHP中Sylius\Component\User\Model\UserInterface::getSalt方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserInterface::getSalt方法的具體用法?PHP UserInterface::getSalt怎麽用?PHP UserInterface::getSalt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sylius\Component\User\Model\UserInterface
的用法示例。
在下文中一共展示了UserInterface::getSalt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_encodes_password(EncoderFactoryInterface $encoderFactory, PasswordEncoderInterface $passwordEncoder, UserInterface $user)
{
$user->getPlainPassword()->willReturn('topSecretPlainPassword');
$user->getSalt()->willReturn('typicalSalt');
$encoderFactory->getEncoder($user)->willReturn($passwordEncoder);
$passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
$this->encode($user)->shouldReturn('topSecretEncodedPassword');
}
示例2: it_does_nothing_if_plain_password_is_empty
public function it_does_nothing_if_plain_password_is_empty($encoderFactory, PasswordEncoderInterface $encoder, UserInterface $user)
{
$user->getPlainPassword()->willReturn('');
$user->getSalt()->willReturn('typicalSalt');
$encoderFactory->getEncoder($user)->shouldNotBeCalled();
$encoder->encodePassword('', 'typicalSalt')->shouldNotBeCalled();
$user->setPassword(Argument::any())->shouldNotBeCalled();
$user->eraseCredentials()->shouldNotBeCalled();
$this->updatePassword($user);
}
示例3: encode
/**
* {@inheritdoc}
*
* @throws \LogicException when the algorithm is not supported
*/
public function encode(UserInterface $user)
{
return $this->encodePassword($user->getPlainPassword(), $user->getSalt());
}
示例4:
function it_encodes_password(UserInterface $user)
{
$user->getPlainPassword()->willReturn('myPassword');
$user->getSalt()->willReturn('typicalSalt');
$this->encode($user)->shouldReturn('G1DuArwJiu+4Ctk9p2965gC3SXjGcom6gNhmV0OGUm79Kb9Anm5GWg==');
}