From b34f289bfd4f6fc12c5f947beae58be5a04177d2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 5 Feb 2020 03:28:33 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/db.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 4934e98b28..aaee36fd9d 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -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 );