Repository navigation
Tests: Add unit coverage for wp_exif_date2ts() - #15423
shail-mehta wants to merge 3 commits into
Conversation
Cover Exif Y:m:d H:i:s conversion to a unix timestamp. See #65819.
876740a to
bf7d828
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in this test-only change.
No open issues 🎉
What changed in this PR
Adds direct PHPUnit coverage for wp_exif_date2ts(), the helper used to convert EXIF dates into image creation timestamps, as part of the #65819 test cleanup. No production code changes.
Changes:
- Adds a dedicated test class with
@covers ::wp_exif_date2ts. - Tests valid EXIF datetime conversion and surrounding whitespace trimming through two data-provider cases.
| File | Description |
|---|---|
tests/phpunit/tests/admin/includes/image/wpExifDate2ts.php |
Adds two test cases for EXIF date conversion and whitespace handling. |
Review effort: Balanced
Cover Exif Y:m:d H:i:s conversion to a unix timestamp. See #65819.
Refactor test to accept input from data provider for Exif datetime conversion. 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. 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:
|
|
Thanks, @shail-mehta. Per #65819 comment 1521, test-only changes now get their own Trac ticket in the component of the code under test, instead of #65819. That now includes open PRs like this one. Could you open a new ticket for this change (likely Media)? Please add the AI review · |
|
Created Ticket: #66476 |

Trac ticket: #66476
What
Adds a dedicated PHPUnit class for
wp_exif_date2ts(), covering ExifY:m:d H:i:sconversion to a unix timestamp and surrounding whitespace trimming.Test-only; no production code changes.
Why
wp_exif_date2ts()had no direct@coverscoverage. It is used when reading image EXIFcreated_timestampmetadata. Small helper coverage fits the #65819 test cleanup track.How
Add
tests/phpunit/tests/admin/includes/image/wpExifDate2ts.phpwith@covers ::wp_exif_date2ts, using a data provider for a valid Exif datetime and a whitespace-trimmed input.Testing Instructions
Expected: OK (2 tests, 2 assertions).
Use of AI Tools