Skip to content

Commit

Permalink
[NFC] Skip utf8mb4 test on MySQL versions lower than 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Feb 6, 2020
1 parent 990a93e commit 433a950
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/phpunit/api/v3/SystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,20 @@ public function testSystemGet() {
* @throws \CRM_Core_Exception
*/
public function testSystemUTFMB8Conversion() {
$this->callAPISuccess('System', 'utf8conversion', []);
$table = CRM_Core_DAO::executeQuery('SHOW CREATE TABLE civicrm_contact');
$table->fetch();
$this->assertStringEndsWith('DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC', $table->Create_Table);
if (version_compare(CRM_Utils_SQL::getDatabaseVersion(), '5.7', '>=')) {
$this->callAPISuccess('System', 'utf8conversion', []);
$table = CRM_Core_DAO::executeQuery('SHOW CREATE TABLE civicrm_contact');
$table->fetch();
$this->assertStringEndsWith('DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC', $table->Create_Table);

$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);
$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);
}
else {
$this->markTestSkipped('MySQL Version does not support ut8mb4 testing');
}
}

}

0 comments on commit 433a950

Please sign in to comment.