Changeset 52010 for trunk/tests/phpunit/tests/oembed/filterResult.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/oembed/filterResult.php
r51397 r52010 5 5 */ 6 6 class Tests_Filter_oEmbed_Result extends WP_UnitTestCase { 7 function test_filter_oembed_result_trusted_malicious_iframe() {7 public function test_filter_oembed_result_trusted_malicious_iframe() { 8 8 $html = '<p></p><iframe onload="alert(1)"></iframe>'; 9 9 … … 13 13 } 14 14 15 function test_filter_oembed_result_with_untrusted_provider() {15 public function test_filter_oembed_result_with_untrusted_provider() { 16 16 $html = '<p></p><iframe onload="alert(1)" src="http://example.com/sample-page/"></iframe>'; 17 17 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), 'http://example.com/sample-page/' ); … … 25 25 } 26 26 27 function test_filter_oembed_result_only_one_iframe_is_allowed() {27 public function test_filter_oembed_result_only_one_iframe_is_allowed() { 28 28 $html = '<div><iframe></iframe><iframe></iframe><p></p></div>'; 29 29 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ); … … 32 32 } 33 33 34 function test_filter_oembed_result_with_newlines() {34 public function test_filter_oembed_result_with_newlines() { 35 35 $html = <<<EOD 36 36 <script>var = 1;</script> … … 45 45 } 46 46 47 function test_filter_oembed_result_without_iframe() {47 public function test_filter_oembed_result_without_iframe() { 48 48 $html = '<span>Hello</span><p>World</p>'; 49 49 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ); … … 57 57 } 58 58 59 function test_filter_oembed_result_secret_param_available() {59 public function test_filter_oembed_result_secret_param_available() { 60 60 $html = '<iframe src="https://wordpress.org"></iframe>'; 61 61 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ); … … 69 69 } 70 70 71 function test_filter_oembed_result_wrong_type_provided() {71 public function test_filter_oembed_result_wrong_type_provided() { 72 72 $actual = wp_filter_oembed_result( 'some string', (object) array( 'type' => 'link' ), '' ); 73 73 … … 75 75 } 76 76 77 function test_filter_oembed_result_invalid_result() {77 public function test_filter_oembed_result_invalid_result() { 78 78 $this->assertFalse( wp_filter_oembed_result( false, (object) array( 'type' => 'rich' ), '' ) ); 79 79 $this->assertFalse( wp_filter_oembed_result( '', (object) array( 'type' => 'rich' ), '' ) ); 80 80 } 81 81 82 function test_filter_oembed_result_blockquote_adds_style_to_iframe() {82 public function test_filter_oembed_result_blockquote_adds_style_to_iframe() { 83 83 $html = '<blockquote></blockquote><iframe></iframe>'; 84 84 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ); … … 87 87 } 88 88 89 function test_filter_oembed_result_allowed_html() {89 public function test_filter_oembed_result_allowed_html() { 90 90 $html = '<blockquote class="foo" id="bar"><strong><a href="" target=""></a></strong></blockquote><iframe></iframe>'; 91 91 $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ); … … 131 131 * @group feed 132 132 */ 133 function test_filter_feed_content() {133 public function test_filter_feed_content() { 134 134 $html = '<blockquote></blockquote><iframe></iframe>'; 135 135 $actual = _oembed_filter_feed_content( wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ) );
Note: See TracChangeset
for help on using the changeset viewer.