Tests: Replace uses of `$this->server` with `rest_get_server()`.
In [42724], `$this->server` was replaced with `rest_get_server()` for better memory recycling. [43862], from the 5.0 branch, was merged into trunk in [44225] and used the now unavailable `$this->server`. This updates the new tests from the 5.0 branch to use the expected `rest_get_server()`. See #45269, #41641. git-svn-id: https://develop.svn.wordpress.org/trunk@44234 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c52b38b844
commit
3bcf9f7e46
|
@ -1671,7 +1671,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||||
$request->set_param( 'alt_text', 'Alt text is stored outside post schema.' );
|
$request->set_param( 'alt_text', 'Alt text is stored outside post schema.' );
|
||||||
|
|
||||||
$request->set_body( file_get_contents( $this->test_file ) );
|
$request->set_body( file_get_contents( $this->test_file ) );
|
||||||
$response = $this->server->dispatch( $request );
|
$response = rest_get_server()->dispatch( $request );
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
$this->assertEquals( 201, $response->get_status() );
|
$this->assertEquals( 201, $response->get_status() );
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||||
);
|
);
|
||||||
$request = new WP_REST_Request( 'POST', '/wp/v2/media/' . $attachment_id );
|
$request = new WP_REST_Request( 'POST', '/wp/v2/media/' . $attachment_id );
|
||||||
$request->set_param( 'title', 'My title is very cool' );
|
$request->set_param( 'title', 'My title is very cool' );
|
||||||
$response = $this->server->dispatch( $request );
|
$response = rest_get_server()->dispatch( $request );
|
||||||
|
|
||||||
$this->assertSame( 1, self::$rest_insert_attachment_count );
|
$this->assertSame( 1, self::$rest_insert_attachment_count );
|
||||||
$this->assertSame( 1, self::$rest_after_insert_attachment_count );
|
$this->assertSame( 1, self::$rest_after_insert_attachment_count );
|
||||||
|
|
Loading…
Reference in New Issue