Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Created March 18, 2018 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellofromtonya/63e402fac8210db79a23c1d9bcd5e2f3 to your computer and use it in GitHub Desktop.
Save hellofromtonya/63e402fac8210db79a23c1d9bcd5e2f3 to your computer and use it in GitHub Desktop.
setup_common_wp_stubs()
/**
* Setup the stubs for the common WordPress escaping and internationalization functions.
*/
protected function setup_common_wp_stubs() {
// Common escaping functions.
Monkey\Functions\stubs( array(
'esc_attr',
'esc_html',
'esc_textarea',
'esc_url',
'wp_kses_post',
) );
// Common internationalization functions.
Monkey\Functions\stubs( array(
'__',
'esc_html__',
'esc_html_x',
'esc_attr_x',
) );
foreach ( array( 'esc_attr_e', 'esc_html_e', '_e' ) as $wp_function ) {
Monkey\Functions\when( $wp_function )->echoArg();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment