From ddf2d5ad06842e4047fbe0c69b8eb778e5561ae8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 5 Feb 2020 18:19:11 +0000 Subject: [PATCH] Tests: In `Tests_dbDelta::setUp()`, only force MyISAM database engine on MySQL versions older than 5.7. Since MySQL 5.7, InnoDB engine supports `FULLTEXT` indexes, so forcing MyISAM is unnecessary. Props xkon, joonasvanhatapio, SergeyBiryukov. Fixes #49367. git-svn-id: https://develop.svn.wordpress.org/trunk@47193 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/dbdelta.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/dbdelta.php b/tests/phpunit/tests/dbdelta.php index 2950f27a2a..208979e9b3 100644 --- a/tests/phpunit/tests/dbdelta.php +++ b/tests/phpunit/tests/dbdelta.php @@ -40,13 +40,18 @@ class Tests_dbDelta extends WP_UnitTestCase { global $wpdb; $db_version = $wpdb->db_version(); + $db_engine = ''; + + if ( version_compare( $db_version, '5.7', '<' ) ) { + // Forcing MyISAM, because InnoDB only started supporting FULLTEXT indexes in MySQL 5.7. + $db_engine = 'ENGINE=MyISAM'; + } if ( version_compare( $db_version, '8.0.17', '<' ) ) { // Prior to MySQL 8.0.17, default width of 20 digits was used: BIGINT(20). $this->bigint_display_width = '(20)'; } - // Forcing MyISAM, because InnoDB only started supporting FULLTEXT indexes in MySQL 5.7. $wpdb->query( $wpdb->prepare( " @@ -59,8 +64,9 @@ class Tests_dbDelta extends WP_UnitTestCase { PRIMARY KEY (id), KEY key_1 (column_1(%d)), KEY compound_key (id,column_1(%d)), - FULLTEXT KEY fulltext_key (column_1) - ) ENGINE=MyISAM + FULLTEXT KEY fulltext_key (column_1)" . + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + ") $db_engine ", $this->max_index_length, $this->max_index_length