From ccf619cd028d9e31e22d70671e96ef98496221f6 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Wed, 13 Dec 2023 12:46:01 +0000 Subject: [PATCH] Ad-hoc DB report: Automatically fix test queries for MySQL --- tests/behat/behat_report_customsql.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/behat/behat_report_customsql.php b/tests/behat/behat_report_customsql.php index 5d491cc..56b124a 100644 --- a/tests/behat/behat_report_customsql.php +++ b/tests/behat/behat_report_customsql.php @@ -78,6 +78,11 @@ public function the_following_custom_sql_report_exists(TableNode $data) { throw new Exception('The report SQL must be given as querysql.'); } + // Fix test queries containing CHR for MySQL & chums. + if ($DB->get_dbfamily() == 'mysql' && stripos($report['querysql'], 'CHR') !== false) { + $report['querysql'] = str_ireplace('CHR', 'CHAR', $report['querysql']); + } + // Category. if (isset($report['category'])) { $report['categoryid'] = $this->get_category_id_by_name($report['category']);