]> source.dussan.org Git - nextcloud-server.git/commitdiff
Verify that isPhpMailerUsed uses config as expected
authorKyle Fazzari <kyrofa@ubuntu.com>
Wed, 14 Nov 2018 16:41:38 +0000 (08:41 -0800)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 19 Nov 2018 14:49:49 +0000 (15:49 +0100)
Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
tests/Settings/Controller/CheckSetupControllerTest.php

index cc1ed6555c3cdadedb0c615b78106a124814c458..8da90b91bfd24cc54a9a523c983b344fcedfd4c2 100644 (file)
@@ -511,6 +511,39 @@ 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,
+                       ])
+                       ->setMethods(null)->getMock();
+
+               $this->config->expects($this->at(0))
+                       ->method('getSystemValue')
+                       ->with('mail_smtpmode', null)
+                       ->will($this->returnValue('php'));
+               $this->config->expects($this->at(1))
+                       ->method('getSystemValue')
+                       ->with('mail_smtpmode', null)
+                       ->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([