test: mock wp_date() in RunReaperTest (v0.22.1 TZ fix)

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
This commit is contained in:
peptiderepo
2026-06-22 16:38:05 +00:00
parent 7b540a7ce1
commit 9190361865

View File

@@ -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();
}