Skip to content

Commit

Permalink
Ad-hoc DB report: Automatically fix test queries for MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
marxjohnson authored and timhunt committed Dec 13, 2023
1 parent a7701e1 commit a291508
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
database: 'mariadb'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
database: 'mariadb'

services:
postgres:
Expand Down
5 changes: 5 additions & 0 deletions tests/behat/behat_report_customsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit a291508

Please sign in to comment.