65526 tests to move functions folder - #12307
Conversation
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @pbearne@git.wordpress.org. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
Hi there! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Hi @pbearne, thanks for working on this. Could you please resolve the merge conflicts to move this PR forward? |
There was a problem hiding this comment.
🟡 Not ready to approve
The new wp_get_http_headers() tests use an unrealistic pre_http_request mock/weak assertions and mislabel tests as external-http, which can reduce coverage and make the test less reliable.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR reorganizes PHPUnit coverage for core “functions” by splitting the former monolithic tests/phpunit/tests/functions.php into many smaller, function-focused test classes under tests/phpunit/tests/functions/, and by relocating a few related tests from other files (e.g., tests/phpunit/tests/file.php) into more appropriate dedicated test files.
Changes:
- Removes
tests/phpunit/tests/functions.phpand migrates its test methods into dedicated per-function test files undertests/phpunit/tests/functions/. - Adjusts/creates focused test classes for uploads and timezone helpers (including separating
wp_timezone_string()coverage fromwp_timezone()tests). - Moves
get_file_data()tests out oftests/phpunit/tests/file.phpinto a dedicatedtests/phpunit/tests/functions/getFileData.php.
File summaries
| File | Description |
|---|---|
| tests/phpunit/tests/functions/wpUploadDirInternal.php | Renames/specializes internal upload-dir tests and updates grouping/covers metadata. |
| tests/phpunit/tests/functions/wpUploadDir.php | New focused test class for wp_upload_dir() default behavior. |
| tests/phpunit/tests/functions/wpUniqueId.php | New focused test class for wp_unique_id(). |
| tests/phpunit/tests/functions/wpUniqueFilename.php | New focused test class for wp_unique_filename() (incl. multiple scenarios). |
| tests/phpunit/tests/functions/wpTimezoneString.php | New focused test class for wp_timezone_string(). |
| tests/phpunit/tests/functions/wpTimezone.php | Removes wp_timezone_string() assertions and focuses on wp_timezone() behavior. |
| tests/phpunit/tests/functions/wpRecursiveKsort.php | New focused test class for wp_recursive_ksort(). |
| tests/phpunit/tests/functions/wpRaiseMemoryLimit.php | New focused test class for wp_raise_memory_limit(). |
| tests/phpunit/tests/functions/wpParseArgs.php | New focused test class for wp_parse_args(). |
| tests/phpunit/tests/functions/wpNormalizePath.php | New focused test class for wp_normalize_path() (incl. cache behavior). |
| tests/phpunit/tests/functions/wpJsonFileDecode.php | New focused test class for wp_json_file_decode(). |
| tests/phpunit/tests/functions/wpJsonEncode.php | New focused test class for wp_json_encode(). |
| tests/phpunit/tests/functions/wpIsUuid.php | New focused test class for wp_is_uuid(). |
| tests/phpunit/tests/functions/wpIsStream.php | New focused test class for wp_is_stream(). |
| tests/phpunit/tests/functions/wpIsJsonMediaType.php | New focused test class for wp_is_json_media_type(). |
| tests/phpunit/tests/functions/wpGetMimeTypes.php | Renames/updates mime-type tests and expands coverage for filter interactions. |
| tests/phpunit/tests/functions/wpGetImageSize.php | New focused test class for wp_getimagesize() (incl. multiple formats). |
| tests/phpunit/tests/functions/wpGetImageMime.php | New focused test class for wp_get_image_mime(). |
| tests/phpunit/tests/functions/wpGetHttpHeaders.php | New focused test class for wp_get_http_headers(). |
| tests/phpunit/tests/functions/wpGetExtTypes.php | New focused test class for wp_get_ext_types(). |
| tests/phpunit/tests/functions/wpGetDefaultExtensionForMimeType.php | New focused test class for wp_get_default_extension_for_mime_type(). |
| tests/phpunit/tests/functions/wpGenerateUuid4.php | New focused test class for wp_generate_uuid4(). |
| tests/phpunit/tests/functions/wpExtractUrls.php | New focused test class for wp_extract_urls(). |
| tests/phpunit/tests/functions/wpExt2Type.php | New focused test class for wp_ext2type(). |
| tests/phpunit/tests/functions/wpDate.php | New focused test class for wp_date(). |
| tests/phpunit/tests/functions/wpCheckFiletypeAndExt.php | New focused test class for wp_check_filetype_and_ext(). |
| tests/phpunit/tests/functions/validateFile.php | New focused test class for validate_file(). |
| tests/phpunit/tests/functions/pathJoin.php | New focused test class for path_join(). |
| tests/phpunit/tests/functions/pathIsAbsolute.php | New focused test class for path_is_absolute(). |
| tests/phpunit/tests/functions/mysqlToRfc3339.php | New focused test class for mysql_to_rfc3339(). |
| tests/phpunit/tests/functions/mysql2date.php | New focused test class for mysql2date(). |
| tests/phpunit/tests/functions/humanReadableDuration.php | New focused test class for human_readable_duration(). |
| tests/phpunit/tests/functions/getFileData.php | New focused test class for get_file_data() (moved from tests/phpunit/tests/file.php). |
| tests/phpunit/tests/functions/getAllowedMimeTypes.php | New focused test class for get_allowed_mime_types(). |
| tests/phpunit/tests/functions/deviceCanUpload.php | New focused test class for _device_can_upload(). |
| tests/phpunit/tests/functions/dateI18n.php | New focused test class for date_i18n(). |
| tests/phpunit/tests/functions/currentTime.php | New focused test class for current_time(). |
| tests/phpunit/tests/functions/currentDatetime.php | New focused test class for current_datetime(). |
| tests/phpunit/tests/functions/canonicalCharset.php | Simplifies/renames charset normalization test method naming and annotations. |
| tests/phpunit/tests/functions/boolFromYn.php | New focused test class for bool_from_yn(). |
| tests/phpunit/tests/functions/addQueryArg.php | New focused test class for add_query_arg(). |
| tests/phpunit/tests/functions.php | Removes the previous monolithic “functions” test file after splitting coverage. |
| tests/phpunit/tests/file.php | Removes get_file_data() tests (now covered in functions/getFileData.php). |
Review details
Suppressed comments (1)
tests/phpunit/tests/functions/wpUploadDirInternal.php:28
- The inline comment says this is testing
wp_upload_dir(), but the test calls_wp_upload_dir()directly. Since this file is specifically covering the internal function, the comment should match the code to avoid confusion when maintaining the test.
- Files reviewed: 37/43 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
# Conflicts: # tests/phpunit/tests/file.php # tests/phpunit/tests/functions.php # tests/phpunit/tests/functions/getFileData.php
…y declarations. Copied from 8cb025e
Trac ticket: https://core.trac.wordpress.org/ticket/65526
AI assistance: Yes
Tool(s): Junie (JetBrains)
Model(s): gemini-3-flash-preview
Used for: Code analysis, test implementation, and workflow management. The final implementation and tests were reviewed and edited by me.