Commit b9fb97d6 by Paul Klimov

Getters for 'yii\swiftmailer\Message' fixed.

parent 44bdb65d
......@@ -108,7 +108,7 @@ class Mailer extends BaseMailer
{
$address = $message->getTo();
if (is_array($address)) {
$address = implode(', ', $address);
$address = implode(', ', array_keys($address));
}
Yii::trace('Sending email "' . $message->getSubject() . '" to "' . $address . '"', __METHOD__);
return $this->getSwiftMailer()->send($message->getSwiftMessage()) > 0;
......
......@@ -44,7 +44,7 @@ class Message extends BaseMessage
*/
public function getCharset()
{
$this->getSwiftMessage()->getCharset();
return $this->getSwiftMessage()->getCharset();
}
/**
......@@ -61,7 +61,7 @@ class Message extends BaseMessage
*/
public function getFrom()
{
$this->getSwiftMessage()->getFrom();
return $this->getSwiftMessage()->getFrom();
}
/**
......@@ -78,7 +78,7 @@ class Message extends BaseMessage
*/
public function getReplyTo()
{
$this->getSwiftMessage()->getReplyTo();
return $this->getSwiftMessage()->getReplyTo();
}
/**
......@@ -95,7 +95,7 @@ class Message extends BaseMessage
*/
public function getTo()
{
$this->getSwiftMessage()->getTo();
return $this->getSwiftMessage()->getTo();
}
/**
......@@ -112,7 +112,7 @@ class Message extends BaseMessage
*/
public function getCc()
{
$this->getSwiftMessage()->getCc();
return $this->getSwiftMessage()->getCc();
}
/**
......@@ -129,7 +129,7 @@ class Message extends BaseMessage
*/
public function getBcc()
{
$this->getSwiftMessage()->getBcc();
return $this->getSwiftMessage()->getBcc();
}
/**
......@@ -146,7 +146,7 @@ class Message extends BaseMessage
*/
public function getSubject()
{
$this->getSwiftMessage()->getSubject();
return $this->getSwiftMessage()->getSubject();
}
/**
......
......@@ -115,6 +115,42 @@ class MessageTest extends VendorTestCase
/**
* @depends testGetSwiftMessage
*/
public function testSetGet()
{
$message = new Message();
$charset = 'utf-16';
$message->setCharset($charset);
$this->assertEquals($charset, $message->getCharset(), 'Unable to set charset!');
$subject = 'Test Subject';
$message->setSubject($subject);
$this->assertEquals($subject, $message->getSubject(), 'Unable to set subject!');
$from = 'from@somedomain.com';
$message->setFrom($from);
$this->assertContains($from, array_keys($message->getFrom()), 'Unable to set from!');
$replyTo = 'reply-to@somedomain.com';
$message->setReplyTo($replyTo);
$this->assertContains($replyTo, array_keys($message->getReplyTo()), 'Unable to set replyTo!');
$to = 'someuser@somedomain.com';
$message->setTo($to);
$this->assertContains($to, array_keys($message->getTo()), 'Unable to set to!');
$cc = 'ccuser@somedomain.com';
$message->setCc($cc);
$this->assertContains($cc, array_keys($message->getCc()), 'Unable to set cc!');
$bcc = 'bccuser@somedomain.com';
$message->setBcc($bcc);
$this->assertContains($bcc, array_keys($message->getBcc()), 'Unable to set bcc!');
}
/**
* @depends testGetSwiftMessage
*/
public function testSetupHeaders()
{
$charset = 'utf-16';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment