diff --git a/test/classes/Html/GeneratorTest.php b/test/classes/Html/GeneratorTest.php
index 42377b3274..5fd5cdb273 100644
--- a/test/classes/Html/GeneratorTest.php
+++ b/test/classes/Html/GeneratorTest.php
@@ -282,4 +282,107 @@ class GeneratorTest extends AbstractTestCase
Generator::formatSql('SELECT 1 < 2', true)
);
}
+
+ /**
+ * Test for getServerSSL
+ */
+ public function testGetServerSSL(): void
+ {
+ global $cfg;
+
+ $sslNotUsed = 'SSL is not being used'
+ . '
';
+
+ $sslNotUsedCaution = 'SSL is not being used'
+ . '
';
+
+ $cfg['Server'] = [
+ 'ssl' => false,
+ 'host' => '127.0.0.1',
+ ];
+ $this->assertEquals(
+ $sslNotUsed,
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => false,
+ 'host' => 'custom.host',
+ ];
+ $cfg['MysqlSslWarningSafeHosts'] = ['localhost', '127.0.0.1'];
+
+ $this->assertEquals(
+ $sslNotUsedCaution,
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => false,
+ 'host' => 'custom.host',
+ ];
+ $cfg['MysqlSslWarningSafeHosts'] = ['localhost', '127.0.0.1', 'custom.host'];
+
+ $this->assertEquals(
+ $sslNotUsed,
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => false,
+ 'ssl_verify' => true,
+ 'host' => 'custom.host',
+ ];
+
+ $this->assertEquals(
+ $sslNotUsed,
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => true,
+ 'ssl_verify' => false,
+ 'host' => 'custom.host',
+ ];
+
+ $this->assertEquals(
+ 'SSL is used with disabled verification'
+ . '
',
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => true,
+ 'ssl_verify' => true,
+ 'host' => 'custom.host',
+ ];
+
+ $this->assertEquals(
+ 'SSL is used without certification authority'
+ . '
',
+ Generator::getServerSSL()
+ );
+
+ $cfg['Server'] = [
+ 'ssl' => true,
+ 'ssl_verify' => true,
+ 'ssl_ca' => '/etc/ssl/ca.crt',
+ 'host' => 'custom.host',
+ ];
+
+ $this->assertEquals(
+ 'SSL is used'
+ . '
',
+ Generator::getServerSSL()
+ );
+ }
}