From 3bcf9f7e4687cb30e10acf35ff7630c2c8be7057 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Sun, 16 Dec 2018 18:53:58 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/rest-api/rest-attachments-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php index 408af92396..0ec277ab3a 100644 --- a/tests/phpunit/tests/rest-api/rest-attachments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-attachments-controller.php @@ -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_body( file_get_contents( $this->test_file ) ); - $response = $this->server->dispatch( $request ); + $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); $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->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_after_insert_attachment_count );