Tests: Replace use of `$this->server` with `rest_get_server()` in `test_get_additional_field_registration_null_schema()`.

In [42724], `$this->server` was replaced with `rest_get_server()` for better memory recycling.

[43908], from the 5.0 branch, was merged into trunk in [44254] and used the now unavailable `$this->server`.

This updates the new test from the 5.0 branch to use the expected `rest_get_server()`.

See #45220, #41641.

git-svn-id: https://develop.svn.wordpress.org/trunk@44256 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2018-12-17 01:41:10 +00:00
parent e3e683fc09
commit 0ca5139e70
1 changed files with 3 additions and 3 deletions

View File

@ -3778,19 +3778,19 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
// 'my_custom_int' should appear because ?_fields= isn't set.
$request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
$response = $this->server->dispatch( $request );
$response = rest_get_server()->dispatch( $request );
$this->assertArrayHasKey( 'my_custom_int', $response->data );
// 'my_custom_int' should appear because it's present in ?_fields=.
$request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
$request->set_param( '_fields', 'title,my_custom_int' );
$response = $this->server->dispatch( $request );
$response = rest_get_server()->dispatch( $request );
$this->assertArrayHasKey( 'my_custom_int', $response->data );
// 'my_custom_int' should not appear because it's not present in ?_fields=.
$request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
$request->set_param( '_fields', 'title' );
$response = $this->server->dispatch( $request );
$response = rest_get_server()->dispatch( $request );
$this->assertArrayNotHasKey( 'my_custom_int', $response->data );
global $wp_rest_additional_fields;