mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This replaces all non-static calls to the `WP_UnitTestCase_Base::factory()` method with static function calls, since the method is declared as static. This is a consistency improvement for the test suite. Follow up to [35225], [35242], [49603], [54087]. Props jrf. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@54088 602fd350-edb4-49c9-b593-d223f7449a82
37 lines
948 B
PHP
37 lines
948 B
PHP
<?php
|
|
|
|
/**
|
|
* @runTestsInSeparateProcesses
|
|
* @preserveGlobalState disabled
|
|
* @group oembed
|
|
* @group oembed-headers
|
|
* @group xdebug
|
|
*/
|
|
class Tests_oEmbed_HTTP_Headers extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* @requires function xdebug_get_headers
|
|
*/
|
|
public function test_rest_pre_serve_request_headers() {
|
|
$post = self::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 );
|
|
}
|
|
}
|