wordpress-develop/tests/phpunit/tests
Peter Wilson 63f3914e51 Users: Validate WP_User_Query's fields argument.
Improve validation of `WP_User_Query`'s `fields` argument when passed as an array to ensure it only accepts permitted values. This prevents the invalid values being included in the generated database query.

Expand unit tests to include passing invalid values as part of an array, the lower case value `id`. Correct earlier unit tests to limit database query to one result.

Follow up to [53255].

Props felipeelia.
Fixes #53177.



git-svn-id: https://develop.svn.wordpress.org/trunk@53327 602fd350-edb4-49c9-b593-d223f7449a82
2022-05-02 00:11:48 +00:00
..
actions Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
admin Editor: Register 'lock' attribute for every block on the server 2022-04-26 09:48:20 +00:00
ajax Administration: Add unit test for term supplementary notice. 2022-04-12 15:59:45 +00:00
attachment Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
block-supports Editor: Fix styles for nested elements (link color) 2022-04-25 16:35:16 +00:00
blocks Editor: Show comment previews in the Comment Query Loop. 2022-04-28 01:16:18 +00:00
bookmark General: Fix 'rel' argument in Tests_Functions_wpListBookmarks test datasets. 2021-12-21 00:10:26 +00:00
canonical Canonical: Check if the URL scheme exists in strip_fragment_from_url(). 2022-03-09 15:06:09 +00:00
category Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
comment Comments: Avoid DB error in comment meta queries. 2022-04-27 04:08:16 +00:00
compat General: Introduce polyfills for str_ends_with() and str_starts_with() added in PHP 8.0. 2021-11-08 14:21:44 +00:00
cron Code Modernization: Add input validation to _set_cron_array(). 2021-08-30 15:19:38 +00:00
customize Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
date Date/Time: Add a unit test for the return type of current_datetime(). 2022-01-21 05:58:13 +00:00
db Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
dependencies I18N, Script Loader: Don't register empty locale data objects. 2022-03-15 15:57:57 +00:00
editor Tests: Rename classes in phpunit/tests/editor/ per the naming conventions. 2021-08-20 16:11:04 +00:00
error-protection Tests: Rename classes in phpunit/tests/error-protection/ per the naming conventions. 2021-08-21 15:32:53 +00:00
external-http Tests: Add a unit test for the recommended MariaDB version in readme.html. 2021-12-30 16:27:48 +00:00
feed Build/Test Tools: Typo correction in rss2 unit tests. 2022-04-21 23:11:10 +00:00
filesystem Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
formatting Docs: Update a link to the Custom Elements spec in unsupported_valid_tag_names() unit test docblock. 2022-04-18 14:41:17 +00:00
functions Tests: Add unit tests for some XML-RPC functions: 2022-05-02 00:11:35 +00:00
general Feeds: Remove comment feed HTML headers when empty. 2022-04-11 05:01:04 +00:00
hooks Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
http Tests: Mock the HTTP request response in download_url() tests. 2021-12-15 19:59:32 +00:00
image Media: Ensure wp_crop_image() returns correct file type. 2022-04-27 05:19:52 +00:00
import Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
includes Build/Test Tools: Switch to some more appropriate assertions. 2022-01-30 19:40:57 +00:00
l10n Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
link Docs: Fix typo in some get_edit_term_link() test DocBlocks. 2021-12-02 05:39:57 +00:00
load Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
media Docs: Adjust documentation in get_post_galleries() tests per the documentation standards. 2022-03-23 15:01:48 +00:00
menu Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
meta Build/Test Tools: Correct the order and naming of expected and actual values in various tests. 2021-11-25 19:39:31 +00:00
multisite Networks and Sites: Improve cache key generation in WP_Network_Query class. 2022-04-07 17:57:59 +00:00
oembed Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:23:32 +00:00
option Docs: Correct the format of some comments per the documentation standards. 2021-12-10 20:28:27 +00:00
pomo Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
post Posts, Post Types/Taxonomies: Add object type specific registration filters. 2022-04-11 05:09:53 +00:00
privacy Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
query Query: Add tests following [53065]. 2022-04-05 01:59:52 +00:00
rest-api REST API: Correct the schema for the wp/v2/block-directory/search endpoint. 2022-04-29 16:53:55 +00:00
rewrite Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
sitemaps Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
taxonomy Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
term Taxonomy: Increase cache hits in WP_Term_Query when using include and exclude parameters. 2022-04-29 12:34:35 +00:00
theme Themes: Add internal-only theme.json's webfonts handler (stopgap). 2022-04-26 14:46:37 +00:00
url Build/Test Tools: Standardise the name, signature, and usage of the wpSetUpBeforeClass() method that's used in test classes. 2020-11-15 13:59:32 +00:00
user Users: Validate WP_User_Query's fields argument. 2022-05-02 00:11:48 +00:00
webfonts Tests: Ignore EOL differences in Webfonts API tests. 2022-04-30 11:33:30 +00:00
widgets HTTP API: Revert changeset [52244]. 2021-12-06 21:29:00 +00:00
wp Docs: Add a @since note for WP::parse_request() about the new return value. 2022-03-02 15:38:27 +00:00
xmlrpc Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
actions.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
adminbar.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
auth.php Users: Prevent infinite loop when using capability checks during determine_current_user on multisite. 2021-11-15 01:08:35 +00:00
avatar.php Tests: Replace assertRegExp() with assertMatchesRegularExpression(). 2021-08-06 21:52:06 +00:00
basic.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
block-template-utils.php Editor: Add functionality required for theme export in the site editor 2022-04-11 10:36:02 +00:00
block-template.php Site Editor: Resolve homepage template on server-side 2022-04-07 13:33:03 +00:00
cache.php Cache API: Reorder object cache functions and methods for consistency. 2022-02-11 18:47:38 +00:00
canonical.php Canonical: Include all public status in 404 redirects. 2022-04-01 03:23:07 +00:00
category.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
comment-submission.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
comment.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
cron.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
db.php WPDB: Call wp_load_translations_early() in wpdb::query() and wpdb::process_fields(). 2021-11-19 18:58:14 +00:00
dbdelta.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
dependencies.php Script Loader: Allow for wp_register_script() to be called after wp_enqueue_script(). 2021-12-07 17:44:46 +00:00
file.php Media: Relocate wp_filesize() function for use in frontend and backend. 2022-03-14 16:30:35 +00:00
filters.php Tests: Remove some unused variables in phpunit/tests/filters.php. 2022-03-23 14:48:28 +00:00
functions.php Editor: Add functionality required for theme export in the site editor 2022-04-11 10:36:02 +00:00
https-detection.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
https-migration.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
kses.php KSES: Add support for <ruby> and related elements. 2022-03-21 00:28:55 +00:00
l10n.php Tests: Use a simpler approach to test the output in some tests. 2021-11-27 16:16:15 +00:00
link.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
locale.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
mail.php Tests: Rename the $success variable to $result in the wp_mail() test for an empty home URL. 2022-02-25 14:08:53 +00:00
media.php Media: Run the wp_content_img_tag filter once per image. 2022-04-12 05:16:46 +00:00
meta.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
multisite.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
pluggable.php Tests: Update the test for wp_install() signature. 2022-04-20 11:04:23 +00:00
post.php Posts, Post Types: Fix option validation in stick_post(). 2022-04-21 06:02:21 +00:00
query.php Query: Make sure WP_Query::get_queried_object() works for author_name before ::get_posts() is run. 2022-03-05 15:33:05 +00:00
rest-api.php REST API: Respect _fields query arg in preloaded requests 2022-04-19 14:38:16 +00:00
rewrite.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
robots.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
shortcode.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
site-health.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
taxonomy.php Posts, Post Types/Taxonomies: Add object type specific registration filters. 2022-04-11 05:09:53 +00:00
template.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
term.php Tests: Include special characters in term names for wp_set_term_objects(). 2022-03-16 03:04:40 +00:00
theme.php Themes: Make block themes support HTML5 by default. 2022-01-04 18:38:52 +00:00
upload.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
url.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
user.php Users: Return a WP_Error from wp_insert_user() if the user_url field is too long. 2022-01-29 14:23:59 +00:00
walker.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
widgets.php Tests: Use a simpler approach to test the output in some tests. 2021-11-27 16:16:15 +00:00
wp.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00