Skip to content

65526 tests to move functions folder - #12307

Open
pbearne wants to merge 8 commits into
WordPress:trunkfrom
pbearne:65526-tests-to-move-functions-folder
Open

65526 tests to move functions folder#12307
pbearne wants to merge 8 commits into
WordPress:trunkfrom
pbearne:65526-tests-to-move-functions-folder

Conversation

@pbearne

@pbearne pbearne commented Jun 24, 2026

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

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 props-bot label.

Unlinked Accounts

The 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:

Props pbearne, wildworks.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Hi there! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

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,
The WordPress Project

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

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.

Test this pull request with WordPress Playground.

@t-hamano

t-hamano commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Hi @pbearne, thanks for working on this. Could you please resolve the merge conflicts to move this PR forward?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.php and migrates its test methods into dedicated per-function test files under tests/phpunit/tests/functions/.
  • Adjusts/creates focused test classes for uploads and timezone helpers (including separating wp_timezone_string() coverage from wp_timezone() tests).
  • Moves get_file_data() tests out of tests/phpunit/tests/file.php into a dedicated tests/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
Comment thread tests/phpunit/tests/functions.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants