Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] Skip utf8mb4 test on MySQL versions lower than 5.7 #16483

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
}
}

}