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
This commit is contained in:
peptiderepo
2026-06-12 14:00:12 +00:00
parent e6761c8fdf
commit 02310e90d4

View File

@@ -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(