Repository navigation
REST API: Rename check_domain_is_available() to check_url_is_available() - #6
Merged
lloc merged 2 commits intoSep 30, 2026
Conversation
…e(). The method checks both the `domain` and `path` of a prepared site, not just the domain, so `check_domain_is_available()` was a misleading name. Renamed to check_url_is_available() (domain + path together form the site's URL) and updated its one call site accordingly. Docblock already described the domain+path behavior correctly and needed no changes; no tests reference the method by name, and the existing domain/path-taken conflict tests (test_create_item_domain_validation, test_update_item_*) continue to pass unchanged since this is a pure rename with no behavior change. See #40365. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
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 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. |
Adds a get_reflective_method() helper (matching the pattern already used in wpRestUrlDetailsController.php) to directly unit test the renamed protected method, rather than only exercising it indirectly through create_item()/update_item(). Covers, using @dataProvider where the setup is shared: - create: a brand new domain/path is available, an existing one is rejected, and omitting `path` entirely falls back to '/' and still conflicts (test_check_url_is_available_on_create, 3 data sets). - update: keeping the site's own domain/path via the current-site fallback is not a conflict, changing to another site's domain/path is (test_check_url_is_available_on_update, 2 data sets). - the same domain/path is available on a different network (standalone, needs its own network fixture). - an invalid site ID on update propagates get_site()'s WP_Error rather than reaching the domain/path check (standalone, distinct assertion). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Actions @peterwilsoncc's review feedback: WordPress#13055 (comment)
check_domain_is_available()checks both thedomainandpathof a prepared site (seedomain_exists( $domain, $path, $network_id )inside it), not just the domain, so the name was misleading. Renamed tocheck_url_is_available(), since domain + path together form the site's URL.prepare_item_for_database()(also renamed the local$domain_checkvariable to$url_checkfor consistency).create_item/update_item), so no test changes were needed either — confirmed the existing domain/path-conflict tests (test_create_item_domain_validation, theupdate_itemequivalent, etc.) still pass unchanged, since this is a pure rename with no behavior change.Test plan
WP_Test_REST_Sites_Controllerpasses against a single-site installWP_Test_REST_Sites_Controllerpasses against a multisite installcomposer lint(phpcs) clean on the changed file🤖 Generated with Claude Code