REST API: Use a truly impossibly high number in User Controller tests.

The `100` number could be valid in certain test run configurations. The `REST_TESTS_IMPOSSIBLY_HIGH_NUMBER` constant is impossibly high for this very reason.

Fixes #45128.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43767 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daniel Bachhuber 2018-10-19 11:56:20 +00:00
parent 60b2d59358
commit e8eabb8583

View File

@ -798,7 +798,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
public function test_get_user_invalid_id() { public function test_get_user_invalid_id() {
wp_set_current_user( self::$user ); wp_set_current_user( self::$user );
$request = new WP_REST_Request( 'GET', '/wp/v2/users/100' ); $request = new WP_REST_Request( 'GET', '/wp/v2/users/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
$response = $this->server->dispatch( $request ); $response = $this->server->dispatch( $request );
$this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 ); $this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 );
@ -2069,7 +2069,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
$this->allow_user_to_manage_multisite(); $this->allow_user_to_manage_multisite();
wp_set_current_user( self::$user ); wp_set_current_user( self::$user );
$request = new WP_REST_Request( 'DELETE', '/wp/v2/users/100' ); $request = new WP_REST_Request( 'DELETE', '/wp/v2/users/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
$request['force'] = true; $request['force'] = true;
$request->set_param( 'reassign', false ); $request->set_param( 'reassign', false );
$response = $this->server->dispatch( $request ); $response = $this->server->dispatch( $request );
@ -2119,7 +2119,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
$request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d', $user_id ) ); $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d', $user_id ) );
$request['force'] = true; $request['force'] = true;
$request->set_param( 'reassign', 100 ); $request->set_param( 'reassign', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
$response = $this->server->dispatch( $request ); $response = $this->server->dispatch( $request );
// Not implemented in multisite. // Not implemented in multisite.