From 7ce895bf5e0531b96b2cf0692b9da3814fb742f8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 10 Jan 2016 12:49:43 +0100 Subject: Use HTML email for 2FA Related to #1490 --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 47 +++++++++++++--------- .../UserBundle/Resources/config/services.yml | 2 +- .../Resources/translations/wallabag_user.en.yml | 7 ++-- .../Resources/translations/wallabag_user.fr.yml | 7 ++-- .../views/TwoFactor/email_auth_code.html.twig | 18 +++++++++ .../UserBundle/Tests/Mailer/AuthCodeMailerTest.php | 20 ++++----- 6 files changed, 62 insertions(+), 39 deletions(-) create mode 100644 src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig (limited to 'src/Wallabag') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index be370e71..c04720ae 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -20,11 +20,11 @@ class AuthCodeMailer implements AuthCodeMailerInterface private $mailer; /** - * Translator for email content. + * Twig to render the html's email. * - * @var TranslatorInterface + * @var \Twig_Environment */ - private $translator; + private $twig; /** * Sender email address. @@ -50,16 +50,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Initialize the auth code mailer with the SwiftMailer object. * - * @param \Swift_Mailer $mailer - * @param TranslatorInterface $translator - * @param string $senderEmail - * @param string $senderName - * @param string $supportUrl + * @param \Swift_Mailer $mailer + * @param \Twig_Environment $twig + * @param string $senderEmail + * @param string $senderName + * @param string $supportUrl */ - public function __construct(\Swift_Mailer $mailer, TranslatorInterface $translator, $senderEmail, $senderName, $supportUrl) + public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl) { $this->mailer = $mailer; - $this->translator = $translator; + $this->twig = $twig; $this->senderEmail = $senderEmail; $this->senderName = $senderName; $this->supportUrl = $supportUrl; @@ -72,20 +72,27 @@ class AuthCodeMailer implements AuthCodeMailerInterface */ public function sendAuthCode(TwoFactorInterface $user) { + $template = $this->twig->loadTemplate('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig'); + + $subject = $template->renderBlock('subject', array()); + $bodyHtml = $template->renderBlock('body_html', [ + 'user' => $user->getName(), + 'code' => $user->getEmailAuthCode(), + 'support' => $this->supportUrl, + ]); + $bodyText = $template->renderBlock('body_text', [ + 'user' => $user->getName(), + 'code' => $user->getEmailAuthCode(), + 'support' => $this->supportUrl, + ]); + $message = new \Swift_Message(); $message ->setTo($user->getEmail()) ->setFrom($this->senderEmail, $this->senderName) - ->setSubject($this->translator->trans('auth_code.mailer.subject', array(), 'wallabag_user')) - ->setBody($this->translator->trans( - 'auth_code.mailer.body', - [ - '%user%' => $user->getName(), - '%code%' => $user->getEmailAuthCode(), - '%support%' => $this->supportUrl, - ], - 'wallabag_user' - )) + ->setSubject($subject) + ->setBody($bodyText, 'text/plain') + ->addPart($bodyHtml, 'text/html') ; $this->mailer->send($message); diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index 9109b6a3..aa2fd8b9 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -3,7 +3,7 @@ services: class: Wallabag\UserBundle\Mailer\AuthCodeMailer arguments: - "@mailer" - - "@translator" + - "@twig" - "%scheb_two_factor.email.sender_email%" - "%scheb_two_factor.email.sender_name%" - "%wallabag_support_url%" diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml index f806d1d6..7298bb28 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml @@ -1,10 +1,9 @@ # Two factor mail auth_code.mailer.subject: 'Wallabag authentication Code' -auth_code.mailer.body: | - Hi %user%, - +auth_code.mailer.body.hello: "Hi %user%," +auth_code.mailer.body.content: | Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection. Here is the code: %code% - +auth_code.mailer.body.signature: | Please don't hesitate to contact us if you have any problems: %support% The wallabag team diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml index 386b2d9e..0c492d04 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml @@ -1,10 +1,9 @@ # Two factor mail auth_code.mailer.subject: "Code d'authentification wallabag" -auth_code.mailer.body: | - Bonjour %user%, - +auth_code.mailer.body.hello: "Bonjour %user%," +auth_code.mailer.body.content: | Comme vous avez activé la double authentification sur votre compte wallabag et que vous venez de vous connecter depuis un nouvel appareil (ordinateur, téléphone, etc.), nous vous envoyons un code pour valider votre connexion. Voici le code à renseigner: %code% - +auth_code.mailer.body.signature: | Si vous avez un problème de connexion, n'hésitez pas à contacter le support: %support% L'équipe wallabag diff --git a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig new file mode 100644 index 00000000..b726d142 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig @@ -0,0 +1,18 @@ +{% block subject %} +{{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }} +{% endblock %} + +{% block body_html %} +

{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}

+ +

{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }}

+ +

{{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }}

+{% endblock %} + +{% block body_text %} +{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} + +{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }} +{{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }} +{% endblock %} diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php index 61e960f9..857cdcbe 100644 --- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php +++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php @@ -27,7 +27,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase { protected $mailer; protected $spool; - protected $translator; + protected $twig; protected function setUp() { @@ -38,12 +38,11 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase ); $this->mailer = new \Swift_Mailer($transport); - $this->translator = new Translator('en'); - $this->translator->addLoader('array', new ArrayLoader()); - $this->translator->addResource('array', array( - 'auth_code.mailer.subject' => 'auth_code subject', - 'auth_code.mailer.body' => 'Hi %user%, here is the code: %code% and the support: %support%', - ), 'en', 'wallabag_user'); + $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => ' +{% block subject %}subject{% endblock %} +{% block body_html %}html body{% endblock %} +{% block body_text %}text body{% endblock %} +'))); } public function testSendEmail() @@ -56,7 +55,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase $authCodeMailer = new AuthCodeMailer( $this->mailer, - $this->translator, + $this->twig, 'nobody@test.io', 'wallabag test', 'http://0.0.0.0' @@ -69,7 +68,8 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase $msg = $this->spool->getMessages()[0]; $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); $this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom()); - $this->assertEquals('auth_code subject', $msg->getSubject()); - $this->assertContains('Hi Bob, here is the code: 666666 and the support: http://0.0.0.0', $msg->toString()); + $this->assertEquals('subject', $msg->getSubject()); + $this->assertContains('text body', $msg->toString()); + $this->assertContains('html body', $msg->toString()); } } -- cgit v1.2.3 From d1f1333f481a6814bb310c934b798d9f594f0b04 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 10 Jan 2016 13:01:00 +0100 Subject: CS --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 13 ++++++------- src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index c04720ae..fa682ae7 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -4,7 +4,6 @@ namespace Wallabag\UserBundle\Mailer; use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; -use Symfony\Component\Translation\TranslatorInterface; /** * Custom mailer for TwoFactorBundle email. @@ -50,11 +49,11 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Initialize the auth code mailer with the SwiftMailer object. * - * @param \Swift_Mailer $mailer - * @param \Twig_Environment $twig - * @param string $senderEmail - * @param string $senderName - * @param string $supportUrl + * @param \Swift_Mailer $mailer + * @param \Twig_Environment $twig + * @param string $senderEmail + * @param string $senderName + * @param string $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'); - $subject = $template->renderBlock('subject', array()); + $subject = $template->renderBlock('subject', array()); $bodyHtml = $template->renderBlock('body_html', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php index 857cdcbe..fbd7fdd7 100644 --- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php +++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php @@ -4,8 +4,6 @@ namespace Wallabag\UserBundle\Tests\Mailer; use Wallabag\UserBundle\Entity\User; 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/ -- cgit v1.2.3 From 5f736213af209b0457e4e9d62f06fd5f46652f5f Mon Sep 17 00:00:00 2001 From: Alexandr Danilov Date: Tue, 19 Jan 2016 18:22:59 +0300 Subject: #1490 HTML in E-Mails --- .../views/TwoFactor/email_auth_code.html.twig | 100 ++++++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig index b726d142..849cd136 100644 --- a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig +++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig @@ -3,11 +3,105 @@ {% endblock %} {% block body_html %} -

{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}

+ -

{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }}

+ + + + + {{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }} + + + + + +
+ {{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} +
+ + + + + +
+ + + + + + + + + + + + + + +
logo +

Wallabag

+
{% trans %}on{% endtrans %} { wallabag_url }
+
 
+ +

{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}

+ +

{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }}

+ +

{{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }}

+ +
 
+ + + + + + +
{ wallabag_url }Powered by Wallabag
+ +
+ +
+ + + {% endblock %} {% block body_text %} -- cgit v1.2.3 From abd454c45633e335d9d63bcd250e760b968f8138 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 20 Jan 2016 17:43:10 +0100 Subject: Update HTML 2FA template Split paragraph in translation Inject wallabag_url for image in HTML template Remove username & password from config_dev.yml (null are already the default value) --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 16 ++++++++-- .../UserBundle/Resources/config/services.yml | 1 + .../Resources/translations/wallabag_user.en.yml | 10 +++---- .../Resources/translations/wallabag_user.fr.yml | 10 +++---- .../views/TwoFactor/email_auth_code.html.twig | 35 ++++++++++++---------- .../UserBundle/Tests/Mailer/AuthCodeMailerTest.php | 15 ++++++---- 6 files changed, 51 insertions(+), 36 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index fa682ae7..6b108dd3 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -46,6 +46,13 @@ class AuthCodeMailer implements AuthCodeMailerInterface */ private $supportUrl; + /** + * Url for the wallabag instance. + * + * @var string + */ + private $wallabagUrl; + /** * Initialize the auth code mailer with the SwiftMailer object. * @@ -54,14 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface * @param string $senderEmail * @param string $senderName * @param string $supportUrl + * @param string $wallabagUrl */ - public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl) + public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) { $this->mailer = $mailer; $this->twig = $twig; $this->senderEmail = $senderEmail; $this->senderName = $senderName; $this->supportUrl = $supportUrl; + $this->wallabagUrl = $wallabagUrl; } /** @@ -77,12 +86,13 @@ class AuthCodeMailer implements AuthCodeMailerInterface $bodyHtml = $template->renderBlock('body_html', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), - 'support' => $this->supportUrl, + 'support_url' => $this->supportUrl, + 'wallabag_url' => $this->wallabagUrl, ]); $bodyText = $template->renderBlock('body_text', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), - 'support' => $this->supportUrl, + 'support_url' => $this->supportUrl, ]); $message = new \Swift_Message(); diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index aa2fd8b9..93e04d59 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -7,3 +7,4 @@ services: - "%scheb_two_factor.email.sender_email%" - "%scheb_two_factor.email.sender_name%" - "%wallabag_support_url%" + - "%wallabag_url%" diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml index 7298bb28..4da6075f 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml @@ -1,9 +1,7 @@ # Two factor mail auth_code.mailer.subject: 'Wallabag authentication Code' auth_code.mailer.body.hello: "Hi %user%," -auth_code.mailer.body.content: | - Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection. - Here is the code: %code% -auth_code.mailer.body.signature: | - Please don't hesitate to contact us if you have any problems: %support% - The wallabag team +auth_code.mailer.body.first_para: "Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection." +auth_code.mailer.body.second_para: "Here is the code:" +auth_code.mailer.body.support: "Please don't hesitate to contact us if you have any problems:" +auth_code.mailer.body.signature: "The wallabag team" diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml index 0c492d04..b4448d3a 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml @@ -1,9 +1,7 @@ # Two factor mail auth_code.mailer.subject: "Code d'authentification wallabag" auth_code.mailer.body.hello: "Bonjour %user%," -auth_code.mailer.body.content: | - Comme vous avez activé la double authentification sur votre compte wallabag et que vous venez de vous connecter depuis un nouvel appareil (ordinateur, téléphone, etc.), nous vous envoyons un code pour valider votre connexion. - Voici le code à renseigner: %code% -auth_code.mailer.body.signature: | - Si vous avez un problème de connexion, n'hésitez pas à contacter le support: %support% - L'équipe wallabag +auth_code.mailer.body.first_para: "Comme vous avez activé la double authentification sur votre compte wallabag et que vous venez de vous connecter depuis un nouvel appareil (ordinateur, téléphone, etc.), nous vous envoyons un code pour valider votre connexion." +auth_code.mailer.body.second_para: "Voici le code à renseigner :" +auth_code.mailer.body.support: "Si vous avez un problème de connexion, n'hésitez pas à contacter le support :" +auth_code.mailer.body.signature: "L'équipe wallabag" diff --git a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig index 849cd136..69d23160 100644 --- a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig +++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig @@ -2,6 +2,17 @@ {{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }} {% endblock %} +{% block body_text %} +{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} + +{{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }} +{{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} {{ code }} + +{{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} {{ support_url }} + +{{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }} +{% endblock %} + {% block body_html %} @@ -63,10 +74,10 @@ - + @@ -75,10 +86,11 @@

{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}

-

{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }}

- -

{{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }}

+

{{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }}

+

{{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} {{ code }}

+

{{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} {{ support_url }}

+

{{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }}

@@ -87,8 +99,8 @@
logologo -

Wallabag

-
{% trans %}on{% endtrans %} { wallabag_url }
+

wallabag

+
{% trans %}on{% endtrans %} {{ wallabag_url }}
 
 
- - + +
{ wallabag_url }Powered by Wallabag{{ wallabag_url }}Powered by wallabag
@@ -103,10 +115,3 @@ {% endblock %} - -{% block body_text %} -{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} - -{{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }} -{{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }} -{% endblock %} diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php index fbd7fdd7..e3f43a7e 100644 --- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php +++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php @@ -36,11 +36,13 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase ); $this->mailer = new \Swift_Mailer($transport); - $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => ' + $twigTemplate = <<twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate))); } public function testSendEmail() @@ -56,6 +58,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase $this->twig, 'nobody@test.io', 'wallabag test', + 'http://0.0.0.0/support', 'http://0.0.0.0' ); @@ -67,7 +70,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); $this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom()); $this->assertEquals('subject', $msg->getSubject()); - $this->assertContains('text body', $msg->toString()); - $this->assertContains('html body', $msg->toString()); + $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); + $this->assertContains('html body 666666', $msg->toString()); } } -- cgit v1.2.3