Merge pull request #12401 from pachulo/fix/11107/fix-php-mail-warning

Fix the warning appearing in the admin section when mail_smtpmode is not configured
This commit is contained in:
Morris Jobke 2018-11-19 15:23:45 +01:00 committed by GitHub
commit 5af6289959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -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 {

View File

@ -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([