summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohn Blackbourn <johnbillion@git.wordpress.org>2021-02-27 14:36:22 +0000
committerJohn Blackbourn <johnbillion@git.wordpress.org>2021-02-27 14:36:22 +0000
commit22e72cbdf2d3612d5de0646e494788a1135355c0 (patch)
treea0cfa6a2f6fdcb3c7058f504d1a25c82a33eb333
parent5b2b525169ac46d7feb0dac82168691a62a7ae6b (diff)
downloadwordpress-22e72cbdf2d3612d5de0646e494788a1135355c0.tar.gz
wordpress-22e72cbdf2d3612d5de0646e494788a1135355c0.zip
Build/Test Tools: Add some more tests that perform HTTP requests to the `external-http` test group.
See #52625 git-svn-id: https://develop.svn.wordpress.org/trunk@50448 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r--tests/phpunit/tests/media.php6
-rw-r--r--tests/phpunit/tests/oembed/WpEmbed.php18
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 055618f620..bc9b593d15 100644
--- a/tests/phpunit/tests/media.php
+++ b/tests/phpunit/tests/media.php
@@ -280,6 +280,8 @@ CAP;
/**
* @ticket 23776
+ *
+ * @group external-http
*/
function test_autoembed_no_paragraphs_around_urls() {
global $wp_embed;
@@ -1280,6 +1282,8 @@ EOF;
/**
* @ticket 33016
+ *
+ * @group external-http
*/
function test_multiline_comment_with_embeds() {
$content = <<<EOF
@@ -1323,6 +1327,8 @@ EOF;
/**
* @ticket 33016
+ *
+ * @group external-http
*/
function test_oembed_explicit_media_link() {
global $wp_embed;
diff --git a/tests/phpunit/tests/oembed/WpEmbed.php b/tests/phpunit/tests/oembed/WpEmbed.php
index fea9500d47..b01ca75eff 100644
--- a/tests/phpunit/tests/oembed/WpEmbed.php
+++ b/tests/phpunit/tests/oembed/WpEmbed.php
@@ -105,6 +105,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$this->assertArrayNotHasKey( 'youtube_embed_url', $handlers );
}
+ /**
+ * @group external-http
+ */
public function test_autoembed_should_do_nothing_without_matching_handler() {
$content = "\nhttp://example.com/embed/foo\n";
@@ -112,6 +115,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$this->assertSame( $content, $actual );
}
+ /**
+ * @group external-http
+ */
public function test_autoembed_should_return_modified_content() {
$handle = __FUNCTION__;
$regex = '#https?://example\.com/embed/([^/]+)#i';
@@ -317,6 +323,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
remove_filter( 'oembed_ttl', '__return_zero' );
}
+ /**
+ * @group external-http
+ */
public function test_shortcode_should_get_url_from_src_attribute() {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->shortcode( array( 'src' => $url ) );
@@ -324,10 +333,16 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$this->assertSame( '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>', $actual );
}
+ /**
+ * @group external-http
+ */
public function test_shortcode_should_return_empty_string_for_missing_url() {
$this->assertEmpty( $this->wp_embed->shortcode( array() ) );
}
+ /**
+ * @group external-http
+ */
public function test_shortcode_should_make_link_for_unknown_url() {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->shortcode( array(), $url );
@@ -335,6 +350,9 @@ class Tests_WP_Embed extends WP_UnitTestCase {
$this->assertSame( '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>', $actual );
}
+ /**
+ * @group external-http
+ */
public function test_run_shortcode_url_only() {
$url = 'http://example.com/embed/foo';
$actual = $this->wp_embed->run_shortcode( '[embed]' . $url . '[/embed]' );