Changeset 47338 for branches/3.8/tests/phpunit/includes/bootstrap.php
- Timestamp:
- 02/21/2020 01:05:39 PM (5 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
-
branches/3.8/tests/phpunit/includes/bootstrap.php
r25415 r47338 96 96 * A child class of the PHP test runner. 97 97 * 98 * Not actually used as a runner. Rather, used to access the protected99 * longOptions property, to parse the argumentspassed to the script.98 * Used to access the protected longOptions property, to parse the arguments 99 * passed to the script. 100 100 * 101 101 * If it is determined that phpunit was called with a --group that corresponds … … 106 106 * how you call phpunit has no effect. 107 107 */ 108 class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command { 108 class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt { 109 protected $longOptions = array( 110 'exclude-group=', 111 'group=', 112 ); 109 113 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 115 129 $ajax_message = true; 116 foreach ( $options [0]as $option ) {130 foreach ( $options as $option ) { 117 131 switch ( $option[0] ) { 118 132 case '--exclude-group' : … … 122 136 $groups = explode( ',', $option[1] ); 123 137 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 ) ) { 125 139 WP_UnitTestCase::forceTicket( $group ); 140 } 126 141 } 127 142 $ajax_message = ! in_array( 'ajax', $groups ); … … 129 144 } 130 145 } 131 if ( $ajax_message ) 146 if ( $ajax_message ) { 132 147 echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL; 148 } 133 149 } 134 150 } 135 new WP_PHPUnit_ TextUI_Command( $_SERVER['argv'] );151 new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
Note: See TracChangeset
for help on using the changeset viewer.