|
|
|
|
@ -84,7 +84,7 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam) { |
|
|
|
|
$this->config |
|
|
|
|
->expects($this->exactly(2)) |
|
|
|
|
->method('getSystemValue') |
|
|
|
|
->method('getSystemValueString') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'sendmail'], |
|
|
|
|
['mail_sendmailmode', 'smtp', $sendmailMode], |
|
|
|
|
@ -107,7 +107,7 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam) { |
|
|
|
|
$this->config |
|
|
|
|
->expects($this->exactly(2)) |
|
|
|
|
->method('getSystemValue') |
|
|
|
|
->method('getSystemValueString') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'qmail'], |
|
|
|
|
['mail_sendmailmode', 'smtp', $sendmailMode], |
|
|
|
|
@ -133,7 +133,7 @@ class MailerTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetInstanceSendmail() { |
|
|
|
|
$this->config |
|
|
|
|
->method('getSystemValue') |
|
|
|
|
->method('getSystemValueString') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'sendmail'], |
|
|
|
|
['mail_sendmailmode', 'smtp', 'smtp'], |
|
|
|
|
@ -180,7 +180,7 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testCreateMessage() { |
|
|
|
|
$this->config |
|
|
|
|
->expects($this->any()) |
|
|
|
|
->method('getSystemValue') |
|
|
|
|
->method('getSystemValueBool') |
|
|
|
|
->with('mail_send_plaintext_only', false) |
|
|
|
|
->willReturn(false); |
|
|
|
|
$this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage()); |
|
|
|
|
@ -229,7 +229,7 @@ class MailerTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreateEMailTemplate() { |
|
|
|
|
$this->config->method('getSystemValue') |
|
|
|
|
$this->config->method('getSystemValueString') |
|
|
|
|
->with('mail_template_class', '') |
|
|
|
|
->willReturnArgument(1); |
|
|
|
|
|
|
|
|
|
@ -239,12 +239,16 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testStreamingOptions() { |
|
|
|
|
$this->config->method('getSystemValue') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['mail_smtpstreamoptions', [], ['foo' => 1]], |
|
|
|
|
['mail_smtphost', '127.0.0.1', '127.0.0.1'], |
|
|
|
|
['mail_smtpport', 25, 25], |
|
|
|
|
['mail_smtptimeout', 10, 10], |
|
|
|
|
]); |
|
|
|
|
$this->config->method('getSystemValueString') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['overwrite.cli.url', '', ''], |
|
|
|
|
]); |
|
|
|
|
$mailer = self::invokePrivate($this->mailer, 'getInstance'); |
|
|
|
|
/** @var EsmtpTransport $transport */ |
|
|
|
|
$transport = self::invokePrivate($mailer, 'transport'); |
|
|
|
|
@ -256,12 +260,16 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testStreamingOptionsWrongType() { |
|
|
|
|
$this->config->method('getSystemValue') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['mail_smtpstreamoptions', [], 'bar'], |
|
|
|
|
['mail_smtphost', '127.0.0.1', '127.0.0.1'], |
|
|
|
|
['mail_smtpport', 25, 25], |
|
|
|
|
['mail_smtptimeout', 10, 10], |
|
|
|
|
]); |
|
|
|
|
$this->config->method('getSystemValueString') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['overwrite.cli.url', '', ''], |
|
|
|
|
]); |
|
|
|
|
$mailer = self::invokePrivate($this->mailer, 'getInstance'); |
|
|
|
|
/** @var EsmtpTransport $transport */ |
|
|
|
|
$transport = self::invokePrivate($mailer, 'transport'); |
|
|
|
|
@ -272,14 +280,15 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testLocalDomain(): void { |
|
|
|
|
$this->config->method('getSystemValue') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['mail_smtphost', '127.0.0.1', '127.0.0.1'], |
|
|
|
|
['mail_smtpport', 25, 25], |
|
|
|
|
['mail_smtptimeout', 10, 10], |
|
|
|
|
]); |
|
|
|
|
$this->config->method('getSystemValueString') |
|
|
|
|
->with('overwrite.cli.url', '') |
|
|
|
|
->willReturn('https://some.valid.url.com:8080'); |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['overwrite.cli.url', '', 'https://some.valid.url.com:8080'], |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
/** @var SymfonyMailer $mailer */ |
|
|
|
|
$mailer = self::invokePrivate($this->mailer, 'getInstance'); |
|
|
|
|
@ -294,14 +303,15 @@ class MailerTest extends TestCase { |
|
|
|
|
public function testLocalDomainInvalidUrl(): void { |
|
|
|
|
$this->config->method('getSystemValue') |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['mail_smtphost', '127.0.0.1', '127.0.0.1'], |
|
|
|
|
['mail_smtpport', 25, 25], |
|
|
|
|
['mail_smtptimeout', 10, 10], |
|
|
|
|
['mail_smtphost', '127.0.0.1', '127.0.0.1'], |
|
|
|
|
]); |
|
|
|
|
$this->config->method('getSystemValueString') |
|
|
|
|
->with('overwrite.cli.url', '') |
|
|
|
|
->willReturn('https:only.slash.does.not.work:8080'); |
|
|
|
|
->willReturnMap([ |
|
|
|
|
['mail_smtpmode', 'smtp', 'smtp'], |
|
|
|
|
['overwrite.cli.url', '', 'https:only.slash.does.not.work:8080'], |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
/** @var SymfonyMailer $mailer */ |
|
|
|
|
$mailer = self::invokePrivate($this->mailer, 'getInstance'); |
|
|
|
|
|