public function testSendEmailWithOutEmailLocaleAndNoAttachment()
 {
     $mocks = $this->getMockSetup(array($this, 'returnOne'));
     $mocks['baseTemplateMock']->expects($this->exactly(2))->method('renderBlock')->will($this->returnCallback(array($this, 'renderBlockCallback')));
     $mocks['translator']->expects($this->once())->method('getLocale')->will($this->returnValue("en"));
     $mocks['router']->expects($this->exactly(0))->method('generate')->will($this->returnCallback(array($this, 'generateCallback')));
     $azineMailer = new AzineTwigSwiftMailer($mocks['mailer'], $mocks['router'], $mocks['twig'], $mocks['translator'], $mocks['templateProvider'], $mocks['managerRegistry'], $mocks['trackingCodeImgBuilder'], $mocks['emailTwigExtension'], $mocks['parameters']);
     $failedRecipients = array();
     $from = "*****@*****.**";
     $fromName = "FromName";
     $to = "*****@*****.**";
     $toName = "ToName";
     $cc = "*****@*****.**";
     $ccName = "CcName";
     $bcc = "*****@*****.**";
     $bccName = "BccName";
     $replyTo = "*****@*****.**";
     $replyToName = "ReplyToName";
     $subject = "some dummy test subject";
     $params = array();
     $template = AzineTemplateProvider::BASE_TEMPLATE . ".txt.twig";
     $attachments = array();
     $emailLocale = null;
     $sentCount = $azineMailer->sendEmail($failedRecipients, $subject, $from, $fromName, $to, $toName, $cc, $ccName, $bcc, $bccName, $replyTo, $replyToName, $params, $template, $attachments, $emailLocale);
     $this->assertEquals(1, $sentCount, "One email should have been sent.");
 }
 public function testSendResettingEmailMessage()
 {
     $mocks = $this->getMockSetup();
     $user = $this->getUserMock();
     // as the subject from FOS-templates is embeded in the twig-template, the render-block is called 3 instead of only 2 times
     $mocks['baseTemplateMock']->expects($this->exactly(3))->method('renderBlock')->will($this->returnCallback(array($this, 'renderBlockCallback')));
     $mocks['parameters']['template'] = array();
     $mocks['parameters']['template']['resetting'] = AzineTemplateProvider::FOS_USER_PWD_RESETTING_TEMPLATE . ".txt.twig";
     $mocks['parameters']['from_email'] = array();
     $mocks['parameters']['from_email']['resetting'] = '*****@*****.**';
     $mocks['translator']->expects($this->exactly(2))->method('getLocale')->will($this->returnValue("en"));
     $mocks['router']->expects($this->once())->method('generate')->will($this->returnCallback(array($this, 'generateCallback')));
     $azineMailer = new AzineTwigSwiftMailer($mocks['mailer'], $mocks['router'], $mocks['twig'], $mocks['logger'], $mocks['translator'], $mocks['templateProvider'], $mocks['entityManager'], $mocks['parameters']);
     $azineMailer->sendResettingEmailMessage($user);
 }