From d303221d08c25e7f5fe36b0066172dbfeb3c3342 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 21 Dec 2015 22:26:52 +0000 Subject: [PATCH] Tests: Use the `default_storage_engine` MySQL option on newer MySQL versions. In MySQL 5.5.3, `storage_engine` was deprecated in favour of `default_storage_engine`, and subsequently removed in MySQL 5.7. To avoid errors when running tests on MySQL 5.7, we need to switch between the options based on MySQL version. Props skithund, jeremyfelt. Fixes #34692. git-svn-id: https://develop.svn.wordpress.org/trunk@36055 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/install.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/includes/install.php b/tests/phpunit/includes/install.php index c94c5cb17c..d33c1b76de 100644 --- a/tests/phpunit/includes/install.php +++ b/tests/phpunit/includes/install.php @@ -31,7 +31,15 @@ global $phpmailer; require_once( dirname( __FILE__ ) . '/mock-mailer.php' ); $phpmailer = new MockPHPMailer(); -$wpdb->query( 'SET storage_engine = INNODB' ); +/* + * default_storage_engine and storage_engine are the same option, but storage_engine + * was deprecated in MySQL (and MariaDB) 5.5.3, and removed in 5.7. + */ +if ( version_compare( $wpdb->db_version(), '5.5.3', '>=' ) ) { + $wpdb->query( 'SET default_storage_engine = InnoDB' ); +} else { + $wpdb->query( 'SET storage_engine = InnoDB' ); +} $wpdb->select( DB_NAME, $wpdb->dbh ); echo "Installing..." . PHP_EOL;