test for wp_schedule_delete_old_privacy_export_files - #5550
Conversation
…Files.php Co-authored-by: John Parris <public@johnparris.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 Unlinked AccountsThe 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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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. |
|
Thanks @pbearne for the patch. I've prepared a refreshed version of the test that resolves the outstanding review feedback from @mindctrl on this PR:
Verified locally against |
|
For visibility: I've also opened #12563 as an alternative PR carrying these same tests, in case that's an easier path to land than updating this branch. Happy to close it and fold the changes in here instead — whichever maintainers prefer. See #59707. |
…Files.php Co-authored-by: John Parris <public@johnparris.com>
…Files.php Co-authored-by: John Parris <public@johnparris.com>
…Files.php Co-authored-by: John Parris <public@johnparris.com>
There was a problem hiding this comment.
Pull request overview
Adds PHPUnit coverage for wp_schedule_delete_old_privacy_export_files() (Trac #59707) to ensure the cron event is scheduled appropriately and not duplicated.
Changes:
- Introduces a new test class covering initial scheduling behavior.
- Adds a test to ensure no scheduling occurs during installation mode.
- Adds a test to ensure re-calling the function does not create duplicate cron events.
Comments suppressed due to low confidence (1)
tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php:47
- Calling parent::tear_down() inside an individual test method is incorrect; tear_down() should be handled by PHPUnit, and this call can run cleanup at the wrong time. Once tear_down() correctly calls parent::tear_down(), this line should be removed.
wp_schedule_delete_old_privacy_export_files();
$this->assertFalse( wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) );
parent::tear_down();
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@pbearne, Can you address the feedback from Copilot? Both seem like reasonable suggestions. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…s()`. Adds unit test coverage for the scheduling of the recurring cleanup of expired personal data export files. Developed in #5550 Props desrosj, masteradhoc, mindctrl, pbearne, roshniahuja14, wildworks. Fixes #59707. git-svn-id: https://develop.svn.wordpress.org/trunk@63172 602fd350-edb4-49c9-b593-d223f7449a82
…s()`. Adds unit test coverage for the scheduling of the recurring cleanup of expired personal data export files. Developed in WordPress/wordpress-develop#5550 Props desrosj, masteradhoc, mindctrl, pbearne, roshniahuja14, wildworks. Fixes #59707. Built from https://develop.svn.wordpress.org/trunk@63172 git-svn-id: http://core.svn.wordpress.org/trunk@62369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/59707