Ticket #26725: wordpress-test-boostrap-argument-exception-fix.patch
File wordpress-test-boostrap-argument-exception-fix.patch, 1.8 KB (added by , 11 years ago) |
---|
-
includes/bootstrap.php
87 87 /** 88 88 * A child class of the PHP test runner. 89 89 * 90 * Not actually used as a runner. Rather, used to access the protected91 * longOptions property, to parse the argumentspassed to the script.90 * Used to access the protected longOptions property, to parse the arguments 91 * passed to the script. 92 92 * 93 93 * If it is determined that phpunit was called with a --group that corresponds 94 94 * to an @ticket annotation (such as `phpunit --group 12345` for bugs marked … … 97 97 * If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then 98 98 * how you call phpunit has no effect. 99 99 */ 100 class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command { 100 class WP_HPUnit_Util_Getopt extends PHPUnit_Util_Getopt { 101 protected $longOptions = array( 102 'exclude-group=', 103 'group=', 104 ); 101 105 function __construct( $argv ) { 102 $options = PHPUnit_Util_Getopt::getopt( 103 $argv, 104 'd:c:hv', 105 array_keys( $this->longOptions ) 106 ); 106 $options = array(); 107 while ( list( $i, $arg ) = each( $argv ) ) { 108 try { 109 if ( strlen( $arg ) > 1 && $arg[1] == '-') { 110 PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv ); 111 } 112 } 113 catch ( PHPUnit_Framework_Exception $e ) { 114 // Enforcing recognized arguments or correctly formed arguments is 115 // not really the concern here. 116 continue; 117 } 118 } 107 119 $ajax_message = true; 108 120 foreach ( $options[0] as $option ) { 109 121 switch ( $option[0] ) { … … 124 136 echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL; 125 137 } 126 138 } 127 new WP_ PHPUnit_TextUI_Command( $_SERVER['argv'] );139 new WP_HPUnit_Util_Getopt( $_SERVER['argv'] );