Files
FOSSBilling/tests/bb-library/Box/Box_MailTest.php
T
AnyxandBenjamin Aerni 4e8d83eafb Default to Huraga Green & update naming/URL (#295)
* Default to Huraga Green & update naming/URL

* Apply the code from the Orderbutton module that defaults to Huraga Green to all templates that request Huraga's color scheme. Replace incorrect setting.

* Replace some old references to BoxBilling and boxbilling.org with the FOSSBilling ones. Update LICENSE URLs.

* Fix broken test

Co-authored-by: Benjamin Aerni <belleaerni@gmail.com>
2022-09-30 05:09:02 +02:00

101 lines
2.4 KiB
PHP

<?php
/**
* @group Core
*/
class Box_MailTest extends PHPUnit\Framework\TestCase
{
public function testsend_TransportSendMail()
{
$transport = 'sendmail';
$mailMock = $this->getMockBuilder(Box_Mail::class)
->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->expectException(\Box_Exception::class);
$this->expectExceptionMessage(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::class, $result);
$result = $mail->getBody();
$this->assertEquals($context, $result);
}
public function testsetFrom()
{
$context = 'jobs@fossbilling.org';
$mail = new Box_Mail();
$result = $mail->setFrom($context);
$this->assertInstanceOf(Box_Mail::class, $result);
}
public function testsetSubject()
{
$context = 'Mail title';
$mail = new Box_Mail();
$result = $mail->setSubject($context);
$this->assertInstanceOf(Box_Mail::class, $result);
$result = $mail->getSubject();
$this->assertEquals($context, $result);
}
public function testsetReplyTo()
{
$context = 'do-not-reply@fossbilling.org';
$mail = new Box_Mail();
$result = $mail->setReplyTo($context);
$this->assertInstanceOf(Box_Mail::class, $result);
}
public function testaddTo()
{
$context = 'bcc@fossbilling.org';
$mail = new Box_Mail();
$result = $mail->addTo($context);
$this->assertInstanceOf(Box_Mail::class, $result);
}
}