Make WordPress Core


Ignore:
Timestamp:
06/21/2014 07:59:28 PM (11 years ago)
Author:
wonderboymusic
Message:

Allow wp_die() to die in plain text when running the test suite.

Props jorbin.
Fixes #27749.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r28523 r28797  
    7272
    7373class Basic_Subclass extends Basic_Object {}
     74
     75function _wp_die_handler( $message, $title = '', $args = array() ) {
     76    if ( !$GLOBALS['_wp_die_disabled'] ) {
     77        _wp_die_handler_txt( $message, $title, $args);
     78    } else {
     79        //Ignore at our peril
     80    }
     81}
     82
     83function _disable_wp_die() {
     84    $GLOBALS['_wp_die_disabled'] = true;
     85}
     86
     87function _enable_wp_die() {
     88    $GLOBALS['_wp_die_disabled'] = false;
     89}
     90
     91function _wp_die_handler_filter() {
     92    return '_wp_die_handler';
     93}
     94
     95function _wp_die_handler_txt( $message, $title, $args ) {
     96    echo "\nwp_die called\n";
     97    echo "Message : $message\n";
     98    echo "Title : $title\n";
     99    if ( ! empty( $args ) ) {
     100        echo "Args: \n";
     101        foreach( $args as $k => $v ){
     102            echo "\t $k : $v\n";
     103        }
     104    }
     105}
Note: See TracChangeset for help on using the changeset viewer.