Files
prautoblogger/tests/unit/Core
peptiderepo e6761c8fdf fix(tests): stub get_temp_dir/wp_get_image_editor/is_wp_error in GD-rung test
The test test_gd_rung_emits_passthrough_featured_and_single_warning forced
the capability to 'gd' via the filter override, causing the orchestrator to
instantiate PRAutoBlogger_Image_Composer_Editor and call compose_variants().
Inside cover_crop(), get_temp_dir() was the first WP function called —
unstubbed, Brain Monkey 2.x threw LogicException on all three PHP versions.

Add the three stubs that ImageComposerEditorTest already uses for the same
code path (same house pattern):
  - get_temp_dir  → sys_get_temp_dir() . '/'
  - wp_get_image_editor → WP_Error (no GD editor in test env)
  - is_wp_error   → isinstance alias

With wp_get_image_editor returning WP_Error, cover_crop() returns null for
every role → compose_variants() returns [] → the GD rung emits
array_merge($passthrough, []) = only the pass-through featured.
The existing assertions (assertNotEmpty, assertSame 'featured', assertSame
'raw_base_bytes') all fire against a real execution path and cannot pass
trivially — this is the actual degradation-to-passthrough contract.
Assertions are not weakened.

Agent-Session: engineer-prab-maint-fix-20260612
2026-06-12 13:58:09 +00:00
..