Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
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. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the added directory-size unit tests.
No open issues 🎉
What changed in this PR
Adds unit tests for WordPress’s directory-size functions for Trac ticket #65654, using isolated temporary directories and cleanup without changing production code.
Changes:
- Tests
get_dirsize()for basic size calculation and nonexistent directories. - Tests
recurse_dirsize()for recursion, exclusions, filter overrides, and transient caching.
| File | Description |
|---|---|
tests/phpunit/tests/wp-includes/functions/GetDirsizeTest.php |
Adds basic and nonexistent-directory tests for get_dirsize(). |
tests/phpunit/tests/functions/recurseDirsize.php |
Adds recursive size, exclusion, filter, and cache tests. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
Please focus the wrapper test on the main-site exclusion. I removed the /sites exclusion from get_dirsize() locally and the proposed basic test still passed. Adding a three-byte file in a sites/ subdirectory caught that change: multisite counted 18 bytes instead of 15. With the real implementation it passed. That protects a main site from being charged for child-site uploads. The existing multisite test_pre_recurse_dirsize_filter() already covers the short-circuit, so the new copy and its temp directory can go.
AI review · gpt-6
This PR adds unit tests for get_dirsize() and recurse_dirsize() in wp-includes/functions.php.
The implementation uses isolated temporary directories within the test environment to ensure reliable execution across different platforms and Docker setups.
Changes:
•tests/phpunit/tests/functions/getDirsize.php: Covers the high-level get_dirsize() API.
•tests/phpunit/tests/functions/recurseDirsize.php: Covers the recursive logic, including exclusions, filtering, and caching.
Trac ticket: https://core.trac.wordpress.org/ticket/65654
AI Disclosure:
•AI assistance: Yes
•Tool(s): Junie (JetBrains)
•Model(s): gemini-3-flash-preview
•Used for: Code analysis, test implementation, and environment-specific troubleshooting.