X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FUserBundle%2FTests%2FMailer%2FAuthCodeMailerTest.php;h=00967051b25e1b9df8973201d7c6888a10e1be23;hb=41c9eecfa728df7d8734ca1b0a69c55c93aafcea;hp=fbd7fdd75bd9f01bcc462c1de25bdfb84abeb657;hpb=d1f1333f481a6814bb310c934b798d9f594f0b04;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php index fbd7fdd7..00967051 100644 --- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php +++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php @@ -26,6 +26,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase protected $mailer; protected $spool; protected $twig; + protected $config; protected function setUp() { @@ -36,11 +37,21 @@ 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(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate])); + + $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') + ->disableOriginalConstructor() + ->getMock(); + + $this->config->expects($this->any()) + ->method('get') + ->willReturn('http://0.0.0.0/support'); } public function testSendEmail() @@ -56,7 +67,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase $this->twig, 'nobody@test.io', 'wallabag test', - 'http://0.0.0.0' + $this->config ); $authCodeMailer->sendAuthCode($user); @@ -65,9 +76,9 @@ 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(['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()); } }