/** * @param string $email * @throws \Symfony\Component\Security\Core\Exception\UsernameNotFoundException * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException * @return bool */ public function sendNewActivationLink($email) { if (($user = $this->findUserByUsernameOrEmail($email)) === null) { throw new UsernameNotFoundException(); } if ($user->isEnabled()) { throw new BadRequestHttpException('users.activation_link.user_already_enabled'); } if (($activationLink = $user->getActivationLink()) !== null) { $user->setActivationLink(null); $this->em->persist($user); $this->em->remove($activationLink); $this->em->flush(); } $this->activationLinkManager->createActivationLink($user); $this->activationLinkManager->sendValidationMail($user); return true; }
public function testSendValidationMail() { $user = new Member(); $this->manager->createActivationLink($user); $this->assertTrue($this->manager->sendValidationMail($user)); }