Make WordPress Core

Changeset 41966


Ignore:
Timestamp:
10/21/2017 02:13:37 PM (8 years ago)
Author:
dd32
Message:

Tests: Return an exit code of 1 in the event that the database server for tests is unavailable.
This allows for automated scripts & test suites to handle the failure of the test suite easier.

Props danielbachhuber
Fixes #41916

Location:
trunk/tests/phpunit/includes
Files:
3 edited

Legend:

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

    r41636 r41966  
    6666$wp_theme_directories = array( DIR_TESTDATA . '/themedir1' );
    6767
    68 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite );
     68system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite, $retval );
     69if ( 0 !== $retval ) {
     70    exit( $retval );
     71}
    6972
    7073if ( $multisite ) {
  • trunk/tests/phpunit/includes/functions.php

    r40263 r41966  
    116116}
    117117
     118function _wp_die_handler_filter_exit() {
     119    return '_wp_die_handler_exit';
     120}
     121
    118122function _wp_die_handler_txt( $message, $title, $args ) {
    119123    echo "\nwp_die called\n";
     
    126130        }
    127131    }
     132}
     133
     134function _wp_die_handler_exit( $message, $title, $args ) {
     135    echo "\nwp_die called\n";
     136    echo "Message : $message\n";
     137    echo "Title : $title\n";
     138    if ( ! empty( $args ) ) {
     139        echo "Args: \n";
     140        foreach( $args as $k => $v ){
     141            echo "\t $k : $v\n";
     142        }
     143    }
     144    exit( 1 );
    128145}
    129146
  • trunk/tests/phpunit/includes/install.php

    r38908 r41966  
    2222
    2323$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
     24
     25tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
    2426
    2527require_once ABSPATH . '/wp-settings.php';
Note: See TracChangeset for help on using the changeset viewer.