Tests: Ensure that the default `wp_die()` handler can handle a `WP_Error` object.

Props dd32, utkarshpatel.
Fixes #36166.

git-svn-id: https://develop.svn.wordpress.org/trunk@37071 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2016-03-23 19:00:38 +00:00
parent 703bd5f97f
commit 8e317daa37
2 changed files with 12 additions and 0 deletions

View File

@ -292,6 +292,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
} }
function wp_die_handler( $message ) { function wp_die_handler( $message ) {
if ( ! is_scalar( $message ) ) {
$message = '0';
}
throw new WPDieException( $message ); throw new WPDieException( $message );
} }

View File

@ -204,4 +204,12 @@ class Tests_TestHelpers extends WP_UnitTestCase {
_doing_it_wrong( __METHOD__, __( 'Incorrect usage test' ), '2.5' ); _doing_it_wrong( __METHOD__, __( 'Incorrect usage test' ), '2.5' );
return true; return true;
} }
/**
* @ticket 36166
* @expectedException WPDieException
*/
public function test_die_handler_should_handle_wp_error() {
wp_die( new WP_Error( 'test', 'test' ) );
}
} }