Tests: Allow `wpdb::set_sql_mode()` tests to run on MySQL 8.0.11+.

MySQL 8.0.11 removed support for the `NO_AUTO_CREATE_USER` SQL mode, which was used in as an example of a mode compatible with WordPress.

`NO_AUTO_VALUE_ON_ZERO` is now used in the affected tests instead, which is supported on both MySQL 5.7.x and 8.0.x.

Props kaggdesign, jeremyfelt, afragen.
Fixes #44586. See #49344.

git-svn-id: https://develop.svn.wordpress.org/trunk@47183 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-02-05 03:28:33 +00:00
parent 1fa5058ef3
commit b34f289bfd
1 changed files with 3 additions and 3 deletions

View File

@ -295,7 +295,7 @@ class Tests_DB extends WP_UnitTestCase {
$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
$new_modes = array( 'IGNORE_SPACE', 'NO_AUTO_CREATE_USER' );
$new_modes = array( 'IGNORE_SPACE', 'NO_AUTO_VALUE_ON_ZERO' );
$wpdb->set_sql_mode( $new_modes );
@ -315,7 +315,7 @@ class Tests_DB extends WP_UnitTestCase {
$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
$new_modes = array( 'IGNORE_SPACE', 'NO_ZERO_DATE', 'NO_AUTO_CREATE_USER' );
$new_modes = array( 'IGNORE_SPACE', 'NO_ZERO_DATE', 'NO_AUTO_VALUE_ON_ZERO' );
$wpdb->set_sql_mode( $new_modes );
$check_new_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
$this->assertNotContains( 'NO_ZERO_DATE', explode( ',', $check_new_modes ) );
@ -333,7 +333,7 @@ class Tests_DB extends WP_UnitTestCase {
$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
$new_modes = array( 'IGNORE_SPACE', 'ONLY_FULL_GROUP_BY', 'NO_AUTO_CREATE_USER' );
$new_modes = array( 'IGNORE_SPACE', 'ONLY_FULL_GROUP_BY', 'NO_AUTO_VALUE_ON_ZERO' );
add_filter( 'incompatible_sql_modes', array( $this, 'filter_allowed_incompatible_sql_mode' ), 1, 1 );
$wpdb->set_sql_mode( $new_modes );