mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 13:36:07 +09:00
99 lines
2.3 KiB
PHP
99 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* @group Core
|
|
*/
|
|
class Box_MailTest extends PHPUnit_Framework_TestCase
|
|
{
|
|
|
|
public function testsend_TransportSendMail()
|
|
{
|
|
$transport = 'sendmail';
|
|
|
|
$mailMock = $this->getMockBuilder('Box_Mail')
|
|
->setMethods(array('_sendMail'))
|
|
->getMock();
|
|
|
|
$mailMock->expects($this->once())
|
|
->method('_sendMail')
|
|
->with(array());
|
|
|
|
$mailMock->send($transport);
|
|
}
|
|
|
|
public function testsend_TransportSmtp()
|
|
{
|
|
$transport = 'smtp';
|
|
|
|
$mailMock = $this->getMockBuilder('Box_Mail')
|
|
->setMethods(array('_sendSmtpMail'))
|
|
->getMock();
|
|
|
|
$mailMock->expects($this->once())
|
|
->method('_sendSmtpMail')
|
|
->with(array());
|
|
|
|
$mailMock->send($transport);
|
|
}
|
|
|
|
public function testsend_TransportUnknown()
|
|
{
|
|
$transport = 'mailServer';
|
|
|
|
$mail = new Box_Mail();
|
|
|
|
$this->setExpectedException('\Box_Exception', sprintf('Unknown mail transport: %s', $transport));
|
|
$mail->send($transport);
|
|
}
|
|
|
|
public function testsetBodyHtml()
|
|
{
|
|
$context = 'Mail body';
|
|
$mail = new Box_Mail();
|
|
|
|
$result = $mail->setBodyHtml($context);
|
|
$this->assertInstanceOf('Box_Mail', $result);
|
|
|
|
$result = $mail->getBody();
|
|
$this->assertEquals($context, $result);
|
|
}
|
|
|
|
public function testsetFrom()
|
|
{
|
|
$context = 'jobs@boxbilling.com';
|
|
$mail = new Box_Mail();
|
|
|
|
$result = $mail->setFrom($context);
|
|
|
|
$this->assertInstanceOf('Box_Mail', $result);
|
|
}
|
|
|
|
public function testsetSubject()
|
|
{
|
|
$context = 'Mail title';
|
|
$mail = new Box_Mail();
|
|
|
|
$result = $mail->setSubject($context);
|
|
$this->assertInstanceOf('Box_Mail', $result);
|
|
|
|
$result = $mail->getSubject();
|
|
$this->assertEquals($context, $result);
|
|
}
|
|
|
|
public function testsetReplyTo()
|
|
{
|
|
$context = 'do-not-reply@boxbilling.com';
|
|
$mail = new Box_Mail();
|
|
|
|
$result = $mail->setReplyTo($context);
|
|
$this->assertInstanceOf('Box_Mail', $result);
|
|
}
|
|
|
|
public function testaddTo()
|
|
{
|
|
$context = 'bcc@boxbilling.com';
|
|
$mail = new Box_Mail();
|
|
|
|
$result = $mail->addTo($context);
|
|
$this->assertInstanceOf('Box_Mail', $result);
|
|
}
|
|
} |