From 4c74a9d0047e36d85e69278bbd0518651ead2e5b 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 | 26 +++++++++++++++++++ 1 file changed, 26 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..970e5f6050e1d 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,32 @@ 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]" ) ); + + wpcom_youtube_embed_crazy_url_init(); + 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( '