Build/Test tools: Add support for passing a WP_Error object to wp_die() during tests.

This brings the functionality inline with `wp_die()` during non-test usage.

Fixes #46460


git-svn-id: https://develop.svn.wordpress.org/trunk@44944 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2019-03-20 18:22:11 +00:00
parent 34251aa2ab
commit 4b2a7d4ab6

View File

@ -424,6 +424,10 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
* @param string $message The `wp_die()` message.
*/
public function wp_die_handler( $message ) {
if ( is_wp_error( $message ) ) {
$message = $message->get_error_message();
}
if ( ! is_scalar( $message ) ) {
$message = '0';
}