Dominant Color Images: Clean up redundant metadata generation in tests - #2649
Dominant Color Images: Clean up redundant metadata generation in tests#2649wprashed wants to merge 2 commits into
Conversation
Removes unnecessary calls to wp_maybe_generate_attachment_metadata() following create_upload_object() and asserts directly against generated attachment metadata in test_get_dominant_color_valid(). Fixes WordPress#2524.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #2649 +/- ##
=======================================
Coverage 70.35% 70.35%
=======================================
Files 91 91
Lines 7867 7867
=======================================
Hits 5535 5535
Misses 2332 2332
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Fixes #2524.
In
Dominant_Color_ImagesTestsTestCase,create_upload_object()automatically invokeswp_generate_attachment_metadata(), which triggers thedominant_color_metadatafilter and attaches dominant color data.Subsequent calls to
wp_maybe_generate_attachment_metadata()were redundant because metadata was already populated.Changes
wp_maybe_generate_attachment_metadata()calls inclass-testcase.phpandtest-dominant-color.php.test_get_dominant_color_valid()to assert directly on the generated_wp_attachment_metadata, testing the end-to-end flow from upload to metadata storage.Testing Instructions
composer test:dominant-color-imagesor run PHPUnit on the dominant color images test suite.