Make WordPress Core


Ignore:
Timestamp:
02/21/2020 01:05:39 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Fix the Travis CI build for the 3.8 branch.

Among other fixes, this backports [26871], [26909-26910], [26940], [27086], [27168], [28799], [28873], [28943], [28961], [28964], [28966-28967], [29120], [29251], [29503], [29860], [29869], [29954], [30001], [30160], [30282], [30285], [30289-30291], [30513-30514], [30516-30521], [30524], [30526], [30529-30530], [31253-31254], [31257-31259], [31622], [40241], [40255], [40257], [40259], [40269], [40271], [40446], [40449], [40457], [40604], [40538], [40833], [41082], [41303], [41306], [44993].

See #49485.

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

  • branches/3.8/tests/phpunit/includes/bootstrap.php

    r25415 r47338  
    9696 * A child class of the PHP test runner.
    9797 *
    98  * Not actually used as a runner. Rather, used to access the protected
    99  * longOptions property, to parse the arguments passed to the script.
     98 * Used to access the protected longOptions property, to parse the arguments
     99 * passed to the script.
    100100 *
    101101 * If it is determined that phpunit was called with a --group that corresponds
     
    106106 * how you call phpunit has no effect.
    107107 */
    108 class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command {
     108class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
     109    protected $longOptions = array(
     110      'exclude-group=',
     111      'group=',
     112    );
    109113    function __construct( $argv ) {
    110         $options = PHPUnit_Util_Getopt::getopt(
    111             $argv,
    112             'd:c:hv',
    113             array_keys( $this->longOptions )
    114         );
     114        array_shift( $argv );
     115        $options = array();
     116        while ( list( $i, $arg ) = each( $argv ) ) {
     117            try {
     118                if ( strlen( $arg ) > 1 && $arg[0] === '-' && $arg[1] === '-' ) {
     119                    PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );
     120                }
     121            }
     122            catch ( PHPUnit_Framework_Exception $e ) {
     123                // Enforcing recognized arguments or correctly formed arguments is
     124                // not really the concern here.
     125                continue;
     126            }
     127        }
     128
    115129        $ajax_message = true;
    116         foreach ( $options[0] as $option ) {
     130        foreach ( $options as $option ) {
    117131            switch ( $option[0] ) {
    118132                case '--exclude-group' :
     
    122136                    $groups = explode( ',', $option[1] );
    123137                    foreach ( $groups as $group ) {
    124                         if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) )
     138                        if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) {
    125139                            WP_UnitTestCase::forceTicket( $group );
     140                        }
    126141                    }
    127142                    $ajax_message = ! in_array( 'ajax', $groups );
     
    129144            }
    130145        }
    131         if ( $ajax_message )
     146        if ( $ajax_message ) {
    132147            echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
     148        }
    133149    }
    134150}
    135 new WP_PHPUnit_TextUI_Command( $_SERVER['argv'] );
     151new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
Note: See TracChangeset for help on using the changeset viewer.