You appear to be a bot. Output may be restricted
Description
Handler for wp_die().
Save the output for analysis, stop execution by throwing an exception. Error conditions (no output, just die) will throw <code>WPAjaxDieStopException( $message )</code>. You can test for this with: <code> $this->expectException( 'WPAjaxDieStopException' ); $this->expectExceptionMessage( 'something contained in $message' ); </code> Normal program termination (wp_die called at the end of output) will throw <code>WPAjaxDieContinueException( $message )</code>. You can test for this with: <code> $this->expectException( 'WPAjaxDieContinueException' ); $this->expectExceptionMessage( 'something contained in $message' ); </code>
Usage
WP_Ajax_UnitTestCase::dieHandler( $message );
Parameters
- $message
- ( string ) required – The message to set.
Returns
void
Source
File name: wordpress-develop-tests/phpunit/includes/testcase-ajax.php
Lines:
public function dieHandler( $message ) { $this->_last_response .= ob_get_clean(); if ( '' === $this->_last_response ) { if ( is_scalar( $message ) ) { throw new WPAjaxDieStopException( (string) $message ); } else { throw new WPAjaxDieStopException( '0' ); } } else { throw new WPAjaxDieContinueException( $message ); } }