[wp-trac] [WordPress Trac] #11892: replace die() and exit() with a pluggable wp_exit(); function
WordPress Trac
wp-trac at lists.automattic.com
Sun Jan 17 02:51:57 UTC 2010
#11892: replace die() and exit() with a pluggable wp_exit(); function
--------------------------+-------------------------------------------------
Reporter: hakre | Owner: westi
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Unit Tests | Version: 3.0
Severity: blocker | Keywords:
--------------------------+-------------------------------------------------
Comment(by hakre):
Replying to [comment:1 Denis-de-Bernardy]:
> The issue here is that, if it calls die, it's not really meant to
continue running the actual code. Wouldn't this make the test suit break?
Yes, that's the problem, the command to die() exits the testsuite and
breaks it.
----
Replying to [comment:2 ramenboy]:
> You could throw an exception from a hook to abort the function without
terminating execution (assuming you write your tests in PHP5).
Yes that's what I wanted to do in the plugable / hooked function
wp_exit(); in testing then. So we can even write tests that test for dying
by testing for such a special exception. And afaik PHPUnit can deal with
exceptions pretty well.
----
Replying to [comment:3 dd32]:
> What functions can you not test due to this?
{{{php wp-test.php -t WPTestUserCapabilities}}}
One of the tests results in the call of wp_die() which outputs a message
and dies then (You can't give users that role.).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11892#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list