WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 14 months ago

#35196 new task (blessed)

Unit tests for URL schemes

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: https has-patch
Focuses: Cc:

Description

In order to tackle various HTTPS related issues, it would be ideal to have test coverage for the schemes of URLs returned by the URL-generating functions under various conditions.

For example, we know that admin_url() should always return a URL with an https scheme when FORCE_SSL_ADMIN is true. However the scheme in the URL returned by home_url() varies depending on the current request's scheme as well as the home option's scheme.

We can test all combinations of schemes in the home and siteurl options, as well as the force_ssl_admin() setting, and test the schemes of URLs returned by various functions under various situations (admin vs. front end, and is_ssl() vs. not).

Patch coming up soon.

Attachments (1)

35196.diff (6.8 KB) - added by johnbillion 2 years ago.

Download all attachments as: .zip

Change History (3)

@johnbillion
2 years ago

#1 @johnbillion
2 years ago

  • Keywords has-patch added; needs-patch removed

35196.diff is where I'm going with this. data_scheme_matrix() defines a matrix of information about which functions should return a URL with an https scheme under which circumstances. It's incomplete, and there are many failures, particularly due to the fact that wp_upload_dir() is not testable due to its use of the WP_CONTENT_URL constant.

This ticket was mentioned in Slack in #core-http by johnbillion. View the logs.


14 months ago

Note: See TracTickets for help on using tickets.