aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Tests/Mailer
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle/Tests/Mailer')
-rw-r--r--src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php20
1 files changed, 10 insertions, 10 deletions
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
27{ 27{
28 protected $mailer; 28 protected $mailer;
29 protected $spool; 29 protected $spool;
30 protected $translator; 30 protected $twig;
31 31
32 protected function setUp() 32 protected function setUp()
33 { 33 {
@@ -38,12 +38,11 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
38 ); 38 );
39 $this->mailer = new \Swift_Mailer($transport); 39 $this->mailer = new \Swift_Mailer($transport);
40 40
41 $this->translator = new Translator('en'); 41 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => '
42 $this->translator->addLoader('array', new ArrayLoader()); 42{% block subject %}subject{% endblock %}
43 $this->translator->addResource('array', array( 43{% block body_html %}html body{% endblock %}
44 'auth_code.mailer.subject' => 'auth_code subject', 44{% block body_text %}text body{% endblock %}
45 'auth_code.mailer.body' => 'Hi %user%, here is the code: %code% and the support: %support%', 45')));
46 ), 'en', 'wallabag_user');
47 } 46 }
48 47
49 public function testSendEmail() 48 public function testSendEmail()
@@ -56,7 +55,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
56 55
57 $authCodeMailer = new AuthCodeMailer( 56 $authCodeMailer = new AuthCodeMailer(
58 $this->mailer, 57 $this->mailer,
59 $this->translator, 58 $this->twig,
60 'nobody@test.io', 59 'nobody@test.io',
61 'wallabag test', 60 'wallabag test',
62 'http://0.0.0.0' 61 'http://0.0.0.0'
@@ -69,7 +68,8 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
69 $msg = $this->spool->getMessages()[0]; 68 $msg = $this->spool->getMessages()[0];
70 $this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); 69 $this->assertArrayHasKey('test@wallabag.io', $msg->getTo());
71 $this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom()); 70 $this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom());
72 $this->assertEquals('auth_code subject', $msg->getSubject()); 71 $this->assertEquals('subject', $msg->getSubject());
73 $this->assertContains('Hi Bob, here is the code: 666666 and the support: http://0.0.0.0', $msg->toString()); 72 $this->assertContains('text body', $msg->toString());
73 $this->assertContains('html body', $msg->toString());
74 } 74 }
75} 75}