Commit ad7761f9 by Paul Klimov

Method 'yii\mail\MessageInterface::compose()' renamed to 'yii\mail\MessageInterface::message()'.

parent 3d1a625c
...@@ -36,7 +36,7 @@ use Yii; ...@@ -36,7 +36,7 @@ use Yii;
* *
* @see http://swiftmailer.org * @see http://swiftmailer.org
* *
* @method Message compose(array $config = []) creates new message instance from given configuration. * @method Message message(array $config = []) creates new message instance from given configuration.
* *
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
......
...@@ -118,7 +118,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont ...@@ -118,7 +118,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
* for the configuration format details. * for the configuration format details.
* @return MessageInterface message instance. * @return MessageInterface message instance.
*/ */
public function compose(array $config = []) public function message(array $config = [])
{ {
$config = array_merge($this->messageConfig, $config); $config = array_merge($this->messageConfig, $config);
if (!array_key_exists('class', $config)) { if (!array_key_exists('class', $config)) {
......
...@@ -22,7 +22,7 @@ interface MailerInterface ...@@ -22,7 +22,7 @@ interface MailerInterface
* @param array $config message configuration. * @param array $config message configuration.
* @return MessageInterface message instance. * @return MessageInterface message instance.
*/ */
public function compose(array $config = []); public function message(array $config = []);
/** /**
* Sends the given email message. * Sends the given email message.
......
...@@ -63,7 +63,7 @@ class MessageTest extends VendorTestCase ...@@ -63,7 +63,7 @@ class MessageTest extends VendorTestCase
*/ */
protected function createTestMessage() protected function createTestMessage()
{ {
return Yii::$app->getComponent('mail')->compose(); return Yii::$app->getComponent('mail')->message();
} }
/** /**
......
...@@ -96,7 +96,7 @@ class BaseMailerTest extends TestCase ...@@ -96,7 +96,7 @@ class BaseMailerTest extends TestCase
public function testComposeMessage() public function testComposeMessage()
{ {
$mailer = new Mailer(); $mailer = new Mailer();
$message = $mailer->compose(); $message = $mailer->message();
$this->assertTrue(is_object($message), 'Unable to create message instance!'); $this->assertTrue(is_object($message), 'Unable to create message instance!');
$this->assertEquals($mailer->messageClass, get_class($message), 'Invalid message class!'); $this->assertEquals($mailer->messageClass, get_class($message), 'Invalid message class!');
...@@ -104,7 +104,7 @@ class BaseMailerTest extends TestCase ...@@ -104,7 +104,7 @@ class BaseMailerTest extends TestCase
'id' => 'test-id', 'id' => 'test-id',
'encoding' => 'test-encoding', 'encoding' => 'test-encoding',
); );
$message = $mailer->compose($messageConfig); $message = $mailer->message($messageConfig);
foreach ($messageConfig as $name => $value) { foreach ($messageConfig as $name => $value) {
$this->assertEquals($value, $message->$name, 'Unable to apply message config!'); $this->assertEquals($value, $message->$name, 'Unable to apply message config!');
...@@ -135,7 +135,7 @@ class BaseMailerTest extends TestCase ...@@ -135,7 +135,7 @@ class BaseMailerTest extends TestCase
$messageConfig = array_merge($notPropertyConfig, $propertyConfig); $messageConfig = array_merge($notPropertyConfig, $propertyConfig);
$mailer->messageConfig = $messageConfig; $mailer->messageConfig = $messageConfig;
$message = $mailer->compose(); $message = $mailer->message();
foreach ($notPropertyConfig as $name => $value) { foreach ($notPropertyConfig as $name => $value) {
$this->assertEquals($value, $message->{'_' . $name}); $this->assertEquals($value, $message->{'_' . $name});
...@@ -181,7 +181,7 @@ class BaseMailerTest extends TestCase ...@@ -181,7 +181,7 @@ class BaseMailerTest extends TestCase
$messageConfig = array( $messageConfig = array(
'renderText' => [$viewName], 'renderText' => [$viewName],
); );
$message = $mailer->compose($messageConfig); $message = $mailer->message($messageConfig);
$this->assertEquals($viewFileContent, $message->_text); $this->assertEquals($viewFileContent, $message->_text);
} }
......
...@@ -43,7 +43,7 @@ class BaseMessageTest extends TestCase ...@@ -43,7 +43,7 @@ class BaseMessageTest extends TestCase
public function testRender() public function testRender()
{ {
$mailer = $this->getMailer(); $mailer = $this->getMailer();
$message = $mailer->compose(); $message = $mailer->message();
$viewName = 'test/text/view'; $viewName = 'test/text/view';
$message->renderText($viewName); $message->renderText($viewName);
...@@ -62,7 +62,7 @@ class BaseMessageTest extends TestCase ...@@ -62,7 +62,7 @@ class BaseMessageTest extends TestCase
public function testComposeBody() public function testComposeBody()
{ {
$mailer = $this->getMailer(); $mailer = $this->getMailer();
$message = $mailer->compose(); $message = $mailer->message();
$viewName = 'test/html/view'; $viewName = 'test/html/view';
$message->renderBody($viewName); $message->renderBody($viewName);
...@@ -83,7 +83,7 @@ class BaseMessageTest extends TestCase ...@@ -83,7 +83,7 @@ class BaseMessageTest extends TestCase
public function testSend() public function testSend()
{ {
$mailer = $this->getMailer(); $mailer = $this->getMailer();
$message = $mailer->compose(); $message = $mailer->message();
$message->send(); $message->send();
$this->assertEquals($message, $mailer->sentMessages[0], 'Unable to send message!'); $this->assertEquals($message, $mailer->sentMessages[0], 'Unable to send message!');
} }
......
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