diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2018-07-06 10:39:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-06 10:39:09 +0200 |
commit | 3ade347b0d072a287dbc183d3651ff59fd36f537 (patch) | |
tree | 2cf5886ebd2a0e385ee8bcff7c3863df00653572 /tests | |
parent | 8969e100a0f6115319b10c656ffaf343d1aff11f (diff) | |
parent | 6a0c54d5bfd70baeed2438ac05278a9b4cb73d88 (diff) | |
download | nextcloud-server-3ade347b0d072a287dbc183d3651ff59fd36f537.tar.gz nextcloud-server-3ade347b0d072a287dbc183d3651ff59fd36f537.zip |
Merge pull request #9791 from nextcloud/3rdparty/noid/bump_swiftmailer
Upgrade to swiftmailer-6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings/Controller/CheckSetupControllerTest.php | 27 | ||||
-rw-r--r-- | tests/lib/Mail/MailerTest.php | 33 | ||||
-rw-r--r-- | tests/lib/Settings/Admin/MailTest.php | 4 |
3 files changed, 40 insertions, 24 deletions
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php index 470bc9cde64..057774a45ba 100644 --- a/tests/Settings/Controller/CheckSetupControllerTest.php +++ b/tests/Settings/Controller/CheckSetupControllerTest.php @@ -119,7 +119,22 @@ class CheckSetupControllerTest extends TestCase { $this->lockingProvider, $this->dateTimeFormatter, ]) - ->setMethods(['isReadOnlyConfig', 'hasValidTransactionIsolationLevel', 'hasFileinfoInstalled', 'hasWorkingFileLocking', 'getLastCronInfo', 'getSuggestedOverwriteCliURL', 'getOutdatedCaches', 'getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock(); + ->setMethods([ + 'isReadOnlyConfig', + 'hasValidTransactionIsolationLevel', + 'hasFileinfoInstalled', + 'hasWorkingFileLocking', + 'getLastCronInfo', + 'getSuggestedOverwriteCliURL', + 'getOutdatedCaches', + 'getCurlVersion', + 'isPhpOutdated', + 'isOpcacheProperlySetup', + 'hasFreeTypeSupport', + 'hasMissingIndexes', + 'isSqliteUsed', + 'isPhpMailerUsed', + ])->getMock(); } public function testIsInternetConnectionWorkingDisabledViaConfig() { @@ -352,6 +367,10 @@ class CheckSetupControllerTest extends TestCase { ->method('linkToDocs') ->with('admin-db-conversion') ->willReturn('http://docs.example.org/server/go.php?to=admin-db-conversion'); + $this->urlGenerator->expects($this->at(6)) + ->method('getAbsoluteURL') + ->with('index.php/settings/admin') + ->willReturn('https://server/index.php/settings/admin'); $this->checkSetupController ->method('hasFreeTypeSupport') ->willReturn(false); @@ -392,6 +411,10 @@ class CheckSetupControllerTest extends TestCase { 'relativeTime' => '2 hours ago', 'backgroundJobsUrl' => 'https://example.org', ]); + $this->checkSetupController + ->expects($this->once()) + ->method('isPhpMailerUsed') + ->willReturn(false); $this->checker ->expects($this->once()) ->method('hasPassedCheck') @@ -434,6 +457,8 @@ class CheckSetupControllerTest extends TestCase { 'isSqliteUsed' => false, 'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion', 'missingIndexes' => [], + 'isPhpMailerUsed' => false, + 'mailSettingsDocumentation' => 'https://server/index.php/settings/admin', ] ); $this->assertEquals($expected, $this->checkSetupController->check()); 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() { diff --git a/tests/lib/Settings/Admin/MailTest.php b/tests/lib/Settings/Admin/MailTest.php index 04c0e7fa92e..436a7953220 100644 --- a/tests/lib/Settings/Admin/MailTest.php +++ b/tests/lib/Settings/Admin/MailTest.php @@ -59,7 +59,7 @@ class MailTest extends TestCase { ->expects($this->at(2)) ->method('getSystemValue') ->with('mail_smtpmode', '') - ->willReturn('php'); + ->willReturn('smtp'); $this->config ->expects($this->at(3)) ->method('getSystemValue') @@ -103,7 +103,7 @@ class MailTest extends TestCase { 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'), 'mail_domain' => 'mx.nextcloud.com', 'mail_from_address' => 'no-reply@nextcloud.com', - 'mail_smtpmode' => 'php', + 'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => true, 'mail_smtphost' => 'smtp.nextcloud.com', 'mail_smtpport' => 25, |