[wp-trac] [WordPress Trac] #36166: wp_die() doesn't accept a WP_Error during unit testing

WordPress Trac noreply at wordpress.org
Tue Mar 8 06:15:05 UTC 2016

#36166: wp_die() doesn't accept a WP_Error during unit testing
 Reporter:  dd32              |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:  needs-patch
  Focuses:                    |
 As reported on the forums: https://wordpress.org/support/topic/passing-

 I'm testing some code using PHPUnit, and when my code uses
 wp_die(new WP_Error('errorCode', 'errorMessage'));
 I get the error:
 Error: Wrong parameters for WPDieException([string $message [, long $code
 [, Throwable $previous = NULL]]])
 If I change my code to:
 Then it works correctly (I get WPDieException: errorMessage).

 The unit test `wp_die()` handler should accept the same things that the
 default `wp_die()` handler can.

Ticket URL: <https://core.trac.wordpress.org/ticket/36166>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list