Repository navigation
Tests: Add unit tests for timer_float() - #14484
shail-mehta wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The assertions accept absolute timestamps, leaving the elapsed-time subtraction unverified.
1 open issue
What changed in this PR
Adds dedicated PHPUnit coverage for WordPress’s timer_float() helper, addressing Trac #65819.
Changes:
- Tests the elapsed-time return value and increase between calls.
- Preserves and restores
REQUEST_TIME_FLOATbetween tests.
| File | Description |
|---|---|
| tests/phpunit/tests/load/load/timerFloat.php | Adds two timer tests and request-time cleanup. |
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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. |
mukeshpanchal27
left a comment
There was a problem hiding this comment.
The tests look correct. One problem with the file location.
| * | ||
| * @covers ::timer_float | ||
| */ | ||
| class Tests_Load_TimerFloat extends WP_UnitTestCase { |
There was a problem hiding this comment.
The path has load twice: tests/phpunit/tests/load/load/timerFloat.php. Could the file move to tests/phpunit/tests/load/timerFloat.php, next to the other load.php tests?
There was a problem hiding this comment.
Moved in test file in load folder.

What
See Trac Ticket: #65819.
Adds unit tests for
timer_float().Why
This helper had no dedicated coverage.
How
Covers float elapsed time from
REQUEST_TIME_FLOATand that successive calls increase.Testing
npm run test:php -- --filter Tests_Load_TimerFloatnpm run test:php -- --filter Tests_Load_TimerFloat --order-by=randomvendor/bin/phpcs tests/phpunit/tests/load/timerFloat.phpAI Tools
Cursor