Skip to content

Commit 9f4543d

Browse files
authored
Tests: update tests to account for different month durations (#2724)
1 parent fef2b73 commit 9f4543d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Fixed flaky test for purge_ap_posts due to date boundary condition with -1 month

tests/phpunit/tests/includes/class-test-scheduler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ public function test_cleanup_remote_actors() {
703703
* @covers ::purge_ap_posts
704704
*/
705705
public function test_purge_ap_posts_more_than_200_posts() {
706-
// Create 20 posts older than 6 months (will be deleted).
706+
// Create 20 posts older than 30 days (will be deleted).
707707
self::factory()->post->create_many(
708708
20,
709709
array(
@@ -713,13 +713,13 @@ public function test_purge_ap_posts_more_than_200_posts() {
713713
)
714714
);
715715

716-
// Create 5 posts newer than 6 months (will be kept).
716+
// Create 5 posts newer than 30 days (will be kept).
717717
self::factory()->post->create_many(
718718
5,
719719
array(
720720
'post_type' => Posts::POST_TYPE,
721721
'post_status' => 'publish',
722-
'post_date' => \gmdate( 'Y-m-d H:i:s', \strtotime( '-1 month' ) ),
722+
'post_date' => \gmdate( 'Y-m-d H:i:s', \strtotime( '-1 week' ) ),
723723
)
724724
);
725725

0 commit comments

Comments
 (0)