Tests: Optimize WP_Test_REST_Attachments_Controller fixtures - #13619
Draft
SainathPoojary wants to merge 1 commit into
Draft
SainathPoojary wants to merge 1 commit into
SainathPoojary wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimizes fixture setup in
WP_Test_REST_Attachments_Controllerby avoiding unnecessary image processing in tests that do not check generated image sizes.Three permission tests previously uploaded JPEG files and generated intermediate image sizes before asserting that the REST request was rejected. The permission callback returns the expected error before image editing begins, so these tests now create attachment records directly with the required MIME type, status, and file path.
The EXIF orientation test still uploads and edits a real image, but it only checks the full-size image dimensions after rotation. It now skips intermediate image size generation while preserving the real upload, EXIF correction, rotation, and all assertions.
All 200 tests and 1,159 assertions remain unchanged and pass.
Performance
Measured locally across three consecutive runs comparing
trunkto this branch: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 done 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.