Skip to content

Commit 1a2ee3e

Browse files
committed
Fix tests with SSL
1 parent 77464fb commit 1a2ee3e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/DatabaseTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,16 @@ public function testConnectionFailWithLogger() : void
115115
}
116116
}
117117

118+
protected function mariadbHasSSL() : bool
119+
{
120+
$version = static::$database->getConnection()->get_server_info();
121+
$version = \explode('-', $version, 2)[0];
122+
return \version_compare($version, '11.4.0', '>=');
123+
}
124+
118125
public function testConnectionWithSSL() : void
119126
{
120-
if (\getenv('DB_IMAGE') === 'mariadb') {
127+
if (\getenv('DB_IMAGE') === 'mariadb' && !$this->mariadbHasSSL()) {
121128
$this->expectException(mysqli_sql_exception::class);
122129
$this->expectExceptionMessage('MySQL server has gone away');
123130
}
@@ -146,7 +153,7 @@ protected function cipherStatus(Database $database) : void
146153

147154
public function testConnectionWithSSLNotVerified() : void
148155
{
149-
if (\getenv('DB_IMAGE') === 'mariadb') {
156+
if (\getenv('DB_IMAGE') === 'mariadb' && !$this->mariadbHasSSL()) {
150157
$this->expectException(mysqli_sql_exception::class);
151158
$this->expectExceptionMessage('MySQL server has gone away');
152159
}

0 commit comments

Comments
 (0)