diff --git a/framework/yii/mail/BaseMailer.php b/framework/yii/mail/BaseMailer.php index 8e88749..a78b6fc 100644 --- a/framework/yii/mail/BaseMailer.php +++ b/framework/yii/mail/BaseMailer.php @@ -48,7 +48,7 @@ abstract class BaseMailer extends Component * ) * ~~~ */ - private $_defaultMessageConfig = []; + public $messageConfig = []; /** * @param array|\yii\base\View $view view instance or its array configuration. @@ -97,22 +97,6 @@ abstract class BaseMailer extends Component } /** - * @param array $defaultMessageConfig default message config - */ - public function setDefaultMessageConfig(array $defaultMessageConfig) - { - $this->_defaultMessageConfig = $defaultMessageConfig; - } - - /** - * @return array default message config - */ - public function getDefaultMessageConfig() - { - return $this->_defaultMessageConfig; - } - - /** * Creates view instance from given configuration. * @param array $config view configuration. * @return \yii\base\View view instance. diff --git a/framework/yii/mail/BaseMessage.php b/framework/yii/mail/BaseMessage.php index 5593cec..f48310c 100644 --- a/framework/yii/mail/BaseMessage.php +++ b/framework/yii/mail/BaseMessage.php @@ -49,7 +49,7 @@ abstract class BaseMessage extends Object implements MessageInterface */ public function init() { - Yii::configure($this, $this->getMailer()->getDefaultMessageConfig()); + Yii::configure($this, $this->getMailer()->messageConfig); } /** diff --git a/tests/unit/framework/mail/BaseMailerTest.php b/tests/unit/framework/mail/BaseMailerTest.php index e80ca0c..84bb293 100644 --- a/tests/unit/framework/mail/BaseMailerTest.php +++ b/tests/unit/framework/mail/BaseMailerTest.php @@ -111,15 +111,15 @@ class BaseMailerTest extends TestCase public function testDefaultMessageConfig() { - $defaultMessageConfig = array( + $messageConfig = array( 'id' => 'test-id', 'encoding' => 'test-encoding', ); - Yii::$app->getComponent('email')->setDefaultMessageConfig($defaultMessageConfig); + Yii::$app->getComponent('email')->messageConfig = $messageConfig; $message = new Message(); - foreach ($defaultMessageConfig as $name => $value) { + foreach ($messageConfig as $name => $value) { $this->assertEquals($value, $message->$name); } }