From 4f4ed4cf4d7f996e1b3ffc916e657f4bb0d6646c Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 20 Mar 2021 09:17:14 +1100 Subject: [PATCH] [NFC] Fix Test failures on MySQL 8 caused by change in output of either create table or Column names in queries --- tests/phpunit/CRM/Dedupe/MergerTest.php | 4 ++-- tests/phpunit/CRM/Logging/LoggingTest.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Dedupe/MergerTest.php b/tests/phpunit/CRM/Dedupe/MergerTest.php index afb758eaba..525c539d05 100644 --- a/tests/phpunit/CRM/Dedupe/MergerTest.php +++ b/tests/phpunit/CRM/Dedupe/MergerTest.php @@ -1429,8 +1429,8 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase { $cidRefs = []; $sql = " SELECT - table_name, - column_name + table_name AS table_name, + column_name AS column_name FROM information_schema.key_column_usage WHERE referenced_table_schema = database() AND diff --git a/tests/phpunit/CRM/Logging/LoggingTest.php b/tests/phpunit/CRM/Logging/LoggingTest.php index acce7ee0fa..562450aaa4 100644 --- a/tests/phpunit/CRM/Logging/LoggingTest.php +++ b/tests/phpunit/CRM/Logging/LoggingTest.php @@ -52,6 +52,8 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { $this->assertTrue( in_array(" `logging_test` int(11) DEFAULT '0'", $create) || in_array(" `logging_test` int(11) DEFAULT 0", $create) + || in_array(" `logging_test` int DEFAULT '0'", $create) + || in_array(" `logging_test` int DEFAULT 0", $create) ); CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` DROP COLUMN `logging_test`", [], FALSE, NULL, FALSE, FALSE); $query = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE `log_civicrm_option_value`", [], TRUE, NULL, FALSE, FALSE); @@ -65,7 +67,10 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { Civi::service('sql_triggers')->rebuild('civicrm_option_value'); $this->assertTrue( in_array(" `logging_test` int(11) DEFAULT '0'", $create) - || in_array(" `logging_test` int(11) DEFAULT 0", $create)); + || in_array(" `logging_test` int(11) DEFAULT 0", $create) + || in_array(" `logging_test` int DEFAULT '0'", $create) + || in_array(" `logging_test` int DEFAULT 0", $create) + ); $logging->disableLogging(); } -- 2.25.1