Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--settings/Controller/CheckSetupController.php2
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php34
2 files changed, 35 insertions, 1 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php
index fa4ed57ab95..ba56c72dccf 100644
--- a/settings/Controller/CheckSetupController.php
+++ b/settings/Controller/CheckSetupController.php
@@ -530,7 +530,7 @@ Raw output
}
protected function isPhpMailerUsed(): bool {
- return $this->config->getSystemValue('mail_smtpmode', 'php') === 'php';
+ return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php';
}
protected function hasOpcacheLoaded(): bool {
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index 34c7d19bd8d..ff565f3734b 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -520,6 +520,40 @@ class CheckSetupControllerTest extends TestCase {
$this->assertEquals($expected, $this->checkSetupController->check());
}
+ public function testIsPhpMailerUsed() {
+ $checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
+ ->setConstructorArgs([
+ 'settings',
+ $this->request,
+ $this->config,
+ $this->clientService,
+ $this->urlGenerator,
+ $this->util,
+ $this->l10n,
+ $this->checker,
+ $this->logger,
+ $this->dispatcher,
+ $this->db,
+ $this->lockingProvider,
+ $this->dateTimeFormatter,
+ $this->memoryInfo,
+ $this->secureRandom,
+ ])
+ ->setMethods(null)->getMock();
+
+ $this->config->expects($this->at(0))
+ ->method('getSystemValue')
+ ->with('mail_smtpmode', 'smtp')
+ ->will($this->returnValue('php'));
+ $this->config->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('mail_smtpmode', 'smtp')
+ ->will($this->returnValue('not-php'));
+
+ $this->assertTrue($this->invokePrivate($checkSetupController, 'isPhpMailerUsed'));
+ $this->assertFalse($this->invokePrivate($checkSetupController, 'isPhpMailerUsed'));
+ }
+
public function testGetCurlVersion() {
$checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
->setConstructorArgs([