function test_request_xml_response_headers() { if (!function_exists('xdebug_get_headers')) { $this->markTestSkipped('xdebug is required for this test'); } $post = self::factory()->post->create_and_get(array('post_title' => 'Hello World')); $request = array('url' => get_permalink($post->ID), 'format' => 'xml', 'maxwidth' => 600); $legacy_controller = new WP_oEmbed_Controller(); $legacy_controller->dispatch($request); $headers = xdebug_get_headers(); $this->assertTrue(in_array('Content-Type: text/xml; charset=' . get_option('blog_charset'), $headers)); }
/** * Registers the oEmbed REST API route. * * @since 4.4.0 */ function wp_oembed_register_route() { $controller = new WP_oEmbed_Controller(); $controller->register_routes(); }
/** * @group multisite */ function test_request_ms_child_in_root_blog() { if (!is_multisite()) { $this->markTestSkipped(__METHOD__ . ' is a multisite-only test.'); } $child = self::factory()->blog->create(); switch_to_blog($child); $post = self::factory()->post->create_and_get(array('post_title' => 'Hello Child Blog')); $request = array('url' => get_permalink($post->ID), 'format' => 'json', 'maxwidth' => 600, 'callback' => ''); $legacy_controller = new WP_oEmbed_Controller(); $data = json_decode($legacy_controller->dispatch($request), true); $this->assertInternalType('array', $data); $this->assertNotEmpty($data); restore_current_blog(); }
/** * Parses an oEmbed API query. * * @since 4.4.0 * * @see WP_oEmbed_Controller::parse_query() * * @param WP_Query $wp_query The current WP_Query instance. */ function wp_oembed_parse_query($wp_query) { $controller = new WP_oEmbed_Controller(); $controller->parse_query($wp_query); }