Skip to content

test for wp_schedule_delete_old_privacy_export_files - #5550

Closed
pbearne wants to merge 22 commits into
WordPress:trunkfrom
pbearne:59707_wp_schedule_delete_old_privacy_export_files
Closed

test for wp_schedule_delete_old_privacy_export_files#5550
pbearne wants to merge 22 commits into
WordPress:trunkfrom
pbearne:59707_wp_schedule_delete_old_privacy_export_files

Conversation

@pbearne

@pbearne pbearne commented Oct 23, 2023

Copy link
Copy Markdown

Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
…Files.php

Co-authored-by: John Parris <public@johnparris.com>
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

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 props-bot label.

Unlinked Accounts

The 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:

Props pbearne, wildworks, mindctrl, masteradhoc, roshniahuja14.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
@masteradhoc

Copy link
Copy Markdown

@pbearne could you check the last feedback from @mindctrl? i'd like to milestone this for 7.1 so we can get this added soon.

@roshniahuja

roshniahuja commented Jul 16, 2026

Copy link
Copy Markdown

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:

  • Calls parent::set_up() / parent::tear_down().
  • Moves the wp_installing( false ) reset into tear_down() so it always runs even if an assertion fails.
  • Adds a third test, test_wp_schedule_delete_old_privacy_export_files_already_scheduled(), covering the branch where the event is already scheduled (no duplicate is created).
  • Adds a standard file docblock, @group privacy (the ticket's reassigned component), and assertion failure messages.

Verified locally against trunk: OK (3 tests, 5 assertions), and PHPCS is clean.

Branch: https://github.com/roshniahuja/wordpress-develop/tree/59707-test-wp-schedule-delete-old-privacy-export-files

@roshniahuja

roshniahuja commented Jul 16, 2026

Copy link
Copy Markdown

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.

pbearne and others added 4 commits July 16, 2026 14:26
…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>
@pbearne
pbearne requested a review from mindctrl July 16, 2026 18:27
Copilot AI review requested due to automatic review settings July 28, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
@t-hamano

Copy link
Copy Markdown
Contributor

@pbearne, Can you address the feedback from Copilot? Both seem like reasonable suggestions.

pbearne and others added 2 commits August 4, 2026 13:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@masteradhoc

Copy link
Copy Markdown

Thank you @pbearne! The PR would be ready for another review and merge. @t-hamano Can you help out here?

Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
Comment thread tests/phpunit/tests/functions/wpScheduleDeleteOldPrivacyExportFiles.php Outdated
pbearne and others added 2 commits August 10, 2026 15:58
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
pento pushed a commit that referenced this pull request Aug 11, 2026
…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
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 63172
GitHub commit: 7416a5c

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Aug 11, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 11, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants