mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
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:
@@ -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' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user