This commit is contained in:
Jeremy Benoist 2016-01-10 13:01:00 +01:00
parent 7ce895bf5e
commit d1f1333f48
2 changed files with 6 additions and 9 deletions

View file

@ -4,7 +4,6 @@ namespace Wallabag\UserBundle\Mailer;
use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* Custom mailer for TwoFactorBundle email. * Custom mailer for TwoFactorBundle email.
@ -50,11 +49,11 @@ class AuthCodeMailer implements AuthCodeMailerInterface
/** /**
* Initialize the auth code mailer with the SwiftMailer object. * Initialize the auth code mailer with the SwiftMailer object.
* *
* @param \Swift_Mailer $mailer * @param \Swift_Mailer $mailer
* @param \Twig_Environment $twig * @param \Twig_Environment $twig
* @param string $senderEmail * @param string $senderEmail
* @param string $senderName * @param string $senderName
* @param string $supportUrl * @param string $supportUrl
*/ */
public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl) public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl)
{ {
@ -74,7 +73,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
{ {
$template = $this->twig->loadTemplate('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig'); $template = $this->twig->loadTemplate('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig');
$subject = $template->renderBlock('subject', array()); $subject = $template->renderBlock('subject', array());
$bodyHtml = $template->renderBlock('body_html', [ $bodyHtml = $template->renderBlock('body_html', [
'user' => $user->getName(), 'user' => $user->getName(),
'code' => $user->getEmailAuthCode(), 'code' => $user->getEmailAuthCode(),

View file

@ -4,8 +4,6 @@ namespace Wallabag\UserBundle\Tests\Mailer;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Mailer\AuthCodeMailer; use Wallabag\UserBundle\Mailer\AuthCodeMailer;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
/** /**
* @see https://www.pmg.com/blog/integration-testing-swift-mailer/ * @see https://www.pmg.com/blog/integration-testing-swift-mailer/