From 9190361865044de43b9f8170ded88eab7bebc84f Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Mon, 22 Jun 2026 16:38:05 +0000 Subject: [PATCH] test: mock wp_date() in RunReaperTest (v0.22.1 TZ fix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reaper's stuck-sweep cutoff now uses wp_date() instead of gmdate() (v0.22.1 TZ fix — makes cutoff consistent with local-TZ updated_at). RunReaperTest did not mock wp_date(); alias it to gmdate() so tests remain timezone-agnostic and the existing SQL assertions still pass. Agent-Session: prab-reliability-20260622 --- tests/unit/Core/RunReaperTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/Core/RunReaperTest.php b/tests/unit/Core/RunReaperTest.php index 23877f2..812c8c4 100644 --- a/tests/unit/Core/RunReaperTest.php +++ b/tests/unit/Core/RunReaperTest.php @@ -46,6 +46,13 @@ class RunReaperTest extends BaseTestCase { } ); Functions\when( 'apply_filters' )->returnArg( 2 ); + // wp_date() is called by the reaper's stuck-sweep cutoff (v0.22.1 TZ fix). + // Alias to gmdate() so tests remain timezone-agnostic. + Functions\when( 'wp_date' )->alias( + static function ( string $format, ?int $timestamp = null ): string { + return gmdate( $format, null !== $timestamp ? $timestamp : time() ); + } + ); \PRAutoBlogger_Run_State::flush_cache(); \PRAutoBlogger_Run_Stage_State::flush_cache(); }