Commit 73a8e77c by Paul Klimov

BaseMailer::defaultMessageConfig published as BaseMailer::messageConfig

parent d33519e3
...@@ -48,7 +48,7 @@ abstract class BaseMailer extends Component ...@@ -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. * @param array|\yii\base\View $view view instance or its array configuration.
...@@ -97,22 +97,6 @@ abstract class BaseMailer extends Component ...@@ -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. * Creates view instance from given configuration.
* @param array $config view configuration. * @param array $config view configuration.
* @return \yii\base\View view instance. * @return \yii\base\View view instance.
......
...@@ -49,7 +49,7 @@ abstract class BaseMessage extends Object implements MessageInterface ...@@ -49,7 +49,7 @@ abstract class BaseMessage extends Object implements MessageInterface
*/ */
public function init() public function init()
{ {
Yii::configure($this, $this->getMailer()->getDefaultMessageConfig()); Yii::configure($this, $this->getMailer()->messageConfig);
} }
/** /**
......
...@@ -111,15 +111,15 @@ class BaseMailerTest extends TestCase ...@@ -111,15 +111,15 @@ class BaseMailerTest extends TestCase
public function testDefaultMessageConfig() public function testDefaultMessageConfig()
{ {
$defaultMessageConfig = array( $messageConfig = array(
'id' => 'test-id', 'id' => 'test-id',
'encoding' => 'test-encoding', 'encoding' => 'test-encoding',
); );
Yii::$app->getComponent('email')->setDefaultMessageConfig($defaultMessageConfig); Yii::$app->getComponent('email')->messageConfig = $messageConfig;
$message = new Message(); $message = new Message();
foreach ($defaultMessageConfig as $name => $value) { foreach ($messageConfig as $name => $value) {
$this->assertEquals($value, $message->$name); $this->assertEquals($value, $message->$name);
} }
} }
......
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