From f41d3cff7d9b4ef371e163c3410634d90cf17fbb Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 7 Jul 2016 16:47:25 +0000 Subject: [PATCH] Tests: Ensure that test for invalid user ID actually uses an invalid user ID. This prevents false positives when the ID column's incrementor has exceeded the hardcoded invalid ID. Fixes #37308. git-svn-id: https://develop.svn.wordpress.org/trunk@38005 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index 00964676fb..65869eea4d 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -894,8 +894,11 @@ class Tests_User extends WP_UnitTestCase { * @ticket 28004 */ public function test_wp_insert_user_with_invalid_user_id() { + global $wpdb; + $max_user = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->users" ); + $u = wp_insert_user( array( - 'ID' => 123, + 'ID' => $max_user + 1, 'user_login' => 'whatever', 'user_email' => 'whatever@example.com', 'user_pass' => 'password',