forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheaders.php
More file actions
36 lines (29 loc) · 942 Bytes
/
headers.php
File metadata and controls
36 lines (29 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @group oembed
* @group oembed-headers
* @group xdebug
*/
class Tests_oEmbed_HTTP_Headers extends WP_UnitTestCase {
/**
* @requires function xdebug_get_headers
*/
function test_rest_pre_serve_request_headers() {
$post = $this->factory()->post->create_and_get(
array(
'post_title' => 'Hello World',
)
);
$request = new WP_REST_Request( 'GET', '/oembed/1.0/embed' );
$request->set_param( 'url', get_permalink( $post->ID ) );
$request->set_param( 'format', 'xml' );
$server = new WP_REST_Server();
$response = $server->dispatch( $request );
$output = get_echo( '_oembed_rest_pre_serve_request', array( true, $response, $request, $server ) );
$this->assertNotEmpty( $output );
$headers = xdebug_get_headers();
$this->assertContains( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers );
}
}