Tests: Avoid physical image uploads in Tests_Admin_ExportWp - #13495
Tests: Avoid physical image uploads in Tests_Admin_ExportWp#13495SainathPoojary wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
lancewillett
left a comment
There was a problem hiding this comment.
The simplification looks reasonable.
Before landing, please investigate the PHPUnit failures.
I reproduced that failure locally when running the export tests, the IncludesMedia upload fixtures, and the REST filename tests together.
Upload cleanup and the $ignore_files snapshot look worth investigating. A comparison didn’t guarantee clean uploads, so I haven’t established whether this PR introduces or exposes the problem.
Please resolve the failure and get CI green before we approve and commit this.
Optimizes fixture setup in
Tests_Admin_ExportWpby avoiding physical image uploads and thumbnail generation during sample data preparation.As noted in the ticket description for #66074,
Tests_Admin_ExportWpis driven by fixture and I/O cost. Previously,wpSetUpBeforeClass()calledcreate_upload_object(), which physically copied four JPEGs to the uploads folder and generated intermediate image sizes for each of the 11 tests running in separate PHP processes.export_wp()tests only assert that post and attachment database records appear correctly in the exported XML, they do not inspect physical files or image dimensions. Replacingcreate_upload_object()with$factory->attachment->create()creates the necessary database records and thumbnail relationships directly, eliminating disk writes and GD/Imagick sub-size generation.Performance
Local measurements across three runs (each running 11 tests across separate processes):
While the local time gain is modest and subject to process variance, eliminating disk I/O and thumbnail generation removes unnecessary filesystem churn across all separate test processes.
Validation
set_post_thumbnail) are intact.Trac ticket: https://core.trac.wordpress.org/ticket/66074
Use of AI Tools
AI assistance: Yes
Tool(s): Github Copilot
Used for: Edge-case checks, and assistance with the PR description. Implementation and testing were made and reviewed by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.