Browse Source

BaseMailer::defaultMessageConfig published as BaseMailer::messageConfig

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
73a8e77c3d
  1. 18
      framework/yii/mail/BaseMailer.php
  2. 2
      framework/yii/mail/BaseMessage.php
  3. 6
      tests/unit/framework/mail/BaseMailerTest.php

18
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.

2
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);
}
/**

6
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);
}
}

Loading…
Cancel
Save