Make WordPress Core

Opened 5 months ago

Last modified 4 months ago

#63967 new defect (bug)

REST API test methods using supported image format to test unsupported logic checks

Reported by: desrosj's profile desrosj Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: REST API Keywords: good-first-bug has-patch has-unit-tests
Focuses: tests Cc:

Description

The WP_Test_REST_Attachments_Controller::test_upload_unsupported_image_type and WP_Test_REST_Attachments_Controller::test_upload_unsupported_image_type_with_filter test methods try to validate that the attachment controller correctly handles scenarios where an unsupported image type is provided. They are currently using the AVIF.

It's becoming more and more common for environments to include AVIF support. As a result, these tests are often skipped. A more obscure format should be used to ensure the test runs more consistently.

Change History (6)

#1 @desrosj
5 months ago

  • Focuses tests added

One possible adjustment that could be made to prevent this test from being skipped in the future is to fail the test if the image format used is supported in the environment. When that happens, it's more obvious and it can be changed to a different format.

#2 @rishabhwp
5 months ago

Hey @desrosj,

I’d like to work on this issue. For the format change, I was considering using TGA (Truevision TGA) since it’s rarely supported and there’s already a test-image.tga available in the image test data. Is TGA the right replacement, or would you recommend a different one?

#3 @desrosj
5 months ago

@rishabhwp I think that should work well!

#4 @jignesh.nakrani
5 months ago

@desrosj @rishabhwp Truevision TGA files will not work, as they are not recognised or usable by PHP.

Last edited 5 months ago by jignesh.nakrani (previous) (diff)

This ticket was mentioned in PR #10057 on WordPress/wordpress-develop by @jignesh.nakrani.


5 months ago
#5

  • Keywords has-patch has-unit-tests added; needs-patch removed

Trac ticket: https://core.trac.wordpress.org/ticket/63967

Updated REST API test methods using the unsupported image format to test unsupported logic checks

Note: See TracTickets for help on using tickets.