From 08c73bfcbb67e9125949f31beb8b2f35b3236ae5 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Fri, 11 Sep 2026 17:38:28 +0530 Subject: [PATCH 1/2] Tests: Avoid physical image uploads in Tests_Admin_ExportWp --- tests/phpunit/tests/admin/exportWp.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/admin/exportWp.php b/tests/phpunit/tests/admin/exportWp.php index f17ef0d4ad343..5eaf5dd970dbe 100644 --- a/tests/phpunit/tests/admin/exportWp.php +++ b/tests/phpunit/tests/admin/exportWp.php @@ -44,7 +44,6 @@ class Tests_Admin_ExportWp extends WP_UnitTestCase { public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { require_once ABSPATH . 'wp-admin/includes/export.php'; - $file = DIR_TESTDATA . '/images/test-image.jpg'; $dataset = array( 'post 1' => array( @@ -71,8 +70,16 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { $attachment_key = "attachment for $post_key"; $post_data['post_author'] = $factory->user->create( array( 'role' => 'editor' ) ); - $post_id = $factory->post->create( $post_data ); - $attachment_id = $factory->attachment->create_upload_object( $file, $post_id ); + $post_id = $factory->post->create( $post_data ); + + // Export needs attachment records, not uploaded files or generated image sizes. + $attachment_id = $factory->attachment->create( + array( + 'file' => 'test-image.jpg', + 'post_parent' => $post_id, + 'post_mime_type' => 'image/jpeg', + ) + ); set_post_thumbnail( $post_id, $attachment_id ); self::$post_ids[ $post_key ] = array( From 28b93a68c304029b0e5dd460cd5bc59ebd10b7bc Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Fri, 11 Sep 2026 17:46:29 +0530 Subject: [PATCH 2/2] refactor: remove redundant comment --- tests/phpunit/tests/admin/exportWp.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/phpunit/tests/admin/exportWp.php b/tests/phpunit/tests/admin/exportWp.php index 5eaf5dd970dbe..6390f66f230dc 100644 --- a/tests/phpunit/tests/admin/exportWp.php +++ b/tests/phpunit/tests/admin/exportWp.php @@ -72,7 +72,6 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { $post_id = $factory->post->create( $post_data ); - // Export needs attachment records, not uploaded files or generated image sizes. $attachment_id = $factory->attachment->create( array( 'file' => 'test-image.jpg',