示例#1
0
 /**
  * Test send email.
  *
  * @return void
  */
 public function testSend()
 {
     $email = new Email();
     $result = $email->send('My subject', 'My content', '*****@*****.**');
     $this->assertEquals(['headers', 'message'], array_keys($result));
     $this->assertContains('My content', $result['message']);
     $this->assertContains('From: Union <*****@*****.**>', $result['headers']);
     $this->assertContains('Date:', $result['headers']);
     $this->assertContains('Message-ID:', $result['headers']);
     $this->assertContains('Content-Type: text/html; charset=UTF-8', $result['headers']);
     $result = $email->send('My subject 2', 'My content 2', '*****@*****.**', 'MyFromName', '*****@*****.**');
     $this->assertEquals(['headers', 'message'], array_keys($result));
     $this->assertContains('My content 2', $result['message']);
     $this->assertContains('From: MyFromName <*****@*****.**>', $result['headers']);
     $this->assertContains('Date:', $result['headers']);
     $this->assertContains('Message-ID:', $result['headers']);
     $this->assertContains('Content-Type: text/html; charset=UTF-8', $result['headers']);
 }
示例#2
0
 /**
  * Constructor hook method.
  *
  * @return void
  */
 protected function _initialize()
 {
     parent::_initialize();
     $this->_params = Plugin::params('Union/Community');
     $this->_macros = new Macros($this->_data);
 }