Make WordPress Core


Ignore:
Timestamp:
12/17/2018 01:41:10 AM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r44254 r44256  
    37793779        // 'my_custom_int' should appear because ?_fields= isn't set.
    37803780        $request  = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
    3781         $response = $this->server->dispatch( $request );
     3781        $response = rest_get_server()->dispatch( $request );
    37823782        $this->assertArrayHasKey( 'my_custom_int', $response->data );
    37833783
     
    37853785        $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
    37863786        $request->set_param( '_fields', 'title,my_custom_int' );
    3787         $response = $this->server->dispatch( $request );
     3787        $response = rest_get_server()->dispatch( $request );
    37883788        $this->assertArrayHasKey( 'my_custom_int', $response->data );
    37893789
     
    37913791        $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
    37923792        $request->set_param( '_fields', 'title' );
    3793         $response = $this->server->dispatch( $request );
     3793        $response = rest_get_server()->dispatch( $request );
    37943794        $this->assertArrayNotHasKey( 'my_custom_int', $response->data );
    37953795
Note: See TracChangeset for help on using the changeset viewer.