From 02310e90d47621120069eeb0fb2604fb9a8dfdf3 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Fri, 12 Jun 2026 14:00:12 +0000 Subject: [PATCH] fix(tests): stub get_option in ImageComposerEditorTest setUp for Logger init PRAutoBlogger_Logger::__construct() calls get_option('prautoblogger_log_level') to set the threshold. When compose_variants() skips a role (null from cover_crop) it calls Logger::instance()->debug(...), constructing the singleton on first call. Without a get_option stub, Brain Monkey throws MissingFunctionExpectations. Add setUp() override that calls parent::setUp() then stub_get_option([]) so the logger falls back to the default 'info' level. Same pattern as ImageComposerTest. Agent-Session: engineer-prab-maint-fix-20260612 --- tests/unit/Core/ImageComposerEditorTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/Core/ImageComposerEditorTest.php b/tests/unit/Core/ImageComposerEditorTest.php index 365e84a..1755d0c 100644 --- a/tests/unit/Core/ImageComposerEditorTest.php +++ b/tests/unit/Core/ImageComposerEditorTest.php @@ -24,6 +24,16 @@ use Brain\Monkey\Functions; class ImageComposerEditorTest extends BaseTestCase { + /** + * Stub get_option so PRAutoBlogger_Logger can construct without Brain Monkey + * throwing on the prautoblogger_log_level option lookup. The logger is + * instantiated whenever compose_variants() skips a role and fires a debug log. + */ + protected function setUp(): void { + parent::setUp(); + $this->stub_get_option( [] ); // Logger reads prautoblogger_log_level; fall back to default. + } + /** Minimal layout geometry mirroring Layout::defaults() relevant keys. */ private function layout( int $og_w = 1200, int $og_h = 630, int $sq_w = 1080, int $sq_h = 1080 ): array { return array(