Repository navigation
Tests: Add unit test coverage for the_modified_time() - #14449
rejaulalomkhan wants to merge 1 commit into
Conversation
Adds comprehensive PHPUnit tests covering default modified time formatting, custom format strings via data provider, the time_format option, missing global post fallback, and the the_modified_time and get_the_modified_time filter hooks. See #65819.
|
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. |
There was a problem hiding this comment.
🟢 Approval recommended
The focused test additions match existing behavior and test-isolation mechanisms, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Adds PHPUnit coverage for WordPress’s the_modified_time() template function without changing production code.
Changes:
- Tests default and custom formats, option changes, and missing global posts.
- Verifies filter arguments and filtered output.
| File | Description |
|---|---|
| tests/phpunit/tests/date/theModifiedTime.php | Adds fixtures and tests for modified-time output and filters. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
The distinct creation and modification timestamps make the output checks meaningful. Optional cleanup: remove the computed-default expectation; the literal time-format option case already covers omitted-format behavior.
Unit-tests audit and Copilot review found no blockers. PHPCS passed all ten files. The combined batch passed locally in randomized order: single-site 149 tests / 283 assertions (seed 65825), multisite 140 tests / 236 assertions (seed 65826). CI is green on the reviewed commit.
AI review · gpt-6
Verify echoed modification times, explicit and configured formats, missing posts, and display and retrieval filters. Use distinct creation and modification timestamps. Developed in: #14449 Props rejaulalomkhan. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64543 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14449 landed in https://core.trac.wordpress.org/changeset/64543 |
Verify echoed modification times, explicit and configured formats, missing posts, and display and retrieval filters. Use distinct creation and modification timestamps. Developed in: WordPress/wordpress-develop#14449 Props rejaulalomkhan. See #65819. Built from https://develop.svn.wordpress.org/trunk@64543 git-svn-id: http://core.svn.wordpress.org/trunk@63693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds unit test coverage for
the_modified_time()insrc/wp-includes/general-template.php.Test scenarios covered:
get_option( 'time_format' ).H:i:s,g:i a,Y-m-d H:i,l,H,i) via@dataProvider.time_formatoption when no format argument is supplied.$postexists.the_modified_timefilter hook arguments verification (receives$get_the_modified_timeand$format).the_modified_timefilter hook.get_the_modified_timefilter hook.Verification:
OK (12 tests, 15 assertions)OK (12 tests, 15 assertions)OK (12 tests, 15 assertions)OK (363 tests, 1286 assertions)0 errors, 0 warnings)Trac ticket: https://core.trac.wordpress.org/ticket/65819
Use of AI Tools: Antigravity (Gemini 2.5) was used to assist in test case ideation, code scaffolding, and formatting to WordPress core standards. All assertions and test outcomes were verified locally through PHPUnit and PHPCS.