Changeset 28797
- Timestamp:
- 06/21/2014 07:59:28 PM (10 years ago)
- Location:
- trunk/tests/phpunit/includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r26871 r28797 48 48 // Override the PHPMailer 49 49 require_once( dirname( __FILE__ ) . '/mock-mailer.php' ); 50 $phpmailer = new MockPHPMailer(); 50 $phpmailer = new MockPHPMailer(); 51 51 52 52 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite ); … … 67 67 68 68 require_once dirname( __FILE__ ) . '/functions.php'; 69 70 $GLOBALS['_wp_die_disabled'] = false; 71 // Allow tests to override wp_die 72 tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter' ); 69 73 70 74 // Preset WordPress options defined in bootstrap file. -
trunk/tests/phpunit/includes/functions.php
r28523 r28797 72 72 73 73 class Basic_Subclass extends Basic_Object {} 74 75 function _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 83 function _disable_wp_die() { 84 $GLOBALS['_wp_die_disabled'] = true; 85 } 86 87 function _enable_wp_die() { 88 $GLOBALS['_wp_die_disabled'] = false; 89 } 90 91 function _wp_die_handler_filter() { 92 return '_wp_die_handler'; 93 } 94 95 function _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 } -
trunk/tests/phpunit/includes/utils.php
r26187 r28797 303 303 } 304 304 305 $GLOBALS['_wp_die_disabled'] = false;306 function _wp_die_handler( $message, $title = '', $args = array() ) {307 if ( !$GLOBALS['_wp_die_disabled'] ) {308 _default_wp_die_handler( $message, $title, $args );309 } else {310 //Ignore at our peril311 }312 }313 314 function _disable_wp_die() {315 $GLOBALS['_wp_die_disabled'] = true;316 }317 318 function _enable_wp_die() {319 $GLOBALS['_wp_die_disabled'] = false;320 }321 322 function _wp_die_handler_filter() {323 return '_wp_die_handler';324 }325 326 305 if ( !function_exists( 'str_getcsv' ) ) { 327 306 function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
Note: See TracChangeset
for help on using the changeset viewer.