Repository navigation
Tests: Use create_upload_object() in getAvailablePostMimeTypes tests - #15994
shail-mehta wants to merge 2 commits into
Conversation
Follow-up to [65522] and [65523]. See #42990.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the attachment-factory test setup change.
No open issues 🎉
What changed in this PR
This PR standardizes attachment setup in the get_available_post_mime_types() tests ahead of deprecating WP_UnitTestCase::_make_attachment().
Changes:
- Replaces manual JPEG and PDF uploads with
create_upload_object(). - Removes upload-error assertions tied to the deleted
$uploadsetup while preserving the MIME-type assertions.
| File | Description |
|---|---|
tests/phpunit/tests/post/getAvailablePostMimeTypes.php |
Uses the attachment factory to simplify JPEG and PDF test setup. |
Review effort: Balanced
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
The factory uses the same upload and attachment-creation path, while the test keeps its exact MIME-list assertion. This removes duplicated fixture code without adding tests. Randomized single-site and multisite checks and PHPCS passed; the existing skip is also present on the baseline.
AI review · gpt-6
Replace duplicated upload and attachment setup with `create_upload_object()` in MIME type, template, and AJAX crop tests. Remove the unused custom-logo URL fixture. Follow-up to r65522, r65523. Developed in: #15994, #15995, #15998 Props shailu25, huzaifaalmesbah, desrosj. See #42990. git-svn-id: https://develop.svn.wordpress.org/trunk@65562 602fd350-edb4-49c9-b593-d223f7449a82
Replace duplicated upload and attachment setup with `create_upload_object()` in MIME type, template, and AJAX crop tests. Remove the unused custom-logo URL fixture. Follow-up to r65522, r65523. Developed in: WordPress/wordpress-develop#15994, WordPress/wordpress-develop#15995, WordPress/wordpress-develop#15998 Props shailu25, huzaifaalmesbah, desrosj. See #42990. Built from https://develop.svn.wordpress.org/trunk@65562 git-svn-id: http://core.svn.wordpress.org/trunk@64635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15994 landed in https://core.trac.wordpress.org/changeset/65562 |
Replace duplicated upload and attachment setup with `create_upload_object()` in MIME type, template, and AJAX crop tests. Remove the unused custom-logo URL fixture. Follow-up to r65522, r65523. Developed in: WordPress#15994, WordPress#15995, WordPress#15998 Props shailu25, huzaifaalmesbah, desrosj. See #42990. git-svn-id: https://develop.svn.wordpress.org/trunk@65562 602fd350-edb4-49c9-b593-d223f7449a82
Part of : #42990
What?
Switch the remaining easy
_make_attachment()callers intests/phpunit/tests/post/getAvailablePostMimeTypes.phptoself::factory()->attachment->create_upload_object().Why?
Use
create_upload_object()consistently before deprecatingWP_UnitTestCase::_make_attachment().These two calls only uploaded via
wp_upload_bits(), asserted$upload['error'], then called_make_attachment()— the same pattern already converted in the earlier PRs.How?
_make_attachment()setup withcreate_upload_object().assertEmpty( $upload['error'] )guards that went away with$upload.attachments.phpuses$upload['file']/ empty GUID;template.phpneeds$upload['url'];wpAjaxCropImage.phpbuilds the upload array by hand).Testing Instructions
npm run env:startnpm run test:php -- --filter Tests_Post_GetAvailablePostMimeTypes-c tests/phpunit/multisite.xmland with--order-by=random.Use of AI Tools