[wp-trac] [WordPress Trac] #36166: wp_die() doesn't accept a WP_Error during unit testing
WordPress Trac
noreply at wordpress.org
Wed Mar 23 00:17:13 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 | Resolution:
Keywords: has-patch | Focuses:
------------------------------+------------------------------
Comment (by dd32):
To test it, I simply added that example to the functions.php unit tests:
{{{
+ function test_wp_die_with_wp_error() {
+ wp_die( new WP_Error( 'test', 'test' ) );
+ }
}}}
and got the fatal error as stated.
It turns out that the Ajax wp_die() handler handles it correctly, but the
`WP_UnitTest` wp_die handler doesn't:
https://core.trac.wordpress.org/browser/tags/4.4.2/tests/phpunit/includes/testcase.php#L274
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36166#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list