diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index ce7a7600a2..27aabbf906 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -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 ); } diff --git a/tests/phpunit/tests/includes/helpers.php b/tests/phpunit/tests/includes/helpers.php index 64cb633a42..b035d31672 100644 --- a/tests/phpunit/tests/includes/helpers.php +++ b/tests/phpunit/tests/includes/helpers.php @@ -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' ) ); + } }