You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR introduces dedicated unit tests for the wp_get_update_php_url() function in wp-includes/functions.php.
The tests verify:
•The default support URL return value.
•The ability to override the URL using the WP_UPDATE_PHP_URL environment variable.
•The ability to override the URL using the wp_update_php_url filter.
•The function's robustness in falling back to the default URL if a filter or environment variable provides an empty or invalid value.
The changes in this pull request can previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.
Some things to be aware of
All changes will be lost when closing a tab with a Playground instance.
All changes will be lost when refreshing the page.
A fresh instance is created each time the link below is clicked.
Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.
Add setup and teardown methods to manage PHP update URL environment variable.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The tests omit the empty-environment-variable fallback case, so coverage is needed to verify that WP_UPDATE_PHP_URL= returns the default URL without a filter.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Test the default URL when the environment variable is empty
The environment-variable test only exercises a non-empty URL, while every fallback dataset below supplies its value through the filter. This leaves the environment-variable fallback described in the PR untested. Add a case that sets WP_UPDATE_PHP_URL= without registering a filter and asserts that the default URL is returned.
The reason will be displayed to describe this comment to others. Learn more.
Please make data_wp_get_update_php_url_empty_fallbacks() public static when relocating this class. PHPUnit 11 rejects non-static providers. The saved environment value in tear_down() is worth keeping because a developer may set a custom URL. The extra putenv() after the override call and the manual filter removal can go: teardown restores the environment and the base class restores hooks. I ran the cases with both removed. The environment override is the clearest new behavior beyond the existing annotation tests.
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
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.
This PR introduces dedicated unit tests for the wp_get_update_php_url() function in wp-includes/functions.php.
The tests verify:
•The default support URL return value.
•The ability to override the URL using the WP_UPDATE_PHP_URL environment variable.
•The ability to override the URL using the wp_update_php_url filter.
•The function's robustness in falling back to the default URL if a filter or environment variable provides an empty or invalid value.
Trac ticket: https://core.trac.wordpress.org/ticket/65653
AI Disclosure:
•AI assistance: Yes
•Tool(s): Junie (JetBrains)
•Model(s): gemini-3-flash-preview
•Used for: Code analysis, test implementation, and workflow management.