Browse Source

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

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
ad7761f96a
  1. 2
      extensions/swiftmailer/yii/swiftmailer/Mailer.php
  2. 2
      framework/yii/mail/BaseMailer.php
  3. 2
      framework/yii/mail/MailerInterface.php
  4. 2
      tests/unit/extensions/swiftmailer/MessageTest.php
  5. 8
      tests/unit/framework/mail/BaseMailerTest.php
  6. 6
      tests/unit/framework/mail/BaseMessageTest.php

2
extensions/swiftmailer/yii/swiftmailer/Mailer.php

@ -36,7 +36,7 @@ use Yii;
*
* @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>
* @since 2.0

2
framework/yii/mail/BaseMailer.php

@ -118,7 +118,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
* for the configuration format details.
* @return MessageInterface message instance.
*/
public function compose(array $config = [])
public function message(array $config = [])
{
$config = array_merge($this->messageConfig, $config);
if (!array_key_exists('class', $config)) {

2
framework/yii/mail/MailerInterface.php

@ -22,7 +22,7 @@ interface MailerInterface
* @param array $config message configuration.
* @return MessageInterface message instance.
*/
public function compose(array $config = []);
public function message(array $config = []);
/**
* Sends the given email message.

2
tests/unit/extensions/swiftmailer/MessageTest.php

@ -63,7 +63,7 @@ class MessageTest extends VendorTestCase
*/
protected function createTestMessage()
{
return Yii::$app->getComponent('mail')->compose();
return Yii::$app->getComponent('mail')->message();
}
/**

8
tests/unit/framework/mail/BaseMailerTest.php

@ -96,7 +96,7 @@ class BaseMailerTest extends TestCase
public function testComposeMessage()
{
$mailer = new Mailer();
$message = $mailer->compose();
$message = $mailer->message();
$this->assertTrue(is_object($message), 'Unable to create message instance!');
$this->assertEquals($mailer->messageClass, get_class($message), 'Invalid message class!');
@ -104,7 +104,7 @@ class BaseMailerTest extends TestCase
'id' => 'test-id',
'encoding' => 'test-encoding',
);
$message = $mailer->compose($messageConfig);
$message = $mailer->message($messageConfig);
foreach ($messageConfig as $name => $value) {
$this->assertEquals($value, $message->$name, 'Unable to apply message config!');
@ -135,7 +135,7 @@ class BaseMailerTest extends TestCase
$messageConfig = array_merge($notPropertyConfig, $propertyConfig);
$mailer->messageConfig = $messageConfig;
$message = $mailer->compose();
$message = $mailer->message();
foreach ($notPropertyConfig as $name => $value) {
$this->assertEquals($value, $message->{'_' . $name});
@ -181,7 +181,7 @@ class BaseMailerTest extends TestCase
$messageConfig = array(
'renderText' => [$viewName],
);
$message = $mailer->compose($messageConfig);
$message = $mailer->message($messageConfig);
$this->assertEquals($viewFileContent, $message->_text);
}

6
tests/unit/framework/mail/BaseMessageTest.php

@ -43,7 +43,7 @@ class BaseMessageTest extends TestCase
public function testRender()
{
$mailer = $this->getMailer();
$message = $mailer->compose();
$message = $mailer->message();
$viewName = 'test/text/view';
$message->renderText($viewName);
@ -62,7 +62,7 @@ class BaseMessageTest extends TestCase
public function testComposeBody()
{
$mailer = $this->getMailer();
$message = $mailer->compose();
$message = $mailer->message();
$viewName = 'test/html/view';
$message->renderBody($viewName);
@ -83,7 +83,7 @@ class BaseMessageTest extends TestCase
public function testSend()
{
$mailer = $this->getMailer();
$message = $mailer->compose();
$message = $mailer->message();
$message->send();
$this->assertEquals($message, $mailer->sentMessages[0], 'Unable to send message!');
}

Loading…
Cancel
Save