From b5b1a004d6a13ee8f68c66f23a90e724ac4e1373 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 8 Dec 2021 11:14:33 +1100 Subject: [PATCH] [NFC] Update System Uft8mb4 check to handle for the fact that MySQL8 outputs utf8mb3 when the charset has been set to utf8 as utf8mb3 is the underlyling charset for utf8 --- tests/phpunit/api/v3/SystemTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/SystemTest.php b/tests/phpunit/api/v3/SystemTest.php index 8eae0622a7..275dad39dc 100644 --- a/tests/phpunit/api/v3/SystemTest.php +++ b/tests/phpunit/api/v3/SystemTest.php @@ -96,7 +96,9 @@ class api_v3_SystemTest extends CiviUnitTestCase { $this->callAPISuccess('System', 'utf8conversion', ['is_revert' => 1]); $table = CRM_Core_DAO::executeQuery('SHOW CREATE TABLE civicrm_contact'); $table->fetch(); - $this->assertStringEndsWith('DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC', $table->Create_Table); + $version = CRM_Utils_SQL::getDatabaseVersion(); + $charset = (version_compare($version, '8', '>=') && stripos($version, 'mariadb') === FALSE) ? 'utf8mb3' : 'utf8'; + $this->assertStringEndsWith('DEFAULT CHARSET=' . $charset . ' COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC', $table->Create_Table); } else { $this->markTestSkipped('MySQL Version does not support ut8mb4 testing'); -- 2.25.1