Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ protected function getCronErrors() {
}

protected function isPhpMailerUsed(): bool {
return $this->config->getSystemValue('mail_smtpmode', 'php') === 'php';
return $this->config->getSystemValue('mail_smtpmode', 'smtp') === 'php';
}

protected function hasOpcacheLoaded(): bool {
Expand Down
34 changes: 34 additions & 0 deletions tests/Settings/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,40 @@ public function testCheck() {
$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([
Expand Down