本文整理汇总了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==');
}