WordPress.org

Make WordPress Core

Changeset 937 in tests


Ignore:
Timestamp:
07/26/2012 09:19:52 PM (6 years ago)
Author:
nacin
Message:

Push ajax group and multisite configuration notices to the top of the script, rather than as notices at the bottom. fixes #112.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootstrap.php

    r927 r937  
    4646
    4747if ( $multisite ) {
     48    echo "Running as multisite…" . PHP_EOL;
    4849    define( 'MULTISITE', true );
    4950    define( 'SUBDOMAIN_INSTALL', false );
     
    5455    $GLOBALS['base'] = '/';
    5556} else {
    56     register_shutdown_function( array( 'WP_PHPUnit_TextUI_Command', 'multisiteWasNotRun' ) );
     57    echo "Running as single site… To run multisite, use -c multisite." . PHP_EOL;
    5758}
    5859unset( $multisite );
     
    105106            array_keys( $this->longOptions )
    106107        );
    107         if ( empty( $options[0] ) ) {
    108             register_shutdown_function( array( __CLASS__, 'ajaxTestsWereNotRun' ) );
    109             return;
    110         }
     108        $ajax_message = true;
    111109        foreach ( $options[0] as $option ) {
    112             if ( $option[0] !== '--group' )
    113                 continue;
    114             $groups = explode( ',', $option[1] );
    115             foreach ( $groups as $group ) {
    116                 if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) )
    117                     WP_UnitTestCase::forceTicket( $group );
     110            switch ( $option[0] ) {
     111                case '--exclude-group' :
     112                    $ajax_message = false;
     113                    continue 2;
     114                case '--group' :
     115                    $groups = explode( ',', $option[1] );
     116                    foreach ( $groups as $group ) {
     117                        if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) )
     118                            WP_UnitTestCase::forceTicket( $group );
     119                    }
     120                    $ajax_message = ! in_array( 'ajax', $groups );
     121                    continue 2;
    118122            }
    119123        }
     124        if ( $ajax_message )
     125            echo "Not running ajax tests… To execute these, use --group ajax." . PHP_EOL;
    120126    }
    121 
    122     static function ajaxTestsWereNotRun() {
    123         echo PHP_EOL . "\x1b[0m\x1b[30;43m\x1b[2K";
    124         echo 'INFO: By default, Ajax tests are not run. To execute these, use `phpunit --group ajax`' . PHP_EOL;
    125         echo "\x1b[0m\x1b[2K";
    126     }
    127 
    128     static function multisiteWasNotRun() {
    129         echo PHP_EOL . "\x1b[0m\x1b[30;43m\x1b[2K";
    130         echo 'INFO: To run the tests using multisite, use `phpunit -c multisite`' . PHP_EOL;
    131         echo "\x1b[0m\x1b[2K";
    132     }
    133127}
    134128new WP_PHPUnit_TextUI_Command( $_SERVER['argv'] );
Note: See TracChangeset for help on using the changeset viewer.