Make WordPress Core

Opened 3 years ago

Closed 5 weeks ago

#59707 closed enhancement (fixed)

test for wp_schedule_delete_old_privacy_export_files

Reported by: pbearne Owned by: wildworks
Priority: normal Milestone: 7.2
Component: Privacy Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: tests

Description


Change History (15)

This ticket was mentioned in PR #5550 on WordPress/wordpress-develop by @pbearne.


3 years ago
#1

  • Keywords has-patch has-unit-tests added

#2 @desrosj
2 years ago

  • Component Build/Test ToolsPrivacy
  • Milestone Awaiting ReviewFuture Release
  • Type defect (bug)enhancement

Since this is about adding tests and not a general build or test tooling change, I'm reassigning it to the relevant component.

#3 @desrosj
4 months ago

  • Focuses tests added

Adding the tests focus, which is used to indicate a ticket is solely focused on adding tests.

@masteradhoc commented on PR #5550:


2 months ago
#4

@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.

#5 @masteradhoc
2 months ago

  • Milestone Future Release7.1

This ticket was mentioned in Slack in #core by masteradhoc. View the logs.


2 months ago

#7 @adrianduffell
2 months ago

This was discussed in today’s bug scrub. It will be kept in the 7.1 release to be finished this week. As it adds tests only, I believe It can be safely included in the beta cycle.

@roshniahuja14 commented on PR #5550:


2 months ago
#8

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

Happy to open a PR against your branch or you're welcome to cherry-pick — whichever you prefer. See #59707.

This ticket was mentioned in PR #12563 on WordPress/wordpress-develop by @roshniahuja14.


2 months ago
#9

Adds unit-test coverage for wp_schedule_delete_old_privacy_export_files(), exercising all three branches of the function:

  • Schedules the wp_privacy_delete_old_export_files event when it is not already scheduled.
  • Skips scheduling while WordPress is installing (wp_installing()).
  • Does not create a duplicate event when one is already scheduled.

This builds on @pbearne's work in #5550 and incorporates @mindctrl's review feedback from that PR:

  • Calls parent::set_up() / parent::tear_down().
  • Moves the wp_installing( false ) reset into tear_down() so it always runs.
  • Adds the "already scheduled" branch test.
  • Adds a standard file docblock, @group privacy, and assertion failure messages.

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

Note: this is an alternative to #5550 for the same ticket — happy to fold it back into that PR instead if maintainers prefer.

@roshniahuja14 commented on PR #5550:


2 months ago
#10

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.

This ticket was mentioned in Slack in #core by adrianduffell. View the logs.


8 weeks ago

@wildworks commented on PR #5550:


7 weeks ago
#12

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

#13 @wildworks
6 weeks ago

  • Milestone 7.17.2

As the 7.1 RC1 is approaching and the attached PR does not seem to be complete yet, I'd like to punt this to 7.2.

@masteradhoc commented on PR #5550:


6 weeks ago
#14

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

#15 @wildworks
5 weeks ago

  • Owner set to wildworks
  • Resolutionfixed
  • Status newclosed

In 63172:

Tests: Add unit tests for wp_schedule_delete_old_privacy_export_files().

Adds unit test coverage for the scheduling of the recurring cleanup of expired personal data export files.

Developed in https://github.com/WordPress/wordpress-develop/pull/5550

Props desrosj, masteradhoc, mindctrl, pbearne, roshniahuja14, wildworks.
Fixes #59707.

Note: See TracTickets for help on using tickets.