aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-06-08 10:26:56 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-07-04 08:28:33 +0200
commitbe7db1573dc8c6e7309ec9db124a7a74b8b41199 (patch)
treece507dafb77d2e2b8832ec717598235b14dbc886 /tests
parente6e6b5648a1d47708c3fc8320ad7c3e4e2d41f84 (diff)
downloadnextcloud-server-be7db1573dc8c6e7309ec9db124a7a74b8b41199.tar.gz
nextcloud-server-be7db1573dc8c6e7309ec9db124a7a74b8b41199.zip
Swift to \Swift_Mailer as abstraction
* \Swift_Mailer handles starting the transport etc properly * Fixed tests Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Mail/MailerTest.php33
1 files changed, 12 insertions, 21 deletions
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 2dd4bca5190..d724cd630d3 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -48,50 +48,41 @@ class MailerTest extends TestCase {
);
}
- public function testGetMailInstance() {
- $this->assertEquals(\Swift_MailTransport::newInstance(), self::invokePrivate($this->mailer, 'getMailinstance'));
- }
-
public function testGetSendMailInstanceSendMail() {
$this->config
->expects($this->once())
->method('getSystemValue')
- ->with('mail_smtpmode', 'php')
+ ->with('mail_smtpmode', 'smtp')
->will($this->returnValue('sendmail'));
- $this->assertEquals(\Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance'));
+ $this->assertEquals(new \Swift_SendmailTransport('/usr/sbin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance'));
}
public function testGetSendMailInstanceSendMailQmail() {
$this->config
->expects($this->once())
->method('getSystemValue')
- ->with('mail_smtpmode', 'php')
+ ->with('mail_smtpmode', 'smtp')
->will($this->returnValue('qmail'));
- $this->assertEquals(\Swift_SendmailTransport::newInstance('/var/qmail/bin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance'));
+ $this->assertEquals(new \Swift_SendmailTransport('/var/qmail/bin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance'));
}
public function testGetInstanceDefault() {
- $this->assertInstanceOf('\Swift_MailTransport', self::invokePrivate($this->mailer, 'getInstance'));
- }
-
- public function testGetInstancePhp() {
- $this->config
- ->expects($this->any())
- ->method('getSystemValue')
- ->will($this->returnValue('php'));
-
- $this->assertInstanceOf('\Swift_MailTransport', self::invokePrivate($this->mailer, 'getInstance'));
+ $mailer = self::invokePrivate($this->mailer, 'getInstance');
+ $this->assertInstanceOf(\Swift_Mailer::class, $mailer);
+ $this->assertInstanceOf(\Swift_SmtpTransport::class, $mailer->getTransport());
}
public function testGetInstanceSendmail() {
$this->config
- ->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue('sendmail'));
+ ->with('mail_smtpmode', 'smtp')
+ ->willReturn('sendmail');
- $this->assertInstanceOf('\Swift_Mailer', self::invokePrivate($this->mailer, 'getInstance'));
+ $mailer = self::invokePrivate($this->mailer, 'getInstance');
+ $this->assertInstanceOf(\Swift_Mailer::class, $mailer);
+ $this->assertInstanceOf(\Swift_SendmailTransport::class, $mailer->getTransport());
}
public function testCreateMessage() {