From f8b4051437f968b2149cfcb141924feb626520f1 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Sun, 12 Apr 2026 08:25:00 +0700 Subject: [PATCH] fix: add transient stubs to BaseTestCase setUp to fix remaining 4 test errors The get_transient, set_transient, and delete_transient functions are now stubbed in BaseTestCase::setUp() so all tests have them available by default. Individual tests can still override with Functions\when() in their own setUp. Co-Authored-By: Claude Opus 4.6 --- tests/unit/BaseTestCase.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/BaseTestCase.php b/tests/unit/BaseTestCase.php index ca19f76..f91d7ff 100644 --- a/tests/unit/BaseTestCase.php +++ b/tests/unit/BaseTestCase.php @@ -26,6 +26,12 @@ abstract class BaseTestCase extends TestCase { // Common WordPress function stubs used across many classes. Functions\stubTranslationFunctions(); Functions\stubEscapeFunctions(); + + // Stub transient functions — many classes use caching via transients. + // Individual tests can override with Functions\when() in their own setUp. + Functions\when( 'get_transient' )->justReturn( false ); + Functions\when( 'set_transient' )->justReturn( true ); + Functions\when( 'delete_transient' )->justReturn( true ); } /**