Unit Tests: move some oEmbed tests that can trigger HTTP calls to Tests_External_HTTP_OEmbed
.
See #30017, #33968. git-svn-id: https://develop.svn.wordpress.org/trunk@35178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fc7efaf9b1
commit
75e4de9671
46
tests/phpunit/tests/external-http/oembed.php
Normal file
46
tests/phpunit/tests/external-http/oembed.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @group external-http
|
||||||
|
*/
|
||||||
|
class Tests_External_HTTP_OEmbed extends WP_UnitTestCase {
|
||||||
|
/**
|
||||||
|
* Test secure youtube.com embeds
|
||||||
|
*
|
||||||
|
* @ticket 23149
|
||||||
|
*/
|
||||||
|
function test_youtube_com_secure_embed() {
|
||||||
|
$out = wp_oembed_get( 'http://www.youtube.com/watch?v=oHg5SJYRHA0' );
|
||||||
|
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
||||||
|
|
||||||
|
$out = wp_oembed_get( 'https://www.youtube.com/watch?v=oHg5SJYRHA0' );
|
||||||
|
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
||||||
|
|
||||||
|
$out = wp_oembed_get( 'https://youtu.be/zHjMoNQN7s0' );
|
||||||
|
$this->assertContains( 'https://www.youtube.com/embed/zHjMoNQN7s0?feature=oembed', $out );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test m.youtube.com embeds
|
||||||
|
*
|
||||||
|
* @ticket 32714
|
||||||
|
*/
|
||||||
|
function test_youtube_com_mobile_embed() {
|
||||||
|
$out = wp_oembed_get( 'http://m.youtube.com/watch?v=oHg5SJYRHA0' );
|
||||||
|
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
||||||
|
|
||||||
|
$out = wp_oembed_get( 'https://m.youtube.com/watch?v=oHg5SJYRHA0' );
|
||||||
|
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_youtube_embed_url() {
|
||||||
|
global $wp_embed;
|
||||||
|
$out = $wp_embed->autoembed( 'https://www.youtube.com/embed/QcIy9NiNbmo' );
|
||||||
|
$this->assertContains( 'https://youtube.com/watch?v=QcIy9NiNbmo', $out );
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_youtube_v_url() {
|
||||||
|
global $wp_embed;
|
||||||
|
$out = $wp_embed->autoembed( 'https://www.youtube.com/v/QcIy9NiNbmo' );
|
||||||
|
$this->assertContains( 'https://youtube.com/watch?v=QcIy9NiNbmo', $out );
|
||||||
|
}
|
||||||
|
}
|
@ -114,47 +114,6 @@ CAP;
|
|||||||
$this->assertFalse( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
|
$this->assertFalse( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test secure youtube.com embeds
|
|
||||||
*
|
|
||||||
* @ticket 23149
|
|
||||||
*/
|
|
||||||
function test_youtube_com_secure_embed() {
|
|
||||||
$out = wp_oembed_get( 'http://www.youtube.com/watch?v=oHg5SJYRHA0' );
|
|
||||||
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
|
||||||
|
|
||||||
$out = wp_oembed_get( 'https://www.youtube.com/watch?v=oHg5SJYRHA0' );
|
|
||||||
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
|
||||||
|
|
||||||
$out = wp_oembed_get( 'https://youtu.be/zHjMoNQN7s0' );
|
|
||||||
$this->assertContains( 'https://www.youtube.com/embed/zHjMoNQN7s0?feature=oembed', $out );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test m.youtube.com embeds
|
|
||||||
*
|
|
||||||
* @ticket 32714
|
|
||||||
*/
|
|
||||||
function test_youtube_com_mobile_embed() {
|
|
||||||
$out = wp_oembed_get( 'http://m.youtube.com/watch?v=oHg5SJYRHA0' );
|
|
||||||
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
|
||||||
|
|
||||||
$out = wp_oembed_get( 'https://m.youtube.com/watch?v=oHg5SJYRHA0' );
|
|
||||||
$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_youtube_embed_url() {
|
|
||||||
global $wp_embed;
|
|
||||||
$out = $wp_embed->autoembed( 'https://www.youtube.com/embed/QcIy9NiNbmo' );
|
|
||||||
$this->assertContains( 'https://youtube.com/watch?v=QcIy9NiNbmo', $out );
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_youtube_v_url() {
|
|
||||||
global $wp_embed;
|
|
||||||
$out = $wp_embed->autoembed( 'https://www.youtube.com/v/QcIy9NiNbmo' );
|
|
||||||
$this->assertContains( 'https://youtube.com/watch?v=QcIy9NiNbmo', $out );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ticket 23776
|
* @ticket 23776
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user