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:
parent
703bd5f97f
commit
8e317daa37
@ -292,6 +292,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
function wp_die_handler( $message ) {
|
||||
if ( ! is_scalar( $message ) ) {
|
||||
$message = '0';
|
||||
}
|
||||
|
||||
throw new WPDieException( $message );
|
||||
}
|
||||
|
||||
|
@ -204,4 +204,12 @@ class Tests_TestHelpers extends WP_UnitTestCase {
|
||||
_doing_it_wrong( __METHOD__, __( 'Incorrect usage test' ), '2.5' );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36166
|
||||
* @expectedException WPDieException
|
||||
*/
|
||||
public function test_die_handler_should_handle_wp_error() {
|
||||
wp_die( new WP_Error( 'test', 'test' ) );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user