public function testSendMessage() { $client = $this->getClientMock(); $message = Message::create('*****@*****.**', '*****@*****.**')->setSubject('Foo Bar')->setHtmlContent('some content'); $client->expects($this->once())->method('sendMessage')->with($this->equalTo($message)); $mailer = new Mailer($client); $mailer->sendMessage('*****@*****.**', '*****@*****.**', 'Foo Bar', 'some content'); }
public function testSendMessage() { $client = $this->getClientMock(); $engine = $this->getEngineMock(); $message = Message::create('*****@*****.**', '*****@*****.**')->setSubject('Foo Bar')->setHtmlContent('some content'); $client->expects($this->once())->method('sendMessage')->with($this->equalTo($message)); $engine->expects($this->once())->method('render')->with($this->equalTo('email.twig'), $this->equalTo(array()))->will($this->returnValue('some content')); $mailer = new TemplatingEngineMailer($client, $engine); $mailer->sendMessage('*****@*****.**', '*****@*****.**', 'Foo Bar', 'email.twig'); }
public function testNormalize() { $normalizer = $this->getNormalizerMock(); $message = new Message('*****@*****.**', '*****@*****.**'); $this->assertEquals(array('from_email' => '*****@*****.**', 'from_name' => '', 'to' => array(array('email' => '*****@*****.**', 'name' => '', 'type' => 'to')), 'headers' => array(), 'html' => null, 'text' => null, 'subject' => null), $message->normalize($normalizer)); }
/** * Creates a new Message instance. * * @param mixed $recipients * @param mixed $sender * @param string $subject * @param string $content * * @return Message */ protected function createMessage($recipients, $sender, $subject, $content) { return Message::create($recipients, $sender)->setSubject($subject)->setHtmlContent($content); }