public function test_get_current_user() { $response = $this->endpoint->get_current_user(); $this->assertNotInstanceOf('WP_Error', $response); if (!$response instanceof WP_JSON_ResponseInterface) { $response = new WP_JSON_Response($response); } // Check that we succeeded $this->assertEquals(302, $response->get_status()); $headers = $response->get_headers(); $response_data = $response->get_data(); $this->assertArrayHasKey('Location', $headers); $this->assertEquals($response_data['meta']['links']['self'], $headers['Location']); $this->check_get_user_response($response, $this->user_obj); }