Commit fec4fe6dfc5 for woocommerce

commit fec4fe6dfc53b8fbff3a48cbbf685fd6f808aa72
Author: iris-woocommerce[bot] <282076412+iris-woocommerce[bot]@users.noreply.github.com>
Date:   Mon Nov 16 16:20:36 2026 +0000

    Fix flaky email editor Embed block thumbnail tests that depended on DNS resolution (#70911)

diff --git a/packages/php/email-editor/changelog/fix-embed-test-dns-flakiness b/packages/php/email-editor/changelog/fix-embed-test-dns-flakiness
new file mode 100644
index 00000000000..b3dfa4f4803
--- /dev/null
+++ b/packages/php/email-editor/changelog/fix-embed-test-dns-flakiness
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+Comment: Make email editor embed thumbnail tests independent of DNS; no production change.
+
diff --git a/packages/php/email-editor/tests/integration/Integrations/Core/Renderer/Blocks/Embed_Test.php b/packages/php/email-editor/tests/integration/Integrations/Core/Renderer/Blocks/Embed_Test.php
index c81a6eb7281..f61c74af647 100644
--- a/packages/php/email-editor/tests/integration/Integrations/Core/Renderer/Blocks/Embed_Test.php
+++ b/packages/php/email-editor/tests/integration/Integrations/Core/Renderer/Blocks/Embed_Test.php
@@ -17,6 +17,13 @@ use Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks\Embed;
  * Integration test for Embed class
  */
 class Embed_Test extends \Email_Editor_Integration_Test_Case {
+	/**
+	 * Host used for mocked oEmbed thumbnail URLs.
+	 * An IP address skips the DNS lookup in wp_http_validate_url().
+	 * WordPress blocks TEST-NET-3, so setUp() allows it with the http_request_host_is_external filter.
+	 */
+	private const MOCK_THUMBNAIL_HOST = 'https://203.0.113.10';
+
 	/**
 	 * Embed renderer instance
 	 *
@@ -103,6 +110,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 	 */
 	public function setUp(): void {
 		parent::setUp();
+		add_filter( 'http_request_host_is_external', fn( $external, $host ) => '203.0.113.10' === $host ? true : $external, 10, 2 );
 		$this->di_container->get( Email_Editor::class )->initialize();
 		$this->embed_renderer    = new Embed();
 		$theme_controller        = $this->di_container->get( Theme_Controller::class );
@@ -561,7 +569,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 	 * Test that YouTube URLs without an extractable video ID fall back to the oEmbed thumbnail lookup
 	 */
 	public function test_youtube_embed_falls_back_to_oembed_thumbnail_for_playlists(): void {
-		$mock_thumbnail_url   = 'https://i.ytimg.com/vi/abc/hqdefault.jpg';
+		$mock_thumbnail_url   = self::MOCK_THUMBNAIL_HOST . '/vi/abc/hqdefault.jpg';
 		$mock_oembed_response = wp_json_encode(
 			array(
 				'type'          => 'video',
@@ -732,7 +740,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 	public function test_renders_videopress_embed(): void {
 		// Mock the oEmbed HTTP response to avoid external calls in CI.
 		// Return a thumbnail URL with query parameters to test the URL encoding fix.
-		$mock_thumbnail_url   = 'https://videos.files.wordpress.com/BZHMfMfN/thumbnail.jpg?w=500&h=281';
+		$mock_thumbnail_url   = self::MOCK_THUMBNAIL_HOST . '/BZHMfMfN/thumbnail.jpg?w=500&h=281';
 		$mock_oembed_response = wp_json_encode(
 			array(
 				'type'          => 'video',
@@ -830,7 +838,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 	 */
 	public function test_videopress_embed_detects_videopress_by_url_in_attributes(): void {
 		// Mock the oEmbed HTTP response to avoid external calls in CI.
-		$mock_thumbnail_url   = 'https://videos.files.wordpress.com/BZHMfMfN/thumbnail.jpg';
+		$mock_thumbnail_url   = self::MOCK_THUMBNAIL_HOST . '/BZHMfMfN/thumbnail.jpg';
 		$mock_oembed_response = wp_json_encode(
 			array(
 				'type'          => 'video',
@@ -876,7 +884,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 	 */
 	public function test_videopress_embed_detects_video_wordpress_com_domain(): void {
 		// Mock the oEmbed HTTP response to avoid external calls in CI.
-		$mock_thumbnail_url   = 'https://videos.files.wordpress.com/BZHMfMfN/thumbnail.jpg';
+		$mock_thumbnail_url   = self::MOCK_THUMBNAIL_HOST . '/BZHMfMfN/thumbnail.jpg';
 		$mock_oembed_response = wp_json_encode(
 			array(
 				'type'          => 'video',
@@ -963,7 +971,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 					'providerNameSlug' => 'vimeo',
 				),
 				'vimeo.com/api/oembed',
-				'https://i.vimeocdn.com/video/123456789.jpg?w=500&h=281',
+				self::MOCK_THUMBNAIL_HOST . '/video/123456789.jpg?w=500&h=281',
 				array( 'w=500', 'h=281' ),
 			),
 			'tiktok'             => array(
@@ -972,14 +980,14 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 					'providerNameSlug' => 'tiktok',
 				),
 				'tiktok.com/oembed',
-				'https://p16-sign.tiktokcdn-us.com/obj/tos-useast5-p-0068-tx/thumbnail.jpg',
+				self::MOCK_THUMBNAIL_HOST . '/obj/tos-useast5-p-0068-tx/thumbnail.jpg',
 				array(),
 			),
 			// No providerNameSlug, so the dai.ly short URL exercises domain-based detection.
 			'dailymotion dai.ly' => array(
 				array( 'url' => 'https://dai.ly/x8x9abc' ),
 				'dailymotion.com/services/oembed',
-				'https://s1.dmcdn.net/v/X8x9abc/x720-thumbnail.jpg',
+				self::MOCK_THUMBNAIL_HOST . '/v/X8x9abc/x720-thumbnail.jpg',
 				array(),
 			),
 		);
@@ -1033,7 +1041,7 @@ class Embed_Test extends \Email_Editor_Integration_Test_Case {
 					'body'     => wp_json_encode(
 						array(
 							'type'          => 'video',
-							'thumbnail_url' => 'https://i.vimeocdn.com/video/123456789.jpg',
+							'thumbnail_url' => self::MOCK_THUMBNAIL_HOST . '/video/123456789.jpg',
 						)
 					),
 				);