mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-21 20:34:57 +09:00
Finish Feature-MailTestUpdates
This commit is contained in:
commit
4e1959f13a
4 files changed
+146
-3380
No files matched your search
+3
-3350
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -24,7 +24,8 @@
|
||||
"rev42/tfpdf": "v1.24",
|
||||
"geoip2/geoip2": "v2.1.0",
|
||||
"dflydev/markdown": "1.0.*@dev",
|
||||
"ircmaxell/password-compat": "v1.0.4"
|
||||
"ircmaxell/password-compat": "v1.0.4",
|
||||
"phpmailer/phpmailer": "5.2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gettext": "*"
|
||||
|
||||
Generated
+54
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "9b85e5d1e9c90114eebbc96139a2ac0f",
|
||||
"hash": "7383febeb9a42d16505dd6fad7313249",
|
||||
"packages": [
|
||||
{
|
||||
"name": "dflydev/markdown",
|
||||
@@ -300,6 +300,59 @@
|
||||
],
|
||||
"time": "2014-09-22 17:33:22"
|
||||
},
|
||||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
"version": "v5.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||
"reference": "adb0197c106fad05c1fab28dbed5437133836c44"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/adb0197c106fad05c1fab28dbed5437133836c44",
|
||||
"reference": "adb0197c106fad05c1fab28dbed5437133836c44",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/phpdocumentor": "*",
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"class.phpmailer.php",
|
||||
"class.pop3.php",
|
||||
"class.smtp.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jim Jagielski",
|
||||
"email": "jimjag@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcus Bointon",
|
||||
"email": "phpmailer@synchromedia.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "Andy Prevost",
|
||||
"email": "codeworxtech@users.sourceforge.net"
|
||||
},
|
||||
{
|
||||
"name": "Brent R. Matzelle"
|
||||
}
|
||||
],
|
||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||
"time": "2013-02-21 11:44:28"
|
||||
},
|
||||
{
|
||||
"name": "pimple/pimple",
|
||||
"version": "v2.0.0",
|
||||
|
||||
@@ -4,37 +4,96 @@
|
||||
*/
|
||||
class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testMail()
|
||||
|
||||
public function testsend_TransportSendMail()
|
||||
{
|
||||
try {
|
||||
$mail = new Box_Mail();
|
||||
$mail->setFrom('me@gmail.com');
|
||||
$mail->setReplyTo('info@boxbilling.com');
|
||||
$mail->addTo('example@gmail.com');
|
||||
$mail->setSubject('PHPUnit');
|
||||
$mail->setBodyHtml('testing email <b>html</b>');
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
$transport = 'sendmail';
|
||||
|
||||
$mailMock = $this->getMockBuilder('Box_Mail')
|
||||
->setMethods(array('_sendMail'))
|
||||
->getMock();
|
||||
|
||||
$mailMock->expects($this->once())
|
||||
->method('_sendMail')
|
||||
->with(array());
|
||||
|
||||
$mailMock->send($transport);
|
||||
}
|
||||
|
||||
/*
|
||||
public function testSmtp()
|
||||
public function testsend_TransportSmtp()
|
||||
{
|
||||
$options = array(
|
||||
'smtp_security' => 'tls',
|
||||
'smtp_port' => '587',
|
||||
'smtp_username' => 'john.doe@gmail.com',
|
||||
'smtp_password' => '',
|
||||
'smtp_host' => 'smtp.gmail.com',
|
||||
);
|
||||
$mail = new Box_Mail();
|
||||
$mail->setFrom('me@gmail.com');
|
||||
$mail->addTo('support@1freehosting.com');
|
||||
$mail->setSubject('PHPUnit');
|
||||
$mail->setBodyHtml('testing email <b>html</b>');
|
||||
$mail->send('smtp', $options);
|
||||
$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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in new issue
Block a user