fix(tests): add wp_strip_all_tags and sanitize_text_field stubs
Image prompt builder uses these WP text-processing functions. Without stubs, PHPUnit fails with undefined function errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -92,3 +92,19 @@ if ( ! class_exists( 'WP_Query' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stub WP text-processing functions used by image prompt builder.
|
||||||
|
if ( ! function_exists( 'wp_strip_all_tags' ) ) {
|
||||||
|
function wp_strip_all_tags( $string, $remove_breaks = false ) {
|
||||||
|
$string = strip_tags( $string );
|
||||||
|
if ( $remove_breaks ) {
|
||||||
|
$string = preg_replace( '/[\r\n\t ]+/', ' ', $string );
|
||||||
|
}
|
||||||
|
return trim( $string );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'sanitize_text_field' ) ) {
|
||||||
|
function sanitize_text_field( $str ) {
|
||||||
|
return trim( strip_tags( $str ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user