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
This commit is contained in:
John Blackbourn 2021-02-27 14:36:22 +00:00
parent 5b2b525169
commit 22e72cbdf2
2 changed files with 24 additions and 0 deletions

View File

@ -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;

View File

@ -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]' );