diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
index 6077b088d924a..aef68f068d6b0 100644
--- a/tests/phpunit/tests/oembed/controller.php
+++ b/tests/phpunit/tests/oembed/controller.php
@@ -185,6 +185,9 @@ public function test_wp_oembed_ensure_format() {
$this->assertSame( 'json', wp_oembed_ensure_format( array() ) );
}
+ /**
+ * @requires extension simplexml
+ */
public function test_oembed_create_xml() {
$actual = _oembed_create_xml(
array(
@@ -454,6 +457,9 @@ public function test_request_ms_child_in_root_blog() {
restore_current_blog();
}
+ /**
+ * @requires extension simplexml
+ */
public function test_rest_pre_serve_request() {
$user = get_user_by( 'id', self::$subscriber );
$post = self::factory()->post->create_and_get(
diff --git a/tests/phpunit/tests/oembed/discovery.php b/tests/phpunit/tests/oembed/discovery.php
index e478786ce49e9..20bfcbb9372db 100644
--- a/tests/phpunit/tests/oembed/discovery.php
+++ b/tests/phpunit/tests/oembed/discovery.php
@@ -32,8 +32,10 @@ public function test_add_oembed_discovery_links_static_front_page() {
$this->go_to( home_url() );
$this->assertQueryTrue( 'is_front_page', 'is_singular', 'is_page' );
- $expected = '' . "\n";
- $expected .= '' . "\n";
+ $expected = '' . "\n";
+ if ( class_exists( 'SimpleXMLElement' ) ) {
+ $expected .= '' . "\n";
+ }
$this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
@@ -45,8 +47,10 @@ public function test_add_oembed_discovery_links_to_post() {
$this->go_to( get_permalink( $post_id ) );
$this->assertQueryTrue( 'is_single', 'is_singular' );
- $expected = '' . "\n";
- $expected .= '' . "\n";
+ $expected = '' . "\n";
+ if ( class_exists( 'SimpleXMLElement' ) ) {
+ $expected .= '' . "\n";
+ }
$this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
@@ -63,8 +67,10 @@ public function test_add_oembed_discovery_links_to_page() {
$this->go_to( get_permalink( $post_id ) );
$this->assertQueryTrue( 'is_page', 'is_singular' );
- $expected = '' . "\n";
- $expected .= '' . "\n";
+ $expected = '' . "\n";
+ if ( class_exists( 'SimpleXMLElement' ) ) {
+ $expected .= '' . "\n";
+ }
$this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
}
@@ -83,8 +89,10 @@ public function test_add_oembed_discovery_links_to_attachment() {
$this->go_to( get_permalink( $attachment_id ) );
$this->assertQueryTrue( 'is_attachment', 'is_singular', 'is_single' );
- $expected = '' . "\n";
- $expected .= '' . "\n";
+ $expected = '' . "\n";
+ if ( class_exists( 'SimpleXMLElement' ) ) {
+ $expected .= '' . "\n";
+ }
$this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
}
@@ -132,8 +140,10 @@ public function test_wp_oembed_add_discovery_links_back_compat() {
$wp_head_output = get_echo( 'wp_head' );
$this->assertSame( 1, $mock_action->get_call_count() );
- $expected = '' . "\n";
- $expected .= '' . "\n";
+ $expected = '' . "\n";
+ if ( class_exists( 'SimpleXMLElement' ) ) {
+ $expected .= '' . "\n";
+ }
$this->assertSame( $expected, $wp_head_output, 'Expected wp_head output to be the same as the wp_oembed_add_discovery_links() output.' );
$this->assertSame( $expected, get_echo( $callback ), 'Expected wp_oembed_add_discovery_links() output to be the same as the wp_head output when called outside of wp_head.' );
diff --git a/tests/phpunit/tests/oembed/headers.php b/tests/phpunit/tests/oembed/headers.php
index 8f9c4e4c8d50a..5f5799447f7b5 100644
--- a/tests/phpunit/tests/oembed/headers.php
+++ b/tests/phpunit/tests/oembed/headers.php
@@ -6,6 +6,7 @@
* @group oembed
* @group oembed-headers
* @group xdebug
+ * @requires extension simplexml
*/
class Tests_oEmbed_HTTP_Headers extends WP_UnitTestCase {