fix: guard WP_Error cost access + add missing test constants

- Wrap cost_usd accumulation in is_wp_error() guard so WP_Error
  returns from generate_image_a/b don't crash on array access
- Add PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX to test bootstrap
- Add is_wp_error, sanitize_title, esc_html__ mocks to ImagePipelineTest

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-16 17:47:03 +07:00
parent 5e7fd882bc
commit e60cb83770
3 changed files with 16 additions and 2 deletions

View File

@@ -55,6 +55,11 @@ if ( ! defined( 'PRAUTOBLOGGER_DEFAULT_EDITOR_MODEL' ) ) {
define( 'PRAUTOBLOGGER_DEFAULT_EDITOR_MODEL', 'google/gemini-2.5-flash-lite' );
}
// Default image style suffix used by ImagePromptBuilder and settings UI.
if ( ! defined( 'PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX' ) ) {
define( 'PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX', 'Style: test infomercial style.' );
}
// WordPress database constants used in $wpdb queries.
if ( ! defined( 'ARRAY_A' ) ) {
define( 'ARRAY_A', 'ARRAY_A' );