Пример #1
0
 function it_should_refresh_by_email($manager, MemberInterface $member, MemberInterface $found)
 {
     $member->getId()->shouldBeCalled()->willReturn(1);
     $manager->getClass()->shouldBeCalled()->willReturn('Zaralab\\Model\\MemberInterface');
     $manager->findMemberById(1)->shouldBeCalled()->willReturn($found);
     $this->refreshUser($member)->shouldReturn($found);
 }
Пример #2
0
 function it_should_update_password_from_plain($encoder, MemberInterface $member)
 {
     $encoder->encodePassword('plain_password', 'salt')->shouldBeCalled()->willReturn('password_encoded');
     $member->getPlainPassword()->shouldBeCalled()->willReturn('plain_password');
     $member->getSalt()->shouldBeCalled()->willReturn('salt');
     $member->setPassword('password_encoded')->shouldBeCalled();
     $member->eraseCredentials()->shouldBeCalled();
     $this->updatePassword($member);
 }
Пример #3
0
 /**
  * Updates member password
  *
  * @param MemberInterface $member
  */
 public function updatePassword(MemberInterface $member)
 {
     if (0 !== strlen($password = $member->getPlainPassword())) {
         $encoder = $this->getEncoder();
         $member->setPassword($encoder->encodePassword($password, $member->getSalt()));
         $member->eraseCredentials();
     }
 }