From 73d2b30330dc7d1a0898215c159acbcae632f963 Mon Sep 17 00:00:00 2001 From: arthur Date: Wed, 28 Aug 2024 22:18:16 +0900 Subject: [PATCH] Add youtube test back --- .../modules/shortcodes/test-class.youtube.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.youtube.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.youtube.php index 1fe24db8d3ed1..bbb8ed9578566 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.youtube.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/test-class.youtube.php @@ -92,6 +92,31 @@ public function get_youtube_id_options() { ); } + /** + * @author Toro_Unit + * @covers ::youtube_shortcode + * @since 3.9 + */ + public function test_replace_url_with_iframe_in_the_content() { + global $post; + + $youtube_id = 'JaNH56Vpg-A'; + $url = 'http://www.youtube.com/watch?v=' . $youtube_id; + $post = self::factory()->post->create_and_get( array( 'post_content' => "[youtube $url]" ) ); + + setup_postdata( $post ); + ob_start(); + // This below is needed since Core inserts "loading=lazy" right after the iframe opener. + add_filter( 'wp_lazy_loading_enabled', '__return_false' ); + the_content(); + remove_all_filters( 'wp_lazy_loading_enabled' ); + $actual = ob_get_clean(); + wp_reset_postdata(); + $this->assertStringContainsString( 'assertStringContainsString( '